Bk2MnemonicConstants - pass in system id

This commit is contained in:
adelikat 2020-04-14 18:12:07 -05:00
parent c325286169
commit 27605f4828
4 changed files with 10 additions and 10 deletions

View File

@ -4,7 +4,7 @@ namespace BizHawk.Client.Common
{ {
internal static class Bk2AxisMnemonicConstants internal static class Bk2AxisMnemonicConstants
{ {
public static string Lookup(string button) public static string Lookup(string button, string systemId)
{ {
var key = button var key = button
.Replace("P1 ", "") .Replace("P1 ", "")
@ -13,9 +13,9 @@ namespace BizHawk.Client.Common
.Replace("P4 ", "") .Replace("P4 ", "")
.Replace("Key ", ""); .Replace("Key ", "");
if (SystemOverrides.ContainsKey(Global.Emulator.SystemId) && SystemOverrides[Global.Emulator.SystemId].ContainsKey(key)) if (SystemOverrides.ContainsKey(systemId) && SystemOverrides[systemId].ContainsKey(key))
{ {
return SystemOverrides[Global.Emulator.SystemId][key]; return SystemOverrides[systemId][key];
} }
if (BaseMnemonicLookupTable.ContainsKey(key)) if (BaseMnemonicLookupTable.ContainsKey(key))

View File

@ -56,11 +56,11 @@ namespace BizHawk.Client.Common
{ {
if (_source.Definition.BoolButtons.Contains(button)) if (_source.Definition.BoolButtons.Contains(button))
{ {
dict.Add(button, Bk2MnemonicConstants.Lookup(button).ToString()); dict.Add(button, Bk2MnemonicConstants.Lookup(button, Global.Emulator.SystemId).ToString());
} }
else if (_source.Definition.AxisControls.Contains(button)) else if (_source.Definition.AxisControls.Contains(button))
{ {
dict.Add(button, Bk2AxisMnemonicConstants.Lookup(button)); dict.Add(button, Bk2AxisMnemonicConstants.Lookup(button, Global.Emulator.SystemId));
} }
} }
} }
@ -115,7 +115,7 @@ namespace BizHawk.Client.Common
} }
else else
{ {
sb.Append(_source.IsPressed(button) ? Bk2MnemonicConstants.Lookup(button) : forInputDisplay ? ' ' : '.'); sb.Append(_source.IsPressed(button) ? Bk2MnemonicConstants.Lookup(button, Global.Emulator.SystemId) : forInputDisplay ? ' ' : '.');
} }
} }
} }

View File

@ -5,7 +5,7 @@ namespace BizHawk.Client.Common
{ {
internal static class Bk2MnemonicConstants internal static class Bk2MnemonicConstants
{ {
public static char Lookup(string button) public static char Lookup(string button, string systemId)
{ {
var key = button.Replace("Key ", ""); var key = button.Replace("Key ", "");
if (key.StartsWith("P")) if (key.StartsWith("P"))
@ -21,9 +21,9 @@ namespace BizHawk.Client.Common
} }
if (SystemOverrides.ContainsKey(Global.Emulator.SystemId) && SystemOverrides[Global.Emulator.SystemId].ContainsKey(key)) if (SystemOverrides.ContainsKey(systemId) && SystemOverrides[systemId].ContainsKey(key))
{ {
return SystemOverrides[Global.Emulator.SystemId][key]; return SystemOverrides[systemId][key];
} }
if (BaseMnemonicLookupTable.ContainsKey(key)) if (BaseMnemonicLookupTable.ContainsKey(key))

View File

@ -97,7 +97,7 @@ namespace BizHawk.Client.Common
if (adapter.Definition.BoolButtons.Contains(buttonName)) if (adapter.Definition.BoolButtons.Contains(buttonName))
{ {
return adapter.IsPressed(buttonName) return adapter.IsPressed(buttonName)
? Bk2MnemonicConstants.Lookup(buttonName).ToString() ? Bk2MnemonicConstants.Lookup(buttonName, Global.Emulator.SystemId).ToString()
: ""; : "";
} }