Mapper 195: Properly deallocate CHRRAM

This commit is contained in:
NewRisingSun
2022-12-30 01:04:26 +01:00
parent 2b172d3eb2
commit 8e7ba746dc

View File

@@ -76,11 +76,18 @@ static void Mapper195_Power(void) {
}
}
void Mapper195_Close(void) {
if (CHRRAM)
FCEU_gfree(CHRRAM);
CHRRAM = NULL;
}
void Mapper195_Init(CartInfo *info) {
GenMMC3_Init(info, 512, 256, 16, info->battery);
cwrap = Mapper195_CHRWrap;
info->Power = Mapper195_Power;
info->Reset = MMC3RegReset;
info->Close = Mapper195_Close;
CHRRAMSIZE =4096;
CHRRAM =(uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);