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

Function Memory_Tlb_Hack

Source/Core/Memory.cpp:272–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272static void Memory_Tlb_Hack()
273{
274 bool RomBaseKnown {RomBuffer::IsRomLoaded() && RomBuffer::IsRomAddressFixed()};
275
276 const void * rom_address = RomBaseKnown ? RomBuffer::GetFixedRomBaseAddress() : nullptr;
277 if (rom_address != nullptr)
278 {
279 u32 offset {};
280 switch(g_ROM.rh.CountryID)
281 {
282 case 0x45: offset = 0x34b30; break;
283 case 0x4A: offset = 0x34b70; break;
284 case 0x50: offset = 0x329f0; break;
285 default:
286 offset = 0x34b30; // we can not handle
287 return;
288 }
289
290 u32 start_addr {0x7F000000 >> 18};
291 u32 end_addr {0x7FFFFFFF >> 18};
292
293 u8 * pRead {(u8*)(reinterpret_cast< u32 >(rom_address) + offset - (start_addr << 18))};
294
295 for (u32 i = start_addr; i <= end_addr; i++)
296 {
297 g_MemoryLookupTableRead[i].pRead = pRead;
298 }
299 }
300
301 g_MemoryLookupTableRead[0x70000000 >> 18].pRead = (u8*)(reinterpret_cast< u32 >( g_pMemoryBuffers[MEM_RD_RAM]) - 0x70000000);
302}
303
304static void Memory_InitFunc(u32 start, u32 size, const u32 ReadRegion, const u32 WriteRegion, mReadFunction ReadFunc, mWriteFunction WriteFunc)
305{

Callers 1

Memory_InitTablesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected