From 16b86e70e79c374e76a5c0925c1cb65e03478cc9 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Thu, 12 Jul 2012 21:39:11 +0000 Subject: [PATCH] Increase/Decrease Speed hotkeys --- BizHawk.MultiClient/Config.cs | 2 + BizHawk.MultiClient/MainForm.cs | 47 ++++++++++++- .../config/HotkeyWindow.Designer.cs | 66 ++++++++++++++++--- BizHawk.MultiClient/config/HotkeyWindow.cs | 4 ++ 4 files changed, 108 insertions(+), 11 deletions(-) diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index fbd6d18909..c4487f8d46 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -410,6 +410,8 @@ namespace BizHawk.MultiClient public bool TI83ToolTips = true; // Client Hotkey Bindings + public string IncreaseSpeedBinding = "Equals"; + public string DecreaseSpeedBinding = "Minus"; public string HardResetBinding = "Ctrl+R"; public string FastForwardBinding = "Tab, J1 B6"; public string RewindBinding = "Shift+R, J1 B5"; diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 5967fdc9c1..ff42184505 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -507,7 +507,7 @@ namespace BizHawk.MultiClient "LoadSlot7","LoadSlot8","LoadSlot9", "ToolBox", "Previous Slot", "Next Slot", "Ram Watch", "Ram Search", "Ram Poke", "Hex Editor", "Lua Console", "Cheats", "Open ROM", "Close ROM", "Display FPS", "Display FrameCounter", "Display LagCounter", "Display Input", "Toggle Read Only", "Play Movie", "Record Movie", "Stop Movie", "Play Beginning", "Volume Up", "Volume Down", "Toggle MultiTrack", "Record All", "Record None", "Increment Player", - "Soft Reset", "Decrement Player", "Record AVI", "Stop AVI", "Toggle Menu"} + "Soft Reset", "Decrement Player", "Record AVI", "Stop AVI", "Toggle Menu", "Increase Speed", "Decrease Speed"} }; private void InitControls() @@ -520,6 +520,8 @@ namespace BizHawk.MultiClient controls.BindMulti("Hard Reset", Global.Config.HardResetBinding); controls.BindMulti("Emulator Pause", Global.Config.EmulatorPauseBinding); controls.BindMulti("Frame Advance", Global.Config.FrameAdvanceBinding); + controls.BindMulti("Increase Speed", Global.Config.IncreaseSpeedBinding); + controls.BindMulti("Decrease Speed", Global.Config.DecreaseSpeedBinding); controls.BindMulti("Unthrottle", Global.Config.TurboBinding); controls.BindMulti("Screenshot", Global.Config.ScreenshotBinding); controls.BindMulti("Toggle Fullscreen", Global.Config.ToggleFullscreenBinding); @@ -1586,7 +1588,12 @@ namespace BizHawk.MultiClient case "ToolBox": LoadToolBox(); break; - + case "Increase Speed": + IncreaseSpeed(); + break; + case "Decrease Speed": + DecreaseSpeed(); + break; case "Quick Save State": if (!IsNullEmulator()) SaveState("QuickSave" + Global.Config.SaveSlot.ToString()); @@ -3184,5 +3191,41 @@ namespace BizHawk.MultiClient { Global.Config.SupressAskSave ^= true; } + + private void IncreaseSpeed() + { + int oldp = Global.Config.SpeedPercent; + int newp = 0; + if (oldp < 3) newp = 3; + else if (oldp < 6) newp = 6; + else if (oldp < 12) newp = 12; + else if (oldp < 25) newp = 25; + else if (oldp < 50) newp = 50; + else if (oldp < 75) newp = 75; + else if (oldp < 100) newp = 100; + else if (oldp < 150) newp = 150; + else if (oldp < 200) newp = 200; + else if (oldp < 400) newp = 400; + else if (oldp < 800) newp = 800; + else newp = 1000; + SetSpeedPercent(newp); + } + + private void DecreaseSpeed() + { + int oldp = Global.Config.SpeedPercent; + int newp = 0; + if (oldp > 800) newp = 800; + else if (oldp > 400) newp = 400; + else if (oldp > 200) newp = 200; + else if (oldp > 100) newp = 100; + else if (oldp > 50) newp = 50; + else if (oldp > 25) newp = 25; + else if (oldp > 12) newp = 12; + else if (oldp > 6) newp = 6; + else if (oldp > 3) newp = 3; + else newp = 1; + SetSpeedPercent(newp); + } } } diff --git a/BizHawk.MultiClient/config/HotkeyWindow.Designer.cs b/BizHawk.MultiClient/config/HotkeyWindow.Designer.cs index 9755bbc27a..28b58131b2 100644 --- a/BizHawk.MultiClient/config/HotkeyWindow.Designer.cs +++ b/BizHawk.MultiClient/config/HotkeyWindow.Designer.cs @@ -191,6 +191,10 @@ this.IDB_CANCEL = new System.Windows.Forms.Button(); this.label38 = new System.Windows.Forms.Label(); this.AutoTabCheckBox = new System.Windows.Forms.CheckBox(); + this.IDW_IncSpeed = new BizHawk.MultiClient.InputWidget(); + this.label78 = new System.Windows.Forms.Label(); + this.IDW_DecSpeed = new BizHawk.MultiClient.InputWidget(); + this.label79 = new System.Windows.Forms.Label(); this.hotkeyTabs.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); @@ -215,6 +219,10 @@ // // tabPage1 // + this.tabPage1.Controls.Add(this.label79); + this.tabPage1.Controls.Add(this.IDW_DecSpeed); + this.tabPage1.Controls.Add(this.label78); + this.tabPage1.Controls.Add(this.IDW_IncSpeed); this.tabPage1.Controls.Add(this.label76); this.tabPage1.Controls.Add(this.label75); this.tabPage1.Controls.Add(this.label74); @@ -536,7 +544,7 @@ // this.IDW_RESET.AcceptsTab = true; this.IDW_RESET.BackColor = System.Drawing.SystemColors.Window; - this.IDW_RESET.Location = new System.Drawing.Point(92, 130); + this.IDW_RESET.Location = new System.Drawing.Point(93, 130); this.IDW_RESET.Name = "IDW_RESET"; this.IDW_RESET.Size = new System.Drawing.Size(100, 20); this.IDW_RESET.TabIndex = 25; @@ -545,7 +553,7 @@ // this.IDW_UNTHROTTLE.AcceptsTab = true; this.IDW_UNTHROTTLE.BackColor = System.Drawing.SystemColors.Window; - this.IDW_UNTHROTTLE.Location = new System.Drawing.Point(92, 106); + this.IDW_UNTHROTTLE.Location = new System.Drawing.Point(93, 106); this.IDW_UNTHROTTLE.Name = "IDW_UNTHROTTLE"; this.IDW_UNTHROTTLE.Size = new System.Drawing.Size(100, 20); this.IDW_UNTHROTTLE.TabIndex = 20; @@ -626,7 +634,7 @@ // this.IDW_FRAMEADVANCE.AcceptsTab = true; this.IDW_FRAMEADVANCE.BackColor = System.Drawing.SystemColors.Window; - this.IDW_FRAMEADVANCE.Location = new System.Drawing.Point(92, 10); + this.IDW_FRAMEADVANCE.Location = new System.Drawing.Point(93, 10); this.IDW_FRAMEADVANCE.Name = "IDW_FRAMEADVANCE"; this.IDW_FRAMEADVANCE.Size = new System.Drawing.Size(100, 20); this.IDW_FRAMEADVANCE.TabIndex = 1; @@ -653,7 +661,7 @@ // this.IDW_REWIND.AcceptsTab = true; this.IDW_REWIND.BackColor = System.Drawing.SystemColors.Window; - this.IDW_REWIND.Location = new System.Drawing.Point(92, 34); + this.IDW_REWIND.Location = new System.Drawing.Point(93, 34); this.IDW_REWIND.Name = "IDW_REWIND"; this.IDW_REWIND.Size = new System.Drawing.Size(100, 20); this.IDW_REWIND.TabIndex = 5; @@ -662,7 +670,7 @@ // this.IDW_FASTFORWARD.AcceptsTab = true; this.IDW_FASTFORWARD.BackColor = System.Drawing.SystemColors.Window; - this.IDW_FASTFORWARD.Location = new System.Drawing.Point(92, 82); + this.IDW_FASTFORWARD.Location = new System.Drawing.Point(93, 82); this.IDW_FASTFORWARD.Name = "IDW_FASTFORWARD"; this.IDW_FASTFORWARD.Size = new System.Drawing.Size(100, 20); this.IDW_FASTFORWARD.TabIndex = 15; @@ -671,7 +679,7 @@ // this.IDW_HARDRESET.AcceptsTab = true; this.IDW_HARDRESET.BackColor = System.Drawing.SystemColors.Window; - this.IDW_HARDRESET.Location = new System.Drawing.Point(92, 154); + this.IDW_HARDRESET.Location = new System.Drawing.Point(93, 154); this.IDW_HARDRESET.Name = "IDW_HARDRESET"; this.IDW_HARDRESET.Size = new System.Drawing.Size(100, 20); this.IDW_HARDRESET.TabIndex = 30; @@ -680,7 +688,7 @@ // this.IDW_PAUSE.AcceptsTab = true; this.IDW_PAUSE.BackColor = System.Drawing.SystemColors.Window; - this.IDW_PAUSE.Location = new System.Drawing.Point(92, 58); + this.IDW_PAUSE.Location = new System.Drawing.Point(93, 58); this.IDW_PAUSE.Name = "IDW_PAUSE"; this.IDW_PAUSE.Size = new System.Drawing.Size(100, 20); this.IDW_PAUSE.TabIndex = 10; @@ -689,7 +697,7 @@ // this.IDW_QuickLoad.AcceptsTab = true; this.IDW_QuickLoad.BackColor = System.Drawing.SystemColors.Window; - this.IDW_QuickLoad.Location = new System.Drawing.Point(92, 178); + this.IDW_QuickLoad.Location = new System.Drawing.Point(93, 178); this.IDW_QuickLoad.Name = "IDW_QuickLoad"; this.IDW_QuickLoad.Size = new System.Drawing.Size(100, 20); this.IDW_QuickLoad.TabIndex = 35; @@ -698,7 +706,7 @@ // this.IDW_QuickSave.AcceptsTab = true; this.IDW_QuickSave.BackColor = System.Drawing.SystemColors.Window; - this.IDW_QuickSave.Location = new System.Drawing.Point(92, 202); + this.IDW_QuickSave.Location = new System.Drawing.Point(93, 202); this.IDW_QuickSave.Name = "IDW_QuickSave"; this.IDW_QuickSave.Size = new System.Drawing.Size(100, 20); this.IDW_QuickSave.TabIndex = 40; @@ -1752,6 +1760,42 @@ this.AutoTabCheckBox.UseVisualStyleBackColor = true; this.AutoTabCheckBox.CheckedChanged += new System.EventHandler(this.AutoTabCheckBox_CheckedChanged); // + // IDW_IncSpeed + // + this.IDW_IncSpeed.AcceptsTab = true; + this.IDW_IncSpeed.BackColor = System.Drawing.SystemColors.Window; + this.IDW_IncSpeed.Location = new System.Drawing.Point(93, 226); + this.IDW_IncSpeed.Name = "IDW_IncSpeed"; + this.IDW_IncSpeed.Size = new System.Drawing.Size(100, 20); + this.IDW_IncSpeed.TabIndex = 104; + // + // label78 + // + this.label78.AutoSize = true; + this.label78.Location = new System.Drawing.Point(6, 229); + this.label78.Name = "label78"; + this.label78.Size = new System.Drawing.Size(82, 13); + this.label78.TabIndex = 105; + this.label78.Text = "Increase Speed"; + // + // IDW_DecSpeed + // + this.IDW_DecSpeed.AcceptsTab = true; + this.IDW_DecSpeed.BackColor = System.Drawing.SystemColors.Window; + this.IDW_DecSpeed.Location = new System.Drawing.Point(93, 250); + this.IDW_DecSpeed.Name = "IDW_DecSpeed"; + this.IDW_DecSpeed.Size = new System.Drawing.Size(100, 20); + this.IDW_DecSpeed.TabIndex = 106; + // + // label79 + // + this.label79.AutoSize = true; + this.label79.Location = new System.Drawing.Point(6, 253); + this.label79.Name = "label79"; + this.label79.Size = new System.Drawing.Size(87, 13); + this.label79.TabIndex = 107; + this.label79.Text = "Decrease Speed"; + // // HotkeyWindow // this.AcceptButton = this.IDB_SAVE; @@ -1949,5 +1993,9 @@ private InputWidget IDW_IncreaseWindowSize; private System.Windows.Forms.Label label77; private InputWidget IDW_TASTudio; + private System.Windows.Forms.Label label79; + private InputWidget IDW_DecSpeed; + private System.Windows.Forms.Label label78; + private InputWidget IDW_IncSpeed; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/config/HotkeyWindow.cs b/BizHawk.MultiClient/config/HotkeyWindow.cs index 3f38118f77..e597b9347a 100644 --- a/BizHawk.MultiClient/config/HotkeyWindow.cs +++ b/BizHawk.MultiClient/config/HotkeyWindow.cs @@ -95,6 +95,8 @@ namespace BizHawk.MultiClient.tools IDW_ToggleMenu.SetBindings(Global.Config.ToggleMenuBinding); IDW_IncreaseWindowSize.SetBindings(Global.Config.IncreaseWindowSize); IDW_DecreaseWindowSize.SetBindings(Global.Config.DecreaseWindowSize); + IDW_IncSpeed.SetBindings(Global.Config.IncreaseSpeedBinding); + IDW_DecSpeed.SetBindings(Global.Config.DecreaseSpeedBinding); } private void button2_Click(object sender, EventArgs e) { @@ -198,6 +200,8 @@ namespace BizHawk.MultiClient.tools Global.Config.IncreaseWindowSize = IDW_IncreaseWindowSize.Text; Global.Config.DecreaseWindowSize = IDW_DecreaseWindowSize.Text; + Global.Config.IncreaseSpeedBinding = IDW_IncSpeed.Text; + Global.Config.DecreaseSpeedBinding = IDW_DecSpeed.Text; this.DialogResult = DialogResult.OK; this.Close();