Skip to content

Commit

Permalink
Used the scheduler to generate the interrupt for IPC. Fixes the ES_LA…
Browse files Browse the repository at this point in the history
…UNCH games.
  • Loading branch information
skidau committed Mar 13, 2013
1 parent 0b34457 commit 85eab1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions Source/Core/Core/Src/HW/WII_IPC.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -130,6 +133,8 @@ void Init()
sensorbar_power = 0;

ppc_irq_masks |= INT_CAUSE_IPC_BROADWAY;

updateInterrupts = CoreTiming::RegisterEvent("IPCInterrupt", UpdateInterrupts);
}

void Reset()
Expand Down Expand Up @@ -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))
{
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/HW/WII_IPC.h
Expand Up @@ -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);

Expand Down

0 comments on commit 85eab1d

Please sign in to comment.