Fix for state gap when frame advancing and painting input (#2563)

* Fix for state gap when frame advancing and painting input

* simplify
This commit is contained in:
alyosha-tas 2021-01-12 21:32:44 -05:00 committed by GitHub
parent 39c0011d09
commit 72e8fa031e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -78,6 +78,8 @@ namespace BizHawk.Client.EmuHawk
void PauseEmulator();
bool BlockFrameAdvance { get; set; }
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
void RelinquishControl(IControlMainform master);

View File

@ -768,6 +768,8 @@ namespace BizHawk.Client.EmuHawk
}
}
public bool BlockFrameAdvance { get; set; }
public event Action<bool> OnPauseChanged;
public string CurrentlyOpenRom { get; private set; } // todo - delete me and use only args instead
@ -2916,7 +2918,8 @@ namespace BizHawk.Client.EmuHawk
float atten = 0;
if (runFrame || force)
// BlockFrameAdvance (true when input it being editted in TAStudio) supercedes all other frame advance conditions
if ((runFrame || force) && !BlockFrameAdvance)
{
var isFastForwarding = InputManager.ClientControls["Fast Forward"] || IsTurboing || InvisibleEmulation;
var isFastForwardingOrRewinding = isFastForwarding || isRewinding || _unthrottled;

View File

@ -619,6 +619,11 @@ namespace BizHawk.Client.EmuHawk
_playbackInterrupted = !MainForm.EmulatorPaused;
MainForm.PauseEmulator();
// Pausing the emulator is insufficient to actually stop frame advancing as the frame advance hotkey can
// still take effect. This can lead to desyncs by simultaneously changing input and frame advancing.
// So we want to block all frame advance operations while the user is changing input in the piano roll
MainForm.BlockFrameAdvance = true;
if (ControllerType.BoolButtons.Contains(buttonName))
{
_patternPaint = false;
@ -810,6 +815,8 @@ namespace BizHawk.Client.EmuHawk
{
CurrentTasMovie.ChangeLog?.EndBatch();
}
MainForm.BlockFrameAdvance = false;
}
private void TasView_MouseUp(object sender, MouseEventArgs e)