Discard apihawksurface in TAStudio LoadState when frame advancing after

This fixes an issue where lua scripts could write to the screen twice when seeking to a frame in TAStudio as the screen was not cleared between the load and the following frame advance.

This fixes / expands 1a9176e12f.
This commit is contained in:
Morilli 2024-06-08 14:42:38 +02:00
parent bcc0d83bf0
commit f0bc8fbd2e
2 changed files with 7 additions and 3 deletions

View File

@ -59,7 +59,7 @@ namespace BizHawk.Client.EmuHawk
var lastState = GetPriorStateForFramebuffer(frame);
if (lastState.Key > Emulator.Frame)
{
LoadState(lastState);
LoadState(lastState, true);
}
StartSeeking(frame);

View File

@ -932,7 +932,7 @@ namespace BizHawk.Client.EmuHawk
var closestState = GetPriorStateForFramebuffer(frame);
if (closestState.Value.Length > 0 && (frame < Emulator.Frame || closestState.Key > Emulator.Frame))
{
LoadState(closestState);
LoadState(closestState, true);
}
closestState.Value.Dispose();
@ -980,7 +980,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public void LoadState(KeyValuePair<int, Stream> state)
public void LoadState(KeyValuePair<int, Stream> state, bool discardApiHawkSurfaces = false)
{
StatableEmulator.LoadStateBinary(new BinaryReader(state.Value));
@ -990,6 +990,10 @@ namespace BizHawk.Client.EmuHawk
}
UpdateTools();
if (discardApiHawkSurfaces)
{
DisplayManager.DiscardApiHawkSurfaces();
}
}
public void AddBranchExternal() => BookMarkControl.AddBranchExternal();