@@ -112,7 +112,12 @@ class GameSystemSelectMenu:
112112 "zxs" : "ZX Spectrum"
113113 }
114114
115- def __init__ (self ):
115+ def __init__ (self , app_menu , favorites_menu , collections_menu , recents_menu , settings_menu ):
116+ self .app_menu = app_menu
117+ self .favorites_menu = favorites_menu
118+ self .collections_menu = collections_menu
119+ self .recents_menu = recents_menu
120+ self .settings_menu = settings_menu
116121 self .game_utils : GameSystemUtils = Device .get_game_system_utils ()
117122 self .rom_select_menu : GameSelectMenu = GameSelectMenu ()
118123 self .use_emu_cfg = False
@@ -191,6 +196,81 @@ def get_rom_count_text(self, game_system):
191196 return f"{ len (roms )} games"
192197 else :
193198 return f"{ len (roms )} game"
199+
200+ def game_system_selected (self , input_value , game_system : GameSystem ):
201+ if (ControllerInput .A == input_value ):
202+ PyUiState .set_last_system_selection (game_system .display_name )
203+ return_value = self .rom_select_menu .run_rom_selection (game_system )
204+ if (return_value is not None ):
205+ if (ControllerInput .B == return_value ):
206+ PyUiState .set_in_game_selection_screen (None )
207+ if (Theme .skip_main_menu ()):
208+ return return_value
209+ elif (ControllerInput .MENU == input_value ):
210+ return_value = self .game_system_select_menu_popup .run_popup_menu_selection (game_system )
211+ if (return_value is not None ):
212+ return return_value
213+
214+ def run_extra (self , input_value , primary_text , run_function ):
215+ PyUiState .set_last_system_selection (primary_text )
216+ if (ControllerInput .A == input_value ):
217+ PyUiState .set_in_game_selection_screen (True )
218+ run_function ()
219+ PyUiState .set_in_game_selection_screen (False )
220+
221+ def add_extras_to_systems_list (self , systems_list ):
222+ if ((Theme .skip_main_menu () or Theme .merge_main_menu_and_game_menu ()) and Theme .show_extras_in_system_select_menu ()):
223+ if (Theme .get_apps_enabled ()):
224+ systems_list .append (GridOrListEntry (
225+ primary_text = "Apps" ,
226+ primary_text_long = "Applications" ,
227+ image_path = Theme .get_system_icon ("apps" ),
228+ image_path_selected = Theme .get_system_icon_selected ("apps" ),
229+ description = "Launch Applications" ,
230+ icon = None ,
231+ value = lambda input_value : self .run_extra (input_value , "Apps" ,self .app_menu .run_app_selection )
232+ ))
233+ if (Theme .get_favorites_enabled ()):
234+ systems_list .append (GridOrListEntry (
235+ primary_text = "Favorites" ,
236+ primary_text_long = "Favorites" ,
237+ image_path = Theme .get_system_icon ("favorites" ),
238+ image_path_selected = Theme .get_system_icon_selected ("favorites" ),
239+ description = "Launch Favorites" ,
240+ icon = None ,
241+ value = lambda input_value : self .run_extra (input_value , "Favorites" , self .favorites_menu .run_rom_selection )
242+ ) )
243+ if (Theme .get_recents_enabled ()):
244+ systems_list .append (GridOrListEntry (
245+ primary_text = "Recents" ,
246+ primary_text_long = "Recents" ,
247+ image_path = Theme .get_system_icon ("recents" ),
248+ image_path_selected = Theme .get_system_icon_selected ("recents" ),
249+ description = "Launch Recents" ,
250+ icon = None ,
251+ value = lambda input_value : self .run_extra (input_value , "Recents" , self .recents_menu .run_rom_selection )
252+ ) )
253+ if (Theme .get_collections_enabled ()):
254+ systems_list .append (GridOrListEntry (
255+ primary_text = "Collections" ,
256+ primary_text_long = "Collections" ,
257+ image_path = Theme .get_system_icon ("collections" ),
258+ image_path_selected = Theme .get_system_icon_selected ("collections" ),
259+ description = "Launch Collections" ,
260+ icon = None ,
261+ value = lambda input_value : self .run_extra (input_value , "Collections" , self .collections_menu .run_rom_selection )
262+ ) )
263+ if (Theme .get_settings_enabled () or Theme .merge_main_menu_and_game_menu ()):
264+ systems_list .append (GridOrListEntry (
265+ primary_text = "Settings" ,
266+ primary_text_long = "Settings" ,
267+ image_path = Theme .get_system_icon ("settings" ),
268+ image_path_selected = Theme .get_system_icon_selected ("settings" ),
269+ description = "Launch Settings" ,
270+ icon = None ,
271+ value = lambda input_value : self .settings_menu .show_menu () if ControllerInput .A == input_value else None
272+ ) )
273+
194274
195275 def build_system_list (self ):
196276 systems_list = []
@@ -210,19 +290,22 @@ def build_system_list(self):
210290 image_path_selected = image_path_selected ,
211291 description = lambda idx = index , gs = game_system : f"{ gs .display_name } - { self .get_rom_count_text (gs )} - System { idx } of { total_count } " ,
212292 icon = icon ,
213- value = game_system
293+ value = lambda input_value , game_system = game_system : self . game_system_selected ( input_value , game_system )
214294 )
215295 systems_list .append (option )
216- if (game_system .display_name == PyUiState .get_last_system_selection ()):
217- selected = Selection (option ,None ,index - 1 )
218-
296+
297+ self .add_extras_to_systems_list (systems_list )
298+
299+ for entry in systems_list :
300+ if (entry .get_primary_text () == PyUiState .get_last_system_selection ()):
301+ selected = Selection (entry ,None ,systems_list .index (entry ))
302+ break
219303 return systems_list , selected
220304
221305 def run_system_selection (self ) :
222-
223306 if (self .selected is not None ):
224307 if (PyUiState .get_in_game_selection_screen ()):
225- return_value = self .rom_select_menu . run_rom_selection ( self . selected .get_selection ().get_value ())
308+ return_value = self .selected .get_selection ().get_value ()( ControllerInput . A )
226309 if (return_value is not None ):
227310 if (ControllerInput .B == return_value ):
228311 PyUiState .set_in_game_selection_screen (None )
@@ -260,6 +343,9 @@ def run_system_selection(self) :
260343 carousel_selected_entry_width_percent = Theme .get_carousel_system_select_primary_img_width (),
261344 carousel_shrink_further_away = Theme .get_carousel_system_select_shrink_further_away (),
262345 carousel_sides_hang_off_edge = Theme .get_carousel_system_select_sides_hang_off (),
346+ carousel_x_pad = Theme .get_carousel_system_x_pad (),
347+ carousel_x_offset = Theme .get_carousel_system_external_x_offset (),
348+ grid_view_wrap_around_single_row = Theme .get_system_select_grid_wrap_around_single_row ()
263349 )
264350 else :
265351 view .set_options (self .systems_list )
@@ -271,16 +357,8 @@ def run_system_selection(self) :
271357
272358 while (not exit ):
273359 self .selected = view .get_selection (accepted_inputs )
274- if (ControllerInput .A == self .selected .get_input ()):
275- PyUiState .set_last_system_selection (self .selected .get_selection ().get_value ().display_name )
276- return_value = self .rom_select_menu .run_rom_selection (self .selected .get_selection ().get_value ())
277- if (return_value is not None ):
278- if (ControllerInput .B == return_value ):
279- PyUiState .set_in_game_selection_screen (None )
280- if (Theme .skip_main_menu ()):
281- return return_value
282- elif (ControllerInput .MENU == self .selected .get_input ()):
283- return_value = self .game_system_select_menu_popup .run_popup_menu_selection (self .selected .get_selection ().get_value ())
360+ if (ControllerInput .A == self .selected .get_input () or ControllerInput .MENU == self .selected .get_input ()):
361+ return_value = self .selected .get_selection ().get_value ()(self .selected .get_input ())
284362 if (return_value is not None ):
285363 return return_value
286364 elif (ControllerInput .B == self .selected .get_input () and not Theme .skip_main_menu ()):
0 commit comments