/** * main_exit: * * Cleanly exit RetroArch. * * Also saves configuration files to disk, * and (optionally) autosave state. **/ void main_exit(void *args) { settings_t *settings = config_get_ptr(); if (settings->config_save_on_exit) command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL); #ifdef HAVE_MENU /* Do not want menu context to live any more. */ menu_driver_ctl(RARCH_MENU_CTL_UNSET_OWN_DRIVER, NULL); #endif rarch_ctl(RARCH_CTL_MAIN_DEINIT, NULL); command_event(CMD_EVENT_PERFCNT_REPORT_FRONTEND_LOG, NULL); #if defined(HAVE_LOGGER) && !defined(ANDROID) logger_shutdown(); #endif frontend_driver_deinit(args); frontend_driver_exitspawn( path_get_ptr(RARCH_PATH_CORE), path_get_realsize(RARCH_PATH_CORE)); rarch_ctl(RARCH_CTL_DESTROY, NULL); ui_companion_driver_deinit(); frontend_driver_shutdown(false); driver_ctl(RARCH_DRIVER_CTL_DEINIT, NULL); ui_companion_driver_free(); frontend_driver_free(); }
static void load_dynamic_core(void) { function_t sym = dylib_proc(NULL, "retro_init"); if (sym) { /* Try to verify that -lretro was not linked in from other modules * since loading it dynamically and with -l will fail hard. */ RARCH_ERR("Serious problem. RetroArch wants to load libretro cores" "dyamically, but it is already linked.\n"); RARCH_ERR("This could happen if other modules RetroArch depends on " "link against libretro directly.\n"); RARCH_ERR("Proceeding could cause a crash. Aborting ...\n"); retroarch_fail(1, "init_libretro_sym()"); } if (string_is_empty(path_get(RARCH_PATH_CORE))) { RARCH_ERR("RetroArch is built for dynamic libretro cores, but " "libretro_path is not set. Cannot continue.\n"); retroarch_fail(1, "init_libretro_sym()"); } /* Need to use absolute path for this setting. It can be * saved to content history, and a relative path would * break in that scenario. */ path_resolve_realpath( path_get_ptr(RARCH_PATH_CORE), path_get_realsize(RARCH_PATH_CORE)); RARCH_LOG("Loading dynamic libretro core from: \"%s\"\n", path_get(RARCH_PATH_CORE)); lib_handle = dylib_load(path_get(RARCH_PATH_CORE)); if (!lib_handle) { RARCH_ERR("Failed to open libretro core: \"%s\"\n", path_get(RARCH_PATH_CORE)); RARCH_ERR("Error(s): %s\n", dylib_error()); retroarch_fail(1, "load_dynamic()"); } }