IOS: Clear 0-0x3fff when setting up low MEM1 constants

Low MEM1 is cleared by IOS before all the other constants are written.

This will overwrite the Gecko code handler but it should be fine
because HLE::Reload (which will set up the code handler hook again)
will be called after a title change is detected.
This commit is contained in:
Léo Lam 2021-02-25 16:18:58 +01:00
parent be500a98e2
commit 011f7789e0
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
1 changed files with 6 additions and 0 deletions

View File

@ -137,6 +137,12 @@ static bool SetupMemory(u64 ios_title_id, MemorySetupType setup_type)
return true;
}
// This region is typically used to store constants (e.g. game ID, console type, ...)
// and system information (see below).
constexpr u32 LOW_MEM1_REGION_START = 0;
constexpr u32 LOW_MEM1_REGION_SIZE = 0x3fff;
Memory::Memset(LOW_MEM1_REGION_START, 0, LOW_MEM1_REGION_SIZE);
Memory::Write_U32(target_imv->mem1_physical_size, ADDR_MEM1_SIZE);
Memory::Write_U32(target_imv->mem1_simulated_size, ADDR_MEM1_SIM_SIZE);
Memory::Write_U32(target_imv->mem1_end, ADDR_MEM1_END);