Skip to content

Commit 28300fc

Browse files
Merge pull request #17980 from Lhaete/master
2 parents b353e8d + 49d4a58 commit 28300fc

File tree

15 files changed

+225
-21
lines changed

15 files changed

+225
-21
lines changed

command.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ enum event_command
4343
{
4444
CMD_SPECIAL = -1,
4545
CMD_EVENT_NONE = 0,
46+
/* Toggle Kiosk Mode*/
47+
CMD_EVENT_KIOSK,
4648
/* Resets RetroArch. */
4749
CMD_EVENT_RESET,
4850
CMD_EVENT_SET_PER_GAME_RESOLUTION,
@@ -456,6 +458,7 @@ static const struct cmd_map map[] = {
456458
{ "MENU_TOGGLE", RARCH_MENU_TOGGLE },
457459
{ "QUIT", RARCH_QUIT_KEY },
458460
{ "CLOSE_CONTENT", RARCH_CLOSE_CONTENT_KEY },
461+
{ "KIOSK_MODE", RARCH_KIOSK_MODE },
459462
{ "RESET", RARCH_RESET },
460463

461464
{ "FAST_FORWARD", RARCH_FAST_FORWARD_KEY },

config.def.keybinds.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,13 @@ static const struct retro_keybind retro_keybinds_1[] = {
570570
RARCH_UI_COMPANION_TOGGLE, NO_BTN, NO_BTN, 0,
571571
true
572572
},
573+
{
574+
NULL, NULL,
575+
AXIS_NONE, AXIS_NONE,
576+
MENU_ENUM_LABEL_VALUE_INPUT_META_KIOSK, RETROK_UNKNOWN,
577+
RARCH_KIOSK_MODE, NO_BTN, NO_BTN, 0,
578+
true
579+
},
573580
{
574581
NULL, NULL,
575582
AXIS_NONE, AXIS_NONE,
@@ -1209,6 +1216,13 @@ static const struct retro_keybind retro_keybinds_1[] = {
12091216
RARCH_UI_COMPANION_TOGGLE, NO_BTN, NO_BTN, 0,
12101217
true
12111218
},
1219+
{
1220+
NULL, NULL,
1221+
AXIS_NONE, AXIS_NONE,
1222+
MENU_ENUM_LABEL_VALUE_INPUT_META_KIOSK, RETROK_UNKNOWN,
1223+
RARCH_KIOSK_MODE, NO_BTN, NO_BTN, 0,
1224+
true
1225+
},
12121226
{
12131227
NULL, NULL,
12141228
AXIS_NONE, AXIS_NONE,
@@ -1858,6 +1872,13 @@ static const struct retro_keybind retro_keybinds_1[] = {
18581872
RARCH_UI_COMPANION_TOGGLE, NO_BTN, NO_BTN, 0,
18591873
true
18601874
},
1875+
{
1876+
NULL, NULL,
1877+
AXIS_NONE, AXIS_NONE,
1878+
MENU_ENUM_LABEL_VALUE_INPUT_META_KIOSK, RETROK_F5,
1879+
RARCH_KIOSK_MODE, NO_BTN, NO_BTN, 0,
1880+
true
1881+
},
18611882
{
18621883
NULL, NULL,
18631884
AXIS_NONE, AXIS_NONE,

configuration.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL] = {
345345
DECLARE_META_BIND(2, exit_emulator, RARCH_QUIT_KEY, MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY),
346346
#endif
347347
DECLARE_META_BIND(2, close_content, RARCH_CLOSE_CONTENT_KEY, MENU_ENUM_LABEL_VALUE_INPUT_META_CLOSE_CONTENT_KEY),
348+
DECLARE_META_BIND(2, kiosk_toggle, RARCH_KIOSK_MODE, MENU_ENUM_LABEL_VALUE_INPUT_META_KIOSK),
348349
DECLARE_META_BIND(2, reset, RARCH_RESET, MENU_ENUM_LABEL_VALUE_INPUT_META_RESET),
349350
DECLARE_META_BIND(1, toggle_fast_forward, RARCH_FAST_FORWARD_KEY, MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_KEY),
350351
DECLARE_META_BIND(2, hold_fast_forward, RARCH_FAST_FORWARD_HOLD_KEY, MENU_ENUM_LABEL_VALUE_INPUT_META_FAST_FORWARD_HOLD_KEY),

gfx/common/win32_common.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,8 @@ static LRESULT win32_menu_loop(HWND owner, WPARAM wparam)
802802
win32_load_content_from_gui(win32_file);
803803
}
804804
break;
805+
case ID_M_KIOSK:
806+
command_event(CMD_EVENT_KIOSK, NULL);
805807
case ID_M_RESET:
806808
command_event(CMD_EVENT_RESET, NULL);
807809
break;
@@ -2028,6 +2030,8 @@ static enum msg_hash_enums menu_id_to_label_enum(unsigned int menuId)
20282030
{
20292031
case ID_M_LOAD_CONTENT:
20302032
return MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST;
2033+
case ID_M_KIOSK:
2034+
return MENU_ENUM_LABEL_VALUE_INPUT_META_KIOSK;
20312035
case ID_M_RESET:
20322036
return MENU_ENUM_LABEL_VALUE_RESTART_CONTENT;
20332037
case ID_M_QUIT:
@@ -2068,6 +2072,8 @@ static unsigned int menu_id_to_meta_key(unsigned int menu_id)
20682072
{
20692073
switch (menu_id)
20702074
{
2075+
case ID_M_KIOSK:
2076+
return RARCH_KIOSK_MODE;
20712077
case ID_M_RESET:
20722078
return RARCH_RESET;
20732079
case ID_M_QUIT:

input/input_defines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ enum
126126
RARCH_MENU_TOGGLE,
127127
RARCH_QUIT_KEY,
128128
RARCH_CLOSE_CONTENT_KEY,
129+
RARCH_KIOSK_MODE,
129130
RARCH_RESET,
130131
RARCH_FAST_FORWARD_KEY,
131132
RARCH_FAST_FORWARD_HOLD_KEY,

intl/msg_hash_us.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16111,6 +16111,14 @@ MSG_HASH(
1611116111
MENU_ENUM_LABEL_VALUE_PAL60_ENABLE,
1611216112
"Use PAL60 Mode"
1611316113
)
16114+
MSG_HASH(
16115+
MENU_ENUM_LABEL_VALUE_INPUT_META_KIOSK,
16116+
"Kiosk Mode (Toggle)"
16117+
)
16118+
MSG_HASH(
16119+
MENU_ENUM_SUBLABEL_INPUT_META_KIOSK,
16120+
"Toggles Kiosk Mode."
16121+
)
1611416122
MSG_HASH(
1611516123
MENU_ENUM_LABEL_VALUE_INPUT_META_RESTART_KEY,
1611616124
"Restart RetroArch"

media/rarch.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ IDR_MENU MENU
4747
MENUITEM "Load State", ID_M_LOAD_STATE
4848
MENUITEM "Save State", ID_M_SAVE_STATE
4949
}
50+
MENUITEM "Kiosk", ID_M_KIOSK
5051
MENUITEM "Reset", ID_M_RESET
5152
MENUITEM "Pause Toggle", ID_M_PAUSE_TOGGLE
5253
MENUITEM "Menu Toggle", ID_M_MENU_TOGGLE

menu/drivers/xmb.c

Lines changed: 109 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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

478482
static 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+
87908846
static 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 */

menu/menu_displaylist.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9578,8 +9578,8 @@ unsigned menu_displaylist_build_list(
95789578
build_list[i].checked = settings->bools.settings_show_file_browser;
95799579
break;
95809580
case MENU_ENUM_LABEL_MENU_KIOSK_MODE_PASSWORD:
9581-
if (kiosk_mode_enable)
9582-
build_list[i].checked = true;
9581+
/* Kiosk Mode Fix - Always show Kiosk Password Settings Option */
9582+
build_list[i].checked = true;
95839583
break;
95849584
case MENU_ENUM_LABEL_MENU_SCREENSAVER_TIMEOUT:
95859585
if (menu_screensaver_supported)
@@ -15407,6 +15407,20 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
1540715407
#endif
1540815408

1540915409
info->flags |= MD_FLAG_NEED_PUSH;
15410+
/* Kiosk Mode Fix - Add empty entry if list is empty */
15411+
if(info->list->size <= 0 || settings->bools.kiosk_mode_enable)
15412+
{
15413+
menu_entries_clear(info->list);
15414+
menu_entries_append(info->list,
15415+
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS),
15416+
msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS),
15417+
MENU_ENUM_LABEL_NO_ITEMS,
15418+
MENU_SETTING_NO_ITEM, 0, 0, NULL);
15419+
15420+
info->flags |= MD_FLAG_NEED_REFRESH
15421+
| MD_FLAG_NEED_PUSH;
15422+
break;
15423+
}
1541015424
}
1541115425
break;
1541215426
case DISPLAYLIST_HELP:

menu/menu_setting.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18591,7 +18591,8 @@ static bool setting_append_list(
1859118591
(*list)[list_info->index - 1].action_ok = setting_bool_action_left_with_refresh;
1859218592
(*list)[list_info->index - 1].action_left = setting_bool_action_left_with_refresh;
1859318593
(*list)[list_info->index - 1].action_right = setting_bool_action_right_with_refresh;
18594-
18594+
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_RESTART_RETROARCH);/* Kiosk Mode Fix - RESTART RETROARCH UPON SETTING KIOSK MODE!*/
18595+
1859518596
CONFIG_STRING(
1859618597
list, list_info,
1859718598
settings->paths.kiosk_mode_password,

0 commit comments

Comments
 (0)