diff --git a/console/rmenu/rmenu.c b/console/rmenu/rmenu.c index c9101a3e15..abd59b37a8 100644 --- a/console/rmenu/rmenu.c +++ b/console/rmenu/rmenu.c @@ -2108,15 +2108,19 @@ void menu_loop(void) context->init_textures(); + menu current_menu; + menu_stack_force_refresh(); + do { //first button input frame uint64_t input_state_first_frame = 0; uint64_t input_state = 0; static bool first_held = false; - menu *current_menu = menu_stack_get_current_ptr(); - rmenu_default_positions_t default_pos; + + menu_stack_get_current_ptr(¤t_menu); + context->set_default_pos(&default_pos); input_ptr.poll(NULL); @@ -2141,7 +2145,7 @@ void menu_loop(void) } bool analog_sticks_pressed = (input_state & (1 << RMENU_DEVICE_NAV_LEFT_ANALOG_L)) || (input_state & (1 << RMENU_DEVICE_NAV_RIGHT_ANALOG_L)) || (input_state & (1 << RMENU_DEVICE_NAV_UP_ANALOG_L)) || (input_state & (1 << RMENU_DEVICE_NAV_DOWN_ANALOG_L)) || (input_state & (1 << RMENU_DEVICE_NAV_LEFT_ANALOG_R)) || (input_state & (1 << RMENU_DEVICE_NAV_RIGHT_ANALOG_R)) || (input_state & (1 << RMENU_DEVICE_NAV_UP_ANALOG_R)) || (input_state & (1 << RMENU_DEVICE_NAV_DOWN_ANALOG_R)); - bool shoulder_buttons_pressed = ((input_state & (1 << RMENU_DEVICE_NAV_L2)) || (input_state & (1 << RMENU_DEVICE_NAV_R2))) && current_menu->category_id != CATEGORY_SETTINGS; + bool shoulder_buttons_pressed = ((input_state & (1 << RMENU_DEVICE_NAV_L2)) || (input_state & (1 << RMENU_DEVICE_NAV_R2))) && current_menu.category_id != CATEGORY_SETTINGS; bool do_held = analog_sticks_pressed || shoulder_buttons_pressed; if(do_held) @@ -2161,7 +2165,7 @@ void menu_loop(void) context->clear(); - if(!show_menu_screen || current_menu->enum_id == INGAME_MENU_SCREENSHOT) + if(!show_menu_screen || current_menu.enum_id == INGAME_MENU_SCREENSHOT) { context->render_menu_enable(false); } @@ -2175,10 +2179,10 @@ void menu_loop(void) filebrowser_t * fb = &browser; - switch(current_menu->enum_id) + switch(current_menu.enum_id) { case FILE_BROWSER_MENU: - select_rom(current_menu, trig_state); + select_rom(¤t_menu, trig_state); fb = &browser; break; case GENERAL_VIDEO_MENU: @@ -2188,14 +2192,14 @@ void menu_loop(void) case EMU_AUDIO_MENU: case PATH_MENU: case CONTROLS_MENU: - select_setting(current_menu, trig_state); + select_setting(¤t_menu, trig_state); break; case SHADER_CHOICE: case PRESET_CHOICE: case BORDER_CHOICE: case LIBRETRO_CHOICE: case INPUT_PRESET_CHOICE: - select_file(current_menu, trig_state); + select_file(¤t_menu, trig_state); fb = &tmpBrowser; break; case PATH_SAVESTATES_DIR_CHOICE: @@ -2205,22 +2209,22 @@ void menu_loop(void) #endif case PATH_SRAM_DIR_CHOICE: case PATH_SYSTEM_DIR_CHOICE: - select_directory(current_menu, trig_state); + select_directory(¤t_menu, trig_state); fb = &tmpBrowser; break; case INGAME_MENU: if(g_console.ingame_menu_enable) - ingame_menu(current_menu, trig_state); + ingame_menu(¤t_menu, trig_state); break; case INGAME_MENU_RESIZE: - ingame_menu_resize(current_menu, trig_state); + ingame_menu_resize(¤t_menu, trig_state); break; case INGAME_MENU_SCREENSHOT: - ingame_menu_screenshot(current_menu, trig_state); + ingame_menu_screenshot(¤t_menu, trig_state); break; } - switch(current_menu->category_id) + switch(current_menu.category_id) { case CATEGORY_FILEBROWSER: browser_render(fb); @@ -2270,7 +2274,7 @@ void menu_loop(void) context->swap_buffers(); - if(current_menu->enum_id == INGAME_MENU_RESIZE && (old_state & (1 << RMENU_DEVICE_NAV_Y)) || current_menu->enum_id == INGAME_MENU_SCREENSHOT) + if(current_menu.enum_id == INGAME_MENU_RESIZE && (old_state & (1 << RMENU_DEVICE_NAV_Y)) || current_menu.enum_id == INGAME_MENU_SCREENSHOT) { } else context->blend(false); diff --git a/console/rmenu/rmenu_stack.c b/console/rmenu/rmenu_stack.c index 6d8d39ca75..374cdfe853 100644 --- a/console/rmenu/rmenu_stack.c +++ b/console/rmenu/rmenu_stack.c @@ -16,30 +16,36 @@ #include "rmenu_stack.h" -menu menuStack[10]; -int stack_idx = 0; +static unsigned char menu_stack_enum_array[10]; +static unsigned stack_idx = 0; +static bool need_refresh = false; static void menu_stack_pop(void) { if(stack_idx > 0) + { stack_idx--; + need_refresh = true; + } } -menu *menu_stack_get_current_ptr (void) +static void menu_stack_force_refresh(void) { - return &menuStack[stack_idx]; + need_refresh = true; } static void menu_stack_push(unsigned menu_id) { - static bool first_push_do_not_increment = true; + menu_stack_enum_array[++stack_idx] = menu_id; + need_refresh = true; +} - if(!first_push_do_not_increment) - stack_idx++; - else - first_push_do_not_increment = false; +static void menu_stack_get_current_ptr(menu *current_menu) +{ + if(!need_refresh) + return; - menu *current_menu = menu_stack_get_current_ptr(); + unsigned menu_id = menu_stack_enum_array[stack_idx]; switch(menu_id) { @@ -185,4 +191,6 @@ static void menu_stack_push(unsigned menu_id) default: break; } + + need_refresh = false; } diff --git a/gfx/context/ps3_ctx.h b/gfx/context/ps3_ctx.h index f53a61d29f..7429916229 100644 --- a/gfx/context/ps3_ctx.h +++ b/gfx/context/ps3_ctx.h @@ -17,6 +17,8 @@ #ifndef _PS3_CTX_H #define _PS3_CTX_H +#include "../gl_common.h" + void gfx_ctx_get_available_resolutions (void); int gfx_ctx_check_resolution(unsigned resolution_id); float gfx_ctx_get_aspect_ratio(void); diff --git a/ps3/frontend/main.c b/ps3/frontend/main.c index acb748a2ad..0f69e3dac2 100644 --- a/ps3/frontend/main.c +++ b/ps3/frontend/main.c @@ -41,6 +41,7 @@ #include #include +#include "../../gfx/context/ps3_ctx.h" #include "../ps3_input.h" #include "../../gfx/gl_common.h" @@ -285,6 +286,7 @@ int main(int argc, char *argv[]) #endif video_gl.start(); + driver.video = &video_gl; #ifdef HAVE_OSKUTIL oskutil_init(&g_console.oskutil_handle, 0);