From b0e649c9bbfd84919d320ae03f1ff0061aeae045 Mon Sep 17 00:00:00 2001 From: rogerman Date: Wed, 2 Nov 2016 09:37:59 +0000 Subject: [PATCH] Texture Handler: - Fix a bug where 4x4 formatted textures were being read incorrectly. (Regression from r5569.) --- desmume/src/texcache.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/desmume/src/texcache.cpp b/desmume/src/texcache.cpp index 2df64d257..28403dbb9 100644 --- a/desmume/src/texcache.cpp +++ b/desmume/src/texcache.cpp @@ -469,17 +469,9 @@ TexCacheItem::TexCacheItem(const u32 texAttributes, const u32 palAttributes) isPalZeroTransparent = false; } + paletteAddress = (packFormat == TEXMODE_I2) ? palAttributes << 3 : palAttributes << 4; paletteSize = paletteSizeList[packFormat] * sizeof(u16); - if (paletteSize > 0) - { - paletteAddress = (packFormat == TEXMODE_I2) ? palAttributes << 3 : palAttributes << 4; - paletteColorTable = (u16 *)malloc_alignedCacheLine(paletteSize); - } - else - { - paletteAddress = 0; - paletteColorTable = NULL; - } + paletteColorTable = (paletteSize > 0) ? (u16 *)malloc_alignedCacheLine(paletteSize) : NULL; unpackFormat = TexFormat_None; unpackSize = 0;