mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2025-02-06 04:34:29 +08:00
cpu Affinity
This commit is contained in:
parent
faec463478
commit
d8dbbc5fbd
@ -526,11 +526,32 @@ class HomeUIModel extends BaseUIModel {
|
|||||||
return (map["status"] == "ok" || map["status"] == "operational");
|
return (map["status"] == "ok" || map["status"] == "operational");
|
||||||
}
|
}
|
||||||
|
|
||||||
doLaunchGame(String launchExe, List<String> args, String installPath) async {
|
doLaunchGame(String launchExe, List<String> args, String installPath,
|
||||||
|
int? processorAffinity) async {
|
||||||
_isGameRunning[installPath] = true;
|
_isGameRunning[installPath] = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
try {
|
try {
|
||||||
await Process.run(launchExe, args);
|
if (processorAffinity == null) {
|
||||||
|
ProcessResult result = await Process.run(launchExe, args);
|
||||||
|
dPrint('Exit code: ${result.exitCode}');
|
||||||
|
dPrint('stdout: ${result.stdout}');
|
||||||
|
dPrint('stderr: ${result.stderr}');
|
||||||
|
} else {
|
||||||
|
ProcessResult result = await Process.run("cmd.exe", [
|
||||||
|
'/C',
|
||||||
|
'Start',
|
||||||
|
'"StarCitizen"',
|
||||||
|
'/High',
|
||||||
|
'/Affinity',
|
||||||
|
'$processorAffinity',
|
||||||
|
launchExe,
|
||||||
|
...args
|
||||||
|
]);
|
||||||
|
dPrint('Exit code: ${result.exitCode}');
|
||||||
|
dPrint('stdout: ${result.stdout}');
|
||||||
|
dPrint('stderr: ${result.stderr}');
|
||||||
|
}
|
||||||
|
|
||||||
final launchFile = File("$installPath\\loginData.json");
|
final launchFile = File("$installPath\\loginData.json");
|
||||||
if (await launchFile.exists()) {
|
if (await launchFile.exists()) {
|
||||||
await launchFile.delete();
|
await launchFile.delete();
|
||||||
|
@ -228,11 +228,13 @@ class LoginDialogModel extends BaseUIModel {
|
|||||||
await SystemHelper.getCpuAffinity(inputGameLaunchECore);
|
await SystemHelper.getCpuAffinity(inputGameLaunchECore);
|
||||||
|
|
||||||
// TODO 更新启动方式
|
// TODO 更新启动方式
|
||||||
|
|
||||||
homeUIModel.doLaunchGame(
|
homeUIModel.doLaunchGame(
|
||||||
'$installPath\\$executable',
|
'$installPath\\$executable',
|
||||||
["-no_login_dialog", ...launchOptions.toString().split(" ")],
|
["-no_login_dialog", ...launchOptions.toString().split(" ")],
|
||||||
installPath);
|
installPath,
|
||||||
|
processorAffinity);
|
||||||
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
|
Navigator.pop(context!);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getChannelID() {
|
String getChannelID() {
|
||||||
|
@ -19,7 +19,7 @@ class SettingUI extends BaseUI<SettingUIModel> {
|
|||||||
onTap: model.onResetAutoLogin),
|
onTap: model.onResetAutoLogin),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
makeSettingsItem(const Icon(FontAwesomeIcons.microchip),
|
makeSettingsItem(const Icon(FontAwesomeIcons.microchip),
|
||||||
"启动游戏时忽略能效核心( 适用于Intel 12 ~ 14th处理器 )",
|
"启动游戏时忽略能效核心( 适用于Intel 12+ 处理器 )",
|
||||||
subTitle:
|
subTitle:
|
||||||
"已设置的核心数量:${model.inputGameLaunchECore} ( 设置需要忽略的处理器的能效心数量,盒子将在使用启动游戏功能时为您修改游戏所运行的CPU参数,当为 0 时不启用此功能 )",
|
"已设置的核心数量:${model.inputGameLaunchECore} ( 设置需要忽略的处理器的能效心数量,盒子将在使用启动游戏功能时为您修改游戏所运行的CPU参数,当为 0 时不启用此功能 )",
|
||||||
onTap: model.setGameLaunchECore),
|
onTap: model.setGameLaunchECore),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user