fixed instance loading forget to append basepath.. other path fixes (windows)
[csRadar.git] / vfilesys.h
index 4e4faa9aaa3ae76e5e5a3ff77173e1cbb7366932..fc4cec805886c749f37df2cdadb29f5677eeaae3 100644 (file)
@@ -1,6 +1,24 @@
+// This software is not affiliated with Valve Corporation
+//   We are not affiliated, associated, authorized, endorsed by, or in any way officially 
+//   connected with Valve Corporation, or any of its subsidiaries or its affiliates. 
+// 
+//   All trademarks are property of their respective owners
+
 // Abstract Valve file system 
 //=======================================================================================================================
 
 // Abstract Valve file system 
 //=======================================================================================================================
 
+// Initialize game directories / pakfile
+void fs_set_gameinfo( const char *path );
+void fs_exit(void);
+
+// Read asset as binary in full. Will search VPK, then searchpaths, or return NULL if not found
+char *valve_fs_get( const char *path );
+
+// Implementation
+//=======================================================================================================================
+
+#ifdef VALVE_IMPLEMENTATION
+
 struct valve_filesystem
 {
        char gamedir[ 512 ];
 struct valve_filesystem
 {
        char gamedir[ 512 ];
@@ -25,12 +43,11 @@ void fs_set_gameinfo( const char *path )
        
        // Set gamedir
        strcpy( fs->gamedir, path );
        
        // Set gamedir
        strcpy( fs->gamedir, path );
-       csr_path_winunix( fs->gamedir );
-       *csr_findext( fs->gamedir, '/' ) = 0x00;
+       csr_downlvl( fs->gamedir );
        
        // Set exe dir
        strcpy( fs->exedir, fs->gamedir );
        
        // Set exe dir
        strcpy( fs->exedir, fs->gamedir );
-       strcat( fs->exedir, "../" );
+       csr_downlvl( fs->exedir );
        
        // Get all search paths from file
        vdf_node *search_paths = vdf_next(vdf_next(vdf_next( info, "GameInfo", NULL ), "FileSystem", NULL ), "SearchPaths", NULL );
        
        // Get all search paths from file
        vdf_node *search_paths = vdf_next(vdf_next(vdf_next( info, "GameInfo", NULL ), "FileSystem", NULL ), "SearchPaths", NULL );
@@ -76,7 +93,7 @@ void fs_set_gameinfo( const char *path )
        
        if( !fs->vpk )
        {
        
        if( !fs->vpk )
        {
-               log_error( "Could not locate pak01_dir.vpk in %i searchpaths. Stock models will not load!", csr_sb_count( fs->searchpaths ) );
+               log_error( "Could not locate pak01_dir.vpk in %i searchpaths. Stock models will not load!\n", csr_sb_count( fs->searchpaths ) );
        }
 
        log_info( "fs_info:\n" );
        }
 
        log_info( "fs_info:\n" );
@@ -182,3 +199,5 @@ char *valve_fs_get( const char *path )
        
        return NULL;
 }
        
        return NULL;
 }
+
+#endif