revision 2
[carveJwlIkooP6JGAAIwe30JlM.git] / addon.h
diff --git a/addon.h b/addon.h
index bb96f2e5023777cb8a21642745a05891ce427138..bb5747d54178c80dcc0ad65ac1fec40add88cf66 100644 (file)
--- a/addon.h
+++ b/addon.h
@@ -1,19 +1,15 @@
-#ifndef ADDON_H
-#define ADDON_H
-
-#include "skaterift.h"
+#pragma once
 #include "vg/vg_steam_ugc.h"
-#include "addon_types.h"
 #include "vg/vg_mem_pool.h"
-
-#include "world.h"
-#include "player.h"
+#include "vg/vg_string.h"
+#include "addon_types.h"
 
 typedef struct addon_reg addon_reg;
 typedef struct addon_cache_entry addon_cache_entry;
 typedef struct addon_alias addon_alias;
 
-struct addon_alias {
+struct addon_alias 
+{
    enum addon_type type;
    PublishedFileId_t workshop_id;
    char foldername[ ADDON_FOLDERNAME_MAX ];
@@ -24,8 +20,10 @@ struct addon_alias {
 #define ADDON_REG_CITY     0x4
 #define ADDON_REG_PREMIUM  0x8
 
-struct {
-   struct addon_reg{
+struct addon_system
+{
+   struct addon_reg
+   {
       addon_alias alias;
       u32 foldername_hash;
       u8 metadata[512];  /* vg_msg buffer */
@@ -47,8 +45,10 @@ struct {
    /* deffered: updates in main thread */
    u32 registry_type_counts[k_addon_type_max];
 
-   struct addon_cache{
-      struct addon_cache_entry{
+   struct addon_cache
+   {
+      struct addon_cache_entry
+      {
          u32 reg_index;
          addon_reg *reg_ptr;     /* TODO: only use reg_index? */
 
@@ -70,40 +70,38 @@ struct {
    cache[k_addon_type_max];
    SDL_SpinLock sl_cache_using_resources;
 }
-static addon_system;
+extern addon_system;
 
-static void addon_system_init( void );
-static u32 addon_count( enum addon_type type, u32 ignoreflags );
-static addon_reg *get_addon_from_index( enum addon_type type, u32 index, 
-                                        u32 ignoreflags );
-static u32 get_index_from_addon( enum addon_type type, addon_reg *a );
-static int addon_get_content_folder( addon_reg *reg, vg_str *folder, int async);
+void addon_system_init( void );
+u32 addon_count( enum addon_type type, u32 ignoreflags );
+addon_reg *get_addon_from_index( enum addon_type type, u32 index, 
+                                 u32 ignoreflags );
+u32 get_index_from_addon( enum addon_type type, addon_reg *a );
+int addon_get_content_folder( addon_reg *reg, vg_str *folder, int async);
 
 /* scanning routines */
-static u32 addon_match( addon_alias *alias );
-static int addon_alias_eq( addon_alias *a, addon_alias *b );
-static void addon_alias_uid( addon_alias *alias, char buf[ADDON_UID_MAX] );
-static int addon_uid_to_alias( const char *uid, addon_alias *alias );
-static void invalidate_addon_alias( addon_alias *alias );
-static void addon_mount_content_folder( enum addon_type type,
-                                           const char *base_folder, 
-                                           const char *content_ext );
-static void addon_mount_workshop_items(void);
-static void async_addon_reg_update( void *data, u32 size );
-static addon_reg *addon_mount_local_addon( const char *folder,
-                                              enum addon_type type,
-                                              const char *content_ext );
-static u16 addon_cache_fetch( enum addon_type type, u32 reg_index );
-static u16 addon_cache_alloc( enum addon_type type, u32 reg_index );
-static void *addon_cache_item( enum addon_type type, u16 id );
-static void *addon_cache_item_if_loaded( enum addon_type type, u16 id );
-static void async_addon_setstate( void *data, u32 size );
-static void addon_cache_load_loop(void);
-static u16 addon_cache_create_viewer( enum addon_type type, u16 reg_id);
-
-static void addon_cache_watch( enum addon_type type, u16 cache_id );
-static void addon_cache_unwatch( enum addon_type type, u16 cache_id );
-static u16 addon_cache_create_viewer_from_uid( enum addon_type type,
-                                               char uid[ADDON_UID_MAX] );
-
-#endif /* ADDON_H */
+u32 addon_match( addon_alias *alias );
+int addon_alias_eq( addon_alias *a, addon_alias *b );
+void addon_alias_uid( addon_alias *alias, char buf[ADDON_UID_MAX] );
+int addon_uid_to_alias( const char *uid, addon_alias *alias );
+void invalidate_addon_alias( addon_alias *alias );
+void addon_mount_content_folder( enum addon_type type,
+                                    const char *base_folder, 
+                                    const char *content_ext );
+void addon_mount_workshop_items(void);
+void async_addon_reg_update( void *data, u32 size );
+addon_reg *addon_mount_local_addon( const char *folder,
+                                       enum addon_type type,
+                                       const char *content_ext );
+u16 addon_cache_fetch( enum addon_type type, u32 reg_index );
+u16 addon_cache_alloc( enum addon_type type, u32 reg_index );
+void *addon_cache_item( enum addon_type type, u16 id );
+void *addon_cache_item_if_loaded( enum addon_type type, u16 id );
+void async_addon_setstate( void *data, u32 size );
+void addon_cache_load_loop(void);
+u16 addon_cache_create_viewer( enum addon_type type, u16 reg_id);
+
+void addon_cache_watch( enum addon_type type, u16 cache_id );
+void addon_cache_unwatch( enum addon_type type, u16 cache_id );
+u16 addon_cache_create_viewer_from_uid( enum addon_type type,
+                                        char uid[ADDON_UID_MAX] );