MMU: Use templates for Read/Write functions
This commit is contained in:
1 parent
03ef9b4995
commit
8a97ce9124
32 files changed
+487
-775
No files matched your search
@@ -52,7 +52,7 @@ void PresetTimeBaseTicks(Core::System& system, const Core::CPUThreadGuard& guard
|
||||
|
||||
const u64 time_base_ticks = emulated_time * 40500000ULL;
|
||||
|
||||
PowerPC::MMU::HostWrite_U64(guard, time_base_ticks, 0x800030D8);
|
||||
PowerPC::MMU::HostWrite<u64>(guard, time_base_ticks, 0x800030D8);
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
@@ -172,14 +172,14 @@ bool CBoot::RunApploader(Core::System& system, const Core::CPUThreadGuard& guard
|
||||
ppc_state.gpr[4] = iAppLoaderFuncAddr + 4;
|
||||
ppc_state.gpr[5] = iAppLoaderFuncAddr + 8;
|
||||
RunFunction(system, *entry);
|
||||
const u32 iAppLoaderInit = mmu.Read_U32(iAppLoaderFuncAddr + 0);
|
||||
const u32 iAppLoaderMain = mmu.Read_U32(iAppLoaderFuncAddr + 4);
|
||||
const u32 iAppLoaderClose = mmu.Read_U32(iAppLoaderFuncAddr + 8);
|
||||
const u32 iAppLoaderInit = mmu.Read<u32>(iAppLoaderFuncAddr + 0);
|
||||
const u32 iAppLoaderMain = mmu.Read<u32>(iAppLoaderFuncAddr + 4);
|
||||
const u32 iAppLoaderClose = mmu.Read<u32>(iAppLoaderFuncAddr + 8);
|
||||
|
||||
// iAppLoaderInit
|
||||
DEBUG_LOG_FMT(BOOT, "Call iAppLoaderInit");
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x4E800020, 0x81300000); // Write BLR
|
||||
HLE::Patch(system, 0x81300000, "AppLoaderReport"); // HLE OSReport for Apploader
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x4E800020, 0x81300000); // Write BLR
|
||||
HLE::Patch(system, 0x81300000, "AppLoaderReport"); // HLE OSReport for Apploader
|
||||
ppc_state.gpr[3] = 0x81300000;
|
||||
RunFunction(system, iAppLoaderInit);
|
||||
|
||||
@@ -200,9 +200,9 @@ bool CBoot::RunApploader(Core::System& system, const Core::CPUThreadGuard& guard
|
||||
// iAppLoaderMain returns 0 when there are no more sections to copy.
|
||||
while (ppc_state.gpr[3] != 0x00)
|
||||
{
|
||||
const u32 ram_address = mmu.Read_U32(0x81300004);
|
||||
const u32 length = mmu.Read_U32(0x81300008);
|
||||
const u32 dvd_offset = mmu.Read_U32(0x8130000c) << (is_wii ? 2 : 0);
|
||||
const u32 ram_address = mmu.Read<u32>(0x81300004);
|
||||
const u32 length = mmu.Read<u32>(0x81300008);
|
||||
const u32 dvd_offset = mmu.Read<u32>(0x8130000c) << (is_wii ? 2 : 0);
|
||||
|
||||
INFO_LOG_FMT(BOOT, "DVDRead: offset: {:08x} memOffset: {:08x} length: {}", dvd_offset,
|
||||
ram_address, length);
|
||||
@@ -243,35 +243,36 @@ void CBoot::SetupGCMemory(Core::System& system, const Core::CPUThreadGuard& guar
|
||||
auto& memory = system.GetMemory();
|
||||
|
||||
// Booted from bootrom. 0xE5207C22 = booted from jtag
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x0D15EA5E, 0x80000020);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x0D15EA5E, 0x80000020);
|
||||
|
||||
// Physical Memory Size (24MB on retail)
|
||||
PowerPC::MMU::HostWrite_U32(guard, memory.GetRamSizeReal(), 0x80000028);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, memory.GetRamSizeReal(), 0x80000028);
|
||||
|
||||
// Console type - DevKit (retail ID == 0x00000003) see YAGCD 4.2.1.1.2
|
||||
// TODO: determine why some games fail when using a retail ID.
|
||||
// (Seem to take different EXI paths, see Ikaruga for example)
|
||||
const u32 console_type = static_cast<u32>(Core::ConsoleType::LatestDevkit);
|
||||
PowerPC::MMU::HostWrite_U32(guard, console_type, 0x8000002C);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, console_type, 0x8000002C);
|
||||
|
||||
// Fake the VI Init of the IPL (YAGCD 4.2.1.4)
|
||||
PowerPC::MMU::HostWrite_U32(guard, DiscIO::IsNTSC(SConfig::GetInstance().m_region) ? 0 : 1,
|
||||
0x800000CC);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, DiscIO::IsNTSC(SConfig::GetInstance().m_region) ? 0 : 1,
|
||||
0x800000CC);
|
||||
|
||||
// ARAM Size. 16MB main + 4/16/32MB external. (retail consoles have no external ARAM)
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x01000000, 0x800000d0);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x01000000, 0x800000d0);
|
||||
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x09a7ec80, 0x800000F8); // Bus Clock Speed
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x1cf7c580, 0x800000FC); // CPU Clock Speed
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x09a7ec80, 0x800000F8); // Bus Clock Speed
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x1cf7c580, 0x800000FC); // CPU Clock Speed
|
||||
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x4c000064, 0x80000300); // Write default DSI Handler: rfi
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x4c000064, 0x80000800); // Write default FPU Handler: rfi
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x4c000064, 0x80000C00); // Write default Syscall Handler: rfi
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x4c000064, 0x80000300); // Write default DSI Handler: rfi
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x4c000064, 0x80000800); // Write default FPU Handler: rfi
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x4c000064,
|
||||
0x80000C00); // Write default Syscall Handler: rfi
|
||||
|
||||
PresetTimeBaseTicks(system, guard);
|
||||
|
||||
// HIO checks this
|
||||
// PowerPC::MMU::HostWrite_U16(0x8200, 0x000030e6); // Console type
|
||||
// PowerPC::MMU::HostWrite<u16>(guard, 0x8200, 0x000030e6); // Console type
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
|
||||
Reference in new issue
Block a user