@@ -22,6 +22,7 @@ public sealed class SettingsControls(Desktop desktop, SettingsManager configMana
2222 Dictionary < ButtonName , Button > Buttons { get ; } = [ ] ;
2323 Dictionary < ButtonName , Button > Macros { get ; } = [ ] ;
2424
25+ Theme fallbackTheme ;
2526 WindowDialog currentModal ;
2627 ComboView controllerTypeCombo = new ( ) ;
2728 Theme defaultTheme ;
@@ -75,6 +76,8 @@ public Widget BuildUI()
7576 ButtonName . MK ,
7677 ButtonName . HK ,
7778 ButtonName . KK ,
79+ ButtonName . LS ,
80+ ButtonName . RS ,
7881 ] ;
7982
8083 PlayerInputDevice player ;
@@ -86,6 +89,7 @@ public void SetPlayer(PlayerInputDevice pad)
8689 var currentType = Config . InputMap . GetPadKind ( pad ) ;
8790 controllerTypeCombo . SelectedIndex = ThemeConfig . ControllerTypes . Keys . ToArray ( ) . IndexOf ( currentType ) ;
8891 player = pad ;
92+ RefreshFallbackTheme ( ) ;
8993
9094 foreach ( var button in Directions )
9195 if ( ! player . IsKeyboard ||
@@ -123,18 +127,27 @@ void RebuildMacroButtons()
123127 var theme = ThemeManager . Get ( Config . CurrentTheme ) ;
124128 var macros = theme . GetMacro ( buttonName , Config . Macros ) ;
125129 if ( macros . Length is 0 )
130+ {
131+ var texture = theme . GetTexture ( buttonName )
132+ ?? fallbackTheme ? . GetTexture ( buttonName )
133+ ?? ThemeManager . UnknownButton ;
134+
126135 content . Widgets . Add ( new Image
127136 {
128137 VerticalAlignment = VerticalAlignment . Center ,
129138 HorizontalAlignment = HorizontalAlignment . Right ,
130- Renderable = new TextureRegion ( ThemeManager . UnknownButton ) ,
139+ Renderable = new TextureRegion ( texture ) ,
131140 Width = 30 ,
132141 Height = 30 ,
133142 } ) ;
143+ }
134144 else
135145 foreach ( var part in macros )
136146 {
137- var texture = theme . GetTexture ( part ) ?? ThemeManager . UnknownButton ;
147+ var texture = theme . GetTexture ( part )
148+ ?? fallbackTheme ? . GetTexture ( part )
149+ ?? ThemeManager . UnknownButton ;
150+
138151 content . Widgets . Add ( new Image
139152 {
140153 VerticalAlignment = VerticalAlignment . Center ,
@@ -180,7 +193,7 @@ Dialog CreateMacroDialog(ButtonName buttonName)
180193
181194 foreach ( var b in allButtonNames )
182195 {
183- var texture = theme . GetTexture ( b ) ;
196+ var texture = theme . GetTexture ( b ) ?? fallbackTheme ? . GetTexture ( b ) ;
184197 if ( texture is null ) continue ;
185198
186199 Image icon = new ( )
@@ -245,6 +258,7 @@ Grid BuildMacroMap()
245258 root . ColumnsProportions . Add ( new ( ProportionType . Auto ) ) ;
246259 root . ColumnsProportions . Add ( new ( ProportionType . Auto ) ) ;
247260 root . ColumnsProportions . Add ( new ( ProportionType . Auto ) ) ;
261+ root . ColumnsProportions . Add ( new ( ProportionType . Auto ) ) ;
248262 root . RowsProportions . Add ( new ( ProportionType . Auto ) ) ;
249263 root . RowsProportions . Add ( new ( ProportionType . Auto ) ) ;
250264
@@ -276,7 +290,7 @@ Grid BuildMacroMap()
276290 RebuildMacroButtons ( ) ;
277291 } ;
278292
279- Grid . SetColumn ( resetMapButton , 3 ) ;
293+ Grid . SetColumn ( resetMapButton , 4 ) ;
280294 Grid . SetRow ( resetMapButton , 0 ) ;
281295 root . Widgets . Add ( resetMapButton ) ;
282296
@@ -290,6 +304,8 @@ Grid BuildMacroMap()
290304 SetMacroButton ( ButtonName . MK , ( 2 , 1 ) ) ;
291305 SetMacroButton ( ButtonName . HK , ( 2 , 2 ) ) ;
292306 SetMacroButton ( ButtonName . KK , ( 2 , 3 ) ) ;
307+ SetMacroButton ( ButtonName . LS , ( 1 , 4 ) ) ;
308+ SetMacroButton ( ButtonName . RS , ( 2 , 4 ) ) ;
293309
294310 return root ;
295311
@@ -852,11 +868,13 @@ VerticalStackPanel BuildInputMap()
852868 InitButton ( ButtonName . MP , ( 1 , 2 ) , buttonsGrid ) ;
853869 InitButton ( ButtonName . HP , ( 1 , 3 ) , buttonsGrid ) ;
854870 InitButton ( ButtonName . PP , ( 1 , 4 ) , buttonsGrid ) ;
871+ InitButton ( ButtonName . LS , ( 1 , 5 ) , buttonsGrid ) ;
855872
856873 InitButton ( ButtonName . LK , ( 2 , 1 ) , buttonsGrid ) ;
857874 InitButton ( ButtonName . MK , ( 2 , 2 ) , buttonsGrid ) ;
858875 InitButton ( ButtonName . HK , ( 2 , 3 ) , buttonsGrid ) ;
859876 InitButton ( ButtonName . KK , ( 2 , 4 ) , buttonsGrid ) ;
877+ InitButton ( ButtonName . RS , ( 2 , 5 ) , buttonsGrid ) ;
860878
861879 return root ;
862880 }
@@ -1028,13 +1046,29 @@ Panel BuildSelectedController()
10281046 void OnChangeControllerType ( object sender , EventArgs e )
10291047 {
10301048 if ( sender is not ListView { SelectedItem : Label { Tag : PlayerInputDevice . Kind kind } }
1031- || player is null || Config . InputMap . GetMapping ( player ) is not { } mapping )
1049+ || player is null
1050+ || Config . InputMap . GetMapping ( player ) is not { } mapping
1051+ )
10321052 return ;
10331053
10341054 mapping . Kind = kind ;
1055+ RefreshFallbackTheme ( ) ;
10351056 SaveConfig ( ) ;
10361057 }
10371058
1059+ void RefreshFallbackTheme ( )
1060+ {
1061+ if ( player is null ) return ;
1062+
1063+ var kind = Config . InputMap . GetPadKind ( player ) ;
1064+ var theme = ThemeManager . GetFallback ( kind ) ;
1065+
1066+ if ( fallbackTheme == theme ) return ;
1067+
1068+ fallbackTheme = theme ;
1069+ RebuildMacroButtons ( ) ;
1070+ }
1071+
10381072 public void HighLightDirection ( Direction dir )
10391073 {
10401074 var index = NumpadNotation . From ( dir ) - 1 ;
0 commit comments