コード例 #1
0
        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('!');
        }
コード例 #2
0
        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('!');
            }
        }
コード例 #3
0
ファイル: Bk2MnemonicLookup.cs プロジェクト: gocha/BizHawk
        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.TryGetValue(systemId, out var overridesForSys) && overridesForSys.TryGetValue(key, out var c))
            {
                return(c);
            }

            if (BaseMnemonicLookupTable.TryGetValue(key, out var c1))
            {
                return(c1);
            }

            if (key.Length == 1)
            {
                return(key[0]);
            }

            return('!');
        }
コード例 #4
0
        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('!');
            }
        }
コード例 #5
0
        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);
            }
        }