/** * 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; }
/** * menu_load_content: * * Loads content into currently selected core. * Will also optionally push the content entry to the history playlist. * * Returns: true (1) if successful, otherwise false (0). **/ bool menu_load_content(void) { menu_handle_t *menu = menu_driver_get_ptr(); menu_display_t *disp = menu_display_get_ptr(); driver_t *driver = driver_get_ptr(); global_t *global = global_get_ptr(); /* redraw menu frame */ if (disp) disp->msg_force = true; menu_entry_iterate(MENU_ACTION_NOOP); menu_display_fb(); if (!(main_load_content(0, NULL, NULL, menu_environment_get, driver->frontend_ctx->process_args))) { char name[PATH_MAX_LENGTH] = {0}; char msg[PATH_MAX_LENGTH] = {0}; fill_pathname_base(name, global->fullpath, sizeof(name)); snprintf(msg, sizeof(msg), "Failed to load %s.\n", name); rarch_main_msg_queue_push(msg, 1, 90, false); if (disp) disp->msg_force = true; return false; } menu_shader_manager_init(menu); event_command(EVENT_CMD_HISTORY_INIT); if (*global->fullpath || (menu && menu->load_no_content)) menu_push_to_history_playlist(); event_command(EVENT_CMD_VIDEO_SET_ASPECT_RATIO); event_command(EVENT_CMD_RESUME); return true; }
/** * 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; }