public static char Lookup(string button, string systemId) { var key = button.Replace("Key ", ""); if (key.StartsWith("P")) { if (key.Length > 2 && key[1] == '1' && key[2] >= '0' && key[2] <= '9') // Hack to support 10-20 controllers, TODO: regex this thing instead { key = key.Substring(4); } else if (key.Length > 1 && key[1] >= '0' && key[1] <= '9') { key = key.Substring(3); } } if (SystemOverrides.ContainsKey(systemId) && SystemOverrides[systemId].ContainsKey(key)) { return(SystemOverrides[systemId][key]); } if (BaseMnemonicLookupTable.ContainsKey(key)) { return(BaseMnemonicLookupTable[key]); } if (key.Length == 1) { return(key[0]); } return('!'); }
public char this[string button] { get { var key = button.Replace("Key ", ""); if (key.StartsWith("P") && key.Length > 1 && key[1] >= '0' && key[1] <= '9') { key = key.Substring(3); } if (SystemOverrides.ContainsKey(Global.Emulator.SystemId) && SystemOverrides[Global.Emulator.SystemId].ContainsKey(key)) { return(SystemOverrides[Global.Emulator.SystemId][key]); } if (BaseMnemonicLookupTable.ContainsKey(key)) { return(BaseMnemonicLookupTable[key]); } if (key.Length == 1) { return(key[0]); } return('!'); } }
public char this[string button] { get { var key = button .Replace("P1 ", "") .Replace("P2 ", "") .Replace("P3 ", "") .Replace("P4 ", "") .Replace("Key ", ""); if (SystemOverrides.ContainsKey(Global.Emulator.SystemId) && SystemOverrides[Global.Emulator.SystemId].ContainsKey(key)) { return(SystemOverrides[Global.Emulator.SystemId][key]); } if (BaseMnemonicLookupTable.ContainsKey(key)) { return(BaseMnemonicLookupTable[key]); } if (key.Length == 1) { return(key[0]); } return('!'); } }
public string this[string button] { get { var key = button .Replace("P1 ", string.Empty) .Replace("P2 ", string.Empty) .Replace("P3 ", string.Empty) .Replace("P4 ", string.Empty) .Replace("Key ", string.Empty); if (SystemOverrides.ContainsKey(Global.Emulator.SystemId) && SystemOverrides[Global.Emulator.SystemId].ContainsKey(key)) { return(SystemOverrides[Global.Emulator.SystemId][key]); } if (BaseMnemonicLookupTable.ContainsKey(key)) { return(BaseMnemonicLookupTable[key]); } return(button); } }