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

Method PurgeChunk

Source/Utility/ROMFileCache.cpp:165–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163//
164//*****************************************************************************
165void ROMFileCache::PurgeChunk( CacheIdx cache_idx )
166{
167 #ifdef DAEDALUS_ENABLE_ASSERTS
168 DAEDALUS_ASSERT( cache_idx < CACHE_SIZE, "Invalid chunk index" );
169 #endif
170
171 SChunkInfo & chunk_info( mpChunkInfo[ cache_idx ] );
172 u32 current_chunk_address( chunk_info.StartOffset );
173 if( chunk_info.InUse() )
174 {
175 //DBGConsole_Msg( 0, "[CRomCache - purging %02x %08x-%08x", cache_idx, chunk_info.StartOffset, chunk_info.StartOffset + CHUNK_SIZE );
176 u32 chunk_map_idx( AddressToChunkMapIndex( current_chunk_address ) );
177 #ifdef DAEDALUS_ENABLE_ASSERTS
178 DAEDALUS_ASSERT( chunk_map_idx < mChunkMapEntries, "Chunk address is out of range?" );
179 DAEDALUS_ASSERT( mpChunkMap[ chunk_map_idx ] == cache_idx, "Chunk map inconsistancy" );
180 #endif
181 // Scrub down the chunk map to show it's no longer cached
182 mpChunkMap[ chunk_map_idx ] = INVALID_IDX;
183 }
184 else
185 {
186 //DBGConsole_Msg( 0, "[CRomCache - purging %02x (unused)", cache_idx );
187 }
188
189 // Scrub these down
190 chunk_info.StartOffset = INVALID_ADDRESS;
191 chunk_info.LastUseIdx = 0;
192}
193
194//*****************************************************************************
195//

Callers

nothing calls this directly

Calls 2

AddressToChunkMapIndexFunction · 0.85
InUseMethod · 0.80

Tested by

no test coverage detected