Merge pull request #1417 from fkane/threadsafe-interrupts

Defer processing of expansion interface interrupts (fixes audio in Super Mario Sunshine on lower-end systems)
This commit is contained in:
skidau 2014-11-01 12:24:46 +11:00
commit 439a8605fa
2 changed files with 8 additions and 0 deletions

View file

@ -20,6 +20,7 @@ namespace ExpansionInterface
{
static int changeDevice;
static int updateInterrupts;
static CEXIChannel *g_Channels[MAX_EXI_CHANNELS];
void Init()
@ -43,6 +44,7 @@ void Init()
g_Channels[2]->AddDevice(EXIDEVICE_AD16, 0);
changeDevice = CoreTiming::RegisterEvent("ChangeEXIDevice", ChangeDeviceCallback);
updateInterrupts = CoreTiming::RegisterEvent("EXIUpdateInterrupts", UpdateInterruptsCallback);
}
void Shutdown()
@ -114,6 +116,11 @@ IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex)
}
void UpdateInterrupts()
{
CoreTiming::ScheduleEvent_Threadsafe(0, updateInterrupts, 0);
}
void UpdateInterruptsCallback(u64 userdata, int cyclesLate)
{
// Interrupts are mapped a bit strangely:
// Channel 0 Device 0 generates interrupt on channel 0

View file

@ -27,6 +27,7 @@ void PauseAndLock(bool doLock, bool unpauseOnUnlock);
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
void UpdateInterruptsCallback(u64 userdata, int cyclesLate);
void UpdateInterrupts();
void ChangeDeviceCallback(u64 userdata, int cyclesLate);