diff --git a/src/Cafe/HW/Latte/Core/LatteTextureLoader.cpp b/src/Cafe/HW/Latte/Core/LatteTextureLoader.cpp index 78db5ce1..79764712 100644 --- a/src/Cafe/HW/Latte/Core/LatteTextureLoader.cpp +++ b/src/Cafe/HW/Latte/Core/LatteTextureLoader.cpp @@ -684,17 +684,14 @@ void LatteTextureLoader_UpdateTextureSliceData(LatteTexture* tex, uint32 sliceIn // write texture dump if (textureLoader.dump) { + std::filesystem::path outputDir = ActiveSettings::GetUserDataPath("dump/textures"); - std::filesystem::path outputDir = "dump/textures"; - if (!std::filesystem::exists(outputDir)) - { - std::error_code ec; - std::filesystem::create_directories(outputDir, ec); - } + wchar_t filename[1024]; + swprintf(filename, 1024, L"%08x_fmt%04x_slice%d_mip%02d_%dx%d_tm%02d.tga", physImagePtr, (uint32)tex->format, sliceIndex, mipIndex, tex->width, tex->height, tileMode); + + std::filesystem::path fullPath = outputDir / filename; - wchar_t path[1024]; - swprintf(path, 1024, L"dump/textures/%08x_fmt%04x_slice%d_mip%02d_%dx%d_tm%02d.tga", physImagePtr, (uint32)tex->format, sliceIndex, mipIndex, tex->width, tex->height, tileMode); - tga_write_rgba(path, textureLoader.width, textureLoader.height, textureLoader.dumpRGBA); + tga_write_rgba(fullPath.c_str(), textureLoader.width, textureLoader.height, textureLoader.dumpRGBA); free(textureLoader.dumpRGBA); } // clean up diff --git a/src/util/ImageWriter/tga.h b/src/util/ImageWriter/tga.h index 822bdaae..f918a384 100644 --- a/src/util/ImageWriter/tga.h +++ b/src/util/ImageWriter/tga.h @@ -1,7 +1,7 @@ #include "Common/FileStream.h" #include -static bool tga_write_rgba(wchar_t* path, sint32 width, sint32 height, uint8* pixelData) +static bool tga_write_rgba(const wchar_t* path, sint32 width, sint32 height, uint8* pixelData) { FileStream* fs = FileStream::createFile(path); if (fs == nullptr)