5 #include "vg/vg_steam_ugc.h"
6 #include "workshop_types.h"
7 #include "vg/vg_mem_pool.h"
12 #define ADDON_FOLDERNAME_MAX 64
14 /* total count that we have knowledge of */
15 #define ADDON_MOUNTED_MAX 128
17 /* in memory and loaded stuffs */
18 #define CACHE_BOARD_MAX 10
19 #define CACHE_PLAYER_MAX 10
21 typedef struct addon_reg addon_reg
;
24 PublishedFileId_t workshop_id
;
26 enum workshop_file_type type
;
27 u8 metadata
[512]; /* vg_msg buffer */
30 char foldername
[ ADDON_FOLDERNAME_MAX
];
36 k_addon_state_indexed
,
37 k_addon_state_indexed_absent
/* gone but not forgotten */
44 /* deffered: updates in main thread */
45 u32 registry_type_counts
[k_workshop_file_type_max
];
49 enum cache_board_state
{
50 k_cache_board_state_none
,
51 k_cache_board_state_loaded
,
52 k_cache_board_state_load_request
55 struct player_board board
;
59 vg_pool_node cachenode
;
64 struct cache_playermodel
{
65 enum cache_board_state state
;
66 struct player_model model
;
69 vg_pool_node cachenode
;
72 vg_pool playermodel_cache
;
74 SDL_SpinLock sl_cache
;
78 static void addon_system_init( void );
79 static u32
addon_count( enum workshop_file_type type
);
80 static addon_reg
*get_addon_from_index(enum workshop_file_type type
, u32 index
);
81 static u32
get_index_from_addon( enum workshop_file_type type
, addon_reg
*a
);
82 static int addon_get_content_folder( addon_reg
*reg
, vg_str
*folder
);
84 /* scanning routines */
85 VG_STATIC
void addon_mount_content_folder( enum workshop_file_type type
,
86 const char *base_folder
,
87 const char *content_ext
);
88 VG_STATIC
void addon_mount_workshop_items(void);
89 VG_STATIC
void async_addon_reg_update( void *data
, u32 size
);
90 VG_STATIC addon_reg
*addon_mount_local_addon( const char *folder
,
91 enum workshop_file_type type
,
92 const char *content_ext
);