From 8d3e0b19a40fd0cb763efe29e070fc82260d360e Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Sat, 10 Jan 2009 15:15:39 +0000 Subject: [PATCH] core: - fix cache texture palette; --- desmume/src/OGLRender.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/desmume/src/OGLRender.cpp b/desmume/src/OGLRender.cpp index 9b067fc85..4c0765aa2 100644 --- a/desmume/src/OGLRender.cpp +++ b/desmume/src/OGLRender.cpp @@ -549,7 +549,7 @@ static void setTexture(unsigned int format, unsigned int texpal) //each texel, palette, and 4x4 lookup need to be memory mapped. //since we're caching textures, this cost is not too severe. - const int palSize[]={8,32,512,0,64,16,0}; + const int palSize[]={0, 8, 32, 512, 64, 0, 16, 0}; unsigned int x=0, y=0, i; unsigned int palZeroTransparent; @@ -622,8 +622,7 @@ static void setTexture(unsigned int format, unsigned int texpal) if ( (texcache[i].frm == format) && (texcache[i].pal == texpal) ) { - if ((texcache[i].mode == 5) || - (texcache[i].mode == 7) || + if ((texcache[i].palSize == 0) || !memcmp(texcache[i].palette, pal, texcache[i].palSize) ) { //TODO - this doesnt correctly span bank boundaries. in fact, it seems quite dangerous.