From 782210614519c2368a240b5668b24b8f3874c12c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Aug 2016 00:49:32 +0200 Subject: Reimplement save RAM - do it the libretro way by implementing retro_get_memory_data and friends --- source/gfx.c | 4 ---- source/memmap.c | 35 ----------------------------------- source/memmap.h | 3 --- 3 files changed, 42 deletions(-) (limited to 'source') diff --git a/source/gfx.c b/source/gfx.c index 1c3efa1..d55ae09 100644 --- a/source/gfx.c +++ b/source/gfx.c @@ -717,11 +717,7 @@ void S9xEndScreenRefresh() #endif if (CPU.SRAMModified) - { - S9xAutoSaveSRAM(); CPU.SRAMModified = false; - } - } void S9xSetInfoString(const char* string) diff --git a/source/memmap.c b/source/memmap.c index 01d0707..6c013ea 100644 --- a/source/memmap.c +++ b/source/memmap.c @@ -1535,41 +1535,6 @@ bool LoadSRAM(const char* filename) return (true); } -bool SaveSRAM(const char* filename) -{ - if (Settings.SuperFX && Memory.ROMType < 0x15) - return true; - if (Settings.SA1 && Memory.ROMType == 0x34) - return true; - - int size = Memory.SRAMSize ? - (1 << (Memory.SRAMSize + 3)) * 128 : 0; - if (Settings.SRTC) - { - size += SRTC_SRAM_PAD; - S9xSRTCPreSaveState(); - } - - if (size > 0x20000) - size = 0x20000; - - if (size && *Memory.ROMFilename) - { - - FILE* file = fopen(filename, "w"); - if (file) - { - fwrite((unsigned char*) Memory.SRAM, size, 1, file); - fclose(file); - if (Settings.SPC7110RTC) - S9xSaveSPC7110RTC(&rtc_f9); - - return (true); - } - } - return (false); -} - void FixROMSpeed() { int c; diff --git a/source/memmap.h b/source/memmap.h index 0be1192..3be1cd3 100644 --- a/source/memmap.h +++ b/source/memmap.h @@ -145,7 +145,6 @@ uint32_t FileLoader(uint8_t* buffer, const char* filename, int32_t maxsize); #endif void InitROM(bool); bool LoadSRAM(const char*); -bool SaveSRAM(const char*); bool S9xInitMemory(); void S9xDeinitMemory(); void FreeSDD1Data(); @@ -258,8 +257,6 @@ bool LoadZip(const char* zipname, uint8_t* buffer); -void S9xAutoSaveSRAM(); - #ifdef NO_INLINE_SET_GET uint8_t S9xGetByte(uint32_t Address); uint16_t S9xGetWord(uint32_t Address); -- cgit v1.2.3