Add Patch Options. Make sure that if we pass softpatching options

on the commandline, that these values will not be saved back to
config file.
This commit is contained in:
twinaphex 2015-01-13 03:13:19 +01:00
parent aaef98dcb7
commit 507291bccb
5 changed files with 91 additions and 1 deletions

View File

@ -418,6 +418,10 @@ struct global
bool has_set_netplay_delay_frames;
bool has_set_netplay_ip_port;
bool has_set_ups_pref;
bool has_set_bps_pref;
bool has_set_ips_pref;
/* Config associated with global "default" config. */
char config_path[PATH_MAX_LENGTH];
char append_config_path[PATH_MAX_LENGTH];

View File

@ -703,6 +703,10 @@ static void parse_input(int argc, char *argv[])
g_extern.has_set_netplay_delay_frames = false;
g_extern.has_set_netplay_ip_port = false;
g_extern.has_set_ups_pref = false;
g_extern.has_set_bps_pref = false;
g_extern.has_set_ips_pref = false;
g_extern.ups_pref = false;
g_extern.bps_pref = false;
g_extern.ips_pref = false;
@ -953,6 +957,7 @@ static void parse_input(int argc, char *argv[])
strlcpy(g_extern.ups_name, optarg,
sizeof(g_extern.ups_name));
g_extern.ups_pref = true;
g_extern.has_set_ups_pref = true;
break;
case 'D':
@ -1008,12 +1013,14 @@ static void parse_input(int argc, char *argv[])
strlcpy(g_extern.bps_name, optarg,
sizeof(g_extern.bps_name));
g_extern.bps_pref = true;
g_extern.has_set_bps_pref = true;
break;
case 'I':
strlcpy(g_extern.ips_name, optarg,
sizeof(g_extern.ips_name));
g_extern.ips_pref = true;
g_extern.has_set_ips_pref = true;
break;
case 'n':

View File

@ -1197,6 +1197,19 @@ static bool config_load_file(const char *path, bool set_defaults)
}
}
if (!g_extern.has_set_ups_pref)
{
CONFIG_GET_BOOL_EXTERN(ups_pref, "ups_pref");
}
if (!g_extern.has_set_bps_pref)
{
CONFIG_GET_BOOL_EXTERN(bps_pref, "bps_pref");
}
if (!g_extern.has_set_ips_pref)
{
CONFIG_GET_BOOL_EXTERN(ips_pref, "ips_pref");
}
/* Audio settings. */
CONFIG_GET_BOOL(audio.enable, "audio_enable");
CONFIG_GET_INT(audio.out_rate, "audio_out_rate");
@ -1806,6 +1819,13 @@ bool config_save_file(const char *path)
config_set_float(conf, "video_font_size", g_settings.video.font_size);
config_set_bool(conf, "video_font_enable", g_settings.video.font_enable);
if (!g_extern.has_set_ups_pref)
config_set_bool(conf, "ups_pref", g_extern.ups_pref);
if (!g_extern.has_set_bps_pref)
config_set_bool(conf, "bps_pref", g_extern.bps_pref);
if (!g_extern.has_set_ips_pref)
config_set_bool(conf, "ips_pref", g_extern.ips_pref);
config_set_path(conf, "system_directory",
*g_settings.system_directory ?
g_settings.system_directory : "default");

View File

@ -5485,6 +5485,58 @@ static bool setting_data_append_list_netplay_options(
return true;
}
static bool setting_data_append_list_patch_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
rarch_setting_group_info_t group_info;
rarch_setting_group_info_t subgroup_info;
START_GROUP(group_info, "Patch Options");
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
CONFIG_BOOL(
g_extern.ups_pref,
"ups_pref",
"UPS Patching Enable",
true,
"OFF",
"ON",
group_info.name,
subgroup_info.name,
general_write_handler,
general_read_handler);
CONFIG_BOOL(
g_extern.bps_pref,
"bps_pref",
"BPS Patching Enable",
true,
"OFF",
"ON",
group_info.name,
subgroup_info.name,
general_write_handler,
general_read_handler);
CONFIG_BOOL(
g_extern.ips_pref,
"ips_pref",
"IPS Patching Enable",
true,
"OFF",
"ON",
group_info.name,
subgroup_info.name,
general_write_handler,
general_read_handler);
END_SUB_GROUP(list, list_info);
END_GROUP(list, list_info);
return true;
}
static bool setting_data_append_list_playlist_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
@ -6031,6 +6083,12 @@ rarch_setting_t *setting_data_new(unsigned mask)
goto error;
}
if (mask & SL_FLAG_PATCH_OPTIONS)
{
if (!setting_data_append_list_patch_options(&list, list_info))
goto error;
}
if (mask & SL_FLAG_PLAYLIST_OPTIONS)
{
if (!setting_data_append_list_playlist_options(&list, list_info))

View File

@ -77,7 +77,8 @@ enum setting_list_flags
SL_FLAG_PRIVACY_OPTIONS = (1 << 13),
SL_FLAG_PLAYLIST_OPTIONS = (1 << 14),
SL_FLAG_ARCHIVE_OPTIONS = (1 << 15),
SL_FLAG_ALL = (1 << 16),
SL_FLAG_PATCH_OPTIONS = (1 << 16),
SL_FLAG_ALL = (1 << 17),
};
#define SL_FLAG_ALL_SETTINGS (SL_FLAG_ALL - SL_FLAG_MAIN_MENU)