conslidate Bk2MnemonicConstants and Bk2AxisMnemonicConstants, rename to just Bk2MnemonicLookup
This commit is contained in:
parent
f3534b99b9
commit
2f750e8469
BizHawk.Client.Common/movie/bk2
|
@ -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<string, string> BaseMnemonicLookupTable = new Dictionary<string, string>
|
||||
{
|
||||
["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<string, Dictionary<string, string>> SystemOverrides = new Dictionary<string, Dictionary<string, string>>
|
||||
{
|
||||
["A78"] = new Dictionary<string, string>
|
||||
{
|
||||
["VPos"] = "X",
|
||||
["HPos"] = "Y"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<string, char> BaseMnemonicLookupTable = new Dictionary<string, char>
|
||||
{
|
||||
["Power"] = 'P',
|
||||
|
@ -482,5 +505,33 @@ namespace BizHawk.Client.Common
|
|||
["Lightgun Y"] = 'Y',
|
||||
}
|
||||
};
|
||||
|
||||
private static readonly Dictionary<string, string> BaseAxisLookupTable = new Dictionary<string, string>
|
||||
{
|
||||
["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<string, Dictionary<string, string>> AxisSystemOverrides = new Dictionary<string, Dictionary<string, string>>
|
||||
{
|
||||
["A78"] = new Dictionary<string, string>
|
||||
{
|
||||
["VPos"] = "X",
|
||||
["HPos"] = "Y"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue