@@ -473,6 +473,10 @@ typedef struct xmb_handle
473473
474474 /* Whether to show entry index for current list */
475475 bool entry_idx_enabled ;
476+
477+ /* Kiosk Mode Fix - Makes sure we only call our function once after menu is ready */
478+ bool is_kiosk_init ;
479+
476480} xmb_handle_t ;
477481
478482static float xmb_scale_mod [8 ] = {
@@ -5856,10 +5860,17 @@ static enum menu_action xmb_parse_menu_entry_action(
58565860 else
58575861 {
58585862 /* Jump to Main Menu */
5863+ settings_t * settings = config_get_ptr ();
58595864 size_t i = 0 ;
58605865 size_t current_tab = xmb -> categories_selection_ptr ;
5861-
58625866 menu_entry_t entry ;
5867+
5868+ /* Kiosk Mode Fix - Only jump to Main Menu if not in Kiosk Mode!*/
5869+ if (settings -> bools .kiosk_mode_enable )
5870+ {
5871+ return MENU_ACTION_NOOP ;
5872+ }
5873+
58635874 MENU_ENTRY_INITIALIZE (entry );
58645875 menu_entry_get (& entry , 0 , menu_st -> selection_ptr , NULL , true);
58655876
@@ -6437,6 +6448,7 @@ static bool xmb_context_reset_textures(
64376448 const char * iconpath ,
64386449 unsigned menu_xmb_theme )
64396450{
6451+ settings_t * settings = config_get_ptr ();
64406452 unsigned i ;
64416453
64426454 for (i = 0 ; i < XMB_TEXTURE_LAST ; i ++ )
@@ -6507,11 +6519,13 @@ static bool xmb_context_reset_textures(
65076519 }
65086520 }
65096521 }
6510-
6511- xmb -> main_menu_node .icon = xmb -> textures .list [XMB_TEXTURE_MAIN_MENU ];
6512- xmb -> main_menu_node .alpha = xmb -> categories_active_alpha ;
6513- xmb -> main_menu_node .zoom = xmb -> categories_active_zoom ;
6514-
6522+ /* Kiosk Mode Fix - Hide Main Menu Icon if kiosk mode is enabled */
6523+ if (!settings -> bools .kiosk_mode_enable )
6524+ {
6525+ xmb -> main_menu_node .icon = xmb -> textures .list [XMB_TEXTURE_MAIN_MENU ];
6526+ xmb -> main_menu_node .alpha = xmb -> categories_active_alpha ;
6527+ xmb -> main_menu_node .zoom = xmb -> categories_active_zoom ;
6528+ }
65156529 xmb -> settings_tab_node .icon = xmb -> textures .list [XMB_TEXTURE_SETTINGS ];
65166530 xmb -> settings_tab_node .alpha = xmb -> categories_active_alpha ;
65176531 xmb -> settings_tab_node .zoom = xmb -> categories_active_zoom ;
@@ -8718,7 +8732,10 @@ static void *xmb_init(void **userdata, bool video_is_threaded)
87188732 xmb -> depth = 1 ;
87198733 xmb -> old_depth = 1 ;
87208734 xmb -> alpha = 1.0f ;
8721-
8735+
8736+ /* Kiosk Mode Fix */
8737+ xmb -> is_kiosk_init = false;
8738+
87228739 xmb_refresh_system_tabs_list (xmb );
87238740
87248741 for (i = 0 ; i < XMB_TAB_MAX_LENGTH ; i ++ )
@@ -8787,6 +8804,45 @@ static void *xmb_init(void **userdata, bool video_is_threaded)
87878804 return NULL ;
87888805}
87898806
8807+ /* Kiosk Mode Fix */
8808+ static void xmb_kiosk_mode_fix (xmb_handle_t * xmb )
8809+ {
8810+ settings_t * settings = config_get_ptr ();
8811+ if (settings -> bools .kiosk_mode_enable )
8812+ {
8813+ /* Only jump if we have a Horizontal Menu ( if Play lists Tab is not empty ! ) */
8814+ /* If we have no playlists on the playlists tab, disable Kiosk mode and reset !*/
8815+ if ((unsigned )xmb_list_get_size (xmb , MENU_LIST_HORIZONTAL ) <= 0 )
8816+ {
8817+ /* Disable Kiosk Mode ( Prevents Crash when kiosk mode enabled with no playlists ) */
8818+ settings -> bools .kiosk_mode_enable = false;
8819+ /* Re-Enable Main Menu Icon! */
8820+ xmb -> main_menu_node .icon = xmb -> textures .list [XMB_TEXTURE_MAIN_MENU ];
8821+ xmb -> main_menu_node .alpha = xmb -> categories_active_alpha ;
8822+ xmb -> main_menu_node .zoom = xmb -> categories_active_zoom ;
8823+ /* Refresh list */
8824+ xmb_refresh_system_tabs_list (xmb );
8825+ }
8826+ else
8827+ {
8828+ /* Jump one Categorie Right after init ( "hides" main menu ) */
8829+ /* Only happens once on init */
8830+ if (!xmb -> is_kiosk_init )
8831+ {
8832+ struct menu_state * menu_st = menu_state_get_ptr ();
8833+ menu_list_t * menu_list = menu_st -> entries .list ;
8834+
8835+ menu_entry_t entry ;
8836+ MENU_ENTRY_INITIALIZE (entry );
8837+ menu_entry_get (& entry , 0 , menu_st -> selection_ptr , NULL , true);
8838+
8839+ xmb_menu_entry_action (xmb , & entry , menu_st -> selection_ptr , MENU_ACTION_RIGHT );
8840+ xmb -> is_kiosk_init = true;
8841+ }
8842+ }
8843+ }
8844+ }
8845+
87908846static void xmb_free (void * data )
87918847{
87928848 xmb_handle_t * xmb = (xmb_handle_t * )data ;
@@ -9004,6 +9060,7 @@ static void xmb_list_cache(void *data, enum menu_list_type type,
90049060 file_list_t * menu_stack = MENU_LIST_GET (menu_list , 0 );
90059061 file_list_t * selection_buf = MENU_LIST_GET_SELECTION (menu_list , 0 );
90069062 size_t selection = menu_st -> selection_ptr ;
9063+ settings_t * settings = config_get_ptr ();
90079064 unsigned horizontal_list_size = (xmb -> show_playlist_tabs )
90089065 ? (unsigned )xmb_list_get_size (xmb , MENU_LIST_HORIZONTAL )
90099066 : 0 ;
@@ -9053,23 +9110,54 @@ static void xmb_list_cache(void *data, enum menu_list_type type,
90539110 switch (action )
90549111 {
90559112 case MENU_ACTION_LEFT :
9056- if (xmb -> categories_selection_ptr == 0 )
9113+ /* Kiosk Mode Fix - Only allow categorie movement between idx 1 and last instead of 0 ( skips main menu ) */
9114+ if (settings -> bools .kiosk_mode_enable )
90579115 {
9058- xmb -> categories_selection_ptr = list_size ;
9059- xmb -> categories_active_idx = (unsigned )(list_size - 1 );
9116+ if (xmb -> categories_selection_ptr == 1 )
9117+ {
9118+ xmb -> categories_selection_ptr = list_size ;
9119+ xmb -> categories_active_idx = (unsigned )(list_size - 1 );
9120+ }
9121+ else
9122+ xmb -> categories_selection_ptr -- ;
9123+ break ;
90609124 }
90619125 else
9062- xmb -> categories_selection_ptr -- ;
9063- break ;
9126+ {
9127+ if (xmb -> categories_selection_ptr == 0 )
9128+ {
9129+ xmb -> categories_selection_ptr = list_size ;
9130+ xmb -> categories_active_idx = (unsigned )(list_size - 1 );
9131+ }
9132+ else
9133+ xmb -> categories_selection_ptr -- ;
9134+ break ;
9135+ }
90649136 default :
9065- if (xmb -> categories_selection_ptr == list_size )
9137+ /* Kiosk Mode Fix - Only allow categorie movement between idx 1 and last instead of 0 ( skips main menu ) */
9138+ if (settings -> bools .kiosk_mode_enable )
90669139 {
9067- xmb -> categories_selection_ptr = 0 ;
9068- xmb -> categories_active_idx = 1 ;
9140+ if (xmb -> categories_selection_ptr == list_size )
9141+ {
9142+ xmb -> categories_selection_ptr = 1 ;
9143+ xmb -> categories_active_idx = 2 ;
9144+ }
9145+ else
9146+ xmb -> categories_selection_ptr ++ ;
9147+ break ;
90699148 }
90709149 else
9071- xmb -> categories_selection_ptr ++ ;
9072- break ;
9150+ {
9151+ if (xmb -> categories_selection_ptr == list_size )
9152+ {
9153+ xmb -> categories_selection_ptr = 0 ;
9154+ xmb -> categories_active_idx = 1 ;
9155+ }
9156+ else
9157+ xmb -> categories_selection_ptr ++ ;
9158+ break ;
9159+ }
9160+
90739161 }
90749162
90759163 stack_size = menu_stack -> size ;
@@ -9207,7 +9295,10 @@ static void xmb_toggle(void *userdata, bool menu_on)
92079295 xmb_fade_out (xmb );
92089296 return ;
92099297 }
9210-
9298+
9299+ /* Kiosk Mode Fix */
9300+ xmb_kiosk_mode_fix (xmb );
9301+
92119302 /* Have to reset this, otherwise savestate
92129303 * thumbnail won't update after selecting
92139304 * 'save state' option */
0 commit comments