Skip to content

Commit

Permalink
Fix text issue in God Eater Burst. Forgot that games can allocate tex…
Browse files Browse the repository at this point in the history
…ture 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
  • Loading branch information
hrydgard committed Oct 13, 2020
1 parent 8367b10 commit b8e8325
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Core/MemMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand Down
7 changes: 3 additions & 4 deletions GPU/Common/TextureCacheCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b8e8325

Please sign in to comment.