diff --git a/src/common/config.cpp b/src/common/config.cpp index b571c8ed4..32084cea0 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -180,8 +180,6 @@ static ConfigEntry vkGuestMarkers(false); static ConfigEntry rdocEnable(false); // Debug -static ConfigEntry isDebugDump(false); -static ConfigEntry isShaderDebug(false); static ConfigEntry isFpsColor(true); static ConfigEntry logEnabled(true); @@ -340,14 +338,6 @@ bool getIsMotionControlsEnabled() { return isMotionControlsEnabled.get(); } -bool debugDump() { - return isDebugDump.get(); -} - -bool collectShadersForDebug() { - return isShaderDebug.get(); -} - bool nullGpu() { return isNullGpu.get(); } @@ -455,18 +445,10 @@ void setInternalScreenHeight(u32 height) { internalScreenHeight.base_value = height; } -void setDebugDump(bool enable, bool is_game_specific) { - isDebugDump.set(enable, is_game_specific); -} - void setLoggingEnabled(bool enable, bool is_game_specific) { logEnabled.set(enable, is_game_specific); } -void setCollectShaderForDebug(bool enable, bool is_game_specific) { - isShaderDebug.set(enable, is_game_specific); -} - void setNullGpu(bool enable, bool is_game_specific) { isNullGpu.set(enable, is_game_specific); } @@ -727,8 +709,6 @@ void load(const std::filesystem::path& path, bool is_game_specific) { if (data.contains("Debug")) { const toml::value& debug = data.at("Debug"); - isDebugDump.setFromToml(debug, "DebugDump", is_game_specific); - isShaderDebug.setFromToml(debug, "CollectShader", is_game_specific); isFpsColor.setFromToml(debug, "FPSColor", is_game_specific); logEnabled.setFromToml(debug, "logEnabled", is_game_specific); current_version = toml::find_or(debug, "ConfigVersion", current_version); @@ -871,8 +851,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) { vkGuestMarkers.setTomlValue(data, "Vulkan", "guestMarkers", is_game_specific); rdocEnable.setTomlValue(data, "Vulkan", "rdocEnable", is_game_specific); - isDebugDump.setTomlValue(data, "Debug", "DebugDump", is_game_specific); - isShaderDebug.setTomlValue(data, "Debug", "CollectShader", is_game_specific); logEnabled.setTomlValue(data, "Debug", "logEnabled", is_game_specific); m_language.setTomlValue(data, "Settings", "consoleLanguage", is_game_specific); @@ -985,8 +963,6 @@ void setDefaultValues(bool is_game_specific) { rdocEnable.set(false, is_game_specific); // GS - Debug - isDebugDump.set(false, is_game_specific); - isShaderDebug.set(false, is_game_specific); logEnabled.set(true, is_game_specific); // GS - Settings diff --git a/src/common/config.h b/src/common/config.h index af5acbee9..ab29c5bd4 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -47,14 +47,10 @@ u32 getInternalScreenWidth(); u32 getInternalScreenHeight(); void setInternalScreenWidth(u32 width); void setInternalScreenHeight(u32 height); -bool debugDump(); -void setDebugDump(bool enable, bool is_game_specific = false); s32 getGpuId(); void setGpuId(s32 selectedGpuId, bool is_game_specific = false); bool allowHDR(); void setAllowHDR(bool enable, bool is_game_specific = false); -bool collectShadersForDebug(); -void setCollectShaderForDebug(bool enable, bool is_game_specific = false); bool nullGpu(); void setNullGpu(bool enable, bool is_game_specific = false); bool copyGPUCmdBuffers(); diff --git a/src/core/devtools/widget/shader_list.cpp b/src/core/devtools/widget/shader_list.cpp index 0285db5a5..19f7a0308 100644 --- a/src/core/devtools/widget/shader_list.cpp +++ b/src/core/devtools/widget/shader_list.cpp @@ -13,6 +13,7 @@ #include "common/string_util.h" #include "core/debug_state.h" #include "core/devtools/options.h" +#include "core/emulator_settings.h" #include "imgui/imgui_std.h" #include "sdl_window.h" #include "video_core/renderer_vulkan/vk_presenter.h" @@ -244,8 +245,8 @@ void ShaderList::Draw() { return; } - if (!Config::collectShadersForDebug()) { - DrawCenteredText("Enable 'CollectShader' in config to see shaders"); + if (!EmulatorSettings::GetInstance()->IsShaderDump()) { + DrawCenteredText("Enable 'shader_dump' in config to see shaders"); End(); return; } diff --git a/src/core/emulator_settings.cpp b/src/core/emulator_settings.cpp index 55009140b..29f1b2b09 100644 --- a/src/core/emulator_settings.cpp +++ b/src/core/emulator_settings.cpp @@ -78,6 +78,10 @@ std::vector EmulatorSettings::GetGameInstallDirs() const return out; } +const std::vector& EmulatorSettings::GetAllGameInstallDirs() const { + return m_general.install_dirs.value; +} + void EmulatorSettings::SetAllGameInstallDirs(const std::vector& dirs) { m_general.install_dirs.value = dirs; } diff --git a/src/core/emulator_settings.h b/src/core/emulator_settings.h index f2885a044..b5a3bbde0 100644 --- a/src/core/emulator_settings.h +++ b/src/core/emulator_settings.h @@ -130,21 +130,21 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(GeneralSettings, install_dirs, addon_install_ struct DebugSettings { Setting separate_logging_enabled{false}; // specific Setting debug_dump{false}; // specific - Setting shader_debug{false}; // specific + Setting shader_dump{false}; // specific Setting fps_color{true}; Setting log_enabled{true}; // specific std::vector GetOverrideableFields() const { return std::vector{ make_override("debug_dump", &DebugSettings::debug_dump), - make_override("shader_debug", &DebugSettings::shader_debug), + make_override("shader_dump", &DebugSettings::shader_dump), make_override("separate_logging_enabled", &DebugSettings::separate_logging_enabled), make_override("log_enabled", &DebugSettings::log_enabled)}; } }; -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DebugSettings, separate_logging_enabled, debug_dump, - shader_debug, fps_color, log_enabled) +NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DebugSettings, separate_logging_enabled, debug_dump, shader_dump, + fps_color, log_enabled) // ------------------------------- // Input settings @@ -268,6 +268,7 @@ public: void SetGameInstallDirEnabled(const std::filesystem::path& dir, bool enabled); void SetGameInstallDirs(const std::vector& dirs_config); const std::vector GetGameInstallDirsEnabled(); + const std::vector& GetAllGameInstallDirs() const; std::filesystem::path GetHomeDir(); void SetHomeDir(const std::filesystem::path& dir); @@ -340,6 +341,8 @@ public: // Debug settings SETTING_FORWARD_BOOL(m_debug, SeparateLoggingEnabled, separate_logging_enabled) + SETTING_FORWARD_BOOL(m_debug, DebugDump, debug_dump) + SETTING_FORWARD_BOOL(m_debug, ShaderDump, shader_dump) #undef SETTING_FORWARD #undef SETTING_FORWARD_BOOL diff --git a/src/core/linker.cpp b/src/core/linker.cpp index b7c9a2895..40450d28a 100644 --- a/src/core/linker.cpp +++ b/src/core/linker.cpp @@ -13,6 +13,7 @@ #include "core/aerolib/aerolib.h" #include "core/aerolib/stubs.h" #include "core/devtools/widget/module_list.h" +#include "core/emulator_settings.h" #include "core/libraries/kernel/kernel.h" #include "core/libraries/kernel/memory.h" #include "core/libraries/kernel/threads.h" @@ -56,7 +57,7 @@ Linker::Linker() : memory{Memory::Instance()} {} Linker::~Linker() = default; void Linker::Execute(const std::vector& args) { - if (Config::debugDump()) { + if (EmulatorSettings::GetInstance()->IsDebugDump()) { DebugDump(); } diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 4706bff24..69b06479c 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -8,6 +8,7 @@ #include "common/io_file.h" #include "common/path_util.h" #include "core/debug_state.h" +#include "core/emulator_settings.h" #include "shader_recompiler/backend/spirv/emit_spirv.h" #include "shader_recompiler/info.h" #include "shader_recompiler/recompiler.h" @@ -286,7 +287,7 @@ const GraphicsPipeline* PipelineCache::GetGraphicsPipeline() { it.value() = std::make_unique(instance, scheduler, desc_heap, profile, graphics_key, *pipeline_cache, infos, runtime_infos, fetch_shader, modules); - if (Config::collectShadersForDebug()) { + if (EmulatorSettings::GetInstance()->IsShaderDump()) { for (auto stage = 0; stage < MaxShaderStages; ++stage) { if (infos[stage]) { auto& m = modules[stage]; @@ -310,7 +311,7 @@ const ComputePipeline* PipelineCache::GetComputePipeline() { it.value() = std::make_unique(instance, scheduler, desc_heap, profile, *pipeline_cache, compute_key, *infos[0], modules[0]); - if (Config::collectShadersForDebug()) { + if (EmulatorSettings::GetInstance()->IsShaderDump()) { auto& m = modules[0]; module_related_pipelines[m].emplace_back(compute_key); } @@ -538,7 +539,7 @@ vk::ShaderModule PipelineCache::CompileModule(Shader::Info& info, Shader::Runtim const auto name = GetShaderName(info.stage, info.pgm_hash, perm_idx); Vulkan::SetObjectName(instance.GetDevice(), module, name); - if (Config::collectShadersForDebug()) { + if (EmulatorSettings::GetInstance()->IsShaderDump()) { DebugState.CollectShader(name, info.l_stage, module, spv, code, patch ? *patch : std::span{}, is_patched); }