Make expansion interface interrupt updates thread-safe (fixes loss of audio in Super Mario Sunshine on lower-end systems.)
This commit is contained in:
parent
81dda593cd
commit
c37aca70a7
|
@ -20,6 +20,7 @@ namespace ExpansionInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
static int changeDevice;
|
static int changeDevice;
|
||||||
|
static int updateInterrupts;
|
||||||
|
|
||||||
static CEXIChannel *g_Channels[MAX_EXI_CHANNELS];
|
static CEXIChannel *g_Channels[MAX_EXI_CHANNELS];
|
||||||
void Init()
|
void Init()
|
||||||
|
@ -43,6 +44,7 @@ void Init()
|
||||||
g_Channels[2]->AddDevice(EXIDEVICE_AD16, 0);
|
g_Channels[2]->AddDevice(EXIDEVICE_AD16, 0);
|
||||||
|
|
||||||
changeDevice = CoreTiming::RegisterEvent("ChangeEXIDevice", ChangeDeviceCallback);
|
changeDevice = CoreTiming::RegisterEvent("ChangeEXIDevice", ChangeDeviceCallback);
|
||||||
|
updateInterrupts = CoreTiming::RegisterEvent("EXIUpdateInterrupts", UpdateInterruptsCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown()
|
void Shutdown()
|
||||||
|
@ -114,6 +116,11 @@ IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateInterrupts()
|
void UpdateInterrupts()
|
||||||
|
{
|
||||||
|
CoreTiming::ScheduleEvent_Threadsafe(0, updateInterrupts, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateInterruptsCallback(u64 userdata, int cyclesLate)
|
||||||
{
|
{
|
||||||
// Interrupts are mapped a bit strangely:
|
// Interrupts are mapped a bit strangely:
|
||||||
// Channel 0 Device 0 generates interrupt on channel 0
|
// Channel 0 Device 0 generates interrupt on channel 0
|
||||||
|
|
|
@ -27,6 +27,7 @@ void PauseAndLock(bool doLock, bool unpauseOnUnlock);
|
||||||
|
|
||||||
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
||||||
|
|
||||||
|
void UpdateInterruptsCallback(u64 userdata, int cyclesLate);
|
||||||
void UpdateInterrupts();
|
void UpdateInterrupts();
|
||||||
|
|
||||||
void ChangeDeviceCallback(u64 userdata, int cyclesLate);
|
void ChangeDeviceCallback(u64 userdata, int cyclesLate);
|
||||||
|
|
Loading…
Reference in New Issue