From f2529fa0e0ac82e0d7e599b07fac8d1958bf1d6e Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Mon, 9 Apr 2018 12:48:47 -0400 Subject: [PATCH] NESHawk: Fix mapper 219 --- Assets/gamedb/gamedb_nes.txt | 1 + .../NES/Boards/MMC3_family/Mapper219.cs | 22 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Assets/gamedb/gamedb_nes.txt b/Assets/gamedb/gamedb_nes.txt index 256a27a55b..5ccc1128a5 100644 --- a/Assets/gamedb/gamedb_nes.txt +++ b/Assets/gamedb/gamedb_nes.txt @@ -276,6 +276,7 @@ sha1:4EBC1ED9665C36913D0F05129E6A54787BAD3165 Dragon Ball 3 - Gokuu Den (Japan) sha1:5A6DFDD8A2D62EBE313A6FDB986C3585077BB348 Final Combat (Asia) (NTSC) (Unl) NES board=MAPPER139 sha1:DFAF6D81280ADBEB2ADF3DAB38E536B0F2FDFC76 Final Combat (Asia) (PAL) (Unl) NES board=MAPPER139;system=NES-PAL sha1:433CEC30E71DCA31E32B8A44A0D534DBFE7039CA BoogerMan II (RexSoft) [!] NES board=UNIF_UNL-KOF97 +sha1:1903F3C614E54C0AA4EDE740909D7B3C791FA514 Toy Story NES board=MAPPER219 ;;;;;;;;;;;;;;;;;;;----------------------------------------------------------------------- diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs index 477ffd3ef9..53c335f07f 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs @@ -1,4 +1,6 @@ -namespace BizHawk.Emulation.Cores.Nintendo.NES +using System; + +namespace BizHawk.Emulation.Cores.Nintendo.NES { public sealed class Mapper219 : MMC3Board_Base { @@ -15,14 +17,15 @@ case "MAPPER219": break; default: - return false; + return false; } BaseSetup(); - prgregs[1] = 1; - prgregs[2] = 2; - prgregs[3] = 3; + prgregs[0] = 0xFC; + prgregs[1] = 0xFD; + prgregs[2] = 0xFE; + prgregs[3] = 0xFF; byte r0_0 = (byte)(0 & ~1); byte r0_1 = (byte)(0 | 1); @@ -108,16 +111,21 @@ public override byte ReadPRG(int addr) { int bank_prg = addr >> 13; - bank_prg = prgregs[bank_prg]; + bank_prg = prgregs[bank_prg] & prg_mask; return ROM[((bank_prg << 13) + (addr & 0x1FFF))]; } public override byte ReadPPU(int addr) { + if (addr<0x2000) { int bank_chr = addr >> 10; - bank_chr = chrregs[bank_chr]; + bank_chr = chrregs[bank_chr] & chr_mask; + if (VROM != null) + { + return VROM[((bank_chr << 10) + (addr & 0x3FF))]; + } return VRAM[((bank_chr << 10) + (addr & 0x3FF))]; } else