From 8ef9065c860988c27d5485550ef57243dbc18db5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 28 Sep 2021 10:27:00 +0200 Subject: [PATCH] Get rid of menu_driver_is_alive - we don't want these one/two-line getters/setters anymore --- gfx/drivers/ctr_gfx.c | 67 ++++++++++++------- gfx/drivers_context/drm_go2_ctx.c | 18 +++-- .../gfx_widget_load_content_animation.c | 2 +- input/drivers_joypad/ps3_joypad.c | 12 +++- menu/menu_driver.c | 6 -- retroarch.h | 2 - 6 files changed, 66 insertions(+), 41 deletions(-) diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index 81179c0ff0..f94ccbef1b 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -629,14 +629,16 @@ static void bottom_menu_control(void* data, bool lcd_bottom) ctr->refresh_bottom_menu = true; } - if (menu_driver_is_alive()) +#ifdef HAVE_MENU + if (menu_state_get_ptr()->alive) ctr->bottom_menu = CTR_BOTTOM_MENU_SELECT; else +#endif ctr->bottom_menu = CTR_BOTTOM_MENU_DEFAULT; if (ctr->prev_bottom_menu != ctr->bottom_menu) { - ctr->prev_bottom_menu = ctr->bottom_menu; + ctr->prev_bottom_menu = ctr->bottom_menu; ctr->refresh_bottom_menu = true; } } @@ -913,35 +915,46 @@ static void ctr_lcd_aptHook(APT_HookType hook, void* param) ctr->p3d_event_pending = false; } - if ((hook == APTHOOK_ONSUSPEND) && (ctr->video_mode == CTR_VIDEO_MODE_2D_400X240)) + switch (hook) { - memcpy(gfxTopRightFramebuffers[ctr->current_buffer_top], - gfxTopLeftFramebuffers[ctr->current_buffer_top], - 400 * 240 * 3); - GSPGPU_FlushDataCache(gfxTopRightFramebuffers[ctr->current_buffer_top], 400 * 240 * 3); + case APTHOOK_ONSUSPEND: + if (ctr->video_mode == CTR_VIDEO_MODE_2D_400X240) + { + memcpy(gfxTopRightFramebuffers[ctr->current_buffer_top], + gfxTopLeftFramebuffers[ctr->current_buffer_top], + 400 * 240 * 3); + GSPGPU_FlushDataCache(gfxTopRightFramebuffers[ctr->current_buffer_top], 400 * 240 * 3); + } + if (ctr->supports_parallax_disable) + ctr_set_parallax_layer(*(float*)0x1FF81080 != 0.0); + ctr_set_bottom_screen_enable(true, ctr->bottom_is_idle); + save_state_to_file(ctr); + break; + case APTHOOK_ONRESTORE: + case APTHOOK_ONWAKEUP: + ctr_set_bottom_screen_enable(false, ctr->bottom_is_idle); + save_state_to_file(ctr); + break; + default: + break; } - if ((hook == APTHOOK_ONSUSPEND) && ctr->supports_parallax_disable) - ctr_set_parallax_layer(*(float*)0x1FF81080 != 0.0); - - if ((hook == APTHOOK_ONSUSPEND) || (hook == APTHOOK_ONRESTORE) || (hook == APTHOOK_ONWAKEUP)) - { - ctr_set_bottom_screen_enable(hook == APTHOOK_ONSUSPEND, ctr->bottom_is_idle); - - save_state_to_file(ctr); - } - if (menu_driver_is_alive()) - { +#ifdef HAVE_MENU + if (menu_state_get_ptr()->alive) return; - } - else if ((hook == APTHOOK_ONSUSPEND) || (hook == APTHOOK_ONSLEEP)) +#endif + + switch (hook) { - command_event(CMD_EVENT_AUDIO_STOP, NULL); - } - else if ((hook == APTHOOK_ONRESTORE) || (hook == APTHOOK_ONWAKEUP)) - { - command_event(CMD_EVENT_AUDIO_START, NULL); + case APTHOOK_ONSUSPEND: + case APTHOOK_ONSLEEP: + command_event(CMD_EVENT_AUDIO_STOP, NULL); + break; + case APTHOOK_ONRESTORE: + case APTHOOK_ONWAKEUP: + command_event(CMD_EVENT_AUDIO_START, NULL); + break; } } @@ -949,11 +962,13 @@ static void ctr_vsync_hook(ctr_video_t* ctr) { ctr->vsync_event_pending = false; } + #ifndef HAVE_THREADS static bool ctr_tasks_finder(retro_task_t *task,void *userdata) { return task; } + task_finder_data_t ctr_tasks_finder_data = {ctr_tasks_finder, NULL}; #endif @@ -1528,7 +1543,9 @@ static bool ctr_frame(void* data, const void* frame, } ctr->msg_rendering_enabled = true; +#ifdef HAVE_MENU menu_driver_frame(menu_is_alive, video_info); +#endif ctr->msg_rendering_enabled = false; } else if (statistics_show) diff --git a/gfx/drivers_context/drm_go2_ctx.c b/gfx/drivers_context/drm_go2_ctx.c index 9457ddb0f0..b758137703 100644 --- a/gfx/drivers_context/drm_go2_ctx.c +++ b/gfx/drivers_context/drm_go2_ctx.c @@ -34,6 +34,10 @@ #include #include +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + #include #include "../../configuration.h" @@ -48,8 +52,8 @@ #include "../common/egl_common.h" #endif -#ifdef HAVE_CONFIG_H -#include "../../config.h" +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" #endif #ifdef HAVE_OPENGLES @@ -214,10 +218,8 @@ static bool gfx_ctx_go2_drm_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) { - settings_t *settings = config_get_ptr(); struct retro_system_av_info *av_info = NULL; gfx_ctx_go2_drm_data_t *drm = (gfx_ctx_go2_drm_data_t*)data; - bool use_ctx_scaling = settings->bools.video_ctx_scaling; if (!drm) return false; @@ -226,12 +228,14 @@ static bool gfx_ctx_go2_drm_set_video_mode(void *data, frontend_driver_install_signal_handler(); - if (use_ctx_scaling && !menu_driver_is_alive()) +#ifdef HAVE_MENU + if (config_get_ptr()->bools.video_ctx_scaling && !menu_state_get_ptr()->alive) { drm->fb_width = av_info->geometry.base_width; drm->fb_height = av_info->geometry.base_height; } else +#endif { drm->fb_width = drm->native_width; drm->fb_height = drm->native_height; @@ -270,10 +274,11 @@ static void gfx_ctx_go2_drm_check_window(void *data, bool *quit, unsigned h; gfx_ctx_go2_drm_data_t *drm = (gfx_ctx_go2_drm_data_t*)data; +#ifdef HAVE_MENU settings_t *settings = config_get_ptr(); bool use_ctx_scaling = settings->bools.video_ctx_scaling; - if (use_ctx_scaling && !menu_driver_is_alive()) + if (use_ctx_scaling && !menu_state_get_ptr()->alive) { struct retro_system_av_info* av_info = video_viewport_get_system_av_info(); @@ -281,6 +286,7 @@ static void gfx_ctx_go2_drm_check_window(void *data, bool *quit, h = av_info->geometry.base_height; } else +#endif { w = drm->native_width; h = drm->native_height; diff --git a/gfx/widgets/gfx_widget_load_content_animation.c b/gfx/widgets/gfx_widget_load_content_animation.c index 8ee0824cbb..290bc4b1f5 100644 --- a/gfx/widgets/gfx_widget_load_content_animation.c +++ b/gfx/widgets/gfx_widget_load_content_animation.c @@ -662,7 +662,7 @@ static void gfx_widget_load_content_animation_frame(void *data, void *user_data) #ifdef HAVE_MENU /* Draw nothing if menu is currently active */ - if (menu_driver_is_alive()) + if (menu_state_get_ptr()->alive) return; #endif diff --git a/input/drivers_joypad/ps3_joypad.c b/input/drivers_joypad/ps3_joypad.c index 64edd899d7..48975b98e5 100644 --- a/input/drivers_joypad/ps3_joypad.c +++ b/input/drivers_joypad/ps3_joypad.c @@ -17,8 +17,16 @@ #include #include +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + #include "../../config.def.h" +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif + #include "../../tasks/tasks_internal.h" /* TODO/FIXME - static globals */ @@ -201,7 +209,8 @@ 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_is_alive()) +#ifdef HAVE_MENU + if (menu_state_get_ptr()->alive) { int value = 0; if (cellSysutilGetSystemParamInt(CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN, &value) == 0) @@ -213,6 +222,7 @@ static void ps3_joypad_poll(void) } } else +#endif { *state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_CROSS) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_B) : 0; *state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_CIRCLE) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_A) : 0; diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 9611bbe0a3..0f0bc84f30 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -5268,9 +5268,3 @@ const char *menu_driver_ident(void) return menu_st->driver_ctx->ident; return NULL; } - -/* Checks if the menu is still running */ -bool menu_driver_is_alive(void) -{ - return menu_driver_state.alive; -} diff --git a/retroarch.h b/retroarch.h index bd8aacdfbb..1ebce6a3f9 100644 --- a/retroarch.h +++ b/retroarch.h @@ -824,8 +824,6 @@ extern camera_driver_t camera_avfoundation; **/ const char* config_get_camera_driver_options(void); -bool menu_driver_is_alive(void); - bool gfx_widgets_ready(void); unsigned int retroarch_get_rotation(void);