summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Boot/Boot.cpp4
-rw-r--r--Source/Core/Core/Boot/Boot.h1
-rw-r--r--Source/Core/Core/Boot/Boot_BS2Emu.cpp40
3 files changed, 40 insertions, 5 deletions
diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp
index 4e2844c95b..86ea8e2179 100644
--- a/Source/Core/Core/Boot/Boot.cpp
+++ b/Source/Core/Core/Boot/Boot.cpp
@@ -538,14 +538,12 @@ bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
SetDefaultDisc();
SetupMSR();
+ SetupHID(config.bWii);
SetupBAT(config.bWii);
CopyDefaultExceptionHandlers();
if (config.bWii)
{
- PowerPC::ppcState.spr[SPR_HID0] = 0x0011c464;
- PowerPC::ppcState.spr[SPR_HID4] = 0x82000000;
-
// Set a value for the SP. It doesn't matter where this points to,
// as long as it is a valid location. This value is taken from a homebrew binary.
PowerPC::ppcState.gpr[1] = 0x8004d4bc;
diff --git a/Source/Core/Core/Boot/Boot.h b/Source/Core/Core/Boot/Boot.h
index 236dddaeca..78748717d0 100644
--- a/Source/Core/Core/Boot/Boot.h
+++ b/Source/Core/Core/Boot/Boot.h
@@ -160,6 +160,7 @@ private:
static bool BootNANDTitle(u64 title_id);
static void SetupMSR();
+ static void SetupHID(bool is_wii);
static void SetupBAT(bool is_wii);
static bool RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume,
const std::vector<DiscIO::Riivolution::Patch>& riivolution_patches);
diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp
index 1265317a90..2c51a8ddbf 100644
--- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp
+++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp
@@ -61,10 +61,44 @@ void CBoot::RunFunction(u32 address)
void CBoot::SetupMSR()
{
- MSR.FP = 1;
+ // 0x0002032
+ MSR.RI = 1;
MSR.DR = 1;
MSR.IR = 1;
- MSR.EE = 1;
+ MSR.FP = 1;
+}
+
+void CBoot::SetupHID(bool is_wii)
+{
+ // HID0 is 0x0011c464 on GC, 0x0011c664 on Wii
+ HID0.BHT = 1;
+ HID0.BTIC = 1;
+ HID0.DCFA = 1;
+ if (is_wii)
+ HID0.SPD = 1;
+ HID0.DCFI = 1;
+ HID0.DCE = 1;
+ // Note that Datel titles will fail to boot if the instruction cache is not enabled; see
+ // https://bugs.dolphin-emu.org/issues/8223
+ HID0.ICE = 1;
+ HID0.NHR = 1;
+ HID0.DPM = 1;
+
+ // HID1 is initialized in PowerPC.cpp to 0x80000000
+ // HID2 is 0xe0000000
+ HID2.PSE = 1;
+ HID2.WPE = 1;
+ HID2.LSQE = 1;
+
+ // HID4 is 0 on GC and 0x83900000 on Wii
+ if (is_wii)
+ {
+ HID4.L2CFI = 1;
+ HID4.LPE = 1;
+ HID4.ST0 = 1;
+ HID4.SBE = 1;
+ HID4.reserved_3 = 1;
+ }
}
void CBoot::SetupBAT(bool is_wii)
@@ -214,6 +248,7 @@ bool CBoot::EmulatedBS2_GC(const DiscIO::VolumeDisc& volume,
INFO_LOG_FMT(BOOT, "Faking GC BS2...");
SetupMSR();
+ SetupHID(/*is_wii*/ false);
SetupBAT(/*is_wii*/ false);
SetupGCMemory();
@@ -500,6 +535,7 @@ bool CBoot::EmulatedBS2_Wii(const DiscIO::VolumeDisc& volume,
DVDRead(volume, 0, 0x3180, 4, partition);
SetupMSR();
+ SetupHID(/*is_wii*/ true);
SetupBAT(/*is_wii*/ true);
Memory::Write_U32(0x4c000064, 0x00000300); // Write default DSI Handler: rfi