mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
(RARCH_CONSOLE) Move rarch_config_save to settings.c - rename to
config_save_file
This commit is contained in:
parent
2c26f92c7d
commit
c0c81bf22b
@ -111,87 +111,6 @@ void rarch_config_load(const char *path, bool upgrade_core_succeeded)
|
||||
{
|
||||
//save config file with new libretro path
|
||||
snprintf(g_settings.libretro, sizeof(g_settings.libretro), libretro_path_tmp);
|
||||
rarch_config_save(path);
|
||||
config_save_file(path);
|
||||
}
|
||||
}
|
||||
|
||||
void rarch_config_save(const char *path)
|
||||
{
|
||||
config_file_t * conf = config_file_new(path);
|
||||
|
||||
if(!conf)
|
||||
{
|
||||
RARCH_ERR("Failed to write config file to \"%s\". Check permissions.\n", path);
|
||||
return;
|
||||
}
|
||||
|
||||
// g_settings
|
||||
config_set_string(conf, "libretro_path", g_settings.libretro);
|
||||
#ifdef HAVE_XML
|
||||
config_set_string(conf, "cheat_database_path", g_settings.cheat_database);
|
||||
#endif
|
||||
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
|
||||
config_set_string(conf, "video_cg_shader", g_settings.video.cg_shader_path);
|
||||
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
|
||||
#ifdef HAVE_FBO
|
||||
config_set_float(conf, "video_fbo_scale_x", g_settings.video.fbo.scale_x);
|
||||
config_set_float(conf, "video_fbo_scale_y", g_settings.video.fbo.scale_y);
|
||||
config_set_string(conf, "video_second_pass_shader", g_settings.video.second_pass_shader);
|
||||
config_set_bool(conf, "video_render_to_texture", g_settings.video.render_to_texture);
|
||||
config_set_bool(conf, "video_second_pass_smooth", g_settings.video.second_pass_smooth);
|
||||
#endif
|
||||
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
|
||||
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
|
||||
config_set_int(conf, "aspect_ratio_index", g_settings.video.aspect_ratio_idx);
|
||||
config_set_string(conf, "audio_device", g_settings.audio.device);
|
||||
config_set_bool(conf, "audio_rate_control", g_settings.audio.rate_control);
|
||||
config_set_float(conf, "audio_rate_control_delta", g_settings.audio.rate_control_delta);
|
||||
config_set_string(conf, "system_directory", g_settings.system_directory);
|
||||
|
||||
for (unsigned i = 0; i < 7; i++)
|
||||
{
|
||||
char cfg[64];
|
||||
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
||||
config_set_int(conf, cfg, g_settings.input.dpad_emulation[i]);
|
||||
snprintf(cfg, sizeof(cfg), "input_device_p%u", i + 1);
|
||||
config_set_int(conf, cfg, g_settings.input.device[i]);
|
||||
}
|
||||
|
||||
config_set_bool(conf, "overscan_enable", g_extern.console.screen.state.overscan.enable);
|
||||
config_set_bool(conf, "screenshots_enable", g_extern.console.screen.state.screenshots.enable);
|
||||
config_set_bool(conf, "gamma_correction", g_extern.console.screen.gamma_correction);
|
||||
#ifdef _XBOX1
|
||||
config_set_int(conf, "flicker_filter", g_extern.console.screen.state.flicker_filter.value);
|
||||
config_set_int(conf, "sound_volume_level", g_extern.console.sound.volume_level);
|
||||
#endif
|
||||
config_set_bool(conf, "throttle_enable", g_extern.console.screen.state.throttle.enable);
|
||||
config_set_bool(conf, "triple_buffering_enable", g_extern.console.screen.state.triple_buffering.enable);
|
||||
config_set_bool(conf, "info_msg_enable", g_extern.console.rmenu.state.msg_info.enable);
|
||||
config_set_int(conf, "current_resolution_id", g_extern.console.screen.resolutions.current.id);
|
||||
config_set_int(conf, "custom_viewport_width", g_extern.console.screen.viewports.custom_vp.width);
|
||||
config_set_int(conf, "custom_viewport_height", g_extern.console.screen.viewports.custom_vp.height);
|
||||
config_set_int(conf, "custom_viewport_x", g_extern.console.screen.viewports.custom_vp.x);
|
||||
config_set_int(conf, "custom_viewport_y", g_extern.console.screen.viewports.custom_vp.y);
|
||||
config_set_string(conf, "default_rom_startup_dir", g_extern.console.main_wrap.paths.default_rom_startup_dir);
|
||||
config_set_float(conf, "menu_font_size", g_extern.console.rmenu.font_size);
|
||||
config_set_float(conf, "overscan_amount", g_extern.console.screen.overscan_amount);
|
||||
#ifdef HAVE_ZLIB
|
||||
config_set_int(conf, "zip_extract_mode", g_extern.file_state.zip_extract_mode);
|
||||
#endif
|
||||
|
||||
// g_extern
|
||||
config_set_int(conf, "sound_mode", g_extern.console.sound.mode);
|
||||
config_set_int(conf, "state_slot", g_extern.state_slot);
|
||||
config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
|
||||
config_set_bool(conf, "soft_display_filter_enable", g_extern.console.screen.state.soft_filter.enable);
|
||||
config_set_int(conf, "screen_orientation", g_extern.console.screen.orientation);
|
||||
config_set_bool(conf, "custom_bgm_enable", g_extern.console.sound.custom_bgm.enable);
|
||||
|
||||
config_set_bool(conf, "sram_dir_enable", g_extern.console.main_wrap.state.default_sram_dir.enable);
|
||||
config_set_bool(conf, "savestate_dir_enable", g_extern.console.main_wrap.state.default_savestate_dir.enable);
|
||||
|
||||
if (!config_file_write(conf, path))
|
||||
RARCH_ERR("Failed to write config file to \"%s\". Check permissions.\n", path);
|
||||
|
||||
free(conf);
|
||||
}
|
||||
|
@ -25,6 +25,5 @@ enum
|
||||
};
|
||||
|
||||
void rarch_config_load(const char *path, bool upgrade_core_succeeded);
|
||||
void rarch_config_save(const char *path);
|
||||
|
||||
#endif
|
||||
|
@ -608,6 +608,9 @@ const char *config_get_default_input(void);
|
||||
|
||||
#include "conf/config_file.h"
|
||||
bool config_load_file(const char *path);
|
||||
#ifdef RARCH_CONSOLE
|
||||
bool config_save_file(const char *path);
|
||||
#endif
|
||||
bool config_read_keybinds(const char *path);
|
||||
bool config_save_keybinds(const char *path);
|
||||
|
||||
|
@ -593,7 +593,7 @@ begin_loop:
|
||||
goto begin_loop;
|
||||
|
||||
begin_shutdown:
|
||||
rarch_config_save(default_paths.config_file);
|
||||
config_save_file(default_paths.config_file);
|
||||
config_save_keybinds(input_path);
|
||||
|
||||
if(g_extern.console.emulator_initialized)
|
||||
|
@ -365,7 +365,7 @@ begin_loop:
|
||||
goto begin_loop;
|
||||
|
||||
begin_shutdown:
|
||||
rarch_config_save(default_paths.config_file);
|
||||
config_save_file(default_paths.config_file);
|
||||
|
||||
if(g_extern.console.emulator_initialized)
|
||||
rarch_main_deinit();
|
||||
|
@ -191,7 +191,7 @@ begin_loop:
|
||||
goto begin_loop;
|
||||
|
||||
begin_shutdown:
|
||||
rarch_config_save(default_paths.config_file);
|
||||
config_save_file(default_paths.config_file);
|
||||
|
||||
if(g_extern.console.emulator_initialized)
|
||||
rarch_main_deinit();
|
||||
|
80
settings.c
80
settings.c
@ -941,6 +941,8 @@ static void save_keybind(config_file_t *conf,
|
||||
save_keybind_key(conf, map, bind);
|
||||
save_keybind_joykey(conf, map, bind);
|
||||
save_keybind_axis(conf, map, bind);
|
||||
#ifdef RARCH_CONSOLE
|
||||
#endif
|
||||
}
|
||||
|
||||
static void save_keybinds_player(config_file_t *conf, unsigned i)
|
||||
@ -949,6 +951,84 @@ static void save_keybinds_player(config_file_t *conf, unsigned i)
|
||||
save_keybind(conf, &bind_maps[i][j], &g_settings.input.binds[i][j]);
|
||||
}
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
bool config_save_file(const char *path)
|
||||
{
|
||||
config_file_t *conf = config_file_new(path);
|
||||
if (!conf)
|
||||
conf = config_file_new(NULL);
|
||||
if (!conf)
|
||||
return false;
|
||||
|
||||
config_set_string(conf, "libretro_path", g_settings.libretro);
|
||||
config_set_string(conf, "cheat_database_path", g_settings.cheat_database);
|
||||
config_set_bool(conf, "rewind_enable", g_settings.rewind_enable);
|
||||
config_set_string(conf, "video_cg_shader", g_settings.video.cg_shader_path);
|
||||
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
|
||||
#ifdef HAVE_FBO
|
||||
config_set_float(conf, "video_fbo_scale_x", g_settings.video.fbo.scale_x);
|
||||
config_set_float(conf, "video_fbo_scale_y", g_settings.video.fbo.scale_y);
|
||||
config_set_string(conf, "video_second_pass_shader", g_settings.video.second_pass_shader);
|
||||
config_set_bool(conf, "video_render_to_texture", g_settings.video.render_to_texture);
|
||||
config_set_bool(conf, "video_second_pass_smooth", g_settings.video.second_pass_smooth);
|
||||
#endif
|
||||
config_set_bool(conf, "video_smooth", g_settings.video.smooth);
|
||||
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
|
||||
config_set_int(conf, "aspect_ratio_index", g_settings.video.aspect_ratio_idx);
|
||||
config_set_string(conf, "audio_device", g_settings.audio.device);
|
||||
config_set_bool(conf, "audio_rate_control", g_settings.audio.rate_control);
|
||||
config_set_float(conf, "audio_rate_control_delta", g_settings.audio.rate_control_delta);
|
||||
config_set_string(conf, "system_directory", g_settings.system_directory);
|
||||
|
||||
config_set_bool(conf, "overscan_enable", g_extern.console.screen.state.overscan.enable);
|
||||
config_set_bool(conf, "screenshots_enable", g_extern.console.screen.state.screenshots.enable);
|
||||
config_set_bool(conf, "gamma_correction", g_extern.console.screen.gamma_correction);
|
||||
#ifdef _XBOX1
|
||||
config_set_int(conf, "flicker_filter", g_extern.console.screen.state.flicker_filter.value);
|
||||
config_set_int(conf, "sound_volume_level", g_extern.console.sound.volume_level);
|
||||
#endif
|
||||
config_set_bool(conf, "throttle_enable", g_extern.console.screen.state.throttle.enable);
|
||||
config_set_bool(conf, "triple_buffering_enable", g_extern.console.screen.state.triple_buffering.enable);
|
||||
config_set_bool(conf, "info_msg_enable", g_extern.console.rmenu.state.msg_info.enable);
|
||||
config_set_int(conf, "current_resolution_id", g_extern.console.screen.resolutions.current.id);
|
||||
config_set_int(conf, "custom_viewport_width", g_extern.console.screen.viewports.custom_vp.width);
|
||||
config_set_int(conf, "custom_viewport_height", g_extern.console.screen.viewports.custom_vp.height);
|
||||
config_set_int(conf, "custom_viewport_x", g_extern.console.screen.viewports.custom_vp.x);
|
||||
config_set_int(conf, "custom_viewport_y", g_extern.console.screen.viewports.custom_vp.y);
|
||||
config_set_string(conf, "default_rom_startup_dir", g_extern.console.main_wrap.paths.default_rom_startup_dir);
|
||||
config_set_float(conf, "menu_font_size", g_extern.console.rmenu.font_size);
|
||||
config_set_float(conf, "overscan_amount", g_extern.console.screen.overscan_amount);
|
||||
#ifdef HAVE_ZLIB
|
||||
config_set_int(conf, "zip_extract_mode", g_extern.file_state.zip_extract_mode);
|
||||
#endif
|
||||
|
||||
// g_extern
|
||||
config_set_int(conf, "sound_mode", g_extern.console.sound.mode);
|
||||
config_set_int(conf, "state_slot", g_extern.state_slot);
|
||||
config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
|
||||
config_set_bool(conf, "soft_display_filter_enable", g_extern.console.screen.state.soft_filter.enable);
|
||||
config_set_int(conf, "screen_orientation", g_extern.console.screen.orientation);
|
||||
config_set_bool(conf, "custom_bgm_enable", g_extern.console.sound.custom_bgm.enable);
|
||||
|
||||
config_set_bool(conf, "sram_dir_enable", g_extern.console.main_wrap.state.default_sram_dir.enable);
|
||||
config_set_bool(conf, "savestate_dir_enable", g_extern.console.main_wrap.state.default_savestate_dir.enable);
|
||||
|
||||
for (unsigned i = 0; i < MAX_PLAYERS; i++)
|
||||
{
|
||||
char cfg[64];
|
||||
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
|
||||
config_set_int(conf, cfg, g_settings.input.dpad_emulation[i]);
|
||||
snprintf(cfg, sizeof(cfg), "input_device_p%u", i + 1);
|
||||
config_set_int(conf, cfg, g_settings.input.device[i]);
|
||||
}
|
||||
|
||||
config_file_write(conf, path);
|
||||
config_file_free(conf);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool config_save_keybinds(const char *path)
|
||||
{
|
||||
config_file_t *conf = config_file_new(path);
|
||||
|
@ -204,7 +204,7 @@ begin_loop:
|
||||
goto begin_loop;
|
||||
|
||||
begin_shutdown:
|
||||
rarch_config_save(default_paths.config_file);
|
||||
config_save_file(default_paths.config_file);
|
||||
|
||||
menu_free();
|
||||
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
|
||||
|
Loading…
Reference in New Issue
Block a user