SI: still works with things that check status reg, also doesn't make games like MK:DD hang.

(there's plenty to be done in SI, but for now...it "just works" ;p )

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4715 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-12-22 06:45:00 +00:00
parent acb9e7ca29
commit 0da21aa115
1 changed files with 30 additions and 22 deletions

View File

@ -255,7 +255,7 @@ void Init()
g_StatusReg.Hex = 0; g_StatusReg.Hex = 0;
g_EXIClockCount.Hex = 0; g_EXIClockCount.Hex = 0;
g_EXIClockCount.LOCK = 1; //g_EXIClockCount.LOCK = 1; // Supposedly set on reset, but logs from real wii don't look like it is...
memset(g_SIBuffer, 0, 128); memset(g_SIBuffer, 0, 128);
changeDevice = CoreTiming::RegisterEvent("ChangeSIDevice", ChangeDeviceCallback); changeDevice = CoreTiming::RegisterEvent("ChangeSIDevice", ChangeDeviceCallback);
@ -269,8 +269,6 @@ void Shutdown()
void Read32(u32& _uReturnValue, const u32 _iAddress) void Read32(u32& _uReturnValue, const u32 _iAddress)
{ {
DEBUG_LOG(SERIALINTERFACE, "(r32): 0x%08x", _iAddress);
// SIBuffer // SIBuffer
if ((_iAddress >= 0xCC006480 && _iAddress < 0xCC006500) || if ((_iAddress >= 0xCC006480 && _iAddress < 0xCC006500) ||
(_iAddress >= 0xCD006480 && _iAddress < 0xCD006500)) (_iAddress >= 0xCD006480 && _iAddress < 0xCD006500))
@ -279,6 +277,9 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
return; return;
} }
// error if not changed in the switch
_uReturnValue = 0xdeadbeef;
// registers // registers
switch (_iAddress & 0x3FF) switch (_iAddress & 0x3FF)
{ {
@ -287,77 +288,85 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
case SI_CHANNEL_0_OUT: case SI_CHANNEL_0_OUT:
_uReturnValue = g_Channel[0].m_Out.Hex; _uReturnValue = g_Channel[0].m_Out.Hex;
return; break;
case SI_CHANNEL_0_IN_HI: case SI_CHANNEL_0_IN_HI:
g_StatusReg.RDST0 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[0].m_InHi.Hex; _uReturnValue = g_Channel[0].m_InHi.Hex;
return; break;
case SI_CHANNEL_0_IN_LO: case SI_CHANNEL_0_IN_LO:
g_StatusReg.RDST0 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[0].m_InLo.Hex; _uReturnValue = g_Channel[0].m_InLo.Hex;
return; break;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Channel 1 // Channel 1
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
case SI_CHANNEL_1_OUT: case SI_CHANNEL_1_OUT:
_uReturnValue = g_Channel[1].m_Out.Hex; _uReturnValue = g_Channel[1].m_Out.Hex;
return; break;
case SI_CHANNEL_1_IN_HI: case SI_CHANNEL_1_IN_HI:
g_StatusReg.RDST1 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[1].m_InHi.Hex; _uReturnValue = g_Channel[1].m_InHi.Hex;
return; break;
case SI_CHANNEL_1_IN_LO: case SI_CHANNEL_1_IN_LO:
g_StatusReg.RDST1 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[1].m_InLo.Hex; _uReturnValue = g_Channel[1].m_InLo.Hex;
return; break;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Channel 2 // Channel 2
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
case SI_CHANNEL_2_OUT: case SI_CHANNEL_2_OUT:
_uReturnValue = g_Channel[2].m_Out.Hex; _uReturnValue = g_Channel[2].m_Out.Hex;
return; break;
case SI_CHANNEL_2_IN_HI: case SI_CHANNEL_2_IN_HI:
g_StatusReg.RDST2 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[2].m_InHi.Hex; _uReturnValue = g_Channel[2].m_InHi.Hex;
return; break;
case SI_CHANNEL_2_IN_LO: case SI_CHANNEL_2_IN_LO:
g_StatusReg.RDST2 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[2].m_InLo.Hex; _uReturnValue = g_Channel[2].m_InLo.Hex;
return; break;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Channel 3 // Channel 3
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
case SI_CHANNEL_3_OUT: case SI_CHANNEL_3_OUT:
_uReturnValue = g_Channel[3].m_Out.Hex; _uReturnValue = g_Channel[3].m_Out.Hex;
return; break;
case SI_CHANNEL_3_IN_HI: case SI_CHANNEL_3_IN_HI:
g_StatusReg.RDST3 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[3].m_InHi.Hex; _uReturnValue = g_Channel[3].m_InHi.Hex;
return; break;
case SI_CHANNEL_3_IN_LO: case SI_CHANNEL_3_IN_LO:
g_StatusReg.RDST3 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[3].m_InLo.Hex; _uReturnValue = g_Channel[3].m_InLo.Hex;
return; break;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Other // Other
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
case SI_POLL: _uReturnValue = g_Poll.Hex; return; case SI_POLL: _uReturnValue = g_Poll.Hex; break;
case SI_COM_CSR: _uReturnValue = g_ComCSR.Hex; return; case SI_COM_CSR: _uReturnValue = g_ComCSR.Hex; break;
case SI_STATUS_REG: _uReturnValue = g_StatusReg.Hex; return; case SI_STATUS_REG: _uReturnValue = g_StatusReg.Hex; break;
case SI_EXI_CLOCK_COUNT: _uReturnValue = g_EXIClockCount.Hex; return; case SI_EXI_CLOCK_COUNT: _uReturnValue = g_EXIClockCount.Hex; break;
default: default:
INFO_LOG(SERIALINTERFACE, "(r32-unk): 0x%08x", _iAddress); INFO_LOG(SERIALINTERFACE, "(r32-unk): 0x%08x", _iAddress);
@ -365,13 +374,12 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
break; break;
} }
// error DEBUG_LOG(SERIALINTERFACE, "(r32) 0x%08x - 0x%08x", _iAddress, _uReturnValue);
_uReturnValue = 0xdeadbeef;
} }
void Write32(const u32 _iValue, const u32 _iAddress) void Write32(const u32 _iValue, const u32 _iAddress)
{ {
DEBUG_LOG(SERIALINTERFACE, "(w32): 0x%08x 0x%08x", _iValue,_iAddress); DEBUG_LOG(SERIALINTERFACE, "(w32) 0x%08x @ 0x%08x", _iValue, _iAddress);
// SIBuffer // SIBuffer
if ((_iAddress >= 0xCC006480 && _iAddress < 0xCC006500) || if ((_iAddress >= 0xCC006480 && _iAddress < 0xCC006500) ||