diff --git a/command.c b/command.c index 21cf34109a..04195bfe5b 100644 --- a/command.c +++ b/command.c @@ -1878,7 +1878,7 @@ bool command_event(enum event_command cmd, void *data) return command_event_resize_windowed_scale(); case CMD_EVENT_MENU_TOGGLE: #ifdef HAVE_MENU - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL); else rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL); @@ -1969,7 +1969,7 @@ bool command_event(enum event_command cmd, void *data) command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, (void*)(intptr_t)-1); #ifdef HAVE_MENU menu_display_set_framebuffer_dirty_flag(); - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL); #endif break; @@ -2382,7 +2382,7 @@ bool command_event(enum event_command cmd, void *data) #ifdef HAVE_MENU settings_t *settings = config_get_ptr(); - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { if (settings->menu.pause_libretro) command_event(CMD_EVENT_AUDIO_STOP, NULL); diff --git a/gfx/common/win32_common.cpp b/gfx/common/win32_common.cpp index 5af34e5fe8..21d578d48f 100644 --- a/gfx/common/win32_common.cpp +++ b/gfx/common/win32_common.cpp @@ -542,7 +542,7 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, HDC hdc = BeginPaint(hwnd, &ps); #ifdef HAVE_MENU - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) && !gdi_has_menu_frame()) + if (menu_driver_is_alive() && !gdi_has_menu_frame()) { RECT rect; GetClientRect(hwnd, &rect); diff --git a/gfx/video_driver.c b/gfx/video_driver.c index e682147593..5211b90ab9 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -2291,7 +2291,7 @@ void video_driver_build_info(video_frame_info_t *video_info) video_info->libretro_running = false; #ifdef HAVE_MENU - video_info->menu_is_alive = menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL); + video_info->menu_is_alive = menu_driver_is_alive(); video_info->menu_footer_opacity = settings->menu.footer.opacity; video_info->menu_header_opacity = settings->menu.header.opacity; video_info->materialui_color_theme = settings->menu.materialui.menu_color_theme; diff --git a/input/drivers_joypad/ps3_joypad.c b/input/drivers_joypad/ps3_joypad.c index 1cd6aaab6f..35fc7dadc9 100644 --- a/input/drivers_joypad/ps3_joypad.c +++ b/input/drivers_joypad/ps3_joypad.c @@ -181,7 +181,7 @@ static void ps3_joypad_poll(void) *state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_X) : 0; *state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_SQUARE) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_Y) : 0; - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { int value = 0; if (cellSysutilGetSystemParamInt(CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN, &value) == 0) diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c index dcc802bd67..757c536b98 100644 --- a/input/drivers_joypad/psp_joypad.c +++ b/input/drivers_joypad/psp_joypad.c @@ -250,7 +250,7 @@ static void psp_joypad_poll(void) #endif #if defined(VITA) if (psp2_model == SCE_KERNEL_MODEL_VITA - && !menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) + && !menu_driver_is_alive() && settings->input.backtouch_enable) { unsigned i; diff --git a/input/input_overlay.c b/input/input_overlay.c index cc000042b5..3a04b2738c 100644 --- a/input/input_overlay.c +++ b/input/input_overlay.c @@ -487,7 +487,7 @@ void input_overlay_loaded(void *task_data, void *user_data, const char *err) #ifdef HAVE_MENU /* We can't display when the menu is up */ - if (data->hide_in_menu && menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (data->hide_in_menu && menu_driver_is_alive()) { if (data->overlay_enable) goto abort_load; diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 7a7175adad..9ddfeaea23 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -415,7 +415,7 @@ static void rgui_render(void *data) msg_force = menu_display_get_msg_force(); if (menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL) - && menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) && !msg_force) + && menu_driver_is_alive() && !msg_force) return; if (runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) diff --git a/menu/drivers/xui.cpp b/menu/drivers/xui.cpp index 0d2c89ca62..0d733de233 100644 --- a/menu/drivers/xui.cpp +++ b/menu/drivers/xui.cpp @@ -539,7 +539,7 @@ static void xui_render(void *data) if ( menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL) - && menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) + && menu_driver_is_alive() && !msg_force ) return; diff --git a/menu/menu_driver.c b/menu/menu_driver.c index abc6130bb9..5575af35e7 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -304,10 +304,7 @@ const char *menu_driver_ident(void) void menu_driver_frame(video_frame_info_t *video_info) { - if (!menu_driver_alive) - return; - - if (menu_driver_ctx->frame) + if (menu_driver_alive && menu_driver_ctx->frame) menu_driver_ctx->frame(menu_userdata, video_info); } @@ -376,6 +373,11 @@ bool menu_driver_render(bool is_idle) return true; } +bool menu_driver_is_alive(void) +{ + return menu_driver_alive; +} + bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) { switch (state) @@ -507,8 +509,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) case RARCH_MENU_CTL_UNSET_TOGGLE: menu_driver_toggle(false); break; - case RARCH_MENU_CTL_IS_ALIVE: - return menu_driver_alive; case RARCH_MENU_CTL_SET_OWN_DRIVER: menu_driver_data_own = true; break; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 5eafc3f88b..f67f3fc8d8 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -104,7 +104,6 @@ enum rarch_menu_ctl_state RARCH_MENU_CTL_IS_TOGGLE, RARCH_MENU_CTL_SET_TOGGLE, RARCH_MENU_CTL_UNSET_TOGGLE, - RARCH_MENU_CTL_IS_ALIVE, RARCH_MENU_CTL_DESTROY, RARCH_MENU_CTL_IS_SET_TEXTURE, RARCH_MENU_CTL_SET_OWN_DRIVER, @@ -392,6 +391,8 @@ void menu_driver_set_binding_state(bool on); void menu_driver_frame(video_frame_info_t *video_info); +bool menu_driver_is_alive(void); + extern menu_ctx_driver_t menu_ctx_xui; extern menu_ctx_driver_t menu_ctx_rgui; extern menu_ctx_driver_t menu_ctx_mui; diff --git a/retroarch.c b/retroarch.c index 786f0877c3..4c4da02cfb 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1080,7 +1080,7 @@ bool retroarch_main_init(int argc, char *argv[]) { #ifdef HAVE_MENU /* Check if menu was active prior to core initialization */ - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { /* Attempt initializing dummy core */ current_core_type = CORE_TYPE_DUMMY; diff --git a/runloop.c b/runloop.c index fb0bd6fd9b..f23fcaf096 100644 --- a/runloop.c +++ b/runloop.c @@ -706,7 +706,7 @@ static enum runloop_state runloop_check_state( if (runloop_cmd_triggered(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY)) { - bool fullscreen_toggled = !runloop_paused || menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL); + bool fullscreen_toggled = !runloop_paused || menu_driver_is_alive(); if (fullscreen_toggled) command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL); @@ -757,7 +757,7 @@ static enum runloop_state runloop_check_state( } #ifdef HAVE_MENU - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { menu_ctx_iterate_t iter; core_poll(); @@ -794,7 +794,7 @@ static enum runloop_state runloop_check_state( #ifdef HAVE_MENU if (menu_event_kb_is_set(RETROK_F1) == 1) { - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) @@ -808,7 +808,7 @@ static enum runloop_state runloop_check_state( runloop_cmd_triggered(trigger_input, RARCH_MENU_TOGGLE)) || rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) { - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) @@ -823,7 +823,7 @@ static enum runloop_state runloop_check_state( else menu_event_kb_set(false, RETROK_F1); - if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) + if (menu_driver_is_alive()) { if (!settings->menu.throttle_framerate && !settings->fastforward_ratio) return RUNLOOP_STATE_MENU_ITERATE; @@ -1043,7 +1043,7 @@ int runloop_iterate(unsigned *sleep_ms) settings_t *settings = config_get_ptr(); uint64_t old_input = last_input; #ifdef HAVE_MENU - bool menu_is_alive = menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL); + bool menu_is_alive = menu_driver_is_alive(); #else bool menu_is_alive = false; #endif