From 52281a4474e9dccce50248f8e73e8838f070d4aa Mon Sep 17 00:00:00 2001 From: retro-wertz Date: Sun, 1 Oct 2017 23:39:19 +0800 Subject: [PATCH] Update Ganbare Goemon Gaiden 2 to use Mapper21 based on sources --- src/boards/vrc2and4.c | 31 +++++++++++++++---------------- src/ines-correct.h | 4 ++-- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/boards/vrc2and4.c b/src/boards/vrc2and4.c index 499bd59..87c1435 100644 --- a/src/boards/vrc2and4.c +++ b/src/boards/vrc2and4.c @@ -131,9 +131,7 @@ static DECLFW(VRC24Write) { } static DECLFW(M21Write) { - A = (A & 0xF000) | ((A >> 1) & 0x3); /* Ganbare Goemon Gaiden 2 - Tenka no Zaihou (J) [!] isn't mapper 21 actually, - * it's mapper 23 by wirings - */ + A = (A & 0xF000) | ((A >> 1) & 0x3) | ((A >> 6) & 0x3); /* Ganbare Goemon Gaiden 2 - Tenka no Zaihou (J) [!] is Mapper 21*/ VRC24Write(A, V); } @@ -154,14 +152,18 @@ static DECLFW(M22Write) { } static DECLFW(M23Write) { - A |= ((A >> 2) & 0x3) | ((A >> 4) & 0x3) | ((A >> 6) & 0x3);/* actually there is many-in-one mapper source, some pirate or - * licensed games use various address bits for registers - */ + A |= ((A >> 2) & 0x3) | ((A >> 4) & 0x3); /* actually there is many-in-one mapper source, some pirate or + * licensed games use various address bits for registers + */ VRC24Write(A, V); } static void M21Power(void) { Sync(); + setprg8r(0x10, 0x6000, 0); + SetReadHandler(0x6000, 0x7FFF, CartBR); + SetWriteHandler(0x6000, 0x7FFF, CartBW); + FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); SetReadHandler(0x8000, 0xFFFF, CartBR); SetWriteHandler(0x8000, 0xFFFF, M21Write); } @@ -223,16 +225,6 @@ static void VRC24Close(void) { WRAM = NULL; } -void Mapper21_Init(CartInfo *info) { - isPirate = 0; - is22 = 0; - info->Power = M21Power; - MapIRQHook = VRC24IRQHook; - GameStateRestore = StateRestore; - - AddExState(&StateRegs, ~0, 0, 0); -} - void Mapper22_Init(CartInfo *info) { isPirate = 0; is22 = 1; @@ -260,6 +252,13 @@ void VRC24_Init(CartInfo *info) { AddExState(&StateRegs, ~0, 0, 0); } +void Mapper21_Init(CartInfo *info) { + isPirate = 0; + is22 = 0; + info->Power = M21Power; + VRC24_Init(info); +} + void Mapper23_Init(CartInfo *info) { isPirate = 0; is22 = 0; diff --git a/src/ines-correct.h b/src/ines-correct.h index c421645..98ceca3 100644 --- a/src/ines-correct.h +++ b/src/ines-correct.h @@ -105,7 +105,7 @@ {0x6e68e31a, 16, 8}, /* Dragon Ball 3*/ {0x33b899c9, 16, -1}, /* Dragon Ball - Dai Maou Fukkatsu (J) [!] */ {0xa262a81f, 16, -1}, /* Rokudenashi Blues (J) */ - {0x286fcd20, 23, -1}, /* Ganbare Goemon Gaiden 2 - Tenka no Zaihou (J) [!] */ + {0x286fcd20, 21, -1}, /* Ganbare Goemon Gaiden 2 - Tenka no Zaihou (J) [!] */ {0xe4a291ce, 23, -1}, /* World Hero (Unl) [!] */ {0x51e9cd33, 23, -1}, /* World Hero (Unl) [b1] */ {0x105dd586, 27, -1}, /* Mi Hun Che variations... */ @@ -275,7 +275,7 @@ {0x276237b3, 206, 0}, /* Karnov */ {0xa5e6baf9, 206, 1}, /* Dragon Slayer 4 - Drasle Family (Japan) */ {0x4f2f1846, 206, 1}, /* Famista '89 - Kaimaku Han!! (J) */ - {0x22d6d5bd, 206, 1}, /* Jikuu Yuuden - Debias (J) */ + {0x22d6d5bd, 206, 1}, /* Jikuu Yuuden - Debias (J) */ {0x9d21fe96, 206, 1}, /* Lupin Sansei - Pandora no Isan (Japan) */ {0x96dfc776, 206, 1}, /* R.B.I. Baseball 2 (USA) (Unl) */ {0xfd63e7ac, 206, 1}, /* R.B.I. Baseball 3 (USA) (Unl) */