From 25dddf5160cf7b027fd9c52273e64fd4fdd03362 Mon Sep 17 00:00:00 2001 From: adelikat Date: Mon, 15 Jun 2020 13:20:37 -0500 Subject: [PATCH] hack to fix Nyma roman numeral buttons, virtualpads - PCE and PCFX fixes --- .../tools/VirtualPads/schema/PceSchema.cs | 14 ++++--------- .../tools/VirtualPads/schema/PcfxSchema.cs | 20 ++++++------------- ...NymaCore.Controller.ButtonNameOverrides.cs | 10 +++++++++- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PceSchema.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PceSchema.cs index 44aa2f417a..3327a8207e 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PceSchema.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PceSchema.cs @@ -130,8 +130,8 @@ namespace BizHawk.Client.EmuHawk new ButtonSchema(140, 40, controller, "I"), new ButtonSchema(166, 30, controller, "II"), new ButtonSchema(192, 20, controller, "III"), - new ButtonSchema(77, 63, controller, "SELECT") { DisplayName = "s" }, - new ButtonSchema(101, 63, controller, "RUN") { DisplayName = "R" } + new ButtonSchema(77, 63, controller, "Select") { DisplayName = "s" }, + new ButtonSchema(101, 63, controller, "Run") { DisplayName = "R" } } }; } @@ -158,14 +158,8 @@ namespace BizHawk.Client.EmuHawk { DisplayName = "Right" }, - new ButtonSchema(275, 75, controller, "SELECT") - { - DisplayName = "Select" - }, - new ButtonSchema(275, 105, controller, "RUN") - { - DisplayName = "Run" - } + new ButtonSchema(275, 75, controller, "Select"), + new ButtonSchema(275, 105, controller, "Run") } }; } diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PcfxSchema.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PcfxSchema.cs index 1a653f5b10..fcf05d66a1 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PcfxSchema.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PcfxSchema.cs @@ -49,18 +49,18 @@ namespace BizHawk.Client.EmuHawk ButtonSchema.Down(14, 56, controller), ButtonSchema.Left(2, 34, controller), ButtonSchema.Right(24, 34, controller), - new ButtonSchema(72, 17, controller, "MODE 1: Set A") { DisplayName = "1A" }, - new ButtonSchema(72, 40, controller, "MODE 2: Set A") { DisplayName = "2A" }, - new ButtonSchema(102, 17, controller, "MODE 1: Set B") { DisplayName = "1B" }, - new ButtonSchema(102, 40, controller, "MODE 2: Set B") { DisplayName = "2B" }, + new ButtonSchema(72, 17, controller, "Mode 1: Set A") { DisplayName = "1A" }, + new ButtonSchema(72, 40, controller, "Mode 2: Set A") { DisplayName = "2A" }, + new ButtonSchema(102, 17, controller, "Mode 1: Set B") { DisplayName = "1B" }, + new ButtonSchema(102, 40, controller, "Mode 2: Set B") { DisplayName = "2B" }, new ButtonSchema(140, 63, controller, "IV"), new ButtonSchema(166, 53, controller, "V"), new ButtonSchema(192, 43, controller, "VI"), new ButtonSchema(140, 40, controller, "I"), new ButtonSchema(166, 30, controller, "II"), new ButtonSchema(192, 20, controller, "III"), - new ButtonSchema(77, 63, controller, "SELECT") { DisplayName = "s" }, - new ButtonSchema(101, 63, controller, "RUN") { DisplayName = "R" } + new ButtonSchema(77, 63, controller, "Select") { DisplayName = "s" }, + new ButtonSchema(101, 63, controller, "Run") { DisplayName = "R" } } }; } @@ -86,14 +86,6 @@ namespace BizHawk.Client.EmuHawk new ButtonSchema(275, 45, controller, "Right Button") { DisplayName = "Right" - }, - new ButtonSchema(275, 75, controller, "SELECT") - { - DisplayName = "Select" - }, - new ButtonSchema(275, 105, controller, "RUN") - { - DisplayName = "Run" } } }; diff --git a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Controller.ButtonNameOverrides.cs b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Controller.ButtonNameOverrides.cs index 26e2dbf9bd..4f2007c5f6 100644 --- a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Controller.ButtonNameOverrides.cs +++ b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Controller.ButtonNameOverrides.cs @@ -1,11 +1,15 @@ using System.Collections.Generic; using System.Globalization; +using System.Linq; using System.Text.RegularExpressions; namespace BizHawk.Emulation.Cores.Waterbox { partial class NymaCore { + private static bool IsRomanNumeral(string str) + => new[] {"I", "II", "III", "IV", "V", "VI"}.Contains(str); + /// /// Override button names. Technically this should be per core, but a lot of the names and overrides are the same, /// and an override that doesn't apply to a particular core will just be ignored @@ -14,7 +18,11 @@ namespace BizHawk.Emulation.Cores.Waterbox { original = Regex.Replace(original, @"\s*(↑|↓|←|→)\s*", ""); original = Regex.Replace(original, @"\s*\([^\)]+\)\s*", ""); - original = CultureInfo.InvariantCulture.TextInfo.ToTitleCase(original.ToLowerInvariant()); + if (!IsRomanNumeral(original)) + { + original = CultureInfo.InvariantCulture.TextInfo.ToTitleCase(original.ToLowerInvariant()); + } + // TODO: Add dictionaries or whatever here as needed return original; }