couple of mapper fixes (#482)
* Fix a couple of mapper issues - Implement info->Close, to free any unallocated memory (e.g. WRAM) - Add missing GameStateRestore function - Add missing state variable * Simplify header parsing * Update ines-correct.h Co-authored-by: negativeExponent <negativeExponent@users.noreply.github.com>
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#include "eeprom_93C66.h"
|
||||
#include "../ines.h"
|
||||
|
||||
static uint8 *WRAM;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 reg[4];
|
||||
static uint8 haveEEPROM;
|
||||
static uint8 eeprom_data[512];
|
||||
@@ -97,17 +99,32 @@ static void reset(void)
|
||||
sync();
|
||||
}
|
||||
|
||||
static void close(void)
|
||||
{
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
sync();
|
||||
}
|
||||
|
||||
void Mapper558_Init (CartInfo *info)
|
||||
{
|
||||
uint8 *WRAM;
|
||||
uint32 WRAMSIZE = info->PRGRamSize + (info->PRGRamSaveSize &~0x7FF);
|
||||
info->Power = power;
|
||||
info->Reset = reset;
|
||||
info->Close = close;
|
||||
GameHBIRQHook = hblank;
|
||||
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
|
||||
WRAMSIZE = info->PRGRamSize + (info->PRGRamSaveSize &~0x7FF);
|
||||
WRAM = (uint8*) FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
haveEEPROM =!!(info->PRGRamSaveSize &0x200);
|
||||
if (haveEEPROM)
|
||||
|
||||
Reference in New Issue
Block a user