int main(int argc, char *argv[]) { get_environment_settings(); rarch_main_clear_state(); config_set_defaults(); char full_path[1024]; snprintf(full_path, sizeof(full_path), "game:\\CORE.xex"); bool find_libretro_file = rarch_configure_libretro_core(full_path, "game:\\", "game:\\", SYS_CONFIG_FILE, ".xex"); set_default_settings(); rarch_config_load(SYS_CONFIG_FILE, "game:\\", ".xex", find_libretro_file); init_libretro_sym(); video_xdk360.start(); input_xdk360.init(); rarch_input_set_default_keybind_names_for_emulator(); menu_init(); begin_loop: if(g_console.mode_switch == MODE_EMULATION) { bool repeat = false; input_xdk360.poll(NULL); rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height); do{ repeat = rarch_main_iterate(); }while(repeat && !g_console.frame_advance_enable); } else if(g_console.mode_switch == MODE_MENU) { menu_loop(); rarch_startup(SYS_CONFIG_FILE); } else goto begin_shutdown; goto begin_loop; begin_shutdown: if(path_file_exists(SYS_CONFIG_FILE)) rarch_config_save(SYS_CONFIG_FILE); menu_free(); video_xdk360.stop(); input_xdk360.free(NULL); rarch_exec(); return 0; }
int main(int argc, char *argv[]) { #ifdef HAVE_SYSUTILS RARCH_LOG("Registering system utility callback...\n"); cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL); #endif #ifdef HAVE_SYSMODULES cellSysmoduleLoadModule(CELL_SYSMODULE_IO); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_AVCONF_EXT); cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC); cellSysmoduleLoadModule(CELL_SYSMODULE_JPGDEC); cellSysmoduleLoadModule(CELL_SYSMODULE_NET); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP); #endif sys_net_initialize_network(); #ifdef HAVE_LOGGER logger_init(); #endif sceNpInit(NP_POOL_SIZE, np_pool); rarch_main_clear_state(); get_environment_settings(argc, argv); config_set_defaults(); input_ps3.init(); char tmp_path[PATH_MAX]; snprintf(tmp_path, sizeof(tmp_path), "%s/", default_paths.core_dir); rarch_configure_libretro(&input_ps3, tmp_path, default_paths.executable_extension); #if(CELL_SDK_VERSION > 0x340000) if (g_console.screenshots_enable) { #ifdef HAVE_SYSMODULES cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); #endif #ifdef HAVE_SYSUTILS CellScreenShotSetParam screenshot_param = {0, 0, 0, 0}; screenshot_param.photo_title = "RetroArch PS3"; screenshot_param.game_title = "RetroArch PS3"; cellScreenShotSetParameter (&screenshot_param); cellScreenShotEnable(); #endif } #ifdef HAVE_SYSUTILS if (g_console.custom_bgm_enable) cellSysutilEnableBgmPlayback(); #endif #endif video_gl.start(); #ifdef HAVE_OSKUTIL oskutil_init(&g_console.oskutil_handle, 0); #endif rarch_input_set_default_keybind_names_for_emulator(); menu_init(); switch(g_console.external_launcher_support) { case EXTERN_LAUNCHER_SALAMANDER: g_console.mode_switch = MODE_MENU; break; #ifdef HAVE_MULTIMAN case EXTERN_LAUNCHER_MULTIMAN: RARCH_LOG("Started from multiMAN, will auto-start game.\n"); strlcpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path)); rarch_settings_change(S_START_RARCH); rarch_startup(default_paths.config_file); break; #endif default: break; } begin_loop: if(g_console.mode_switch == MODE_EMULATION) { bool repeat = false; input_ps3.poll(NULL); rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height); do{ repeat = rarch_main_iterate(); }while(repeat && !g_console.frame_advance_enable); } else if(g_console.mode_switch == MODE_MENU) { menu_loop(); rarch_startup(default_paths.config_file); } else goto begin_shutdown; goto begin_loop; begin_shutdown: if(path_file_exists(default_paths.config_file)) rarch_config_save(default_paths.config_file); if(g_console.emulator_initialized) rarch_main_deinit(); input_ps3.free(NULL); video_gl.stop(); menu_free(); #ifdef HAVE_OSKUTIL if(g_console.oskutil_handle.is_running) oskutil_unload(&g_console.oskutil_handle); #endif #ifdef HAVE_LOGGER logger_shutdown(); #endif #ifdef HAVE_SYSMODULES if(g_console.screenshots_enable) cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC); cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC); cellSysmoduleUnloadModule(CELL_SYSMODULE_AVCONF_EXT); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME); #endif #ifdef HAVE_HDD_CACHE_PARTITION int ret = cellSysCacheClear(); if(ret != CELL_SYSCACHE_RET_OK_CLEARED) { RARCH_ERR("System cache partition could not be cleared on exit.\n"); } #endif rarch_exec(); return 1; }
int main(int argc, char *argv[]) { rarch_main_clear_state(); get_environment_settings(); config_set_defaults(); input_xinput.init(); #ifdef _XBOX1 char path_prefix[256]; snprintf(path_prefix, sizeof(path_prefix), "D:\\"); #else const char *path_prefix = default_paths.filesystem_root_dir; #endif const char *extension = default_paths.executable_extension; const input_driver_t *input = &input_xinput; 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(); rarch_input_set_controls_default(input); rarch_config_load(default_paths.config_file, find_libretro_file); init_libretro_sym(); input_xinput.post_init(); #if defined(HAVE_D3D9) || defined(HAVE_D3D8) video_xdk_d3d.start(); driver.video = &video_xdk_d3d; #else video_null.start(); driver.video = &video_null; #endif system_init(); menu_init(); begin_loop: if(g_extern.console.rmenu.mode == MODE_EMULATION) { bool repeat = false; input_xinput.poll(NULL); driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx); do{ repeat = rarch_main_iterate(); }while(repeat && !g_extern.console.screen.state.frame_advance.enable); } else if(g_extern.console.rmenu.mode == MODE_MENU) { menu_loop(); if (g_extern.console.rmenu.mode != MODE_EXIT) rarch_startup(default_paths.config_file); } else goto begin_shutdown; goto begin_loop; begin_shutdown: rarch_config_save(default_paths.config_file); menu_free(); #if defined(HAVE_D3D8) || defined(HAVE_D3D9) video_xdk_d3d.stop(); #else video_null.stop(); #endif input_xinput.free(NULL); if(g_extern.console.external_launch.enable) rarch_console_exec(g_extern.console.external_launch.launch_app); return 0; }
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); }
void rarch_config_load(const char *conf_name, bool upgrade_core_succeeded) { char libretro_path_tmp[PATH_MAX]; //if a core has been upgraded, settings need to saved at the end if(upgrade_core_succeeded) snprintf(libretro_path_tmp, sizeof(libretro_path_tmp), g_settings.libretro); config_file_t * conf = config_file_new(conf_name); if(!conf) { #ifdef RARCH_CONSOLE FILE * f; RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", conf_name); f = fopen(conf_name, "w"); fclose(f); #endif return; } // g_settings CONFIG_GET_STRING(libretro, "libretro_path"); CONFIG_GET_STRING(system_directory, "system_directory"); #ifdef HAVE_XML CONFIG_GET_STRING(cheat_database, "cheat_database"); #endif CONFIG_GET_BOOL(rewind_enable, "rewind_enable"); CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader"); #ifdef HAVE_FBO CONFIG_GET_STRING(video.second_pass_shader, "video_second_pass_shader"); CONFIG_GET_FLOAT(video.fbo.scale_x, "video_fbo_scale_x"); CONFIG_GET_FLOAT(video.fbo.scale_y, "video_fbo_scale_y"); CONFIG_GET_BOOL(video.render_to_texture, "video_render_to_texture"); CONFIG_GET_BOOL(video.second_pass_smooth, "video_second_pass_smooth"); #endif CONFIG_GET_BOOL(video.smooth, "video_smooth"); #ifdef HAVE_FBO CONFIG_GET_BOOL(video.fbo.enable, "fbo_enabled"); #endif CONFIG_GET_BOOL(video.vsync, "video_vsync"); CONFIG_GET_INT(video.aspect_ratio_idx, "aspect_ratio_index"); CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio"); CONFIG_GET_STRING(audio.device, "audio_device"); CONFIG_GET_BOOL(audio.rate_control, "audio_rate_control"); CONFIG_GET_FLOAT(audio.rate_control_delta, "audio_rate_control_delta"); for (unsigned i = 0; i < 7; i++) { char cfg[64]; snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1); CONFIG_GET_INT(input.dpad_emulation[i], cfg); snprintf(cfg, sizeof(cfg), "input_device_p%u", i + 1); CONFIG_GET_INT(input.device[i], cfg); } // g_extern CONFIG_GET_STRING_EXTERN(console.main_wrap.paths.default_rom_startup_dir, "default_rom_startup_dir"); CONFIG_GET_BOOL_EXTERN(console.screen.gamma_correction, "gamma_correction"); CONFIG_GET_BOOL_EXTERN(console.rmenu.state.msg_info.enable, "info_msg_enable"); CONFIG_GET_BOOL_EXTERN(console.screen.state.screenshots.enable, "screenshots_enable"); CONFIG_GET_BOOL_EXTERN(console.screen.state.throttle.enable, "throttle_enable"); CONFIG_GET_BOOL_EXTERN(console.screen.state.triple_buffering.enable, "triple_buffering_enable"); CONFIG_GET_BOOL_EXTERN(console.screen.state.overscan.enable, "overscan_enable"); CONFIG_GET_BOOL_EXTERN(console.sound.custom_bgm.enable, "custom_bgm_enable"); CONFIG_GET_FLOAT_EXTERN(console.screen.overscan_amount, "overscan_amount"); #ifdef _XBOX1 CONFIG_GET_INT_EXTERN(console.screen.state.flicker_filter.enable, "flicker_filter"); CONFIG_GET_INT_EXTERN(console.sound.volume_level, "sound_volume_level"); #endif #ifdef HAVE_ZLIB CONFIG_GET_INT_EXTERN(file_state.zip_extract_mode, "zip_extract_mode"); #endif #ifdef _XBOX360 CONFIG_GET_INT(video.color_format, "color_format"); #endif CONFIG_GET_INT_EXTERN(console.screen.resolutions.current.id, "current_resolution_id"); CONFIG_GET_INT_EXTERN(state_slot, "state_slot"); CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute"); CONFIG_GET_BOOL_EXTERN(console.screen.state.soft_filter.enable, "soft_display_filter_enable"); CONFIG_GET_INT_EXTERN(console.screen.orientation, "screen_orientation"); CONFIG_GET_INT_EXTERN(console.sound.mode, "sound_mode"); CONFIG_GET_INT_EXTERN(console.screen.viewports.custom_vp.x, "custom_viewport_x"); CONFIG_GET_INT_EXTERN(console.screen.viewports.custom_vp.y, "custom_viewport_y"); CONFIG_GET_INT_EXTERN(console.screen.viewports.custom_vp.width, "custom_viewport_width"); CONFIG_GET_INT_EXTERN(console.screen.viewports.custom_vp.height, "custom_viewport_height"); CONFIG_GET_FLOAT_EXTERN(console.rmenu.font_size, "menu_font_size"); if(upgrade_core_succeeded) { //save config file with new libretro path snprintf(g_settings.libretro, sizeof(g_settings.libretro), libretro_path_tmp); rarch_config_save(conf_name); } }
int main(int argc, char *argv[]) { get_environment_settings(); rarch_main_clear_state(); config_set_defaults(); #ifdef _XBOX1 configure_libretro("D:\\", ".xbe"); #else configure_libretro("game:\\", ".xex"); #endif #if defined(HAVE_D3D8) || defined(HAVE_D3D9) video_xdk_d3d.start(); #else video_null.start(); #endif input_xinput.init(); rarch_input_set_default_keybind_names_for_emulator(); menu_init(); begin_loop: if(g_console.mode_switch == MODE_EMULATION) { bool repeat = false; input_xinput.poll(NULL); rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height); do { repeat = rarch_main_iterate(); } while(repeat && !g_console.frame_advance_enable); } else if(g_console.mode_switch == MODE_MENU) { menu_loop(); rarch_startup(SYS_CONFIG_FILE); } else goto begin_shutdown; goto begin_loop; begin_shutdown: if(path_file_exists(SYS_CONFIG_FILE)) rarch_config_save(SYS_CONFIG_FILE); menu_free(); #if defined(HAVE_D3D8) || defined(HAVE_D3D9) video_xdk_d3d.stop(); #else video_null.stop(); #endif input_xinput.free(NULL); rarch_exec(); return 0; }