PowerPC: Parametrize HID4 macro.

This commit is contained in:
Admiral H. Curtiss 2023-01-09 20:53:35 +01:00
parent 6f0ab1b33e
commit 31483e492e
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
3 changed files with 9 additions and 9 deletions

View File

@ -98,11 +98,11 @@ void CBoot::SetupHID(bool is_wii)
// 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;
HID4(PowerPC::ppcState).L2CFI = 1;
HID4(PowerPC::ppcState).LPE = 1;
HID4(PowerPC::ppcState).ST0 = 1;
HID4(PowerPC::ppcState).SBE = 1;
HID4(PowerPC::ppcState).reserved_3 = 1;
}
}
@ -122,7 +122,7 @@ void CBoot::SetupBAT(bool is_wii)
PowerPC::ppcState.spr[SPR_DBAT4L] = 0x10000002;
PowerPC::ppcState.spr[SPR_DBAT5U] = 0xd0001fff;
PowerPC::ppcState.spr[SPR_DBAT5L] = 0x1000002a;
HID4.SBE = 1;
HID4(PowerPC::ppcState).SBE = 1;
}
PowerPC::DBATUpdated();
PowerPC::IBATUpdated();

View File

@ -1736,7 +1736,7 @@ void DBATUpdated()
dbat_table = {};
UpdateBATs(dbat_table, SPR_DBAT0U);
bool extended_bats = SConfig::GetInstance().bWii && HID4.SBE;
bool extended_bats = SConfig::GetInstance().bWii && HID4(PowerPC::ppcState).SBE;
if (extended_bats)
UpdateBATs(dbat_table, SPR_DBAT4U);
if (memory.GetFakeVMEM())
@ -1761,7 +1761,7 @@ void IBATUpdated()
ibat_table = {};
UpdateBATs(ibat_table, SPR_IBAT0U);
bool extended_bats = SConfig::GetInstance().bWii && HID4.SBE;
bool extended_bats = SConfig::GetInstance().bWii && HID4(PowerPC::ppcState).SBE;
if (extended_bats)
UpdateBATs(ibat_table, SPR_IBAT4U);
if (memory.GetFakeVMEM())

View File

@ -237,7 +237,7 @@ void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst);
// Easy register access macros.
#define HID0(ppc_state) ((UReg_HID0&)(ppc_state).spr[SPR_HID0])
#define HID2(ppc_state) ((UReg_HID2&)(ppc_state).spr[SPR_HID2])
#define HID4 ((UReg_HID4&)PowerPC::ppcState.spr[SPR_HID4])
#define HID4(ppc_state) ((UReg_HID4&)(ppc_state).spr[SPR_HID4])
#define DMAU (*(UReg_DMAU*)&PowerPC::ppcState.spr[SPR_DMAU])
#define DMAL (*(UReg_DMAL*)&PowerPC::ppcState.spr[SPR_DMAL])
#define MMCR0 ((UReg_MMCR0&)PowerPC::ppcState.spr[SPR_MMCR0])