From 6d6eb066f1713be6819108c328bb2f64f03637fc Mon Sep 17 00:00:00 2001 From: Crementif <26669564+Crementif@users.noreply.github.com> Date: Sat, 4 Jan 2025 20:05:57 +0100 Subject: [PATCH] Don't recreate directories on each shader dumped Wasn't aware that directories were already created. --- src/Cafe/HW/Latte/Core/LatteShader.cpp | 10 ++-------- src/gui/MainWindow.cpp | 4 +--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/Cafe/HW/Latte/Core/LatteShader.cpp b/src/Cafe/HW/Latte/Core/LatteShader.cpp index 220c7efc1..d9f0a5ddf 100644 --- a/src/Cafe/HW/Latte/Core/LatteShader.cpp +++ b/src/Cafe/HW/Latte/Core/LatteShader.cpp @@ -452,10 +452,7 @@ void LatteShader_DumpShader(uint64 baseHash, uint64 auxHash, LatteDecompilerShad else if (shader->shaderType == LatteConst::ShaderType::Pixel) suffix = "ps"; - fs::path shaderPath = ActiveSettings::GetUserDataPath("dump/shaders"); - std::error_code ec; - fs::create_directories(shaderPath, ec); - FileStream* fs = FileStream::createFile2(shaderPath / fmt::format("{:016x}_{:016x}_{}.txt", baseHash, auxHash, suffix)); + FileStream* fs = FileStream::createFile2(ActiveSettings::GetUserDataPath("dump/shaders/{:016x}_{:016x}_{}.txt", baseHash, auxHash, suffix)); if (fs) { if (shader->strBuf_shaderSource) @@ -482,10 +479,7 @@ void LatteShader_DumpRawShader(uint64 baseHash, uint64 auxHash, uint32 type, uin else if (type == SHADER_DUMP_TYPE_COMPUTE) suffix = "compute"; - fs::path shaderPath = ActiveSettings::GetUserDataPath("dump/shaders"); - std::error_code ec; - fs::create_directories(shaderPath, ec); - FileStream* fs = FileStream::createFile2(shaderPath / fmt::format("{:016x}_{:016x}_{}.bin", baseHash, auxHash, suffix)); + FileStream* fs = FileStream::createFile2(ActiveSettings::GetUserDataPath("dump/shaders/{:016x}_{:016x}_{}.bin", baseHash, auxHash, suffix)); if (fs) { fs->writeData(programCode, programLen); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 69ff4e993..4801706a9 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1113,9 +1113,7 @@ void MainWindow::OnDebugDumpUsedShaders(wxCommandEvent& event) { try { - // create directory - const fs::path path(ActiveSettings::GetUserDataPath()); - fs::create_directories(path / "dump" / "shaders"); + fs::create_directories(ActiveSettings::GetUserDataPath("dump/shaders")); } catch (const std::exception & ex) {