diff --git a/BizHawk.Client.Common/movie/bk2/Bk2AxisMnemonicConstants.cs b/BizHawk.Client.Common/movie/bk2/Bk2AxisMnemonicConstants.cs deleted file mode 100644 index 98f2d8aa6a..0000000000 --- a/BizHawk.Client.Common/movie/bk2/Bk2AxisMnemonicConstants.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Collections.Generic; - -namespace BizHawk.Client.Common -{ - internal static class Bk2AxisMnemonicConstants - { - public static string Lookup(string button, string systemId) - { - var key = button - .Replace("P1 ", "") - .Replace("P2 ", "") - .Replace("P3 ", "") - .Replace("P4 ", "") - .Replace("Key ", ""); - - if (SystemOverrides.ContainsKey(systemId) && SystemOverrides[systemId].ContainsKey(key)) - { - return SystemOverrides[systemId][key]; - } - - if (BaseMnemonicLookupTable.ContainsKey(key)) - { - return BaseMnemonicLookupTable[key]; - } - - return button; - } - - private static readonly Dictionary BaseMnemonicLookupTable = new Dictionary - { - ["Zapper X"] = "zapX", - ["Zapper Y"] = "zapY", - ["Paddle"] = "Pad", - ["Pen"] = "Pen", - ["Mouse X"] = "mX", - ["Mouse Y"] = "mY", - ["Lightgun X"] = "lX", - ["Lightgun Y"] = "lY", - ["X Axis"] = "aX", - ["Y Axis"] = "aY", - ["LStick X"] = "lsX", - ["LStick Y"] = "lsY", - ["RStick X"] = "rsX", - ["RStick Y"] = "rsY", - ["Disc Select"] = "Disc" - }; - - private static readonly Dictionary> SystemOverrides = new Dictionary> - { - ["A78"] = new Dictionary - { - ["VPos"] = "X", - ["HPos"] = "Y" - } - }; - } -} diff --git a/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs b/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs index b625e936dc..f4ac3ade59 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs @@ -60,7 +60,7 @@ namespace BizHawk.Client.Common } else if (_source.Definition.AxisControls.Contains(button)) { - dict.Add(button, Bk2AxisMnemonicConstants.Lookup(button, Global.Emulator.SystemId)); + dict.Add(button, Bk2MnemonicConstants.LookupAxis(button, Global.Emulator.SystemId)); } } } diff --git a/BizHawk.Client.Common/movie/bk2/Bk2MnemonicConstants.cs b/BizHawk.Client.Common/movie/bk2/Bk2MnemonicConstants.cs index 2f8fb44beb..4152d416d4 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2MnemonicConstants.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2MnemonicConstants.cs @@ -3,7 +3,7 @@ // ReSharper disable StyleCop.SA1509 namespace BizHawk.Client.Common { - internal static class Bk2MnemonicConstants + internal static class Bk2MnemonicLookup { public static char Lookup(string button, string systemId) { @@ -39,6 +39,29 @@ namespace BizHawk.Client.Common return '!'; } + public static string LookupAxis(string button, string systemId) + { + var key = button + .Replace("P1 ", "") + .Replace("P2 ", "") + .Replace("P3 ", "") + .Replace("P4 ", "") + .Replace("Key ", ""); + + if (AxisSystemOverrides.ContainsKey(systemId) && AxisSystemOverrides[systemId].ContainsKey(key)) + { + return AxisSystemOverrides[systemId][key]; + } + + if (BaseAxisLookupTable.ContainsKey(key)) + { + return BaseAxisLookupTable[key]; + } + + return button; + } + + private static readonly Dictionary BaseMnemonicLookupTable = new Dictionary { ["Power"] = 'P', @@ -482,5 +505,33 @@ namespace BizHawk.Client.Common ["Lightgun Y"] = 'Y', } }; + + private static readonly Dictionary BaseAxisLookupTable = new Dictionary + { + ["Zapper X"] = "zapX", + ["Zapper Y"] = "zapY", + ["Paddle"] = "Pad", + ["Pen"] = "Pen", + ["Mouse X"] = "mX", + ["Mouse Y"] = "mY", + ["Lightgun X"] = "lX", + ["Lightgun Y"] = "lY", + ["X Axis"] = "aX", + ["Y Axis"] = "aY", + ["LStick X"] = "lsX", + ["LStick Y"] = "lsY", + ["RStick X"] = "rsX", + ["RStick Y"] = "rsY", + ["Disc Select"] = "Disc" + }; + + private static readonly Dictionary> AxisSystemOverrides = new Dictionary> + { + ["A78"] = new Dictionary + { + ["VPos"] = "X", + ["HPos"] = "Y" + } + }; } }