- Small change to search path order - local files not in .pk3s take precedence over files in pk3s. Should make life easier for modders/mappers wanting to override textures that are already contained in some older pk3

- Make VM loading more robust, change loading order: when vm_* == 0 first try loading DLL, then QVM in *each* search directory/path
- Fix FS_FileForHandle that would return a FILE pointer to invalid file handle 0
This commit is contained in:
Thilo Schulz 2011-06-15 22:09:26 +00:00
parent 1ff28b3b2e
commit 9219cde4e8
6 changed files with 584 additions and 368 deletions

View file

@ -412,35 +412,23 @@ void Sys_UnloadDll( void *dllHandle )
Sys_LoadDll
Used to load a development dll instead of a virtual machine
#1 look in fs_homepath
#2 look in fs_basepath
=================
*/
void * QDECL Sys_LoadDll( const char *name,
void *Sys_LoadDll(const char *name,
intptr_t (QDECL **entryPoint)(int, ...),
intptr_t (*systemcalls)(intptr_t, ...) )
intptr_t (*systemcalls)(intptr_t, ...))
{
void *libHandle;
void (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) );
char fname[MAX_OSPATH];
char *netpath;
void *libHandle;
void (*dllEntry)(intptr_t (*syscallptr)(intptr_t, ...));
assert( name );
assert(name);
Com_sprintf(fname, sizeof(fname), "%s" ARCH_STRING DLL_EXT, name);
Com_Printf( "Loading DLL file: %s\n", name);
libHandle = Sys_LoadLibrary(name);
netpath = FS_FindDll(fname);
if(!netpath) {
Com_Printf( "Sys_LoadDll(%s) could not find it\n", fname );
return NULL;
}
Com_Printf( "Loading DLL file: %s\n", netpath);
libHandle = Sys_LoadLibrary(netpath);
if(!libHandle) {
Com_Printf( "Sys_LoadDll(%s) failed:\n\"%s\"\n", netpath, Sys_LibraryError() );
if(!libHandle)
{
Com_Printf("Sys_LoadDll(%s) failed:\n\"%s\"\n", name, Sys_LibraryError());
return NULL;
}