mirror of
https://github.com/libretro/RetroArch
synced 2025-03-31 19:21:06 +00:00
(RMenu) Refactor g_extern.draw_menu
This commit is contained in:
parent
a6f04970a3
commit
3c8bb7333e
@ -73,6 +73,7 @@ enum
|
|||||||
MODE_INIT,
|
MODE_INIT,
|
||||||
MODE_MENU,
|
MODE_MENU,
|
||||||
MODE_MENU_PREINIT,
|
MODE_MENU_PREINIT,
|
||||||
|
MODE_MENU_DRAW,
|
||||||
MODE_EXIT,
|
MODE_EXIT,
|
||||||
MODE_LOAD_FIRST_SHADER,
|
MODE_LOAD_FIRST_SHADER,
|
||||||
MODE_LOAD_SECOND_SHADER,
|
MODE_LOAD_SECOND_SHADER,
|
||||||
|
@ -1935,13 +1935,18 @@ int ingame_menu_resize(void *data, void *state)
|
|||||||
if (input & (1ULL << RMENU_DEVICE_NAV_A))
|
if (input & (1ULL << RMENU_DEVICE_NAV_A))
|
||||||
{
|
{
|
||||||
menu_stack_pop();
|
menu_stack_pop();
|
||||||
g_extern.draw_menu = true;
|
g_extern.lifecycle_menu_state |= (1 << MODE_MENU_DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((input & (1ULL << RMENU_DEVICE_NAV_Y)))
|
if((input & (1ULL << RMENU_DEVICE_NAV_Y)))
|
||||||
g_extern.draw_menu = !g_extern.draw_menu;
|
{
|
||||||
|
if (g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW))
|
||||||
|
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU_DRAW);
|
||||||
|
else
|
||||||
|
g_extern.lifecycle_menu_state |= (1 << MODE_MENU_DRAW);
|
||||||
|
}
|
||||||
|
|
||||||
if(g_extern.draw_menu)
|
if(g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW))
|
||||||
{
|
{
|
||||||
char viewport_x[32], viewport_y[32], viewport_w[32], viewport_h[32];
|
char viewport_x[32], viewport_y[32], viewport_w[32], viewport_h[32];
|
||||||
char msg[256];
|
char msg[256];
|
||||||
@ -2024,14 +2029,14 @@ int ingame_menu_screenshot(void *data, void *state)
|
|||||||
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
|
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
|
||||||
filebrowser_t *filebrowser = NULL;
|
filebrowser_t *filebrowser = NULL;
|
||||||
|
|
||||||
g_extern.draw_menu = false;
|
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU_DRAW);
|
||||||
|
|
||||||
if(g_extern.console.rmenu.state.ingame_menu.enable)
|
if(g_extern.console.rmenu.state.ingame_menu.enable)
|
||||||
{
|
{
|
||||||
if(input & (1ULL << RMENU_DEVICE_NAV_A))
|
if(input & (1ULL << RMENU_DEVICE_NAV_A))
|
||||||
{
|
{
|
||||||
menu_stack_pop();
|
menu_stack_pop();
|
||||||
g_extern.draw_menu = true;
|
g_extern.lifecycle_menu_state |= (1 << MODE_MENU_DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(input & (1ULL << RMENU_DEVICE_NAV_B))
|
if(input & (1ULL << RMENU_DEVICE_NAV_B))
|
||||||
@ -2424,10 +2429,8 @@ bool rmenu_iterate(void)
|
|||||||
menu_stack_push(INGAME_MENU);
|
menu_stack_push(INGAME_MENU);
|
||||||
|
|
||||||
menu_stack_force_refresh();
|
menu_stack_force_refresh();
|
||||||
g_extern.draw_menu = true;
|
g_extern.lifecycle_menu_state |= (1 << MODE_MENU_DRAW);
|
||||||
|
|
||||||
device_ptr->ctx_driver->rmenu_init();
|
device_ptr->ctx_driver->rmenu_init();
|
||||||
|
|
||||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU_PREINIT);
|
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU_PREINIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2438,7 +2441,7 @@ bool rmenu_iterate(void)
|
|||||||
rmenu_default_positions_t default_pos;
|
rmenu_default_positions_t default_pos;
|
||||||
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
|
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
|
||||||
|
|
||||||
if (g_extern.draw_menu)
|
if (g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW))
|
||||||
device_ptr->ctx_driver->set_blend(true);
|
device_ptr->ctx_driver->set_blend(true);
|
||||||
|
|
||||||
rarch_render_cached_frame();
|
rarch_render_cached_frame();
|
||||||
@ -2484,7 +2487,7 @@ bool rmenu_iterate(void)
|
|||||||
frame_count = 0;
|
frame_count = 0;
|
||||||
device_ptr->ctx_driver->check_window(&quit, &resize, &width, &height, frame_count);
|
device_ptr->ctx_driver->check_window(&quit, &resize, &width, &height, frame_count);
|
||||||
|
|
||||||
if (g_extern.draw_menu)
|
if (g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW))
|
||||||
device_ptr->ctx_driver->set_blend(false);
|
device_ptr->ctx_driver->set_blend(false);
|
||||||
|
|
||||||
if (quit)
|
if (quit)
|
||||||
@ -2506,7 +2509,7 @@ deinit:
|
|||||||
if(g_extern.console.rmenu.state.ingame_menu.enable)
|
if(g_extern.console.rmenu.state.ingame_menu.enable)
|
||||||
menu_stack_pop();
|
menu_stack_pop();
|
||||||
|
|
||||||
g_extern.draw_menu = false;
|
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU_DRAW);
|
||||||
g_extern.console.rmenu.state.ingame_menu.enable = false;
|
g_extern.console.rmenu.state.ingame_menu.enable = false;
|
||||||
|
|
||||||
device_ptr->ctx_driver->rmenu_free();
|
device_ptr->ctx_driver->rmenu_free();
|
||||||
|
@ -171,7 +171,7 @@ bool rmenu_iterate(void)
|
|||||||
static bool initial_held = true;
|
static bool initial_held = true;
|
||||||
static bool first_held = false;
|
static bool first_held = false;
|
||||||
|
|
||||||
g_extern.draw_menu = true;
|
g_extern.lifecycle_menu_state |= (1 << MODE_MENU_DRAW);
|
||||||
driver.video->apply_state_changes();
|
driver.video->apply_state_changes();
|
||||||
|
|
||||||
g_extern.frame_count++;
|
g_extern.frame_count++;
|
||||||
@ -265,7 +265,7 @@ deinit:
|
|||||||
if (!(g_extern.lifecycle_state & (1ULL << RARCH_FRAMEADVANCE)))
|
if (!(g_extern.lifecycle_state & (1ULL << RARCH_FRAMEADVANCE)))
|
||||||
g_extern.delay_timer[0] = g_extern.frame_count + 30;
|
g_extern.delay_timer[0] = g_extern.frame_count + 30;
|
||||||
|
|
||||||
g_extern.draw_menu = false;
|
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU_DRAW);
|
||||||
g_extern.console.rmenu.state.ingame_menu.enable = false;
|
g_extern.console.rmenu.state.ingame_menu.enable = false;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -1171,8 +1171,7 @@ bool rmenu_iterate(void)
|
|||||||
if (g_extern.lifecycle_menu_state & (1 << MODE_MENU_PREINIT))
|
if (g_extern.lifecycle_menu_state & (1 << MODE_MENU_PREINIT))
|
||||||
{
|
{
|
||||||
g_extern.console.rmenu.input_loop = INPUT_LOOP_MENU;
|
g_extern.console.rmenu.input_loop = INPUT_LOOP_MENU;
|
||||||
g_extern.draw_menu = true;
|
g_extern.lifecycle_menu_state |= (1 << MODE_MENU_DRAW);
|
||||||
|
|
||||||
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU_PREINIT);
|
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU_PREINIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1239,7 +1238,7 @@ deinit:
|
|||||||
g_extern.delay_timer[0] = g_extern.frame_count + 30;
|
g_extern.delay_timer[0] = g_extern.frame_count + 30;
|
||||||
|
|
||||||
g_extern.console.rmenu.state.ingame_menu.enable = false;
|
g_extern.console.rmenu.state.ingame_menu.enable = false;
|
||||||
g_extern.draw_menu = false;
|
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU_DRAW);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -378,10 +378,9 @@ static void system_process_args(int argc, char *argv[])
|
|||||||
rarch_console_load_game_wrap(rom, g_extern.file_state.zip_extract_mode);
|
rarch_console_load_game_wrap(rom, g_extern.file_state.zip_extract_mode);
|
||||||
|
|
||||||
rgui_iterate(rgui, RGUI_ACTION_MESSAGE);
|
rgui_iterate(rgui, RGUI_ACTION_MESSAGE);
|
||||||
g_extern.draw_menu = true;
|
g_extern.lifecycle_menu_state |= (1 << MODE_MENU_DRAW);
|
||||||
rarch_render_cached_frame();
|
rarch_render_cached_frame();
|
||||||
g_extern.draw_menu = false;
|
g_extern.lifecycle_menu_state &= ~(1 << MODE_MENU_DRAW);
|
||||||
|
|
||||||
g_extern.lifecycle_menu_state = (1 << MODE_INIT);
|
g_extern.lifecycle_menu_state = (1 << MODE_INIT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -562,7 +562,6 @@ struct global
|
|||||||
#endif
|
#endif
|
||||||
} console;
|
} console;
|
||||||
|
|
||||||
bool draw_menu;
|
|
||||||
uint64_t lifecycle_state;
|
uint64_t lifecycle_state;
|
||||||
uint32_t lifecycle_menu_state;
|
uint32_t lifecycle_menu_state;
|
||||||
|
|
||||||
|
2
gfx/gl.c
2
gfx/gl.c
@ -1285,7 +1285,7 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
|
|||||||
RARCH_PERFORMANCE_STOP(frame_run);
|
RARCH_PERFORMANCE_STOP(frame_run);
|
||||||
|
|
||||||
#ifdef HAVE_RMENU
|
#ifdef HAVE_RMENU
|
||||||
if (g_extern.draw_menu)
|
if (g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW))
|
||||||
context_rmenu_frame_func(gl);
|
context_rmenu_frame_func(gl);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -333,7 +333,7 @@ static void gx_input_poll(void *data)
|
|||||||
*state_cur |= GX_QUIT_KEY;
|
*state_cur |= GX_QUIT_KEY;
|
||||||
|
|
||||||
//TODO: Hack, analog stick twitchiness needs to be properly fixed
|
//TODO: Hack, analog stick twitchiness needs to be properly fixed
|
||||||
if(g_extern.draw_menu)
|
if(g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW))
|
||||||
{
|
{
|
||||||
s8 x = gx_stick_x(exp->classic.ljs);
|
s8 x = gx_stick_x(exp->classic.ljs);
|
||||||
s8 y = gx_stick_y(exp->classic.ljs);
|
s8 y = gx_stick_y(exp->classic.ljs);
|
||||||
|
@ -303,7 +303,7 @@ static void init_texture(unsigned width, unsigned height)
|
|||||||
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
||||||
unsigned g_filter = g_settings.video.smooth ? GX_LINEAR : GX_NEAR;
|
unsigned g_filter = g_settings.video.smooth ? GX_LINEAR : GX_NEAR;
|
||||||
|
|
||||||
GX_InitTexObj(&g_tex.obj, g_tex.data, width, height, (gx->rgb32) ? GX_TF_RGBA8 : (g_extern.draw_menu) ? GX_TF_RGB5A3 : GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
GX_InitTexObj(&g_tex.obj, g_tex.data, width, height, (gx->rgb32) ? GX_TF_RGBA8 : (g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW)) ? GX_TF_RGB5A3 : GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||||
GX_InitTexObjLOD(&g_tex.obj, g_filter, g_filter, 0, 0, 0, GX_TRUE, GX_FALSE, GX_ANISO_1);
|
GX_InitTexObjLOD(&g_tex.obj, g_filter, g_filter, 0, 0, 0, GX_TRUE, GX_FALSE, GX_ANISO_1);
|
||||||
GX_InitTexObj(&menu_tex.obj, menu_tex.data, RGUI_WIDTH, RGUI_HEIGHT, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
GX_InitTexObj(&menu_tex.obj, menu_tex.data, RGUI_WIDTH, RGUI_HEIGHT, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||||
GX_InitTexObjLOD(&menu_tex.obj, g_filter, g_filter, 0, 0, 0, GX_TRUE, GX_FALSE, GX_ANISO_1);
|
GX_InitTexObjLOD(&menu_tex.obj, g_filter, g_filter, 0, 0, 0, GX_TRUE, GX_FALSE, GX_ANISO_1);
|
||||||
@ -876,7 +876,7 @@ static bool gx_frame(void *data, const void *frame,
|
|||||||
else
|
else
|
||||||
gx->msg[0] = 0;
|
gx->msg[0] = 0;
|
||||||
|
|
||||||
if(!frame && !g_extern.draw_menu)
|
if(!frame && !(g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!frame)
|
if (!frame)
|
||||||
@ -888,7 +888,7 @@ static bool gx_frame(void *data, const void *frame,
|
|||||||
clear_efb = GX_TRUE;
|
clear_efb = GX_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((g_vsync || g_extern.draw_menu) && !g_draw_done)
|
while ((g_vsync || (g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW))) && !g_draw_done)
|
||||||
LWP_ThreadSleep(g_video_cond);
|
LWP_ThreadSleep(g_video_cond);
|
||||||
|
|
||||||
if (width != gx_old_width || height != gx_old_height)
|
if (width != gx_old_width || height != gx_old_height)
|
||||||
@ -905,14 +905,14 @@ static bool gx_frame(void *data, const void *frame,
|
|||||||
{
|
{
|
||||||
if (gx->rgb32)
|
if (gx->rgb32)
|
||||||
convert_texture32(frame, g_tex.data, width, height, pitch);
|
convert_texture32(frame, g_tex.data, width, height, pitch);
|
||||||
else if (g_extern.draw_menu)
|
else if (g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW))
|
||||||
convert_texture16_conv(frame, g_tex.data, width, height, pitch);
|
convert_texture16_conv(frame, g_tex.data, width, height, pitch);
|
||||||
else
|
else
|
||||||
convert_texture16(frame, g_tex.data, width, height, pitch);
|
convert_texture16(frame, g_tex.data, width, height, pitch);
|
||||||
DCFlushRange(g_tex.data, height * (width << (gx->rgb32 ? 2 : 1)));
|
DCFlushRange(g_tex.data, height * (width << (gx->rgb32 ? 2 : 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_extern.draw_menu)
|
if (g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW))
|
||||||
{
|
{
|
||||||
convert_texture16(gx->menu_data, menu_tex.data, RGUI_WIDTH, RGUI_HEIGHT, RGUI_WIDTH * 2);
|
convert_texture16(gx->menu_data, menu_tex.data, RGUI_WIDTH, RGUI_HEIGHT, RGUI_WIDTH * 2);
|
||||||
DCFlushRange(menu_tex.data, RGUI_WIDTH * RGUI_HEIGHT * 2);
|
DCFlushRange(menu_tex.data, RGUI_WIDTH * RGUI_HEIGHT * 2);
|
||||||
@ -927,7 +927,7 @@ static bool gx_frame(void *data, const void *frame,
|
|||||||
GX_DrawDone();
|
GX_DrawDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g_extern.draw_menu)
|
if(g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW))
|
||||||
{
|
{
|
||||||
GX_LoadTexObj(&menu_tex.obj, GX_TEXMAP0);
|
GX_LoadTexObj(&menu_tex.obj, GX_TEXMAP0);
|
||||||
GX_CallDispList(display_list, display_list_size);
|
GX_CallDispList(display_list, display_list_size);
|
||||||
|
@ -895,7 +895,7 @@ static bool xdk_d3d_frame(void *data, const void *frame,
|
|||||||
if (msg)
|
if (msg)
|
||||||
d3d->font_ctx->render_msg_place(d3d, msg_width, msg_height, 0.0f, 0, msg);
|
d3d->font_ctx->render_msg_place(d3d, msg_width, msg_height, 0.0f, 0, msg);
|
||||||
|
|
||||||
if (g_extern.draw_menu)
|
if (g_extern.lifecycle_menu_state & (1 << MODE_MENU_DRAW))
|
||||||
{
|
{
|
||||||
#ifdef _XBOX360
|
#ifdef _XBOX360
|
||||||
app.Render();
|
app.Render();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user