Pass w/h in for replacement lookup.

So we can scale the w/h properly.
This commit is contained in:
Unknown W. Brackets 2016-04-30 16:29:46 -07:00
parent f039259a1a
commit 0c357c0ea3
5 changed files with 6 additions and 5 deletions

View File

@ -166,7 +166,7 @@ u32 TextureReplacer::ComputeHash(u32 addr, int bufw, int w, int h, GETextureForm
}
}
ReplacedTexture TextureReplacer::FindReplacement(u64 cachekey, u32 hash) {
ReplacedTexture TextureReplacer::FindReplacement(u64 cachekey, u32 hash, int w, int h) {
_assert_msg_(G3D, enabled_, "Replacement not enabled");
ReplacedTexture result;
@ -179,6 +179,7 @@ ReplacedTexture TextureReplacer::FindReplacement(u64 cachekey, u32 hash) {
if (!hashfile.empty() && File::Exists(filename)) {
// TODO: Count levels that exist, etc.
// TODO: Use w/h to determine actual size based on hash range (png may be smaller)?
}
}
return result;

View File

@ -107,7 +107,7 @@ public:
u32 ComputeHash(u32 addr, int bufw, int w, int h, GETextureFormat fmt, u16 maxSeenV);
ReplacedTexture FindReplacement(u64 cachekey, u32 hash);
ReplacedTexture FindReplacement(u64 cachekey, u32 hash, int w, int h);
void NotifyTextureDecoded(u64 cachekey, u32 hash, u32 addr, const void *data, int pitch, int level, int w, int h, ReplacedTextureFormat fmt);

View File

@ -1255,7 +1255,7 @@ void TextureCacheDX9::SetTexture(bool force) {
scaleFactor = scaleFactor > 4 ? 4 : (scaleFactor > 2 ? 2 : 1);
}
ReplacedTexture replaced = replacer.FindReplacement(cachekey, entry->fullhash);
ReplacedTexture replaced = replacer.FindReplacement(cachekey, entry->fullhash, w, h);
if (replaced.GetSize(0, w, h)) {
// We're replacing, so we won't scale.
scaleFactor = 1;

View File

@ -1364,7 +1364,7 @@ void TextureCache::SetTexture(bool force) {
scaleFactor = scaleFactor > 4 ? 4 : (scaleFactor > 2 ? 2 : 1);
}
ReplacedTexture replaced = replacer.FindReplacement(cachekey, entry->fullhash);
ReplacedTexture replaced = replacer.FindReplacement(cachekey, entry->fullhash, w, h);
if (replaced.GetSize(0, w, h)) {
// We're replacing, so we won't scale.
scaleFactor = 1;

View File

@ -1237,7 +1237,7 @@ void TextureCacheVulkan::SetTexture(VulkanPushBuffer *uploadBuffer) {
scaleFactor = scaleFactor > 4 ? 4 : (scaleFactor > 2 ? 2 : 1);
}
ReplacedTexture replaced = replacer.FindReplacement(cachekey, entry->fullhash);
ReplacedTexture replaced = replacer.FindReplacement(cachekey, entry->fullhash, w, h);
if (replaced.GetSize(0, w, h)) {
// We're replacing, so we won't scale.
scaleFactor = 1;