feat: Add OpenXR setting, track default values, and optimize config file writing by skipping default entries.

This commit is contained in:
xkeyC
2025-12-12 10:06:21 +08:00
parent 3fd020b8b0
commit 138be64c0d
11 changed files with 417 additions and 337 deletions

View File

@@ -1,335 +1,344 @@
import 'package:starcitizen_doctor/generated/l10n.dart';
List get performanceUIConfJsonData => [
{
"key": "r_ssdo",
"name": S.current.performance_json_text_ssdo,
"info": S.current.performance_json_text_ssdo_info,
"type": "int",
"max": 2,
"min": 0,
"value": 1,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "r_DepthOfField",
"name": S.current.performance_json_text_dof,
"info": S.current.performance_json_text_dof_info,
"type": "int",
"max": 2,
"min": 0,
"value": 1,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "r_AntialiasingMode",
"name": S.current.performance_json_text_antialiasing,
"info": S.current.performance_json_text_antialiasing_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "sys_spec_gameeffects",
"name": S.current.performance_json_text_game_effects,
"info": S.current.performance_json_text_game_effects_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "sys_spec_texture",
"name": S.current.performance_json_text_texture,
"info": S.current.performance_json_text_texture_info,
"type": "int",
"max": 3,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "sys_spec_volumetriceffects",
"name": S.current.performance_json_text_volumetric_effects,
"info": S.current.performance_json_text_volumetric_effects_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "sys_spec_water",
"name": S.current.performance_json_text_water,
"info": S.current.performance_json_text_water_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "sys_spec_objectdetail",
"name": S.current.performance_json_text_object_detail,
"info": S.current.performance_json_text_object_detail_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "sys_spec_particles",
"name": S.current.performance_json_text_particles,
"info": "",
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "sys_spec_physics",
"name": S.current.performance_json_text_physics,
"info": S.current.performance_json_text_physics_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "sys_spec_shading",
"name": S.current.performance_json_text_shading,
"info": S.current.performance_json_text_shading_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "sys_spec_shadows",
"name": S.current.performance_json_text_shadows,
"info": S.current.performance_json_text_shadows_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "sys_spec_postprocessing",
"name": S.current.performance_json_text_postprocessing,
"info": S.current.performance_json_text_postprocessing_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "q_Renderer",
"name": S.current.performance_json_text_renderer,
"info": S.current.performance_json_text_renderer_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "q_ShaderDecal",
"name": S.current.performance_json_text_shader_decal,
"info": S.current.performance_json_text_shader_decal_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "q_ShaderPostProcess",
"name": S.current.performance_json_text_shader_post_process,
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 3,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "q_ShaderFX",
"name": S.current.performance_json_text_shader_fx,
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "q_ShaderGeneral",
"name": S.current.performance_json_text_shader_general,
"info": S.current.performance_json_text_shader_general_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "q_ShaderGlass",
"name": S.current.performance_json_text_shader_glass,
"info": S.current.performance_json_text_shader_glass_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "q_ShaderHDR",
"name": S.current.performance_json_text_shader_hdr,
"info": S.current.performance_json_text_shader_hdr_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "q_ShaderParticle",
"name": S.current.performance_json_text_shader_particle,
"info": S.current.performance_json_text_shader_particle_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "q_ShaderTerrain",
"name": S.current.performance_json_text_shader_terrain,
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "q_ShaderShadow",
"name": S.current.performance_json_text_shader_shadow,
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "q_ShaderSky",
"name": S.current.performance_json_text_shader_sky,
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "e_ParticlesObjectCollisions",
"name": S.current.performance_json_text_particles_object_collisions,
"info":
S.current.performance_json_text_particles_object_collisions_info,
"type": "int",
"max": 2,
"min": 1,
"value": 1,
"group": S.current.performance_json_text_title_graphics
},
{
"key": "r_displayinfo",
"name": S.current.performance_json_text_displayinfo,
"info": S.current.performance_json_text_displayinfo_info,
"type": "int",
"max": 4,
"min": 0,
"value": 1,
"group": S.current.app_index_menu_settings
},
{
"key": "sys_maxFps",
"name": S.current.performance_json_text_max_fps,
"info": S.current.performance_json_text_max_fps_info,
"type": "int",
"max": 300,
"min": 0,
"value": 0,
"group": S.current.app_index_menu_settings
},
{
"key": "r_DisplaySessionInfo",
"name": S.current.performance_json_text_display_session,
"info": S.current.performance_json_text_display_session_info,
"type": "bool",
"max": 1,
"min": 0,
"value": 0,
"group": S.current.app_index_menu_settings
},
{
"key": "r_VSync",
"name": S.current.performance_json_text_vsync,
"info": S.current.performance_json_text_vsync_info,
"type": "bool",
"max": 1,
"min": 0,
"value": 0,
"group": S.current.app_index_menu_settings
},
{
"key": "r_MotionBlur",
"name": S.current.performance_json_text_motion_blur,
"info": S.current.performance_json_text_motion_blur_info,
"type": "bool",
"max": 1,
"min": 0,
"value": 0,
"group": S.current.app_index_menu_settings
},
{
"key": "cl_fov",
"name": "FOV",
"info": S.current.performance_json_text_fov,
"type": "int",
"max": 160,
"min": 25,
"value": 90,
"group": S.current.app_index_menu_settings
},
{
"key": "ui_disableScreenFade",
"name": S.current.performance_json_text_ui_animation,
"info": "",
"type": "bool",
"max": 1,
"min": 0,
"value": 1,
"group": S.current.app_index_menu_settings
},
{
"key": "customize",
"name": S.current.performance_json_text_custom_parameters,
"info": "",
"type": "customize",
"max": 1,
"min": 0,
"value": 1,
"group": S.current.performance_json_text_title_custom
}
];
{
"key": "r_ssdo",
"name": S.current.performance_json_text_ssdo,
"info": S.current.performance_json_text_ssdo_info,
"type": "int",
"max": 2,
"min": 0,
"value": 1,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "r_DepthOfField",
"name": S.current.performance_json_text_dof,
"info": S.current.performance_json_text_dof_info,
"type": "int",
"max": 2,
"min": 0,
"value": 1,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "r_AntialiasingMode",
"name": S.current.performance_json_text_antialiasing,
"info": S.current.performance_json_text_antialiasing_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "sys_spec_gameeffects",
"name": S.current.performance_json_text_game_effects,
"info": S.current.performance_json_text_game_effects_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "sys_spec_texture",
"name": S.current.performance_json_text_texture,
"info": S.current.performance_json_text_texture_info,
"type": "int",
"max": 3,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "sys_spec_volumetriceffects",
"name": S.current.performance_json_text_volumetric_effects,
"info": S.current.performance_json_text_volumetric_effects_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "sys_spec_water",
"name": S.current.performance_json_text_water,
"info": S.current.performance_json_text_water_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "sys_spec_objectdetail",
"name": S.current.performance_json_text_object_detail,
"info": S.current.performance_json_text_object_detail_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "sys_spec_particles",
"name": S.current.performance_json_text_particles,
"info": "",
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "sys_spec_physics",
"name": S.current.performance_json_text_physics,
"info": S.current.performance_json_text_physics_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "sys_spec_shading",
"name": S.current.performance_json_text_shading,
"info": S.current.performance_json_text_shading_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "sys_spec_shadows",
"name": S.current.performance_json_text_shadows,
"info": S.current.performance_json_text_shadows_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "sys_spec_postprocessing",
"name": S.current.performance_json_text_postprocessing,
"info": S.current.performance_json_text_postprocessing_info,
"type": "int",
"max": 4,
"min": 1,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "q_Renderer",
"name": S.current.performance_json_text_renderer,
"info": S.current.performance_json_text_renderer_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "q_ShaderDecal",
"name": S.current.performance_json_text_shader_decal,
"info": S.current.performance_json_text_shader_decal_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "q_ShaderPostProcess",
"name": S.current.performance_json_text_shader_post_process,
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 3,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "q_ShaderFX",
"name": S.current.performance_json_text_shader_fx,
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "q_ShaderGeneral",
"name": S.current.performance_json_text_shader_general,
"info": S.current.performance_json_text_shader_general_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "q_ShaderGlass",
"name": S.current.performance_json_text_shader_glass,
"info": S.current.performance_json_text_shader_glass_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "q_ShaderHDR",
"name": S.current.performance_json_text_shader_hdr,
"info": S.current.performance_json_text_shader_hdr_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "q_ShaderParticle",
"name": S.current.performance_json_text_shader_particle,
"info": S.current.performance_json_text_shader_particle_info,
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "q_ShaderTerrain",
"name": S.current.performance_json_text_shader_terrain,
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "q_ShaderShadow",
"name": S.current.performance_json_text_shader_shadow,
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "q_ShaderSky",
"name": S.current.performance_json_text_shader_sky,
"info": "",
"type": "int",
"max": 3,
"min": 0,
"value": 2,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "e_ParticlesObjectCollisions",
"name": S.current.performance_json_text_particles_object_collisions,
"info": S.current.performance_json_text_particles_object_collisions_info,
"type": "int",
"max": 2,
"min": 1,
"value": 1,
"group": S.current.performance_json_text_title_graphics,
},
{
"key": "sys.OpenXR",
"name": S.current.performance_json_text_openxr,
"info": S.current.performance_json_text_openxr_info,
"type": "bool",
"max": 1,
"min": 0,
"value": 0,
"group": S.current.app_index_menu_settings,
},
{
"key": "r_displayinfo",
"name": S.current.performance_json_text_displayinfo,
"info": S.current.performance_json_text_displayinfo_info,
"type": "int",
"max": 4,
"min": 0,
"value": 1,
"group": S.current.app_index_menu_settings,
},
{
"key": "sys_maxFps",
"name": S.current.performance_json_text_max_fps,
"info": S.current.performance_json_text_max_fps_info,
"type": "int",
"max": 300,
"min": 0,
"value": 0,
"group": S.current.app_index_menu_settings,
},
{
"key": "r_DisplaySessionInfo",
"name": S.current.performance_json_text_display_session,
"info": S.current.performance_json_text_display_session_info,
"type": "bool",
"max": 1,
"min": 0,
"value": 0,
"group": S.current.app_index_menu_settings,
},
{
"key": "r_VSync",
"name": S.current.performance_json_text_vsync,
"info": S.current.performance_json_text_vsync_info,
"type": "bool",
"max": 1,
"min": 0,
"value": 0,
"group": S.current.app_index_menu_settings,
},
{
"key": "r_MotionBlur",
"name": S.current.performance_json_text_motion_blur,
"info": S.current.performance_json_text_motion_blur_info,
"type": "bool",
"max": 1,
"min": 0,
"value": 0,
"group": S.current.app_index_menu_settings,
},
{
"key": "cl_fov",
"name": "FOV",
"info": S.current.performance_json_text_fov,
"type": "int",
"max": 160,
"min": 25,
"value": 90,
"group": S.current.app_index_menu_settings,
},
{
"key": "ui_disableScreenFade",
"name": S.current.performance_json_text_ui_animation,
"info": "",
"type": "bool",
"max": 1,
"min": 0,
"value": 1,
"group": S.current.app_index_menu_settings,
},
{
"key": "customize",
"name": S.current.performance_json_text_custom_parameters,
"info": "",
"type": "customize",
"max": 1,
"min": 0,
"value": 1,
"group": S.current.performance_json_text_title_custom,
},
];

View File

@@ -87,8 +87,14 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
for (var m in state.performanceMap!.entries) {
for (var value in m.value) {
if (value.key == kv[0].trim()) {
final v = int.tryParse(kv[1].trim());
if (v != null) value.value = v;
var v = int.tryParse(kv[1].trim());
if (v != null) {
// Special mapping for sys.OpenXR: 42 -> 1
if (value.key == "sys.OpenXR" && v == 42) {
v = 1;
}
value.value = v;
}
}
}
}
@@ -188,7 +194,18 @@ class HomePerformanceUIModel extends _$HomePerformanceUIModel {
for (var v in state.performanceMap!.entries) {
for (var c in v.value) {
if (c.key != "customize") {
conf = "$conf${c.key}=${c.value}\n";
// Skip writing configuration if value equals default value
if (c.value == c.defaultValue) {
continue;
}
// Special mapping for sys.OpenXR: 1 -> 42
var outputValue = c.value;
if (c.key == "sys.OpenXR" && c.value == 1) {
outputValue = 42;
}
conf = "$conf${c.key}=$outputValue\n";
}
}
}