예제 #1
0
        public MExtKey GetExtEmulator(MappedKeyItem code)
        {
            // Get the "strongest" ExtKey, that is emulating current code
            var skey = code.ToString();

            if (!AllGates.ContainsKey(skey))
            {
                return(null);
            }

            return(AllGates[skey].OrderByDescending(x => x.OutValue).FirstOrDefault());
        }
예제 #2
0
        private bool LegacyEmu(MappedKeyItem code)
        {
            // Check if specified code is emulated by any vanilla MKey in machine
            bool legacyEmu = false;
            var  skey      = code.ToString();

            if (AllKeys.ContainsKey(skey))
            {
                legacyEmu = AllKeys[skey].Where(x => !(x is MExtKey) && x.isEmulator).Any(x => x.EmulationHeld(true));
            }
            return(legacyEmu);
        }
예제 #3
0
        public float IsAnyEmulating(MappedKeyItem code)
        {
            // If vanilla MKey emulates this code - return 1.0
            if (LegacyEmu(code))
            {
                return(1);
            }

            // If no MExtKey is mapped to this code - return 0.0
            var skey = code.ToString();

            if (!AllGates.ContainsKey(skey))
            {
                return(0);
            }

            // Get maximum value from MExtKeys, mapped to this code
            var res = AllGates[skey].Max(x => x.OutValue);

            return(res);
        }