[SCM] Packaging for the OpenArena engine branch, master, updated. debian/0.8.1-7-17-g7521e4f
Simon McVittie
smcv at debian.org
Wed Jul 21 22:46:42 UTC 2010
The following commit has been merged in the master branch:
commit 519a6cf23a74b19914419985eb680bf79136e255
Author: Simon McVittie <smcv at debian.org>
Date: Wed Jul 21 23:39:35 2010 +0100
Add a special vmMagic that causes equivalent native code to be loaded instead
diff --git a/debian/patches/0009-Add-a-special-vmMagic-that-causes-equivalent-native-.patch b/debian/patches/0009-Add-a-special-vmMagic-that-causes-equivalent-native-.patch
new file mode 100644
index 0000000..12c00d4
--- /dev/null
+++ b/debian/patches/0009-Add-a-special-vmMagic-that-causes-equivalent-native-.patch
@@ -0,0 +1,65 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Wed, 21 Jul 2010 19:50:32 +0100
+Subject: [PATCH] Add a special vmMagic that causes equivalent native code to be loaded instead
+
+This means that mods can build everything from source without relying on
+the non-GPL q3lcc compiler. By padding the fake QVM with bytes chosen
+to match the CRC-32 of the upstream-released QVM, it's even possible to
+be network-compatible with the upstream one, and so play on pure servers.
+---
+ code/qcommon/qfiles.h | 4 ++++
+ code/qcommon/vm.c | 18 ++++++++++++++++++
+ 2 files changed, 22 insertions(+), 0 deletions(-)
+
+diff --git a/code/qcommon/qfiles.h b/code/qcommon/qfiles.h
+index 7f1ef96..e3515b4 100644
+--- a/code/qcommon/qfiles.h
++++ b/code/qcommon/qfiles.h
+@@ -52,6 +52,10 @@ QVM files
+
+ #define VM_MAGIC 0x12721444
+ #define VM_MAGIC_VER2 0x12721445
++
++/* 'NTVE', but backwards because the QVM format is little-endian */
++#define VM_MAGIC_USE_NATIVE 0x4556544E
++
+ typedef struct {
+ int vmMagic;
+
+diff --git a/code/qcommon/vm.c b/code/qcommon/vm.c
+index c2efcd2..292b631 100644
+--- a/code/qcommon/vm.c
++++ b/code/qcommon/vm.c
+@@ -376,6 +376,18 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) {
+ return NULL;
+ }
+
++ if (LittleLong( header->vmMagic ) == VM_MAGIC_USE_NATIVE) {
++ Com_Printf( "...which has vmMagic VM_MAGIC_USE_NATIVE.\n" );
++ Com_Printf( "Loading DLL file %s instead.\n", vm->name );
++ vm->dllHandle = Sys_LoadDll( vm->name, vm->fqpath , &vm->entryPoint, VM_DllSyscall );
++ if ( !vm->dllHandle ) {
++ Com_Printf( "Failed to load DLL.\n" );
++ VM_Free( vm );
++ return NULL;
++ }
++ return header;
++ }
++
+ if( LittleLong( header->vmMagic ) == VM_MAGIC_VER2 ) {
+ Com_Printf( "...which has vmMagic VM_MAGIC_VER2\n" );
+
+@@ -563,6 +575,12 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *),
+ return NULL;
+ }
+
++ if ( vm->dllHandle ) {
++ // it was replaced by a DLL anyway
++ FS_FreeFile( header );
++ return vm;
++ }
++
+ // allocate space for the jump targets, which will be filled in by the compile/prep functions
+ vm->instructionPointersLength = header->instructionCount * 4;
+ vm->instructionPointers = Hunk_Alloc( vm->instructionPointersLength, h_high );
+--
diff --git a/debian/patches/series b/debian/patches/series
index cff69dc..ab921e3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@
0006-Fix-FTBFS-on-kFreeBSD.patch
0007-Use-memmove-instead-of-strcpy-for-overlapping-memory.patch
0008-Fix-spelling-error.patch
+0009-Add-a-special-vmMagic-that-causes-equivalent-native-.patch
--
Packaging for the OpenArena engine
More information about the Pkg-games-commits
mailing list