Implement 'Update Databases'

This commit is contained in:
twinaphex 2015-06-24 17:42:31 +02:00
parent 9a991e4852
commit 90a6932b53
2 changed files with 25 additions and 0 deletions

View File

@ -1267,6 +1267,8 @@ static int action_ok_download_generic(const char *path,
path = "cheats.zip";
else if (!strcmp(type_msg, "cb_update_overlays"))
path = "overlays.zip";
else if (!strcmp(type_msg, "cb_update_databases"))
path = "database-rdb.zip";
else
strlcpy(s, settings->network.buildbot_url, sizeof(s));
@ -1317,6 +1319,16 @@ static int action_ok_update_overlays(const char *path,
return 0;
}
static int action_ok_update_databases(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_databases");
#endif
return 0;
}
static int action_ok_update_cheats(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -1713,6 +1725,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_LABEL_UPDATE_OVERLAYS:
cbs->action_ok = action_ok_update_overlays;
break;
case MENU_LABEL_UPDATE_DATABASES:
cbs->action_ok = action_ok_update_databases;
break;
case MENU_LABEL_UPDATE_CHEATS:
cbs->action_ok = action_ok_update_cheats;
break;

View File

@ -32,6 +32,7 @@
#define CB_UPDATE_AUTOCONFIG_PROFILES 0x28ada67dU
#define CB_UPDATE_CHEATS 0xc360fec3U
#define CB_UPDATE_OVERLAYS 0x699009a0U
#define CB_UPDATE_DATABASES 0x931eb8d3U
extern char core_updater_path[PATH_MAX_LENGTH];
@ -142,6 +143,12 @@ static int cb_update_autoconfig_profiles(void *data, size_t len)
return cb_generic_download(data, len, settings->input.autoconfig_dir);
}
static int cb_update_databases(void *data, size_t len)
{
settings_t *settings = config_get_ptr();
return cb_generic_download(data, len, settings->content_database);
}
static int cb_update_overlays(void *data, size_t len)
{
global_t *global = global_get_ptr();
@ -231,6 +238,9 @@ static int cb_http_conn_default(void *data_, size_t len)
case CB_UPDATE_CHEATS:
http->cb = &cb_update_cheats;
break;
case CB_UPDATE_DATABASES:
http->cb = &cb_update_databases;
break;
case CB_UPDATE_OVERLAYS:
http->cb = &cb_update_overlays;
break;