aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--code/qcommon/common.c2
-rw-r--r--code/qcommon/q_shared.h48
-rw-r--r--code/renderer/qgl.h16
-rw-r--r--code/tools/asm/Makefile8
-rw-r--r--code/tools/lcc/etc/gcc-solaris.c51
-rw-r--r--code/tools/lcc/etc/lcc.c11
-rw-r--r--code/tools/lcc/makefile12
-rw-r--r--code/unix/Makefile157
-rw-r--r--code/unix/linux_glimp.c38
-rw-r--r--code/unix/linux_joystick.c4
-rw-r--r--code/unix/linux_snd.c4
-rw-r--r--code/unix/sdl_glimp.c4
-rw-r--r--code/unix/sdl_snd.c4
-rw-r--r--code/unix/unix_glw.h4
-rw-r--r--code/unix/unix_main.c8
-rw-r--r--code/unix/unix_net.c4
-rw-r--r--code/unix/unix_shared.c2
17 files changed, 320 insertions, 57 deletions
diff --git a/code/qcommon/common.c b/code/qcommon/common.c
index 60825f2..3fad8ed 100644
--- a/code/qcommon/common.c
+++ b/code/qcommon/common.c
@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "q_shared.h"
#include "qcommon.h"
#include <setjmp.h>
-#if defined __linux__ || defined MACOS_X || defined __FreeBSD__
+#if defined __linux__ || defined MACOS_X || defined __FreeBSD__ || defined __sun
#include <netinet/in.h>
#else
#include <winsock.h>
diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
index 41e634a..08d4c23 100644
--- a/code/qcommon/q_shared.h
+++ b/code/qcommon/q_shared.h
@@ -105,7 +105,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// this is the define for determining if we have an asm version of a C function
-#if (defined _M_IX86 || defined __i386__) && !defined __sun__ && !defined __LCC__
+#if (defined _M_IX86 || defined __i386__) && !defined __sun && !defined __LCC__
#define id386 1
#else
#define id386 0
@@ -355,6 +355,52 @@ static float LittleFloat (const float l) { return FloatSwap(&l); }
#endif
+//======================= SUNOS DEFINES =================================
+
+#ifdef __sun
+
+#include <sys/isa_defs.h>
+
+// bk001205 - from Makefile
+#define stricmp strcasecmp
+
+#define MAC_STATIC
+#define ID_INLINE inline
+
+#ifdef __i386__
+#define CPUSTRING "Solaris-i386"
+#elif defined __sparc
+#define CPUSTRING "Solaris-sparc"
+#endif
+
+#define PATH_SEP '/'
+
+// bk001205 - try
+#ifdef Q3_STATIC
+#define GAME_HARD_LINKED
+#define CGAME_HARD_LINKED
+#define UI_HARD_LINKED
+#define BOTLIB_HARD_LINKED
+#endif
+
+#if defined(_LITTLE_ENDIAN)
+inline static short BigShort( short l) { return ShortSwap(l); }
+#define LittleShort
+inline static int BigLong(int l) { return LongSwap(l); }
+#define LittleLong
+inline static float BigFloat(const float l) { return FloatSwap(&l); }
+#define LittleFloat
+#else /* Must be _BIG_ENDIAN */
+#define BigShort
+inline static short LittleShort(short l) { return ShortSwap(l); }
+#define BigLong
+inline static int LittleLong (int l) { return LongSwap(l); }
+#define BigFloat
+inline static float LittleFloat (const float l) { return FloatSwap(&l); }
+#endif
+
+#endif
+
//=============================================================
typedef unsigned char byte;
diff --git a/code/renderer/qgl.h b/code/renderer/qgl.h
index ee76ed9..02b5727 100644
--- a/code/renderer/qgl.h
+++ b/code/renderer/qgl.h
@@ -57,6 +57,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <GL/fxmesa.h>
#endif
+#elif defined( __sun )
+#include <GL/gl.h>
+#include <GL/glx.h>
+
#else
#include <gl.h>
@@ -76,6 +80,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/*
** multitexture extension definitions
*/
+#if !defined(__sun)
#define GL_ACTIVE_TEXTURE_ARB 0x84E0
#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
#define GL_MAX_ACTIVE_TEXTURES_ARB 0x84E2
@@ -84,9 +89,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define GL_TEXTURE1_ARB 0x84C1
#define GL_TEXTURE2_ARB 0x84C2
#define GL_TEXTURE3_ARB 0x84C3
+#else
+#define GL_MAX_ACTIVE_TEXTURES_ARB 0x84E2
+#endif /* defined(__sun) */
// NOTE: some Linux platforms would need those prototypes
-#if defined(MACOS_X)
+#if defined(MACOS_X) || defined(__sun)
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);
@@ -152,7 +160,7 @@ extern void ( APIENTRY * qglUnlockArraysEXT) (void);
//===========================================================================
// non-windows systems will just redefine qgl* to gl*
-#if !defined( _WIN32 ) && !defined(MACOS_X) && !defined( __linux__ ) && !defined( __FreeBSD__ ) // rb010123
+#if !defined( _WIN32 ) && !defined(MACOS_X) && !defined( __linux__ ) && !defined( __FreeBSD__ ) && !defined(__sun) // rb010123
#include "qgl_linked.h"
@@ -539,7 +547,7 @@ extern BOOL ( WINAPI * qwglSwapIntervalEXT)( int interval );
#endif // _WIN32
-#if ( (defined __linux__ ) || (defined __FreeBSD__ ) ) // rb010123
+#if ( (defined __linux__ ) || (defined __FreeBSD__ ) || (defined __sun) ) // rb010123
//FX Mesa Functions
// bk001129 - from cvs1.17 (mkv)
@@ -560,7 +568,7 @@ extern Bool (*qglXMakeCurrent)( Display *dpy, GLXDrawable drawable, GLXContext c
extern void (*qglXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, GLuint mask );
extern void (*qglXSwapBuffers)( Display *dpy, GLXDrawable drawable );
-#endif // __linux__ || __FreeBSD__ // rb010123
+#endif // __linux__ || __FreeBSD__ || __sun // rb010123
#endif // _WIN32 && __linux__
diff --git a/code/tools/asm/Makefile b/code/tools/asm/Makefile
index a6202ae..852afa6 100644
--- a/code/tools/asm/Makefile
+++ b/code/tools/asm/Makefile
@@ -7,6 +7,12 @@ else
BINEXT=
endif
+ifeq ($(PLATFORM),SunOS)
+ INSTALL=ginstall
+else
+ INSTALL=install
+endif
+
CC=gcc
Q3ASM_CFLAGS=-O2 -Wall -Werror -fno-strict-aliasing
@@ -19,7 +25,7 @@ clean:
rm -f q3asm *~ *.o
install: default
- install -s -m 0755 q3asm$(BINEXT) ../
+ $(INSTALL) -s -m 0755 q3asm$(BINEXT) ../
uninstall:
rm -f ../q3asm$(BINEXT)
diff --git a/code/tools/lcc/etc/gcc-solaris.c b/code/tools/lcc/etc/gcc-solaris.c
index 24b6cd4..8a47f11 100644
--- a/code/tools/lcc/etc/gcc-solaris.c
+++ b/code/tools/lcc/etc/gcc-solaris.c
@@ -1,48 +1,55 @@
-/* SPARCs running Solaris 2.5.1 w/GCC tools
- at CS Dept., Princeton University */
+/* Solaris 10 sparc */
#include <string.h>
+/*
+TTimo - 10-18-2001
+our binaries are named q3lcc q3rcc and q3cpp
+removed hardcoded paths
+removed __linux__ preprocessor define (confuses the preprocessor, we are doing bytecode!)
+*/
+
#ifndef LCCDIR
-#define LCCDIR "/usr/local/lib/lcc/"
+#define LCCDIR ""
#endif
#ifndef GCCDIR
-#define GCCDIR "/usr/local/gnu/bin/"
+#define GCCDIR "/usr/sfw/bin/"
#endif
#ifndef GCCLIB
-#define GCCLIB "/usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/"
+#define GCCLIB "/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/"
#endif
+#define BINEXT ""
-char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
+char *suffixes[] = { ".c", ".i", ".asm", ".s", ".o", ".out", 0 };
char inputs[256] = "";
-char *cpp[] = { LCCDIR "cpp",
- "-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix",
- "$1", "$2", "$3", 0 };
-char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
- "-I" GCCLIB "include", "-I/usr/include", 0 };
-char *com[] = { LCCDIR "rcc", "-target=sparc/solaris",
+char *cpp[] = { LCCDIR "q3cpp" BINEXT,
+ "-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix", "-D__sun",
"$1", "$2", "$3", 0 };
-char *as[] = { GCCDIR "as", "-f", "-o", "$3", "$1", "$2", 0 };
-char *ld[] = { GCCDIR "ld", "-o", "$3", "$1",
- GCCLIB "crti.o", GCCLIB "crt1.o",
- GCCLIB "crtbegin.o", "$2", "", "", "-L" LCCDIR, "-llcc",
- "-L" GCCLIB, "-lgcc", "-lm", "-lc", "",
- GCCLIB "crtend.o", GCCLIB "crtn.o", 0 };
+char *include[] = { "-I" LCCDIR "include", "-I" LCCDIR "gcc/include",
+ "-I" SYSTEM "include", "-I/usr/include", 0 };
+/* char *com[] = { LCCDIR "q3rcc", "-target=bytecode", "$1", "$2", "$3", 0 }; */
+char *com[] = { LCCDIR "q3rcc", "-target=sparc/solaris", "$1", "$2", "$3", 0 };
+char *as[] = { "/usr/ccs/bin/as", "-o", "$3", "$1", "$2", 0 };
+char *ld[] = { "/usr/ccs/bin/ld", "-o", "$3", "$1",
+ GCCLIB "crti.o", GCCLIB "crt1.o",
+ GCCLIB "crtbegin.o", "$2", "", "", "-L" LCCDIR, "-llcc",
+ "-L" GCCLIB, "-lgcc", "-lm", "-lc", "",
+ GCCLIB "crtend.o", GCCLIB "crtn.o", 0 };
extern char *concat(char *, char *);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
- cpp[0] = concat(&arg[8], "/cpp");
+ cpp[0] = concat(&arg[8], "/gcc/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
ld[10] = concat("-L", &arg[8]);
com[0] = concat(&arg[8], "/rcc");
+ } else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
+ ld[8] = "-lgmon";
} else if (strcmp(arg, "-g") == 0)
;
- else if (strcmp(arg, "-pg") == 0) {
- ld[8] = GCCLIB "gmon.o";
- } else if (strcmp(arg, "-b") == 0)
+ else if (strcmp(arg, "-b") == 0)
;
else
return 0;
diff --git a/code/tools/lcc/etc/lcc.c b/code/tools/lcc/etc/lcc.c
index 01257fe..ab411a8 100644
--- a/code/tools/lcc/etc/lcc.c
+++ b/code/tools/lcc/etc/lcc.c
@@ -48,7 +48,9 @@ extern char *stringf(const char *, ...);
extern int suffix(char *, char *[], int);
extern char *tempname(char *);
+#ifndef __sun
extern int getpid(void);
+#endif
extern char *cpp[], *include[], *com[], *as[],*ld[], inputs[], *suffixes[];
extern int option(char *);
@@ -95,15 +97,14 @@ void AddLCCDirToPath( const char *lccBinary )
if( p )
{
*p = '\0';
- strncpy( path, "PATH=", 4096 );
- strncat( path, getenv( "PATH" ), 4096 );
#ifdef _WIN32
+ strncpy( path, "PATH=", 4096 );
strncat( path, ";", 4096 );
strncat( path, basepath, 4096 );
_putenv( path );
#else
- strncat( path, ":", 4096 );
- strncat( path, basepath, 4096 );
+/* Ugly workaround against execvp problem/limitation on Solaris 10 */
+ snprintf( path, 4096, "PATH=%s:%s", basepath, getenv( "PATH" ) );
putenv( path );
#endif
}
@@ -252,7 +253,9 @@ char *basepath(char *name) {
#include <process.h>
#else
#define _P_WAIT 0
+#ifndef __sun
extern int fork(void);
+#endif
extern int wait(int *);
static int _spawnvp(int mode, const char *cmdname, char *argv[]) {
diff --git a/code/tools/lcc/makefile b/code/tools/lcc/makefile
index 7f78156..10f551a 100644
--- a/code/tools/lcc/makefile
+++ b/code/tools/lcc/makefile
@@ -25,6 +25,12 @@ BUILDDIR=build
TSTDIR=$(BUILDDIR)/$(TARGET)/tst
BD=$(BUILDDIR)/
T=$(TSTDIR)/
+ifeq ($(PLATFORM),SunOS)
+ INSTALL=ginstall
+HOSTFILE=etc/gcc-solaris.c
+else
+ INSTALL=install
+endif
# $Id: makefile 145 2001-10-17 21:53:10Z timo $
@@ -237,9 +243,9 @@ testclean:
$(RM) $(T)yacc$(E) $(T)yacc.s $(T)yacc.2 $(T)yacc.1
install:: all
- install -s -m 0755 $(BD)q3lcc$(E) ../
- install -s -m 0755 $(BD)q3cpp$(E) ../
- install -s -m 0755 $(BD)q3rcc$(E) ../
+ $(INSTALL) -s -m 0755 $(BD)q3lcc$(E) ../
+ $(INSTALL) -s -m 0755 $(BD)q3cpp$(E) ../
+ $(INSTALL) -s -m 0755 $(BD)q3rcc$(E) ../
uninstall::
-$(RM) ../q3lcc$(E)
diff --git a/code/unix/Makefile b/code/unix/Makefile
index 3eaa504..46abd59 100644
--- a/code/unix/Makefile
+++ b/code/unix/Makefile
@@ -49,6 +49,10 @@ ifndef DXSDK_DIR
DXSDK_DIR=C:/DXSDK
endif
+ifndef USE_SDL
+USE_SDL=true
+endif
+
#############################################################################
BD=debug$(ARCH)$(GLIBC)
@@ -78,12 +82,8 @@ VERSION=$(shell grep Q3_VERSION ../qcommon/q_shared.h | \
#############################################################################
## Defaults
-USE_SDL=true
VM_PPC=
-# bk010215 - TODO - add all defaults / kill Ryan
-
-
LIB=lib
ifeq ($(PLATFORM),linux)
@@ -110,7 +110,7 @@ ifeq ($(PLATFORM),linux)
BASE_CFLAGS = -pipe -Wall -Wimplicit -Wstrict-prototypes
ifeq ($(strip $(USE_SDL)),true)
- BASE_CFLAGS += -DUSE_SDL=1 $(shell sdl-config --cflags)
+ BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
GL_CFLAGS =
else
GL_CFLAGS = -I/usr/X11R6/include
@@ -352,6 +352,117 @@ ifeq ($(PLATFORM),irix)
else # ifeq IRIX
#############################################################################
+# SETUP AND BUILD -- SunOS
+#############################################################################
+
+ifeq ($(PLATFORM),SunOS)
+
+ GLIBC= #libc is irrelevant
+ CC=gcc
+ CXX=g++
+ COPYDIR="/usr/local/share/games/quake3"
+
+ ifneq (,$(findstring i86pc,$(shell uname -m)))
+ ARCH=i386
+ else #default to sparc
+ ARCH=sparc
+ endif
+
+ ifneq ($(ARCH),i386)
+ ifneq ($(ARCH),sparc)
+ $(error arch $(ARCH) is currently not supported)
+ endif
+ endif
+
+
+ BASE_CFLAGS = -pipe -Wall -Wimplicit -Wstrict-prototypes
+
+ ifeq ($(strip $(USE_SDL)),true)
+ BASE_CFLAGS += -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
+ GL_CFLAGS =
+ else
+ GL_CFLAGS = -I/usr/openwin/include
+ endif
+
+ OPTIMIZE = -O3 -ffast-math -funroll-loops -fomit-frame-pointer \
+ -fno-strict-aliasing
+ BASE_CFLAGS += -DNO_VM_COMPILED
+
+ ifeq ($(ARCH),sparc)
+ OPTIMIZE = -O3 -fomit-frame-pointer -ffast-math -falign-loops=2 \
+ -falign-jumps=2 -falign-functions=2 -fstrength-reduce \
+ -fno-strict-aliasing
+ else
+ ifeq ($(ARCH),i386)
+ OPTIMIZE = -O3 -march=i686 -fomit-frame-pointer -ffast-math \
+ -falign-loops=2 -falign-jumps=2 -falign-functions=2 \
+ -fno-strict-aliasing -fstrength-reduce
+ endif
+ endif
+
+ DEBUG_CFLAGS = $(BASE_CFLAGS) -g -O0
+
+ RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
+
+ SHLIBEXT=so
+ SHLIBCFLAGS=-fPIC
+ SHLIBLDFLAGS=-shared $(LDFLAGS)
+
+ THREAD_LDFLAGS=-lpthread
+ LDFLAGS=-lsocket -lnsl -ldl -lm
+
+ ifeq ($(strip $(USE_SDL)),true)
+ GLLDFLAGS=$(shell sdl-config --libs) -lGLU -lX11 -lXext
+ else
+ GLLDFLAGS=-L/usr/openwin/$(LIB) -lGLU -lX11 -lXext
+ endif
+
+ ifeq ($(ARCH),i386)
+ # linux32 make ...
+ BASE_CFLAGS += -m32
+ LDFLAGS+=-m32
+ endif
+
+ ifeq ($(ARCH),sparc)
+ TARGETS=\
+ $(B)/$(PLATFORM)quake3 \
+ $(B)/$(PLATFORM)q3ded \
+ $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/ui$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/vm/cgame.qvm \
+ $(B)/baseq3/vm/qagame.qvm \
+ $(B)/baseq3/vm/ui.qvm \
+ $(B)/missionpack/vm/qagame.qvm \
+ $(B)/missionpack/vm/cgame.qvm \
+ $(B)/missionpack/vm/ui.qvm
+# $(B)/$(PLATFORM)quake3-smp
+ else
+ TARGETS=\
+ $(B)/$(PLATFORM)quake3 \
+ $(B)/$(PLATFORM)q3ded \
+ $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/ui$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/vm/cgame.qvm \
+ $(B)/baseq3/vm/qagame.qvm \
+ $(B)/baseq3/vm/ui.qvm \
+ $(B)/missionpack/vm/qagame.qvm \
+ $(B)/missionpack/vm/cgame.qvm \
+ $(B)/missionpack/vm/ui.qvm
+# $(B)/$(PLATFORM)quake3-smp
+
+ endif
+
+else # ifeq SunOS
+
+#############################################################################
# SETUP AND BUILD -- GENERIC
#############################################################################
@@ -371,6 +482,7 @@ endif #Linux
endif #mingw32
endif #FreeBSD
endif #IRIX
+endif #SunOS
ifdef DEFAULT_BASEDIR
BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
@@ -699,8 +811,41 @@ else
Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o
Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o
endif
-
endif #Linux-axp
+else
+ifeq ($(PLATFORM),SunOS)
+ Q3POBJ=\
+ $(B)/client/unix_main.o \
+ $(B)/client/unix_net.o \
+ $(B)/client/unix_shared.o \
+ $(B)/client/linux_signals.o \
+ $(B)/client/linux_common.o \
+ $(B)/client/linux_qgl.o \
+ $(B)/client/linux_glimp.o \
+ $(B)/client/linux_snd.o \
+ $(B)/client/sdl_snd.o \
+ $(B)/client/snd_mixa.o \
+ $(B)/client/matha.o \
+
+ Q3POBJ_SMP=\
+ $(B)/client/unix_main.o \
+ $(B)/client/unix_net.o \
+ $(B)/client/unix_shared.o \
+ $(B)/client/linux_signals.o \
+ $(B)/client/linux_common.o \
+ $(B)/client/linux_qgl.o \
+ $(B)/client/linux_glimp_smp.o \
+ $(B)/client/linux_snd.o \
+ $(B)/client/sdl_snd.o \
+ $(B)/client/snd_mixa.o \
+ $(B)/client/matha.o
+
+ ifeq ($(ARCH),i386)
+ Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o
+ Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o
+ endif
+
+endif #SunOS
endif #Linux
endif #mingw32
endif #IRIX
diff --git a/code/unix/linux_glimp.c b/code/unix/linux_glimp.c
index 792677a..cc9aa91 100644
--- a/code/unix/linux_glimp.c
+++ b/code/unix/linux_glimp.c
@@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**
*/
-#if !USE_SDL
+#if !USE_SDL_VIDEO
#include <termios.h>
#include <sys/ioctl.h>
@@ -68,8 +68,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <X11/keysym.h>
#include <X11/cursorfont.h>
+#if !defined(__sun)
#include <X11/extensions/xf86dga.h>
#include <X11/extensions/xf86vmode.h>
+#endif
+
+#if defined(__sun)
+#include <X11/Sunkeysym.h>
+#endif
+
+#ifdef _XF86DGA_H_
+#define HAVE_XF86DGA
+#endif
#define WINDOW_CLASS_NAME "Quake III: Arena"
@@ -121,14 +131,18 @@ cvar_t *r_allowSoftwareGL; // don't abort out if the pixelformat claims softw
cvar_t *r_previousglDriver;
qboolean vidmode_ext = qfalse;
+#ifdef HAVE_XF86DGA
static int vidmode_MajorVersion = 0, vidmode_MinorVersion = 0; // major and minor of XF86VidExtensions
// gamma value of the X display before we start playing with it
static XF86VidModeGamma vidmode_InitialGamma;
+#endif /* HAVE_XF86DGA */
static int win_x, win_y;
+#ifdef HAVE_XF86DGA
static XF86VidModeModeInfo **vidmodes;
+#endif /* HAVE_XF86DGA */
//static int default_dotclock_vidmode; // bk001204 - unused
static int num_vidmodes;
static qboolean vidmode_active = qfalse;
@@ -398,6 +412,7 @@ static void install_grabs(void)
if (in_dgamouse->value)
{
+#ifdef HAVE_XF86DGA
int MajorVersion, MinorVersion;
if (!XF86DGAQueryVersion(dpy, &MajorVersion, &MinorVersion))
@@ -410,6 +425,7 @@ static void install_grabs(void)
XF86DGADirectVideo(dpy, DefaultScreen(dpy), XF86DGADirectMouse);
XWarpPointer(dpy, None, win, 0, 0, 0, 0, 0, 0);
}
+#endif /* HAVE_XF86DGA */
} else
{
mwx = glConfig.vidWidth / 2;
@@ -431,7 +447,9 @@ static void uninstall_grabs(void)
{
if (com_developer->value)
ri.Printf( PRINT_ALL, "DGA Mouse - Disabling DGA DirectVideo\n" );
+#ifdef HAVE_XF86DGA
XF86DGADirectVideo(dpy, DefaultScreen(dpy), 0);
+#endif /* HAVE_XF86DGA */
}
XChangePointerControl(dpy, qtrue, qtrue, mouse_accel_numerator,
@@ -741,6 +759,7 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
{
// NOTE TTimo we get the gamma value from cvar, because we can't work with the s_gammatable
// the API wasn't changed to avoid breaking other OSes
+#ifdef HAVE_XF86DGA
float g = Cvar_Get("r_gamma", "1.0", 0)->value;
XF86VidModeGamma gamma;
assert(glConfig.deviceSupportsGamma);
@@ -748,6 +767,7 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
gamma.green = g;
gamma.blue = g;
XF86VidModeSetGamma(dpy, scrnum, &gamma);
+#endif /* HAVE_XF86DGA */
}
/*
@@ -773,12 +793,14 @@ void GLimp_Shutdown( void )
qglXDestroyContext(dpy, ctx);
if (win)
XDestroyWindow(dpy, win);
+#ifdef HAVE_XF86DGA
if (vidmode_active)
XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[0]);
if (glConfig.deviceSupportsGamma)
{
XF86VidModeSetGamma(dpy, scrnum, &vidmode_InitialGamma);
}
+#endif /* HAVE_XF86DGA */
// NOTE TTimo opening/closing the display should be necessary only once per run
// but it seems QGL_Shutdown gets called in a lot of occasion
// in some cases, this XCloseDisplay is known to raise some X errors
@@ -909,18 +931,23 @@ int GLW_SetMode( const char *drivername, int mode, qboolean fullscreen )
actualHeight = glConfig.vidHeight;
// Get video mode list
+#ifdef HAVE_XF86DGA
if (!XF86VidModeQueryVersion(dpy, &vidmode_MajorVersion, &vidmode_MinorVersion))
{
+#endif /* HAVE_XF86DGA */
vidmode_ext = qfalse;
+#ifdef HAVE_XF86DGA
} else
{
ri.Printf(PRINT_ALL, "Using XFree86-VidModeExtension Version %d.%d\n",
vidmode_MajorVersion, vidmode_MinorVersion);
vidmode_ext = qtrue;
}
+#endif /* HAVE_XF86DGA */
// Check for DGA
dga_MajorVersion = 0, dga_MinorVersion = 0;
+#ifdef HAVE_XF86DGA
if (in_dgamouse->value)
{
if (!XF86DGAQueryVersion(dpy, &dga_MajorVersion, &dga_MinorVersion))
@@ -934,7 +961,9 @@ int GLW_SetMode( const char *drivername, int mode, qboolean fullscreen )
dga_MajorVersion, dga_MinorVersion);
}
}
+#endif /* HAVE_XF86DGA */
+#ifdef HAVE_XF86DGA
if (vidmode_ext)
{
int best_fit, best_dist, dist, x, y;
@@ -988,6 +1017,7 @@ int GLW_SetMode( const char *drivername, int mode, qboolean fullscreen )
ri.Printf(PRINT_ALL, "XFree86-VidModeExtension: Ignored on non-fullscreen/Voodoo\n");
}
}
+#endif /* HAVE_XF86DGA */
if (!r_colorbits->value)
@@ -1286,6 +1316,7 @@ static void GLW_InitGamma(void)
glConfig.deviceSupportsGamma = qfalse;
+#ifdef HAVE_XF86DGA
if (vidmode_ext)
{
if (vidmode_MajorVersion < GAMMA_MINMAJOR ||
@@ -1297,6 +1328,7 @@ static void GLW_InitGamma(void)
ri.Printf( PRINT_ALL, "XF86 Gamma extension initialized\n");
glConfig.deviceSupportsGamma = qtrue;
}
+#endif /* HAVE_XF86DGA */
}
/*
@@ -1768,10 +1800,10 @@ void Sys_SendKeyEvents (void) {
// bk010216 - added stubs for non-Linux UNIXes here
// FIXME - use NO_JOYSTICK or something else generic
-#if defined( __FreeBSD__ ) // rb010123
+#if (defined( __FreeBSD__ ) || defined( __sun)) // rb010123
void IN_StartupJoystick( void ) {}
void IN_JoyMove( void ) {}
#endif
-#endif // !USE_SDL
+#endif // !USE_SDL_VIDEO
diff --git a/code/unix/linux_joystick.c b/code/unix/linux_joystick.c
index 13a866c..1ab114b 100644
--- a/code/unix/linux_joystick.c
+++ b/code/unix/linux_joystick.c
@@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**
*/
-#if !USE_SDL
+#if !USE_SDL_VIDEO
#include <linux/joystick.h>
#include <sys/types.h>
@@ -206,6 +206,6 @@ void IN_JoyMove( void )
old_axes = axes;
}
-#endif // !USE_SDL
+#endif // !USE_SDL_VIDEO
diff --git a/code/unix/linux_snd.c b/code/unix/linux_snd.c
index 284be10..5193769 100644
--- a/code/unix/linux_snd.c
+++ b/code/unix/linux_snd.c
@@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
-#if !USE_SDL
+#if !USE_SDL_SOUND
#include <unistd.h>
#include <fcntl.h>
@@ -290,5 +290,5 @@ void SNDDMA_BeginPainting (void)
{
}
-#endif // !USE_SDL
+#endif // !USE_SDL_SOUND
diff --git a/code/unix/sdl_glimp.c b/code/unix/sdl_glimp.c
index cac10ed..dfc6724 100644
--- a/code/unix/sdl_glimp.c
+++ b/code/unix/sdl_glimp.c
@@ -1,5 +1,5 @@
-#if USE_SDL
+#if USE_SDL_VIDEO
/*
* SDL implementation for Quake 3: Arena's GPL source release.
@@ -1406,7 +1406,7 @@ void IN_JoyMove( void )
stick_state.oldaxes = axes;
}
-#endif // USE_SDL
+#endif // USE_SDL_VIDEO
// end of linux_glimp_sdl.c ...
diff --git a/code/unix/sdl_snd.c b/code/unix/sdl_snd.c
index 73ae4d6..3caf85a 100644
--- a/code/unix/sdl_snd.c
+++ b/code/unix/sdl_snd.c
@@ -1,4 +1,4 @@
-#if USE_SDL
+#if USE_SDL_SOUND
/*
* SDL implementation for Quake 3: Arena's GPL source release.
@@ -298,7 +298,7 @@ void SNDDMA_BeginPainting (void)
SDL_LockAudio();
}
-#endif // USE_SDL
+#endif // USE_SDL_SOUND
// end of linux_snd_sdl.c ...
diff --git a/code/unix/unix_glw.h b/code/unix/unix_glw.h
index 2dda4ef..1e88c13 100644
--- a/code/unix/unix_glw.h
+++ b/code/unix/unix_glw.h
@@ -19,8 +19,8 @@ along with Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
-#if !( defined __linux__ || defined __FreeBSD__ )
-#error You should include this file only on Linux/FreeBSD platforms
+#if !( defined __linux__ || defined __FreeBSD__ || defined __sun)
+#error You should include this file only on Linux/FreeBSD/Solaris platforms
#endif
#ifndef __GLW_LINUX_H__
diff --git a/code/unix/unix_main.c b/code/unix/unix_main.c
index 7d913cc..7ee5620 100644
--- a/code/unix/unix_main.c
+++ b/code/unix/unix_main.c
@@ -47,6 +47,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <fpu_control.h> // bk001213 - force dumps on divide by zero
#endif
+#if defined(__sun)
+ #include <sys/file.h>
+#endif
+
// FIXME TTimo should we gard this? most *nix system should comply?
#include <termios.h>
@@ -391,7 +395,7 @@ void Sys_Init(void)
#else
Cvar_Set( "arch", "freebsd unknown" );
#endif
-#elif defined __sun__
+#elif defined(__sun)
#if defined __i386__
Cvar_Set( "arch", "solaris x86" );
#elif defined __sparc__
@@ -801,6 +805,8 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
snprintf (fname, sizeof(fname), "%shppa.so", name);
#elif defined __sh__
snprintf (fname, sizeof(fname), "%ssh.so", name);
+#elif defined __sparc__
+ snprintf (fname, sizeof(fname), "%ssparc.so", name);
#else
#error Unknown arch
#endif
diff --git a/code/unix/unix_net.c b/code/unix/unix_net.c
index c0fd124..b0bad36 100644
--- a/code/unix/unix_net.c
+++ b/code/unix/unix_net.c
@@ -45,6 +45,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#import <net/if_dl.h> // for 'struct sockaddr_dl'
#endif
+#ifdef __sun
+#include <sys/filio.h>
+#endif
+
static cvar_t *noudp;
netadr_t net_local_adr;
diff --git a/code/unix/unix_shared.c b/code/unix/unix_shared.c
index dca610f..be39955 100644
--- a/code/unix/unix_shared.c
+++ b/code/unix/unix_shared.c
@@ -76,7 +76,7 @@ int Sys_Milliseconds (void)
return curtime;
}
-#if (defined(__linux__) || defined(__FreeBSD__)) && !defined(DEDICATED)
+#if (defined(__linux__) || defined(__FreeBSD__) || defined(__sun)) && !defined(DEDICATED)
/*
================
Sys_XTimeToSysTime