Improve UX of loading a savestate from an older (or newer) version

This commit is contained in:
YoshiRulz 2022-05-02 13:11:40 +10:00
parent c3e3ffbe27
commit ee241dc626
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 16 additions and 2 deletions

View File

@ -125,13 +125,27 @@ namespace BizHawk.Client.Common
}
}
public bool Load(string path)
public bool Load(string path, IDialogParent dialogParent)
{
// try to detect binary first
using var bl = ZipStateLoader.LoadAndDetect(path);
if (bl is null) return false;
var succeed = false;
if (!VersionInfo.DeveloperBuild)
{
bl.GetLump(BinaryStateLump.BizVersion, true, tr => succeed = tr.ReadLine() == VersionInfo.GetEmuVersion());
if (!succeed)
{
var result = dialogParent.ModalMessageBox2(
"This savestate was made with a different version, so it's unlikely to work.\nChoose OK to try loading it anyway.",
"Savestate version mismatch",
EMsgBoxIcon.Question,
useOKCancel: true);
if (!result) return false;
}
}
// Movie timeline check must happen before the core state is loaded
if (_movieSession.Movie.IsActive())
{

View File

@ -4176,7 +4176,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
if (new SavestateFile(Emulator, MovieSession, QuickBmpFile, MovieSession.UserBag).Load(path))
if (new SavestateFile(Emulator, MovieSession, QuickBmpFile, MovieSession.UserBag).Load(path, this))
{
OSD.ClearGuiText();
EmuClient.OnStateLoaded(this, userFriendlyStateName);