summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2010-12-16 01:37:50 +0300
committerAndrey Nazarov <skuller@skuller.net>2010-12-16 01:37:50 +0300
commit35ee0fff510ce005166f3f04895524b6cdd92bcb (patch)
tree343c3224ecd6387774507b864eef9b5b376c33d2 /src
parent6731a603982cd6ca1fa0362c98be1e25f6b78bd6 (diff)
Add ‘sys_forcegamelib’ cvar.
Attempt to clean up SV_InitGameProgs by removing hacky #ifdef stuff in favor of using single variable specifying the absolute path to the game library that should be tried first. It is empty by default on all platforms. That means ‘.\release\gamex86.dll’ will no longer be tried by default on Win32, and on non-Win32 platforms root of the libdir will not be tried also. This needs to be explicitly requested on the command line.
Diffstat (limited to 'src')
-rw-r--r--src/sv_game.c30
-rw-r--r--src/sys_public.h2
-rw-r--r--src/sys_unix.c4
-rw-r--r--src/sys_win.c3
4 files changed, 16 insertions, 23 deletions
diff --git a/src/sv_game.c b/src/sv_game.c
index 86756b9..8164285 100644
--- a/src/sv_game.c
+++ b/src/sv_game.c
@@ -776,37 +776,25 @@ void SV_InitGameProgs ( void ) {
// unload anything we have now
SV_ShutdownGameProgs ();
-#ifdef _WIN32
- // FIXME: check current debug directory first for
- // e.g. running legacy stuff like Q2Admin
- Q_concat( path, sizeof( path ), Sys_GetCurrentDirectory(),
- PATH_SEP_STRING "release" PATH_SEP_STRING GAMELIB, NULL );
- entry = Sys_LoadLibrary( path, "GetGameAPI", &game_library );
- if( !entry )
-#endif
- {
- // try ./game first
+ // for debugging or `proxy' mods
+ if( sys_forcegamelib->string[0] ) {
+ entry = Sys_LoadLibrary( sys_forcegamelib->string,
+ "GetGameAPI", &game_library );
+ }
+ if( !entry ) {
+ // try game first
if( fs_game->string[0] ) {
Q_concat( path, sizeof( path ), sys_libdir->string,
PATH_SEP_STRING, fs_game->string, PATH_SEP_STRING GAMELIB, NULL );
entry = Sys_LoadLibrary( path, "GetGameAPI", &game_library );
}
if( !entry ) {
- // then try ./baseq2
+ // then try baseq2
Q_concat( path, sizeof( path ), sys_libdir->string,
PATH_SEP_STRING BASEGAME PATH_SEP_STRING GAMELIB, NULL );
entry = Sys_LoadLibrary( path, "GetGameAPI", &game_library );
if( !entry ) {
-#ifdef __unix__
- // then try ./
- Q_concat( path, sizeof( path ), sys_libdir->string,
- PATH_SEP_STRING GAMELIB, NULL );
- entry = Sys_LoadLibrary( path, "GetGameAPI", &game_library );
- if( !entry )
-#endif
- {
- Com_Error( ERR_DROP, "Failed to load game DLL" );
- }
+ Com_Error( ERR_DROP, "Failed to load game library" );
}
}
}
diff --git a/src/sys_public.h b/src/sys_public.h
index 1ebf7e8..fd420c7 100644
--- a/src/sys_public.h
+++ b/src/sys_public.h
@@ -71,8 +71,8 @@ qboolean Sys_GetAntiCheatAPI( void );
extern cvar_t *sys_basedir;
extern cvar_t *sys_libdir;
-extern cvar_t *sys_refdir;
extern cvar_t *sys_homedir;
+extern cvar_t *sys_forcegamelib;
#if USE_SYSCON && ( defined __unix__ )
extern cvar_t *sys_console;
#endif
diff --git a/src/sys_unix.c b/src/sys_unix.c
index 94ec24e..769bebd 100644
--- a/src/sys_unix.c
+++ b/src/sys_unix.c
@@ -57,8 +57,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cvar_t *sys_basedir;
cvar_t *sys_libdir;
cvar_t *sys_homedir;
-cvar_t *sys_parachute;
+cvar_t *sys_forcegamelib;
+cvar_t *sys_parachute;
/*
===============================================================================
@@ -684,6 +685,7 @@ void Sys_Init( void ) {
}
sys_homedir = Cvar_Get( "homedir", homedir, CVAR_NOSET );
sys_libdir = Cvar_Get( "libdir", LIBDIR, CVAR_NOSET );
+ sys_forcegamelib = Cvar_Get( "sys_forcegamelib", "", CVAR_NOSET );
#if USE_SYSCON
// we want TTY support enabled if started from terminal,
diff --git a/src/sys_win.c b/src/sys_win.c
index 5eda55e..088f432 100644
--- a/src/sys_win.c
+++ b/src/sys_win.c
@@ -35,6 +35,7 @@ qboolean iswinnt;
cvar_t *sys_basedir;
cvar_t *sys_libdir;
cvar_t *sys_homedir;
+cvar_t *sys_forcegamelib;
static char currentDirectory[MAX_OSPATH];
@@ -721,6 +722,8 @@ void Sys_Init( void ) {
// specifies per-user writable directory for demos, screenshots, etc
sys_homedir = Cvar_Get( "homedir", "", CVAR_NOSET );
+ sys_forcegamelib = Cvar_Get( "sys_forcegamelib", "", CVAR_NOSET );
+
#if USE_WINSVC
Cmd_AddCommand( "installservice", Sys_InstallService_f );
Cmd_AddCommand( "deleteservice", Sys_DeleteService_f );