Mapper9: only PC10 has wram/battery

This commit is contained in:
retro-wertz
2017-10-18 10:43:45 +08:00
parent 623129b0a9
commit 1877360efc
2 changed files with 18 additions and 17 deletions

View File

@@ -22,7 +22,7 @@
#include "mapinc.h" #include "mapinc.h"
static uint8 is10, battery; static uint8 is10, isPC10;
static uint8 creg[4], latch0, latch1, preg, mirr; static uint8 creg[4], latch0, latch1, preg, mirr;
static uint8 *WRAM = NULL; static uint8 *WRAM = NULL;
static uint32 WRAMSIZE; static uint32 WRAMSIZE;
@@ -47,7 +47,7 @@ static void Sync(void) {
setprg8(0xC000, ~1); setprg8(0xC000, ~1);
setprg8(0xE000, ~0); setprg8(0xE000, ~0);
} }
if (battery) if (is10 || isPC10)
setprg8r(0x10, 0x6000, 0); setprg8r(0x10, 0x6000, 0);
setchr4(0x0000, creg[latch0]); setchr4(0x0000, creg[latch0]);
setchr4(0x1000, creg[latch1 + 2]); setchr4(0x1000, creg[latch1 + 2]);
@@ -93,7 +93,7 @@ static void MMC2and4Power(void) {
preg = 0; preg = 0;
latch0 = latch1 = 1; latch0 = latch1 = 1;
Sync(); Sync();
if (battery) { if (is10 || isPC10) {
SetReadHandler(0x6000, 0x7FFF, CartBR); SetReadHandler(0x6000, 0x7FFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
@@ -114,18 +114,20 @@ static void MMC2and4Close(void) {
void Mapper9_Init(CartInfo *info) { void Mapper9_Init(CartInfo *info) {
is10 = 0; is10 = 0;
battery = 0; isPC10 = 0;
info->Power = MMC2and4Power; info->Power = MMC2and4Power;
info->Close = MMC2and4Close; info->Close = MMC2and4Close;
PPU_hook = MMC2and4PPUHook; PPU_hook = MMC2and4PPUHook;
WRAMSIZE = 8192; if (info->CRC32 == 0x7b837fde) { /* Mike Tyson's Punch-Out!! (PC10) supports save ram */
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); isPC10 = 1;
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); WRAMSIZE = 8192;
AddExState(WRAM, WRAMSIZE, 0, "WRAM"); WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
if (info->battery) { SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
battery = 1; AddExState(WRAM, WRAMSIZE, 0, "WRAM");
info->SaveGame[0] = WRAM; if (info->battery) {
info->SaveGameLen[0] = WRAMSIZE; info->SaveGame[0] = WRAM;
info->SaveGameLen[0] = WRAMSIZE;
}
} }
GameStateRestore = StateRestore; GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
@@ -133,7 +135,7 @@ void Mapper9_Init(CartInfo *info) {
void Mapper10_Init(CartInfo *info) { void Mapper10_Init(CartInfo *info) {
is10 = 1; is10 = 1;
battery = 0; isPC10 = 0;
info->Power = MMC2and4Power; info->Power = MMC2and4Power;
info->Close = MMC2and4Close; info->Close = MMC2and4Close;
PPU_hook = MMC2and4PPUHook; PPU_hook = MMC2and4PPUHook;
@@ -142,7 +144,6 @@ void Mapper10_Init(CartInfo *info) {
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM"); AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if (info->battery) { if (info->battery) {
battery = 1;
info->SaveGame[0] = WRAM; info->SaveGame[0] = WRAM;
info->SaveGameLen[0] = WRAMSIZE; info->SaveGameLen[0] = WRAMSIZE;
} }

View File

@@ -94,9 +94,9 @@
{0x9cbadc25, 5, 8}, /* JustBreed */ {0x9cbadc25, 5, 8}, /* JustBreed */
{0xf518dd58, 7, 8}, /* Captain Skyhawk */ {0xf518dd58, 7, 8}, /* Captain Skyhawk */
{0x6c4a9735, 7, 8}, /* WWF Wrestlemania (Europe) */ {0x6c4a9735, 7, 8}, /* WWF Wrestlemania (Europe) */
{0x84382231, 9, 0}, /* Punch Out (J) */ {0x84382231, 9, -1}, /* Punch Out (J) */
{0xbe939fce, 9, 1}, /* Punchout*/ {0xbe939fce, 9, -1}, /* Punchout*/
{0x7b837fde, 9, 1}, /* Mike Tyson's Punch-Out!! (PC10)*/ {0x7b837fde, 9, -1}, /* Mike Tyson's Punch-Out!! (PC10)*/
{0x345d3a1a, 11, 1}, /* Castle of Deceit */ {0x345d3a1a, 11, 1}, /* Castle of Deceit */
{0xb79f2651, 11, 1}, /* Chiller (USA) (Unl) */ {0xb79f2651, 11, 1}, /* Chiller (USA) (Unl) */
{0x5e66eaea, 13, 1}, /* Videomation */ {0x5e66eaea, 13, 1}, /* Videomation */