diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp index 318b1213af..a041a3b0ad 100644 --- a/Source/Core/Core/Src/HW/SystemTimers.cpp +++ b/Source/Core/Core/Src/HW/SystemTimers.cpp @@ -248,10 +248,11 @@ void Init() DSP_PERIOD = (int)(GetTicksPerSecond() * 0.003f); // AyuanX: TO BE TWEAKED - // Now the 1500 is (was) a pure assumption + // Now the 1500 is a pure assumption // We need to figure out the real frequency though - const int freq = 8000; + // FYI, WII_IPC_HLE_Interface::Update is also called in WII_IPCInterface::Write32 + const int freq = 1500; const int fields = SConfig::GetInstance().m_LocalCoreStartupParameter. bVBeam ? 2 : 1; IPC_HLE_PERIOD = GetTicksPerSecond() / (freq * fields); diff --git a/Source/Core/Core/Src/HW/WII_IPC.cpp b/Source/Core/Core/Src/HW/WII_IPC.cpp index 74af1ecdea..3651eef8ab 100644 --- a/Source/Core/Core/Src/HW/WII_IPC.cpp +++ b/Source/Core/Core/Src/HW/WII_IPC.cpp @@ -221,6 +221,7 @@ void Write32(const u32 _Value, const u32 _Address) break; } + WII_IPC_HLE_Interface::Update(); UpdateInterrupts(); } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp index 4aee5cb045..4149931353 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -405,6 +405,7 @@ void ExecuteCommand(u32 _Address) else { delete pDevice; + pDevice = NULL; } } @@ -435,7 +436,10 @@ void ExecuteCommand(u32 _Address) // Don't delete hardware if (!pDevice->IsHardware()) + { delete pDevice; + pDevice = NULL; + } } else { @@ -515,7 +519,8 @@ void ExecuteCommand(u32 _Address) if (CmdSuccess) { // Generate a reply to the IPC command - EnqReply(_Address, SystemTimers::GetTicksPerSecond() / 150); + int const reply_delay = pDevice ? pDevice->GetCmdDelay(_Address) : 0; + EnqReply(_Address, reply_delay); } else { diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h index d2907d7ee9..d52bd4f1e3 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h @@ -95,6 +95,8 @@ public: virtual bool IOCtlV (u32) { UNIMPLEMENTED_CMD(IOCtlV) } #undef UNIMPLEMENTED_CMD + virtual int GetCmdDelay(u32) { return 0; } + virtual u32 Update() { return 0; } virtual bool IsHardware() { return m_Hardware; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp index 05b365ef01..18ddc56c88 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp @@ -28,6 +28,7 @@ #include "VolumeCreator.h" #include "Filesystem.h" #include "LogManager.h" +#include "../HW/SystemTimers.h" #include "../../DiscIO/Src/FileMonitor.h" @@ -460,3 +461,8 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 // i dunno but prolly 1 is okay all the time :) return 1; } + +int CWII_IPC_HLE_Device_di::GetCmdDelay(u32) +{ + return SystemTimers::GetTicksPerSecond() / 100; +} \ No newline at end of file diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h index 36e9f89067..0b62daefa3 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h @@ -38,6 +38,8 @@ public: bool IOCtl(u32 _CommandAddress); bool IOCtlV(u32 _CommandAddress); + + int GetCmdDelay(u32); private: