(360/PS3) use rarch_config_load for PS3 and 360

This commit is contained in:
Twinaphex 2012-05-28 21:20:39 +02:00
parent 148526a638
commit 472ac47344
4 changed files with 83 additions and 125 deletions

View File

@ -185,59 +185,6 @@ static void set_default_settings (void)
g_extern.verbose = true;
}
static void init_settings (bool load_libretro_path)
{
if(!path_file_exists(SYS_CONFIG_FILE))
rarch_config_create_default(SYS_CONFIG_FILE);
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
#ifdef HAVE_LIBRETRO_MANAGEMENT
if(load_libretro_path)
{
CONFIG_GET_STRING(libretro, "libretro_path");
if(!strcmp(g_settings.libretro, ""))
{
const char *first_file = rarch_manage_libretro_set_first_file("game:\\", ".xex");
if(first_file != NULL)
strlcpy(g_settings.libretro, first_file, sizeof(g_settings.libretro));
}
}
#endif
// g_settings
CONFIG_GET_STRING(cheat_database, "cheat_database");
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader");
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");
CONFIG_GET_BOOL(video.smooth, "video_smooth");
CONFIG_GET_BOOL(video.vsync, "video_vsync");
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
// g_console
CONFIG_GET_BOOL_CONSOLE(fbo_enabled, "fbo_enabled");
CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable");
CONFIG_GET_BOOL_CONSOLE(gamma_correction_enable, "gamma_correction_enable");
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
CONFIG_GET_INT_CONSOLE(aspect_ratio_index, "aspect_ratio_index");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.x, "custom_viewport_x");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.y, "custom_viewport_y");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.width, "custom_viewport_width");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.height, "custom_viewport_height");
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
CONFIG_GET_INT_CONSOLE(color_format, "color_format");
// g_extern
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
}
static void get_environment_settings (void)
{
DWORD ret;
@ -338,7 +285,7 @@ int main(int argc, char *argv[])
find_libretro_file = true;
set_default_settings();
init_settings(find_libretro_file);
rarch_config_load(SYS_CONFIG_FILE, "game:\\", ".xex", find_libretro_file);
init_libretro_sym();
video_xdk360.start();

View File

@ -714,6 +714,86 @@ void rarch_config_create_default(const char * conf_name)
fclose(f);
}
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path)
{
if(!path_file_exists(conf_name))
rarch_config_create_default(conf_name);
else
{
config_file_t * conf = config_file_new(conf_name);
// g_settings
#ifdef HAVE_LIBRETRO_MANAGEMENT
if(find_libretro_path)
{
CONFIG_GET_STRING(libretro, "libretro_path");
if(!strcmp(g_settings.libretro, ""))
{
const char *first_file = rarch_manage_libretro_set_first_file(libretro_dir_path, exe_ext);
if(first_file != NULL)
strlcpy(g_settings.libretro, first_file, sizeof(g_settings.libretro));
}
}
#endif
CONFIG_GET_STRING(cheat_database, "cheat_database");
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
#ifdef _XBOX
CONFIG_GET_BOOL_CONSOLE(gamma_correction_enable, "gamma_correction_enable");
CONFIG_GET_INT_CONSOLE(color_format, "color_format");
#endif
CONFIG_GET_BOOL(video.smooth, "video_smooth");
CONFIG_GET_BOOL(video.vsync, "video_vsync");
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
CONFIG_GET_STRING(audio.device, "audio_device");
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);
}
// g_console
#ifdef HAVE_FBO
CONFIG_GET_BOOL_CONSOLE(fbo_enabled, "fbo_enabled");
#endif
#ifdef __CELLOS_LV2__
CONFIG_GET_BOOL_CONSOLE(custom_bgm_enable, "custom_bgm_enable");
#endif
CONFIG_GET_BOOL_CONSOLE(overscan_enable, "overscan_enable");
CONFIG_GET_BOOL_CONSOLE(screenshots_enable, "screenshots_enable");
CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable");
CONFIG_GET_BOOL_CONSOLE(triple_buffering_enable, "triple_buffering_enable");
CONFIG_GET_INT_CONSOLE(aspect_ratio_index, "aspect_ratio_index");
CONFIG_GET_INT_CONSOLE(current_resolution_id, "current_resolution_id");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.x, "custom_viewport_x");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.y, "custom_viewport_y");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.width, "custom_viewport_width");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.height, "custom_viewport_height");
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
CONFIG_GET_INT_CONSOLE(sound_mode, "sound_mode");
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
CONFIG_GET_FLOAT_CONSOLE(menu_font_size, "menu_font_size");
CONFIG_GET_FLOAT_CONSOLE(overscan_amount, "overscan_amount");
// g_extern
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
}
}
void rarch_config_save(const char * conf_name)
{
if(!path_file_exists(conf_name))

View File

@ -140,6 +140,7 @@ wchar_t * rarch_convert_char_to_wchar(const char * str);
const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr);
void rarch_config_create_default(const char * conf_name);
void rarch_config_load(const char * conf_name, const char * libretro_dir_path, const char * exe_ext, bool find_libretro_path);
void rarch_config_save(const char * conf_name);
#endif

