From d33626467ecd9c65baf593a1a7e4295d6047798d Mon Sep 17 00:00:00 2001 From: bladeoner Date: Thu, 13 Dec 2018 18:23:39 +0100 Subject: [PATCH] Backport Move S9xMovieUpdate to start of next frame. --- source/snes9x/controls.cpp | 2 -- source/snes9x/cpuexec.cpp | 27 ++++++++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/source/snes9x/controls.cpp b/source/snes9x/controls.cpp index 328ae0c..ed5a316 100644 --- a/source/snes9x/controls.cpp +++ b/source/snes9x/controls.cpp @@ -3322,8 +3322,6 @@ void S9xControlEOF (void) do_polling(POLL_ALL); - S9xMovieUpdate(); - pad_read_last = pad_read; pad_read = false; } diff --git a/source/snes9x/cpuexec.cpp b/source/snes9x/cpuexec.cpp index ff003fd..fe309b9 100644 --- a/source/snes9x/cpuexec.cpp +++ b/source/snes9x/cpuexec.cpp @@ -12,6 +12,7 @@ #include "apu/apu.h" #include "fxemu.h" #include "snapshot.h" +#include "movie.h" #ifdef DEBUGGER #include "debug.h" #include "missing.h" @@ -19,7 +20,6 @@ static inline void S9xReschedule (void); - void S9xMainLoop (void) { #define CHECK_FOR_IRQ_CHANGE() \ @@ -32,6 +32,12 @@ void S9xMainLoop (void) Timings.IRQFlagChanging = IRQ_NONE; \ } + if (CPU.Flags & SCAN_KEYS_FLAG) + { + CPU.Flags &= ~SCAN_KEYS_FLAG; + S9xMovieUpdate(); + } + for (;;) { if (CPU.NMIPending) @@ -121,8 +127,16 @@ void S9xMainLoop (void) #endif if (CPU.Flags & SCAN_KEYS_FLAG) + { + #ifdef DEBUGGER + if (!(CPU.Flags & FRAME_ADVANCE_FLAG)) + #endif + { + S9xSyncSpeed(); + } break; - + } + uint8 Op; struct SOpcodes *Opcodes; @@ -156,15 +170,6 @@ void S9xMainLoop (void) } S9xPackStatus(); - - if (CPU.Flags & SCAN_KEYS_FLAG) - { - #ifdef DEBUGGER - if (!(CPU.Flags & FRAME_ADVANCE_FLAG)) - #endif - S9xSyncSpeed(); - CPU.Flags &= ~SCAN_KEYS_FLAG; - } } static inline void S9xReschedule (void)