NesHawk - proof of concept - put VS dipswitches into sync settings, replace mapper 99 dipswitch code with these

This commit is contained in:
adelikat 2016-11-03 18:19:23 -05:00
parent c96d8f860c
commit 16723b12db
2 changed files with 38 additions and 36 deletions

View File

@ -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)

View File

@ -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<byte>()).SequenceEqual(y.InitialWRamStatePattern ?? new List<byte>())));
}
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