From 9fa4725f67a0fb05e1616695e3790a3a345193ce Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 27 Apr 2013 01:03:40 -0700 Subject: [PATCH] Mask clut indexes for > 8-bit clut indexes. Fixes #1532. --- GPU/GLES/TextureCache.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 37b3849fff..ed0b8a0796 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -243,8 +243,14 @@ inline void DeIndexTexture(ClutT *dest, const IndexT *indexed, int length, const const bool nakedIndex = (gstate.clutformat & ~3) == 0xC500FF00; if (nakedIndex) { - for (int i = 0; i < length; ++i) { - *dest++ = clut[*indexed++]; + if (sizeof(IndexT) == 1) { + for (int i = 0; i < length; ++i) { + *dest++ = clut[*indexed++]; + } + } else { + for (int i = 0; i < length; ++i) { + *dest++ = clut[(*indexed++) & 0xFF]; + } } } else { for (int i = 0; i < length; ++i) {