TAStudio: Update self after loading a state. This fixes two bugs that were most evident when loading the state for frame 0:

-The UI was not updated.
-TasSession.UpdateValues was not called.  So saving the movie and then re-loading it would result in the previous frame being loaded/seeked to.

This commit addresses the regression mentioned in commit 319455c.
This commit is contained in:
SuuperW 2022-01-27 09:36:36 -06:00
parent 5012ba0f09
commit bc0579dd0e
3 changed files with 3 additions and 16 deletions

View File

@ -19,7 +19,6 @@ namespace BizHawk.Client.EmuHawk
[OptionalService] [OptionalService]
public ISaveRam SaveRamEmulator { get; private set; } public ISaveRam SaveRamEmulator { get; private set; }
private bool _hackyDontUpdate;
private bool _initializing; // If true, will bypass restart logic, this is necessary since loading projects causes a movie to load which causes a rom to reload causing dialogs to restart private bool _initializing; // If true, will bypass restart logic, this is necessary since loading projects causes a movie to load which causes a rom to reload causing dialogs to restart
private int _lastRefresh; private int _lastRefresh;
@ -67,11 +66,6 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
if (_hackyDontUpdate)
{
return;
}
if (_exiting) if (_exiting)
{ {
return; return;

View File

@ -657,7 +657,6 @@ namespace BizHawk.Client.EmuHawk
CurrentTasMovie.SetBoolStates(firstSel, (frame - firstSel) + 1, buttonName, !allPressed); CurrentTasMovie.SetBoolStates(firstSel, (frame - firstSel) + 1, buttonName, !allPressed);
_boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName); _boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName);
_triggerAutoRestore = true; _triggerAutoRestore = true;
JumpToGreenzone(true);
RefreshDialog(); RefreshDialog();
} }
else if (ModifierKeys == Keys.Shift && ModifierKeys == Keys.Alt) // Does not work? else if (ModifierKeys == Keys.Shift && ModifierKeys == Keys.Alt) // Does not work?
@ -671,7 +670,6 @@ namespace BizHawk.Client.EmuHawk
CurrentTasMovie.ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName); CurrentTasMovie.ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName);
_boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName); _boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName);
_triggerAutoRestore = true; _triggerAutoRestore = true;
JumpToGreenzone(true);
RefreshDialog(); RefreshDialog();
} }
} }
@ -846,10 +844,7 @@ namespace BizHawk.Client.EmuHawk
{ {
// If painting up, we have altered frames without loading states (for smoothness) // If painting up, we have altered frames without loading states (for smoothness)
// So now we have to ensure that all the edited frames are invalidated // So now we have to ensure that all the edited frames are invalidated
if (_paintingMinFrame < Emulator.Frame) GoToLastEmulatedFrameIfNecessary(_paintingMinFrame);
{
GoToFrame(_paintingMinFrame);
}
} }
ClearLeftMouseStates(); ClearLeftMouseStates();

View File

@ -960,18 +960,16 @@ namespace BizHawk.Client.EmuHawk
Emulator.ResetCounters(); Emulator.ResetCounters();
} }
UpdateOtherTools(); UpdateTools();
} }
public void AddBranchExternal() => BookMarkControl.AddBranchExternal(); public void AddBranchExternal() => BookMarkControl.AddBranchExternal();
public void RemoveBranchExternal() => BookMarkControl.RemoveBranchExternal(); public void RemoveBranchExternal() => BookMarkControl.RemoveBranchExternal();
private void UpdateOtherTools() // a hack probably, surely there is a better way to do this private void UpdateTools()
{ {
_hackyDontUpdate = true;
Tools.UpdateToolsBefore(); Tools.UpdateToolsBefore();
Tools.UpdateToolsAfter(); Tools.UpdateToolsAfter();
_hackyDontUpdate = false;
} }
public void TogglePause() public void TogglePause()