mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-21 09:21:02 +00:00
Fix periodic events drifting when eating cycles.
Need to set the next timer before rescheduling threads or etc.
This commit is contained in:
parent
e9fd43b947
commit
5cd4a17e88
@ -83,16 +83,18 @@ static inline s16 adjustvolume(s16 sample, int vol) {
|
||||
}
|
||||
|
||||
void hleAudioUpdate(u64 userdata, int cyclesLate) {
|
||||
__AudioUpdate();
|
||||
|
||||
// Schedule the next cycle first. __AudioUpdate() may consume cycles.
|
||||
CoreTiming::ScheduleEvent(usToCycles(audioIntervalUs) - cyclesLate, eventAudioUpdate, 0);
|
||||
|
||||
__AudioUpdate();
|
||||
}
|
||||
|
||||
void hleHostAudioUpdate(u64 userdata, int cyclesLate) {
|
||||
CoreTiming::ScheduleEvent(usToCycles(audioHostIntervalUs) - cyclesLate, eventHostAudioUpdate, 0);
|
||||
|
||||
// Not all hosts need this call to poke their audio system once in a while, but those that don't
|
||||
// can just ignore it.
|
||||
host->UpdateSound();
|
||||
CoreTiming::ScheduleEvent(usToCycles(audioHostIntervalUs) - cyclesLate, eventHostAudioUpdate, 0);
|
||||
}
|
||||
|
||||
void __AudioInit() {
|
||||
|
@ -289,8 +289,9 @@ void __CtrlTimerUpdate(u64 userdata, int cyclesLate)
|
||||
// This only runs in timer mode (ctrlCycle > 0.)
|
||||
_dbg_assert_msg_(SCECTRL, ctrlCycle > 0, "Ctrl: sampling cycle should be > 0");
|
||||
|
||||
__CtrlDoSample();
|
||||
CoreTiming::ScheduleEvent(usToCycles(ctrlCycle), ctrlTimer, 0);
|
||||
|
||||
__CtrlDoSample();
|
||||
}
|
||||
|
||||
void __CtrlInit()
|
||||
|
@ -602,6 +602,8 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
|
||||
}
|
||||
frameStartTicks = CoreTiming::GetTicks();
|
||||
|
||||
CoreTiming::ScheduleEvent(msToCycles(vblankMs) - cyclesLate, leaveVblankEvent, vbCount + 1);
|
||||
|
||||
// Wake up threads waiting for VBlank
|
||||
u32 error;
|
||||
bool wokeThreads = false;
|
||||
@ -623,8 +625,6 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
|
||||
// Trigger VBlank interrupt handlers.
|
||||
__TriggerInterrupt(PSP_INTR_IMMEDIATE | PSP_INTR_ONLY_IF_ENABLED | PSP_INTR_ALWAYS_RESCHED, PSP_VBLANK_INTR, PSP_INTR_SUB_ALL);
|
||||
|
||||
CoreTiming::ScheduleEvent(msToCycles(vblankMs) - cyclesLate, leaveVblankEvent, vbCount + 1);
|
||||
|
||||
gpuStats.numVBlanks++;
|
||||
|
||||
numVBlanksSinceFlip++;
|
||||
|
@ -264,6 +264,8 @@ void __GeCheckCycles(u64 userdata, int cyclesLate)
|
||||
CoreTiming::Advance();
|
||||
}
|
||||
}
|
||||
|
||||
// This may get out of step if we synced, but that's okay.
|
||||
CoreTiming::ScheduleEvent(usToCycles(geIntervalUs), geCycleEvent, 0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user