Check for gamex86.dll if game.dll wasn't found

This change allows the usage of old mods without renaming their game
lib. This is applied to windows only because the few Linux mods out
there are broken since a long time due to incompatible changes in libc
and the kernel. Requested by Victor Sergeevich.
This commit is contained in:
Yamagi Burmeister 2012-07-09 15:54:20 +02:00
parent 55a65bb53e
commit de3da4ba70

View file

@ -328,7 +328,6 @@ void *
Sys_GetGameAPI(void *parms)
{
void *(*GetGameAPI)(void *);
const char *gamename = "game.dll";
char name[MAX_OSPATH];
char *path = NULL;
@ -349,7 +348,8 @@ Sys_GetGameAPI(void *parms)
return NULL; /* couldn't find one anywhere */
}
Com_sprintf(name, sizeof(name), "%s/%s", path, gamename);
/* Try game.dll */
Com_sprintf(name, sizeof(name), "%s/%s", path, "game.dll");
game_library = LoadLibrary(name);
if (game_library)
@ -357,6 +357,16 @@ Sys_GetGameAPI(void *parms)
Com_DPrintf("LoadLibrary (%s)\n", name);
break;
}
/* Try gamex86.dll as fallback */
Com_sprintf(name, sizeof(name), "%s/%s", path, "gamex86.dll");
game_library = LoadLibrary(name);
if (game_library)
{
Com_DPrintf("LoadLibrary (%s)\n", name);
break;
}
}
GetGameAPI = (void *)GetProcAddress(game_library, "GetGameAPI");