diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs
index f524b4bb13..1475a7e2dd 100644
--- a/BizHawk.Client.EmuHawk/MainForm.Events.cs
+++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs
@@ -10,6 +10,7 @@ using BizHawk.Emulation.Cores.Atari.A7800Hawk;
using BizHawk.Emulation.Cores.Calculators;
using BizHawk.Emulation.Cores.ColecoVision;
using BizHawk.Emulation.Cores.Nintendo.NES;
+using BizHawk.Emulation.Cores.Nintendo.SubNESHawk;
using BizHawk.Emulation.Cores.Nintendo.N64;
using BizHawk.Emulation.Cores.Nintendo.SNES;
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
@@ -1634,6 +1635,10 @@ namespace BizHawk.Client.EmuHawk
{
new NESGraphicsConfig().ShowDialog(this);
}
+ else if (Emulator is SubNESHawk)
+ {
+ new NESGraphicsConfig().ShowDialog(this);
+ }
else if (Emulator is QuickNES)
{
new QuickNesConfig().ShowDialog(this);
@@ -1704,6 +1709,10 @@ namespace BizHawk.Client.EmuHawk
{
new NesControllerSettings().ShowDialog();
}
+ else if (Emulator is SubNESHawk)
+ {
+ new NesControllerSettings().ShowDialog();
+ }
else if (Emulator is QuickNES)
{
GenericCoreConfig.DoDialog(this, "QuickNES Controller Settings", true, false);
diff --git a/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs b/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs
index f8c41e16ee..64b371ddc6 100644
--- a/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs
+++ b/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs
@@ -5,6 +5,7 @@ using System.Windows.Forms;
using BizHawk.Common;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
+using BizHawk.Emulation.Cores.Nintendo.SubNESHawk;
namespace BizHawk.Client.EmuHawk
{
@@ -15,6 +16,7 @@ namespace BizHawk.Client.EmuHawk
// Hotkeys for BG & Sprite display toggle
// NTSC filter settings? Hue, Tint (This should probably be a client thing, not a nes specific thing?)
private NES _nes;
+ private SubNESHawk _subneshawk;
private NES.NESSettings _settings;
private Bitmap _bmp;
@@ -25,8 +27,17 @@ namespace BizHawk.Client.EmuHawk
private void NESGraphicsConfig_Load(object sender, EventArgs e)
{
- _nes = (NES)Global.Emulator;
- _settings = _nes.GetSettings();
+ if (Global.Emulator is NES)
+ {
+ _nes = (NES)Global.Emulator;
+ _settings = _nes.GetSettings();
+ }
+ else
+ {
+ _subneshawk = (SubNESHawk)Global.Emulator;
+ _settings = _subneshawk.GetSettings();
+ }
+
LoadStuff();
}
@@ -146,7 +157,15 @@ namespace BizHawk.Client.EmuHawk
_settings.BackgroundColor &= 0x00FFFFFF;
}
- _nes.PutSettings(_settings);
+ if (Global.Emulator is NES)
+ {
+ _nes.PutSettings(_settings);
+ }
+ else
+ {
+ _subneshawk.PutSettings(_settings);
+ }
+
Close();
}
diff --git a/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs b/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs
index 068711825f..4141bf067e 100644
--- a/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs
+++ b/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs
@@ -4,6 +4,7 @@ using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
+using BizHawk.Emulation.Cores.Nintendo.SubNESHawk;
namespace BizHawk.Client.EmuHawk
{
@@ -14,7 +15,15 @@ namespace BizHawk.Client.EmuHawk
public NesControllerSettings()
{
InitializeComponent();
- _syncSettings = ((NES)Global.Emulator).GetSyncSettings();
+ if (Global.Emulator is NES)
+ {
+ _syncSettings = ((NES)Global.Emulator).GetSyncSettings();
+ }
+ else
+ {
+ _syncSettings = ((SubNESHawk)Global.Emulator).GetSyncSettings();
+ }
+
// TODO: use combobox extension and add descriptions to enum values
comboBoxFamicom.Items.AddRange(NESControlSettings.GetFamicomExpansionValues().ToArray());
diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
index dda627b813..f6bf415a2a 100644
--- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
+++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
@@ -317,9 +317,9 @@
-
+
-
+
@@ -327,23 +327,23 @@
- NECUPD765.cs
-
+ NECUPD765.cs
+
- NECUPD765.cs
-
+ NECUPD765.cs
+
- NECUPD765.cs
-
+ NECUPD765.cs
+
- NECUPD765.cs
-
+ NECUPD765.cs
+
- NECUPD765.cs
-
+ NECUPD765.cs
+
- NECUPD765.cs
-
+ NECUPD765.cs
+
@@ -375,93 +375,93 @@
- SpectrumBase.cs
-
+ SpectrumBase.cs
+
- SpectrumBase.cs
-
+ SpectrumBase.cs
+
- SpectrumBase.cs
-
-
- SpectrumBase.cs
-
-
-
-
+ SpectrumBase.cs
+
+
+ SpectrumBase.cs
+
+
+
+
- ZX48.cs
-
-
- ZX48.cs
-
+ ZX48.cs
+
+
+ ZX48.cs
+
-
-
+
+
- ZX128.cs
-
+ ZX128.cs
+
- ZX128.cs
-
+ ZX128.cs
+
-
-
+
+
- ZX128Plus2a.cs
-
+ ZX128Plus2a.cs
+
- ZX128Plus2a.cs
-
-
-
+ ZX128Plus2a.cs
+
+
+
- ZX128Plus3.cs
-
+ ZX128Plus3.cs
+
- ZX128Plus3.cs
-
+ ZX128Plus3.cs
+
- Pentagon128.cs
-
+ Pentagon128.cs
+
- Pentagon128.cs
-
-
-
-
+ Pentagon128.cs
+
+
+
+
- ZXSpectrum.cs
-
+ ZXSpectrum.cs
+
- ZXSpectrum.cs
-
+ ZXSpectrum.cs
+
- ZXSpectrum.cs
-
+ ZXSpectrum.cs
+
- ZXSpectrum.cs
-
+ ZXSpectrum.cs
+
- ZXSpectrum.cs
-
+ ZXSpectrum.cs
+
- ZXSpectrum.cs
-
+ ZXSpectrum.cs
+
- ZXSpectrum.cs
-
+ ZXSpectrum.cs
+
- ZXSpectrum.cs
-
+ ZXSpectrum.cs
+
- ZXSpectrum.cs
-
-
- ZXSpectrum.cs
-
+ ZXSpectrum.cs
+
+
+ ZXSpectrum.cs
+
Atari2600.cs
@@ -789,7 +789,7 @@
VBANext.cs
-
+
GBHawkLink.cs
@@ -1201,7 +1201,7 @@
-
+
SubNESHawk.cs
@@ -1217,14 +1217,9 @@
SubNESHawk.cs
-
- SubNESHawk.cs
-
SubNESHawk.cs
-
-
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs
index 6ff0282779..40d3106894 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs
@@ -419,17 +419,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public bool current_strobe;
public bool new_strobe;
public bool alt_lag;
- public byte ctrl_1 = 0;
- public byte ctrl_2 = 0;
- public byte ctrl_1_new = 0;
- public byte ctrl_2_new = 0;
- public int shift_1;
- public int shift_2;
- public bool use_sub_input = false;
// this function will run one step of the ppu
// it will return whether the controller is read or not.
- public void do_single_step(out bool cont_read, out bool frame_done)
+ public void do_single_step(IController controller, out bool cont_read, out bool frame_done)
{
+ _controller = controller;
+
controller_was_latched = false;
frame_is_done = false;
@@ -779,21 +774,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
controller_was_latched = true;
alt_lag = false;
-
- if (use_sub_input)
- {
- shift_1 = 7;
- shift_2 = 7;
-
- ctrl_1 = ctrl_1_new;
- ctrl_2 = ctrl_2_new;
- }
- }
-
- if (use_sub_input && new_strobe)
- {
- shift_1 = 7;
- shift_2 = 7;
}
}
@@ -803,36 +783,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
lagged = false;
byte ret = 0;
- if (use_sub_input)
+ if (_isVS)
{
- if (addr == 0x4016)
- {
- if (shift_1 >= 0) { ret = (byte)((ctrl_1 >> shift_1) & 1); }
- else { ret = 1; }
-
- if (!current_strobe) { shift_1 -= 1; }
- }
- else
- {
- if (shift_2 >= 0) { ret = (byte)((ctrl_2 >> shift_2) & 1); }
- else { ret = 1; }
-
- if (!current_strobe) { shift_2 -= 1; }
- }
+ // for whatever reason, in VS left and right controller have swapped regs
+ ret = addr == 0x4017 ? ControllerDeck.ReadA(_controller) : ControllerDeck.ReadB(_controller);
}
else
{
- if (_isVS)
- {
- // for whatever reason, in VS left and right controller have swapped regs
- ret = addr == 0x4017 ? ControllerDeck.ReadA(_controller) : ControllerDeck.ReadB(_controller);
- }
- else
- {
- ret = addr == 0x4016 ? ControllerDeck.ReadA(_controller) : ControllerDeck.ReadB(_controller);
- }
+ ret = addr == 0x4016 ? ControllerDeck.ReadA(_controller) : ControllerDeck.ReadB(_controller);
}
-
+
ret &= 0x1f;
ret |= (byte)(0xe0 & DB);
return ret;
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IStatable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IStatable.cs
index 7c7b3f7f17..eeda0a5fd7 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IStatable.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IStatable.cs
@@ -85,11 +85,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// single cycle execution related
ser.Sync("current_strobe", ref current_strobe);
ser.Sync("new_strobe", ref new_strobe);
- ser.Sync("ctrl_1", ref ctrl_1);
- ser.Sync("ctrl_2", ref ctrl_2);
- ser.Sync("shift_1", ref shift_1);
- ser.Sync("shift_2", ref shift_2);
- ser.Sync("use_sub_input", ref use_sub_input);
ser.BeginSection("Board");
Board.SyncState(ser);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.IEmulator.cs
index 3fef3f0d45..5e31027258 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.IEmulator.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.IEmulator.cs
@@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
{
public IEmulatorServiceProvider ServiceProvider { get; }
- public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
+ public ControllerDefinition ControllerDefinition => subnes.ControllerDefinition;
public bool FrameAdvance(IController controller, bool render, bool rendersound)
{
@@ -38,9 +38,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
_islag = true;
subnes.alt_lag = true;
- GetControllerState(controller);
+ InputCallbacks.Call();
- do_frame();
+ do_frame(controller);
bool ret = pass_a_frame;
@@ -62,31 +62,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
public bool stop_cur_frame;
public bool pass_new_input;
public bool pass_a_frame;
- public byte ctrl_byte_1;
- public byte ctrl_byte_2;
- public void do_frame()
+ public void do_frame(IController controller)
{
stop_cur_frame = false;
while (!stop_cur_frame)
{
- subnes.do_single_step(out pass_new_input, out pass_a_frame);
+ subnes.do_single_step(controller, out pass_new_input, out pass_a_frame);
stop_cur_frame |= pass_a_frame;
stop_cur_frame |= pass_new_input;
}
}
- public void GetControllerState(IController controller)
- {
- InputCallbacks.Call();
-
- ctrl_byte_1 = _controllerDeck.ReadPort1(controller);
- ctrl_byte_2 = _controllerDeck.ReadPort2(controller);
-
- subnes.ctrl_1_new = ctrl_byte_1;
- subnes.ctrl_2_new = ctrl_byte_2;
- }
-
public int Frame => _frame;
public string SystemId => "NES";
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.ISettable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.ISettable.cs
deleted file mode 100644
index 9db3f0acc1..0000000000
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.ISettable.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System;
-
-using BizHawk.Common;
-using BizHawk.Emulation.Common;
-using BizHawk.Emulation.Cores.Nintendo.NES;
-
-namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
-{
- public partial class SubNESHawk : IEmulator, IStatable, ISettable
- {
- public SubNESHawkSettings GetSettings()
- {
- return subnesSettings.Clone();
- }
-
- public SubNESHawkSyncSettings GetSyncSettings()
- {
- return subnesSyncSettings.Clone();
- }
-
- public bool PutSettings(SubNESHawkSettings o)
- {
- subnesSettings = o;
- return false;
- }
-
- public bool PutSyncSettings(SubNESHawkSyncSettings o)
- {
- bool ret = SubNESHawkSyncSettings.NeedsReboot(subnesSyncSettings, o);
- subnesSyncSettings = o;
- return ret;
- }
-
- private SubNESHawkSettings subnesSettings = new SubNESHawkSettings();
- public SubNESHawkSyncSettings subnesSyncSettings = new SubNESHawkSyncSettings();
-
- public class SubNESHawkSettings
- {
- public SubNESHawkSettings Clone()
- {
- return (SubNESHawkSettings)MemberwiseClone();
- }
- }
-
- public class SubNESHawkSyncSettings
- {
- public SubNESHawkSyncSettings Clone()
- {
- return (SubNESHawkSyncSettings)MemberwiseClone();
- }
-
- public static bool NeedsReboot(SubNESHawkSyncSettings x, SubNESHawkSyncSettings y)
- {
- return !DeepEquality.DeepEquals(x, y);
- }
- }
- }
-}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.IStatable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.IStatable.cs
index d6a092971e..0f6a4b3e54 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.IStatable.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.IStatable.cs
@@ -54,10 +54,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
ser.Sync("IsLag", ref _islag);
ser.Sync("pass_a_frame", ref pass_a_frame);
ser.Sync("pass_new_input", ref pass_new_input);
- ser.Sync("ctrl_byte_1", ref ctrl_byte_1);
- ser.Sync("ctrl_byte_2", ref ctrl_byte_2);
-
- _controllerDeck.SyncState(ser);
}
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs
index 91d590f508..90b3904778 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs
@@ -13,7 +13,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
isReleased: false)]
[ServiceNotApplicable(typeof(IDriveLight))]
public partial class SubNESHawk : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable,
- ISettable, INESPPUViewable
+ ISettable, INESPPUViewable
{
public NES.NES subnes;
@@ -22,18 +22,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
{
var ser = new BasicServiceProvider(this);
- subnesSettings = (SubNESHawkSettings)settings ?? new SubNESHawkSettings();
- subnesSyncSettings = (SubNESHawkSyncSettings)syncSettings ?? new SubNESHawkSyncSettings();
- _controllerDeck = new SubNESHawkControllerDeck(SubNESHawkControllerDeck.DefaultControllerName, SubNESHawkControllerDeck.DefaultControllerName);
+ subnesSettings = (NES.NES.NESSettings)settings ?? new NES.NES.NESSettings();
+ subnesSyncSettings = (NES.NES.NESSyncSettings)syncSettings ?? new NES.NES.NESSyncSettings();
CoreComm = comm;
- var temp_set = new NES.NES.NESSettings();
-
- var temp_sync = new NES.NES.NESSyncSettings();
-
subnes = new NES.NES(new CoreComm(comm.ShowMessage, comm.Notify) { CoreFileProvider = comm.CoreFileProvider },
- game, rom, temp_set, temp_sync);
+ game, rom, subnesSettings, subnesSyncSettings);
ser.Register(subnes.videoProvider);
ser.Register(subnes.magicSoundProvider);
@@ -46,9 +41,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
SetupMemoryDomains();
HardReset();
-
- // input override for subframe input
- subnes.use_sub_input = true;
}
public void HardReset()
@@ -68,8 +60,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
public int _frame = 0;
- private readonly SubNESHawkControllerDeck _controllerDeck;
-
private readonly ITraceable _tracer;
private void ExecFetch(ushort addr)
@@ -77,6 +67,52 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
MemoryCallbacks.CallExecutes(addr, "System Bus");
}
+ #region ISettable
+ private NES.NES.NESSettings subnesSettings = new NES.NES.NESSettings();
+ public NES.NES.NESSyncSettings subnesSyncSettings = new NES.NES.NESSyncSettings();
+
+ public NES.NES.NESSettings GetSettings()
+ {
+ return subnesSettings.Clone();
+ }
+
+ public NES.NES.NESSyncSettings GetSyncSettings()
+ {
+ return subnesSyncSettings.Clone();
+ }
+
+ public bool PutSettings(NES.NES.NESSettings o)
+ {
+ subnesSettings = o;
+ if (subnesSettings.ClipLeftAndRight)
+ {
+ subnes.videoProvider.left = 8;
+ subnes.videoProvider.right = 247;
+ }
+ else
+ {
+ subnes.videoProvider.left = 0;
+ subnes.videoProvider.right = 255;
+ }
+
+ CoreComm.ScreenLogicalOffsetX = subnes.videoProvider.left;
+ CoreComm.ScreenLogicalOffsetY = Region == DisplayType.NTSC ? subnesSettings.NTSC_TopLine : subnesSettings.PAL_TopLine;
+
+ subnes.SetPalette(subnesSettings.Palette);
+
+ subnes.apu.m_vol = subnesSettings.APU_vol;
+
+ return false;
+ }
+
+ public bool PutSyncSettings(NES.NES.NESSyncSettings o)
+ {
+ bool ret = NES.NES.NESSyncSettings.NeedsReboot(subnesSyncSettings, o);
+ subnesSyncSettings = o;
+ return ret;
+ }
+ #endregion
+
#region PPU Viewable
public int[] GetPalette()
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawkControllerDeck.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawkControllerDeck.cs
deleted file mode 100644
index 7f2ecfae40..0000000000
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawkControllerDeck.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using BizHawk.Common;
-using BizHawk.Common.ReflectionExtensions;
-using BizHawk.Emulation.Common;
-
-namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
-{
- public class SubNESHawkControllerDeck
- {
- public SubNESHawkControllerDeck(string controller1Name, string controller2Name)
- {
- if (!ValidControllerTypes.ContainsKey(controller1Name))
- {
- throw new InvalidOperationException("Invalid controller type: " + controller1Name);
- }
-
- if (!ValidControllerTypes.ContainsKey(controller2Name))
- {
- throw new InvalidOperationException("Invalid controller type: " + controller2Name);
- }
-
- Port1 = (IPort)Activator.CreateInstance(ValidControllerTypes[controller1Name], 1);
- Port2 = (IPort)Activator.CreateInstance(ValidControllerTypes[controller2Name], 2);
-
- Definition = new ControllerDefinition
- {
- Name = Port1.Definition.Name,
- BoolButtons = Port1.Definition.BoolButtons
- .Concat(Port2.Definition.BoolButtons)
- .Concat(new[]
- {
- "Power",
- "Reset",
- })
- .ToList()
- };
- }
-
- public byte ReadPort1(IController c)
- {
- return Port1.Read(c);
- }
-
- public byte ReadPort2(IController c)
- {
- return Port2.Read(c);
- }
-
- public ControllerDefinition Definition { get; }
-
- public void SyncState(Serializer ser)
- {
- ser.BeginSection("Port1");
- Port1.SyncState(ser);
- ser.EndSection();
-
- ser.BeginSection("Port2");
- Port2.SyncState(ser);
- ser.EndSection();
- }
-
- private readonly IPort Port1;
- private readonly IPort Port2;
-
- private static Dictionary _controllerTypes;
-
- public static Dictionary ValidControllerTypes
- {
- get
- {
- if (_controllerTypes == null)
- {
- _controllerTypes = typeof(SubNESHawkControllerDeck).Assembly
- .GetTypes()
- .Where(t => typeof(IPort).IsAssignableFrom(t))
- .Where(t => !t.IsAbstract && !t.IsInterface)
- .ToDictionary(tkey => tkey.DisplayName());
- }
-
- return _controllerTypes;
- }
- }
-
- public static string DefaultControllerName => typeof(StandardControls).DisplayName();
- }
-}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawkControllers.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawkControllers.cs
deleted file mode 100644
index 44e9e5e98d..0000000000
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawkControllers.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-using System;
-
-using System.ComponentModel;
-using System.Linq;
-
-using BizHawk.Common;
-using BizHawk.Emulation.Common;
-
-namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
-{
- ///
- /// Represents a Standard Nintendo Controller
- ///
- public interface IPort
- {
- byte Read(IController c);
-
- ControllerDefinition Definition { get; }
-
- void SyncState(Serializer ser);
-
- int PortNum { get; }
- }
-
- [DisplayName("NES Controller")]
- public class StandardControls : IPort
- {
- public StandardControls(int portNum)
- {
- PortNum = portNum;
- Definition = new ControllerDefinition
- {
- Name = "NES Controller",
- BoolButtons = BaseDefinition
- .Select(b => "P" + PortNum + " " + b)
- .ToList()
- };
- }
-
- public int PortNum { get; }
-
- public ControllerDefinition Definition { get; }
-
- public byte Read(IController c)
- {
- byte result = 0;
-
- if (c.IsPressed(Definition.BoolButtons[0]))
- {
- result |= 8;
- }
- if (c.IsPressed(Definition.BoolButtons[1]))
- {
- result |= 4;
- }
- if (c.IsPressed(Definition.BoolButtons[2]))
- {
- result |= 2;
- }
- if (c.IsPressed(Definition.BoolButtons[3]))
- {
- result |= 1;
- }
- if (c.IsPressed(Definition.BoolButtons[4]))
- {
- result |= 16;
- }
- if (c.IsPressed(Definition.BoolButtons[5]))
- {
- result |= 32;
- }
- if (c.IsPressed(Definition.BoolButtons[6]))
- {
- result |= 64;
- }
- if (c.IsPressed(Definition.BoolButtons[7]))
- {
- result |= 128;
- }
-
- return result;
- }
-
- private static readonly string[] BaseDefinition =
- {
- "Up", "Down", "Left", "Right", "Start", "Select", "B", "A"
- };
-
- public void SyncState(Serializer ser)
- {
- //nothing
- }
- }
-}
\ No newline at end of file