diff options
author | Thilo Schulz <arny@ats.s.bawue.de> | 2011-09-27 22:16:07 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-10 23:38:29 +0000 |
commit | 8f53d0826c3bc1742fd37db56c9f3499d3060a9a (patch) | |
tree | b8b9f9ba73d083bf102238564032e4c2ed3da9c9 /src/qcommon/vm.c | |
parent | e9d0af975a62f645d0ff3b29d49670f176b57918 (diff) |
Allow VM_Restart to load unpure qagame.qvm so that local server won't crash after map_restart if server operator has qagame.qvm residing outside pak file (#5196) Thanks to "rg3" for providing a shell account
Diffstat (limited to 'src/qcommon/vm.c')
-rw-r--r-- | src/qcommon/vm.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/qcommon/vm.c b/src/qcommon/vm.c index 90af748f..6113901d 100644 --- a/src/qcommon/vm.c +++ b/src/qcommon/vm.c @@ -364,7 +364,8 @@ VM_LoadQVM Load a .qvm file ================= */ -vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) { +vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc, qboolean unpure) +{ int dataLength; int i; char filename[MAX_QPATH]; @@ -377,7 +378,7 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) { Com_sprintf( filename, sizeof(filename), "vm/%s.qvm", vm->name ); Com_Printf( "Loading vm file %s...\n", filename ); - FS_ReadFileDir(filename, vm->searchPath, &header.v); + FS_ReadFileDir(filename, vm->searchPath, unpure, &header.v); if ( !header.h ) { Com_Printf( "Failed.\n" ); @@ -523,9 +524,13 @@ VM_Restart Reload the data, but leave everything else in place This allows a server to do a map_restart without changing memory allocation + +We need to make sure that servers can access unpure QVMs (not contained in any pak) +even if the client is pure, so take "unpure" as argument. ================= */ -vm_t *VM_Restart( vm_t *vm ) { +vm_t *VM_Restart(vm_t *vm, qboolean unpure) +{ vmHeader_t *header; // DLL's can't be restarted in place @@ -543,15 +548,16 @@ vm_t *VM_Restart( vm_t *vm ) { } // load the image - Com_Printf( "VM_Restart()\n" ); + Com_Printf("VM_Restart()\n"); - if( !( header = VM_LoadQVM( vm, qfalse ) ) ) { - Com_Error( ERR_DROP, "VM_Restart failed" ); + if(!(header = VM_LoadQVM(vm, qfalse, unpure))) + { + Com_Error(ERR_DROP, "VM_Restart failed"); return NULL; } // free the original file - FS_FreeFile( header ); + FS_FreeFile(header); return vm; } @@ -622,7 +628,7 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *), else if(retval == VMI_COMPILED) { vm->searchPath = startSearch; - if((header = VM_LoadQVM(vm, qtrue))) + if((header = VM_LoadQVM(vm, qtrue, qfalse))) break; // VM_Free overwrites the name on failed load |