From 515b510da0242bb1d1bdbc275c2b4a157929951e Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Wed, 18 Jun 2025 09:39:09 +0200 Subject: [PATCH] gracefully handle existent saveram when core does not support it - closes #4358 Fixes 291dd80c27a7924666ae7800d81f91c4b90dba08 and now matches previous behavior. Usual reason for this happening seems to be cores interpreting "saveram" differently. --- src/BizHawk.Client.EmuHawk/MainForm.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index ae2fd81ada..4baa981fdd 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -2053,7 +2053,12 @@ namespace BizHawk.Client.EmuHawk else { var oldRam = Emulator.AsSaveRam().CloneSaveRam(); - Debug.Assert(oldRam is not null, $"Tried loading existing saveram, but {nameof(ISaveRam.CloneSaveRam)} returned null!"); + if (oldRam is null) + { + // we have a SaveRAM file, but the current core does not have save ram. + // just skip loading the saveram file in that case + return; + } // why do we silently truncate\pad here instead of warning\erroring? sram = new byte[oldRam.Length];