From bb6627858503de6dfb59921d9dab800d1750ca00 Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Wed, 12 Dec 2018 12:36:56 -0600 Subject: [PATCH] Move S9xMovieUpdate to start of next frame. --- controls.cpp | 2 -- cpuexec.cpp | 26 ++++++++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/controls.cpp b/controls.cpp index 9c26aa7a..b828bd9d 100644 --- a/controls.cpp +++ b/controls.cpp @@ -3321,8 +3321,6 @@ void S9xControlEOF (void) do_polling(POLL_ALL); - S9xMovieUpdate(); - pad_read_last = pad_read; pad_read = false; } diff --git a/cpuexec.cpp b/cpuexec.cpp index 78f9876a..bc27e0b6 100644 --- a/cpuexec.cpp +++ b/cpuexec.cpp @@ -11,6 +11,7 @@ #include "apu/apu.h" #include "fxemu.h" #include "snapshot.h" +#include "movie.h" #ifdef DEBUGGER #include "debug.h" #include "missing.h" @@ -18,7 +19,6 @@ static inline void S9xReschedule (void); - void S9xMainLoop (void) { #define CHECK_FOR_IRQ_CHANGE() \ @@ -31,6 +31,12 @@ void S9xMainLoop (void) Timings.IRQFlagChanging = IRQ_NONE; \ } + if (CPU.Flags & SCAN_KEYS_FLAG) + { + CPU.Flags &= ~SCAN_KEYS_FLAG; + S9xMovieUpdate(); + } + for (;;) { if (CPU.NMIPending) @@ -120,7 +126,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; @@ -155,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)