From 75d7e40113c03ec6a2a83fb8cfa736a17c6862a3 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Sun, 7 May 2023 10:35:28 -0400 Subject: [PATCH] settings: Recategorize a bit Will help with generating config UI later. --- src/common/settings.cpp | 7 +- src/common/settings.h | 87 +++++++++++-------- src/yuzu/configuration/config.cpp | 12 ++- .../configuration/configuration_shared.cpp | 8 +- .../configure_graphics_advanced.cpp | 2 +- src/yuzu_cmd/config.cpp | 6 +- 6 files changed, 77 insertions(+), 45 deletions(-) diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 59934803e..38a82f6f7 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -151,14 +151,19 @@ const char* TranslateCategory(Category category) { case Category::Core: return "Core"; case Category::Cpu: + case Category::CpuDebug: + case Category::CpuUnsafe: return "Cpu"; case Category::Renderer: + case Category::RendererAdvanced: + case Category::RendererDebug: return "Renderer"; case Category::System: return "System"; case Category::DataStorage: return "Data Storage"; case Category::Debugging: + case Category::DebuggingGraphics: return "Debugging"; case Category::Miscellaneous: return "Miscellaneous"; @@ -188,8 +193,6 @@ const char* TranslateCategory(Category category) { return "Paths"; case Category::MaxEnum: break; - case Category::AdvancedGraphics: - return "Renderer"; } return "Miscellaneous"; } diff --git a/src/common/settings.h b/src/common/settings.h index 48f86d0aa..70ab8d584 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -120,11 +120,15 @@ enum class Category : u32 { Audio, Core, Cpu, + CpuDebug, + CpuUnsafe, Renderer, - AdvancedGraphics, + RendererAdvanced, + RendererDebug, System, DataStorage, Debugging, + DebuggingGraphics, Miscellaneous, Network, WebService, @@ -624,53 +628,56 @@ struct Values { "cpu_accuracy", Category::Cpu}; // TODO: remove cpu_accuracy_first_time, migration setting added 8 July 2021 Setting cpu_accuracy_first_time{linkage, true, "cpu_accuracy_first_time", Category::Cpu}; - Setting cpu_debug_mode{linkage, false, "cpu_debug_mode", Category::Cpu}; + Setting cpu_debug_mode{linkage, false, "cpu_debug_mode", Category::CpuDebug}; - Setting cpuopt_page_tables{linkage, true, "cpuopt_page_tables", Category::Cpu}; - Setting cpuopt_block_linking{linkage, true, "cpuopt_block_linking", Category::Cpu}; + Setting cpuopt_page_tables{linkage, true, "cpuopt_page_tables", Category::CpuDebug}; + Setting cpuopt_block_linking{linkage, true, "cpuopt_block_linking", Category::CpuDebug}; Setting cpuopt_return_stack_buffer{linkage, true, "cpuopt_return_stack_buffer", - Category::Cpu}; - Setting cpuopt_fast_dispatcher{linkage, true, "cpuopt_fast_dispatcher", Category::Cpu}; + Category::CpuDebug}; + Setting cpuopt_fast_dispatcher{linkage, true, "cpuopt_fast_dispatcher", + Category::CpuDebug}; Setting cpuopt_context_elimination{linkage, true, "cpuopt_context_elimination", - Category::Cpu}; - Setting cpuopt_const_prop{linkage, true, "cpuopt_const_prop", Category::Cpu}; - Setting cpuopt_misc_ir{linkage, true, "cpuopt_misc_ir", Category::Cpu}; + Category::CpuDebug}; + Setting cpuopt_const_prop{linkage, true, "cpuopt_const_prop", Category::CpuDebug}; + Setting cpuopt_misc_ir{linkage, true, "cpuopt_misc_ir", Category::CpuDebug}; Setting cpuopt_reduce_misalign_checks{linkage, true, "cpuopt_reduce_misalign_checks", - Category::Cpu}; - Setting cpuopt_fastmem{linkage, true, "cpuopt_fastmem", Category::Cpu}; + Category::CpuDebug}; + Setting cpuopt_fastmem{linkage, true, "cpuopt_fastmem", Category::CpuDebug}; Setting cpuopt_fastmem_exclusives{linkage, true, "cpuopt_fastmem_exclusives", - Category::Cpu}; + Category::CpuDebug}; Setting cpuopt_recompile_exclusives{linkage, true, "cpuopt_recompile_exclusives", - Category::Cpu}; + Category::CpuDebug}; Setting cpuopt_ignore_memory_aborts{linkage, true, "cpuopt_ignore_memory_aborts", - Category::Cpu}; + Category::CpuDebug}; SwitchableSetting cpuopt_unsafe_unfuse_fma{linkage, true, "cpuopt_unsafe_unfuse_fma", - Category::Cpu}; + Category::CpuUnsafe}; SwitchableSetting cpuopt_unsafe_reduce_fp_error{ - linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::Cpu}; + linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::CpuUnsafe}; SwitchableSetting cpuopt_unsafe_ignore_standard_fpcr{ - linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::Cpu}; + linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::CpuUnsafe}; SwitchableSetting cpuopt_unsafe_inaccurate_nan{ - linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::Cpu}; + linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::CpuUnsafe}; SwitchableSetting cpuopt_unsafe_fastmem_check{ - linkage, true, "cpuopt_unsafe_fastmem_check", Category::Cpu}; + linkage, true, "cpuopt_unsafe_fastmem_check", Category::CpuUnsafe}; SwitchableSetting cpuopt_unsafe_ignore_global_monitor{ - linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::Cpu}; + linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::CpuUnsafe}; // Renderer SwitchableSetting renderer_backend{ linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null, "backend", Category::Renderer}; SwitchableSetting async_presentation{linkage, false, "async_presentation", - Category::AdvancedGraphics}; + Category::RendererAdvanced}; SwitchableSetting renderer_force_max_clock{linkage, false, "force_max_clock", - Category::AdvancedGraphics}; - Setting renderer_debug{linkage, false, "debug", Category::Renderer}; - Setting renderer_shader_feedback{linkage, false, "shader_feedback", Category::Renderer}; - Setting enable_nsight_aftermath{linkage, false, "nsight_aftermath", Category::Renderer}; + Category::RendererAdvanced}; + Setting renderer_debug{linkage, false, "debug", Category::RendererDebug}; + Setting renderer_shader_feedback{linkage, false, "shader_feedback", + Category::RendererDebug}; + Setting enable_nsight_aftermath{linkage, false, "nsight_aftermath", + Category::RendererDebug}; Setting disable_shader_loop_safety_checks{ - linkage, false, "disable_shader_loop_safety_checks", Category::Renderer}; + linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug}; SwitchableSetting vulkan_device{linkage, 0, "vulkan_device", Category::Renderer}; ResolutionScalingInfo resolution_info{}; @@ -697,7 +704,7 @@ struct Values { SwitchableSetting aspect_ratio{linkage, 0, 0, 4, "aspect_ratio", Category::Renderer}; SwitchableSetting max_anisotropy{ linkage, AnisotropyMode::Automatic, AnisotropyMode::Automatic, AnisotropyMode::X16, - "max_anisotropy", Category::AdvancedGraphics}; + "max_anisotropy", Category::RendererAdvanced}; SwitchableSetting use_speed_limit{linkage, true, "use_speed_limit", Category::Renderer}; SwitchableSetting speed_limit{linkage, 100, 0, @@ -706,7 +713,7 @@ struct Values { Category::Renderer}; SwitchableSetting gpu_accuracy{ linkage, GPUAccuracy::High, GPUAccuracy::Normal, GPUAccuracy::Extreme, - "gpu_accuracy", Category::AdvancedGraphics}; + "gpu_accuracy", Category::RendererAdvanced}; SwitchableSetting use_asynchronous_gpu_emulation{ linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer}; SwitchableSetting nvdec_emulation{linkage, NvdecEmulation::GPU, @@ -728,21 +735,21 @@ struct Values { SwitchableSetting use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders", Category::Renderer}; SwitchableSetting use_fast_gpu_time{linkage, true, "use_fast_gpu_time", - Category::AdvancedGraphics}; + Category::RendererAdvanced}; SwitchableSetting use_vulkan_driver_pipeline_cache{ - linkage, true, "use_vulkan_driver_pipeline_cache", Category::AdvancedGraphics}; + linkage, true, "use_vulkan_driver_pipeline_cache", Category::RendererAdvanced}; SwitchableSetting enable_compute_pipelines{linkage, false, "enable_compute_pipelines", - Category::AdvancedGraphics}; + Category::RendererAdvanced}; SwitchableSetting astc_recompression{linkage, AstcRecompression::Uncompressed, AstcRecompression::Uncompressed, AstcRecompression::Bc3, "astc_recompression", - Category::AdvancedGraphics}; + Category::RendererAdvanced}; SwitchableSetting use_video_framerate{linkage, false, "use_video_framerate", - Category::AdvancedGraphics}; + Category::RendererAdvanced}; SwitchableSetting barrier_feedback_loops{linkage, true, "barrier_feedback_loops", - Category::AdvancedGraphics}; + Category::RendererAdvanced}; SwitchableSetting bg_red{linkage, 0, "bg_red", Category::Renderer}; SwitchableSetting bg_green{linkage, 0, "bg_green", Category::Renderer}; @@ -855,14 +862,18 @@ struct Values { Setting program_args{linkage, std::string(), "program_args", Category::Debugging}; Setting dump_exefs{linkage, false, "dump_exefs", Category::Debugging}; Setting dump_nso{linkage, false, "dump_nso", Category::Debugging}; - Setting dump_shaders{linkage, false, "dump_shaders", Category::Debugging}; - Setting dump_macros{linkage, false, "dump_macros", Category::Debugging}; + Setting dump_shaders{linkage, false, "dump_shaders", + Category::DebuggingGraphics}; + Setting dump_macros{linkage, false, "dump_macros", + Category::DebuggingGraphics}; Setting enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging}; Setting reporting_services{linkage, false, "reporting_services", Category::Debugging}; Setting quest_flag{linkage, false, "quest_flag", Category::Debugging}; - Setting disable_macro_jit{linkage, false, "disable_macro_jit", Category::Debugging}; - Setting disable_macro_hle{linkage, false, "disable_macro_hle", Category::Debugging}; + Setting disable_macro_jit{linkage, false, "disable_macro_jit", + Category::DebuggingGraphics}; + Setting disable_macro_hle{linkage, false, "disable_macro_hle", + Category::DebuggingGraphics}; Setting extended_logging{linkage, false, "extended_logging", Category::Debugging}; Setting use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging}; diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index f274fe4ea..c6a34e787 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -550,6 +550,7 @@ void Config::ReadDebuggingValues() { qt_config->value(QStringLiteral("record_frame_times"), false).toBool(); ReadCategory(Settings::Category::Debugging); + ReadCategory(Settings::Category::DebuggingGraphics); qt_config->endGroup(); } @@ -635,6 +636,8 @@ void Config::ReadCpuValues() { qt_config->beginGroup(QStringLiteral("Cpu")); ReadCategory(Settings::Category::Cpu); + ReadCategory(Settings::Category::CpuDebug); + ReadCategory(Settings::Category::CpuUnsafe); if (Settings::values.cpu_accuracy_first_time) { Settings::values.cpu_accuracy.SetValue(Settings::values.cpu_accuracy.GetDefault()); @@ -648,7 +651,8 @@ void Config::ReadRendererValues() { qt_config->beginGroup(QStringLiteral("Renderer")); ReadCategory(Settings::Category::Renderer); - ReadCategory(Settings::Category::AdvancedGraphics); + ReadCategory(Settings::Category::RendererAdvanced); + ReadCategory(Settings::Category::RendererDebug); qt_config->endGroup(); } @@ -1016,6 +1020,7 @@ void Config::SaveDebuggingValues() { qt_config->setValue(QStringLiteral("record_frame_times"), Settings::values.record_frame_times); WriteCategory(Settings::Category::Debugging); + WriteCategory(Settings::Category::DebuggingGraphics); qt_config->endGroup(); } @@ -1079,6 +1084,8 @@ void Config::SaveCpuValues() { qt_config->beginGroup(QStringLiteral("Cpu")); WriteCategory(Settings::Category::Cpu); + WriteCategory(Settings::Category::CpuDebug); + WriteCategory(Settings::Category::CpuUnsafe); qt_config->endGroup(); } @@ -1086,8 +1093,9 @@ void Config::SaveCpuValues() { void Config::SaveRendererValues() { qt_config->beginGroup(QStringLiteral("Renderer")); - WriteCategory(Settings::Category::AdvancedGraphics); WriteCategory(Settings::Category::Renderer); + WriteCategory(Settings::Category::RendererAdvanced); + WriteCategory(Settings::Category::RendererDebug); qt_config->endGroup(); } diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 44222718c..dc11a318a 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -128,10 +128,16 @@ QWidget* CreateWidget(Settings::BasicSetting* setting, const TranslationMap& tra return std::pair{translations.at(setting_label).first, translations.at(setting_label).second}; } - LOG_ERROR(Frontend, "Translation map lacks entry for \"{}\"", setting_label); + LOG_ERROR(Frontend, "Translation table lacks entry for \"{}\"", setting_label); return std::pair{QString::fromStdString(setting_label), QStringLiteral("")}; }(); + if (label == QStringLiteral("")) { + LOG_DEBUG(Frontend, "Translation table has emtpy entry for \"{}\", skipping...", + setting->GetLabel()); + return widget; + } + if (type == typeid(bool)) { auto pair = CreateCheckBox(setting, label, parent, trackers); widget = pair.first; diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 6d387b5c3..7d79044d4 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -31,7 +31,7 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { std::map hold{}; // A map will sort the data for us for (auto setting : - Settings::values.linkage.by_category[Settings::Category::AdvancedGraphics]) { + Settings::values.linkage.by_category[Settings::Category::RendererAdvanced]) { QWidget* widget = ConfigurationShared::CreateWidget(setting, translations, this, runtime_lock, apply_funcs, trackers); diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index cfc1a5d81..f8cbf8034 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -223,11 +223,15 @@ void Config::ReadValues() { ReadCategory(Settings::Category::Audio); ReadCategory(Settings::Category::Core); ReadCategory(Settings::Category::Cpu); + ReadCategory(Settings::Category::CpuDebug); + ReadCategory(Settings::Category::CpuUnsafe); ReadCategory(Settings::Category::Renderer); - ReadCategory(Settings::Category::AdvancedGraphics); + ReadCategory(Settings::Category::RendererAdvanced); + ReadCategory(Settings::Category::RendererDebug); ReadCategory(Settings::Category::System); ReadCategory(Settings::Category::DataStorage); ReadCategory(Settings::Category::Debugging); + ReadCategory(Settings::Category::DebuggingGraphics); ReadCategory(Settings::Category::Miscellaneous); ReadCategory(Settings::Category::Network); ReadCategory(Settings::Category::WebService);