View File

@ -153,76 +153,6 @@ static void set_default_settings(void)
g_extern.verbose = true;
}
static void init_settings(bool load_libretro_path)
{
if(!path_file_exists(SYS_CONFIG_FILE))
rarch_config_create_default(SYS_CONFIG_FILE);
else
{
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
// g_settings
#ifdef HAVE_LIBRETRO_MANAGEMENT
if(load_libretro_path)
{
CONFIG_GET_STRING(libretro, "libretro_path");
if(!strcmp(g_settings.libretro, ""))
{
const char *first_file = rarch_manage_libretro_set_first_file(LIBRETRO_DIR_PATH, ".SELF");
if(first_file != NULL)
strlcpy(g_settings.libretro, first_file, sizeof(g_settings.libretro));
}
}
#endif
CONFIG_GET_STRING(cheat_database, "cheat_database");
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
CONFIG_GET_STRING(video.cg_shader_path, "video_cg_shader");
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");
CONFIG_GET_BOOL(video.smooth, "video_smooth");
CONFIG_GET_BOOL(video.vsync, "video_vsync");
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
CONFIG_GET_STRING(audio.device, "audio_device");
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);
}
// g_console
CONFIG_GET_BOOL_CONSOLE(fbo_enabled, "fbo_enabled");
CONFIG_GET_BOOL_CONSOLE(custom_bgm_enable, "custom_bgm_enable");
CONFIG_GET_BOOL_CONSOLE(overscan_enable, "overscan_enable");
CONFIG_GET_BOOL_CONSOLE(screenshots_enable, "screenshots_enable");
CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable");
CONFIG_GET_BOOL_CONSOLE(triple_buffering_enable, "triple_buffering_enable");
CONFIG_GET_INT_CONSOLE(aspect_ratio_index, "aspect_ratio_index");
CONFIG_GET_INT_CONSOLE(current_resolution_id, "current_resolution_id");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.x, "custom_viewport_x");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.y, "custom_viewport_y");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.width, "custom_viewport_width");
CONFIG_GET_INT_CONSOLE(viewports.custom_vp.height, "custom_viewport_height");
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
CONFIG_GET_INT_CONSOLE(sound_mode, "sound_mode");
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
CONFIG_GET_FLOAT_CONSOLE(menu_font_size, "menu_font_size");
CONFIG_GET_FLOAT_CONSOLE(overscan_amount, "overscan_amount");
// g_extern
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
}
}
#ifdef HAVE_SYSUTILS
static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdata)
{
@ -404,7 +334,7 @@ int main(int argc, char *argv[])
find_libretro_file = true;
set_default_settings();
init_settings(find_libretro_file);
rarch_config_load(SYS_CONFIG_FILE, LIBRETRO_DIR_PATH, ".SELF", find_libretro_file);
init_libretro_sym();
#if(CELL_SDK_VERSION > 0x340000)