diff options
Diffstat (limited to 'src/sys/sys_main.c')
-rw-r--r-- | src/sys/sys_main.c | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/src/sys/sys_main.c b/src/sys/sys_main.c index 53fc57fb..46a795eb 100644 --- a/src/sys/sys_main.c +++ b/src/sys/sys_main.c @@ -208,6 +208,8 @@ static void Sys_Exit( int exitCode ) remove( Sys_PIDFileName( ) ); } + Sys_PlatformExit( ); + exit( exitCode ); } @@ -408,34 +410,6 @@ void Sys_UnloadDll( void *dllHandle ) /* ================= -Sys_TryLibraryLoad -================= -*/ -static void* Sys_TryLibraryLoad(const char* base, const char* gamedir, const char* fname, char* fqpath ) -{ - void* libHandle; - char* fn; - - *fqpath = 0; - - fn = FS_BuildOSPath( base, gamedir, fname ); - Com_Printf( "Sys_LoadDll(%s)... \n", fn ); - - libHandle = Sys_LoadLibrary(fn); - - if(!libHandle) { - Com_Printf( "Sys_LoadDll(%s) failed:\n\"%s\"\n", fn, Sys_LibraryError() ); - return NULL; - } - - Com_Printf ( "Sys_LoadDll(%s): succeeded ...\n", fn ); - Q_strncpyz ( fqpath , fn , MAX_QPATH ) ; - - return libHandle; -} - -/* -================= Sys_LoadDll Used to load a development dll instead of a virtual machine @@ -443,33 +417,31 @@ Used to load a development dll instead of a virtual machine #2 look in fs_basepath ================= */ -void *Sys_LoadDll( const char *name, char *fqpath , +void *Sys_LoadDll( const char *name, intptr_t (**entryPoint)(int, ...), intptr_t (*systemcalls)(intptr_t, ...) ) { void *libHandle; void (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) ); char fname[MAX_OSPATH]; - char *basepath; - char *homepath; - char *gamedir; + char *netpath; assert( name ); - Q_snprintf (fname, sizeof(fname), "%s" ARCH_STRING DLL_EXT, name); + Com_sprintf(fname, sizeof(fname), "%s" ARCH_STRING DLL_EXT, name); - // TODO: use fs_searchpaths from files.c - basepath = Cvar_VariableString( "fs_basepath" ); - homepath = Cvar_VariableString( "fs_homepath" ); - gamedir = Cvar_VariableString( "fs_game" ); + netpath = FS_FindDll(fname); - libHandle = Sys_TryLibraryLoad(homepath, gamedir, fname, fqpath); + if(!netpath) { + Com_Printf( "Sys_LoadDll(%s) could not find it\n", fname ); + return NULL; + } - if(!libHandle && basepath) - libHandle = Sys_TryLibraryLoad(basepath, gamedir, fname, fqpath); + Com_Printf( "Loading DLL file: %s\n", netpath); + libHandle = Sys_LoadLibrary(netpath); if(!libHandle) { - Com_Printf ( "Sys_LoadDll(%s) failed to load library\n", name ); + Com_Printf( "Sys_LoadDll(%s) failed:\n\"%s\"\n", netpath, Sys_LibraryError() ); return NULL; } |