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 bool content_load_wrapper( content_ctx_info_t *content_info, bool launched_from_menu) { char name[PATH_MAX_LENGTH]; char msg[PATH_MAX_LENGTH]; char *fullpath = NULL; runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); #ifdef HAVE_MENU if (launched_from_menu) { /* redraw menu frame */ menu_display_set_msg_force(true); menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL); fill_pathname_base(name, fullpath, sizeof(name)); } #endif if (!content_load(content_info)) goto error; if (launched_from_menu) { /** Show loading OSD message */ if (*fullpath) { snprintf(msg, sizeof(msg), "INFO - Loading %s ...", name); runloop_msg_queue_push(msg, 1, 1, false); } } /* Push entry to top of history playlist */ if (content_is_inited() || content_does_not_need_content()) { char tmp[PATH_MAX_LENGTH]; struct retro_system_info *info = NULL; rarch_system_info_t *system = NULL; runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); if (system) info = &system->info; #ifdef HAVE_MENU if (launched_from_menu) menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &info); #endif strlcpy(tmp, fullpath, sizeof(tmp)); if (!launched_from_menu) { /* Path can be relative here. * Ensure we're pushing absolute path. */ if (*tmp) path_resolve_realpath(tmp, sizeof(tmp)); } if (info && *tmp) { content_push_to_history_playlist( true, tmp, info); playlist_write_file(g_defaults.history); } } return true; error: if (launched_from_menu) { if (!string_is_empty(fullpath) && !string_is_empty(name)) { snprintf(msg, sizeof(msg), "Failed to load %s.\n", name); runloop_msg_queue_push(msg, 1, 90, false); } } return false; }
/* Take frame bottom-up. */ static bool screenshot_dump( const char *global_name_base, const char *folder, const void *frame, unsigned width, unsigned height, int pitch, bool bgr24) { char filename[PATH_MAX_LENGTH] = {0}; char shotname[256] = {0}; bool ret = false; settings_t *settings = config_get_ptr(); #if defined(HAVE_ZLIB_DEFLATE) && defined(HAVE_RPNG) uint8_t *out_buffer = NULL; struct scaler_ctx scaler = {0}; #endif if (settings->auto_screenshot_filename) { fill_dated_filename(shotname, IMG_EXT, sizeof(shotname)); fill_pathname_join(filename, folder, shotname, sizeof(filename)); } else { snprintf(shotname, sizeof(shotname),"%s.png", path_basename(global_name_base)); fill_pathname_join(filename, folder, shotname, sizeof(filename)); } #ifdef _XBOX1 d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(true); D3DSurface *surf = NULL; d3d->dev->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &surf); if (XGWriteSurfaceToFile(surf, filename) == S_OK) ret = true; surf->Release(); #elif defined(HAVE_ZLIB_DEFLATE) && defined(HAVE_RPNG) out_buffer = (uint8_t*)malloc(width * height * 3); if (!out_buffer) return false; video_frame_convert_to_bgr24( &scaler, out_buffer, (const uint8_t*)frame + ((int)height - 1) * pitch, width, height, -pitch, bgr24); scaler_ctx_gen_reset(&scaler); ret = rpng_save_image_bgr24( filename, out_buffer, width, height, width * 3 ); free(out_buffer); #elif defined(HAVE_RBMP) enum rbmp_source_type bmp_type = RBMP_SOURCE_TYPE_DONT_CARE; if (bgr24) bmp_type = RBMP_SOURCE_TYPE_BGR24; else if (video_driver_get_pixel_format() == RETRO_PIXEL_FORMAT_XRGB8888) bmp_type = RBMP_SOURCE_TYPE_XRGB888; ret = rbmp_save_image(filename, frame, width, height, pitch, bmp_type); #endif #ifdef HAVE_IMAGEVIEWER if (ret == true) { if (content_push_to_history_playlist(g_defaults.image_history, filename, "imageviewer", "builtin")) playlist_write_file(g_defaults.image_history); } #endif return ret; }
/** * task_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). **/ static bool task_load_content(content_ctx_info_t *content_info, bool launched_from_menu, enum content_mode_load mode) { char name[256]; char msg[256]; name[0] = msg[0] = '\0'; if (launched_from_menu) { #ifdef HAVE_MENU /* redraw menu frame */ menu_display_set_msg_force(true); menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL); if (!path_is_empty(RARCH_PATH_CONTENT)) fill_pathname_base(name, path_get(RARCH_PATH_CONTENT), sizeof(name)); #endif /** Show loading OSD message */ if (!string_is_empty(path_get(RARCH_PATH_CONTENT))) { snprintf(msg, sizeof(msg), "%s %s ...", msg_hash_to_str(MSG_LOADING), name); runloop_msg_queue_push(msg, 2, 1, true); } } if (!content_load(content_info)) goto error; /* Push entry to top of history playlist */ if (content_is_inited() || content_does_not_need_content()) { char tmp[PATH_MAX_LENGTH]; struct retro_system_info *info = NULL; rarch_system_info_t *system = NULL; tmp[0] = '\0'; runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); if (system) info = &system->info; #ifdef HAVE_MENU if (launched_from_menu) menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &info); #endif strlcpy(tmp, path_get(RARCH_PATH_CONTENT), sizeof(tmp)); if (!launched_from_menu) { /* Path can be relative here. * Ensure we're pushing absolute path. */ if (!string_is_empty(tmp)) path_resolve_realpath(tmp, sizeof(tmp)); } if (info && *tmp) { const char *core_path = NULL; const char *core_name = NULL; playlist_t *playlist_tmp = g_defaults.content_history; switch (path_is_media_type(tmp)) { case RARCH_CONTENT_MOVIE: #ifdef HAVE_FFMPEG playlist_tmp = g_defaults.video_history; core_name = "movieplayer"; core_path = "builtin"; #endif break; case RARCH_CONTENT_MUSIC: #ifdef HAVE_FFMPEG playlist_tmp = g_defaults.music_history; core_name = "musicplayer"; core_path = "builtin"; #endif break; case RARCH_CONTENT_IMAGE: #ifdef HAVE_IMAGEVIEWER playlist_tmp = g_defaults.image_history; core_name = "imageviewer"; core_path = "builtin"; #endif break; default: core_path = path_get(RARCH_PATH_CORE); core_name = info->library_name; break; } if (content_push_to_history_playlist(playlist_tmp, tmp, core_name, core_path)) playlist_write_file(playlist_tmp); } } return true; error: if (launched_from_menu) { if (!path_is_empty(RARCH_PATH_CONTENT) && !string_is_empty(name)) { snprintf(msg, sizeof(msg), "%s %s.\n", msg_hash_to_str(MSG_FAILED_TO_LOAD), name); runloop_msg_queue_push(msg, 2, 90, true); } } return false; }