From badaae7198f9d309e8afb0ec70558399e070a722 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 24 Jun 2015 16:36:29 +0200 Subject: [PATCH] (Menu) Hook up 'Update Autoconfig Profiles' --- menu/cbs/menu_cbs_ok.c | 19 +++++++++++++++++++ tasks/task_http.c | 17 ++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index b33fac227c..8296505d0c 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -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; } diff --git a/tasks/task_http.c b/tasks/task_http.c index 0073747790..2b67a5c6fe 100644 --- a/tasks/task_http.c +++ b/tasks/task_http.c @@ -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; } }