mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 00:33:42 +08:00
https://github.com/StarCitizenToolBox/app/issues/1 性能优化,新增q_ShaderPostProcess sys_maxFps,支持自定义配置
This commit is contained in:
parent
a442823bfe
commit
9ddce61b49
@ -139,6 +139,16 @@
|
||||
"value": 2,
|
||||
"group": "图形(修改后建议清理着色器)"
|
||||
},
|
||||
{
|
||||
"key": "q_ShaderPostProcess",
|
||||
"name": "着色器质量",
|
||||
"info": "",
|
||||
"type": "int",
|
||||
"max": 3,
|
||||
"min": 0,
|
||||
"value": 3,
|
||||
"group": "图形(修改后建议清理着色器)"
|
||||
},
|
||||
{
|
||||
"key": "q_ShaderFX",
|
||||
"name": "FX 质量",
|
||||
@ -239,6 +249,16 @@
|
||||
"value": 1,
|
||||
"group": "设置"
|
||||
},
|
||||
{
|
||||
"key": "sys_maxFps",
|
||||
"name": "最大帧率",
|
||||
"info": "调整游戏最高帧率,0为不限制",
|
||||
"type": "int",
|
||||
"max": 300,
|
||||
"min": 0,
|
||||
"value": 0,
|
||||
"group": "设置"
|
||||
},
|
||||
{
|
||||
"key": "r_DisplaySessionInfo",
|
||||
"name": "显示会话信息",
|
||||
@ -288,5 +308,15 @@
|
||||
"min": 0,
|
||||
"value": 1,
|
||||
"group": "设置"
|
||||
},
|
||||
{
|
||||
"key": "customize",
|
||||
"name": "自定义参数",
|
||||
"info": "",
|
||||
"type": "customize",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"value": 1,
|
||||
"group": "自定义"
|
||||
}
|
||||
]
|
@ -161,6 +161,7 @@ class PerformanceUI extends BaseUI<PerformanceUIModel> {
|
||||
}
|
||||
|
||||
Widget makeItem(GamePerformanceData item) {
|
||||
final model = ref.watch(provider);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 8),
|
||||
child: Column(
|
||||
@ -225,6 +226,13 @@ class PerformanceUI extends BaseUI<PerformanceUIModel> {
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
else if (item.type == "customize")
|
||||
TextFormBox(
|
||||
maxLines: 10,
|
||||
placeholder:
|
||||
"您可以在这里输入未收录进盒子的自定义参数。配置示例:\n\nr_displayinfo=0\nr_VSync=0",
|
||||
controller: model.customizeCtrl,
|
||||
),
|
||||
if (item.info != null && item.info!.isNotEmpty) ...[
|
||||
const SizedBox(height: 12),
|
||||
|
@ -13,8 +13,12 @@ class PerformanceUIModel extends BaseUIModel {
|
||||
|
||||
PerformanceUIModel(this.scPath);
|
||||
|
||||
TextEditingController customizeCtrl = TextEditingController();
|
||||
|
||||
Map<String?, List<GamePerformanceData>>? performanceMap;
|
||||
|
||||
List<String> inAppKeys = [];
|
||||
|
||||
String workingString = "";
|
||||
|
||||
late final confFile = File("$scPath\\USER.cfg");
|
||||
@ -26,6 +30,8 @@ class PerformanceUIModel extends BaseUIModel {
|
||||
|
||||
@override
|
||||
Future loadData() async {
|
||||
customizeCtrl.clear();
|
||||
inAppKeys.clear();
|
||||
final String jsonString =
|
||||
await rootBundle.loadString('assets/performance.json');
|
||||
final list = json.decode(jsonString);
|
||||
@ -34,6 +40,9 @@ class PerformanceUIModel extends BaseUIModel {
|
||||
performanceMap = {};
|
||||
for (var element in list) {
|
||||
final item = GamePerformanceData.fromJson(element);
|
||||
if (item.key != "customize") {
|
||||
inAppKeys.add(item.key ?? "");
|
||||
}
|
||||
performanceMap?[item.group] ??= [];
|
||||
performanceMap?[item.group]?.add(item);
|
||||
}
|
||||
@ -101,7 +110,19 @@ class PerformanceUIModel extends BaseUIModel {
|
||||
String conf = "";
|
||||
for (var v in performanceMap!.entries) {
|
||||
for (var c in v.value) {
|
||||
conf = "$conf${c.key} = ${c.value}\n";
|
||||
if (c.key != "customize") {
|
||||
conf = "$conf${c.key}=${c.value}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (customizeCtrl.text.trim().isNotEmpty) {
|
||||
final lines = customizeCtrl.text.split("\n");
|
||||
for (var value in lines) {
|
||||
final sp = value.split("=");
|
||||
// 忽略无效的配置文件
|
||||
if (sp.length == 2) {
|
||||
conf = "$conf${sp[0].trim()}=${sp[1].trim()}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
workingString = "写出配置文件";
|
||||
@ -153,6 +174,10 @@ class PerformanceUIModel extends BaseUIModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (kv.length == 2 && !inAppKeys.contains(kv[0].trim())) {
|
||||
customizeCtrl.text =
|
||||
"${customizeCtrl.text}${kv[0].trim()}=${kv[1].trim()}\n";
|
||||
}
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user