diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2017-05-23 14:40:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-23 14:40:11 +0200 |
| commit | e2d4fe6881f9b4be1233b5aa25a85229fc168ea0 (patch) | |
| tree | ac27ecc78b242c05c28779e73fc35ceb9210ccbf /Source | |
| parent | 4870e4119bcbf54edd37aace023cf0d1fb2894b2 (diff) | |
| parent | 1e56972e4fcd67be6bad1e9a201c29fe295f5d07 (diff) | |
Merge pull request #5421 from JosJuice/load-bs2-setupbat
Use SetupBAT in Load_BS2
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/Boot/Boot.cpp | 19 | ||||
| -rw-r--r-- | Source/Core/Core/Boot/Boot.h | 1 | ||||
| -rw-r--r-- | Source/Core/Core/Boot/Boot_BS2Emu.cpp | 8 | ||||
| -rw-r--r-- | Source/Core/Core/Boot/Boot_ELF.cpp | 1 |
4 files changed, 19 insertions, 10 deletions
diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index b4d96afeaf..daf9472763 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -250,23 +250,23 @@ bool CBoot::Load_BS2(const std::string& boot_rom_filename) // to work around this. Memory::CopyToEmu(0x01200000, data.data() + 0x100, 0x700); Memory::CopyToEmu(0x01300000, data.data() + 0x820, 0x1AFE00); + PowerPC::ppcState.gpr[3] = 0xfff0001f; PowerPC::ppcState.gpr[4] = 0x00002030; PowerPC::ppcState.gpr[5] = 0x0000009c; - PowerPC::ppcState.msr = 0x00002030; + + UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr); + m_MSR.FP = 1; + m_MSR.DR = 1; + m_MSR.IR = 1; + PowerPC::ppcState.spr[SPR_HID0] = 0x0011c464; - PowerPC::ppcState.spr[SPR_IBAT0U] = 0x80001fff; - PowerPC::ppcState.spr[SPR_IBAT0L] = 0x00000002; PowerPC::ppcState.spr[SPR_IBAT3U] = 0xfff0001f; PowerPC::ppcState.spr[SPR_IBAT3L] = 0xfff00001; - PowerPC::ppcState.spr[SPR_DBAT0U] = 0x80001fff; - PowerPC::ppcState.spr[SPR_DBAT0L] = 0x00000002; - PowerPC::ppcState.spr[SPR_DBAT1U] = 0xc0001fff; - PowerPC::ppcState.spr[SPR_DBAT1L] = 0x0000002a; PowerPC::ppcState.spr[SPR_DBAT3U] = 0xfff0001f; PowerPC::ppcState.spr[SPR_DBAT3L] = 0xfff00001; - PowerPC::DBATUpdated(); - PowerPC::IBATUpdated(); + SetupBAT(/*is_wii*/ false); + PC = 0x81200150; return true; } @@ -359,6 +359,7 @@ bool CBoot::BootUp() if (dolWii) { HID4.SBE = 1; + SetupMSR(); SetupBAT(dolWii); // Because there is no TMD to get the requested system (IOS) version from, diff --git a/Source/Core/Core/Boot/Boot.h b/Source/Core/Core/Boot/Boot.h index 1b90cf3457..c383dc2962 100644 --- a/Source/Core/Core/Boot/Boot.h +++ b/Source/Core/Core/Boot/Boot.h @@ -55,6 +55,7 @@ private: static bool Boot_ELF(const std::string& filename); static bool Boot_WiiWAD(const std::string& filename); + static void SetupMSR(); static void SetupBAT(bool is_wii); static bool RunApploader(bool is_wii, const DiscIO::IVolume& volume); static bool EmulatedBS2_GC(const DiscIO::IVolume* volume, bool skip_app_loader = false); diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp index c8288c4d44..8d0fff6f1c 100644 --- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp +++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp @@ -51,13 +51,17 @@ void CBoot::RunFunction(u32 address) PowerPC::SingleStep(); } -void CBoot::SetupBAT(bool is_wii) +void CBoot::SetupMSR() { UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr); m_MSR.FP = 1; m_MSR.DR = 1; m_MSR.IR = 1; m_MSR.EE = 1; +} + +void CBoot::SetupBAT(bool is_wii) +{ PowerPC::ppcState.spr[SPR_IBAT0U] = 0x80001fff; PowerPC::ppcState.spr[SPR_IBAT0L] = 0x00000002; PowerPC::ppcState.spr[SPR_DBAT0U] = 0x80001fff; @@ -158,6 +162,7 @@ bool CBoot::EmulatedBS2_GC(const DiscIO::IVolume* volume, bool skip_app_loader) { INFO_LOG(BOOT, "Faking GC BS2..."); + SetupMSR(); SetupBAT(/*is_wii*/ false); // Write necessary values @@ -350,6 +355,7 @@ bool CBoot::EmulatedBS2_Wii(const DiscIO::IVolume* volume) // after this check during booting. DVDRead(*volume, 0, 0x3180, 4, partition); + SetupMSR(); SetupBAT(/*is_wii*/ true); Memory::Write_U32(0x4c000064, 0x00000300); // Write default DSI Handler: rfi diff --git a/Source/Core/Core/Boot/Boot_ELF.cpp b/Source/Core/Core/Boot/Boot_ELF.cpp index 9130fafdfc..1cef0937ba 100644 --- a/Source/Core/Core/Boot/Boot_ELF.cpp +++ b/Source/Core/Core/Boot/Boot_ELF.cpp @@ -70,6 +70,7 @@ bool CBoot::Boot_ELF(const std::string& filename) const bool is_wii = IsElfWii(filename); if (is_wii) HID4.SBE = 1; + SetupMSR(); SetupBAT(is_wii); if (!reader.LoadSymbols()) |
