Example #1
0
        public void InitializeDefaultShortcuts()
        {
            if (ShortcutKeys1 != null && ShortcutKeys2 != null)
            {
                return;
            }

            ShortcutKeys1 = new List <ShortcutKeyInfo>();
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.FastForward, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Tab")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Rewind, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Backspace")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.IncreaseSpeed, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("=")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.DecreaseSpeed, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("-")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.MaxSpeed, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F9")
            }));

            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.ToggleFps, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F10")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.ToggleFullscreen, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F11")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.TakeScreenshot, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F12")
            }));

            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Reset, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Ctrl"), Key2 = InputApi.GetKeyCode("R")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.PowerCycle, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Ctrl"), Key2 = InputApi.GetKeyCode("T")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Pause, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Esc")
            }));

            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale1x, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("1")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale2x, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("2")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale3x, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("3")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale4x, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("4")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale5x, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("5")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SetScale6x, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Alt"), Key2 = InputApi.GetKeyCode("6")
            }));

            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.OpenFile, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Ctrl"), Key2 = InputApi.GetKeyCode("O")
            }));

            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot1, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F1")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot2, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F2")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot3, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F3")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot4, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F4")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot5, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F5")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot6, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F6")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateSlot7, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Shift"), Key2 = InputApi.GetKeyCode("F7")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SaveStateToFile, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Ctrl"), Key2 = InputApi.GetKeyCode("S")
            }));

            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot1, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F1")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot2, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F2")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot3, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F3")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot4, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F4")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot5, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F5")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot6, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F6")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlot7, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F7")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateSlotAuto, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("F8")
            }));
            ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadStateFromFile, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Ctrl"), Key2 = InputApi.GetKeyCode("L")
            }));

            ShortcutKeys2 = new List <ShortcutKeyInfo>();
            ShortcutKeys2.Add(new ShortcutKeyInfo(EmulatorShortcut.FastForward, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Pad1 R2")
            }));
            ShortcutKeys2.Add(new ShortcutKeyInfo(EmulatorShortcut.Rewind, new KeyCombination()
            {
                Key1 = InputApi.GetKeyCode("Pad1 L2")
            }));
        }
