diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 612af9f6b1..91dd4dcacd 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -150,6 +150,7 @@ + diff --git a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt index 1965611b44..7d1ca2675c 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt +++ b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt @@ -97,6 +97,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an 164 Pirate Junk - Started 165 Pirate Junk 176 Chinese WXN Decent +178 Chinese Decent 180 Misc (J) Complete (but we don't implement the crazy climber controller) 182 MMC3Variant Decent 184 Sunsoft-1 Complete diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs index 715c1ffaeb..eded123433 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs @@ -256,6 +256,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo //this will be used to track classes that implement boards [AttributeUsage(AttributeTargets.Class)] public class INESBoardImplAttribute : Attribute { } + //this tracks derived boards that shouldnt be used by the implementation scanner + [AttributeUsage(AttributeTargets.Class)] + public class INESBoardImplCancelAttribute : Attribute { } static List INESBoardImplementors = new List(); static NES() @@ -266,6 +269,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo var attrs = type.GetCustomAttributes(typeof(INESBoardImplAttribute), true); if (attrs.Length == 0) continue; if (type.IsAbstract) continue; + var cancelAttrs = type.GetCustomAttributes(typeof(INESBoardImplCancelAttribute), true); + if (cancelAttrs.Length != 0) continue; INESBoardImplementors.Add(type); } } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper116.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper116.cs index ff714bec02..e1099eebec 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper116.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper116.cs @@ -8,6 +8,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo { class Mapper116 : NES.NESBoardBase { + [NES.INESBoardImplCancel] class MMC3_CustomBoard : MMC3Board_Base { public override void WritePRG(int addr, byte value) diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper178.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper178.cs new file mode 100644 index 0000000000..5058105fec --- /dev/null +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper178.cs @@ -0,0 +1,69 @@ +using System; +using System.IO; +using System.Diagnostics; + +namespace BizHawk.Emulation.Consoles.Nintendo +{ + class Mapper178 : NES.NESBoardBase + { + //configuration + int prg_bank_mask_32k; + + //state + ByteBuffer prg_banks_32k = new ByteBuffer(1); + int reg4802; + + public override bool Configure(NES.EDetectionOrigin origin) + { + //configure + switch (Cart.board_type) + { + case "MAPPER178": + break; + default: + return false; + } + prg_bank_mask_32k = (Cart.prg_size / 32) - 1; + + prg_banks_32k[0] = 0; + + SetMirrorType(EMirrorType.Vertical); + + return true; + } + + public override void WriteEXP(int addr, byte value) + { + switch (addr) + { + case 0x0800: //$4800 + SetMirrorType(value.Bit(0) ? EMirrorType.Horizontal : EMirrorType.Vertical); + break; + case 0x0801: //$4801 + { + int reg4801 = (value >> 1) & 0xF; + int prg = reg4801 + (reg4802 << 2); + prg_banks_32k[0] = (byte)prg; + ApplyMemoryMapMask(prg_bank_mask_32k, prg_banks_32k); + break; + } + case 0x0802: //$4802 + reg4802 = value; + break; + } + } + + public override byte ReadPRG(int addr) + { + addr = ApplyMemoryMap(15, prg_banks_32k, addr); + return ROM[addr]; + } + + public override void SyncState(Serializer ser) + { + base.SyncState(ser); + ser.Sync("prg_banks_32k", ref prg_banks_32k); + ser.Sync("reg4802", ref reg4802); + } + } +}