From 9352654d3a48c2a7e3ac25e684b19908a6574dff Mon Sep 17 00:00:00 2001 From: Crementif <26669564+Crementif@users.noreply.github.com> Date: Sat, 4 Jan 2025 15:09:00 +0100 Subject: [PATCH] Fix shader dumping --- src/Cafe/HW/Latte/Core/LatteShader.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Cafe/HW/Latte/Core/LatteShader.cpp b/src/Cafe/HW/Latte/Core/LatteShader.cpp index 77f164682..af5d4203a 100644 --- a/src/Cafe/HW/Latte/Core/LatteShader.cpp +++ b/src/Cafe/HW/Latte/Core/LatteShader.cpp @@ -451,9 +451,11 @@ void LatteShader_DumpShader(uint64 baseHash, uint64 auxHash, LatteDecompilerShad suffix = "gs"; else if (shader->shaderType == LatteConst::ShaderType::Pixel) suffix = "ps"; - fs::path dumpPath = "dump/shaders"; - dumpPath /= fmt::format("{:016x}_{:016x}_{}.txt", baseHash, auxHash, suffix); - FileStream* fs = FileStream::createFile2(dumpPath); + + fs::path shaderPath = ActiveSettings::GetUserDataPath("dump/shaders"); + std::error_code ec; + fs::create_directories(shaderPath, ec); + FileStream* fs = FileStream::createFile2(shaderPath / std::format("{:016x}_{:016x}_{}.txt", baseHash, auxHash, suffix)); if (fs) { if (shader->strBuf_shaderSource) @@ -479,9 +481,11 @@ void LatteShader_DumpRawShader(uint64 baseHash, uint64 auxHash, uint32 type, uin suffix = "copy"; else if (type == SHADER_DUMP_TYPE_COMPUTE) suffix = "compute"; - fs::path dumpPath = "dump/shaders"; - dumpPath /= fmt::format("{:016x}_{:016x}_{}.bin", baseHash, auxHash, suffix); - FileStream* fs = FileStream::createFile2(dumpPath); + + fs::path shaderPath = ActiveSettings::GetUserDataPath("dump/shaders"); + std::error_code ec; + fs::create_directories(shaderPath, ec); + FileStream* fs = FileStream::createFile2(shaderPath / std::format("{:016x}_{:016x}_{}.bin", baseHash, auxHash, suffix)); if (fs) { fs->writeData(programCode, programLen);