Add option for auto-extracting downloaded archive

This commit is contained in:
twinaphex 2015-01-31 12:45:20 +01:00
parent 5e39a9abe6
commit 124145505a
5 changed files with 31 additions and 5 deletions

View File

@ -321,6 +321,7 @@ struct settings
struct
{
char buildbot_url[PATH_MAX_LENGTH];
bool buildbot_auto_extract_archive;
} network;
int state_slot;

View File

@ -1418,6 +1418,10 @@ static int cb_core_manager_download(void *data_, size_t len)
#ifdef HAVE_ZLIB
file_ext = path_get_extension(output_path);
if (!g_settings.network.buildbot_auto_extract_archive)
return 0;
if (!strcasecmp(file_ext,"zip"))
{
if (!zlib_parse_file(output_path, NULL, zlib_extract_core_callback,

View File

@ -632,10 +632,15 @@
# Override the default privacy permission for cores that want to access location services. Is "false" by default.
# location_allow = false
#### Network
#### Core Updater
# URL to core management upgrade buildbot.
# core_management_buildbot_url = "http://buildbot.libretro.com"
# core_updater_buildbot_url = "http://buildbot.libretro.com"
# Automatically extract archives that the cores are contained in to the libretro cores directory.
# core_updater_auto_extract_archive = true
#### Network
# When being client over netplay, use keybinds for user 1.
# netplay_client_swap_input = false

View File

@ -541,6 +541,7 @@ static void config_set_defaults(void)
strlcpy(g_settings.network.buildbot_url, buildbot_server_url,
sizeof(g_settings.network.buildbot_url));
g_settings.network.buildbot_auto_extract_archive = true;
g_settings.input.overlay_enable = true;
g_settings.input.overlay_opacity = 0.7f;
@ -1212,7 +1213,9 @@ static bool config_load_file(const char *path, bool set_defaults)
CONFIG_GET_BOOL(input.autoconfig_descriptor_label_show,
"autoconfig_descriptor_label_show");
CONFIG_GET_PATH(network.buildbot_url, "core_management_buildbot_url");
CONFIG_GET_PATH(network.buildbot_url, "core_updater_buildbot_url");
CONFIG_GET_BOOL(network.buildbot_auto_extract_archive,
"core_updater_auto_extract_archive");
for (i = 0; i < MAX_USERS; i++)
{
@ -1885,7 +1888,8 @@ bool config_save_file(const char *path)
config_set_string(conf, "audio_device", g_settings.audio.device);
config_set_string(conf, "video_filter", g_settings.video.softfilter_plugin);
config_set_string(conf, "audio_dsp_plugin", g_settings.audio.dsp_plugin);
config_set_string(conf, "core_management_buildbot_url", g_settings.network.buildbot_url);
config_set_string(conf, "core_updater_buildbot_url", g_settings.network.buildbot_url);
config_set_bool(conf, "core_updater_auto_extract_archive", g_settings.network.buildbot_auto_extract_archive);
config_set_string(conf, "camera_device", g_settings.camera.device);
config_set_bool(conf, "camera_allow", g_settings.camera.allow);
config_set_bool(conf, "audio_rate_control", g_settings.audio.rate_control);

View File

@ -5605,7 +5605,7 @@ static bool setting_data_append_list_core_manager_options(
CONFIG_STRING(
g_settings.network.buildbot_url,
"core_management_buildbot_url",
"core_updater_buildbot_url",
"Buildbot URL",
buildbot_server_url,
group_info.name,
@ -5614,6 +5614,18 @@ static bool setting_data_append_list_core_manager_options(
general_read_handler);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT);
CONFIG_BOOL(
g_settings.network.buildbot_auto_extract_archive,
"core_updater_auto_extract_archive",
"Automatically extract downloaded archive",
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);
#endif