Ported the linux q2dll stuff over to SDL, attempts to load gamei386.so still. This is wrong.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3530 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
a2fbc53631
commit
d57438adf3
1 changed files with 54 additions and 12 deletions
|
@ -139,18 +139,6 @@ void Sys_ServerActivity(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Without these two we cannot run Q2 gamecode.
|
|
||||||
void Sys_UnloadGame (void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
void *Sys_GetGameAPI (void *parms)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Sys_CloseLibrary(dllhandle_t *lib)
|
void Sys_CloseLibrary(dllhandle_t *lib)
|
||||||
{
|
{
|
||||||
SDL_UnloadObject((void*)lib);
|
SDL_UnloadObject((void*)lib);
|
||||||
|
@ -179,6 +167,60 @@ dllhandle_t *Sys_LoadLibrary(char *name, dllfunction_t *funcs)
|
||||||
return (dllhandle_t*)lib;
|
return (dllhandle_t*)lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Without these two we cannot run Q2 gamecode.
|
||||||
|
dllhandle_t *q2gamedll;
|
||||||
|
void Sys_UnloadGame (void)
|
||||||
|
{
|
||||||
|
if (q2gamedll)
|
||||||
|
Sys_CloseLibrary(q2gamedll);
|
||||||
|
q2gamedll = NULL;
|
||||||
|
}
|
||||||
|
void *Sys_GetGameAPI (void *parms)
|
||||||
|
{
|
||||||
|
void *(*GetGameAPI)(void *);
|
||||||
|
dllfunction_t funcs[] =
|
||||||
|
{
|
||||||
|
{(void**)GetGameAPI, "GetGameAPI"},
|
||||||
|
{NULL,NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
char name[MAX_OSPATH];
|
||||||
|
char curpath[MAX_OSPATH];
|
||||||
|
char *searchpath;
|
||||||
|
const char *gamename = "gamei386.so";
|
||||||
|
|
||||||
|
void *ret;
|
||||||
|
|
||||||
|
Con_DPrintf("Searching for %s\n", gamename);
|
||||||
|
|
||||||
|
getcwd(curpath, sizeof(curpath));
|
||||||
|
|
||||||
|
searchpath = 0;
|
||||||
|
while((searchpath = COM_NextPath(searchpath)))
|
||||||
|
{
|
||||||
|
if (searchpath[0] == '/')
|
||||||
|
snprintf(name, sizeof(name), "%s/%s", searchpath, gamename);
|
||||||
|
else
|
||||||
|
snprintf(name, sizeof(name), "%s/%s/%s", curpath, searchpath, gamename);
|
||||||
|
|
||||||
|
q2gamedll = Sys_LoadLibrary(name, funcs);
|
||||||
|
if (q2gamedll && gamename)
|
||||||
|
{
|
||||||
|
ret = GetGameAPI(parms);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
Sys_CloseLibrary(q2gamedll);
|
||||||
|
q2gamedll = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//used to see if a file exists or not.
|
//used to see if a file exists or not.
|
||||||
int Sys_FileTime (char *path)
|
int Sys_FileTime (char *path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue