The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => Technical Issues => Topic started by: Oskar Linde on August 06, 2003, 04:50:09 pm

Title: Building on Solaris
Post by: Oskar Linde on August 06, 2003, 04:50:09 pm
I successfully managed to build and rum the latest CVS-release on Solaris (SunOS 5.8), but I hade to make a few changes to the code.

The changes are regarding unaligned pointers. The Sun architechture want pointers to be 32-bit aligned or it crashes with a bus error.

For instance GetCodeResData in dummy.c generates an unaligned pointer on line 296 since MEM_HANDLE is a SWORD. I changed the definition of MEM_HANDLE into a DWORD, and things seems to work. I'm not sure about the proper way to solve this thou.

libvorbis seems to require the OggVorbis_File* to be 64-bit aligned. I made changes in w_memlib to make sure all pointers get this alignment by changing the memory-block headers to 64 bits. This ment changing _alloc_mem() to allocate 2*sizeof(int) instead of 1*sizeof(int) extra memory and return (int *)p+2 instead of +1.  The same change was made to HFree() and HRealloc() (-2 instead of -1) .

Finally, the color cycling in comm.c had unaligned reads and writes. I wrote two functions for doing unaligned reads and writes. I changed the two reads and the write in xform_PLUT_step() into those new functions.

I have not had time to check how these changes effect other platforms, and there are probleby more unaligned reads at other places that I havn't found, but the game seems to run fine as far as I have been able to tell. The sound and music works. Communication, melee, interstellar travel and mineral harvesting also work without glitches.

If anyone is interested in the patches, I will gladly mail them.


Title: Re: Building on Solaris
Post by: meep-eep on August 06, 2003, 09:32:36 pm
The memory management code will be rewritten.
For the rest, yes, I would be interested in your patches, though it doesn't have a high priority right now. I think bug 252 looks like a good place to put them (

Title: Re: Building on Solaris
Post by: Talana on February 28, 2004, 10:11:08 am
Did the Solaris patches make it into 0.3?  I'm considering pulling together an installable package for ("pkg-get"-able), and don't want to reinvent the wheel if someone else has worked this through already.

Title: Re: Building on Solaris
Post by: meep-eep on February 28, 2004, 05:04:19 pm
There have been some changes which should improve things on platforms that have such alignment requirements, but we haven't been purposely elliminating such problems.
I don't think I actually received Oskar's patches, but the problems should probably be easy enough to fix. However, as some of the code involved is scheduled for replacement anyhow, this has received little attention.