mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 00:33:42 +08:00
能效核心屏蔽功能应用到 RSI启动器,以让开发板使用此功能。
This commit is contained in:
parent
06c581cd80
commit
4f6623a4cd
@ -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;
|
||||
|
@ -31,14 +31,19 @@ class AppUI extends BaseUI {
|
||||
restorationScopeId: "Doctor",
|
||||
themeMode: ThemeMode.dark,
|
||||
theme: FluentThemeData(
|
||||
brightness: Brightness.dark,
|
||||
fontFamily: "SourceHanSansCN-Regular",
|
||||
navigationPaneTheme: NavigationPaneThemeData(
|
||||
backgroundColor: AppConf.colorBackground,
|
||||
),
|
||||
menuColor: AppConf.colorMenu,
|
||||
micaBackgroundColor: AppConf.colorMica,
|
||||
),
|
||||
brightness: Brightness.dark,
|
||||
fontFamily: "SourceHanSansCN-Regular",
|
||||
navigationPaneTheme: NavigationPaneThemeData(
|
||||
backgroundColor: AppConf.colorBackground,
|
||||
),
|
||||
menuColor: AppConf.colorMenu,
|
||||
micaBackgroundColor: AppConf.colorMica,
|
||||
buttonTheme: ButtonThemeData(
|
||||
defaultButtonStyle: ButtonStyle(
|
||||
shape: ButtonState.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
side: BorderSide(color: Colors.white.withOpacity(.01)))),
|
||||
))),
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: BaseUIContainer(
|
||||
uiCreate: () => IndexUI(), modelCreate: () => IndexUIModel()),
|
||||
|
@ -537,7 +537,7 @@ class HomeUIModel extends BaseUIModel {
|
||||
dPrint('stdout: ${result.stdout}');
|
||||
dPrint('stderr: ${result.stderr}');
|
||||
} else {
|
||||
dPrint("set Affinity === $processorAffinity ");
|
||||
dPrint("set Affinity === $processorAffinity launchExe === $launchExe");
|
||||
ProcessResult result = await Process.run("cmd.exe", [
|
||||
'/C',
|
||||
'Start',
|
||||
|
@ -220,14 +220,9 @@ class LoginDialogModel extends BaseUIModel {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
final confBox = await Hive.openBox("app_conf");
|
||||
final inputGameLaunchECore = int.tryParse(
|
||||
confBox.get("gameLaunch_eCore_count", defaultValue: "0")) ??
|
||||
0;
|
||||
final processorAffinity =
|
||||
await SystemHelper.getCpuAffinity(inputGameLaunchECore);
|
||||
await SystemHelper.getCpuAffinity();
|
||||
|
||||
// TODO 更新启动方式
|
||||
homeUIModel.doLaunchGame(
|
||||
'$installPath\\$executable',
|
||||
["-no_login_dialog", ...launchOptions.toString().split(" ")],
|
||||
|
@ -17,14 +17,14 @@ class SettingUI extends BaseUI<SettingUIModel> {
|
||||
subTitle:
|
||||
"启用:${model.isEnableAutoLogin ? "已启用" : "已禁用"} 设备支持:${model.isDeviceSupportWinHello ? "支持" : "不支持"} 邮箱:${model.autoLoginEmail} 密码:${model.isEnableAutoLoginPwd ? "已加密保存" : "未保存"}",
|
||||
onTap: model.onResetAutoLogin),
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(const Icon(FontAwesomeIcons.microchip),
|
||||
"启动游戏时忽略能效核心( 适用于Intel 12th+ 处理器 ) [实验性功能,请随时反馈]",
|
||||
subTitle:
|
||||
"已设置的核心数量:${model.inputGameLaunchECore} ( 设置需要忽略的处理器的能效心数量,盒子将在使用启动游戏功能时为您修改游戏所运行的CPU参数,当为 0 时不启用此功能 )",
|
||||
onTap: model.setGameLaunchECore),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(const Icon(FontAwesomeIcons.microchip),
|
||||
"启动游戏时忽略能效核心( 适用于Intel 12th+ 处理器 ) [实验性功能,请随时反馈]",
|
||||
subTitle:
|
||||
"已设置的核心数量:${model.inputGameLaunchECore} (此功能适用于首页的盒子一键启动 或 工具中的RSI启动器管理员模式,当为 0 时不启用此功能 )",
|
||||
onTap: model.setGameLaunchECore),
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(
|
||||
const Icon(FluentIcons.folder_open), "设置启动器文件(RSI Launcher.exe)",
|
||||
subTitle: model.customLauncherPath != null
|
||||
|
@ -56,7 +56,8 @@ class SettingUIModel extends BaseUIModel {
|
||||
userBox.get("gameLaunch_eCore_count", defaultValue: "0");
|
||||
final input = await showInputDialogs(context!,
|
||||
title: "请输入要忽略的 CPU 核心数",
|
||||
content: "tip:您的设备拥有几个能效核心就输入几,非大小核设备请保持0",
|
||||
content:
|
||||
"Tip:您的设备拥有几个能效核心就输入几,非大小核设备请保持 0\n\n此功能适用于首页的盒子一键启动 或 工具中的 RSI启动器管理员模式,当为 0 时不启用此功能。",
|
||||
initialValue: defaultInput,
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly]);
|
||||
if (input == null) return;
|
||||
|
@ -68,7 +68,7 @@ class ToolsUIModel extends BaseUIModel {
|
||||
_ToolsItemData(
|
||||
"rsilauncher_admin_mode",
|
||||
"RSI Launcher 管理员模式",
|
||||
"在某些情况下 RSI启动器 无法正确获得管理员权限,您可尝试使用该功能以管理员模式运行启动器。",
|
||||
"以管理员身份运行RSI启动器,可能会解决一些问题。\n\n若设置了能效核心屏蔽参数,也会在此应用。",
|
||||
const Icon(FluentIcons.admin, size: 28),
|
||||
onTap: _adminRSILauncher,
|
||||
)
|
||||
|
@ -32,7 +32,7 @@ dependencies:
|
||||
sdk: flutter
|
||||
flutter_riverpod: ^2.3.6
|
||||
window_manager: ^0.3.2
|
||||
fluent_ui: ^4.7.4
|
||||
fluent_ui: ^4.8.1
|
||||
flutter_staggered_grid_view: ^0.7.0
|
||||
flutter_acrylic: ^1.1.0
|
||||
url_launcher: ^6.1.10
|
||||
|
Loading…
Reference in New Issue
Block a user