diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 9774ab15d1..5ba275b7f5 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1269,6 +1269,10 @@ static int action_ok_download_generic(const char *path, path = "overlays.zip"; else if (!strcmp(type_msg, "cb_update_databases")) path = "database-rdb.zip"; + else if (!strcmp(type_msg, "cb_update_shaders_glsl")) + path = "shaders_glsl.zip"; + else if (!strcmp(type_msg, "cb_update_shaders_cg")) + path = "shaders_cg.zip"; else strlcpy(s, settings->network.buildbot_url, sizeof(s)); @@ -1319,6 +1323,26 @@ static int action_ok_update_overlays(const char *path, return 0; } +static int action_ok_update_shaders_cg(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_shaders_cg"); +#endif + return 0; +} + +static int action_ok_update_shaders_glsl(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_shaders_glsl"); +#endif + return 0; +} + static int action_ok_update_databases(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -1728,6 +1752,12 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_UPDATE_DATABASES: cbs->action_ok = action_ok_update_databases; break; + case MENU_LABEL_UPDATE_GLSL_SHADERS: + cbs->action_ok = action_ok_update_shaders_glsl; + break; + case MENU_LABEL_UPDATE_CG_SHADERS: + cbs->action_ok = action_ok_update_shaders_cg; + break; case MENU_LABEL_UPDATE_CHEATS: cbs->action_ok = action_ok_update_cheats; break; diff --git a/tasks/task_http.c b/tasks/task_http.c index 6323feeb38..9072beacb0 100644 --- a/tasks/task_http.c +++ b/tasks/task_http.c @@ -33,6 +33,8 @@ #define CB_UPDATE_CHEATS 0xc360fec3U #define CB_UPDATE_OVERLAYS 0x699009a0U #define CB_UPDATE_DATABASES 0x931eb8d3U +#define CB_UPDATE_SHADERS_GLSL 0x0121a186U +#define CB_UPDATE_SHADERS_CG 0xc93a53feU extern char core_updater_path[PATH_MAX_LENGTH]; @@ -143,6 +145,32 @@ 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_shaders_cg(void *data, size_t len) +{ + char shaderdir[PATH_MAX_LENGTH]; + settings_t *settings = config_get_ptr(); + fill_pathname_join(shaderdir, settings->video.shader_dir, "shaders_cg", + sizeof(shaderdir)); + if (!path_file_exists(shaderdir)) + if (!path_mkdir(shaderdir)) + return -1; + + return cb_generic_download(data, len, shaderdir); +} + +static int cb_update_shaders_glsl(void *data, size_t len) +{ + char shaderdir[PATH_MAX_LENGTH]; + settings_t *settings = config_get_ptr(); + fill_pathname_join(shaderdir, settings->video.shader_dir, "shaders_glsl", + sizeof(shaderdir)); + if (!path_file_exists(shaderdir)) + if (!path_mkdir(shaderdir)) + return -1; + + return cb_generic_download(data, len, shaderdir); +} + static int cb_update_databases(void *data, size_t len) { settings_t *settings = config_get_ptr(); @@ -241,6 +269,12 @@ static int cb_http_conn_default(void *data_, size_t len) case CB_UPDATE_DATABASES: http->cb = &cb_update_databases; break; + case CB_UPDATE_SHADERS_CG: + http->cb = &cb_update_shaders_cg; + break; + case CB_UPDATE_SHADERS_GLSL: + http->cb = &cb_update_shaders_glsl; + break; case CB_UPDATE_OVERLAYS: http->cb = &cb_update_overlays; break;