diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs index 4616d12c08..db2b2dab85 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/LibmGBA.cs @@ -80,7 +80,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA public static extern void BizGetMemoryAreas(IntPtr ctx, [Out]MemoryAreas dst); [DllImport(dll, CallingConvention = cc)] - public static extern int BizGetSaveRam(IntPtr ctx, byte[] dest); + public static extern int BizGetSaveRam(IntPtr ctx, byte[] dest, int maxsize); [DllImport(dll, CallingConvention = cc)] public static extern bool BizPutSaveRam(IntPtr ctx, byte[] src, int size); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs index 5a87baf29d..cc0aace0be 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs @@ -317,7 +317,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA public byte[] CloneSaveRam() { - int len = LibmGBA.BizGetSaveRam(_core, _saveScratch); + int len = LibmGBA.BizGetSaveRam(_core, _saveScratch, _saveScratch.Length); + if (len == _saveScratch.Length) + throw new InvalidOperationException("Save buffer not long enough"); if (len == 0) return null; @@ -362,7 +364,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA { get { - return LibmGBA.BizGetSaveRam(_core, _saveScratch) > 0; + return LibmGBA.BizGetSaveRam(_core, _saveScratch, _saveScratch.Length) > 0; } } diff --git a/output64/dll/mgba.dll b/output64/dll/mgba.dll index 7fe703a98f..3c66650480 100644 Binary files a/output64/dll/mgba.dll and b/output64/dll/mgba.dll differ