Skip to content

Commit

Permalink
debug: Fix shader dumping (#1466)
Browse files Browse the repository at this point in the history
  • Loading branch information
Crementif authored Jan 4, 2025
1 parent 1e30d72 commit 4b792aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/Cafe/HW/Latte/Core/LatteShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,8 @@ 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);

FileStream* fs = FileStream::createFile2(ActiveSettings::GetUserDataPath("dump/shaders/{:016x}_{:016x}_{}.txt", baseHash, auxHash, suffix));
if (fs)
{
if (shader->strBuf_shaderSource)
Expand All @@ -479,9 +478,8 @@ 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);

FileStream* fs = FileStream::createFile2(ActiveSettings::GetUserDataPath("dump/shaders/{:016x}_{:016x}_{}.bin", baseHash, auxHash, suffix));
if (fs)
{
fs->writeData(programCode, programLen);
Expand Down
4 changes: 1 addition & 3 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 4b792aa

Please sign in to comment.