[quake3] quake3 on Solaris x86

vincent at cojot.name vincent at cojot.name
Tue Nov 1 12:12:11 EST 2005


Here's a diff (backported from ioq2 code base) that fixes LoadTGA on 
Solaris/Sparc. I bet it applies to other arches too..
I'm going to audit the tr_image* code to check for other fixes..

Best regards,

PS: Now the client dies in as follows:

----- finished R_Init -----

------- sound initialization -------
SDL Audio driver initializing...
Calling SDL_Init(SDL_INIT_AUDIO)...
SDL_Init(SDL_INIT_AUDIO) passed.
SDL audio driver is "audio"
Format we requested from SDL audio device:
Format: AUDIO_S16MSB
Freq: 22050
Samples: 512
Channels: 2

[New LWP 1]
[New LWP 2]
Format we actually got:
Format: AUDIO_S16MSB
Freq: 22050
Samples: 512
Channels: 2

WARNING: sdlmixsamps wasn't a power of two (10240), so we made it one (16384).
Starting SDL audio callback...
SDL audio initialized.
------------------------------------
----- Sound Info -----
     1 stereo
16384 samples
    16 samplebits
     1 submission_chunk
22050 speed
0x54576a0 dma buffer
No background file.
----------------------
Sound memory manager started
Loading vm file vm/ui.qvm...
Architecture doesn't have a bytecode compiler, using interpreter

Program received signal SIGSEGV, Segmentation fault.
0x000be1a0 in VM_PrepareInterpreter (vm=0x9c2efc, header=0x51a4ab8) at ../qcommon/vm_interpreted.c:208
208                             codeBase[pc+0] = loadWord(&code[pc]);
(gdb)
-------------- next part --------------
Index: tr_image.c
===================================================================
--- tr_image.c	(revision 204)
+++ tr_image.c	(working copy)
@@ -1135,6 +1135,7 @@
 	byte	*buffer;
 	TargaHeader	targa_header;
 	byte		*targa_rgba;
+	byte tmp[2];
 
 	*pic = NULL;
 
@@ -1152,18 +1153,22 @@
 	targa_header.colormap_type = *buf_p++;
 	targa_header.image_type = *buf_p++;
 	
-	targa_header.colormap_index = LittleShort ( *(short *)buf_p );
+	tmp[0] = buf_p[0];
+	tmp[1] = buf_p[1];
+	targa_header.colormap_index = LittleShort ( *((short *)tmp) );
 	buf_p += 2;
-	targa_header.colormap_length = LittleShort ( *(short *)buf_p );
+	tmp[0] = buf_p[0];
+	tmp[1] = buf_p[1];
+	targa_header.colormap_length = LittleShort ( *((short *)tmp) );
 	buf_p += 2;
 	targa_header.colormap_size = *buf_p++;
-	targa_header.x_origin = LittleShort ( *(short *)buf_p );
+	targa_header.x_origin = LittleShort ( *((short *)buf_p) );
 	buf_p += 2;
-	targa_header.y_origin = LittleShort ( *(short *)buf_p );
+	targa_header.y_origin = LittleShort ( *((short *)buf_p) );
 	buf_p += 2;
-	targa_header.width = LittleShort ( *(short *)buf_p );
+	targa_header.width = LittleShort ( *((short *)buf_p) );
 	buf_p += 2;
-	targa_header.height = LittleShort ( *(short *)buf_p );
+	targa_header.height = LittleShort ( *((short *)buf_p) );
 	buf_p += 2;
 	targa_header.pixel_size = *buf_p++;
 	targa_header.attributes = *buf_p++;
Index: qgl.h
===================================================================
--- qgl.h	(revision 204)
+++ qgl.h	(working copy)
@@ -94,7 +94,7 @@
 #endif /* defined(__sun) */
 
 // NOTE: some Linux platforms would need those prototypes
-#if defined(MACOS_X) || defined(__sun)
+#if defined(MACOS_X) || ( defined(__sun) && defined(__sparc) )
 typedef void (APIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
 typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
 typedef void (APIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);


More information about the quake3 mailing list