From eb1d87933bd21f9c79321dc2a0f42f90a2b9b505 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 16 Nov 2019 12:42:18 -0600 Subject: [PATCH] Fix Nintento (breaking config change but we've already thoroughly broken compatibility since last release), partially addresses #971 --- .../movie/bkm/BkmControllerAdapter.cs | 2 +- .../movie/bkm/BkmMnemonicConstants.cs | 8 +++---- .../config/ControllerConfig.cs | 2 +- .../Consoles/Nintendo/N64/N64Input.cs | 24 +++++++------------ BizHawk.sln.DotSettings | 1 + 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs b/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs index 4e87e6d1b9..504db375b5 100644 --- a/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs +++ b/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs @@ -75,7 +75,7 @@ namespace BizHawk.Client.Common return; } - if (ControlType == "Nintento 64 Controller") + if (ControlType == "Nintendo 64 Controller") { SetN64ControllersAsMnemonic(mnemonic); return; diff --git a/BizHawk.Client.Common/movie/bkm/BkmMnemonicConstants.cs b/BizHawk.Client.Common/movie/bkm/BkmMnemonicConstants.cs index 078176da88..24c28b26a6 100644 --- a/BizHawk.Client.Common/movie/bkm/BkmMnemonicConstants.cs +++ b/BizHawk.Client.Common/movie/bkm/BkmMnemonicConstants.cs @@ -125,7 +125,7 @@ namespace BizHawk.Client.Common } }, { - "Nintento 64 Controller", new Dictionary + "Nintendo 64 Controller", new Dictionary { { "DPad U", "U" }, { "DPad D", "D" }, { "DPad L", "L" }, { "DPad R", "R" }, { "B", "B" }, { "A", "A" }, { "Z", "Z" }, { "Start", "S" }, { "L", "L" }, { "R", "R" }, @@ -144,7 +144,7 @@ namespace BizHawk.Client.Common public static readonly Dictionary> Analogs = new Dictionary> { - { "Nintento 64 Controller", new Dictionary { { "X Axis", "X" }, { "Y Axis", "Y" } } } + { "Nintendo 64 Controller", new Dictionary { { "X Axis", "X" }, { "Y Axis", "Y" } } } }; public static readonly Dictionary> Commands = new Dictionary> @@ -160,7 +160,7 @@ namespace BizHawk.Client.Common { "PC Engine Controller", new Dictionary() }, { "SMS Controller", new Dictionary { { "Pause", "p" }, { "Reset", "r" } } }, { "TI83 Controller", new Dictionary() }, - { "Nintento 64 Controller", new Dictionary { { "Power", "P" }, { "Reset", "r" } } }, + { "Nintendo 64 Controller", new Dictionary { { "Power", "P" }, { "Reset", "r" } } }, { "Saturn Controller", new Dictionary { { "Power", "P" }, { "Reset", "r" } } }, { "GPGX 3-Button Controller", new Dictionary { { "Power", "P" }, { "Reset", "r" } } } }; @@ -169,7 +169,7 @@ namespace BizHawk.Client.Common { { "Gameboy Controller", 1 }, { "GBA Controller", 1 }, { "Genesis 3-Button Controller", 2 }, { "GPGX Genesis Controller", 2 }, { "NES Controller", 4 }, { "SNES Controller", 4 }, { "PC Engine Controller", 5 }, { "SMS Controller", 2 }, { "TI83 Controller", 1 }, { "Atari 2600 Basic Controller", 2 }, { "Atari 7800 ProLine Joystick Controller", 2 }, - { "ColecoVision Basic Controller", 2 }, { "Commodore 64 Controller", 2 }, { "Nintento 64 Controller", 4 }, { "Saturn Controller", 2 }, + { "ColecoVision Basic Controller", 2 }, { "Commodore 64 Controller", 2 }, { "Nintendo 64 Controller", 4 }, { "Saturn Controller", 2 }, { "GPGX 3-Button Controller", 2 }, { "Lynx Controller", 1 } }; diff --git a/BizHawk.Client.EmuHawk/config/ControllerConfig.cs b/BizHawk.Client.EmuHawk/config/ControllerConfig.cs index b908423953..f838b1fbd0 100644 --- a/BizHawk.Client.EmuHawk/config/ControllerConfig.cs +++ b/BizHawk.Client.EmuHawk/config/ControllerConfig.cs @@ -22,7 +22,7 @@ namespace BizHawk.Client.EmuHawk { ControllerImages.Add("NES Controller", Properties.Resources.NES_Controller); ControllerImages.Add("SNES Controller", Properties.Resources.SNES_Controller); - ControllerImages.Add("Nintento 64 Controller", Properties.Resources.N64); + ControllerImages.Add("Nintendo 64 Controller", Properties.Resources.N64); ControllerImages.Add("Gameboy Controller", Properties.Resources.GBController); ControllerImages.Add("Gameboy Controller H", Properties.Resources.GBController); ControllerImages.Add("Gameboy Controller + Tilt", Properties.Resources.GBController); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64Input.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64Input.cs index ee927c10d0..7fb31a5a36 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64Input.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64Input.cs @@ -5,31 +5,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 { internal class N64Input { - private mupen64plusInputApi api; - public CoreComm CoreComm { get; private set; } + private readonly mupen64plusInputApi _api; + public CoreComm CoreComm { get; } public IController Controller { get; set; } public bool LastFrameInputPolled { get; set; } public bool ThisFrameInputPolled { get; set; } - public ControllerDefinition ControllerDefinition { get { return N64ControllerDefinition; } } + public ControllerDefinition ControllerDefinition => N64ControllerDefinition; public static readonly ControllerDefinition N64ControllerDefinition = new ControllerDefinition { - Name = "Nintento 64 Controller", + Name = "Nintendo 64 Controller", BoolButtons = { "P1 A Up", "P1 A Down", "P1 A Left", "P1 A Right", "P1 DPad U", "P1 DPad D", "P1 DPad L", "P1 DPad R", "P1 Start", "P1 Z", "P1 B", "P1 A", "P1 C Up", "P1 C Down", "P1 C Right", "P1 C Left", "P1 L", "P1 R", - //"P2 A Up", "P2 A Down", "P2 A Left", "P2 A Right", "P2 DPad U", "P2 DPad D", "P2 DPad L", "P2 DPad R", "P2 Start", "P2 Z", "P2 B", "P2 A", "P2 C Up", "P2 C Down", "P2 C Right", "P2 C Left", "P2 L", "P2 R", - //"P3 A Up", "P3 A Down", "P3 A Left", "P3 A Right", "P3 DPad U", "P3 DPad D", "P3 DPad L", "P3 DPad R", "P3 Start", "P3 Z", "P3 B", "P3 A", "P3 C Up", "P3 C Down", "P3 C Right", "P3 C Left", "P3 L", "P3 R", - //"P4 A Up", "P4 A Down", "P4 A Left", "P4 A Right", "P4 DPad U", "P4 DPad D", "P4 DPad L", "P4 DPad R", "P4 Start", "P4 Z", "P4 B", "P4 A", "P4 C Up", "P4 C Down", "P4 C Right", "P4 C Left", "P4 L", "P4 R", "Reset", "Power" }, FloatControls = { "P1 X Axis", "P1 Y Axis", - //"P2 X Axis", "P2 Y Axis", - //"P3 X Axis", "P3 Y Axis", - //"P4 X Axis", "P4 Y Axis" }, FloatRanges = { @@ -53,10 +47,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 public N64Input(IInputPollable emuCore, mupen64plusApi core, CoreComm comm, N64SyncSettings.N64ControllerSettings[] controllerSettings) { _emuCore = emuCore; - api = new mupen64plusInputApi(core); + _api = new mupen64plusInputApi(core); CoreComm = comm; - api.SetM64PInputCallback(new mupen64plusInputApi.InputCallback(GetControllerInput)); + _api.SetM64PInputCallback(GetControllerInput); core.VInterrupt += ShiftInputPolledBools; for (int i = 0; i < controllerSettings.Length; ++i) @@ -129,7 +123,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 /// into a form the N64 understands /// /// Number of controller to translate - /// Bitlist of pressed buttons + /// Bit list of pressed buttons public int ReadController(int num) { int buttons = 0; @@ -159,7 +153,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 /// Type to which the controller pak is set. Currently only NO_PAK and MEMORY_CARD are supported public void SetControllerPakType(int controller, N64SyncSettings.N64ControllerSettings.N64ControllerPakType type) { - api.SetM64PControllerPakType(controller, type); + _api.SetM64PControllerPakType(controller, type); } /// @@ -169,7 +163,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 /// New status of the controller connection public void SetControllerConnected(int controller, bool connectionStatus) { - api.SetM64PControllerConnected(controller, connectionStatus); + _api.SetM64PControllerConnected(controller, connectionStatus); } } } diff --git a/BizHawk.sln.DotSettings b/BizHawk.sln.DotSettings index 22b064bb2c..011f67f31a 100644 --- a/BizHawk.sln.DotSettings +++ b/BizHawk.sln.DotSettings @@ -188,6 +188,7 @@ True True True + True True True True