Skip to content

Commit dddb2ef

Browse files
committed
Do not default bind two hotkeys to the same key combination.
1 parent 674edbb commit dddb2ef

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/BizHawk.Client.Common/config/Binding.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
using System.Collections.Generic;
2+
#if DEBUG
3+
using System.Diagnostics;
4+
#endif
25
using System.Linq;
36

7+
using BizHawk.Common.CollectionExtensions;
8+
49
namespace BizHawk.Client.Common
510
{
611
public class HotkeyInfo
@@ -133,7 +138,7 @@ void Bind(string tabGroup, string displayName, string defaultBinding = "", strin
133138
Bind("TAStudio", "Show Cursor");
134139
Bind("TAStudio", "Select Current Frame");
135140
Bind("TAStudio", "Toggle Follow Cursor", "Shift+F");
136-
Bind("TAStudio", "Toggle Auto-Restore", "Shift+R");
141+
Bind("TAStudio", "Toggle Auto-Restore", "Alt+R");
137142
Bind("TAStudio", "Seek To Green Arrow", "R");
138143
Bind("TAStudio", "Toggle Turbo Seek", "Shift+S");
139144
Bind("TAStudio", "Undo", "Ctrl+Z"); // TODO: these are getting not unique enough
@@ -200,6 +205,14 @@ void Bind(string tabGroup, string displayName, string defaultBinding = "", strin
200205

201206
AllHotkeys = dict;
202207
Groupings = dict.Values.Select(static info => info.TabGroup).Distinct().ToList();
208+
209+
#if DEBUG
210+
var bindings = dict.Values
211+
.Where(static info => !info.DisplayName.StartsWith("RA ") && !string.IsNullOrEmpty(info.DefaultBinding))
212+
.Select(static info => info.DefaultBinding)
213+
.ToArray();
214+
Debug.Assert(bindings.Distinct().CountIsExactly(bindings.Length), "Do not default bind multiple hotkeys to the same button combination.");
215+
#endif
203216
}
204217

205218
public static void ResolveWithDefaults(IDictionary<string, string> dict)

0 commit comments

Comments
 (0)