diff --git a/assets/performance.json b/assets/performance.json index 2cbcc39..91ddc59 100644 --- a/assets/performance.json +++ b/assets/performance.json @@ -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": "自定义" } ] \ No newline at end of file diff --git a/lib/ui/home/performance/performance_ui.dart b/lib/ui/home/performance/performance_ui.dart index 266ff68..a7ba3ba 100644 --- a/lib/ui/home/performance/performance_ui.dart +++ b/lib/ui/home/performance/performance_ui.dart @@ -161,6 +161,7 @@ class PerformanceUI extends BaseUI { } 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 { }, ) ], + ) + 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), diff --git a/lib/ui/home/performance/performance_ui_model.dart b/lib/ui/home/performance/performance_ui_model.dart index c3705e4..d532dc4 100644 --- a/lib/ui/home/performance/performance_ui_model.dart +++ b/lib/ui/home/performance/performance_ui_model.dart @@ -13,8 +13,12 @@ class PerformanceUIModel extends BaseUIModel { PerformanceUIModel(this.scPath); + TextEditingController customizeCtrl = TextEditingController(); + Map>? performanceMap; + List 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(); }