@@ -2985,6 +2985,38 @@ bool is_accessibility_enabled(bool accessibility_enable, bool accessibility_enab
29852985}
29862986#endif
29872987
2988+
2989+ /* Kiosk Mode Fix - Confirm User Input - slighlty modified menu_input_st_string_cb_disable_kiosk_mode function from menu_cbs_ok.c */
2990+ static void kiosk_password_input_complete (void * userdata , const char * line )
2991+ {
2992+ if (line && * line )
2993+ {
2994+ const char * label = menu_input_dialog_get_buffer ();
2995+ settings_t * settings = config_get_ptr ();
2996+ const char * path_kiosk_mode_password =
2997+ settings -> paths .kiosk_mode_password ;
2998+
2999+ if (string_is_equal (label , path_kiosk_mode_password ))
3000+ {
3001+ const char * _msg = msg_hash_to_str (MSG_INPUT_KIOSK_MODE_PASSWORD_OK );
3002+ runloop_msg_queue_push (_msg , strlen (_msg ), 1 , 100 , true, NULL ,
3003+ MESSAGE_QUEUE_ICON_DEFAULT , MESSAGE_QUEUE_CATEGORY_INFO );
3004+ /* Disable Kiosk Mode and Restart RetroArch! */
3005+ settings -> bools .kiosk_mode_enable = false;
3006+ command_event (CMD_EVENT_RESTART_RETROARCH , NULL );
3007+ }
3008+ else
3009+ {
3010+ const char * _msg = msg_hash_to_str (MSG_INPUT_KIOSK_MODE_PASSWORD_NOK );
3011+ runloop_msg_queue_push (_msg , strlen (_msg ), 1 , 100 , true, NULL ,
3012+ MESSAGE_QUEUE_ICON_DEFAULT , MESSAGE_QUEUE_CATEGORY_INFO );
3013+ }
3014+ }
3015+
3016+ menu_input_dialog_end ();
3017+ }
3018+
3019+
29883020/**
29893021 * command_event:
29903022 * @cmd : Event command index.
@@ -3430,6 +3462,24 @@ bool command_event(enum event_command cmd, void *data)
34303462 retroarch_menu_running ();
34313463#endif
34323464 break ;
3465+ /* Kiosk Mode Fix */
3466+ case CMD_EVENT_KIOSK :
3467+ /* If were already in Kiosk Mode, ask for the Password! */
3468+ if (settings -> bools .kiosk_mode_enable && settings -> paths .kiosk_mode_password != "" )
3469+ {
3470+ menu_input_ctx_line_t line ;
3471+ line .label = msg_hash_to_str (MENU_ENUM_LABEL_VALUE_MENU_KIOSK_MODE_PASSWORD );
3472+ line .label_setting = NULL ;
3473+ line .type = 0 ;
3474+ line .idx = 0 ;
3475+ line .cb = kiosk_password_input_complete ;
3476+ menu_input_dialog_start (& line );
3477+ break ;
3478+ }
3479+ /* Toggle Kiosk mode then Restart Retroarch */
3480+ settings -> bools .kiosk_mode_enable = !(settings -> bools .kiosk_mode_enable );
3481+ command_event (CMD_EVENT_RESTART_RETROARCH , NULL );
3482+ break ;
34333483 case CMD_EVENT_RESET :
34343484 {
34353485 const char * _msg = msg_hash_to_str (MSG_RESET );
0 commit comments