diff --git a/src/boards/199.c b/src/boards/199.c index 0c260af..c6cd39f 100644 --- a/src/boards/199.c +++ b/src/boards/199.c @@ -75,6 +75,7 @@ static void M199Power(void) { } static void M199Close(void) { + GenMMC3Close(); if (CHRRAM) FCEU_gfree(CHRRAM); CHRRAM = NULL; diff --git a/src/boards/208.c b/src/boards/208.c index 151c135..95230a2 100644 --- a/src/boards/208.c +++ b/src/boards/208.c @@ -21,7 +21,7 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 lut[256] = { +static const uint8 lut[256] = { 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09, diff --git a/src/boards/269.c b/src/boards/269.c index 0fcf287..0acef24 100644 --- a/src/boards/269.c +++ b/src/boards/269.c @@ -55,6 +55,7 @@ static DECLFW(M269Write5) { } static void M269Close(void) { + GenMMC3Close(); if (CHRROM) FCEU_free(CHRROM); CHRROM = NULL; diff --git a/src/boards/353.c b/src/boards/353.c index c900dcd..765aa08 100644 --- a/src/boards/353.c +++ b/src/boards/353.c @@ -110,6 +110,7 @@ static void M353Reset(void) { } static void M353Close(void) { + GenMMC3Close(); if (CHRRAM) FCEU_gfree(CHRRAM); CHRRAM = NULL; diff --git a/src/boards/356.c b/src/boards/356.c index 67049cf..3ea1f5f 100644 --- a/src/boards/356.c +++ b/src/boards/356.c @@ -67,6 +67,7 @@ static DECLFW(M356Write) { } static void M356Close(void) { + GenMMC3Close(); if (CHRRAM) FCEU_free(CHRRAM); CHRRAM = NULL; diff --git a/src/boards/372.c b/src/boards/372.c index 1a4c772..9da9ee3 100644 --- a/src/boards/372.c +++ b/src/boards/372.c @@ -90,6 +90,7 @@ static void M372Power(void) { } static void M372Close(void) { + GenMMC3Close(); if (CHRRAM) FCEU_gfree(CHRRAM); CHRRAM = NULL; diff --git a/src/boards/603-5052.c b/src/boards/603-5052.c index 1de82f8..cbee199 100644 --- a/src/boards/603-5052.c +++ b/src/boards/603-5052.c @@ -26,7 +26,7 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 lut[4] = { 0x00, 0x02, 0x02, 0x03 }; +static const uint8 lut[4] = { 0x00, 0x02, 0x02, 0x03 }; static DECLFW(UNL6035052ProtWrite) { EXPREGS[0] = lut[V & 3]; diff --git a/src/boards/BS110.c b/src/boards/BS110.c index 18212f8..1f5736f 100644 --- a/src/boards/BS110.c +++ b/src/boards/BS110.c @@ -175,6 +175,10 @@ static void BS110Reset(void) MMC3RegReset(); } static void BS110Close(void) { + GenMMC3Close(); + if (WRAM) + FCEU_free(WRAM); + WRAM = NULL; } void BS110_Init(CartInfo *info) { diff --git a/src/boards/Bs5652.c b/src/boards/Bs5652.c index a7e9a93..a9f8ad3 100644 --- a/src/boards/Bs5652.c +++ b/src/boards/Bs5652.c @@ -213,6 +213,7 @@ static void Bs5652Reset(void) static void Bs5652Close(void) { + GenMMC3Close(); if (WRAM) FCEU_gfree(WRAM); WRAM = NULL; diff --git a/src/boards/NC7000M.c b/src/boards/NC7000M.c index 9925e65..0f8b1ce 100644 --- a/src/boards/NC7000M.c +++ b/src/boards/NC7000M.c @@ -162,6 +162,7 @@ static void NC7000MReset(void) { MMC3RegReset(); } static void NC7000MClose(void) { + GenMMC3Close(); if (WRAM) FCEU_gfree(WRAM); WRAM = NULL; diff --git a/src/boards/et-100.c b/src/boards/et-100.c index 70882ee..5e41622 100644 --- a/src/boards/et-100.c +++ b/src/boards/et-100.c @@ -83,6 +83,7 @@ static void BMC1024CA1Power(void) { } static void BMC1024CA1Close(void) { + GenMMC3Close(); if (CHRRAM) FCEU_gfree(CHRRAM); CHRRAM = NULL; diff --git a/src/boards/et-4320.c b/src/boards/et-4320.c index 5e75a73..0f32942 100644 --- a/src/boards/et-4320.c +++ b/src/boards/et-4320.c @@ -90,6 +90,7 @@ static void BMC810131C_Power(void) { } static void BMC810131C_Close(void) { + GenMMC3Close(); if (CHRRAM) FCEU_gfree(CHRRAM); CHRRAM = NULL; diff --git a/src/boards/mmc3.c b/src/boards/mmc3.c index b2d06dd..1618bea 100644 --- a/src/boards/mmc3.c +++ b/src/boards/mmc3.c @@ -289,7 +289,7 @@ void GenMMC3Power(void) { FCEU_dwmemset(CHRRAM, 0, CHRRAMSIZE); } -static void GenMMC3Close(void) { +void GenMMC3Close(void) { if (CHRRAM) FCEU_gfree(CHRRAM); if (WRAM) diff --git a/src/boards/mmc3.h b/src/boards/mmc3.h index 6a30fce..2479f9d 100644 --- a/src/boards/mmc3.h +++ b/src/boards/mmc3.h @@ -21,6 +21,7 @@ extern void (*mwrap)(uint8 V); void GenMMC3Power(void); void GenMMC3Restore(int version); void MMC3RegReset(void); +void GenMMC3Close(void); void FixMMC3PRG(int V); void FixMMC3CHR(int V); DECLFW(MMC3_CMDWrite); diff --git a/src/boards/sheroes.c b/src/boards/sheroes.c index 6fe8a6e..ef84d04 100644 --- a/src/boards/sheroes.c +++ b/src/boards/sheroes.c @@ -61,6 +61,7 @@ static void MSHPower(void) { } static void MSHClose(void) { + GenMMC3Close(); if (CHRRAM) FCEU_gfree(CHRRAM); CHRRAM = NULL; diff --git a/src/boards/super24.c b/src/boards/super24.c index 40862bb..23889f1 100644 --- a/src/boards/super24.c +++ b/src/boards/super24.c @@ -76,6 +76,7 @@ static void Super24Reset(void) { } static void Super24Close(void) { + GenMMC3Close(); if (CHRRAM) FCEU_gfree(CHRRAM); CHRRAM = NULL;