void config_set_defaults(void) { unsigned i, j; const char *def_video = config_get_default_video(); const char *def_audio = config_get_default_audio(); const char *def_input = config_get_default_input(); if (def_video) strlcpy(g_settings.video.driver, def_video, sizeof(g_settings.video.driver)); if (def_audio) strlcpy(g_settings.audio.driver, def_audio, sizeof(g_settings.audio.driver)); if (def_input) strlcpy(g_settings.input.driver, def_input, sizeof(g_settings.input.driver)); g_settings.video.xscale = xscale; g_settings.video.yscale = yscale; g_settings.video.fullscreen = g_extern.force_fullscreen ? true : fullscreen; g_settings.video.windowed_fullscreen = windowed_fullscreen; g_settings.video.monitor_index = monitor_index; g_settings.video.fullscreen_x = fullscreen_x; g_settings.video.fullscreen_y = fullscreen_y; g_settings.video.disable_composition = disable_composition; g_settings.video.vsync = vsync; g_settings.video.hard_sync = hard_sync; g_settings.video.hard_sync_frames = hard_sync_frames; g_settings.video.black_frame_insertion = black_frame_insertion; g_settings.video.swap_interval = swap_interval; g_settings.video.threaded = video_threaded; g_settings.video.smooth = video_smooth; g_settings.video.force_aspect = force_aspect; g_settings.video.scale_integer = scale_integer; g_settings.video.crop_overscan = crop_overscan; g_settings.video.aspect_ratio = aspect_ratio; g_settings.video.aspect_ratio_auto = aspect_ratio_auto; // Let implementation decide if automatic, or 1:1 PAR. g_settings.video.aspect_ratio_idx = aspect_ratio_idx; g_settings.video.shader_enable = shader_enable; g_settings.video.allow_rotate = allow_rotate; g_settings.video.font_enable = font_enable; g_settings.video.font_size = font_size; g_settings.video.font_scale = font_scale; g_settings.video.msg_pos_x = message_pos_offset_x; g_settings.video.msg_pos_y = message_pos_offset_y; g_settings.video.msg_color_r = ((message_color >> 16) & 0xff) / 255.0f; g_settings.video.msg_color_g = ((message_color >> 8) & 0xff) / 255.0f; g_settings.video.msg_color_b = ((message_color >> 0) & 0xff) / 255.0f; g_settings.video.refresh_rate = refresh_rate; g_settings.video.post_filter_record = post_filter_record; g_settings.video.gpu_record = gpu_record; g_settings.video.gpu_screenshot = gpu_screenshot; g_settings.video.rotation = ORIENTATION_NORMAL; g_settings.audio.enable = audio_enable; g_settings.audio.out_rate = out_rate; g_settings.audio.block_frames = 0; g_settings.audio.in_rate = out_rate; if (audio_device) strlcpy(g_settings.audio.device, audio_device, sizeof(g_settings.audio.device)); g_settings.audio.latency = out_latency; g_settings.audio.sync = audio_sync; g_settings.audio.rate_control = rate_control; g_settings.audio.rate_control_delta = rate_control_delta; g_settings.audio.volume = audio_volume; g_settings.rewind_enable = rewind_enable; g_settings.rewind_buffer_size = rewind_buffer_size; g_settings.rewind_granularity = rewind_granularity; g_settings.slowmotion_ratio = slowmotion_ratio; g_settings.fastforward_ratio = fastforward_ratio; g_settings.pause_nonactive = pause_nonactive; g_settings.autosave_interval = autosave_interval; g_settings.block_sram_overwrite = block_sram_overwrite; g_settings.savestate_auto_index = savestate_auto_index; g_settings.savestate_auto_save = savestate_auto_save; g_settings.savestate_auto_load = savestate_auto_load; g_settings.network_cmd_enable = network_cmd_enable; g_settings.network_cmd_port = network_cmd_port; g_settings.stdin_cmd_enable = stdin_cmd_enable; g_settings.game_history_size = game_history_size; g_settings.rgui_show_start_screen = rgui_show_start_screen; rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(retro_keybinds_1)); rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(retro_keybinds_rest)); memcpy(g_settings.input.binds[0], retro_keybinds_1, sizeof(retro_keybinds_1)); for (i = 1; i < MAX_PLAYERS; i++) memcpy(g_settings.input.binds[i], retro_keybinds_rest, sizeof(retro_keybinds_rest)); for (i = 0; i < MAX_PLAYERS; i++) { for (j = 0; j < RARCH_BIND_LIST_END; j++) { g_settings.input.autoconf_binds[i][j].joykey = NO_BTN; g_settings.input.autoconf_binds[i][j].joyaxis = AXIS_NONE; } } memset(g_settings.input.autoconfigured, 0, sizeof(g_settings.input.autoconfigured)); // Verify that binds are in proper order. for (i = 0; i < MAX_PLAYERS; i++) for (j = 0; j < RARCH_BIND_LIST_END; j++) if (g_settings.input.binds[i][j].valid) rarch_assert(j == g_settings.input.binds[i][j].id); g_settings.input.axis_threshold = axis_threshold; g_settings.input.netplay_client_swap_input = netplay_client_swap_input; g_settings.input.turbo_period = turbo_period; g_settings.input.turbo_duty_cycle = turbo_duty_cycle; g_settings.input.overlay_opacity = 1.0f; g_settings.input.overlay_scale = 1.0f; g_settings.input.debug_enable = input_debug_enable; g_settings.input.autodetect_enable = input_autodetect_enable; #ifdef ANDROID g_settings.input.back_behavior = BACK_BUTTON_QUIT; #endif for (i = 0; i < MAX_PLAYERS; i++) { g_settings.input.joypad_map[i] = i; if (!g_extern.has_set_libretro_device[i]) g_settings.input.libretro_device[i] = RETRO_DEVICE_JOYPAD; } g_extern.console.screen.viewports.custom_vp.width = 0; g_extern.console.screen.viewports.custom_vp.height = 0; g_extern.console.screen.viewports.custom_vp.x = 0; g_extern.console.screen.viewports.custom_vp.y = 0; // Make sure settings from other configs carry over into defaults for another config. if (!g_extern.has_set_save_path) *g_extern.savefile_dir = '\0'; if (!g_extern.has_set_state_path) *g_extern.savestate_dir = '\0'; *g_settings.libretro_info_path = '\0'; *g_settings.core_options_path = '\0'; *g_settings.game_history_path = '\0'; *g_settings.cheat_database = '\0'; *g_settings.cheat_settings_path = '\0'; *g_settings.screenshot_directory = '\0'; *g_settings.system_directory = '\0'; *g_settings.input.autoconfig_dir = '\0'; *g_settings.input.overlay = '\0'; #if defined(HAVE_RGUI) || defined(HAVE_RMENU) || defined(HAVE_RMENU_XUI) *g_settings.rgui_browser_directory = '\0'; *g_settings.rgui_config_directory = '\0'; #endif #ifdef RARCH_CONSOLE g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU); strlcpy(g_settings.system_directory, default_paths.system_dir, sizeof(g_settings.system_directory)); g_settings.video.msg_pos_x = 0.05f; g_settings.video.msg_pos_y = 0.90f; g_settings.video.aspect_ratio = -1.0f; // g_extern strlcpy(g_extern.savefile_dir, default_paths.sram_dir, sizeof(g_extern.savefile_dir)); g_extern.console.screen.gamma_correction = DEFAULT_GAMMA; g_extern.lifecycle_mode_state |= (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE); g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE); g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE); g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE); g_extern.console.screen.resolutions.current.id = 0; strlcpy(g_extern.savestate_dir, default_paths.savestate_dir, sizeof(g_extern.savestate_dir)); #ifdef HAVE_RMENU strlcpy(g_extern.menu_texture_path, default_paths.menu_border_file, sizeof(g_extern.menu_texture_path)); #endif g_extern.state_slot = 0; g_extern.audio_data.mute = 0; g_extern.verbose = true; g_extern.console.sound.mode = SOUND_MODE_NORMAL; #ifdef _XBOX1 g_extern.console.sound.volume_level = 0; #endif #endif #ifdef HAVE_OVERLAY #if defined(__QNX__) strlcpy(g_extern.overlay_dir, "app/native/overlays/", sizeof(g_extern.overlay_dir)); RARCH_LOG("Setting default overlay %s ...\n", "app/native/overlays/snes-landscape.cfg"); strlcpy(g_settings.input.overlay, "app/native/overlays/snes-landscape.cfg", sizeof(g_settings.input.overlay)); #elif defined(IOS) strlcpy(g_extern.overlay_dir, "/Applications/RetroArch.app/overlays/", sizeof(g_extern.overlay_dir)); #elif defined(ANDROID) strlcpy(g_extern.overlay_dir, "/data/data/org.retroarch/overlays/", sizeof(g_extern.overlay_dir)); #endif #endif #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL) #if defined(__QNX__) strlcpy(g_settings.video.shader_dir, "/app/native/shaders_glsl/", sizeof(g_settings.video.shader_dir)); #elif defined(IOS) strlcpy(g_settings.video.shader_dir, "/Applications/RetroArch.app/shaders_glsl/", sizeof(g_settings.video.shader_dir)); #elif defined(ANDROID) strlcpy(g_settings.video.shader_dir, "/data/data/org.retroarch/shaders_glsl/", sizeof(g_settings.video.shader_dir)); #endif #endif #if defined(ANDROID) strlcpy(g_settings.libretro_info_path, "/data/data/org.retroarch/info/", sizeof(g_settings.libretro_info_path)); #elif defined(__QNX__) strlcpy(g_settings.libretro_info_path, "app/native/info/", sizeof(g_settings.libretro_info_path)); #elif defined(IOS) strlcpy(g_settings.libretro_info_path, "/Applications/RetroArch.app/info/", sizeof(g_settings.libretro_info_path)); #endif g_extern.config_save_on_exit = config_save_on_exit; #if defined(HAVE_RMENU) || defined(HAVE_RGUI) || defined(HAVE_RMENU_XUI) /* Avoid reloading config on every ROM load */ g_extern.block_config_read = true; #endif rarch_init_msg_queue(); }
void config_set_defaults(void) { const char *def_video = config_get_default_video(); const char *def_audio = config_get_default_audio(); const char *def_input = config_get_default_input(); if (def_video) strlcpy(g_settings.video.driver, def_video, sizeof(g_settings.video.driver)); if (def_audio) strlcpy(g_settings.audio.driver, def_audio, sizeof(g_settings.audio.driver)); if (def_input) strlcpy(g_settings.input.driver, def_input, sizeof(g_settings.input.driver)); g_settings.video.xscale = xscale; g_settings.video.yscale = yscale; g_settings.video.fullscreen = g_extern.force_fullscreen ? true : fullscreen; g_settings.video.windowed_fullscreen = windowed_fullscreen; g_settings.video.monitor_index = monitor_index; g_settings.video.fullscreen_x = fullscreen_x; g_settings.video.fullscreen_y = fullscreen_y; g_settings.video.disable_composition = disable_composition; g_settings.video.vsync = vsync; g_settings.video.smooth = video_smooth; g_settings.video.force_aspect = force_aspect; g_settings.video.scale_integer = scale_integer; g_settings.video.crop_overscan = crop_overscan; g_settings.video.aspect_ratio = aspect_ratio; g_settings.video.aspect_ratio_auto = aspect_ratio_auto; // Let implementation decide if automatic, or 1:1 PAR. g_settings.video.shader_type = DEFAULT_SHADER_TYPE; g_settings.video.allow_rotate = allow_rotate; g_settings.video.font_enable = font_enable; g_settings.video.font_size = font_size; g_settings.video.font_scale = font_scale; g_settings.video.msg_pos_x = message_pos_offset_x; g_settings.video.msg_pos_y = message_pos_offset_y; g_settings.video.msg_color_r = ((message_color >> 16) & 0xff) / 255.0f; g_settings.video.msg_color_g = ((message_color >> 8) & 0xff) / 255.0f; g_settings.video.msg_color_b = ((message_color >> 0) & 0xff) / 255.0f; #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL) g_settings.video.render_to_texture = render_to_texture; g_settings.video.second_pass_smooth = second_pass_smooth; g_settings.video.fbo.scale_x = fbo_scale_x; g_settings.video.fbo.scale_y = fbo_scale_y; #endif g_settings.video.refresh_rate = refresh_rate; g_settings.video.post_filter_record = post_filter_record; g_settings.video.gpu_record = gpu_record; g_settings.video.gpu_screenshot = gpu_screenshot; g_settings.audio.enable = audio_enable; g_settings.audio.out_rate = out_rate; g_settings.audio.in_rate = out_rate; g_settings.audio.rate_step = audio_rate_step; if (audio_device) strlcpy(g_settings.audio.device, audio_device, sizeof(g_settings.audio.device)); g_settings.audio.latency = out_latency; g_settings.audio.sync = audio_sync; g_settings.audio.rate_control = rate_control; g_settings.audio.rate_control_delta = rate_control_delta; g_settings.audio.volume = audio_volume; strlcpy(g_settings.audio.resampler, audio_resampler, sizeof(g_settings.audio.resampler)); g_settings.rewind_enable = rewind_enable; g_settings.rewind_buffer_size = rewind_buffer_size; g_settings.rewind_granularity = rewind_granularity; g_settings.slowmotion_ratio = slowmotion_ratio; g_settings.pause_nonactive = pause_nonactive; g_settings.autosave_interval = autosave_interval; g_settings.block_sram_overwrite = block_sram_overwrite; g_settings.savestate_auto_index = savestate_auto_index; g_settings.savestate_auto_save = savestate_auto_save; g_settings.savestate_auto_load = savestate_auto_load; g_settings.network_cmd_enable = network_cmd_enable; g_settings.network_cmd_port = network_cmd_port; g_settings.stdin_cmd_enable = stdin_cmd_enable; rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(retro_keybinds_1)); rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(retro_keybinds_rest)); memcpy(g_settings.input.binds[0], retro_keybinds_1, sizeof(retro_keybinds_1)); for (unsigned i = 1; i < MAX_PLAYERS; i++) memcpy(g_settings.input.binds[i], retro_keybinds_rest, sizeof(retro_keybinds_rest)); // Verify that binds are in proper order. for (int i = 0; i < MAX_PLAYERS; i++) for (int j = 0; j < RARCH_BIND_LIST_END; j++) if (g_settings.input.binds[i][j].valid) rarch_assert(j == g_settings.input.binds[i][j].id); g_settings.input.axis_threshold = axis_threshold; g_settings.input.netplay_client_swap_input = netplay_client_swap_input; g_settings.input.turbo_period = turbo_period; g_settings.input.turbo_duty_cycle = turbo_duty_cycle; g_settings.input.overlay_opacity = 1.0f; g_settings.input.debug_enable = input_debug_enable; #ifdef ANDROID g_settings.input.autodetect_enable = input_autodetect_enable; #endif for (int i = 0; i < MAX_PLAYERS; i++) g_settings.input.joypad_map[i] = i; #ifdef RARCH_CONSOLE g_extern.lifecycle_mode_state |= ((1ULL << MODE_INFO_DRAW) | (1ULL << MODE_MENU)); #if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) strlcpy(g_settings.video.cg_shader_path, default_paths.shader_file, sizeof(g_settings.video.cg_shader_path)); strlcpy(g_settings.video.second_pass_shader, default_paths.shader_file, sizeof(g_settings.video.second_pass_shader)); #endif strlcpy(g_settings.system_directory, default_paths.system_dir, sizeof(g_settings.system_directory)); g_settings.video.msg_pos_x = 0.05f; g_settings.video.msg_pos_y = 0.90f; g_settings.video.aspect_ratio = -1.0f; // g_extern strlcpy(g_extern.console.main_wrap.default_sram_dir, default_paths.sram_dir, sizeof(g_extern.console.main_wrap.default_sram_dir)); g_extern.console.screen.overscan_amount = 0.0f; g_extern.console.screen.gamma_correction = DEFAULT_GAMMA; g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_OVERSCAN_ENABLE); g_extern.lifecycle_mode_state |= (1ULL << MODE_AUDIO_CUSTOM_BGM_ENABLE); g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_SCREENSHOTS_ENABLE); g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_THROTTLE_ENABLE); g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE); g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_SOFT_FILTER_ENABLE); g_extern.lifecycle_mode_state |= (1ULL << MODE_VIDEO_FLICKER_FILTER_ENABLE); g_extern.console.screen.orientation = ORIENTATION_NORMAL; g_extern.console.screen.resolutions.current.id = 0; strlcpy(g_extern.console.main_wrap.default_rom_startup_dir, default_paths.filebrowser_startup_dir, sizeof(g_extern.console.main_wrap.default_rom_startup_dir)); strlcpy(g_extern.console.main_wrap.default_savestate_dir, default_paths.savestate_dir, sizeof(g_extern.console.main_wrap.default_savestate_dir)); strlcpy(g_extern.console.menu_texture_path, default_paths.menu_border_file, sizeof(g_extern.console.menu_texture_path)); #if defined(__CELLOS_LV2) || defined(_XBOX360) g_settings.video.aspect_ratio_idx = ASPECT_RATIO_16_9; #elif defined(GEKKO) || defined(_XBOX1) g_settings.video.aspect_ratio_idx = ASPECT_RATIO_4_3; #else g_settings.video.aspect_ratio_idx = 0; #endif g_extern.state_slot = 0; g_extern.audio_data.mute = 0; g_extern.verbose = true; g_extern.console.sound.mode = SOUND_MODE_NORMAL; g_extern.console.screen.viewports.custom_vp.width = 0; g_extern.console.screen.viewports.custom_vp.height = 0; g_extern.console.screen.viewports.custom_vp.x = 0; g_extern.console.screen.viewports.custom_vp.y = 0; #ifdef _XBOX1 g_extern.console.sound.volume_level = 0; #endif g_extern.block_config_read = true; #endif rarch_init_msg_queue(); }