private void btnGamepad2_Click(object sender, EventArgs e) { PollKey pollKey; Keybinds newKeys = ((Keybinds)bindViewer.SelectedObject); pollKey = new PollKey(newKeys.Player2Up, "Up", inputMode); pollKey.ShowDialog(); newKeys.Player2Up = pollKey.newKey; pollKey = new PollKey(newKeys.Player2Down, "Down", inputMode); pollKey.ShowDialog(); newKeys.Player2Down = pollKey.newKey; pollKey = new PollKey(newKeys.Player2Left, "Left", inputMode); pollKey.ShowDialog(); newKeys.Player2Left = pollKey.newKey; pollKey = new PollKey(newKeys.Player2Right, "Right", inputMode); pollKey.ShowDialog(); newKeys.Player2Right = pollKey.newKey; pollKey = new PollKey(newKeys.Player2A, "A button", inputMode); pollKey.ShowDialog(); newKeys.Player2A = pollKey.newKey; pollKey = new PollKey(newKeys.Player2B, "B button", inputMode); pollKey.ShowDialog(); newKeys.Player2B = pollKey.newKey; pollKey = new PollKey(newKeys.Player2Select, "Select button", inputMode); pollKey.ShowDialog(); newKeys.Player2Select = pollKey.newKey; pollKey = new PollKey(newKeys.Player2Start, "Start button", inputMode); pollKey.ShowDialog(); newKeys.Player2Start = pollKey.newKey; bindViewer.SelectedObject = newKeys; }
public Keybind(Keybinds keys, ControllerType portOne, ControllerType portTwo, ControllerType expansion, bool fourScore, bool filterIllegalInput, string inputMode) { this.keys = keys; this.fourScore = fourScore; this.portOne = portOne; this.portTwo = portTwo; this.expansion = expansion; this.inputMode = inputMode; InitializeComponent(); chkFourScore.Checked = fourScore; chkFilter.Checked = filterIllegalInput; switch (portOne) { case ControllerType.Controller: cboPortOne.SelectedIndex = 0; break; case ControllerType.Zapper: cboPortOne.SelectedIndex = 1; break; case ControllerType.Paddle: cboPortOne.SelectedIndex = 2; break; default: case ControllerType.Empty: cboPortOne.SelectedIndex = 3; break; } switch (portTwo) { case ControllerType.Controller: cboPortTwo.SelectedIndex = 0; break; case ControllerType.Zapper: cboPortTwo.SelectedIndex = 1; break; case ControllerType.Paddle: cboPortTwo.SelectedIndex = 2; break; default: case ControllerType.Empty: cboPortTwo.SelectedIndex = 3; break; } switch (expansion) { case ControllerType.FamiPaddle: cboExpansion.SelectedIndex = 0; break; default: case ControllerType.Empty: cboExpansion.SelectedIndex = 1; break; } }
private void btnOk_Click(object sender, EventArgs e) { this.keys = (Keybinds)this.bindViewer.SelectedObject; this.DialogResult = DialogResult.OK; }
private void LoadKeys() { keyBindings = new Keybinds(); keyBindings.Player1Up = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player1Up"]); keyBindings.Player1Down = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player1Down"]); keyBindings.Player1Left = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player1Left"]); keyBindings.Player1Right = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player1Right"]); keyBindings.Player1Start = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player1Start"]); keyBindings.Player1Select = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player1Select"]); keyBindings.Player1A = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player1A"]); keyBindings.Player1B = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player1B"]); keyBindings.Player1TurboA = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player1TurboA"]); keyBindings.Player1TurboB = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player1TurboB"]); keyBindings.Player2Up = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player2Up"]); keyBindings.Player2Down = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player2Down"]); keyBindings.Player2Left = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player2Left"]); keyBindings.Player2Right = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player2Right"]); keyBindings.Player2Start = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player2Start"]); keyBindings.Player2Select = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player2Select"]); keyBindings.Player2A = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player2A"]); keyBindings.Player2B = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player2B"]); keyBindings.Player2TurboA = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player2TurboA"]); keyBindings.Player2TurboB = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["player2TurboB"]); keyBindings.LoadState = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["loadState"]); keyBindings.SaveState = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["saveState"]); keyBindings.Rewind = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["rewind"]); keyBindings.FastForward = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["fastForward"]); keyBindings.Pause = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["pause"]); keyBindings.Power = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["power"]); keyBindings.Reset = (EmuKeys)Enum.Parse(typeof(EmuKeys), this.config["restart"]); }
private void keyBindingsToolStripMenuItem_Click(object sender, EventArgs e) { SystemState old = state; state = SystemState.SystemPause; Keybind keyBindWindow = new Keybind(keyBindings, (ControllerType)Enum.Parse(typeof(ControllerType), config["portOne"]), (ControllerType)Enum.Parse(typeof(ControllerType), config["portTwo"]), (ControllerType)Enum.Parse(typeof(ControllerType), config["expansion"]), (config["fourScore"] == "1"), config["filterIllegalInput"] == "1", config["input"]); if (keyBindWindow.ShowDialog() == DialogResult.OK) { keyBindings = keyBindWindow.keys; config["portOne"] = keyBindWindow.portOne.ToString(); config["portTwo"] = keyBindWindow.portTwo.ToString(); config["expansion"] = keyBindWindow.expansion.ToString(); config["fourScore"] = keyBindWindow.fourScore ? "1" : "0"; config["filterIllegalInput"] = keyBindWindow.filterIllegalInput ? "1" : "0"; if (cpu != null) { cpu.SetControllers(keyBindWindow.portOne, keyBindWindow.portTwo, keyBindWindow.expansion, keyBindWindow.fourScore, keyBindWindow.filterIllegalInput); } } state = old; }