mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-30 07:41:16 +00:00
Let a separate libdir be specified for loading libraries.
Partially fixes Bugzilla #4271.
This commit is contained in:
parent
31ce89361d
commit
826f05f95f
3 changed files with 45 additions and 0 deletions
|
@ -241,6 +241,7 @@ static cvar_t *fs_apppath;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static cvar_t *fs_basepath;
|
static cvar_t *fs_basepath;
|
||||||
|
static cvar_t *fs_libpath;
|
||||||
static cvar_t *fs_basegame;
|
static cvar_t *fs_basegame;
|
||||||
static cvar_t *fs_gamedirvar;
|
static cvar_t *fs_gamedirvar;
|
||||||
static searchpath_t *fs_searchpaths;
|
static searchpath_t *fs_searchpaths;
|
||||||
|
@ -2761,6 +2762,8 @@ static void FS_Startup( const char *gameName )
|
||||||
fs_debug = Cvar_Get( "fs_debug", "0", 0 );
|
fs_debug = Cvar_Get( "fs_debug", "0", 0 );
|
||||||
fs_basepath = Cvar_Get ("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT );
|
fs_basepath = Cvar_Get ("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT );
|
||||||
fs_basegame = Cvar_Get ("fs_basegame", "", CVAR_INIT );
|
fs_basegame = Cvar_Get ("fs_basegame", "", CVAR_INIT );
|
||||||
|
fs_libpath = Cvar_Get ("fs_libpath", Sys_DefaultLibPath(), CVAR_INIT );
|
||||||
|
|
||||||
homePath = Sys_DefaultHomePath();
|
homePath = Sys_DefaultHomePath();
|
||||||
if (!homePath || !homePath[0]) {
|
if (!homePath || !homePath[0]) {
|
||||||
homePath = fs_basepath->string;
|
homePath = fs_basepath->string;
|
||||||
|
|
|
@ -1079,6 +1079,9 @@ char *Sys_DefaultInstallPath(void);
|
||||||
char *Sys_DefaultAppPath(void);
|
char *Sys_DefaultAppPath(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void Sys_SetDefaultLibPath(const char *path);
|
||||||
|
char *Sys_DefaultLibPath(void);
|
||||||
|
|
||||||
void Sys_SetDefaultHomePath(const char *path);
|
void Sys_SetDefaultHomePath(const char *path);
|
||||||
char *Sys_DefaultHomePath(void);
|
char *Sys_DefaultHomePath(void);
|
||||||
const char *Sys_Dirname( char *path );
|
const char *Sys_Dirname( char *path );
|
||||||
|
|
|
@ -49,6 +49,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
static char binaryPath[ MAX_OSPATH ] = { 0 };
|
static char binaryPath[ MAX_OSPATH ] = { 0 };
|
||||||
static char installPath[ MAX_OSPATH ] = { 0 };
|
static char installPath[ MAX_OSPATH ] = { 0 };
|
||||||
|
static char libPath[ MAX_OSPATH ] = { 0 };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
|
@ -93,6 +94,29 @@ char *Sys_DefaultInstallPath(void)
|
||||||
return Sys_Cwd();
|
return Sys_Cwd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Sys_SetDefaultLibPath
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
void Sys_SetDefaultLibPath(const char *path)
|
||||||
|
{
|
||||||
|
Q_strncpyz(libPath, path, sizeof(libPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Sys_DefaultLibPath
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
char *Sys_DefaultLibPath(void)
|
||||||
|
{
|
||||||
|
if (*libPath)
|
||||||
|
return libPath;
|
||||||
|
else
|
||||||
|
return Sys_Cwd();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
Sys_DefaultAppPath
|
Sys_DefaultAppPath
|
||||||
|
@ -384,6 +408,7 @@ Used to load a development dll instead of a virtual machine
|
||||||
#1 look down current path
|
#1 look down current path
|
||||||
#2 look in fs_homepath
|
#2 look in fs_homepath
|
||||||
#3 look in fs_basepath
|
#3 look in fs_basepath
|
||||||
|
#4 look in fs_libpath
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void *Sys_LoadDll( const char *name, char *fqpath ,
|
void *Sys_LoadDll( const char *name, char *fqpath ,
|
||||||
|
@ -394,6 +419,7 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
|
||||||
void (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) );
|
void (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) );
|
||||||
char fname[MAX_OSPATH];
|
char fname[MAX_OSPATH];
|
||||||
char *basepath;
|
char *basepath;
|
||||||
|
char *libpath;
|
||||||
char *homepath;
|
char *homepath;
|
||||||
char *pwdpath;
|
char *pwdpath;
|
||||||
char *gamedir;
|
char *gamedir;
|
||||||
|
@ -405,6 +431,7 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
|
||||||
// TODO: use fs_searchpaths from files.c
|
// TODO: use fs_searchpaths from files.c
|
||||||
pwdpath = Sys_Cwd();
|
pwdpath = Sys_Cwd();
|
||||||
basepath = Cvar_VariableString( "fs_basepath" );
|
basepath = Cvar_VariableString( "fs_basepath" );
|
||||||
|
libpath = Cvar_VariableString( "fs_libpath" );
|
||||||
homepath = Cvar_VariableString( "fs_homepath" );
|
homepath = Cvar_VariableString( "fs_homepath" );
|
||||||
gamedir = Cvar_VariableString( "fs_game" );
|
gamedir = Cvar_VariableString( "fs_game" );
|
||||||
|
|
||||||
|
@ -416,6 +443,9 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
|
||||||
if(!libHandle && basepath)
|
if(!libHandle && basepath)
|
||||||
libHandle = Sys_TryLibraryLoad(basepath, gamedir, fname, fqpath);
|
libHandle = Sys_TryLibraryLoad(basepath, gamedir, fname, fqpath);
|
||||||
|
|
||||||
|
if(!libHandle && libpath)
|
||||||
|
libHandle = Sys_TryLibraryLoad(libpath, gamedir, fname, fqpath);
|
||||||
|
|
||||||
if(!libHandle) {
|
if(!libHandle) {
|
||||||
Com_Printf ( "Sys_LoadDll(%s) failed to load library\n", name );
|
Com_Printf ( "Sys_LoadDll(%s) failed to load library\n", name );
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -469,6 +499,14 @@ void Sys_ParseArgs( int argc, char **argv )
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DEFAULT_LIBDIR
|
||||||
|
# ifdef MACOS_X
|
||||||
|
# define DEFAULT_LIBDIR Sys_StripAppBundle(Sys_BinaryPath())
|
||||||
|
# else
|
||||||
|
# define DEFAULT_LIBDIR Sys_BinaryPath()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
Sys_SigHandler
|
Sys_SigHandler
|
||||||
|
@ -538,6 +576,7 @@ int main( int argc, char **argv )
|
||||||
Sys_ParseArgs( argc, argv );
|
Sys_ParseArgs( argc, argv );
|
||||||
Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) );
|
Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) );
|
||||||
Sys_SetDefaultInstallPath( DEFAULT_BASEDIR );
|
Sys_SetDefaultInstallPath( DEFAULT_BASEDIR );
|
||||||
|
Sys_SetDefaultLibPath( DEFAULT_LIBDIR );
|
||||||
|
|
||||||
// Concatenate the command line for passing to Com_Init
|
// Concatenate the command line for passing to Com_Init
|
||||||
for( i = 1; i < argc; i++ )
|
for( i = 1; i < argc; i++ )
|
||||||
|
|
Loading…
Reference in a new issue