Refactor the save/load state and battery code
* Simplifies most of the GB save/load state code and changes many of the global variable uses to go through gbCartData instead. * Changes all battery reads to use gzFiles. This seems to have been an oversight in an earlier refactor of the code. * Removes some unused variables and stops exporting internal-only functions in GB.cpp/gb.h. Breaking change: Cartridges with no mapper, but a save battery should now properly save and load changes. However, this type of cartridge has not been used in any commercially released software for Game Boy so the exact intended behavior is speculative.
This commit is contained in:
parent
36e88fafb6
commit
d8d6991c4b
1336
src/gb/GB.cpp
1336
src/gb/GB.cpp
File diff suppressed because it is too large
Load Diff
15
src/gb/gb.h
15
src/gb/gb.h
|
@ -44,7 +44,6 @@ bool gbApplyPatch(const char* patchName);
|
||||||
|
|
||||||
void gbEmulate(int);
|
void gbEmulate(int);
|
||||||
void gbWriteMemory(uint16_t, uint8_t);
|
void gbWriteMemory(uint16_t, uint8_t);
|
||||||
void gbDrawLine();
|
|
||||||
bool gbIsGameboyRom(const char*);
|
bool gbIsGameboyRom(const char*);
|
||||||
void gbGetHardwareType();
|
void gbGetHardwareType();
|
||||||
|
|
||||||
|
@ -56,21 +55,7 @@ void gbResetPalette();
|
||||||
void gbReset();
|
void gbReset();
|
||||||
void gbCleanUp();
|
void gbCleanUp();
|
||||||
void gbCPUInit(const char*, bool);
|
void gbCPUInit(const char*, bool);
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
unsigned int gbWriteSaveState(uint8_t*, unsigned);
|
|
||||||
bool gbReadSaveState(const uint8_t*, unsigned);
|
|
||||||
#else
|
|
||||||
bool gbWriteSaveState(const char*);
|
|
||||||
bool gbReadSaveState(const char*);
|
|
||||||
#endif
|
|
||||||
bool gbWriteBatteryFile(const char*);
|
|
||||||
bool gbWriteBatteryFile(const char*, bool);
|
|
||||||
bool gbReadBatteryFile(const char*);
|
|
||||||
bool gbWriteMemSaveState(char*, int, long&);
|
|
||||||
bool gbReadMemSaveState(char*, int);
|
|
||||||
void gbSgbRenderBorder();
|
void gbSgbRenderBorder();
|
||||||
bool gbWritePNGFile(const char*);
|
|
||||||
bool gbWriteBMPFile(const char*);
|
|
||||||
bool gbReadGSASnapshot(const char*);
|
bool gbReadGSASnapshot(const char*);
|
||||||
|
|
||||||
// Allows invalid vram/palette access needed for Colorizer hacked games in GBC/GBA hardware
|
// Allows invalid vram/palette access needed for Colorizer hacked games in GBC/GBA hardware
|
||||||
|
|
Loading…
Reference in New Issue