static void system_post_init(void) { char core_name[64]; get_libretro_core_name(core_name, sizeof(core_name)); snprintf(input_path, sizeof(input_path), "%s/%s.cfg", default_paths.input_presets_dir, core_name); config_read_keybinds(input_path); }
static void rarch_get_environment(int argc, char *argv[]) { g_extern.verbose = true; #if defined(HAVE_LOGGER) logger_init(); #elif defined(HAVE_FILE_LOGGER) g_extern.log_file = fopen("/retroarch-log.txt", "w"); #endif if (frontend_ctx && frontend_ctx->environment_get) frontend_ctx->environment_get(argc, argv); config_load(); #if defined(RARCH_CONSOLE) init_libretro_sym(false); rarch_init_system_info(); global_init_drivers(); #ifdef HAVE_LIBRETRO_MANAGEMENT char path_prefix[PATH_MAX]; #if defined(_WIN32) char slash = '\\'; #else char slash = '/'; #endif snprintf(path_prefix, sizeof(path_prefix), "%s%c", default_paths.core_dir, slash); char core_exe_path[256]; snprintf(core_exe_path, sizeof(core_exe_path), "%sCORE%s", path_prefix, DEFAULT_EXE_EXT); // Save new libretro core path to config file and exit if (path_file_exists(core_exe_path)) if (libretro_install_core(path_prefix, core_exe_path)) #ifdef _XBOX g_extern.system.shutdown = g_extern.system.shutdown; #else g_extern.system.shutdown = true; #endif #endif #ifdef GEKKO /* Per-core input config loading */ char core_name[64]; libretro_get_current_core_pathname(core_name, sizeof(core_name)); snprintf(g_extern.input_config_path, sizeof(g_extern.input_config_path), "%s/%s.cfg", default_paths.input_presets_dir, core_name); config_read_keybinds(g_extern.input_config_path); #endif #endif }
void rarch_get_environment_console(void) { init_libretro_sym(false); rarch_init_system_info(); global_init_drivers(); #ifdef HAVE_LIBRETRO_MANAGEMENT char path_prefix[PATH_MAX]; #if defined(_WIN32) char slash = '\\'; #else char slash = '/'; #endif snprintf(path_prefix, sizeof(path_prefix), "%s%c", default_paths.core_dir, slash); char core_exe_path[256]; snprintf(core_exe_path, sizeof(core_exe_path), "%sCORE%s", path_prefix, DEFAULT_EXE_EXT); // Save new libretro core path to config file and exit if (path_file_exists(core_exe_path)) if (libretro_install_core(path_prefix, core_exe_path)) #ifdef _XBOX g_extern.system.shutdown = g_extern.system.shutdown; #else g_extern.system.shutdown = true; #endif #endif #ifdef GEKKO /* Per-core input config loading */ char core_name[64]; libretro_get_current_core_pathname(core_name, sizeof(core_name)); snprintf(g_extern.input_config_path, sizeof(g_extern.input_config_path), "%s/%s.cfg", default_paths.input_presets_dir, core_name); config_read_keybinds(g_extern.input_config_path); #endif }
int main(int argc, char *argv[]) { #ifdef HW_RVL IOS_ReloadIOS(IOS_GetVersion()); L2Enhance(); gx_init_mem2(); #endif fatInitDefault(); #ifdef HAVE_LOGGER g_extern.verbose = true; logger_init(); devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout; dotab_stdout.write_r = gx_logger_net; #elif defined(HAVE_FILE_LOGGER) g_extern.verbose = true; log_fp = fopen("/retroarch-log.txt", "w"); devoptab_list[STD_OUT] = &dotab_stdout; devoptab_list[STD_ERR] = &dotab_stdout; dotab_stdout.write_r = gx_logger_file; #endif #ifdef HW_RVL lwp_t gx_device_thread; gx_devices[GX_DEVICE_SD].interface = &__io_wiisd; gx_devices[GX_DEVICE_SD].name = "sd"; gx_devices[GX_DEVICE_SD].mounted = fatMountSimple(gx_devices[GX_DEVICE_SD].name, gx_devices[GX_DEVICE_SD].interface); gx_devices[GX_DEVICE_USB].interface = &__io_usbstorage; gx_devices[GX_DEVICE_USB].name = "usb"; gx_devices[GX_DEVICE_USB].mounted = fatMountSimple(gx_devices[GX_DEVICE_USB].name, gx_devices[GX_DEVICE_USB].interface); LWP_MutexInit(&gx_device_mutex, false); LWP_CreateThread(&gx_device_thread, gx_devthread, NULL, NULL, 0, 66); #endif get_environment_settings(); make_directories(); config_set_defaults(); input_gx.init(); video_gx.start(); driver.video = &video_gx; gx_video_t *gx = (gx_video_t*)driver.video_data; gx->menu_data = (uint32_t *) menu_framebuf; char tmp_path[PATH_MAX]; const char *extension = default_paths.executable_extension; snprintf(tmp_path, sizeof(tmp_path), "%s/", default_paths.core_dir); const char *path_prefix = tmp_path; char full_path[1024]; snprintf(full_path, sizeof(full_path), "%sCORE%s", path_prefix, extension); bool find_libretro_file = rarch_configure_libretro_core(full_path, path_prefix, path_prefix, default_paths.config_file, extension); rarch_settings_set_default(&input_gx); rarch_config_load(default_paths.config_file, path_prefix, extension, find_libretro_file); char core_name[64]; rarch_console_name_from_id(core_name, sizeof(core_name)); char input_path[1024]; snprintf(input_path, sizeof(input_path), "%s/%s.cfg", default_paths.input_presets_dir, core_name); config_read_keybinds(input_path); init_libretro_sym(); input_gx.post_init(); menu_init(); if (argc > 2 && argv[1] != NULL && argv[2] != NULL) { char rom[PATH_MAX]; g_console.external_launcher_support = EXTERN_LAUNCHER_CHANNEL; snprintf(rom, sizeof(rom), "%s%s", argv[1], argv[2]); g_console.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE; rarch_console_load_game_wrap(rom, g_console.zip_extract_mode, S_DELAY_1); rgui_iterate(rgui, RGUI_ACTION_MESSAGE); gx->menu_render = true; rarch_render_cached_frame(); gx->menu_render = false; rarch_startup(default_paths.config_file); } else { g_console.external_launcher_support = EXTERN_LAUNCHER_SALAMANDER; } begin_loop: if(g_console.mode_switch == MODE_EMULATION) { bool repeat = false; input_gx.poll(NULL); video_set_aspect_ratio_func(g_console.aspect_ratio_index); audio_start_func(); do{ repeat = rarch_main_iterate(); }while(repeat && !g_console.frame_advance_enable); audio_stop_func(); } else if(g_console.mode_switch == MODE_MENU) { menu_loop(); if (g_console.mode_switch != MODE_EXIT) rarch_startup(default_paths.config_file); } else goto begin_shutdown; goto begin_loop; begin_shutdown: rarch_config_save(default_paths.config_file); config_save_keybinds(input_path); if(g_console.emulator_initialized) rarch_main_deinit(); input_gx.free(NULL); video_gx.stop(); menu_free(); #ifdef HAVE_LOGGER logger_shutdown(); #elif defined(HAVE_FILE_LOGGER) fclose(log_fp); #endif if(g_console.return_to_launcher) rarch_console_exec(g_console.launch_app_on_exit); exit(0); }