#ifndef ADDON_H
#define ADDON_H
-#include "workshop.h"
+#include "common.h"
+#include "vg/vg_steam_ugc.h"
#include "workshop_types.h"
-#define ADDON_MOUNTED_MAX 128
+#include "vg/vg_mem_pool.h"
+
+#include "world.h"
+#include "player.h"
+
#define ADDON_FOLDERNAME_MAX 64
+/* total count that we have knowledge of */
+#define ADDON_MOUNTED_MAX 128
+
+/* in memory and loaded stuffs */
+#define CACHE_BOARD_MAX 10
+#define CACHE_PLAYER_MAX 10
+
typedef struct addon_reg addon_reg;
struct {
struct addon_reg{
/* deffered: updates in main thread */
u32 registry_type_counts[k_workshop_file_type_max];
+
+ /* caches */
+ struct cache_board{
+ enum cache_board_state{
+ k_cache_board_state_none,
+ k_cache_board_state_loaded,
+ k_cache_board_state_load_request
+ }
+ state;
+ struct player_board board;
+ u32 reg_index;
+ addon_reg *reg_ptr;
+
+ vg_pool_node cachenode;
+ }
+ *boards;
+ vg_pool board_cache;
+
+ struct cache_playermodel{
+ enum cache_board_state state;
+ struct player_model model;
+ u32 reg_index;
+ addon_reg *reg_ptr;
+ vg_pool_node cachenode;
+ }
+ *playermodels;
+ vg_pool playermodel_cache;
+
+ SDL_SpinLock sl_cache;
}
static addon_system;
static u32 addon_count( enum workshop_file_type type );
static addon_reg *get_addon_from_index(enum workshop_file_type type, u32 index);
static u32 get_index_from_addon( enum workshop_file_type type, addon_reg *a );
+static int addon_get_content_folder( addon_reg *reg, vg_str *folder );
/* scanning routines */
VG_STATIC void addon_mount_content_folder( enum workshop_file_type type,