Save and load textures using full key.

Of course, need this, not just the hash.
This commit is contained in:
Unknown W. Brackets committed 2016-05-01 00:30:40 -07:00
1 parent 9039dd606f
commit 565653c77b
5 files changed
+12 -12

No files matched your search

+4 -4
View File
@@ -73,7 +73,7 @@ u32 TextureReplacer::ComputeHash(u32 addr, int bufw, int w, int h, GETextureForm
return DoQuickTexHash(checkp, sizeInRAM);
}
ReplacedTexture TextureReplacer::FindReplacement(u32 hash) {
ReplacedTexture TextureReplacer::FindReplacement(u64 cachekey, u32 hash) {
_assert_msg_(G3D, enabled_, "Replacement not enabled");
ReplacedTexture result;
@@ -109,15 +109,15 @@ static bool WriteTextureToPNG(png_imagep image, const std::string &filename, int
}
#endif
void TextureReplacer::NotifyTextureDecoded(u32 hash, u32 addr, const void *data, int pitch, int w, int h, ReplacedTextureFormat fmt) {
void TextureReplacer::NotifyTextureDecoded(u64 cachekey, u32 hash, u32 addr, const void *data, int pitch, int w, int h, ReplacedTextureFormat fmt) {
_assert_msg_(G3D, enabled_, "Replacement not enabled");
if (!g_Config.bSaveNewTextures) {
// Ignore.
return;
}
char hashname[8 + 4 + 1] = {};
snprintf(hashname, sizeof(hashname), "%08x.png", hash);
char hashname[16 + 8 + 4 + 1] = {};
snprintf(hashname, sizeof(hashname), "%016llx%08x.png", cachekey, hash);
const std::string filename = basePath_ + hashname;
// TODO: Check for ini ignored or aliased textures.