From: Simon McVittie Date: Wed, 21 Jul 2010 19:46:38 +0100 Subject: [PATCH] Sys_LoadDll: use FS_FindDll Origin: vendor, Debian Bug: http://bugzilla.icculus.org/show_bug.cgi?id=4701 Forwarded: yes --- code/sys/sys_main.c | 48 +++++++++--------------------------------------- 1 files changed, 9 insertions(+), 39 deletions(-) diff --git a/code/sys/sys_main.c b/code/sys/sys_main.c index 91c54f1..923ecf3 100644 --- a/code/sys/sys_main.c +++ b/code/sys/sys_main.c @@ -402,34 +402,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 @@ -444,26 +416,24 @@ void *Sys_LoadDll( const char *name, char *fqpath , 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); - // 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; } --