File tree Expand file tree Collapse file tree 2 files changed +40
-2
lines changed
Intersect.Client.Core/Core/Controls
Intersect.Client.Framework/Input Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -224,6 +224,16 @@ public bool TryLoad()
224224 }
225225 }
226226
227+ // Check for corrupted controls bug (all bindings are None/None)
228+ if ( AreAllControlsBroken ( ) )
229+ {
230+ ApplicationContext . Context . Value ? . Logger . LogWarning (
231+ "Detected broken control bindings (all None/None), resetting to defaults"
232+ ) ;
233+ ResetDefaults ( ) ;
234+ TrySave ( ) ;
235+ }
236+
227237 return success ;
228238 }
229239 catch ( Exception exception )
@@ -233,6 +243,25 @@ public bool TryLoad()
233243 }
234244 }
235245
246+ private bool AreAllControlsBroken ( )
247+ {
248+ // Check if all controls have all bindings set to None/None (broken state from old bug)
249+ foreach ( var ( control , mapping ) in Mappings )
250+ {
251+ foreach ( var binding in mapping . Bindings )
252+ {
253+ // If we find any binding that's not None/None, controls are not broken
254+ if ( binding . Modifier != Keys . None || binding . Key != Keys . None )
255+ {
256+ return false ;
257+ }
258+ }
259+ }
260+
261+ // All bindings are None/None, this is the broken state
262+ return true ;
263+ }
264+
236265 private bool TryLoadBindingFor ( Control control , int bindingIndex , [ NotNullWhen ( true ) ] out ControlBinding ? binding )
237266 {
238267 try
Original file line number Diff line number Diff line change @@ -53,8 +53,17 @@ internal sealed class BuiltinControlsProvider : IControlsProvider
5353
5454 public Control [ ] Controls { get ; } = Enum . GetValues < Control > ( ) . Where ( control => control . IsValid ( ) ) . ToArray ( ) ;
5555
56- public bool TryGetDefaultMapping ( Control control , [ NotNullWhen ( true ) ] out ControlMapping ? defaultMapping ) =>
57- _defaultMappings . TryGetValue ( control , out defaultMapping ) ;
56+ public bool TryGetDefaultMapping ( Control control , [ NotNullWhen ( true ) ] out ControlMapping ? defaultMapping )
57+ {
58+ if ( _defaultMappings . TryGetValue ( control , out var mapping ) )
59+ {
60+ defaultMapping = new ControlMapping ( mapping ) ;
61+ return true ;
62+ }
63+
64+ defaultMapping = null ;
65+ return false ;
66+ }
5867
5968 public void ReloadFromOptions ( Options ? options )
6069 {
You can’t perform that action at this time.
0 commit comments