aboutsummaryrefslogtreecommitdiffstats
path: root/games/ioquake3/files/patch-code-qcommon-vm_interpreted.c
blob: 1e9b6ee4d54bc3c9d7ee8dffe6899338bbbc9642 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- code/qcommon/vm_interpreted.c   2009/11/01 19:58:07 1717
+++ code/qcommon/vm_interpreted.c   2010/01/16 10:55:51 1772
@@ -516,18 +516,20 @@
 
 //VM_LogSyscalls( (int *)&image[ programStack + 4 ] );
                {
-                   intptr_t* argptr = (intptr_t *)&image[ programStack + 4 ];
-               #if __WORDSIZE == 64
-               // the vm has ints on the stack, we expect
-               // longs so we have to convert it
-                   intptr_t argarr[16];
-                   int i;
-                   for (i = 0; i < 16; ++i) {
-                       argarr[i] = *(int*)&image[ programStack + 4 + 4*i ];
+                   // the vm has ints on the stack, we expect
+                   // pointers so we might have to convert it
+                   if (sizeof(intptr_t) != sizeof(int)) {
+                       intptr_t argarr[16];
+                       int *imagePtr = (int *)&image[programStack];
+                       int i;
+                       for (i = 0; i < 16; ++i) {
+                           argarr[i] = *(++imagePtr);
+                       }
+                       r = vm->systemCall( argarr );
+                   } else {
+                       intptr_t* argptr = (intptr_t *)&image[ programStack + 4 ];
+                       r = vm->systemCall( argptr );
                    }
-                   argptr = argarr;
-               #endif
-                   r = vm->systemCall( argptr );
                }
 
 #ifdef DEBUG_VM