IPCHLE: use only one CoreTiming event.

This commit is contained in:
magumagu 2014-06-14 10:56:11 -07:00
parent f9b72d0891
commit b423004ab3
1 changed files with 18 additions and 21 deletions

View File

@ -78,27 +78,26 @@ static ipc_msg_queue request_queue; // ppc -> arm
static ipc_msg_queue reply_queue; // arm -> ppc
static ipc_msg_queue ack_queue; // arm -> ppc
static int event_enqueue_reply;
static int event_enqueue_request;
static int event_enqueue;
static u64 last_reply_time;
static const u64 ENQUEUE_ACKNOWLEDGEMENT_FLAG = 0x100000000ULL;
static void EnqueueReplyCallback(u64 userdata, int)
static const u64 ENQUEUE_REQUEST_FLAG = 0x100000000ULL;
static const u64 ENQUEUE_ACKNOWLEDGEMENT_FLAG = 0x200000000ULL;
static void EnqueueEventCallback(u64 userdata, int)
{
if (userdata & ENQUEUE_ACKNOWLEDGEMENT_FLAG)
{
ack_queue.push_back((u32)userdata);
Update();
return;
}
reply_queue.push_back((u32)userdata);
Update();
}
static void EnqueueRequestCallback(u64 userdata, int)
{
else if (userdata & ENQUEUE_REQUEST_FLAG)
{
request_queue.push_back((u32)userdata);
}
else
{
reply_queue.push_back((u32)userdata);
}
Update();
}
@ -144,14 +143,12 @@ void Init()
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, "/dev/usb/oh1"); i++;
g_DeviceMap[i] = new IWII_IPC_HLE_Device(i, "_Unimplemented_Device_"); i++;
event_enqueue_reply = CoreTiming::RegisterEvent("IPCReply", EnqueueReplyCallback);
event_enqueue_request = CoreTiming::RegisterEvent("IPCRequest", EnqueueRequestCallback);
event_enqueue = CoreTiming::RegisterEvent("IPCEvent", EnqueueEventCallback);
}
void Reset(bool _bHard)
{
CoreTiming::RemoveAllEvents(event_enqueue_reply);
CoreTiming::RemoveAllEvents(event_enqueue_request);
CoreTiming::RemoveAllEvents(event_enqueue);
for (IWII_IPC_HLE_Device*& dev : g_FdMap)
{
@ -567,7 +564,7 @@ void ExecuteCommand(u32 _Address)
// Happens AS SOON AS IPC gets a new pointer!
void EnqueueRequest(u32 address)
{
CoreTiming::ScheduleEvent(1000, event_enqueue_request, address);
CoreTiming::ScheduleEvent(1000, event_enqueue, address | ENQUEUE_REQUEST_FLAG);
}
// Called when IOS module has some reply
@ -576,17 +573,17 @@ void EnqueueRequest(u32 address)
// Please search for examples of this being called elsewhere.
void EnqueueReply(u32 address, int cycles_in_future)
{
CoreTiming::ScheduleEvent(cycles_in_future, event_enqueue_reply, address);
CoreTiming::ScheduleEvent(cycles_in_future, event_enqueue, address);
}
void EnqueueReply_Threadsafe(u32 address, int cycles_in_future)
{
CoreTiming::ScheduleEvent_Threadsafe(cycles_in_future, event_enqueue_reply, address);
CoreTiming::ScheduleEvent_Threadsafe(cycles_in_future, event_enqueue, address);
}
void EnqueueCommandAcknowledgement(u32 address, int cycles_in_future)
{
CoreTiming::ScheduleEvent(cycles_in_future, event_enqueue_reply,
CoreTiming::ScheduleEvent(cycles_in_future, event_enqueue,
address | ENQUEUE_ACKNOWLEDGEMENT_FLAG);
}