global,mainmenu: enable Quit if quitting is allowed in kiosk mode
This commit is contained in:
parent
139ac03d5c
commit
fc54f3f8ce
3 changed files with 19 additions and 5 deletions
14
src/global.c
14
src/global.c
|
@ -50,8 +50,20 @@ bool gamekeypressed(KeyIndex key) {
|
|||
|
||||
static SDL_atomic_t quitting;
|
||||
|
||||
static bool taisei_is_quit_forbidden(void) {
|
||||
return global.is_kiosk_mode && env_get("TAISEI_KIOSK_PREVENT_QUIT", true);
|
||||
}
|
||||
|
||||
bool taisei_is_quit_hidden(void) {
|
||||
#ifdef __EMSCRIPTEN__
|
||||
return true;
|
||||
#else
|
||||
return taisei_is_quit_forbidden();
|
||||
#endif
|
||||
}
|
||||
|
||||
void taisei_quit(void) {
|
||||
if(global.is_kiosk_mode && env_get("TAISEI_KIOSK_PREVENT_QUIT", true)) {
|
||||
if(taisei_is_quit_forbidden()) {
|
||||
log_info("Running in kiosk mode; exit request ignored");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -108,6 +108,7 @@ void init_global(CLIAction *cli);
|
|||
|
||||
void taisei_quit(void);
|
||||
bool taisei_quit_requested(void);
|
||||
bool taisei_is_quit_hidden(void);
|
||||
void taisei_commit_persistent_data(void);
|
||||
|
||||
// XXX: Move this somewhere?
|
||||
|
|
|
@ -127,10 +127,11 @@ MenuData* create_main_menu(void) {
|
|||
add_menu_entry(m, "Replays", menu_action_enter_replayview, NULL);
|
||||
add_menu_entry(m, "Media Room", menu_action_enter_media, NULL);
|
||||
add_menu_entry(m, "Options", menu_action_enter_options, NULL);
|
||||
#ifndef __EMSCRIPTEN__
|
||||
add_menu_entry(m, "Quit", global.is_kiosk_mode ? NULL : menu_action_close, NULL)->transition = TransFadeBlack;
|
||||
m->input = main_menu_input;
|
||||
#endif
|
||||
|
||||
if(!taisei_is_quit_hidden()) {
|
||||
add_menu_entry(m, "Quit", menu_action_close, NULL)->transition = TransFadeBlack;
|
||||
m->input = main_menu_input;
|
||||
}
|
||||
|
||||
stage_practice_entry = dynarray_get_ptr(&m->entries, stage_practice_idx);
|
||||
spell_practice_entry = dynarray_get_ptr(&m->entries, spell_practice_idx);
|
||||
|
|
Loading…
Reference in a new issue