From 85eab1d262192159a8b2b0e61e767688e0ac18bb Mon Sep 17 00:00:00 2001 From: skidau Date: Wed, 13 Mar 2013 22:23:59 +1100 Subject: [PATCH] Used the scheduler to generate the interrupt for IPC. Fixes the ES_LAUNCH games. --- Source/Core/Core/Src/HW/WII_IPC.cpp | 11 ++++++++--- Source/Core/Core/Src/HW/WII_IPC.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/Src/HW/WII_IPC.cpp b/Source/Core/Core/Src/HW/WII_IPC.cpp index 3651eef8ab..3d269d0fcd 100644 --- a/Source/Core/Core/Src/HW/WII_IPC.cpp +++ b/Source/Core/Core/Src/HW/WII_IPC.cpp @@ -28,6 +28,7 @@ #include "../IPC_HLE/WII_IPC_HLE.h" #include "WII_IPC.h" +#include "CoreTiming.h" // This is the intercommunication between ARM and PPC. Currently only PPC actually uses it, because of the IOS HLE @@ -104,6 +105,8 @@ static u32 arm_irq_masks; static u32 sensorbar_power; // do we need to care about this? +int updateInterrupts; + void DoState(PointerWrap &p) { p.Do(ppc_msg); @@ -130,6 +133,8 @@ void Init() sensorbar_power = 0; ppc_irq_masks |= INT_CAUSE_IPC_BROADWAY; + + updateInterrupts = CoreTiming::RegisterEvent("IPCInterrupt", UpdateInterrupts); } void Reset() @@ -222,10 +227,10 @@ void Write32(const u32 _Value, const u32 _Address) } WII_IPC_HLE_Interface::Update(); - UpdateInterrupts(); + CoreTiming::ScheduleEvent_Threadsafe(0, updateInterrupts, 0); } -void UpdateInterrupts() +void UpdateInterrupts(u64 userdata, int cyclesLate) { if ((ctrl.Y1 & ctrl.IY1) || (ctrl.Y2 & ctrl.IY2)) { @@ -247,7 +252,7 @@ void GenerateAck(u32 _Address) ctrl.Y2 = 1; INFO_LOG(WII_IPC, "GenerateAck: %08x | %08x [R:%i A:%i E:%i]", ppc_msg,_Address, ctrl.Y1, ctrl.Y2, ctrl.X1); - UpdateInterrupts(); + CoreTiming::ScheduleEvent_Threadsafe(0, updateInterrupts, 0); } void GenerateReply(u32 _Address) diff --git a/Source/Core/Core/Src/HW/WII_IPC.h b/Source/Core/Core/Src/HW/WII_IPC.h index cb79a4f700..3d4e416c42 100644 --- a/Source/Core/Core/Src/HW/WII_IPC.h +++ b/Source/Core/Core/Src/HW/WII_IPC.h @@ -52,7 +52,7 @@ void DoState(PointerWrap &p); void Read32(u32& _rReturnValue, const u32 _Address); void Write32(const u32 _Value, const u32 _Address); -void UpdateInterrupts(); +void UpdateInterrupts(u64 userdata = 0, int cyclesLate = 0); void GenerateAck(u32 _Address); void GenerateReply(u32 _Address);