bool core_unload(void) { video_driver_set_cached_frame_ptr(NULL); current_core.retro_deinit(); return true; }
bool core_reset(void) { video_driver_set_cached_frame_ptr(NULL); current_core.retro_reset(); return true; }
bool core_load_game(retro_ctx_load_content_info_t *load_info) { bool contentless = false; bool is_inited = false; video_driver_set_cached_frame_ptr(NULL); #ifdef HAVE_RUNAHEAD set_load_content_info(load_info); clear_controller_port_map(); #endif content_get_status(&contentless, &is_inited); if (load_info && load_info->special) current_core.game_loaded = current_core.retro_load_game_special( load_info->special->id, load_info->info, load_info->content->size); else if (load_info && !string_is_empty(load_info->content->elems[0].data)) current_core.game_loaded = current_core.retro_load_game(load_info->info); else if (contentless) current_core.game_loaded = current_core.retro_load_game(NULL); else current_core.game_loaded = false; return current_core.game_loaded; }
bool core_init(void) { video_driver_set_cached_frame_ptr(NULL); current_core.retro_init(); current_core.inited = true; return true; }
static bool take_screenshot_choice(const char *name_base, bool savestate, bool is_paused, bool is_idle, bool has_valid_framebuffer) { size_t old_pitch; unsigned old_width, old_height; bool ret = false; void *frame_data = NULL; const void* old_data = NULL; settings_t *settings = config_get_ptr(); const char *screenshot_dir = settings->paths.directory_screenshot; /* No way to infer screenshot directory. */ if ( string_is_empty(screenshot_dir) && string_is_empty(name_base)) return false; if (video_driver_supports_viewport_read()) { /* Avoid taking screenshot of GUI overlays. */ video_driver_set_texture_enable(false, false); if (!is_idle) video_driver_cached_frame(); #if defined(VITA) return take_screenshot_raw(name_base, NULL, savestate, is_idle, is_paused); #else return take_screenshot_viewport(name_base, savestate, is_idle, is_paused); #endif } if (!has_valid_framebuffer) return take_screenshot_raw(name_base, NULL, savestate, is_idle, is_paused); if (!video_driver_supports_read_frame_raw()) return false; video_driver_cached_frame_get(&old_data, &old_width, &old_height, &old_pitch); frame_data = video_driver_read_frame_raw( &old_width, &old_height, &old_pitch); video_driver_cached_frame_set(old_data, old_width, old_height, old_pitch); if (frame_data) { video_driver_set_cached_frame_ptr(frame_data); if (take_screenshot_raw(name_base, frame_data, savestate, is_idle, is_paused)) ret = true; } return ret; }
bool core_unload_game(void) { video_driver_free_hw_context(); video_driver_set_cached_frame_ptr(NULL); current_core.retro_unload_game(); current_core.game_loaded = false; audio_driver_stop(); return true; }
static bool take_screenshot_choice(const char *global_name_base) { settings_t *settings = config_get_ptr(); /* No way to infer screenshot directory. */ if (string_is_empty(settings->directory.screenshot) && (!*global_name_base)) return false; if (video_driver_supports_viewport_read()) { /* Avoid taking screenshot of GUI overlays. */ video_driver_set_texture_enable(false, false); video_driver_cached_frame_render(); return take_screenshot_viewport(global_name_base); } if (!video_driver_cached_frame_has_valid_framebuffer()) return take_screenshot_raw(global_name_base); if (video_driver_supports_read_frame_raw()) { unsigned old_width, old_height; size_t old_pitch; bool ret = false; void *frame_data = NULL; const void* old_data = NULL; video_driver_cached_frame_get(&old_data, &old_width, &old_height, &old_pitch); frame_data = video_driver_read_frame_raw( &old_width, &old_height, &old_pitch); video_driver_cached_frame_set(old_data, old_width, old_height, old_pitch); if (frame_data) { video_driver_set_cached_frame_ptr(frame_data); if (take_screenshot_raw(global_name_base)) ret = true; free(frame_data); } return ret; } return false; }