feat: unp4k update

This commit is contained in:
xkeyC
2025-12-10 21:04:47 +08:00
parent c172b623d7
commit 23e909e330
7 changed files with 114 additions and 111 deletions

View File

@@ -8,7 +8,7 @@ import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
part 'unp4k_api.freezed.dart';
// These functions are ignored because they are not marked as `pub`: `dos_datetime_to_millis`, `ensure_files_loaded`
// These functions are ignored because they are not marked as `pub`: `dos_datetime_to_millis`, `ensure_files_loaded`, `p4k_get_entry`
/// 打开 P4K 文件(仅打开,不读取文件列表)
Future<void> p4KOpen({required String p4KPath}) =>

View File

@@ -399,10 +399,10 @@ class Unp4kCModel extends _$Unp4kCModel {
dPrint("extractFile .... $filePath -> $fullOutputPath");
// 使用 Rust API 提取到磁盘
await unp4k_api.p4KExtractToDisk(filePath: filePath, outputPath: fullOutputPath);
await unp4k_api.p4KExtractToDisk(filePath: filePath, outputPath: outputPath);
if (mode == "extract_open") {
const textExt = [".txt", ".xml", ".json", ".lua", ".cfg", ".ini"];
const textExt = [".txt", ".xml", ".json", ".lua", ".cfg", ".ini", ".mtl"];
const imgExt = [".png"];
String openType = "unknown";
for (var element in textExt) {
@@ -475,9 +475,7 @@ class Unp4kCModel extends _$Unp4kCModel {
current++;
onProgress?.call(current, total, entryPath);
final fullOutputPath = "$outputDir\\$entryPath";
await unp4k_api.p4KExtractToDisk(filePath: entryPath, outputPath: fullOutputPath);
await unp4k_api.p4KExtractToDisk(filePath: entryPath, outputPath: outputDir);
}
state = state.copyWith(endMessage: S.current.tools_unp4k_extract_completed(current));
@@ -493,8 +491,7 @@ class Unp4kCModel extends _$Unp4kCModel {
return (false, 0, S.current.tools_unp4k_extract_cancelled);
}
final fullOutputPath = "$outputDir\\$filePath";
await unp4k_api.p4KExtractToDisk(filePath: filePath, outputPath: fullOutputPath);
await unp4k_api.p4KExtractToDisk(filePath: filePath, outputPath: outputDir);
state = state.copyWith(endMessage: S.current.tools_unp4k_extract_completed(1));
return (true, 1, null);
@@ -609,9 +606,7 @@ class Unp4kCModel extends _$Unp4kCModel {
current++;
onProgress?.call(current, total, extractPath);
final fullOutputPath = "$outputDir\\$extractPath";
await unp4k_api.p4KExtractToDisk(filePath: extractPath, outputPath: fullOutputPath);
await unp4k_api.p4KExtractToDisk(filePath: extractPath, outputPath: outputDir);
}
state = state.copyWith(endMessage: S.current.tools_unp4k_extract_completed(current));

View File

@@ -50,7 +50,7 @@ final class ToolsLogAnalyzeProvider
}
}
String _$toolsLogAnalyzeHash() => r'f5079c7d35daf25b07f83bacb224484171e9c93f';
String _$toolsLogAnalyzeHash() => r'4c1aea03394e5c5641b2eb40a31d37892bb978bf';
final class ToolsLogAnalyzeFamily extends $Family
with