diff options
| author | degasus <wickmarkus@web.de> | 2015-11-17 23:18:37 +0100 |
|---|---|---|
| committer | degasus <wickmarkus@web.de> | 2015-11-17 23:29:54 +0100 |
| commit | ee2223c4a06586c0c232e5f1e573b8c84888d62d (patch) | |
| tree | d340ca57407ada148369589f72f690ddba45b871 /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | fb87de83d494b9fae552b0608f0193188a02a4e6 (diff) | |
TextureCache: Fix crash for invalid textures.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 693b4b5ba1..f6d07a476b 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -409,17 +409,23 @@ TextureCacheBase::TCacheEntryBase* TextureCacheBase::Load(const u32 stage) additional_mips_size += TexDecoder_GetTextureSizeInBytes(expanded_mip_width, expanded_mip_height, texformat); } - // If we are recording a FifoLog, keep track of what memory we read. - // FifiRecorder does it's own memory modification tracking independant of the texture hashing below. - if (g_bRecordFifoData && !from_tmem) - FifoRecorder::GetInstance().UseMemory(address, texture_size + additional_mips_size, MemoryUpdate::TEXTURE_MAP); - const u8* src_data; if (from_tmem) src_data = &texMem[bpmem.tex[stage / 4].texImage1[stage % 4].tmem_even * TMEM_LINE_SIZE]; else src_data = Memory::GetPointer(address); + if (!src_data) + { + ERROR_LOG(VIDEO, "Trying to use an invalid texture address 0x%8x", address); + return nullptr; + } + + // If we are recording a FifoLog, keep track of what memory we read. + // FifiRecorder does it's own memory modification tracking independant of the texture hashing below. + if (g_bRecordFifoData && !from_tmem) + FifoRecorder::GetInstance().UseMemory(address, texture_size + additional_mips_size, MemoryUpdate::TEXTURE_MAP); + // TODO: This doesn't hash GB tiles for preloaded RGBA8 textures (instead, it's hashing more data from the low tmem bank than it should) base_hash = GetHash64(src_data, texture_size, g_ActiveConfig.iSafeTextureCache_ColorSamples); u32 palette_size = 0; |
