snes-fix SGB

This commit is contained in:
zeromus 2013-07-30 02:51:40 +00:00
parent b03da7d3b0
commit c0453ae2e8
1 changed files with 4 additions and 1 deletions
BizHawk.Emulation/Consoles/Nintendo/SNES

View File

@ -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);
}