From c0453ae2e840b6bf287f1d80f91f880ac1e7cead Mon Sep 17 00:00:00 2001 From: zeromus Date: Tue, 30 Jul 2013 02:51:40 +0000 Subject: [PATCH] snes-fix SGB --- BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesApi.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesApi.cs b/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesApi.cs index 74bcfa53a4..96d2c606e5 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesApi.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesApi.cs @@ -947,7 +947,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES public void Allocate() { - mmf = MemoryMappedFile.CreateNew(BlockName, Size); + //we can't allocate 0 bytes here.. so just allocate 1 byte here if 0 was requested. it should be OK, and we dont have to handle cases where blocks havent been allocated + int sizeToAlloc = Size; + if (sizeToAlloc == 0) sizeToAlloc = 1; + mmf = MemoryMappedFile.CreateNew(BlockName, sizeToAlloc); mmva = mmf.CreateViewAccessor(); mmva.SafeMemoryMappedViewHandle.AcquirePointer(ref Ptr); }