From ea8cf7c73a576760dda6b4bbfd6914b8af20c52c Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 8 Jun 2012 21:41:05 +0000 Subject: [PATCH] support all mapper 176 games by unifying virtuanes 176 concepts with fk23c mapper and employing a new game database to provide one tiny PRG wiring parameter (??) or mapper variation which apparently isnt set by the game's operations. all the WXN games need it and none of the others do, so a variant is plausible, but it's such a tiny change i suspect a wiring difference instead. --- src/boards/176.cpp | 5 +++ src/boards/fk23c.cpp | 75 ++++++++++++++++++++++++++++++++++++++------ src/ines.cpp | 30 ++++++++++++++++++ src/ines.h | 9 ++++++ 4 files changed, 110 insertions(+), 9 deletions(-) diff --git a/src/boards/176.cpp b/src/boards/176.cpp index ab20fe8c..b00f1ee7 100644 --- a/src/boards/176.cpp +++ b/src/boards/176.cpp @@ -48,6 +48,7 @@ static void Sync(void) static DECLFW(M176Write_5001) { + printf("%04X = $%02X\n",A,V); if(sbw) { prg[0] = V*4; @@ -60,12 +61,14 @@ static DECLFW(M176Write_5001) static DECLFW(M176Write_5010) { + printf("%04X = $%02X\n",A,V); if(V == 0x24) sbw = 1; Sync(); } static DECLFW(M176Write_5011) { + printf("%04X = $%02X\n",A,V); V >>= 1; if(sbw) { @@ -79,6 +82,7 @@ static DECLFW(M176Write_5011) static DECLFW(M176Write_5FF1) { + printf("%04X = $%02X\n",A,V); V >>= 1; prg[0] = V*4; prg[1] = V*4+1; @@ -89,6 +93,7 @@ static DECLFW(M176Write_5FF1) static DECLFW(M176Write_5FF2) { + printf("%04X = $%02X\n",A,V); chr = V; Sync(); } diff --git a/src/boards/fk23c.cpp b/src/boards/fk23c.cpp index 0f000ec2..45a8e275 100644 --- a/src/boards/fk23c.cpp +++ b/src/boards/fk23c.cpp @@ -1,4 +1,4 @@ -/* FCE Ultra - NES/Famicom Emulator +/* FCE Ultra - NES/Famicom Emulator * * Copyright notice for this file: * Copyright (C) 2006 CaH4e3 @@ -20,6 +20,7 @@ #include "mapinc.h" #include "mmc3.h" +#include "../ines.h" static uint8 unromchr; static uint32 dipswitch; @@ -41,9 +42,35 @@ static void BMCFK23CCW(uint32 A, uint8 V) } //some games are wired differently, and this will need to be changed. -//for instance, WAIXING176 needs prg_bonus=1, and cah4e3's 4-in-1's need prg_bonus=0 -static int prg_bonus = 0; -static int prg_mask = 0x7F>>(prg_bonus); +//all the WXN games require prg_bonus = 1, and cah4e3's multicarts require prg_bonus = 0 +//we'll populate this from a game database +static int prg_bonus; +static int prg_mask; + +//prg_bonus = 0 +//4-in-1 (FK23C8021)[p1][!].nes +//4-in-1 (FK23C8033)[p1][!].nes +//4-in-1 (FK23C8043)[p1][!].nes +//4-in-1 (FK23Cxxxx, S-0210A PCB)[p1][!].nes + +//prg_bonus = 1 +//[m176]大富翁2-上海大亨.wxn.nes +//[m176]宠物翡翠.fix.nes +//[m176]格兰帝亚.wxn.nes +//[m176]梦幻之星.wxn.nes +//[m176]水浒神兽.fix.nes +//[m176]西楚霸王.fix.nes +//[m176]超级大富翁.wxn.nes +//[m176]雄霸天下.wxn.nes + +//works as-is under virtuanes m176 +//[m176]三侠五义.wxn.nes +//[m176]口袋金.fix.nes +//[m176]爆笑三国.fix.nes + +//needs other tweaks +//[m176]三国忠烈传.wxn.nes +//[m176]破釜沉舟.fix.nes //PRG wrapper static void BMCFK23CPW(uint32 A, uint8 V) @@ -62,7 +89,7 @@ static void BMCFK23CPW(uint32 A, uint8 V) uint32 blocksize = (6+prg_bonus)-(EXPREGS[0]&3); uint32 mask = (1<>(prg_bonus); } diff --git a/src/ines.cpp b/src/ines.cpp index aab60a58..e3cab428 100644 --- a/src/ines.cpp +++ b/src/ines.cpp @@ -38,6 +38,7 @@ #include "utils/memory.h" #include "utils/crc32.h" #include "utils/md5.h" +#include "utils/xstring.h" #include "cheat.h" #include "vsuni.h" #include "driver.h" @@ -285,6 +286,7 @@ struct CHINF { uint32 crc32; int32 mapper; int32 mirror; + const char* params; }; void MapperInit() @@ -304,6 +306,14 @@ void MapperInit() } } +static const TMasterRomInfo sMasterRomInfo[] = { + { 0x62b51b108a01d2beLL, "bonus=0" }, //4-in-1 (FK23C8021)[p1][!].nes + { 0x8bb48490d8d22711LL, "bonus=0" }, //4-in-1 (FK23C8033)[p1][!].nes + { 0xc75888d7b48cd378LL, "bonus=0" }, //4-in-1 (FK23C8043)[p1][!].nes + { 0xf81a376fa54fdd69LL, "bonus=0" }, //4-in-1 (FK23Cxxxx, S-0210A PCB)[p1][!].nes +}; +const TMasterRomInfo* MasterRomInfo; +std::map MasterRomInfoParams; static void CheckHInfo(void) { @@ -382,6 +392,26 @@ static void CheckHInfo(void) } CheckBad(partialmd5); + MasterRomInfo = NULL; + MasterRomInfoParams = std::map(); + for(int i=0;i toks = tokenize_str(info.params,","); + for(int j=0;j<(int)toks.size();j++) + { + std::vector parts = tokenize_str(toks[j],"="); + MasterRomInfoParams[parts[0]] = parts[1]; + } + break; + } + x=0; do diff --git a/src/ines.h b/src/ines.h index 98eccc0f..b2ae17c5 100644 --- a/src/ines.h +++ b/src/ines.h @@ -23,6 +23,7 @@ #define _INES_H_ #include #include +#include #ifdef INESPRIV void iNESStateRestore(int version); @@ -68,6 +69,12 @@ extern uint8 iNESIRQa; #else #endif +struct TMasterRomInfo +{ + uint64 md5lower; + const char* params; +}; + //mbg merge 6/29/06 extern uint8 *ROM; extern uint8 *VROM; @@ -76,6 +83,8 @@ extern uint32 ROM_size; extern int iNesSave(); //bbit Edited: line added extern int iNesSaveAs(char* name); extern char LoadedRomFName[2048]; //bbit Edited: line added +extern const TMasterRomInfo* MasterRomInfo; +extern std::map MasterRomInfoParams; //mbg merge 7/19/06 changed to c++ decl format struct iNES_HEADER {