From 5bff07b305e2ea027d50fdebe61a89100d8370cc Mon Sep 17 00:00:00 2001 From: bladeoner Date: Fri, 27 Aug 2021 16:40:49 +0200 Subject: [PATCH] Snes9x - Add 128KByte SRAM support in cheats (#976) --- source/snes9x/cheats.cpp | 2 +- source/snes9x/cheats.h | 2 +- source/snes9x/cheats2.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/snes9x/cheats.cpp b/source/snes9x/cheats.cpp index fa99e33..0b54a0f 100644 --- a/source/snes9x/cheats.cpp +++ b/source/snes9x/cheats.cpp @@ -146,7 +146,7 @@ const char * S9xGameGenieToRaw (const char *code, uint32 &address, uint8 &byte) void S9xStartCheatSearch (SCheatData *d) { memmove(d->CWRAM, d->RAM, 0x20000); - memmove(d->CSRAM, d->SRAM, 0x10000); + memmove(d->CSRAM, d->SRAM, 0x80000); memmove(d->CIRAM, &d->FillRAM[0x3000], 0x2000); memset((char *) d->ALL_BITS, 0xff, 0x32000 >> 3); } diff --git a/source/snes9x/cheats.h b/source/snes9x/cheats.h index 5ca819b..7fbabd7 100644 --- a/source/snes9x/cheats.h +++ b/source/snes9x/cheats.h @@ -33,7 +33,7 @@ struct SCheatData std::vector g; bool8 enabled; uint8 CWRAM[0x20000]; - uint8 CSRAM[0x10000]; + uint8 CSRAM[0x80000]; uint8 CIRAM[0x2000]; uint8 *RAM; uint8 *FillRAM; diff --git a/source/snes9x/cheats2.cpp b/source/snes9x/cheats2.cpp index 1e0e01c..83a2969 100644 --- a/source/snes9x/cheats2.cpp +++ b/source/snes9x/cheats2.cpp @@ -62,7 +62,7 @@ static inline uint8 S9xGetByteFree (uint32 Address) case CMemory::MAP_HIROM_SRAM: case CMemory::MAP_RONLY_SRAM: - byte = *(Memory.SRAM + (((Address & 0x7fff) - 0x6000 + ((Address & 0xf0000) >> 3)) & Memory.SRAMMask)); + byte = *(Memory.SRAM + (((Address & 0x7fff) - 0x6000 + ((Address & 0x1f0000) >> 3)) & Memory.SRAMMask)); return (byte); case CMemory::MAP_BWRAM: @@ -153,7 +153,7 @@ static inline void S9xSetByteFree (uint8 Byte, uint32 Address) case CMemory::MAP_HIROM_SRAM: if (Memory.SRAMMask) { - *(Memory.SRAM + (((Address & 0x7fff) - 0x6000 + ((Address & 0xf0000) >> 3)) & Memory.SRAMMask)) = Byte; + *(Memory.SRAM + (((Address & 0x7fff) - 0x6000 + ((Address & 0x1f0000) >> 3)) & Memory.SRAMMask)) = Byte; CPU.SRAMModified = TRUE; } return;