From 16723b12db7e7941d2fbfa9b5ff6dba9cf8cae60 Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 3 Nov 2016 18:19:23 -0500 Subject: [PATCH] NesHawk - proof of concept - put VS dipswitches into sync settings, replace mapper 99 dipswitch code with these --- .../Consoles/Nintendo/NES/Boards/VS_M99.cs | 44 ++++--------------- .../Consoles/Nintendo/NES/NES.ISettable.cs | 30 +++++++++++++ 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs index 716e39ed36..4fcc6d077d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs @@ -14,23 +14,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES //state int chr; - [MapperProp] - public byte Dip_Switch_1; - [MapperProp] - public byte Dip_Switch_2; - [MapperProp] - public byte Dip_Switch_3; - [MapperProp] - public byte Dip_Switch_4; - [MapperProp] - public byte Dip_Switch_5; - [MapperProp] - public byte Dip_Switch_6; - [MapperProp] - public byte Dip_Switch_7; - [MapperProp] - public byte Dip_Switch_8; - //the VS actually does have 2 KB of nametable address space //let's make the extra space here, instead of in the main NES to avoid confusion byte[] CIRAM_VS = new byte[0x800]; @@ -50,19 +33,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES prg_byte_mask = Cart.prg_size * 1024 - 1; chr_mask = (Cart.chr_size / 8) - 1; - AutoMapperProps.Apply(this); - - //update the state of the dip switches //this is only done at power on - NES.VS_dips[0] = (byte)(Dip_Switch_1 & 1); - NES.VS_dips[1] = (byte)(Dip_Switch_2 & 1); - NES.VS_dips[2] = (byte)(Dip_Switch_3 & 1); - NES.VS_dips[3] = (byte)(Dip_Switch_4 & 1); - NES.VS_dips[4] = (byte)(Dip_Switch_5 & 1); - NES.VS_dips[5] = (byte)(Dip_Switch_6 & 1); - NES.VS_dips[6] = (byte)(Dip_Switch_7 & 1); - NES.VS_dips[7] = (byte)(Dip_Switch_8 & 1); + NES.VS_dips[0] = (byte)(NES.SyncSettings.VSDipswitches.Dip_Switch_1 ? 1 : 0); + NES.VS_dips[1] = (byte)(NES.SyncSettings.VSDipswitches.Dip_Switch_1 ? 1 : 0); + NES.VS_dips[2] = (byte)(NES.SyncSettings.VSDipswitches.Dip_Switch_1 ? 1 : 0); + NES.VS_dips[3] = (byte)(NES.SyncSettings.VSDipswitches.Dip_Switch_1 ? 1 : 0); + NES.VS_dips[4] = (byte)(NES.SyncSettings.VSDipswitches.Dip_Switch_1 ? 1 : 0); + NES.VS_dips[5] = (byte)(NES.SyncSettings.VSDipswitches.Dip_Switch_1 ? 1 : 0); + NES.VS_dips[6] = (byte)(NES.SyncSettings.VSDipswitches.Dip_Switch_1 ? 1 : 0); + NES.VS_dips[7] = (byte)(NES.SyncSettings.VSDipswitches.Dip_Switch_1 ? 1 : 0); return true; } @@ -126,14 +106,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES base.SyncState(ser); ser.Sync("chr", ref chr); ser.Sync("VS_CIRAM", ref CIRAM_VS, false); - ser.Sync("Dip_1", ref Dip_Switch_1); - ser.Sync("Dip_2", ref Dip_Switch_2); - ser.Sync("Dip_3", ref Dip_Switch_3); - ser.Sync("Dip_4", ref Dip_Switch_4); - ser.Sync("Dip_5", ref Dip_Switch_5); - ser.Sync("Dip_6", ref Dip_Switch_6); - ser.Sync("Dip_7", ref Dip_Switch_7); - ser.Sync("Dip_8", ref Dip_Switch_8); } public override byte ReadPRG(int addr) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.ISettable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.ISettable.cs index e428d9d5c7..449a11595c 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.ISettable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.ISettable.cs @@ -4,6 +4,7 @@ using System.Linq; using BizHawk.Common; using BizHawk.Emulation.Common; +using System.ComponentModel; namespace BizHawk.Emulation.Cores.Nintendo.NES { @@ -90,6 +91,35 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES !NESControlSettings.NeedsReboot(x.Controls, y.Controls) && ((x.InitialWRamStatePattern ?? new List()).SequenceEqual(y.InitialWRamStatePattern ?? new List()))); } + + public class VSDipswitchSettings + { + [DisplayName("TODO: Something user frinedly here")] + public bool Dip_Switch_1 { get; set; } + + [DisplayName("TODO: Something user frinedly here")] + public bool Dip_Switch_2 { get; set; } + + [DisplayName("TODO: Something user frinedly here")] + public bool Dip_Switch_3 { get; set; } + + [DisplayName("TODO: Something user frinedly here")] + public bool Dip_Switch_4 { get; set; } + + [DisplayName("TODO: Something user frinedly here")] + public bool Dip_Switch_5 { get; set; } + + [DisplayName("TODO: Something user frinedly here")] + public bool Dip_Switch_6 { get; set; } + + [DisplayName("TODO: Something user frinedly here")] + public bool Dip_Switch_7 { get; set; } + + [DisplayName("TODO: Something user frinedly here")] + public bool Dip_Switch_8 { get; set; } + } + + public VSDipswitchSettings VSDipswitches = new VSDipswitchSettings(); } public class NESSettings