feat: unp4kTools extract_memory

This commit is contained in:
2024-04-27 16:23:57 +08:00
parent 9bdccc3bbf
commit a7e1d8d0b7
9 changed files with 41 additions and 32 deletions

View File

@ -223,4 +223,23 @@ class Unp4kCModel extends _$Unp4kCModel {
rsPid: _rsPid!, data: "$mode<:,:>$filePath<:,:>$outputPath\n");
}
}
static Future<Uint8List> unp4kTools(
String applicationBinaryModuleDir, List<String> args) async {
await BinaryModuleConf.extractModule(
["unp4kc"], applicationBinaryModuleDir);
final execDir = "$applicationBinaryModuleDir\\unp4kc";
final exec = "$execDir\\unp4kc.exe";
final r = await Process.run(exec, args);
if (r.exitCode != 0) {
throw Exception(
"error: ${r.exitCode} , info= ${r.stdout} , err= ${r.stderr}");
}
final eventJson = await compute(json.decode, r.stdout.toString());
if (eventJson["action"] == "data: Uint8List") {
final data = eventJson["data"];
return Uint8List.fromList((data as List).cast<int>());
}
throw Exception("error: data error");
}
}

View File

@ -6,7 +6,7 @@ part of 'unp4kc.dart';
// RiverpodGenerator
// **************************************************************************
String _$unp4kCModelHash() => r'0f1bff187bbc4e043405f60e95c08af6e1159b57';
String _$unp4kCModelHash() => r'69117c5857797683e2d080da9238bfecc5948898';
/// See also [Unp4kCModel].
@ProviderFor(Unp4kCModel)