diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 3e3453b7da..8a64ca9ff7 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -256,7 +256,6 @@ - diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper074.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper074.cs index 275b589c2a..e15125a0f2 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper074.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper074.cs @@ -3,6 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; +//27 + +//TODO - could merge functionality with 192 somehow + namespace BizHawk.Emulation.Consoles.Nintendo { class Mapper074 : MMC3Board_Base diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper027.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper027.cs deleted file mode 100644 index bf4e2376f3..0000000000 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper027.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace BizHawk.Emulation.Consoles.Nintendo -{ - // World Hero (Unl) - // 8k banked prgrom, 1k banked chrrom, scanline counter - // tried to copy behavior from fceux, but it doesn't work - public class Mapper027 : NES.NESBoardBase - { - // state - int[] chr = new int[8]; - int[] prg = new int[4]; - int prglatch; - int irqlatch; - int irqstat; - int irqcount; - - // config - int chr_mask; - int prg_mask; - - public override bool Configure(NES.EDetectionOrigin origin) - { - switch (Cart.board_type) - { - case "MAPPER027": - break; - default: - return false; - } - AssertPrg(128); - AssertChr(512); - AssertVram(0); - AssertWram(0); - prg_mask = Cart.prg_size / 8 - 1; - chr_mask = Cart.chr_size / 1 - 1; - prg[3] = prg_mask; - return true; - } - - public override byte ReadPRG(int addr) - { - return ROM[addr & 0x1fff | prg[addr >> 13] << 13]; - } - - public override byte ReadPPU(int addr) - { - if (addr < 0x2000) - return VROM[addr & 0x3ff | chr[addr >> 10] << 10]; - else - return base.ReadPPU(addr); - } - - public override void WritePRG(int addr, byte value) - { - addr &= 0xf00f; - //if (true) - // Console.WriteLine("{0:x4}:{1:x2}", addr + 0x8000, value); - if (addr >= 0x3000 && addr <= 0x6003) - { - int regnum = (addr >> 12) + 1 & 3; - regnum = regnum << 1 | (addr & 2) >> 1; - if ((addr & 1) != 0) - { - chr[regnum] &= 0x00f; - chr[regnum] |= value << 4 & chr_mask; - } - else - { - chr[regnum] &= 0x1f0; - chr[regnum] |= value & 0xf & chr_mask; - } - return; - } - - switch (addr) - { - case 0x0000: - prg[prglatch] = value & prg_mask; - break; - case 0x1000: - switch (value & 3) - { - case 0: SetMirrorType(EMirrorType.Vertical); break; - case 1: SetMirrorType(EMirrorType.Horizontal); break; - case 2: SetMirrorType(EMirrorType.OneScreenA); break; - case 3: SetMirrorType(EMirrorType.OneScreenB); break; - } - prglatch = value & 2; // in fceux, this runs because of a lack of case break. bug? - break; - case 0x1002: - prglatch = value & 2; - break; - case 0x2000: - prg[1] = value & prg_mask; - break; - case 0x7000: - irqlatch &= 0xf0; - irqlatch |= value & 0x0f; - break; - case 0x7001: - irqlatch &= 0x0f; - irqlatch |= value << 4 & 0xf0; - break; - case 0x7002: - irqstat = value & 3; - if ((irqstat & 2) != 0) - irqcount = irqlatch - 1; - break; - case 0x7003: - irqstat = irqstat << 1 & 2 | irqstat & 1; - IRQSignal = false; - break; - } - - - } - - // irq timing is entirely a guess; this bit improvised from ExROM - public override void ClockPPU() - { - if (NES.ppu.ppur.status.cycle != 336) - return; - if (!NES.ppu.reg_2001.PPUON) - return; - - int sl = NES.ppu.ppur.status.sl + 1; - - if (sl >= 241) - return; - hblanktrigger(); - } - - void hblanktrigger() - { - if ((irqstat & 2) != 0) - { - if (irqcount == 255) - { - IRQSignal = true; - irqcount = irqlatch + 1; - Console.WriteLine("Raise"); - } - else - irqcount++; - } - } - - - } -} diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/VRC2_4.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/VRC2_4.cs index d9409f9b9f..c0a0c228ed 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/VRC2_4.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/VRC2_4.cs @@ -17,13 +17,14 @@ namespace BizHawk.Emulation.Consoles.Nintendo Func fix_chr; int type; bool latch6k_exists = false; + bool extrabig_chr = false; //state public int[] prg_bank_reg_8k = new int[2]; public int[] chr_bank_reg_1k = new int[16]; bool prg_mode; ByteBuffer prg_banks_8k = new ByteBuffer(4); - public ByteBuffer chr_banks_1k = new ByteBuffer(8); + public IntBuffer chr_banks_1k = new IntBuffer(8); bool irq_mode; bool irq_enabled, irq_pending, irq_autoen; byte irq_reload; @@ -88,7 +89,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo temp = fix_chr(temp); //Console.Write("{0},", temp); temp &= chr_bank_mask_1k; - chr_banks_1k[i] = (byte)temp; + chr_banks_1k[i] = temp; } } @@ -108,6 +109,15 @@ namespace BizHawk.Emulation.Consoles.Nintendo case "MAPPER025": throw new InvalidOperationException("someone will need to bug me to set these up for failsafe mapping"); + case "MAPPER027": + //not exactly the same implementation as FCEUX, but we're taking functionality from it step by step as we discover and document it + //world hero (unl) is m027 and depends on the extrabig_chr functionality to have correct graphics. + //otherwise, cah4e3 says its the same as VRC4 + extrabig_chr = true; + remap = (addr) => addr; + type = 4; + break; + case "MAPPER116_HACKY": remap = (addr) => addr; type = 2; @@ -190,8 +200,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo public override void WritePRG(int addr, byte value) { - //Console.WriteLine("mapping {0:X4} = {1:X2}", addr, value); + //Console.WriteLine("mapping {0:X4} = {1:X2}", addr + 0x8000, value); addr = remap(addr); + + int chr_value = value & 0xF; + if ((addr & 1) == 1 && extrabig_chr) + chr_value = value & 0x1F; + switch (addr) { default: @@ -236,7 +251,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo case 0x3001: //$B001 case 0x3002: //$B002 case 0x3003: //$B003 - chr_bank_reg_1k[addr-0x3000] = value & 0xF; + chr_bank_reg_1k[addr - 0x3000] = chr_value; SyncCHR(); break; @@ -244,7 +259,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo case 0x4001: //$C001 case 0x4002: //$C002 case 0x4003: //$C003 - chr_bank_reg_1k[addr - 0x4000 + 4] = value & 0xF; + chr_bank_reg_1k[addr - 0x4000 + 4] = chr_value; SyncCHR(); break; @@ -252,7 +267,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo case 0x5001: //$D001 case 0x5002: //$D002 case 0x5003: //$D003 - chr_bank_reg_1k[addr - 0x5000 + 8] = value & 0xF; + chr_bank_reg_1k[addr - 0x5000 + 8] = chr_value; SyncCHR(); break; @@ -260,7 +275,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo case 0x6001: //$E001 case 0x6002: //$E002 case 0x6003: //$E003 - chr_bank_reg_1k[addr - 0x6000 + 12] = value & 0xF; + chr_bank_reg_1k[addr - 0x6000 + 12] = chr_value; SyncCHR(); break; diff --git a/BizHawk.MultiClient/output/gamedb/gamedb.txt b/BizHawk.MultiClient/output/gamedb/gamedb.txt index 0ccb3235f1..bd44faab7a 100644 --- a/BizHawk.MultiClient/output/gamedb/gamedb.txt +++ b/BizHawk.MultiClient/output/gamedb/gamedb.txt @@ -73,6 +73,13 @@ sha1:7BD102770FE7766BF8430ACDB3C17EE51E30478C H Mike Tyson's Punch-Out!! (Hacked sha1:536D623BA02A622BDE8E2D7D514AE9785B5E0357 H Punch Out!! Kirby (Hack) (U) NES board=NES-PNROM;PRG=128;CHR=128;WRAM=0 ;;;;;;;;;;;;;;;;;;;----------------------------------------------------------------------- +;;;;;;;;;;;;;;;;;;;----------------------------------------------------------------------- +;heres another idea. let's list rom sets from goodNES, good and bad variants together +sha1:98B71119294DA59D1B22723D2D2955D80EADABF4 World Hero (Unl) [!] NES board=MAPPER027 +sha1:17AC56723F99A646BD44F8C999B23B8A972A3EF2 B World Hero (Unl) [b1] NES board=MAPPER027 +sha1:5227195D5DB2030758BF67704150E8C5FAF056B1 B World Hero (Unl) [b2] NES board=MAPPER027 +;;;;;;;;;;;;;;;;;;;----------------------------------------------------------------------- + ;;;;;;;;;;;;;;;;;;;----------------------------------------------------------------------- ;obscure and unlicensed roms which are not likely to be in bootgod's DB anytime soon but which are nonetheless "good" as far as things go ;people like these games (especially vast quantities of chinese oddities) so its important to add them here as good