diff --git a/command_event.c b/command_event.c index 52aac1790c..6b69186e38 100644 --- a/command_event.c +++ b/command_event.c @@ -1091,9 +1091,15 @@ bool event_command(enum event_command cmd) input_driver_poll(); #ifdef HAVE_MENU - runloop->frames.video.current.menu.framebuf.dirty = true; - if (runloop->is_menu) - event_command(EVENT_CMD_VIDEO_SET_BLOCKING_STATE); + { + menu_handle_t *menu = menu_driver_get_ptr(); + + if (menu) + menu->framebuf.dirty = true; + + if (runloop->is_menu) + event_command(EVENT_CMD_VIDEO_SET_BLOCKING_STATE); + } #endif break; case EVENT_CMD_CHEATS_DEINIT: diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 8b11070d82..1bd95de93c 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -368,9 +368,8 @@ static void glui_frame(void) menu->navigation.selection_ptr, global->video_data.width, glui->line_height, 1, 1, 1, 0.1); - runloop->frames.video.current.menu.animation.is_active = true; - runloop->frames.video.current.menu.label.is_updated = false; - runloop->frames.video.current.menu.framebuf.dirty = false; + menu->animation_is_active = true; + menu->label.is_updated = false; glui_render_quad(gl, 0, 0, global->video_data.width, menu->header_height, 0.2, 0.2, 0.2, 1); diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 6e3d484f12..46b500ac76 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -356,9 +356,9 @@ static void rgui_render(void) return; /* ensures the framebuffer will be rendered on the screen */ - runloop->frames.video.current.menu.framebuf.dirty = true; - runloop->frames.video.current.menu.animation.is_active = false; - runloop->frames.video.current.menu.label.is_updated = false; + menu->framebuf.dirty = true; + menu->animation_is_active = false; + menu->label.is_updated = false; if (settings->menu.pointer.enable) { @@ -571,10 +571,10 @@ static void rgui_set_texture(void) if (!menu) return; - if (!runloop->frames.video.current.menu.framebuf.dirty) + if (!menu->framebuf.dirty) return; - runloop->frames.video.current.menu.framebuf.dirty = false; + menu->framebuf.dirty = false; video_driver_set_texture_frame( menu->frame_buf.data, false, diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index b97aa1bcb3..c2c898fcfd 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1164,9 +1164,8 @@ static void xmb_render(void) } } - runloop->frames.video.current.menu.animation.is_active = false; - runloop->frames.video.current.menu.label.is_updated = false; - runloop->frames.video.current.menu.framebuf.dirty = false; + menu->animation_is_active = false; + menu->label.is_updated = false; } static void xmb_frame(void) diff --git a/menu/menu.c b/menu/menu.c index 24b0058a28..8dbe601612 100644 --- a/menu/menu.c +++ b/menu/menu.c @@ -171,7 +171,7 @@ void *menu_init(const void *data) rarch_assert(menu->msg_queue = msg_queue_new(8)); - runloop->frames.video.current.menu.framebuf.dirty = true; + menu->framebuf.dirty = true; return menu; error: @@ -349,7 +349,7 @@ int menu_iterate(retro_input_t input, if (menu->cur_time - last_clock_update > 1000000 && settings->menu.timedate_enable) { - runloop->frames.video.current.menu.label.is_updated = true; + menu->label.is_updated = true; last_clock_update = menu->cur_time; } diff --git a/menu/menu_animation.c b/menu/menu_animation.c index 42dcc9f338..d74605dc5b 100644 --- a/menu/menu_animation.c +++ b/menu/menu_animation.c @@ -439,7 +439,7 @@ bool menu_animation_update(animation_t *animation, float dt) { unsigned i; unsigned active_tweens = 0; - runloop_t *runloop = rarch_main_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); for(i = 0; i < animation->size; i++) menu_animation_iterate(&animation->list[i], dt, &active_tweens); @@ -450,7 +450,7 @@ bool menu_animation_update(animation_t *animation, float dt) return false; } - runloop->frames.video.current.menu.animation.is_active = true; + menu->animation_is_active = true; return true; } @@ -473,7 +473,7 @@ void menu_animation_ticker_line(char *buf, size_t len, uint64_t idx, unsigned phase_left_moving, phase_right_stop; unsigned left_offset, right_offset; size_t str_len = strlen(str); - runloop_t *runloop = rarch_main_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); if (str_len <= len) { @@ -514,5 +514,5 @@ void menu_animation_ticker_line(char *buf, size_t len, uint64_t idx, else strlcpy(buf, str + right_offset, len + 1); - runloop->frames.video.current.menu.animation.is_active = true; + menu->animation_is_active = true; } diff --git a/menu/menu_display.c b/menu/menu_display.c index 1aef01d8ad..7160b684bf 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -24,12 +24,10 @@ bool menu_display_update_pending(void) { - runloop_t *runloop = rarch_main_get_ptr(); - if (runloop) + menu_handle_t *menu = menu_driver_get_ptr(); + if (menu) { - if (runloop->frames.video.current.menu.animation.is_active || - runloop->frames.video.current.menu.label.is_updated || - runloop->frames.video.current.menu.framebuf.dirty) + if (menu->animation_is_active || menu->label.is_updated || menu->framebuf.dirty) return true; } return false; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 84898c03b9..5accef2e77 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -210,12 +210,29 @@ typedef struct unsigned idx; } keyboard; + struct + { + bool is_updated; + } label; + + struct + { + bool dirty; + } framebuf; + + struct + { + bool active; + } action; + rarch_setting_t *list_settings; animation_t *animation; + bool animation_is_active; content_playlist_t *db_playlist; char db_playlist_file[PATH_MAX_LENGTH]; database_info_handle_t *db; + } menu_handle_t; typedef struct menu_file_list_cbs diff --git a/menu/menu_entries_cbs_representation.c b/menu/menu_entries_cbs_representation.c index c480b7dd04..ee7eb25683 100644 --- a/menu/menu_entries_cbs_representation.c +++ b/menu/menu_entries_cbs_representation.c @@ -388,10 +388,10 @@ static void menu_action_setting_disp_set_label_perf_counters( const char *path, char *path_buf, size_t path_buf_size) { + menu_handle_t *menu = menu_driver_get_ptr(); const struct retro_perf_counter **counters = (const struct retro_perf_counter **)perf_counters_rarch; unsigned offset = type - MENU_SETTINGS_PERF_COUNTERS_BEGIN; - runloop_t *runloop = rarch_main_get_ptr(); *type_str = '\0'; *w = 19; @@ -412,7 +412,7 @@ static void menu_action_setting_disp_set_label_perf_counters( (unsigned long long)counters[offset]->call_cnt), (unsigned long long)counters[offset]->call_cnt); - runloop->frames.video.current.menu.label.is_updated = true; + menu->label.is_updated = true; } static void menu_action_setting_disp_set_label_libretro_perf_counters( @@ -424,10 +424,10 @@ static void menu_action_setting_disp_set_label_libretro_perf_counters( const char *path, char *path_buf, size_t path_buf_size) { + menu_handle_t *menu = menu_driver_get_ptr(); const struct retro_perf_counter **counters = (const struct retro_perf_counter **)perf_counters_libretro; unsigned offset = type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN; - runloop_t *runloop = rarch_main_get_ptr(); *type_str = '\0'; *w = 19; @@ -448,7 +448,7 @@ static void menu_action_setting_disp_set_label_libretro_perf_counters( (unsigned long long)counters[offset]->call_cnt), (unsigned long long)counters[offset]->call_cnt); - runloop->frames.video.current.menu.label.is_updated = true; + menu->label.is_updated = true; } static void menu_action_setting_disp_set_label_menu_more( diff --git a/menu/menu_entry.c b/menu/menu_entry.c index ee4be7f4cd..2c2312a141 100644 --- a/menu/menu_entry.c +++ b/menu/menu_entry.c @@ -359,7 +359,7 @@ int menu_entry_iterate(unsigned action) return -1; if (action != MENU_ACTION_NOOP || menu->need_refresh || menu_display_update_pending()) - runloop->frames.video.current.menu.framebuf.dirty = true; + menu->framebuf.dirty = true; cbs = (menu_file_list_cbs_t*)menu_list_get_last_stack_actiondata(menu_list); diff --git a/menu/menu_input.c b/menu/menu_input.c index 84b10e9b5c..9327b5825f 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -657,7 +657,7 @@ static int menu_input_mouse(unsigned *action) || menu->mouse.wheelup || menu->mouse.wheeldown || menu->mouse.hwheelup || menu->mouse.hwheeldown || menu->mouse.scrollup || menu->mouse.scrolldown) - runloop->frames.video.current.menu.animation.is_active = true; + menu->animation_is_active = true; return 0; } @@ -699,7 +699,7 @@ static int menu_input_pointer(unsigned *action) if (menu->pointer.pressed[0] || menu->pointer.oldpressed[0] || menu->pointer.back || menu->pointer.dragging || menu->pointer.dy != 0 || menu->pointer.dx != 0) - runloop->frames.video.current.menu.animation.is_active = true; + menu->animation_is_active = true; return 0; } diff --git a/runloop.h b/runloop.h index 2b325cea2c..1a3c4a9414 100644 --- a/runloop.h +++ b/runloop.h @@ -55,31 +55,6 @@ typedef struct runloop struct { unsigned max; - struct - { - struct - { - struct - { - bool is_updated; - } label; - - struct - { - bool is_active; - } animation; - - struct - { - bool dirty; - } framebuf; - - struct - { - bool active; - } action; - } menu; - } current; } video; struct diff --git a/settings.c b/settings.c index adf1989e0b..ce4e8ad49e 100644 --- a/settings.c +++ b/settings.c @@ -1145,7 +1145,14 @@ static void setting_get_string_representation_st_float_video_refresh_rate_auto(v snprintf(type_str, type_str_size, "%.3f Hz (%.1f%% dev, %u samples)", video_refresh_rate, 100.0 * deviation, sample_points); - runloop->frames.video.current.menu.label.is_updated = true; +#ifdef HAVE_MENU + { + menu_handle_t *menu = menu_driver_get_ptr(); + + if (menu) + menu->label.is_updated = true; + } +#endif } else strlcpy(type_str, "N/A", type_str_size);