From 53de453958769b7ef12cfd4b6d006705caa48f8a Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Tue, 6 Oct 2009 23:11:39 +0000 Subject: [PATCH] correct some register initializations in IPL HLE. (Just setup global pointers so apploaders don't complain) I only know that it makes Luigi's Mansion's apploader stop complaining, and didn't break any games I tested. :) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4367 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp | 28 ++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp b/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp index 1f04dea230..716f441f4a 100644 --- a/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp +++ b/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp @@ -65,12 +65,13 @@ void CBoot::EmulatedBIOS(bool _bDebug) // DVDInterface::DVDRead(0x00000000, 0x80000000, 10); // write boot info needed for multidisc games - Memory::Write_U32(0x4c000064, 0x80000300); // write default DFI Handler: rfi - Memory::Write_U32(0x4c000064, 0x80000800); // write default FPU Handler: rfi - Memory::Write_U32(0x4c000064, 0x80000C00); // write default Syscall Handler: rfi - Memory::Write_U32(0xc2339f3d, 0x8000001C); // game disc - Memory::Write_U32(0x0D15EA5E, 0x80000020); // booted from bootrom. 0xE5207C22 = booted from jtag - Memory::Write_U32(0x01800000, 0x80000028); // Physical Memory Size + Memory::Write_U32(0x4c000064, 0x80000300); // write default DFI Handler: rfi + Memory::Write_U32(0x4c000064, 0x80000800); // write default FPU Handler: rfi + Memory::Write_U32(0x4c000064, 0x80000C00); // write default Syscall Handler: rfi + + Memory::Write_U32(0xc2339f3d, 0x8000001C); // gamecube game disc magic number + Memory::Write_U32(0x0D15EA5E, 0x80000020); // booted from bootrom. 0xE5207C22 = booted from jtag + Memory::Write_U32(0x01800000, 0x80000028); // Physical Memory Size // On any of the production boards, ikaruga fails to read the memcard the first time. It succeeds on the second time though. // And (only sometimes?) with 0x00000003, the loading picture in the bottom right will become corrupt and @@ -84,7 +85,20 @@ void CBoot::EmulatedBIOS(bool _bDebug) // Load Apploader to Memory - The apploader is hardcoded to begin at byte 9 280 on the disc, // but it seems like the size can be variable. Compare with yagcd chap 13. - PowerPC::ppcState.gpr[1] = 0x816ffff0; // StackPointer + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC) + { + DEBUG_LOG(MASTER_LOG, "Call bNTSC"); + PowerPC::ppcState.gpr[1] = 0x81566550; // StackPointer, used to be set to 0x816ffff0 + PowerPC::ppcState.gpr[2] = 0x81465cc0; // global pointer to Small Data Area 2 Base (haven't seen anything use it...meh) + PowerPC::ppcState.gpr[13] = 0x81465320; // global pointer to Small Data Area Base (Luigi's Mansion's apploader uses it) + } + else + { + DEBUG_LOG(MASTER_LOG, "Call PAL"); + PowerPC::ppcState.gpr[1] = 0x815edca8; + PowerPC::ppcState.gpr[2] = 0x814b5b20; + PowerPC::ppcState.gpr[13] = 0x814b4fc0; + } u32 iAppLoaderOffset = 0x2440; // 0x1c40 - 2MB lower...perhaps used on early GCMs? MYSTERY OLD COMMENT u32 iAppLoaderEntry = VolumeHandler::Read32(iAppLoaderOffset + 0x10); u32 iAppLoaderSize = VolumeHandler::Read32(iAppLoaderOffset + 0x14);