From b17cca4d1c84685cb17f7791199ad62b7142ed19 Mon Sep 17 00:00:00 2001 From: bladeoner Date: Tue, 7 Apr 2020 01:16:15 +0200 Subject: [PATCH] Snes9x - Increase SRAM size to 512KB (#920) Increased SRAM size from 128KB to 512KB. This fixes a crash in the emulator when writing to SRAM between addresses $720000 and $7DFFFF. --- source/snes9x/memmap.cpp | 4 ++-- source/snes9x/snapshot.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/snes9x/memmap.cpp b/source/snes9x/memmap.cpp index 69965b7..f7c5841 100644 --- a/source/snes9x/memmap.cpp +++ b/source/snes9x/memmap.cpp @@ -908,7 +908,7 @@ static void S9xDeinterleaveGD24 (int size, uint8 *base) bool8 CMemory::Init (void) { RAM = (uint8 *) memalign(32,0x20000); - SRAM = (uint8 *) memalign(32,0x20000); + SRAM = (uint8 *) memalign(32,0x80000); VRAM = (uint8 *) memalign(32,0x10000); #ifdef USE_VM ROM = (uint8 *) vm_malloc(MAX_ROM_SIZE + 0x200 + 0x8000); @@ -953,7 +953,7 @@ bool8 CMemory::Init (void) } memset(RAM, 0, 0x20000); - memset(SRAM, 0, 0x20000); + memset(SRAM, 0, 0x80000); memset(VRAM, 0, 0x10000); memset(ROM, 0, MAX_ROM_SIZE + 0x200 + 0x8000); diff --git a/source/snes9x/snapshot.cpp b/source/snes9x/snapshot.cpp index 4b3e9d3..5c88a4b 100644 --- a/source/snes9x/snapshot.cpp +++ b/source/snes9x/snapshot.cpp @@ -1167,7 +1167,7 @@ void S9xFreezeToStream (STREAM stream) FreezeBlock (stream, "RAM", Memory.RAM, 0x20000); - FreezeBlock (stream, "SRA", Memory.SRAM, 0x20000); + FreezeBlock (stream, "SRA", Memory.SRAM, 0x80000); FreezeBlock (stream, "FIL", Memory.FillRAM, 0x8000); @@ -1372,9 +1372,9 @@ int S9xUnfreezeFromStream (STREAM stream) break; if (fast) - result = UnfreezeBlock(stream, "SRA", Memory.SRAM, 0x20000); + result = UnfreezeBlock(stream, "SRA", Memory.SRAM, 0x80000); else - result = UnfreezeBlockCopy (stream, "SRA", &local_sram, 0x20000); + result = UnfreezeBlockCopy (stream, "SRA", &local_sram, 0x80000); if (result != SUCCESS) break; @@ -1544,7 +1544,7 @@ int S9xUnfreezeFromStream (STREAM stream) memcpy(Memory.RAM, local_ram, 0x20000); if (local_sram) - memcpy(Memory.SRAM, local_sram, 0x20000); + memcpy(Memory.SRAM, local_sram, 0x80000); if (local_fillram) memcpy(Memory.FillRAM, local_fillram, 0x8000);