static void event_set_savestate_auto_index(void) { size_t i; char state_dir[PATH_MAX_LENGTH] = {0}; char state_base[PATH_MAX_LENGTH] = {0}; struct string_list *dir_list = NULL; unsigned max_idx = 0; settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); if (!settings->savestate_auto_index) return; /* Find the file in the same directory as global->savestate_name * with the largest numeral suffix. * * E.g. /foo/path/content.state, will try to find * /foo/path/content.state%d, where %d is the largest number available. */ fill_pathname_basedir(state_dir, global->savestate_name, sizeof(state_dir)); fill_pathname_base(state_base, global->savestate_name, sizeof(state_base)); if (!(dir_list = dir_list_new_special(state_dir, DIR_LIST_PLAIN))) return; for (i = 0; i < dir_list->size; i++) { unsigned idx; char elem_base[PATH_MAX_LENGTH] = {0}; const char *end = NULL; const char *dir_elem = dir_list->elems[i].data; fill_pathname_base(elem_base, dir_elem, sizeof(elem_base)); if (strstr(elem_base, state_base) != elem_base) continue; end = dir_elem + strlen(dir_elem); while ((end > dir_elem) && isdigit(end[-1])) end--; idx = strtoul(end, NULL, 0); if (idx > max_idx) max_idx = idx; } dir_list_free(dir_list); settings->state_slot = max_idx; RARCH_LOG("Found last state slot: #%d\n", settings->state_slot); }
static void find_and_set_first_file(void) { //Last fallback - we'll need to start the first executable file // we can find in the RetroArch cores directory #if defined(_XBOX) char ** dir_list = dir_list_new("game:\\", ".xex"); #elif defined(__CELLOS_LV2__) char ** dir_list = dir_list_new(LIBRETRO_DIR_PATH, ".SELF"); #endif if (!dir_list) { RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n"); return; } char * first_executable = dir_list[0]; if(first_executable) { #ifdef _XBOX //Check if it's RetroArch Salamander itself - if so, first_executable needs to //be overridden char fname_tmp[MAX_PATH_LENGTH]; fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp)); if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0) { RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n"); first_executable = dir_list[1]; fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp)); if(!first_executable) { RARCH_WARN("There is no second entry - no choice but to boot RetroArch Salamander\n"); first_executable = dir_list[0]; fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp)); } } snprintf(first_executable, sizeof(first_executable), "game:\\%s", fname_tmp); #endif RARCH_LOG("Start first entry in libretro cores dir: [%s].\n", first_executable); strlcpy(libretro_path, first_executable, sizeof(libretro_path)); } else { RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n"); } dir_list_free(dir_list); }
void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first_file, const char *libretro_path, const char * exe_ext) { //We need to set libretro to the first entry in the cores //directory so that it will be saved to the config file struct string_list *dir_list = dir_list_new(libretro_path, exe_ext, false); const char * first_exe; if (!dir_list) { RARCH_ERR("Couldn't read directory.\n"); RARCH_ERR("Failed to set first entry to libretro path.\n"); goto end; } first_exe = dir_list->elems[0].data; if(first_exe) { #ifdef _XBOX char fname_tmp[PATH_MAX]; fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp)); if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0) { RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n"); first_exe = dir_list->elems[1].data; fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp)); if(!first_exe) { RARCH_ERR("Unlikely error happened - no second entry - no choice but to set it to RetroArch Salamander\n"); first_exe = dir_list->elems[0].data; fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp)); } } strlcpy(first_file, fname_tmp, size_of_first_file); #else strlcpy(first_file, first_exe, size_of_first_file); #endif RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", first_file); } end: dir_list_free(dir_list); }
static void menu_action_setting_disp_set_label_shader_pass( file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *s2, size_t len2) { unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_0); menu_handle_t *menu = menu_driver_get_ptr(); if (!menu) return; (void)pass; (void)menu; *s = '\0'; *w = 19; strlcpy(s2, path, len2); strlcpy(s, menu_hash_to_str(MENU_VALUE_NOT_AVAILABLE), len); #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL) if (!menu->shader) return; if (*menu->shader->pass[pass].source.path) fill_pathname_base(s, menu->shader->pass[pass].source.path, len); #endif }
static void menu_action_setting_disp_set_label_shader_pass( file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *s2, size_t len2) { #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL) struct video_shader *shader = NULL; #endif unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_0); (void)pass; *s = '\0'; *w = 19; strlcpy(s2, path, len2); strlcpy(s, menu_hash_to_str(MENU_VALUE_NOT_AVAILABLE), len); #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL) menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, &shader); if (!shader) return; if (*shader->pass[pass].source.path) fill_pathname_base(s, shader->pass[pass].source.path, len); #endif }
bool menu_content_load(void) { bool msg_force = true; char *fullpath = NULL; runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); /* redraw menu frame */ menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL); if (!(main_load_content(0, NULL, NULL, menu_content_environment_get))) { char name[PATH_MAX_LENGTH]; char msg[PATH_MAX_LENGTH]; fill_pathname_base(name, fullpath, sizeof(name)); snprintf(msg, sizeof(msg), "Failed to load %s.\n", name); menu_display_msg_queue_push(msg, 1, 90, false); return false; } menu_driver_ctl(RARCH_MENU_CTL_SHADER_MANAGER_INIT, NULL); event_cmd_ctl(EVENT_CMD_HISTORY_INIT, NULL); if (*fullpath || menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL)) menu_content_push_to_history_playlist(); event_cmd_ctl(EVENT_CMD_VIDEO_SET_ASPECT_RATIO, NULL); event_cmd_ctl(EVENT_CMD_RESUME, NULL); return true; }
static void menu_push_to_history_playlist(void) { settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); if (!settings->history_list_enable) return; if (*global->fullpath) { char tmp[PATH_MAX_LENGTH] = {0}; char str[PATH_MAX_LENGTH] = {0}; fill_pathname_base(tmp, global->fullpath, sizeof(tmp)); snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp); rarch_main_msg_queue_push(str, 1, 1, false); } content_playlist_push(g_defaults.history, global->fullpath, NULL, settings->libretro, global->menu.info.library_name, NULL, NULL); }
static void menu_content_push_to_history_playlist(void) { struct retro_system_info *system = NULL; settings_t *settings = config_get_ptr(); char *fullpath = NULL; if (!settings->history_list_enable) return; runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); if (*fullpath) { char tmp[PATH_MAX_LENGTH]; char str[PATH_MAX_LENGTH]; fill_pathname_base(tmp, fullpath, sizeof(tmp)); snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp); menu_display_msg_queue_push(str, 1, 1, false); } menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &system); content_playlist_push(g_defaults.history, fullpath, NULL, settings->libretro, system->library_name, NULL, NULL); content_playlist_write_file(g_defaults.history); }
/** * 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(enum rarch_core_type type) { bool msg_force = true; char *fullpath = NULL; runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); /* redraw menu frame */ menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); menu_iterate_render(); if (!(main_load_content(0, NULL, NULL, menu_environment_get))) { char name[PATH_MAX_LENGTH] = {0}; char msg[PATH_MAX_LENGTH] = {0}; fill_pathname_base(name, fullpath, sizeof(name)); snprintf(msg, sizeof(msg), "Failed to load %s.\n", name); menu_display_msg_queue_push(msg, 1, 90, false); return false; } menu_shader_manager_init(menu_driver_get_ptr()); event_command(EVENT_CMD_HISTORY_INIT); if (*fullpath || menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL)) menu_push_to_history_playlist(); event_command(EVENT_CMD_VIDEO_SET_ASPECT_RATIO); event_command(EVENT_CMD_RESUME); return true; }
static void menu_push_to_history_playlist(void) { settings_t *settings = config_get_ptr(); char *fullpath = NULL; if (!settings->history_list_enable) return; runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); if (*fullpath) { char tmp[PATH_MAX_LENGTH]; char str[PATH_MAX_LENGTH]; fill_pathname_base(tmp, fullpath, sizeof(tmp)); snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp); menu_display_msg_queue_push(str, 1, 1, false); } content_playlist_push(g_defaults.history, fullpath, NULL, settings->libretro, g_system_menu.library_name, NULL, NULL); }
bool load_menu_game(void) { if (g_extern.main_is_init) rarch_main_deinit(); struct rarch_main_wrap args = {0}; args.verbose = g_extern.verbose; args.config_path = *g_extern.config_path ? g_extern.config_path : NULL; args.sram_path = *g_extern.savefile_dir ? g_extern.savefile_dir : NULL; args.state_path = *g_extern.savestate_dir ? g_extern.savestate_dir : NULL; args.rom_path = *g_extern.fullpath ? g_extern.fullpath : NULL; args.libretro_path = g_settings.libretro; args.no_rom = rgui->load_no_rom; rgui->load_no_rom = false; if (rarch_main_init_wrap(&args) == 0) { RARCH_LOG("rarch_main_init_wrap() succeeded.\n"); return true; } else { char name[PATH_MAX]; char msg[PATH_MAX]; fill_pathname_base(name, g_extern.fullpath, sizeof(name)); snprintf(msg, sizeof(msg), "Failed to load %s.\n", name); msg_queue_push(g_extern.msg_queue, msg, 1, 90); rgui->msg_force = true; RARCH_ERR("rarch_main_init_wrap() failed.\n"); return false; } }
void menu_shader_manager_get_str(struct gfx_shader *shader, char *type_str, size_t type_str_size, const char *menu_label, const char *label, unsigned type) { *type_str = '\0'; if (!strcmp(label, "video_shader_num_passes")) snprintf(type_str, type_str_size, "%u", shader->passes); else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0 && type <= MENU_SETTINGS_SHADER_PARAMETER_LAST) { /* menu->parameter_shader here. */ if (shader) { const struct gfx_shader_parameter *param = (const struct gfx_shader_parameter*)&shader->parameters [type - MENU_SETTINGS_SHADER_PARAMETER_0]; snprintf(type_str, type_str_size, "%.2f [%.2f %.2f]", param->current, param->minimum, param->maximum); } } else if (!strcmp(label, "video_shader_default_filter")) snprintf(type_str, type_str_size, "%s", g_settings.video.smooth ? "Linear" : "Nearest"); else if (!strcmp(label, "video_shader_pass")) { unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_0); if (*shader->pass[pass].source.path) fill_pathname_base(type_str, shader->pass[pass].source.path, type_str_size); else strlcpy(type_str, "N/A", type_str_size); } else if (!strcmp(label, "video_shader_filter_pass")) { unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_FILTER_0); static const char *modes[] = { "Don't care", "Linear", "Nearest" }; strlcpy(type_str, modes[shader->pass[pass].filter], type_str_size); } else if (!strcmp(label, "video_shader_scale_pass")) { unsigned pass = (type - MENU_SETTINGS_SHADER_PASS_SCALE_0); unsigned scale = shader->pass[pass].fbo.scale_x; if (!scale) strlcpy(type_str, "Don't care", type_str_size); else snprintf(type_str, type_str_size, "%ux", scale); } }
/*We need to set libretro to the first entry in the cores * directory so that it will be saved to the config file */ static void find_first_libretro_core(char *first_file, size_t size_of_first_file, const char *dir, const char * ext) { size_t i; bool ret = false; struct string_list *list = dir_list_new(dir, ext, false, true, false, false); if (!list) { RARCH_ERR("Couldn't read directory." " Cannot infer default libretro core.\n"); return; } RARCH_LOG("Searching for valid libretro implementation in: \"%s\".\n", dir); for (i = 0; i < list->size && !ret; i++) { char fname[PATH_MAX_LENGTH]; char salamander_name[PATH_MAX_LENGTH]; const char *libretro_elem = (const char*)list->elems[i].data; RARCH_LOG("Checking library: \"%s\".\n", libretro_elem); if (!libretro_elem) continue; fill_pathname_base(fname, libretro_elem, sizeof(fname)); if (!frontend_driver_get_salamander_basename( salamander_name, sizeof(salamander_name))) break; if (!strncmp(fname, salamander_name, sizeof(fname))) { if (list->size == (i + 1)) { RARCH_WARN("Entry is RetroArch Salamander itself, " "but is last entry. No choice but to set it.\n"); strlcpy(first_file, fname, size_of_first_file); } continue; } strlcpy(first_file, fname, size_of_first_file); RARCH_LOG("First found libretro core is: \"%s\".\n", first_file); ret = true; } dir_list_free(list); }
void shader_manager_get_str(struct gfx_shader *shader, char *type_str, size_t type_str_size, unsigned type) { if (type == RGUI_SETTINGS_SHADER_APPLY) *type_str = '\0'; else if (type == RGUI_SETTINGS_SHADER_PASSES) snprintf(type_str, type_str_size, "%u", shader->passes); else { unsigned pass = (type - RGUI_SETTINGS_SHADER_0) / 3; switch ((type - RGUI_SETTINGS_SHADER_0) % 3) { case 0: if (*shader->pass[pass].source.cg) fill_pathname_base(type_str, shader->pass[pass].source.cg, type_str_size); else strlcpy(type_str, "N/A", type_str_size); break; case 1: switch (shader->pass[pass].filter) { case RARCH_FILTER_LINEAR: strlcpy(type_str, "Linear", type_str_size); break; case RARCH_FILTER_NEAREST: strlcpy(type_str, "Nearest", type_str_size); break; case RARCH_FILTER_UNSPEC: strlcpy(type_str, "Don't care", type_str_size); break; } break; case 2: { unsigned scale = shader->pass[pass].fbo.scale_x; if (!scale) strlcpy(type_str, "Don't care", type_str_size); else snprintf(type_str, type_str_size, "%ux", scale); break; } } } }
static void menu_action_setting_disp_set_label_remap_file_load( file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *s2, size_t len2) { settings_t *settings = config_get_ptr(); *w = 19; strlcpy(s2, path, len2); fill_pathname_base(s, settings->input.remapping_path, len); }
//We need to set libretro to the first entry in the cores //directory so that it will be saved to the config file static void find_first_libretro_core(char *first_file, size_t size_of_first_file, const char *dir, const char * ext) { struct string_list *list; size_t i; bool ret = false; RARCH_LOG("Searching for valid libretro implementation in: \"%s\".\n", dir); list = (struct string_list*)dir_list_new(dir, ext, false); if (!list) { RARCH_ERR("Couldn't read directory. Cannot infer default libretro core.\n"); return; } for (i = 0; i < list->size && !ret; i++) { char fname[PATH_MAX]; const char *libretro_elem = (const char*)list->elems[i].data; RARCH_LOG("Checking library: \"%s\".\n", libretro_elem); if (!libretro_elem) continue; fill_pathname_base(fname, libretro_elem, sizeof(fname)); if (strncmp(fname, SALAMANDER_FILE, sizeof(fname)) == 0) { if ((i + 1) == list->size) { RARCH_WARN("Entry is RetroArch Salamander itself, but is last entry. No choice but to set it.\n"); strlcpy(first_file, fname, size_of_first_file); } continue; } strlcpy(first_file, fname, size_of_first_file); RARCH_LOG("First found libretro core is: \"%s\".\n", first_file); ret = true; } dir_list_free(list); }
void rarch_settings_msg(unsigned setting, unsigned delay) { char str[PATH_MAX], tmp[PATH_MAX]; msg_queue_clear(g_extern.msg_queue); (void)tmp; switch(setting) { case S_MSG_CACHE_PARTITION: snprintf(str, sizeof(str), "INFO - All the contents of the ZIP files you have selected in the filebrowser\nare extracted to this partition."); break; case S_MSG_CHANGE_CONTROLS: snprintf(str, sizeof(str), "INFO - Press LEFT/RIGHT to change the controls, and press\n[RetroPad Start] to reset a button to default values."); break; case S_MSG_EXTRACTED_ZIPFILE: snprintf(str, sizeof(str), "INFO - ZIP file successfully extracted to cache partition."); break; case S_MSG_LOADING_ROM: fill_pathname_base(tmp, g_console.rom_path, sizeof(tmp)); snprintf(str, sizeof(str), "INFO - Loading %s...", tmp); break; case S_MSG_ROM_LOADING_ERROR: snprintf(str, sizeof(str), "ERROR - An error occurred during ROM loading."); break; case S_MSG_NOT_IMPLEMENTED: snprintf(str, sizeof(str), "TODO - Not yet implemented."); break; case S_MSG_RESIZE_SCREEN: snprintf(str, sizeof(str), "INFO - Resize the screen by moving around the two analog sticks.\nPress [RetroPad X] to reset to default values, and [RetroPad A] to go back.\nTo select the resized screen mode, set Aspect Ratio to: 'Custom'."); break; case S_MSG_RESTART_RARCH: snprintf(str, sizeof(str), "INFO - You need to restart RetroArch for this change to take effect."); break; case S_MSG_SELECT_LIBRETRO_CORE: snprintf(str, sizeof(str), "INFO - Select a Libretro core from the menu by pressing [RetroPad B]."); break; case S_MSG_SELECT_SHADER: snprintf(str, sizeof(str), "INFO - Select a shader from the menu by pressing [RetroPad A]."); break; case S_MSG_SHADER_LOADING_SUCCEEDED: snprintf(str, sizeof(str), "INFO - Shader successfully loaded."); break; } msg_queue_push(g_extern.msg_queue, str, 1, delay); }
static bool menu_content_load(void) { content_ctx_info_t content_info; char name[PATH_MAX_LENGTH]; char msg[PATH_MAX_LENGTH]; bool msg_force = true; char *fullpath = NULL; runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); /* redraw menu frame */ menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL); if (*fullpath) fill_pathname_base(name, fullpath, sizeof(name)); content_info.argc = 0; content_info.argv = NULL; content_info.args = NULL; content_info.environ_get = menu_content_environment_get; if (!content_ctl(CONTENT_CTL_LOAD, &content_info)) goto error; if (*fullpath) { snprintf(msg, sizeof(msg), "INFO - Loading %s ...", name); runloop_msg_queue_push(msg, 1, 1, false); } if (*fullpath || menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL)) { struct retro_system_info *info = NULL; menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &info); content_push_to_history_playlist(true, fullpath, info); content_playlist_write_file(g_defaults.history); } return true; error: snprintf(msg, sizeof(msg), "Failed to load %s.\n", name); runloop_msg_queue_push(msg, 1, 90, false); return false; }
static void menu_action_setting_disp_set_label_remap_file_load( file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *s2, size_t len2) { global_t *global = global_get_ptr(); *w = 19; strlcpy(s2, path, len2); if (global && !string_is_empty(global->name.remapfile)) fill_pathname_base(s, global->name.remapfile, len); }
void load_menu_game_prepare(void *data) { rgui_handle_t *rgui = (rgui_handle_t*)data; if (*g_extern.fullpath || (rgui && rgui->load_no_rom)) { if (*g_extern.fullpath) { char tmp[PATH_MAX]; char str[PATH_MAX]; fill_pathname_base(tmp, g_extern.fullpath, sizeof(tmp)); snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp); msg_queue_push(g_extern.msg_queue, str, 1, 1); } #ifdef RARCH_CONSOLE if (g_extern.system.no_game || *g_extern.fullpath) #endif menu_rom_history_push(rgui, *g_extern.fullpath ? g_extern.fullpath : NULL, g_settings.libretro, rgui->info.library_name ? rgui->info.library_name : ""); } #ifdef HAVE_MENU // redraw RGUI frame rgui->old_input_state = rgui->trigger_state = 0; rgui->do_held = false; rgui->msg_force = true; if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->iterate) driver.menu_ctx->backend->iterate(rgui, RGUI_ACTION_NOOP); #endif // Draw frame for loading message if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable) driver.video_poke->set_texture_enable(driver.video_data, rgui->frame_buf_show, MENU_TEXTURE_FULLSCREEN); if (driver.video) rarch_render_cached_frame(); if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable) driver.video_poke->set_texture_enable(driver.video_data, false, MENU_TEXTURE_FULLSCREEN); }
bool load_menu_game(void *data) { struct rarch_main_wrap args = {0}; rgui_handle_t *rgui = (rgui_handle_t*)data; if (g_extern.main_is_init) rarch_main_deinit(); args.verbose = g_extern.verbose; args.config_path = *g_extern.config_path ? g_extern.config_path : NULL; args.sram_path = *g_extern.savefile_dir ? g_extern.savefile_dir : NULL; args.state_path = *g_extern.savestate_dir ? g_extern.savestate_dir : NULL; args.rom_path = *g_extern.fullpath ? g_extern.fullpath : NULL; args.libretro_path = *g_settings.libretro ? g_settings.libretro : NULL; args.no_rom = rgui->load_no_rom; if (rgui) rgui->load_no_rom = false; if (rarch_main_init_wrap(&args) != 0) { char name[PATH_MAX], msg[PATH_MAX]; fill_pathname_base(name, g_extern.fullpath, sizeof(name)); snprintf(msg, sizeof(msg), "Failed to load %s.\n", name); msg_queue_push(g_extern.msg_queue, msg, 1, 90); if (rgui) rgui->msg_force = true; RARCH_ERR("rarch_main_init_wrap() failed.\n"); return false; } RARCH_LOG("rarch_main_init_wrap() succeeded.\n"); if (rgui) { // Update menu state which depends on config. menu_update_libretro_info(rgui); menu_init_history(rgui); if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_init) driver.menu_ctx->backend->shader_manager_init(rgui); } return true; }
static void filebrowser_fetch_directory_entries(const char *path, filebrowser_t * browser, CXuiList * romlist, CXuiTextElement * rompath_title) { filebrowser_push_directory(browser, path, true); rarch_convert_char_to_wchar(strw_buffer, path, sizeof(strw_buffer)); rompath_title->SetText(strw_buffer); romlist->DeleteItems(0, romlist->GetItemCount()); romlist->InsertItems(0, browser->current_dir.list->size); for(unsigned i = 0; i < browser->current_dir.list->size; i++) { char fname_tmp[256]; fill_pathname_base(fname_tmp, browser->current_dir.list->elems[i].data, sizeof(fname_tmp)); rarch_convert_char_to_wchar(strw_buffer, fname_tmp, sizeof(strw_buffer)); romlist->SetText(i, strw_buffer); } }
void filebrowser_fetch_directory_entries(uint64_t action) { filebrowser_iterate(rgui->browser, action); mbstowcs(strw_buffer, rgui->browser->current_dir.directory_path, sizeof(strw_buffer) / sizeof(wchar_t)); XuiTextElementSetText(m_menutitle, strw_buffer); XuiListDeleteItems(m_menulist, 0, XuiListGetItemCount(m_menulist)); XuiListInsertItems(m_menulist, 0, rgui->browser->list->size); for(unsigned i = 0; i < rgui->browser->list->size; i++) { char fname_tmp[256]; fill_pathname_base(fname_tmp, rgui->browser->list->elems[i].data, sizeof(fname_tmp)); mbstowcs(strw_buffer, fname_tmp, sizeof(strw_buffer) / sizeof(wchar_t)); XuiListSetText(m_menulist, i, strw_buffer); } }
static void filebrowser_fetch_directory_entries(filebrowser_t * browser, uint64_t action, CXuiList * romlist, CXuiTextElement * rompath_title) { browser_update(browser, action, browser->extensions); convert_char_to_wchar(strw_buffer, filebrowser_get_current_dir(browser), sizeof(strw_buffer)); rompath_title->SetText(strw_buffer); romlist->DeleteItems(0, romlist->GetItemCount()); romlist->InsertItems(0, browser->current_dir.list->size); for(unsigned i = 0; i < browser->current_dir.list->size; i++) { char fname_tmp[256]; fill_pathname_base(fname_tmp, browser->current_dir.list->elems[i].data, sizeof(fname_tmp)); convert_char_to_wchar(strw_buffer, fname_tmp, sizeof(strw_buffer)); romlist->SetText(i, strw_buffer); } }
static void menu_action_setting_disp_set_label_configurations( file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *s2, size_t len2) { *w = 19; strlcpy(s2, path, len2); if (!path_is_empty(RARCH_PATH_CONFIG)) fill_pathname_base(s, path_get(RARCH_PATH_CONFIG), len); else strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), len); }
static void menu_action_setting_disp_set_label_configurations( file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *s2, size_t len2) { global_t *global = global_get_ptr(); *w = 19; strlcpy(s2, path, len2); if (*global->config_path) fill_pathname_base(s, global->config_path, len); else strlcpy(s, "<default>", len); }
/** * 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; }
static void menu_action_setting_disp_set_label_configurations( file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *s2, size_t len2) { global_t *global = global_get_ptr(); *w = 19; strlcpy(s2, path, len2); if (global && *global->path.config) fill_pathname_base(s, global->path.config, len); else strlcpy(s, menu_hash_to_str(MENU_VALUE_DIRECTORY_DEFAULT), len); }
static void load_menu_content_prepare(void) { if (!driver.menu) return; if (*g_extern.fullpath || driver.menu->load_no_content) { if (*g_extern.fullpath) { char tmp[PATH_MAX]; char str[PATH_MAX]; fill_pathname_base(tmp, g_extern.fullpath, sizeof(tmp)); snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp); msg_queue_push(g_extern.msg_queue, str, 1, 1); } content_playlist_push(g_extern.history, *g_extern.fullpath ? g_extern.fullpath : NULL, g_settings.libretro, driver.menu->info.library_name ? driver.menu->info.library_name : ""); } /* redraw menu frame */ driver.menu->old_input_state = driver.menu->trigger_state = 0; driver.menu->do_held = false; driver.menu->msg_force = true; if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->iterate) driver.menu_ctx->backend->iterate(MENU_ACTION_NOOP); /* Draw frame for loading message */ if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable) driver.video_poke->set_texture_enable(driver.video_data, driver.menu->frame_buf_show, MENU_TEXTURE_FULLSCREEN); if (driver.video) rarch_render_cached_frame(); if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable) driver.video_poke->set_texture_enable(driver.video_data, false, MENU_TEXTURE_FULLSCREEN); }
void load_menu_game_prepare(void) { if (*g_extern.fullpath || rgui->load_no_rom) { if (*g_extern.fullpath && g_extern.lifecycle_mode_state & (1ULL << MODE_INFO_DRAW)) { char tmp[PATH_MAX]; char str[PATH_MAX]; fill_pathname_base(tmp, g_extern.fullpath, sizeof(tmp)); snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp); msg_queue_push(g_extern.msg_queue, str, 1, 1); } menu_rom_history_push(*g_extern.fullpath ? g_extern.fullpath : NULL, g_settings.libretro, rgui->info.library_name ? rgui->info.library_name : ""); } #ifdef HAVE_RGUI // redraw RGUI frame rgui->old_input_state = rgui->trigger_state = 0; rgui->do_held = false; rgui->msg_force = true; rgui_iterate(rgui); #endif // Draw frame for loading message if (driver.video_poke && driver.video_poke->set_texture_enable) driver.video_poke->set_texture_enable(driver.video_data, rgui->frame_buf_show, MENU_TEXTURE_FULLSCREEN); if (driver.video) rarch_render_cached_frame(); if (driver.video_poke && driver.video_poke->set_texture_enable) driver.video_poke->set_texture_enable(driver.video_data, false, MENU_TEXTURE_FULLSCREEN); }