CustomTexture: Use another file name with wildcards

This commit is contained in:
degasus 2015-01-14 21:25:33 +01:00
parent a353ead3cb
commit ee9d05d67f
3 changed files with 13 additions and 11 deletions

View File

@ -80,7 +80,7 @@ void HiresTexture::Init(const std::string& gameCode)
}
}
std::string HiresTexture::GenBaseName(const u8* texture, size_t texture_size, const u8* tlut, size_t tlut_size, u32 width, u32 height, int format)
std::string HiresTexture::GenBaseName(const u8* texture, size_t texture_size, const u8* tlut, size_t tlut_size, u32 width, u32 height, int format, bool dump)
{
// checking for min/max on paletted textures
u32 min = 0xffff;
@ -119,14 +119,16 @@ std::string HiresTexture::GenBaseName(const u8* texture, size_t texture_size, co
}
u64 tex_hash = GetHashHiresTexture(texture, (int)texture_size);
u64 tlut_hash = 0;
u64 hash = tex_hash;
if (tlut_size)
{
tlut_hash = GetHashHiresTexture(tlut, (int)tlut_size);
hash ^= tlut_hash;
}
return StringFromFormat("%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32)hash, (u16)format);
u64 tlut_hash = tlut_size ? GetHashHiresTexture(tlut, (int)tlut_size) : 0;
std::string basename = StringFromFormat("tex1_%dx%d_%016lx", width, height, tex_hash);
std::string tlutname = tlut_size ? StringFromFormat("_%016lx", tlut_hash) : "";
std::string formatname = StringFromFormat("_%d", format);
if (!dump && textureMap.find(basename + "_*" + formatname) != textureMap.end())
return basename + "_*" + formatname;
return basename + tlutname + formatname;
}
HiresTexture* HiresTexture::Search(const u8* texture, size_t texture_size, const u8* tlut, size_t tlut_size, u32 width, u32 height, int format)

View File

@ -25,7 +25,7 @@ public:
const u8* texture, size_t texture_size,
const u8* tlut, size_t tlut_size,
u32 width, u32 height,
int format
int format, bool dump = false
);
~HiresTexture();

View File

@ -476,7 +476,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
src_data, texture_size,
&texMem[tlutaddr], palette_size,
width, height,
texformat
texformat, true
);
DumpTexture(entry, basename, 0);
}