Fix text issue in God Eater Burst. Forgot that games can allocate texture in volatile memory too.

We considered any texture from kernel memory "reliable", which is wrong
since games can allocate out of the upper half of kernel RAM, which is
called "volatile" memory.

Fixes issue #13511
This commit is contained in:
Henrik Rydgård 2020-10-14 00:08:10 +02:00
parent 8367b10d9d
commit b8e8325888
2 changed files with 10 additions and 4 deletions

View File

@ -261,10 +261,17 @@ inline bool IsVRAMAddress(const u32 address) {
inline bool IsDepthTexVRAMAddress(const u32 address) {
return ((address & 0x3FE00000) == 0x04200000) || ((address & 0x3FE00000) == 0x04600000);
}
// 0x08000000 -> 0x08800000
inline bool IsKernelAddress(const u32 address) {
return ((address & 0x3F800000) == 0x08000000);
}
// 0x08000000 -> 0x08400000
inline bool IsKernelAndNotVolatileAddress(const u32 address) {
return ((address & 0x3FC00000) == 0x08000000);
}
bool IsScratchpadAddress(const u32 address);
// Used for auto-converted char * parameters, which can sometimes legitimately be null -

View File

@ -497,15 +497,14 @@ TexCacheEntry *TextureCacheCommon::SetTexture() {
if (!entry) {
VERBOSE_LOG(G3D, "No texture in cache for %08x, decoding...", texaddr);
TexCacheEntry *entryNew = new TexCacheEntry{};
cache_[cachekey].reset(entryNew);
entry = new TexCacheEntry{};
cache_[cachekey].reset(entry);
if (hasClut && clutRenderAddress_ != 0xFFFFFFFF) {
WARN_LOG_REPORT_ONCE(clutUseRender, G3D, "Using texture with rendered CLUT: texfmt=%d, clutfmt=%d", gstate.getTextureFormat(), gstate.getClutPaletteFormat());
}
entry = entryNew;
if (Memory::IsKernelAddress(texaddr)) {
if (Memory::IsKernelAndNotVolatileAddress(texaddr)) {
// It's the builtin font texture.
entry->status = TexCacheEntry::STATUS_RELIABLE;
} else if (g_Config.bTextureBackoffCache) {