Get rid of menu_driver_is_alive - we don't want these one/two-line getters/setters anymore

This commit is contained in:
twinaphex 2021-09-28 10:27:00 +02:00
parent e31fbb8048
commit 8ef9065c86
6 changed files with 66 additions and 41 deletions

View File

@ -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)

View File

@ -34,6 +34,10 @@
#include <libdrm/drm.h>
#include <gbm.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#include <string/stdstring.h>
#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;

View File

@ -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

View File

@ -17,8 +17,16 @@
#include <stdint.h>
#include <retro_inline.h>
#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;

View File

@ -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;
}

View File

@ -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);