diff --git a/src/common/d3d11/shader_cache.cpp b/src/common/d3d11/shader_cache.cpp index 82176fbba..fa9194071 100644 --- a/src/common/d3d11/shader_cache.cpp +++ b/src/common/d3d11/shader_cache.cpp @@ -160,7 +160,6 @@ std::string ShaderCache::GetCacheBaseFileName(const std::string_view& base_path, bool debug) { std::string base_filename(base_path); - base_filename += FS_OSPATH_SEPERATOR_CHARACTER; base_filename += "d3d_shaders_"; switch (feature_level) diff --git a/src/common/gl/shader_cache.cpp b/src/common/gl/shader_cache.cpp index b2bd5ad3a..752d50484 100644 --- a/src/common/gl/shader_cache.cpp +++ b/src/common/gl/shader_cache.cpp @@ -244,12 +244,12 @@ ShaderCache::CacheIndexKey ShaderCache::GetCacheKey(const std::string_view& vert std::string ShaderCache::GetIndexFileName() const { - return StringUtil::StdStringFromFormat("%s%cgl_programs.idx", m_base_path.c_str(), FS_OSPATH_SEPERATOR_CHARACTER); + return StringUtil::StdStringFromFormat("%sgl_programs.idx", m_base_path.c_str()); } std::string ShaderCache::GetBlobFileName() const { - return StringUtil::StdStringFromFormat("%s%cgl_programs.bin", m_base_path.c_str(), FS_OSPATH_SEPERATOR_CHARACTER); + return StringUtil::StdStringFromFormat("%sgl_programs.bin", m_base_path.c_str()); } std::optional ShaderCache::GetProgram(const std::string_view vertex_shader, diff --git a/src/common/vulkan/shader_cache.cpp b/src/common/vulkan/shader_cache.cpp index 2ba5074f6..6f56684d3 100644 --- a/src/common/vulkan/shader_cache.cpp +++ b/src/common/vulkan/shader_cache.cpp @@ -375,7 +375,6 @@ void ShaderCache::ClosePipelineCache() std::string ShaderCache::GetShaderCacheBaseFileName(const std::string_view& base_path, bool debug) { std::string base_filename(base_path); - base_filename += FS_OSPATH_SEPERATOR_CHARACTER; base_filename += "vulkan_shaders"; if (debug) @@ -387,7 +386,6 @@ std::string ShaderCache::GetShaderCacheBaseFileName(const std::string_view& base std::string ShaderCache::GetPipelineCacheBaseFileName(const std::string_view& base_path, bool debug) { std::string base_filename(base_path); - base_filename += FS_OSPATH_SEPERATOR_CHARACTER; base_filename += "vulkan_pipelines"; if (debug) diff --git a/src/core/gpu_hw_d3d11.cpp b/src/core/gpu_hw_d3d11.cpp index 02811b710..8d1da2d78 100644 --- a/src/core/gpu_hw_d3d11.cpp +++ b/src/core/gpu_hw_d3d11.cpp @@ -38,7 +38,7 @@ bool GPU_HW_D3D11::Initialize(HostDisplay* host_display, System* system, DMA* dm if (!m_device || !m_context) return false; - m_shader_cache.Open(system->GetHostInterface()->GetUserDirectoryRelativePath("cache"), m_device->GetFeatureLevel(), + m_shader_cache.Open(system->GetHostInterface()->GetShaderCacheBasePath(), m_device->GetFeatureLevel(), system->GetSettings().gpu_use_debug_device); if (!CreateFramebuffer()) diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp index fb093f6d2..2c9a4dfad 100644 --- a/src/core/gpu_hw_opengl.cpp +++ b/src/core/gpu_hw_opengl.cpp @@ -39,7 +39,7 @@ bool GPU_HW_OpenGL::Initialize(HostDisplay* host_display, System* system, DMA* d SetCapabilities(host_display); - m_shader_cache.Open(IsGLES(), system->GetHostInterface()->GetUserDirectoryRelativePath("cache")); + m_shader_cache.Open(IsGLES(), system->GetHostInterface()->GetShaderCacheBasePath()); if (!GPU_HW::Initialize(host_display, system, dma, interrupt_controller, timers)) return false; diff --git a/src/core/host_interface.cpp b/src/core/host_interface.cpp index a33741974..d9fd5ce73 100644 --- a/src/core/host_interface.cpp +++ b/src/core/host_interface.cpp @@ -318,9 +318,9 @@ void HostInterface::OnRunningGameChanged() {} void HostInterface::OnControllerTypeChanged(u32 slot) {} -std::string HostInterface::GetShaderCacheDirectory() +std::string HostInterface::GetShaderCacheBasePath() const { - return GetUserDirectoryRelativePath("cache"); + return GetUserDirectoryRelativePath("cache/"); } void HostInterface::SetDefaultSettings(SettingsInterface& si) diff --git a/src/core/host_interface.h b/src/core/host_interface.h index ba8aaf03e..2381afdcb 100644 --- a/src/core/host_interface.h +++ b/src/core/host_interface.h @@ -103,6 +103,9 @@ public: /// Returns the default path to a memory card for a specific game. virtual std::string GetGameMemoryCardPath(const char* game_code, u32 slot) const; + /// Returns the path to the shader cache directory. + virtual std::string GetShaderCacheBasePath() const; + /// Returns a setting value from the configuration. virtual std::string GetSettingValue(const char* section, const char* key, const char* default_value = "") = 0; @@ -127,9 +130,6 @@ protected: virtual void OnRunningGameChanged(); virtual void OnControllerTypeChanged(u32 slot); - /// Returns the path to the shader cache directory. - virtual std::string GetShaderCacheDirectory(); - /// Restores all settings to defaults. virtual void SetDefaultSettings(SettingsInterface& si); diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp index 619e82ba6..7fa2e0979 100644 --- a/src/duckstation-qt/qthostinterface.cpp +++ b/src/duckstation-qt/qthostinterface.cpp @@ -335,7 +335,7 @@ bool QtHostInterface::AcquireHostDisplay() createImGuiContext(display_widget->devicePixelRatioFromScreen()); if (!m_display->MakeRenderContextCurrent() || - !m_display->InitializeRenderDevice(GetShaderCacheDirectory(), m_settings.gpu_use_debug_device)) + !m_display->InitializeRenderDevice(GetShaderCacheBasePath(), m_settings.gpu_use_debug_device)) { destroyImGuiContext(); m_display->DestroyRenderDevice(); diff --git a/src/duckstation-sdl/sdl_host_interface.cpp b/src/duckstation-sdl/sdl_host_interface.cpp index 876be449a..99bd63928 100644 --- a/src/duckstation-sdl/sdl_host_interface.cpp +++ b/src/duckstation-sdl/sdl_host_interface.cpp @@ -131,7 +131,7 @@ bool SDLHostInterface::CreateDisplay() Assert(display); if (!display->CreateRenderDevice(wi.value(), m_settings.gpu_adapter, m_settings.gpu_use_debug_device) || - !display->InitializeRenderDevice(GetShaderCacheDirectory(), m_settings.gpu_use_debug_device)) + !display->InitializeRenderDevice(GetShaderCacheBasePath(), m_settings.gpu_use_debug_device)) { ReportError("Failed to create/initialize display render device"); return false;