diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /tier2/defaultfilesystem.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'tier2/defaultfilesystem.cpp')
| -rw-r--r-- | tier2/defaultfilesystem.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tier2/defaultfilesystem.cpp b/tier2/defaultfilesystem.cpp new file mode 100644 index 0000000..b3a1662 --- /dev/null +++ b/tier2/defaultfilesystem.cpp @@ -0,0 +1,57 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: A higher level link library for general use in the game and tools. +// +//===========================================================================// + +#include <tier0/platform.h> +#include <tier2/tier2.h> +#include <filesystem_init.h> + + +static CSysModule *g_pFullFileSystemModule = NULL; + +void* DefaultCreateInterfaceFn(const char *pName, int *pReturnCode) +{ + if ( pReturnCode ) + { + *pReturnCode = 0; + } + return NULL; +} + +void InitDefaultFileSystem( void ) +{ + AssertMsg( !g_pFullFileSystem, "Already set up the file system" ); + + if ( !Sys_LoadInterface( "filesystem_stdio", FILESYSTEM_INTERFACE_VERSION, + &g_pFullFileSystemModule, (void**)&g_pFullFileSystem ) ) + { + if ( !Sys_LoadInterface( "filesystem_steam", FILESYSTEM_INTERFACE_VERSION, + &g_pFullFileSystemModule, (void**)&g_pFullFileSystem ) ) + { + exit(0); + } + } + + if ( !g_pFullFileSystem->Connect( DefaultCreateInterfaceFn ) ) + { + exit(0); + } + + if ( g_pFullFileSystem->Init() != INIT_OK ) + { + exit(0); + } + + g_pFullFileSystem->RemoveAllSearchPaths(); + g_pFullFileSystem->AddSearchPath( "", "LOCAL", PATH_ADD_TO_HEAD ); +} + +void ShutdownDefaultFileSystem(void) +{ + AssertMsg( g_pFullFileSystem, "File system not set up" ); + g_pFullFileSystem->Shutdown(); + g_pFullFileSystem->Disconnect(); + Sys_UnloadModule( g_pFullFileSystemModule ); +} |