From c8526c7be1c480496e1a95cbe3ea462d47bd314f Mon Sep 17 00:00:00 2001 From: "XTra.KrazzY" Date: Sun, 8 Feb 2009 19:17:51 +0000 Subject: [PATCH] 1. Fixed RTC in both Wii and GC (added Wii epoch bias, notify me if it isn't good for your PC and I'll revert it). 2. Added some Zelda UCode HLE Documentation and changed the way it handles mail, also fixed a bug there. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2155 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp | 8 +++-- Source/Core/Core/Src/HW/SystemTimers.cpp | 2 +- .../Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.cpp | 29 ++++++++++++++++--- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp index 3dc9e20fce..01f92d97b9 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp @@ -278,7 +278,8 @@ void CEXIIPL::TransferByte(u8& _uByte) u32 CEXIIPL::GetGCTime() { - const u32 cJanuary2000 = 0x386D4380; // Seconds between 1.1.1970 and 1.1.2000 + const u32 cJanuary2000 = 0x386D42C0; // Seconds between 1.1.1970 and 1.1.2000 + const u32 cWiiBias = 0x0F111566; // Seconds between 1.1.2000 and 5.1.2008 (Wii epoch) // (mb2): I think we can get rid of the IPL bias. // I know, it's another hack so I let the previous code for a while. @@ -296,7 +297,10 @@ u32 CEXIIPL::GetGCTime() return ((u32)ltime - cJanuary2000 - Bias); #else u64 ltime = Common::Timer::GetLocalTimeSinceJan1970(); - return ((u32)ltime - cJanuary2000); + if (Core::GetStartupParameter().bWii) + return ((u32)ltime - cJanuary2000 - cWiiBias); + else + return ((u32)ltime - cJanuary2000); #endif } diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp index 117d1ac2b7..b95a0ad45d 100644 --- a/Source/Core/Core/Src/HW/SystemTimers.cpp +++ b/Source/Core/Core/Src/HW/SystemTimers.cpp @@ -231,7 +231,7 @@ void Init() { if (Core::GetStartupParameter().bWii) { - CPU_CORE_CLOCK = 721000000; + CPU_CORE_CLOCK = 721000000u; VI_PERIOD = GetTicksPerSecond() / (60*120); SI_PERIOD = GetTicksPerSecond() / 60; // once a frame is good for controllers diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.cpp index c88bf3abb1..fa25a3d873 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.cpp @@ -57,11 +57,32 @@ void CUCode_Zelda::Update() void CUCode_Zelda::HandleMail(u32 _uMail) { + PanicAlert("Zelda mail 0x%08X, list in progress? %s", _uMail, + m_bListInProgress ? "Yes" : "No"); + // SetupTable + // in WW we get SetDolbyDelay + // SyncFrame + // The last mails we get before the audio goes bye-bye + // 0, 0, 0 + // 0x10000 + // 0 + // 0x20000 + // 0 + // 0x30000 + // And then silence... if (m_bListInProgress == false) { - m_bListInProgress = true; - m_numSteps = _uMail; - m_step = 0; + if(_uMail == 0) { + g_dspInitialize.pGenerateDSPInterrupt(); + } else if((_uMail >> 16) == 0) { + m_bListInProgress = true; + m_numSteps = _uMail; + m_step = 0; + } else { + // Release halt + m_rMailHandler.PushMail(DSP_RESUME); + g_dspInitialize.pGenerateDSPInterrupt(); + } } else { @@ -70,7 +91,7 @@ void CUCode_Zelda::HandleMail(u32 _uMail) ((u32*)m_Buffer)[m_step] = _uMail; m_step++; - if (m_step == m_numSteps) + if (m_step >= m_numSteps) { ExecuteList(); m_bListInProgress = false;