mirror of
https://git.code.sf.net/p/quake/quake2forge
synced 2024-12-12 13:42:21 +00:00
- Added PKGLIBDIR to game search path, so that the game.so
shared object is found. - Reverted the game loader in main.c to iterate through the search path.
This commit is contained in:
parent
a5b3a4adb2
commit
27ab9f9b47
2 changed files with 27 additions and 13 deletions
|
@ -904,6 +904,7 @@ void FS_InitFilesystem (void)
|
||||||
// add baseq2 to search path
|
// add baseq2 to search path
|
||||||
//
|
//
|
||||||
/*FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_basedir->string) );*/
|
/*FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_basedir->string) );*/
|
||||||
|
FS_AddGameDirectory(PKGLIBDIR"/"BASEDIRNAME);
|
||||||
FS_AddGameDirectory(PKGDATADIR"/"BASEDIRNAME);
|
FS_AddGameDirectory(PKGDATADIR"/"BASEDIRNAME);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
39
src/main.c
39
src/main.c
|
@ -221,8 +221,9 @@ void Sys_UnloadGame(void) {
|
||||||
/* Loads the game dll */
|
/* Loads the game dll */
|
||||||
void *Sys_GetGameAPI (void *parms) {
|
void *Sys_GetGameAPI (void *parms) {
|
||||||
gameapi_t * GetGameAPI;
|
gameapi_t * GetGameAPI;
|
||||||
char path[MAX_OSPATH];
|
FILE * fp;
|
||||||
cvar_t * gamename;
|
char name[MAX_OSPATH];
|
||||||
|
char * path;
|
||||||
|
|
||||||
setreuid(getuid(), getuid());
|
setreuid(getuid(), getuid());
|
||||||
setegid(getgid());
|
setegid(getgid());
|
||||||
|
@ -230,18 +231,30 @@ void *Sys_GetGameAPI (void *parms) {
|
||||||
if (game_library)
|
if (game_library)
|
||||||
Com_Error (ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame");
|
Com_Error (ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame");
|
||||||
|
|
||||||
|
Com_Printf("------- Loading game.so -------\n");
|
||||||
|
|
||||||
/* now run through the search paths */
|
/* now run through the search paths */
|
||||||
gamename = Cvar_Get("gamedir", BASEDIRNAME, CVAR_LATCH|CVAR_SERVERINFO);
|
path = NULL;
|
||||||
Com_Printf("------- Loading %s -------\n", gamename->string);
|
while (1) {
|
||||||
|
path = FS_NextPath(path);
|
||||||
/* set the module search path */
|
if (!path)
|
||||||
snprintf(path, MAX_OSPATH, PKGLIBDIR"/%s/game.so", gamename->string);
|
return NULL;
|
||||||
game_library = dlopen(path, RTLD_NOW);
|
snprintf(name, MAX_OSPATH, "%s/game.so", path);
|
||||||
if (game_library) {
|
|
||||||
Com_MDPrintf("LoadLibrary (%s)\n", gamename->string);
|
/* skip it if it doesn't exist */
|
||||||
} else {
|
fp = fopen(name, "rb");
|
||||||
Com_MDPrintf("LoadLibrary (%s)\n", gamename->string);
|
if (fp == NULL)
|
||||||
Com_MDPrintf("%s\n", dlerror());
|
continue;
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
game_library = dlopen(name, RTLD_NOW);
|
||||||
|
if (game_library) {
|
||||||
|
Com_MDPrintf("LoadLibrary (%s)\n", name);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
Com_MDPrintf("LoadLibrary (%s)\n", name);
|
||||||
|
Com_MDPrintf("%s\n", dlerror());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGameAPI = (gameapi_t *) dlsym(game_library, "GetGameAPI");
|
GetGameAPI = (gameapi_t *) dlsym(game_library, "GetGameAPI");
|
||||||
|
|
Loading…
Reference in a new issue