GPGX: Saveram tweaks

When saveram doesn't exist, return null, not new byte [0].  If passed a 0-length saveram file, do not pass it to the core (this crashed in interop stubs).  Note that as best as I can tell, this is not fixing any problem; even without this commit it seems impossible to get BizHawk to actually generate a 0 byte saveram file for GPGX because of other checks that already existed.
This commit is contained in:
nattthebear 2020-06-20 19:21:55 -04:00
parent fc5e325608
commit a9d1ad16b1
1 changed files with 6 additions and 1 deletions

View File

@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
int size = 0;
IntPtr area = Core.gpgx_get_sram(ref size);
if (size == 0 || area == IntPtr.Zero)
return new byte[0];
return null;
byte[] ret = new byte[size];
using (_elf.EnterExit())
@ -22,6 +22,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
public void StoreSaveRam(byte[] data)
{
if (data.Length == 0)
{
// not sure how this is happening, but reject them
return;
}
if (!Core.gpgx_put_sram(data, data.Length))
{
throw new Exception("Core rejected saveram");