/** * menu_iterate: * @input : input sample for this frame * @old_input : input sample of the previous frame * @trigger_input : difference' input sample - difference * between 'input' and 'old_input' * * Runs RetroArch menu for one frame. * * Returns: 0 on success, -1 if we need to quit out of the loop. **/ int menu_iterate(retro_input_t input, retro_input_t old_input, retro_input_t trigger_input) { int32_t ret = 0; unsigned action = 0; runloop_t *runloop = rarch_main_get_ptr(); menu_display_t *disp = menu_display_get_ptr(); menu_input_t *menu_input = menu_input_get_ptr(); menu_animation_update_time(disp->animation); menu_input->joypad.state = menu_input_frame(input, trigger_input); action = menu_input->joypad.state; ret = menu_entry_iterate(action); if (menu_driver_alive() && !runloop->is_idle) menu_display_fb(); menu_driver_set_texture(); if (ret) return -1; return 0; }
int menu_iterate_render(void) { bool is_idle; const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr(); if (!menu) return -1; if (BIT64_GET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER) != BIT64_GET(menu->state, MENU_STATE_RENDER_MESSAGEBOX)) BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER); if (BIT64_GET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER)) menu_display_ctl(MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG, NULL); if (BIT64_GET(menu->state, MENU_STATE_RENDER_MESSAGEBOX) && menu->menu_state.msg[0] != '\0') { if (driver->render_messagebox) driver->render_messagebox(menu->menu_state.msg); if (ui_companion_is_on_foreground()) { const ui_companion_driver_t *ui = ui_companion_get_ptr(); if (ui->render_messagebox) ui->render_messagebox(menu->menu_state.msg); } } if (BIT64_GET(menu->state, MENU_STATE_BLIT)) { menu_animation_ctl(MENU_ANIMATION_CTL_UPDATE_TIME, NULL); if (driver->render) driver->render(); } rarch_main_ctl(RARCH_MAIN_CTL_IS_IDLE, &is_idle); if (menu_driver_alive() && !is_idle) menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO, NULL); menu_driver_set_texture(); menu->state = 0; return 0; }
/** * menu_iterate: * @input : input sample for this frame * @old_input : input sample of the previous frame * @trigger_input : difference' input sample - difference * between 'input' and 'old_input' * * Runs RetroArch menu for one frame. * * Returns: 0 on success, -1 if we need to quit out of the loop. **/ int menu_iterate(retro_input_t input, retro_input_t old_input, retro_input_t trigger_input) { static retro_time_t last_clock_update = 0; int32_t ret = 0; unsigned action = 0; runloop_t *runloop = rarch_main_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr(); settings_t *settings = config_get_ptr(); menu->input.joypad = menu_input_frame(input, trigger_input); menu->cur_time = rarch_get_time_usec(); menu->dt = menu->cur_time - menu->old_time; if (menu->dt >= IDEAL_DT * 4) menu->dt = IDEAL_DT * 4; if (menu->dt <= IDEAL_DT / 4) menu->dt = IDEAL_DT / 4; menu->old_time = menu->cur_time; if (menu->cur_time - last_clock_update > 1000000 && settings->menu.timedate_enable) { menu->label.is_updated = true; last_clock_update = menu->cur_time; } action = menu->input.joypad; if (menu_do_refresh(action) == 0) return 0; ret = menu_entry_iterate(action); if (runloop->is_menu && !runloop->is_idle) menu_display_fb(); menu_driver_set_texture(); if (ret) return -1; return 0; }
int menu_iterate_render(void) { const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr(); if (!menu) return -1; if (menu->state.fb_is_dirty != menu->state.do_messagebox) menu->state.fb_is_dirty = true; if (menu->state.fb_is_dirty) menu_display_fb_set_dirty(); if (menu->state.do_messagebox && menu->state.msg[0] != '\0') { if (driver->render_messagebox) driver->render_messagebox(menu->state.msg); if (ui_companion_is_on_foreground()) { const ui_companion_driver_t *ui = ui_companion_get_ptr(); if (ui->render_messagebox) ui->render_messagebox(menu->state.msg); } } if (menu->state.do_render) { if (driver->render) driver->render(); } if (menu_driver_alive() && !rarch_main_is_idle()) menu_display_fb(); menu_driver_set_texture(); return 0; }