mirror of https://github.com/snes9xgit/snes9x.git
Move S9xSyncSpeed call.
DMA can last multiple frames, and so can S9xMainLoop. If we throttle outside of S9xMainLoop or only as we're exiting the loop as is currently done, we zoom through multiple frames and overrun the audio. Moving S9xSyncSpeed just after EndScreenRefresh causes it to be called every frame. This seemingly wasn't a problem because throttling with vsync *did* happen every frame regardless. Oops.
This commit is contained in:
parent
c325cbc2f6
commit
50f9f9eba1
13
cpuexec.cpp
13
cpuexec.cpp
|
@ -132,13 +132,6 @@ void S9xMainLoop (void)
|
|||
|
||||
if (CPU.Flags & SCAN_KEYS_FLAG)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
if (!(CPU.Flags & FRAME_ADVANCE_FLAG))
|
||||
#endif
|
||||
{
|
||||
S9xSyncSpeed();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -326,6 +319,12 @@ void S9xDoHEventProcessing (void)
|
|||
if (CPU.V_Counter == PPU.ScreenHeight + FIRST_VISIBLE_LINE) // VBlank starts from V=225(240).
|
||||
{
|
||||
S9xEndScreenRefresh();
|
||||
#ifdef DEBUGGER
|
||||
if (!(CPU.Flags & FRAME_ADVANCE_FLAG))
|
||||
#endif
|
||||
{
|
||||
S9xSyncSpeed();
|
||||
}
|
||||
|
||||
CPU.Flags |= SCAN_KEYS_FLAG;
|
||||
|
||||
|
|
|
@ -304,8 +304,6 @@ static bool S9xIdleFunc()
|
|||
|
||||
S9xProcessEvents(true);
|
||||
|
||||
S9xThrottle(Settings.SkipFrames);
|
||||
|
||||
if (!S9xDisplayDriverIsReady())
|
||||
{
|
||||
usleep(100);
|
||||
|
@ -494,6 +492,7 @@ static void S9xThrottle(int method)
|
|||
|
||||
void S9xSyncSpeed()
|
||||
{
|
||||
S9xThrottle(Settings.SkipFrames);
|
||||
}
|
||||
|
||||
static void S9xCheckPointerTimer()
|
||||
|
|
Loading…
Reference in New Issue