summaryrefslogtreecommitdiff
path: root/src/qcommon/files.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcommon/files.c')
-rw-r--r--src/qcommon/files.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/qcommon/files.c b/src/qcommon/files.c
index 856ea285..11b78d3b 100644
--- a/src/qcommon/files.c
+++ b/src/qcommon/files.c
@@ -1365,6 +1365,10 @@ write found DLL or QVM to "found" and return VMI_NATIVE if DLL, VMI_COMPILED if
Return the searchpath in "startSearch".
=================
*/
+static directory_t fs_directory_overpath_game;
+static searchpath_t fs_searchpath_overpath_game;
+static directory_t fs_directory_overpath_basegame;
+static searchpath_t fs_searchpath_overpath_basegame;
int FS_FindVM(void **startSearch, char *found, int foundlen, const char *name, int enableDll)
{
@@ -1383,8 +1387,27 @@ int FS_FindVM(void **startSearch, char *found, int foundlen, const char *name, i
Com_sprintf(qvmName, sizeof(qvmName), "vm/%s.qvm", name);
lastSearch = *startSearch;
- if(*startSearch == NULL)
- search = fs_searchpaths;
+ if(lastSearch == NULL)
+ {
+ const char *overpath = Cvar_VariableString( "fs_overpath" );
+ if(overpath[0])
+ {
+ // set up some special searchpath elements
+ Q_strncpyz( fs_directory_overpath_game.path, overpath, sizeof( fs_directory_overpath_game.path ) );
+ Q_strncpyz( fs_directory_overpath_game.gamedir, fs_gamedir, sizeof( fs_directory_overpath_game.gamedir ) );
+ fs_searchpath_overpath_game.next = &fs_searchpath_overpath_basegame;
+ fs_searchpath_overpath_game.pack = NULL;
+ fs_searchpath_overpath_game.dir = &fs_directory_overpath_game;
+ Q_strncpyz( fs_directory_overpath_basegame.path, overpath, sizeof( fs_directory_overpath_basegame.path ) );
+ Q_strncpyz( fs_directory_overpath_basegame.gamedir, fs_basegame->string, sizeof( fs_directory_overpath_basegame.gamedir ) );
+ fs_searchpath_overpath_basegame.next = fs_searchpaths;
+ fs_searchpath_overpath_basegame.pack = NULL;
+ fs_searchpath_overpath_basegame.dir = &fs_directory_overpath_basegame;
+ search = &fs_searchpath_overpath_game;
+ }
+ else
+ search = fs_searchpaths;
+ }
else
search = lastSearch->next;
@@ -1394,7 +1417,7 @@ int FS_FindVM(void **startSearch, char *found, int foundlen, const char *name, i
{
dir = search->dir;
- if(enableDll)
+ if(enableDll && (search == &fs_searchpath_overpath_game || search == &fs_searchpath_overpath_basegame))
{
netpath = FS_BuildOSPath(dir->path, dir->gamedir, dllName);
@@ -3198,6 +3221,7 @@ static void FS_Startup( const char *gameName )
fs_packFiles = 0;
fs_debug = Cvar_Get( "fs_debug", "0", 0 );
+ Cvar_Get ("fs_overpath", Sys_BinaryPath(), CVAR_INIT|CVAR_PROTECTED );
fs_basepath = Cvar_Get ("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT|CVAR_PROTECTED );
fs_basegame = Cvar_Get ("fs_basegame", "gpp", CVAR_INIT );
homePath = Sys_DefaultHomePath();
@@ -3606,6 +3630,7 @@ void FS_InitFilesystem( void ) {
// we have to specially handle this, because normal command
// line variable sets don't happen until after the filesystem
// has already been initialized
+ Com_StartupVariable("fs_overpath");
Com_StartupVariable("fs_basepath");
Com_StartupVariable("fs_homepath");
Com_StartupVariable("fs_game");