能效核心屏蔽功能应用到 RSI启动器,以让开发板使用此功能。

This commit is contained in:
2023-11-28 20:04:15 +08:00
parent 06c581cd80
commit 4f6623a4cd
8 changed files with 45 additions and 33 deletions

View File

@ -130,14 +130,21 @@ class SystemHelper {
// check running and kill
await killRSILauncher();
// launch
final r = await Process.run(powershellPath, [
'Start-Process',
"'$path'",
'-Verb RunAs',
]);
final processorAffinity = await SystemHelper.getCpuAffinity();
if (processorAffinity == null) {
Process.run(path, []);
} else {
Process.run("cmd.exe", [
'/C',
'Start',
'""',
'/High',
'/Affinity',
processorAffinity,
path,
]);
}
dPrint(path);
dPrint(r.stdout);
dPrint(r.stderr);
}
static Future<int> getSystemMemorySizeGB() async {
@ -218,7 +225,11 @@ foreach ($adapter in $adapterMemory) {
return int.tryParse(cpuNumberResult.stdout.toString().trim()) ?? 0;
}
static Future<String?> getCpuAffinity(int eCoreCount) async {
static Future<String?> getCpuAffinity() async {
final confBox = await Hive.openBox("app_conf");
final eCoreCount = int.tryParse(
confBox.get("gameLaunch_eCore_count", defaultValue: "0")) ??
0;
final cpuNumber = await getNumberOfLogicalProcessors();
if (cpuNumber == 0 || eCoreCount == 0 || eCoreCount > cpuNumber) {
return null;