(Menu) Hook up 'Update Autoconfig Profiles'

This commit is contained in:
twinaphex 2015-06-24 16:36:29 +02:00
parent b2e27a452e
commit badaae7198
2 changed files with 33 additions and 3 deletions

View File

@ -1262,6 +1262,12 @@ static int action_ok_download_generic(const char *path,
fill_pathname_join(s, settings->network.buildbot_assets_url,
"frontend/assets.zip", sizeof(s));
}
else if (!strcmp(type_msg, "cb_update_autoconfig_profiles"))
{
path = "autoconf.zip";
fill_pathname_join(s, settings->network.buildbot_assets_url,
"frontend/autoconf.zip", sizeof(s));
}
else
{
fill_pathname_join(s, settings->network.buildbot_url,
@ -1303,6 +1309,16 @@ static int action_ok_update_assets(const char *path,
return 0;
}
static int action_ok_update_autoconfig_profiles(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
#ifdef HAVE_NETWORKING
action_ok_download_generic(path, label, type, idx, entry_idx,
"cb_update_autoconfig_profiles");
#endif
return 0;
}
static int action_ok_disk_cycle_tray_status(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -1676,6 +1692,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_LABEL_UPDATE_ASSETS:
cbs->action_ok = action_ok_update_assets;
break;
case MENU_LABEL_UPDATE_AUTOCONFIG_PROFILES:
cbs->action_ok = action_ok_update_autoconfig_profiles;
break;
default:
return -1;
}

View File

@ -26,9 +26,10 @@
#include "../runloop_data.h"
#include "tasks.h"
#define CB_CORE_UPDATER_DOWNLOAD 0x7412da7dU
#define CB_CORE_UPDATER_LIST 0x32fd4f01U
#define CB_UPDATE_ASSETS 0xbf85795eU
#define CB_CORE_UPDATER_DOWNLOAD 0x7412da7dU
#define CB_CORE_UPDATER_LIST 0x32fd4f01U
#define CB_UPDATE_ASSETS 0xbf85795eU
#define CB_UPDATE_AUTOCONFIG_PROFILES 0x28ada67dU
extern char core_updater_path[PATH_MAX_LENGTH];
@ -98,6 +99,7 @@ static int cb_generic_download(void *data, size_t len,
snprintf(msg, sizeof(msg), "Download complete: %s.",
core_updater_path);
rarch_main_msg_queue_push(msg, 1, 90, true);
#ifdef HAVE_ZLIB
@ -132,6 +134,12 @@ static int cb_update_assets(void *data, size_t len)
return cb_generic_download(data, len, settings->assets_directory);
}
static int cb_update_autoconfig_profiles(void *data, size_t len)
{
settings_t *settings = config_get_ptr();
return cb_generic_download(data, len, settings->input.autoconfig_dir);
}
static int rarch_main_data_http_con_iterate_transfer(http_handle_t *http)
{
if (!net_http_connection_iterate(http->connection.handle))
@ -203,6 +211,9 @@ static int cb_http_conn_default(void *data_, size_t len)
case CB_UPDATE_ASSETS:
http->cb = &cb_update_assets;
break;
case CB_UPDATE_AUTOCONFIG_PROFILES:
http->cb = &cb_update_autoconfig_profiles;
break;
}
}