BizHawk icon indicating copy to clipboard operation
BizHawk copied to clipboard

BizHawk crashes when trying to load a savestate made with different sync settings

Open ThunderAxe31 opened this issue 4 years ago • 3 comments

Create a savestate with GB or PSX, then change some core settings and reboot the core. Then, if you try to load that savestate, you get this for Gambatte:

System.InvalidOperationException: Save buffer size mismatch!
   at BizHawk.Emulation.Cores.Sony.PSX.Octoshock.LoadStateBinary(BinaryReader reader)
   at BizHawk.Client.Common.BinaryStateLoader.GetLump(BinaryStateLump lump, Boolean abort, Action`2 callback)
   at BizHawk.Client.Common.BinaryStateLoader.GetCoreState(Action`1 callbackBinary, Action`1 callbackText)
   at BizHawk.Client.Common.SavestateManager.LoadStateFile(IEmulator emulator, String path)
   at BizHawk.Client.EmuHawk.MainForm.LoadState(String path, String userFriendlyStateName, Boolean fromLua, Boolean suppressOSD)
   at BizHawk.Client.EmuHawk.MainForm.LoadQuickSave(String quickSlotName, Boolean fromLua, Boolean suppressOSD)
   at BizHawk.Client.EmuHawk.MainForm.CheckHotkey(String trigger)
   at BizHawk.Client.EmuHawk.MainForm.<ProcessInput>b__101_0(Boolean current, String trigger)
   at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   at BizHawk.Client.EmuHawk.MainForm.ProcessInput()
   at BizHawk.Client.EmuHawk.MainForm.ProgramRunLoop()
   at BizHawk.Client.EmuHawk.Program.SubMain(String[] args)

And this for Octoshock:

System.InvalidOperationException: Savestate buffer size mismatch!
   at BizHawk.Emulation.Cores.Nintendo.Gameboy.Gameboy.LoadStateBinary(BinaryReader reader)
   at BizHawk.Client.Common.BinaryStateLoader.GetLump(BinaryStateLump lump, Boolean abort, Action`2 callback)
   at BizHawk.Client.Common.BinaryStateLoader.GetCoreState(Action`1 callbackBinary, Action`1 callbackText)
   at BizHawk.Client.Common.SavestateManager.LoadStateFile(IEmulator emulator, String path)
   at BizHawk.Client.EmuHawk.MainForm.LoadState(String path, String userFriendlyStateName, Boolean fromLua, Boolean suppressOSD)
   at BizHawk.Client.EmuHawk.MainForm.LoadQuickSave(String quickSlotName, Boolean fromLua, Boolean suppressOSD)
   at BizHawk.Client.EmuHawk.MainForm.CheckHotkey(String trigger)
   at BizHawk.Client.EmuHawk.MainForm.<ProcessInput>b__101_0(Boolean current, String trigger)
   at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   at BizHawk.Client.EmuHawk.MainForm.ProcessInput()
   at BizHawk.Client.EmuHawk.MainForm.ProgramRunLoop()
   at BizHawk.Client.EmuHawk.Program.SubMain(String[] args)

Also, after closing the error window, the BizHawk process ends instantly without updating settings.ini.

First, BizHawk shouldn't close abruptly after displaying the error window. Second, the error window should explain which are the sync settings that are different between the savestate that was attempted to load and the currently set ones for the running core.

see also #1664 for the same bug using Genplus-gx

ThunderAxe31 avatar Jun 03 '20 13:06 ThunderAxe31

I don't think any other issues track this at the moment, but this is something we're interested in and adelikat has been laboring tirelessly to work towards resolving it. Unfortunately, there's still a long road ahead.

nattthebear avatar Jun 04 '20 15:06 nattthebear

A possibly related crash from Discord: screencap It's partially cut off and in Norwegian(?), but the stacktrace is from jumping to a marker TAStudio. Something like:

InvalidOperationException: Save buffer size mismatch!
  at BizHawk.Emulation.Cores.Sony.PSX.Octoshock.LoadStateBinary
  at BizHawk.Client.EmuHawk.TAStudio.LoadState
  at BizHawk.Client.EmuHawk.TAStudio.StartAtNearestFrameAndEmulate
  at BizHawk.Client.EmuHawk.TAStudio.GoToFrame
  at BizHawk.Client.EmuHawk.MarkerControl.MarkerView_MouseDoubleClick

YoshiRulz avatar Oct 14 '20 02:10 YoshiRulz

Also, after closing the error window, the BizHawk process ends instantly without updating settings.ini.

This doesn't seem to be the case anymore.

Second, the error window should explain which are the sync settings that are different between the savestate that was attempted to load and the currently set ones for the running core.

Sync Settings aren't stated. The error here will occur for any unexpected state size difference (which can be due to sync settings). For Gambatte it would be GB/SGB vs GBC/GBA, as their state sizes differ (GB/SGB has less VRAM and less WRAM than GBC/GBA). Perhaps the error message could just mention it might be the issue. Or maybe sync settings should be stated for comparision purposes?

CasualPokePlayer avatar Jun 22 '22 06:06 CasualPokePlayer