From 00e605d9ba5030e53816556a1e0a802d94ad33e0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 25 Sep 2014 06:33:28 +0200 Subject: [PATCH] Take out MODE_MENu - and introduce g_extern.is_menu --- frontend/menu/disp/rgui.c | 4 ++-- frontend/menu/disp/rmenu.c | 3 +-- frontend/menu/disp/rmenu_xui.cpp | 3 +-- general.h | 2 +- gfx/d3d/d3d.cpp | 2 +- gfx/gl.c | 2 +- gfx/sdl2_gfx.c | 3 ++- input/ps3_input.c | 2 +- retroarch.c | 6 +++--- 9 files changed, 13 insertions(+), 14 deletions(-) diff --git a/frontend/menu/disp/rgui.c b/frontend/menu/disp/rgui.c index b3a060eb01..0ed3adee7a 100644 --- a/frontend/menu/disp/rgui.c +++ b/frontend/menu/disp/rgui.c @@ -281,8 +281,8 @@ static void rgui_render(void) size_t begin = 0; size_t end; - if (driver.menu->need_refresh && - (g_extern.lifecycle_state & (1ULL << MODE_MENU)) + if (driver.menu->need_refresh + && g_extern.is_menu && !driver.menu->msg_force) return; diff --git a/frontend/menu/disp/rmenu.c b/frontend/menu/disp/rmenu.c index 8bd8ade7f2..7f61a97607 100644 --- a/frontend/menu/disp/rmenu.c +++ b/frontend/menu/disp/rmenu.c @@ -134,8 +134,7 @@ static void rmenu_render(void) return; } - if (menu->need_refresh && - (g_extern.lifecycle_state & (1ULL << MODE_MENU)) + if (menu->need_refresh && g_extern.is_menu && !menu->msg_force) return; diff --git a/frontend/menu/disp/rmenu_xui.cpp b/frontend/menu/disp/rmenu_xui.cpp index 6c9f2b3fc4..5a7bf93105 100644 --- a/frontend/menu/disp/rmenu_xui.cpp +++ b/frontend/menu/disp/rmenu_xui.cpp @@ -372,8 +372,7 @@ static void rmenu_xui_render(void) unsigned menu_type = 0; if (!driver.menu || driver.menu->need_refresh && - (g_extern.lifecycle_state & (1ULL << MODE_MENU)) - && !driver.menu->msg_force) + g_extern.is_menu && !driver.menu->msg_force) return; begin = driver.menu->selection_ptr; diff --git a/general.h b/general.h index c75f5eb893..2e3a28bc4a 100644 --- a/general.h +++ b/general.h @@ -148,7 +148,6 @@ enum action_state enum menu_enums { MODE_NONE = 0, - MODE_MENU, MODE_MENU_WIDESCREEN, MODE_MENU_HD, MODE_EXTLAUNCH_MULTIMAN, @@ -635,6 +634,7 @@ struct global /* Pausing support. */ bool is_paused; bool is_oneshot; + bool is_menu; bool is_slowmotion; /* Turbo support. */ diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 9c1a9a7f9a..dc6f5a2658 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -1596,7 +1596,7 @@ static bool d3d_frame(void *data, const void *frame, #endif #ifdef HAVE_MENU - if (g_extern.lifecycle_state & (1ULL << MODE_MENU) + if (g_extern.is_menu && driver.menu_ctx && driver.menu_ctx->frame) driver.menu_ctx->frame(); diff --git a/gfx/gl.c b/gfx/gl.c index 51f64f03d4..d17c68d0b9 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1595,7 +1595,7 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei gl_set_prev_texture(gl, &tex_info); #if defined(HAVE_MENU) - if ((g_extern.lifecycle_state & (1ULL << MODE_MENU)) + if (g_extern.is_menu && driver.menu_ctx && driver.menu_ctx->frame) driver.menu_ctx->frame(); diff --git a/gfx/sdl2_gfx.c b/gfx/sdl2_gfx.c index 6de0e2e85e..bd45bce3ed 100644 --- a/gfx/sdl2_gfx.c +++ b/gfx/sdl2_gfx.c @@ -490,7 +490,8 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width, SDL_RenderCopyEx(vid->renderer, vid->frame.tex, NULL, NULL, vid->rotation, NULL, SDL_FLIP_NONE); #ifdef HAVE_MENU - if (g_extern.lifecycle_state & (1ULL << MODE_MENU) && driver.menu_ctx && driver.menu_ctx->frame) + if (g_extern.is_menu + && driver.menu_ctx && driver.menu_ctx->frame) driver.menu_ctx->frame(); #endif diff --git a/input/ps3_input.c b/input/ps3_input.c index 9eb184ac77..5371592eac 100644 --- a/input/ps3_input.c +++ b/input/ps3_input.c @@ -109,7 +109,7 @@ static void ps3_input_poll(void *data) *state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE) ? (1ULL << RETRO_DEVICE_ID_JOYPAD_X) : 0; *state_cur |= (state_tmp.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_SQUARE) ? (1ULL << RETRO_DEVICE_ID_JOYPAD_Y) : 0; - if (*lifecycle_state & (1ULL << MODE_MENU)) + if (g_extern.is_menu) { int value = 0; if (cellSysutilGetSystemParamInt(CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN, &value) == 0) diff --git a/retroarch.c b/retroarch.c index 808212d072..181ab229af 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2849,10 +2849,10 @@ void rarch_main_set_state(unsigned cmd) #endif break; case RARCH_ACTION_STATE_MENU_RUNNING: - g_extern.lifecycle_state |= (1ULL << MODE_MENU); + g_extern.is_menu = true; break; case RARCH_ACTION_STATE_MENU_RUNNING_FINISHED: - g_extern.lifecycle_state &= ~(1ULL << MODE_MENU); + g_extern.is_menu = false; break; case RARCH_ACTION_STATE_EXITSPAWN: g_extern.lifecycle_state |= (1ULL << MODE_EXITSPAWN); @@ -3232,7 +3232,7 @@ bool rarch_main_iterate(void) !driver.video->alive(driver.video_data)) return false; - if (g_extern.lifecycle_state & (1ULL << MODE_MENU)) + if (g_extern.is_menu) { if (!menu_iterate(input, old_input, trigger_input)) {