From b8e83258882fd7c1c89306687549cac0f17eb786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 14 Oct 2020 00:08:10 +0200 Subject: [PATCH] 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 --- Core/MemMap.h | 7 +++++++ GPU/Common/TextureCacheCommon.cpp | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Core/MemMap.h b/Core/MemMap.h index 7383b719eab2..d5df36cad7de 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -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 - diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 03e62629400f..1c5c63cdceb7 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -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) {