From e741cc77c6217d01d6e52bd120d0a456fd4a28f1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 10 Mar 2013 17:40:34 +0100 Subject: [PATCH] start/stop/restart ifdeffed for RARCH_CONSOLE instead of HAVE_RMENU - transfer of control bypasses initialization of variables in RGUI - issues fixed --- driver.h | 2 +- frontend/menu/rgui.c | 15 +++++++++------ gfx/context/ps3_ctx.c | 2 ++ gfx/gl.c | 8 ++++---- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/driver.h b/driver.h index 7e68248a42..33d715707d 100644 --- a/driver.h +++ b/driver.h @@ -250,7 +250,7 @@ typedef struct video_driver const char *ident; // Callbacks essentially useless on PC, but useful on consoles where the drivers are used for more stuff. -#if defined(RARCH_CONSOLE) +#ifdef RARCH_CONSOLE void (*start)(void); void (*stop)(void); void (*restart)(void); diff --git a/frontend/menu/rgui.c b/frontend/menu/rgui.c index 2d952f53ad..be634aa8a5 100644 --- a/frontend/menu/rgui.c +++ b/frontend/menu/rgui.c @@ -1646,13 +1646,17 @@ bool menu_iterate(void) static uint16_t old_input_state = 0; static bool initial_held = true; static bool first_held = false; + bool do_held; + int input_entry_ret, input_process_ret; + rgui_action_t action; + uint16_t input_state; g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_DRAW); device_ptr->should_resize = true; g_extern.frame_count++; - uint16_t input_state = 0; + input_state = 0; driver.input->poll(NULL); @@ -1705,7 +1709,7 @@ bool menu_iterate(void) #endif trigger_state = input_state & ~old_input_state; - bool do_held = (input_state & ((1ULL << GX_DEVICE_NAV_UP) | (1ULL << GX_DEVICE_NAV_DOWN) | (1ULL << GX_DEVICE_NAV_LEFT) | (1ULL << GX_DEVICE_NAV_RIGHT))) && !(input_state & ((1ULL << GX_DEVICE_NAV_MENU) | (1ULL << GX_DEVICE_NAV_QUIT))); + do_held = (input_state & ((1ULL << GX_DEVICE_NAV_UP) | (1ULL << GX_DEVICE_NAV_DOWN) | (1ULL << GX_DEVICE_NAV_LEFT) | (1ULL << GX_DEVICE_NAV_RIGHT))) && !(input_state & ((1ULL << GX_DEVICE_NAV_MENU) | (1ULL << GX_DEVICE_NAV_QUIT))); if(do_held) { @@ -1730,8 +1734,7 @@ bool menu_iterate(void) } old_input_state = input_state; - - rgui_action_t action = RGUI_ACTION_NOOP; + action = RGUI_ACTION_NOOP; // don't run anything first frame, only capture held inputs for old_input_state if (trigger_state & (1ULL << GX_DEVICE_NAV_UP)) @@ -1758,8 +1761,8 @@ bool menu_iterate(void) } #endif - int input_entry_ret = 0; - int input_process_ret = 0; + input_entry_ret = 0; + input_process_ret = 0; input_entry_ret = rgui_iterate(rgui, action); diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index 1b47053c51..7cff56dffb 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -251,10 +251,12 @@ void texture_image_border_load(const char *path) static bool gfx_ctx_rmenu_init(void) { +#ifdef HAVE_RMENU if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE)) return true; texture_image_border_load(g_extern.console.menu_texture_path); +#endif return true; } diff --git a/gfx/gl.c b/gfx/gl.c index c9d968be78..48cb3feee9 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -2021,7 +2021,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer) } #endif -#ifdef HAVE_RMENU +#ifdef RARCH_CONSOLE static void gl_get_poke_interface(void *data, const video_poke_interface_t **iface); static void gl_start(void) @@ -2046,17 +2046,17 @@ static void gl_start(void) gl_t *gl = (gl_t*)driver.video_data; gl_get_poke_interface(gl, &driver.video_poke); -#ifdef RARCH_CONSOLE // Comes too early for console - moved to gl_start gl->font_ctx = gl_font_init_first(gl, g_settings.video.font_path, g_settings.video.font_size); +#ifdef HAVE_FBO if (!g_settings.video.render_to_texture) gl_deinit_fbo(gl); #endif +#ifdef HAVE_RMENU context_get_available_resolutions_func(); -#ifdef HAVE_RMENU if (gl->ctx_driver->rmenu_init) context_rmenu_init_func(); #endif @@ -2315,7 +2315,7 @@ const video_driver_t video_gl = { gl_free, "gl", -#ifdef HAVE_RMENU +#ifdef RARCH_CONSOLE gl_start, gl_stop, gl_restart,