diff --git a/BizHawk.Client.Common/config/Binding.cs b/BizHawk.Client.Common/config/Binding.cs index fd2a147973..0d506633c5 100644 --- a/BizHawk.Client.Common/config/Binding.cs +++ b/BizHawk.Client.Common/config/Binding.cs @@ -64,6 +64,13 @@ namespace BizHawk.Client.Common } } + private static Binding Bind(string tabGroup, string displayName, string bindings = "", string defaultBinding = "", string toolTip = "") + { + if (string.IsNullOrEmpty(defaultBinding)) + defaultBinding = bindings; + return new Binding { DisplayName = displayName, Bindings = bindings, TabGroup = tabGroup, DefaultBinding = defaultBinding, ToolTip = toolTip }; + } + public void ResolveWithDefaults() { //TODO - this method is potentially disastrously O(N^2) slow due to linear search nested in loop @@ -107,135 +114,131 @@ namespace BizHawk.Client.Common if (s_DefaultValues == null) { s_DefaultValues = new List - { - //General - new Binding { DisplayName = "Frame Advance", Bindings = "F", TabGroup = "General", DefaultBinding = "F" }, - new Binding { DisplayName = "Rewind", Bindings = "Shift+R, J1 B7, X1 LeftTrigger", TabGroup = "General", DefaultBinding = "Shift+R, J1 B7, X1 Left Trigger" }, - new Binding { DisplayName = "Pause", Bindings = "Pause", TabGroup = "General", DefaultBinding = "Pause" }, - new Binding { DisplayName = "Fast Forward", Bindings = "Tab, J1 B8, X1 RightTrigger", TabGroup = "General", DefaultBinding = "Tab, J1 B8, X1 Right Trigger" }, - new Binding { DisplayName = "Turbo", Bindings = "Shift+Tab", TabGroup = "General", DefaultBinding = "Shift+Tab" }, - new Binding { DisplayName = "Toggle Throttle", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Soft Reset", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Hard Reset", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Quick Load", Bindings = "P", TabGroup = "General", DefaultBinding = "P" }, - new Binding { DisplayName = "Quick Save", Bindings = "I", TabGroup = "General", DefaultBinding = "I" }, - new Binding { DisplayName = "Autohold", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Clear Autohold", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Screenshot", Bindings = "F12", TabGroup = "General", DefaultBinding = "F12" }, - new Binding { DisplayName = "Full Screen", Bindings = "Alt+Return", TabGroup = "General", DefaultBinding = "Alt+Return" }, - new Binding { DisplayName = "Open ROM", Bindings = "Ctrl+O", TabGroup = "General", DefaultBinding = "Ctrl+O" }, - new Binding { DisplayName = "Close ROM", Bindings = "Ctrl+W", TabGroup = "General", DefaultBinding = "Ctrl+W" }, - new Binding { DisplayName = "Load Last ROM", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Display FPS", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Frame Counter", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Lag Counter", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Input Display", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Toggle BG Input", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Toggle Menu", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Volume Up", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Volume Down", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Record A/V", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Stop A/V", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Larger Window", Bindings = "Alt+UpArrow", TabGroup = "General", DefaultBinding = "Alt+UpArrow" }, - new Binding { DisplayName = "Smaller Window", Bindings = "Alt+DownArrow", TabGroup = "General", DefaultBinding = "Alt+DownArrow" }, - new Binding { DisplayName = "Increase Speed", Bindings = "Equals", TabGroup = "General", DefaultBinding = "Equals" }, - new Binding { DisplayName = "Decrease Speed", Bindings = "Minus", TabGroup = "General", DefaultBinding = "Minus" }, - new Binding { DisplayName = "Reboot Core", Bindings = "Ctrl+R", TabGroup = "General", DefaultBinding = "Ctrl+R" }, - new Binding { DisplayName = "Autofire", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Toggle Sound", Bindings = "", TabGroup = "General", DefaultBinding = "" }, - new Binding { DisplayName = "Exit Program", Bindings = "", TabGroup = "General", DefaultBinding = "" }, + { + Bind("General", "Frame Advance", "F"), + Bind("General", "Rewind", "Shift+R, J1 B7, X1 LeftTrigger"), + Bind("General", "Pause", "Pause"), + Bind("General", "Fast Forward", "Tab, J1 B8, X1 RightTrigger"), + Bind("General", "Turbo", "Shift+Tab"), + Bind("General", "Toggle Throttle"), + Bind("General", "Soft Reset"), + Bind("General", "Hard Reset"), + Bind("General", "Quick Load", "P"), + Bind("General", "Quick Save", "I"), + Bind("General", "Autohold"), + Bind("General", "Clear Autohold"), + Bind("General", "Screenshot", "F12"), + Bind("General", "Full Screen", "Alt+Return"), + Bind("General", "Open ROM", "Ctrl+O"), + Bind("General", "Close ROM", "Ctrl+W"), + Bind("General", "Load Last ROM"), + Bind("General", "Display FPS"), + Bind("General", "Frame Counter"), + Bind("General", "Lag Counter"), + Bind("General", "Input Display"), + Bind("General", "Toggle BG Input"), + Bind("General", "Toggle Menu"), + Bind("General", "Volume Up"), + Bind("General", "Volume Down"), + Bind("General", "Record A/V"), + Bind("General", "Stop A/V"), + Bind("General", "Larger Window", "Alt+UpArrow"), + Bind("General", "Smaller Window", "Alt+DownArrow"), + Bind("General", "Increase Speed", "Equals"), + Bind("General", "Decrease Speed", "Minus"), + Bind("General", "Reboot Core", "Ctrl+R"), + Bind("General", "Autofire"), + Bind("General", "Toggle Sound"), + Bind("General", "Exit Program"), - //Save States - new Binding { DisplayName = "Save State 0", Bindings = "Shift+F10", TabGroup = "Save States", DefaultBinding = "Shift+F10" }, - new Binding { DisplayName = "Save State 1", Bindings = "Shift+F1", TabGroup = "Save States", DefaultBinding = "Shift+F1" }, - new Binding { DisplayName = "Save State 2", Bindings = "Shift+F2", TabGroup = "Save States", DefaultBinding = "Shift+F2" }, - new Binding { DisplayName = "Save State 3", Bindings = "Shift+F3", TabGroup = "Save States", DefaultBinding = "Shift+F3" }, - new Binding { DisplayName = "Save State 4", Bindings = "Shift+F4", TabGroup = "Save States", DefaultBinding = "Shift+F4" }, - new Binding { DisplayName = "Save State 5", Bindings = "Shift+F5", TabGroup = "Save States", DefaultBinding = "Shift+F5" }, - new Binding { DisplayName = "Save State 6", Bindings = "Shift+F6", TabGroup = "Save States", DefaultBinding = "Shift+F6" }, - new Binding { DisplayName = "Save State 7", Bindings = "Shift+F7", TabGroup = "Save States", DefaultBinding = "Shift+F7" }, - new Binding { DisplayName = "Save State 8", Bindings = "Shift+F8", TabGroup = "Save States", DefaultBinding = "Shift+F8" }, - new Binding { DisplayName = "Save State 9", Bindings = "Shift+F9", TabGroup = "Save States", DefaultBinding = "Shift+F9" }, - new Binding { DisplayName = "Load State 0", Bindings = "F10", TabGroup = "Save States", DefaultBinding = "F10" }, - new Binding { DisplayName = "Load State 1", Bindings = "F1", TabGroup = "Save States", DefaultBinding = "F1" }, - new Binding { DisplayName = "Load State 2", Bindings = "F2", TabGroup = "Save States", DefaultBinding = "F2" }, - new Binding { DisplayName = "Load State 3", Bindings = "F3", TabGroup = "Save States", DefaultBinding = "F3" }, - new Binding { DisplayName = "Load State 4", Bindings = "F4", TabGroup = "Save States", DefaultBinding = "F4" }, - new Binding { DisplayName = "Load State 5", Bindings = "F5", TabGroup = "Save States", DefaultBinding = "F5" }, - new Binding { DisplayName = "Load State 6", Bindings = "F6", TabGroup = "Save States", DefaultBinding = "F6" }, - new Binding { DisplayName = "Load State 7", Bindings = "F7", TabGroup = "Save States", DefaultBinding = "F7" }, - new Binding { DisplayName = "Load State 8", Bindings = "F8", TabGroup = "Save States", DefaultBinding = "F8" }, - new Binding { DisplayName = "Load State 9", Bindings = "F9", TabGroup = "Save States", DefaultBinding = "F9" }, - new Binding { DisplayName = "Select State 0", Bindings = "D0", TabGroup = "Save States", DefaultBinding = "D0" }, - new Binding { DisplayName = "Select State 1", Bindings = "D1", TabGroup = "Save States", DefaultBinding = "D1" }, - new Binding { DisplayName = "Select State 2", Bindings = "D2", TabGroup = "Save States", DefaultBinding = "D2" }, - new Binding { DisplayName = "Select State 3", Bindings = "D3", TabGroup = "Save States", DefaultBinding = "D3" }, - new Binding { DisplayName = "Select State 4", Bindings = "D4", TabGroup = "Save States", DefaultBinding = "D4" }, - new Binding { DisplayName = "Select State 5", Bindings = "D5", TabGroup = "Save States", DefaultBinding = "D5" }, - new Binding { DisplayName = "Select State 6", Bindings = "D6", TabGroup = "Save States", DefaultBinding = "D6" }, - new Binding { DisplayName = "Select State 7", Bindings = "D7", TabGroup = "Save States", DefaultBinding = "D7" }, - new Binding { DisplayName = "Select State 8", Bindings = "D8", TabGroup = "Save States", DefaultBinding = "D8" }, - new Binding { DisplayName = "Select State 9", Bindings = "D9", TabGroup = "Save States", DefaultBinding = "D9" }, - new Binding { DisplayName = "Save Named State", Bindings = "", TabGroup = "Save States", DefaultBinding = "" }, - new Binding { DisplayName = "Load Named State", Bindings = "", TabGroup = "Save States", DefaultBinding = "" }, - new Binding { DisplayName = "Previous Slot", Bindings = "", TabGroup = "Save States", DefaultBinding = "" }, - new Binding { DisplayName = "Next Slot", Bindings = "", TabGroup = "Save States", DefaultBinding = "" }, + Bind("Save States", "Save State 0", "Shift+F10"), + Bind("Save States", "Save State 1", "Shift+F1"), + Bind("Save States", "Save State 2", "Shift+F2"), + Bind("Save States", "Save State 3", "Shift+F3"), + Bind("Save States", "Save State 4", "Shift+F4"), + Bind("Save States", "Save State 5", "Shift+F5"), + Bind("Save States", "Save State 6", "Shift+F6"), + Bind("Save States", "Save State 7", "Shift+F7"), + Bind("Save States", "Save State 8", "Shift+F8"), + Bind("Save States", "Save State 9", "Shift+F9"), + Bind("Save States", "Load State 0", "F10"), + Bind("Save States", "Load State 1", "F1"), + Bind("Save States", "Load State 2", "F2"), + Bind("Save States", "Load State 3", "F3"), + Bind("Save States", "Load State 4", "F4"), + Bind("Save States", "Load State 5", "F5"), + Bind("Save States", "Load State 6", "F6"), + Bind("Save States", "Load State 7", "F7"), + Bind("Save States", "Load State 8", "F8"), + Bind("Save States", "Load State 9", "F9"), + Bind("Save States", "Select State 0", "D0"), + Bind("Save States", "Select State 1", "D1"), + Bind("Save States", "Select State 2", "D2"), + Bind("Save States", "Select State 3", "D3"), + Bind("Save States", "Select State 4", "D4"), + Bind("Save States", "Select State 5", "D5"), + Bind("Save States", "Select State 6", "D6"), + Bind("Save States", "Select State 7", "D7"), + Bind("Save States", "Select State 8", "D8"), + Bind("Save States", "Select State 9", "D9"), + Bind("Save States", "Save Named State"), + Bind("Save States", "Load Named State"), + Bind("Save States", "Previous Slot"), + Bind("Save States", "Next Slot"), - //Movie - new Binding { DisplayName = "Toggle read-only", Bindings = "Q", TabGroup = "Movie", DefaultBinding = "Q" }, - new Binding { DisplayName = "Play Movie", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, - new Binding { DisplayName = "Record Movie", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, - new Binding { DisplayName = "Stop Movie", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, - new Binding { DisplayName = "Play from beginning", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, - new Binding { DisplayName = "Save Movie", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, - new Binding { DisplayName = "Toggle MultiTrack", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, - new Binding { DisplayName = "MT Select All", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, - new Binding { DisplayName = "MT Select None", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, - new Binding { DisplayName = "MT Increment Player", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, - new Binding { DisplayName = "MT Decrement Player", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, - new Binding { DisplayName = "Movie Poke", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, - new Binding { DisplayName = "Scrub Input", Bindings = "", TabGroup = "Movie", DefaultBinding = "" }, + Bind("Movie", "Toggle read-only", "Q"), + Bind("Movie", "Play Movie"), + Bind("Movie", "Record Movie"), + Bind("Movie", "Stop Movie"), + Bind("Movie", "Play from beginning"), + Bind("Movie", "Save Movie"), + Bind("Movie", "Toggle MultiTrack"), + Bind("Movie", "MT Select All"), + Bind("Movie", "MT Select None"), + Bind("Movie", "MT Increment Player"), + Bind("Movie", "MT Decrement Player"), + Bind("Movie", "Movie Poke"), + Bind("Movie", "Scrub Input"), - //Tools - new Binding { DisplayName = "Ram Watch", Bindings = "", TabGroup = "Tools", DefaultBinding = "" }, - new Binding { DisplayName = "Ram Search", Bindings = "", TabGroup = "Tools", DefaultBinding = "" }, - new Binding { DisplayName = "Hex Editor", Bindings = "", TabGroup = "Tools", DefaultBinding = "" }, - new Binding { DisplayName = "Trace Logger", Bindings = "", TabGroup = "Tools", DefaultBinding = "" }, - new Binding { DisplayName = "Lua Console", Bindings = "", TabGroup = "Tools", DefaultBinding = "" }, - new Binding { DisplayName = "Cheats", Bindings = "", TabGroup = "Tools", DefaultBinding = "" }, - new Binding { DisplayName = "TAStudio", Bindings = "", TabGroup = "Tools", DefaultBinding = "" }, - new Binding { DisplayName = "ToolBox", Bindings = "Shift+T", TabGroup = "Tools", DefaultBinding = "" }, - new Binding { DisplayName = "Virtual Pad", Bindings = "", TabGroup = "Tools", DefaultBinding = "" }, + Bind("Tools", "Ram Watch"), + Bind("Tools", "Ram Search"), + Bind("Tools", "Hex Editor"), + Bind("Tools", "Trace Logger"), + Bind("Tools", "Lua Console"), + Bind("Tools", "Cheats"), + Bind("Tools", "TAStudio"), + Bind("Tools", "ToolBox", "Shift+T"), + Bind("Tools", "Virtual Pad"), - //Ram Search - new Binding { DisplayName = "New Search", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "" }, - new Binding { DisplayName = "Do Search", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "" }, - new Binding { DisplayName = "Previous Compare To", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "" }, - new Binding { DisplayName = "Next Compare To", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "" }, - new Binding { DisplayName = "Previous Operator", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "" }, - new Binding { DisplayName = "Next Operator", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "" }, + Bind("Ram Search", "New Search"), + Bind("Ram Search", "Do Search"), + Bind("Ram Search", "Previous Compare To"), + Bind("Ram Search", "Next Compare To"), + Bind("Ram Search", "Previous Operator"), + Bind("Ram Search", "Next Operator"), - //SNES - new Binding { DisplayName = "Toggle BG 1", Bindings = "", TabGroup = "SNES", DefaultBinding = "" }, - new Binding { DisplayName = "Toggle BG 2", Bindings = "", TabGroup = "SNES", DefaultBinding = "" }, - new Binding { DisplayName = "Toggle BG 3", Bindings = "", TabGroup = "SNES", DefaultBinding = "" }, - new Binding { DisplayName = "Toggle BG 4", Bindings = "", TabGroup = "SNES", DefaultBinding = "" }, - new Binding { DisplayName = "Toggle OBJ 1", Bindings = "", TabGroup = "SNES", DefaultBinding = "" }, - new Binding { DisplayName = "Toggle OBJ 2", Bindings = "", TabGroup = "SNES", DefaultBinding = "" }, - new Binding { DisplayName = "Toggle OBJ 3", Bindings = "", TabGroup = "SNES", DefaultBinding = "" }, - new Binding { DisplayName = "Toggle OBJ 4", Bindings = "", TabGroup = "SNES", DefaultBinding = "" }, + Bind("TAStudio", "Add Branch"), + Bind("TAStudio", "Delete Branch"), - //Analog - new Binding { DisplayName = "Y Up Small", Bindings = "", TabGroup = "Analog", DefaultBinding = "", ToolTip = "For Virtual Pad" }, - new Binding { DisplayName = "Y Up Large", Bindings = "", TabGroup = "Analog", DefaultBinding = "", ToolTip = "For Virtual Pad" }, - new Binding { DisplayName = "Y Down Small", Bindings = "", TabGroup = "Analog", DefaultBinding = "", ToolTip = "For Virtual Pad" }, - new Binding { DisplayName = "Y Down Large", Bindings = "", TabGroup = "Analog", DefaultBinding = "", ToolTip = "For Virtual Pad" }, - new Binding { DisplayName = "X Up Small", Bindings = "", TabGroup = "Analog", DefaultBinding = "", ToolTip = "For Virtual Pad" }, - new Binding { DisplayName = "X Up Large", Bindings = "", TabGroup = "Analog", DefaultBinding = "", ToolTip = "For Virtual Pad" }, - new Binding { DisplayName = "X Down Small", Bindings = "", TabGroup = "Analog", DefaultBinding = "", ToolTip = "For Virtual Pad" }, - new Binding { DisplayName = "X Down Large", Bindings = "", TabGroup = "Analog", DefaultBinding = "", ToolTip = "For Virtual Pad" }, + Bind("SNES", "Toggle BG 1"), + Bind("SNES", "Toggle BG 2"), + Bind("SNES", "Toggle BG 3"), + Bind("SNES", "Toggle BG 4"), + Bind("SNES", "Toggle OBJ 1"), + Bind("SNES", "Toggle OBJ 2"), + Bind("SNES", "Toggle OBJ 3"), + Bind("SNES", "Toggle OBJ 4"), + + Bind("Analog", "Y Up Small", toolTip: "For Virtual Pad"), + Bind("Analog", "Y Up Large", toolTip: "For Virtual Pad"), + Bind("Analog", "Y Down Small", toolTip: "For Virtual Pad"), + Bind("Analog", "Y Down Large", toolTip: "For Virtual Pad"), + Bind("Analog", "X Up Small", toolTip: "For Virtual Pad"), + Bind("Analog", "X Up Large", toolTip: "For Virtual Pad"), + Bind("Analog", "X Down Small", toolTip: "For Virtual Pad"), + Bind("Analog", "X Down Large", toolTip: "For Virtual Pad"), - }; + }; //set ordinals based on order in list for (int i = 0; i < s_DefaultValues.Count; i++) diff --git a/BizHawk.Client.EmuHawk/config/HotkeyConfig.cs b/BizHawk.Client.EmuHawk/config/HotkeyConfig.cs index e40e5be15b..bbe2c9bc45 100644 --- a/BizHawk.Client.EmuHawk/config/HotkeyConfig.cs +++ b/BizHawk.Client.EmuHawk/config/HotkeyConfig.cs @@ -118,7 +118,7 @@ namespace BizHawk.Client.EmuHawk foreach (var b in bindings) { var l = new Label - { + { Text = b.DisplayName, Location = new Point(_x, _y), Size = new Size(iwOffsetX - UIHelper.ScaleX(2), UIHelper.ScaleY(15)), @@ -148,6 +148,16 @@ namespace BizHawk.Client.EmuHawk } } + if (tab == "TAStudio") + { + tb.Controls.Add(new Label + { + Text = "Save States hotkeys operate with branches when TAStudio is engaged.", + Location = new Point(_x, _y), + Size = new Size(iwWidth + iwOffsetX, HotkeyTabControl.Height - _y), + }); + } + HotkeyTabControl.TabPages.Add(tb); } }