X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=addon.c;h=504904fac98c26546869ecc633033924eb7ef42e;hb=2b7784846e2f2ee57ba336a2aa040adb2d0ca461;hp=29b24a020ba59bf01fba14f3c3fc17f8d564d623;hpb=92ba950580dd4877935e90682cd4f66fead8fed2;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/addon.c b/addon.c index 29b24a0..504904f 100644 --- a/addon.c +++ b/addon.c @@ -4,6 +4,8 @@ #include "addon.h" #include "vg/vg_msg.h" #include "steam.h" +#include "workshop_types.h" +#include "workshop.h" static u32 addon_count( enum workshop_file_type type ){ return addon_system.registry_type_counts[ type ]; @@ -347,4 +349,35 @@ VG_STATIC void addon_mount_content_folder( enum workshop_file_type type, vg_dir_close(&dir); } +static int addon_get_content_folder( addon_reg *reg, vg_str *folder ){ + if( reg->workshop_id ){ + vg_async_item *call = + vg_async_alloc( sizeof(struct async_workshop_filepath_info) ); + struct async_workshop_filepath_info *info = call->payload; + info->buf = folder->buffer; + info->id = reg->workshop_id; + info->len = folder->len; + vg_async_dispatch( call, async_workshop_get_filepath ); + vg_async_stall(); /* too bad! */ + if( info->buf[0] == '\0' ){ + vg_error( "Failed SteamAPI_GetItemInstallInfo(" PRINTF_U64 ")\n", + reg->workshop_id ); + return 0; + } + folder->i = strlen( folder->buffer ); + return 1; + } + else{ + folder->i = 0; + if( reg->type == k_workshop_file_type_board ) + vg_strcat( folder, "boards/" ); + else if( reg->type == k_workshop_file_type_world ) + vg_strcat( folder, "maps/" ); + else return 0; + + vg_strcat( folder, reg->foldername ); + return 1; + } +} + #endif /* ADDON_C */