MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / HasExpired

Method HasExpired

Source/HLEGraphics/CachedTexture.cpp:308–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308bool CachedTexture::HasExpired() const
309{
310 if (!kUpdateTexturesEveryFrame)
311 {
312 if (!IsFresh())
313 {
314 //Hack to make WONDER PROJECT J2 work (need to reload some textures every frame!) //Corn
315 if( (g_ROM.GameHacks == WONDER_PROJECTJ2) && (mTextureInfo.GetTLutFormat() == kTT_RGBA16) && (mTextureInfo.GetSize() == G_IM_SIZ_8b) ) return true;
316
317 //Hack for Worms Armageddon
318 if( (g_ROM.GameHacks == WORMS_ARMAGEDDON) && (mTextureInfo.GetSize() == G_IM_SIZ_8b) && (mTextureContentsHash != mTextureInfo.GenerateHashValue()) ) return true;
319
320 //Hack for Zelda OOT & MM text (only needed if there is not a general hash check) //Corn
321 if( g_ROM.ZELDA_HACK && (mTextureInfo.GetSize() == G_IM_SIZ_4b) && mTextureContentsHash != mTextureInfo.GenerateHashValue() ) return true;
322
323 //Check if texture has changed
324 //if( mTextureContentsHash != mTextureInfo.GenerateHashValue() ) return true;
325 }
326 }
327
328 //Otherwise we wait 20+random(0-3) frames before trashing the texture if unused
329 //Spread trashing them over time so not all get killed at once (lower value uses less VRAM) //Corn
330 return gRDPFrame - mFrameLastUsed > (20 + (FastRand() & 0x3));
331}
332
333#ifdef DAEDALUS_DEBUG_DISPLAYLIST
334void CachedTexture::DumpTexture( const TextureInfo & ti, const CNativeTexture * texture )

Callers 1

PurgeOldTexturesMethod · 0.80

Calls 4

FastRandFunction · 0.85
GetTLutFormatMethod · 0.80
GenerateHashValueMethod · 0.80
GetSizeMethod · 0.45

Tested by

no test coverage detected