diff --git a/desmume/ChangeLog b/desmume/ChangeLog index 3e2131596..2c8fd3a15 100644 --- a/desmume/ChangeLog +++ b/desmume/ChangeLog @@ -7,6 +7,7 @@ General/Core: bug: fix div and sqrt busy flag bug bug: fix vectest bug: fix lid savestate desync + bug: fix texcache memory GB explosion when games use tons of tiny 3d sprites enh: support devkitpro argv enh: add gbaslot-rom commandline @@ -24,8 +25,10 @@ Windows: Linux/OSX: bug: fix building for nosse2 systems + bug: fix --num-cores enh: add --nojoy=1 to fix laptops with accelerometers + 0.9.4 -> 0.9.5 (r2437-r3075) 0.9.5 introduces an entirely rewritten main emulation loop diff --git a/desmume/src/driver.cpp b/desmume/src/driver.cpp index a1ac4c810..9c98c41ef 100644 --- a/desmume/src/driver.cpp +++ b/desmume/src/driver.cpp @@ -84,7 +84,7 @@ public: engine.updateFogTable(); - engine.initFramebuffer(kViewportWidth,kViewportHeight,gfx3d.state.enableClearImage); + engine.initFramebuffer(kViewportWidth,kViewportHeight,gfx3d.state.enableClearImage?true:false); engine.updateToonTable(); engine.updateFloatColors(); engine.performClipping(checkMaterialInterpolate->IsChecked()); diff --git a/desmume/src/rasterize.cpp b/desmume/src/rasterize.cpp index 09cdf0756..cbf416405 100644 --- a/desmume/src/rasterize.cpp +++ b/desmume/src/rasterize.cpp @@ -1437,7 +1437,7 @@ static void SoftRastRender() if(gfx3d.state.enableFog && CommonSettings.GFX3D_Fog) mainSoftRasterizer.updateFogTable(); - mainSoftRasterizer.initFramebuffer(256,192,gfx3d.state.enableClearImage); + mainSoftRasterizer.initFramebuffer(256,192,gfx3d.state.enableClearImage?true:false); mainSoftRasterizer.updateToonTable(); mainSoftRasterizer.updateFloatColors(); mainSoftRasterizer.performClipping(CommonSettings.GFX3D_HighResolutionInterpolateColor); diff --git a/desmume/src/texcache.cpp b/desmume/src/texcache.cpp index ae1a4a999..d618ec98b 100644 --- a/desmume/src/texcache.cpp +++ b/desmume/src/texcache.cpp @@ -193,7 +193,11 @@ public: TTexCacheItemMultimap index; //this ought to be enough for anyone - static const u32 kMaxCacheSize = 64*1024*1024; + //static const u32 kMaxCacheSize = 64*1024*1024; + //changed by zeromus on 15-dec. I couldnt find any games that were getting anywhere NEAR 64 + static const u32 kMaxCacheSize = 16*1024*1024; + //metal slug burns through sprites so fast, it can test it pretty quickly though + //this is not really precise, it is off by a constant factor u32 cache_size; @@ -307,7 +311,7 @@ public: if(mspal.size != 0 && memcmp(curr->dump.palette,pal,mspal.size)) goto REJECT; //when the texture data doesn't match - if(ms.memcmp(curr->dump.texture,sizeof(curr->dump.texture))) goto REJECT; + if(ms.memcmp(&curr->dump.texture[0],sizeof(curr->dump.texture))) goto REJECT; //if the texture is 4x4 then the index data must match if(textureMode == TEXMODE_4X4) @@ -342,7 +346,6 @@ public: newitem->sizeY=sizeY; newitem->invSizeX=1.0f/((float)(sizeX)); newitem->invSizeY=1.0f/((float)(sizeY)); - newitem->dump.textureSize = ms.dump(newitem->dump.texture,sizeof(newitem->dump.texture)); newitem->decode_len = sizeX*sizeY*4; newitem->mode = textureMode; newitem->decoded = new u8[newitem->decode_len]; @@ -356,13 +359,15 @@ public: { memcpy(newitem->dump.palette, pal, palSize*2); } - //dump 4x4 index data for cache keying - newitem->dump.indexSize = 0; + + //dump texture and 4x4 index data for cache keying + const int texsize = newitem->dump.textureSize = ms.size; + const int indexsize = newitem->dump.indexSize = msIndex.size; + newitem->dump.texture = new u8[texsize+indexsize]; + ms.dump(&newitem->dump.texture[0],newitem->dump.maxTextureSize); //dump texture if(textureMode == TEXMODE_4X4) - { - newitem->dump.indexSize = min(msIndex.size,(int)sizeof(newitem->dump.texture) - newitem->dump.textureSize); - msIndex.dump(newitem->dump.texture+newitem->dump.textureSize,newitem->dump.indexSize); - } + msIndex.dump(newitem->dump.texture+newitem->dump.textureSize,newitem->dump.indexSize); //dump 4x4 + //============================================================================ //Texture conversion @@ -637,6 +642,7 @@ public: void evict(u32 target = kMaxCacheSize) { + printf("%d %d/%d\n",index.size(),cache_size/1024,target/1024); //dont do anything unless we're over the target if(cache_size