gracefully handle existent saveram when core does not support it

- closes #4358

Fixes 291dd80c27 and now matches previous behavior. Usual reason for this happening seems to be cores interpreting "saveram" differently.
This commit is contained in:
Morilli 2025-06-18 09:39:09 +02:00
parent 62040a3ba2
commit 515b510da0
1 changed files with 6 additions and 1 deletions

View File

@ -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];