Delay IPC replies directly caused by requests by 150th of a second. Fixes everything.

This commit is contained in:
Jordan Woyak 2013-02-01 20:53:05 -06:00
parent 039bf27767
commit 00a1f351e9
2 changed files with 15 additions and 4 deletions

View File

@ -58,6 +58,8 @@ They will also generate a true or false return for UpdateInterrupts() in WII_IPC
#include "../HW/WII_IPC.h"
#include "../Debugger/Debugger_SymbolMap.h"
#include "../PowerPC/PowerPC.h"
#include "../HW/SystemTimers.h"
#include "CoreTiming.h"
namespace WII_IPC_HLE_Interface
@ -80,8 +82,17 @@ typedef std::deque<u32> ipc_msg_queue;
static ipc_msg_queue request_queue; // ppc -> arm
static ipc_msg_queue reply_queue; // arm -> ppc
static int enque_reply;
void EnqueReplyCallback(u64 userdata, int)
{
reply_queue.push_back(userdata);
}
void Init()
{
enque_reply = CoreTiming::RegisterEvent("IPCReply", EnqueReplyCallback);
_dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isnt empty on init");
CWII_IPC_HLE_Device_es::m_ContentFile = "";
u32 i;
@ -504,7 +515,7 @@ void ExecuteCommand(u32 _Address)
if (CmdSuccess)
{
// Generate a reply to the IPC command
EnqReply(_Address);
EnqReply(_Address, SystemTimers::GetTicksPerSecond() / 150);
}
else
{
@ -526,9 +537,9 @@ void EnqRequest(u32 _Address)
}
// Called when IOS module has some reply
void EnqReply(u32 _Address)
void EnqReply(u32 _Address, int cycles_in_future)
{
reply_queue.push_back(_Address);
CoreTiming::ScheduleEvent(cycles_in_future, enque_reply, _Address);
}
// This is called every IPC_HLE_PERIOD from SystemTimers.cpp

View File

@ -62,7 +62,7 @@ void UpdateDevices();
void ExecuteCommand(u32 _Address);
void EnqRequest(u32 _Address);
void EnqReply(u32 _Address);
void EnqReply(u32 _Address, int cycles_in_future = 0);
enum ECommandType
{