@@ -1002,8 +1002,12 @@ public int ProgramRunLoop()
10021002 Tools . GeneralUpdateActiveExtTools ( ) ;
10031003
10041004 StepRunLoop_Core ( ) ;
1005- Render ( ) ;
1006- StepRunLoop_Throttle ( ) ;
1005+
1006+ if ( ! _invisibleEmulation )
1007+ {
1008+ Render ( ) ;
1009+ StepRunLoop_Throttle ( ) ;
1010+ }
10071011
10081012 // HACK: RAIntegration might peek at memory during messages
10091013 // we need this to allow memory access here, otherwise it will deadlock
@@ -1145,7 +1149,9 @@ private void OnPauseToggle(bool newPauseState)
11451149 /// <item><description><see cref="ClientLuaLibrary.InvisibleEmulation(bool)"/></description></item>
11461150 /// </list>
11471151 /// </summary>
1148- public bool InvisibleEmulation { get ; set ; }
1152+ public bool InvisibleEmulateNextFrame { get ; set ; }
1153+
1154+ private bool _invisibleEmulation ;
11491155
11501156 private long MouseWheelTracker ;
11511157
@@ -1170,7 +1176,7 @@ private void OnPauseToggle(bool newPauseState)
11701176
11711177 public bool IsSeeking => PauseOnFrame . HasValue ;
11721178 private bool IsTurboSeeking => PauseOnFrame . HasValue && Config . TurboSeek ;
1173- public bool IsTurboing => InputManager . ClientControls [ "Turbo" ] || IsTurboSeeking || InvisibleEmulation ;
1179+ public bool IsTurboing => InputManager . ClientControls [ "Turbo" ] || IsTurboSeeking || _invisibleEmulation ;
11741180 public bool IsFastForwarding => InputManager . ClientControls [ "Fast Forward" ] || IsTurboing ;
11751181 public bool IsRewinding { get ; private set ; }
11761182
@@ -2976,11 +2982,11 @@ private void StepRunLoop_Core(bool force = false)
29762982
29772983 _runloopFrameAdvance = frameAdvance ;
29782984
2985+ bool unpaused = ! EmulatorPaused || _invisibleEmulation ;
29792986#if BIZHAWKBUILD_SUPERHAWK
2980- if ( ! EmulatorPaused && ( ! Config . SuperHawkThrottle || InputManager . ClientControls . AnyInputHeld ) )
2981- #else
2982- if ( ! EmulatorPaused )
2987+ unpaused = unpaused && ( ! Config . SuperHawkThrottle || InputManager . ClientControls . AnyInputHeld ) ;
29832988#endif
2989+ if ( unpaused )
29842990 {
29852991 runFrame = true ;
29862992 }
@@ -2994,15 +3000,20 @@ private void StepRunLoop_Core(bool force = false)
29943000 // BlockFrameAdvance (true when input it being editted in TAStudio) supercedes all other frame advance conditions
29953001 if ( ( runFrame || force ) && ! BlockFrameAdvance )
29963002 {
3003+ _invisibleEmulation = InvisibleEmulateNextFrame ;
3004+
29973005 var isFastForwarding = IsFastForwarding ;
29983006 var isFastForwardingOrRewinding = isFastForwarding || isRewinding || Config . Unthrottled ;
29993007
3000- if ( isFastForwardingOrRewinding != _lastFastForwardingOrRewinding )
3008+ if ( ! _invisibleEmulation )
30013009 {
3002- InitializeFpsData ( ) ;
3003- }
3010+ if ( isFastForwardingOrRewinding != _lastFastForwardingOrRewinding )
3011+ {
3012+ InitializeFpsData ( ) ;
3013+ }
30043014
3005- _lastFastForwardingOrRewinding = isFastForwardingOrRewinding ;
3015+ _lastFastForwardingOrRewinding = isFastForwardingOrRewinding ;
3016+ }
30063017
30073018 // client input-related duties
30083019 OSD . ClearGuiText ( ) ;
@@ -3022,13 +3033,13 @@ private void StepRunLoop_Core(bool force = false)
30223033 Tools . UpdateToolsBefore ( ) ;
30233034 }
30243035
3025- if ( ! InvisibleEmulation )
3036+ if ( ! _invisibleEmulation )
30263037 {
30273038 CaptureRewind ( isRewinding ) ;
30283039 }
30293040
30303041 // Set volume, if enabled
3031- if ( Config . SoundEnabledNormal && ! InvisibleEmulation )
3042+ if ( Config . SoundEnabledNormal && ! _invisibleEmulation )
30323043 {
30333044 atten = Config . SoundVolume / 100.0f ;
30343045
@@ -3073,7 +3084,7 @@ private void StepRunLoop_Core(bool force = false)
30733084 }
30743085
30753086 bool atTurboSeekEnd = IsTurboSeeking && Emulator . Frame == PauseOnFrame . Value - 1 ;
3076- bool render = ! InvisibleEmulation && ( ! _throttle . skipNextFrame || _currAviWriter ? . UsesVideo is true || atTurboSeekEnd ) ;
3087+ bool render = ! _invisibleEmulation && ( ! _throttle . skipNextFrame || _currAviWriter ? . UsesVideo is true || atTurboSeekEnd ) ;
30773088 bool newFrame = Emulator . FrameAdvance ( InputManager . ControllerOutput , render , renderSound ) ;
30783089
30793090 MovieSession . HandleFrameAfter ( ToolBypassingMovieEndAction is not null ) ;
@@ -3114,12 +3125,12 @@ private void StepRunLoop_Core(bool force = false)
31143125 }
31153126 }
31163127
3117- if ( ! PauseAvi && newFrame && ! InvisibleEmulation )
3128+ if ( ! PauseAvi && newFrame && ! _invisibleEmulation )
31183129 {
31193130 AvFrameAdvance ( ) ;
31203131 }
31213132
3122- if ( newFrame )
3133+ if ( newFrame && ! _invisibleEmulation )
31233134 {
31243135 _framesSinceLastFpsUpdate ++ ;
31253136
0 commit comments