Open FenzaFenz opened 7 years ago
I've just compiled the latest build and it SegFaults at:
clearbufbyte (D=D@entry=0x55810fe0, c=123, c@entry=125, a=a@entry=0) at fixedPoint_math.c:20 20 *(p++) = (uint8_t )((a & m[z])>>n[z]);
So it fails here. If your build is 64 bit, does it also crash on a 32 bit version?
The game works perfectly in 32bit. But not 64bit.
I've done some tracking of the code and found this in Engine/src/unix_compat.h:28
// Horrible horrible macro: Watcom allowed memory pointer to be cast
// to a 32bits integer. The code is unfortunately stuffed with this :( !
#define FP_OFF(x) ((int32_t) (x))
Changing the type from an int32_t to a long helps the game continue but still SegFaults. This time in the function clearview in Engine/src/engine.c:8995 Variable p clearly needs to be a long type, but it still SegFaults.
Hmmm. Getting a bit further. If I put a return; at the beginning of the clearview function, the game then SegFaults at dorotatesprite in Engine/src/engine.c:3784
If I put a return; at the beginning of dorotatesprite, the game actually starts playing. Sort of.
One more fix: In the function clearview, changing the type for variable p to uint8_t* fixes that function. This leaves the dorotatesprite function. All I can work out is it's from line 3991 onwards in that function, but I can't see where.
EDIT: The remaining memory pointer problems all seem to be in Engine/src/draw.c (called from dorotatesprite) which is riddled with 32 bit pointers.
Execution fails on Debian 9.3 64bit. It executes perfectly on Debian 9.3 32bit. Also fails on Ubuntu 17.10 64bit. But it does work on Linux Mint 18.2 64bit.
@phenest I just made a pull request of fixes for 64-bit. Please try my branch (https://github.com/rohit-n/chocolate_duke3D/tree/build-64bit) and let me know if you have any issues.
@phenest I just made a pull request of fixes for 64-bit. Please try my branch (https://github.com/rohit-n/chocolate_duke3D/tree/build-64bit) and let me know if you have any issues.
Sorry for necro-ing the issue, but will this be merged as a solution to this issue?