summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/qcommon/files.c31
-rw-r--r--src/sys/sys_main.c36
2 files changed, 39 insertions, 28 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");
diff --git a/src/sys/sys_main.c b/src/sys/sys_main.c
index e5d93546..45b2f6ba 100644
--- a/src/sys/sys_main.c
+++ b/src/sys/sys_main.c
@@ -459,34 +459,20 @@ void *Sys_LoadDll(const char *name, qboolean useSystemLib)
if(!useSystemLib || !(dllhandle = Sys_LoadLibrary(name)))
{
- const char *topDir;
- char libPath[MAX_OSPATH];
+ const char *overpath = Cvar_VariableString("fs_overpath");
- topDir = Sys_BinaryPath();
-
- if(!*topDir)
- topDir = ".";
-
- Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, topDir);
- Com_sprintf(libPath, sizeof(libPath), "%s%c%s", topDir, PATH_SEP, name);
-
- if(!(dllhandle = Sys_LoadLibrary(libPath)))
+ if(overpath[0])
{
- const char *basePath = Cvar_VariableString("fs_basepath");
-
- if(!basePath || !*basePath)
- basePath = ".";
-
- if(FS_FilenameCompare(topDir, basePath))
- {
- Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, basePath);
- Com_sprintf(libPath, sizeof(libPath), "%s%c%s", basePath, PATH_SEP, name);
- dllhandle = Sys_LoadLibrary(libPath);
- }
-
- if(!dllhandle)
- Com_Printf("Loading \"%s\" failed\n", name);
+ char libPath[MAX_OSPATH];
+ Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, overpath);
+ Com_sprintf(libPath, sizeof(libPath), "%s%c%s", overpath, PATH_SEP, name);
+ dllhandle = Sys_LoadLibrary(libPath);
}
+ else
+ dllhandle = NULL;
+
+ if(!dllhandle)
+ Com_Printf("Loading \"%s\" failed\n", name);
}
return dllhandle;