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

View File

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