Example #2
0
        public KeyPresets()
        {
            _wasdLayout = new KeyMapping()
            {
                A      = InputApi.GetKeyCode("K"),
                B      = InputApi.GetKeyCode("J"),
                X      = InputApi.GetKeyCode(","),
                Y      = InputApi.GetKeyCode("M"),
                Select = InputApi.GetKeyCode("O"),
                Start  = InputApi.GetKeyCode("L"),
                L      = InputApi.GetKeyCode("U"),
                R      = InputApi.GetKeyCode("I"),
                Up     = InputApi.GetKeyCode("W"),
                Down   = InputApi.GetKeyCode("S"),
                Left   = InputApi.GetKeyCode("A"),
                Right  = InputApi.GetKeyCode("D")
            };

            _arrowLayout = new KeyMapping()
            {
                A      = InputApi.GetKeyCode("S"),
                B      = InputApi.GetKeyCode("A"),
                X      = InputApi.GetKeyCode("X"),
                Y      = InputApi.GetKeyCode("Z"),
                Select = InputApi.GetKeyCode("E"),
                Start  = InputApi.GetKeyCode("D"),
                L      = InputApi.GetKeyCode("Q"),
                R      = InputApi.GetKeyCode("W"),
                Up     = InputApi.GetKeyCode("Up Arrow"),
                Down   = InputApi.GetKeyCode("Down Arrow"),
                Left   = InputApi.GetKeyCode("Left Arrow"),
                Right  = InputApi.GetKeyCode("Right Arrow")
            };

            if (Program.IsMono)
            {
                //TODO test and update for Mono
                for (int i = 0; i < 2; i++)
                {
                    string prefix = "Pad" + (i + 1).ToString() + " ";
                    _xboxLayouts[i] = new KeyMapping()
                    {
                        A      = InputApi.GetKeyCode(prefix + "A"),
                        B      = InputApi.GetKeyCode(prefix + "X"),
                        X      = InputApi.GetKeyCode(prefix + "B"),
                        Y      = InputApi.GetKeyCode(prefix + "Y"),
                        Select = InputApi.GetKeyCode(prefix + "Select"),
                        Start  = InputApi.GetKeyCode(prefix + "Start"),
                        Up     = InputApi.GetKeyCode(prefix + "Up"),
                        Down   = InputApi.GetKeyCode(prefix + "Down"),
                        Left   = InputApi.GetKeyCode(prefix + "Left"),
                        Right  = InputApi.GetKeyCode(prefix + "Right")
                    };

                    _ps4Layouts[i] = new KeyMapping()
                    {
                        A      = InputApi.GetKeyCode(prefix + "B"),
                        B      = InputApi.GetKeyCode(prefix + "A"),
                        X      = InputApi.GetKeyCode(prefix + "C"),
                        Y      = InputApi.GetKeyCode(prefix + "X"),
                        Select = InputApi.GetKeyCode(prefix + "L2"),
                        Start  = InputApi.GetKeyCode(prefix + "R2"),
                        Up     = InputApi.GetKeyCode(prefix + "Up"),
                        Down   = InputApi.GetKeyCode(prefix + "Down"),
                        Left   = InputApi.GetKeyCode(prefix + "Left"),
                        Right  = InputApi.GetKeyCode(prefix + "Right")
                    };

                    _snes30Layouts[i] = new KeyMapping()
                    {
                        A      = InputApi.GetKeyCode(prefix + "Thumb"),
                        B      = InputApi.GetKeyCode(prefix + "Top2"),
                        X      = InputApi.GetKeyCode(prefix + "Trigger"),
                        Y      = InputApi.GetKeyCode(prefix + "Top"),
                        Select = InputApi.GetKeyCode(prefix + "Base5"),
                        Start  = InputApi.GetKeyCode(prefix + "Base6"),
                        Up     = InputApi.GetKeyCode(prefix + "Y-"),
                        Down   = InputApi.GetKeyCode(prefix + "Y+"),
                        Left   = InputApi.GetKeyCode(prefix + "X-"),
                        Right  = InputApi.GetKeyCode(prefix + "X+")
                    };
                }
            }
            else
            {
                for (int i = 0; i < 2; i++)
                {
                    string prefix = "Pad" + (i + 1).ToString() + " ";
                    _xboxLayouts[i] = new KeyMapping()
                    {
                        A      = InputApi.GetKeyCode(prefix + "B"),
                        B      = InputApi.GetKeyCode(prefix + "A"),
                        X      = InputApi.GetKeyCode(prefix + "Y"),
                        Y      = InputApi.GetKeyCode(prefix + "X"),
                        Select = InputApi.GetKeyCode(prefix + "Back"),
                        Start  = InputApi.GetKeyCode(prefix + "Start"),
                        L      = InputApi.GetKeyCode(prefix + "L1"),
                        R      = InputApi.GetKeyCode(prefix + "R1"),
                        Up     = InputApi.GetKeyCode(prefix + "Up"),
                        Down   = InputApi.GetKeyCode(prefix + "Down"),
                        Left   = InputApi.GetKeyCode(prefix + "Left"),
                        Right  = InputApi.GetKeyCode(prefix + "Right")
                    };

                    prefix         = "Joy" + (i + 1).ToString() + " ";
                    _ps4Layouts[i] = new KeyMapping()
                    {
                        A      = InputApi.GetKeyCode(prefix + "But3"),
                        B      = InputApi.GetKeyCode(prefix + "But2"),
                        X      = InputApi.GetKeyCode(prefix + "But4"),
                        Y      = InputApi.GetKeyCode(prefix + "But1"),
                        Select = InputApi.GetKeyCode(prefix + "But9"),
                        Start  = InputApi.GetKeyCode(prefix + "But10"),
                        L      = InputApi.GetKeyCode(prefix + "But5"),
                        R      = InputApi.GetKeyCode(prefix + "But6"),
                        Up     = InputApi.GetKeyCode(prefix + "DPad Up"),
                        Down   = InputApi.GetKeyCode(prefix + "DPad Down"),
                        Left   = InputApi.GetKeyCode(prefix + "DPad Left"),
                        Right  = InputApi.GetKeyCode(prefix + "DPad Right")
                    };

                    _snes30Layouts[i] = new KeyMapping()
                    {
                        A      = InputApi.GetKeyCode(prefix + "But1"),
                        B      = InputApi.GetKeyCode(prefix + "But2"),
                        X      = InputApi.GetKeyCode(prefix + "But4"),
                        Y      = InputApi.GetKeyCode(prefix + "But5"),
                        Select = InputApi.GetKeyCode(prefix + "But11"),
                        Start  = InputApi.GetKeyCode(prefix + "But12"),
                        L      = InputApi.GetKeyCode(prefix + "But7"),
                        R      = InputApi.GetKeyCode(prefix + "But8"),
                        Up     = InputApi.GetKeyCode(prefix + "Y+"),
                        Down   = InputApi.GetKeyCode(prefix + "Y-"),
                        Left   = InputApi.GetKeyCode(prefix + "X-"),
                        Right  = InputApi.GetKeyCode(prefix + "X+")
                    };
                }
            }
        }