* Beginnings of Solaris support from Vincent S. Cojot

* Note this patch also splits USE_SDL into USE_SDL_VIDEO and USE_SDL_AUDIO
This commit is contained in:
Tim Angus 2005-10-29 22:05:20 +00:00
parent 58512aff09
commit c5bdb034f2
17 changed files with 320 additions and 57 deletions

View file

@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "q_shared.h" #include "q_shared.h"
#include "qcommon.h" #include "qcommon.h"
#include <setjmp.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> #include <netinet/in.h>
#else #else
#include <winsock.h> #include <winsock.h>

View file

@ -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 // 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 #define id386 1
#else #else
#define id386 0 #define id386 0
@ -355,6 +355,52 @@ static float LittleFloat (const float l) { return FloatSwap(&l); }
#endif #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; typedef unsigned char byte;

View file

@ -57,6 +57,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <GL/fxmesa.h> #include <GL/fxmesa.h>
#endif #endif
#elif defined( __sun )
#include <GL/gl.h>
#include <GL/glx.h>
#else #else
#include <gl.h> #include <gl.h>
@ -76,6 +80,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/* /*
** multitexture extension definitions ** multitexture extension definitions
*/ */
#if !defined(__sun)
#define GL_ACTIVE_TEXTURE_ARB 0x84E0 #define GL_ACTIVE_TEXTURE_ARB 0x84E0
#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 #define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
#define GL_MAX_ACTIVE_TEXTURES_ARB 0x84E2 #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_TEXTURE1_ARB 0x84C1
#define GL_TEXTURE2_ARB 0x84C2 #define GL_TEXTURE2_ARB 0x84C2
#define GL_TEXTURE3_ARB 0x84C3 #define GL_TEXTURE3_ARB 0x84C3
#else
#define GL_MAX_ACTIVE_TEXTURES_ARB 0x84E2
#endif /* defined(__sun) */
// NOTE: some Linux platforms would need those prototypes // 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 * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); 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* // 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" #include "qgl_linked.h"
@ -539,7 +547,7 @@ extern BOOL ( WINAPI * qwglSwapIntervalEXT)( int interval );
#endif // _WIN32 #endif // _WIN32
#if ( (defined __linux__ ) || (defined __FreeBSD__ ) ) // rb010123 #if ( (defined __linux__ ) || (defined __FreeBSD__ ) || (defined __sun) ) // rb010123
//FX Mesa Functions //FX Mesa Functions
// bk001129 - from cvs1.17 (mkv) // 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 (*qglXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, GLuint mask );
extern void (*qglXSwapBuffers)( Display *dpy, GLXDrawable drawable ); extern void (*qglXSwapBuffers)( Display *dpy, GLXDrawable drawable );
#endif // __linux__ || __FreeBSD__ // rb010123 #endif // __linux__ || __FreeBSD__ || __sun // rb010123
#endif // _WIN32 && __linux__ #endif // _WIN32 && __linux__

View file

@ -7,6 +7,12 @@ else
BINEXT= BINEXT=
endif endif
ifeq ($(PLATFORM),SunOS)
INSTALL=ginstall
else
INSTALL=install
endif
CC=gcc CC=gcc
Q3ASM_CFLAGS=-O2 -Wall -Werror -fno-strict-aliasing Q3ASM_CFLAGS=-O2 -Wall -Werror -fno-strict-aliasing
@ -19,7 +25,7 @@ clean:
rm -f q3asm *~ *.o rm -f q3asm *~ *.o
install: default install: default
install -s -m 0755 q3asm$(BINEXT) ../ $(INSTALL) -s -m 0755 q3asm$(BINEXT) ../
uninstall: uninstall:
rm -f ../q3asm$(BINEXT) rm -f ../q3asm$(BINEXT)

View file

@ -1,48 +1,55 @@
/* SPARCs running Solaris 2.5.1 w/GCC tools /* Solaris 10 sparc */
at CS Dept., Princeton University */
#include <string.h> #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 #ifndef LCCDIR
#define LCCDIR "/usr/local/lib/lcc/" #define LCCDIR ""
#endif #endif
#ifndef GCCDIR #ifndef GCCDIR
#define GCCDIR "/usr/local/gnu/bin/" #define GCCDIR "/usr/sfw/bin/"
#endif #endif
#ifndef GCCLIB #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 #endif
#define BINEXT ""
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 }; char *suffixes[] = { ".c", ".i", ".asm", ".s", ".o", ".out", 0 };
char inputs[256] = ""; char inputs[256] = "";
char *cpp[] = { LCCDIR "cpp", char *cpp[] = { LCCDIR "q3cpp" BINEXT,
"-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix", "-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix", "-D__sun",
"$1", "$2", "$3", 0 }; "$1", "$2", "$3", 0 };
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include", char *include[] = { "-I" LCCDIR "include", "-I" LCCDIR "gcc/include",
"-I" GCCLIB "include", "-I/usr/include", 0 }; "-I" SYSTEM "include", "-I/usr/include", 0 };
char *com[] = { LCCDIR "rcc", "-target=sparc/solaris", /* char *com[] = { LCCDIR "q3rcc", "-target=bytecode", "$1", "$2", "$3", 0 }; */
"$1", "$2", "$3", 0 }; char *com[] = { LCCDIR "q3rcc", "-target=sparc/solaris", "$1", "$2", "$3", 0 };
char *as[] = { GCCDIR "as", "-f", "-o", "$3", "$1", "$2", 0 }; char *as[] = { "/usr/ccs/bin/as", "-o", "$3", "$1", "$2", 0 };
char *ld[] = { GCCDIR "ld", "-o", "$3", "$1", char *ld[] = { "/usr/ccs/bin/ld", "-o", "$3", "$1",
GCCLIB "crti.o", GCCLIB "crt1.o", GCCLIB "crti.o", GCCLIB "crt1.o",
GCCLIB "crtbegin.o", "$2", "", "", "-L" LCCDIR, "-llcc", GCCLIB "crtbegin.o", "$2", "", "", "-L" LCCDIR, "-llcc",
"-L" GCCLIB, "-lgcc", "-lm", "-lc", "", "-L" GCCLIB, "-lgcc", "-lm", "-lc", "",
GCCLIB "crtend.o", GCCLIB "crtn.o", 0 }; GCCLIB "crtend.o", GCCLIB "crtn.o", 0 };
extern char *concat(char *, char *); extern char *concat(char *, char *);
int option(char *arg) { int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) { 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")); include[0] = concat("-I", concat(&arg[8], "/include"));
ld[10] = concat("-L", &arg[8]); ld[10] = concat("-L", &arg[8]);
com[0] = concat(&arg[8], "/rcc"); 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, "-g") == 0)
; ;
else if (strcmp(arg, "-pg") == 0) { else if (strcmp(arg, "-b") == 0)
ld[8] = GCCLIB "gmon.o";
} else if (strcmp(arg, "-b") == 0)
; ;
else else
return 0; return 0;

View file

@ -48,7 +48,9 @@ extern char *stringf(const char *, ...);
extern int suffix(char *, char *[], int); extern int suffix(char *, char *[], int);
extern char *tempname(char *); extern char *tempname(char *);
#ifndef __sun
extern int getpid(void); extern int getpid(void);
#endif
extern char *cpp[], *include[], *com[], *as[],*ld[], inputs[], *suffixes[]; extern char *cpp[], *include[], *com[], *as[],*ld[], inputs[], *suffixes[];
extern int option(char *); extern int option(char *);
@ -95,15 +97,14 @@ void AddLCCDirToPath( const char *lccBinary )
if( p ) if( p )
{ {
*p = '\0'; *p = '\0';
strncpy( path, "PATH=", 4096 );
strncat( path, getenv( "PATH" ), 4096 );
#ifdef _WIN32 #ifdef _WIN32
strncpy( path, "PATH=", 4096 );
strncat( path, ";", 4096 ); strncat( path, ";", 4096 );
strncat( path, basepath, 4096 ); strncat( path, basepath, 4096 );
_putenv( path ); _putenv( path );
#else #else
strncat( path, ":", 4096 ); /* Ugly workaround against execvp problem/limitation on Solaris 10 */
strncat( path, basepath, 4096 ); snprintf( path, 4096, "PATH=%s:%s", basepath, getenv( "PATH" ) );
putenv( path ); putenv( path );
#endif #endif
} }
@ -252,7 +253,9 @@ char *basepath(char *name) {
#include <process.h> #include <process.h>
#else #else
#define _P_WAIT 0 #define _P_WAIT 0
#ifndef __sun
extern int fork(void); extern int fork(void);
#endif
extern int wait(int *); extern int wait(int *);
static int _spawnvp(int mode, const char *cmdname, char *argv[]) { static int _spawnvp(int mode, const char *cmdname, char *argv[]) {

View file

@ -25,6 +25,12 @@ BUILDDIR=build
TSTDIR=$(BUILDDIR)/$(TARGET)/tst TSTDIR=$(BUILDDIR)/$(TARGET)/tst
BD=$(BUILDDIR)/ BD=$(BUILDDIR)/
T=$(TSTDIR)/ 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 $ # $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 $(RM) $(T)yacc$(E) $(T)yacc.s $(T)yacc.2 $(T)yacc.1
install:: all install:: all
install -s -m 0755 $(BD)q3lcc$(E) ../ $(INSTALL) -s -m 0755 $(BD)q3lcc$(E) ../
install -s -m 0755 $(BD)q3cpp$(E) ../ $(INSTALL) -s -m 0755 $(BD)q3cpp$(E) ../
install -s -m 0755 $(BD)q3rcc$(E) ../ $(INSTALL) -s -m 0755 $(BD)q3rcc$(E) ../
uninstall:: uninstall::
-$(RM) ../q3lcc$(E) -$(RM) ../q3lcc$(E)

View file

@ -49,6 +49,10 @@ ifndef DXSDK_DIR
DXSDK_DIR=C:/DXSDK DXSDK_DIR=C:/DXSDK
endif endif
ifndef USE_SDL
USE_SDL=true
endif
############################################################################# #############################################################################
BD=debug$(ARCH)$(GLIBC) BD=debug$(ARCH)$(GLIBC)
@ -78,12 +82,8 @@ VERSION=$(shell grep Q3_VERSION ../qcommon/q_shared.h | \
############################################################################# #############################################################################
## Defaults ## Defaults
USE_SDL=true
VM_PPC= VM_PPC=
# bk010215 - TODO - add all defaults / kill Ryan
LIB=lib LIB=lib
ifeq ($(PLATFORM),linux) ifeq ($(PLATFORM),linux)
@ -110,7 +110,7 @@ ifeq ($(PLATFORM),linux)
BASE_CFLAGS = -pipe -Wall -Wimplicit -Wstrict-prototypes BASE_CFLAGS = -pipe -Wall -Wimplicit -Wstrict-prototypes
ifeq ($(strip $(USE_SDL)),true) 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 = GL_CFLAGS =
else else
GL_CFLAGS = -I/usr/X11R6/include GL_CFLAGS = -I/usr/X11R6/include
@ -351,6 +351,117 @@ ifeq ($(PLATFORM),irix)
else # ifeq 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 # SETUP AND BUILD -- GENERIC
############################################################################# #############################################################################
@ -371,6 +482,7 @@ endif #Linux
endif #mingw32 endif #mingw32
endif #FreeBSD endif #FreeBSD
endif #IRIX endif #IRIX
endif #SunOS
ifdef DEFAULT_BASEDIR ifdef DEFAULT_BASEDIR
BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\" BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
@ -699,8 +811,41 @@ else
Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o
Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o
endif endif
endif #Linux-axp 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 #Linux
endif #mingw32 endif #mingw32
endif #IRIX endif #IRIX

View file

@ -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 <termios.h>
#include <sys/ioctl.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/keysym.h>
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
#if !defined(__sun)
#include <X11/extensions/xf86dga.h> #include <X11/extensions/xf86dga.h>
#include <X11/extensions/xf86vmode.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" #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; cvar_t *r_previousglDriver;
qboolean vidmode_ext = qfalse; qboolean vidmode_ext = qfalse;
#ifdef HAVE_XF86DGA
static int vidmode_MajorVersion = 0, vidmode_MinorVersion = 0; // major and minor of XF86VidExtensions 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 // gamma value of the X display before we start playing with it
static XF86VidModeGamma vidmode_InitialGamma; static XF86VidModeGamma vidmode_InitialGamma;
#endif /* HAVE_XF86DGA */
static int win_x, win_y; static int win_x, win_y;
#ifdef HAVE_XF86DGA
static XF86VidModeModeInfo **vidmodes; static XF86VidModeModeInfo **vidmodes;
#endif /* HAVE_XF86DGA */
//static int default_dotclock_vidmode; // bk001204 - unused //static int default_dotclock_vidmode; // bk001204 - unused
static int num_vidmodes; static int num_vidmodes;
static qboolean vidmode_active = qfalse; static qboolean vidmode_active = qfalse;
@ -398,6 +412,7 @@ static void install_grabs(void)
if (in_dgamouse->value) if (in_dgamouse->value)
{ {
#ifdef HAVE_XF86DGA
int MajorVersion, MinorVersion; int MajorVersion, MinorVersion;
if (!XF86DGAQueryVersion(dpy, &MajorVersion, &MinorVersion)) if (!XF86DGAQueryVersion(dpy, &MajorVersion, &MinorVersion))
@ -410,6 +425,7 @@ static void install_grabs(void)
XF86DGADirectVideo(dpy, DefaultScreen(dpy), XF86DGADirectMouse); XF86DGADirectVideo(dpy, DefaultScreen(dpy), XF86DGADirectMouse);
XWarpPointer(dpy, None, win, 0, 0, 0, 0, 0, 0); XWarpPointer(dpy, None, win, 0, 0, 0, 0, 0, 0);
} }
#endif /* HAVE_XF86DGA */
} else } else
{ {
mwx = glConfig.vidWidth / 2; mwx = glConfig.vidWidth / 2;
@ -431,7 +447,9 @@ static void uninstall_grabs(void)
{ {
if (com_developer->value) if (com_developer->value)
ri.Printf( PRINT_ALL, "DGA Mouse - Disabling DGA DirectVideo\n" ); ri.Printf( PRINT_ALL, "DGA Mouse - Disabling DGA DirectVideo\n" );
#ifdef HAVE_XF86DGA
XF86DGADirectVideo(dpy, DefaultScreen(dpy), 0); XF86DGADirectVideo(dpy, DefaultScreen(dpy), 0);
#endif /* HAVE_XF86DGA */
} }
XChangePointerControl(dpy, qtrue, qtrue, mouse_accel_numerator, 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 // 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 // the API wasn't changed to avoid breaking other OSes
#ifdef HAVE_XF86DGA
float g = Cvar_Get("r_gamma", "1.0", 0)->value; float g = Cvar_Get("r_gamma", "1.0", 0)->value;
XF86VidModeGamma gamma; XF86VidModeGamma gamma;
assert(glConfig.deviceSupportsGamma); assert(glConfig.deviceSupportsGamma);
@ -748,6 +767,7 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
gamma.green = g; gamma.green = g;
gamma.blue = g; gamma.blue = g;
XF86VidModeSetGamma(dpy, scrnum, &gamma); XF86VidModeSetGamma(dpy, scrnum, &gamma);
#endif /* HAVE_XF86DGA */
} }
/* /*
@ -773,12 +793,14 @@ void GLimp_Shutdown( void )
qglXDestroyContext(dpy, ctx); qglXDestroyContext(dpy, ctx);
if (win) if (win)
XDestroyWindow(dpy, win); XDestroyWindow(dpy, win);
#ifdef HAVE_XF86DGA
if (vidmode_active) if (vidmode_active)
XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[0]); XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[0]);
if (glConfig.deviceSupportsGamma) if (glConfig.deviceSupportsGamma)
{ {
XF86VidModeSetGamma(dpy, scrnum, &vidmode_InitialGamma); XF86VidModeSetGamma(dpy, scrnum, &vidmode_InitialGamma);
} }
#endif /* HAVE_XF86DGA */
// NOTE TTimo opening/closing the display should be necessary only once per run // 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 // but it seems QGL_Shutdown gets called in a lot of occasion
// in some cases, this XCloseDisplay is known to raise some X errors // 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; actualHeight = glConfig.vidHeight;
// Get video mode list // Get video mode list
#ifdef HAVE_XF86DGA
if (!XF86VidModeQueryVersion(dpy, &vidmode_MajorVersion, &vidmode_MinorVersion)) if (!XF86VidModeQueryVersion(dpy, &vidmode_MajorVersion, &vidmode_MinorVersion))
{ {
#endif /* HAVE_XF86DGA */
vidmode_ext = qfalse; vidmode_ext = qfalse;
#ifdef HAVE_XF86DGA
} else } else
{ {
ri.Printf(PRINT_ALL, "Using XFree86-VidModeExtension Version %d.%d\n", ri.Printf(PRINT_ALL, "Using XFree86-VidModeExtension Version %d.%d\n",
vidmode_MajorVersion, vidmode_MinorVersion); vidmode_MajorVersion, vidmode_MinorVersion);
vidmode_ext = qtrue; vidmode_ext = qtrue;
} }
#endif /* HAVE_XF86DGA */
// Check for DGA // Check for DGA
dga_MajorVersion = 0, dga_MinorVersion = 0; dga_MajorVersion = 0, dga_MinorVersion = 0;
#ifdef HAVE_XF86DGA
if (in_dgamouse->value) if (in_dgamouse->value)
{ {
if (!XF86DGAQueryVersion(dpy, &dga_MajorVersion, &dga_MinorVersion)) 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); dga_MajorVersion, dga_MinorVersion);
} }
} }
#endif /* HAVE_XF86DGA */
#ifdef HAVE_XF86DGA
if (vidmode_ext) if (vidmode_ext)
{ {
int best_fit, best_dist, dist, x, y; 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"); ri.Printf(PRINT_ALL, "XFree86-VidModeExtension: Ignored on non-fullscreen/Voodoo\n");
} }
} }
#endif /* HAVE_XF86DGA */
if (!r_colorbits->value) if (!r_colorbits->value)
@ -1286,6 +1316,7 @@ static void GLW_InitGamma(void)
glConfig.deviceSupportsGamma = qfalse; glConfig.deviceSupportsGamma = qfalse;
#ifdef HAVE_XF86DGA
if (vidmode_ext) if (vidmode_ext)
{ {
if (vidmode_MajorVersion < GAMMA_MINMAJOR || if (vidmode_MajorVersion < GAMMA_MINMAJOR ||
@ -1297,6 +1328,7 @@ static void GLW_InitGamma(void)
ri.Printf( PRINT_ALL, "XF86 Gamma extension initialized\n"); ri.Printf( PRINT_ALL, "XF86 Gamma extension initialized\n");
glConfig.deviceSupportsGamma = qtrue; glConfig.deviceSupportsGamma = qtrue;
} }
#endif /* HAVE_XF86DGA */
} }
/* /*
@ -1768,10 +1800,10 @@ void Sys_SendKeyEvents (void) {
// bk010216 - added stubs for non-Linux UNIXes here // bk010216 - added stubs for non-Linux UNIXes here
// FIXME - use NO_JOYSTICK or something else generic // FIXME - use NO_JOYSTICK or something else generic
#if defined( __FreeBSD__ ) // rb010123 #if (defined( __FreeBSD__ ) || defined( __sun)) // rb010123
void IN_StartupJoystick( void ) {} void IN_StartupJoystick( void ) {}
void IN_JoyMove( void ) {} void IN_JoyMove( void ) {}
#endif #endif
#endif // !USE_SDL #endif // !USE_SDL_VIDEO

View file

@ -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 <linux/joystick.h>
#include <sys/types.h> #include <sys/types.h>
@ -206,6 +206,6 @@ void IN_JoyMove( void )
old_axes = axes; old_axes = axes;
} }
#endif // !USE_SDL #endif // !USE_SDL_VIDEO

View file

@ -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 <unistd.h>
#include <fcntl.h> #include <fcntl.h>
@ -290,5 +290,5 @@ void SNDDMA_BeginPainting (void)
{ {
} }
#endif // !USE_SDL #endif // !USE_SDL_SOUND

View file

@ -1,5 +1,5 @@
#if USE_SDL #if USE_SDL_VIDEO
/* /*
* SDL implementation for Quake 3: Arena's GPL source release. * SDL implementation for Quake 3: Arena's GPL source release.
@ -1406,7 +1406,7 @@ void IN_JoyMove( void )
stick_state.oldaxes = axes; stick_state.oldaxes = axes;
} }
#endif // USE_SDL #endif // USE_SDL_VIDEO
// end of linux_glimp_sdl.c ... // end of linux_glimp_sdl.c ...

View file

@ -1,4 +1,4 @@
#if USE_SDL #if USE_SDL_SOUND
/* /*
* SDL implementation for Quake 3: Arena's GPL source release. * SDL implementation for Quake 3: Arena's GPL source release.
@ -298,7 +298,7 @@ void SNDDMA_BeginPainting (void)
SDL_LockAudio(); SDL_LockAudio();
} }
#endif // USE_SDL #endif // USE_SDL_SOUND
// end of linux_snd_sdl.c ... // end of linux_snd_sdl.c ...

View file

@ -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 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */
#if !( defined __linux__ || defined __FreeBSD__ ) #if !( defined __linux__ || defined __FreeBSD__ || defined __sun)
#error You should include this file only on Linux/FreeBSD platforms #error You should include this file only on Linux/FreeBSD/Solaris platforms
#endif #endif
#ifndef __GLW_LINUX_H__ #ifndef __GLW_LINUX_H__

View file

@ -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 #include <fpu_control.h> // bk001213 - force dumps on divide by zero
#endif #endif
#if defined(__sun)
#include <sys/file.h>
#endif
// FIXME TTimo should we gard this? most *nix system should comply? // FIXME TTimo should we gard this? most *nix system should comply?
#include <termios.h> #include <termios.h>
@ -391,7 +395,7 @@ void Sys_Init(void)
#else #else
Cvar_Set( "arch", "freebsd unknown" ); Cvar_Set( "arch", "freebsd unknown" );
#endif #endif
#elif defined __sun__ #elif defined(__sun)
#if defined __i386__ #if defined __i386__
Cvar_Set( "arch", "solaris x86" ); Cvar_Set( "arch", "solaris x86" );
#elif defined __sparc__ #elif defined __sparc__
@ -801,6 +805,8 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
snprintf (fname, sizeof(fname), "%shppa.so", name); snprintf (fname, sizeof(fname), "%shppa.so", name);
#elif defined __sh__ #elif defined __sh__
snprintf (fname, sizeof(fname), "%ssh.so", name); snprintf (fname, sizeof(fname), "%ssh.so", name);
#elif defined __sparc__
snprintf (fname, sizeof(fname), "%ssparc.so", name);
#else #else
#error Unknown arch #error Unknown arch
#endif #endif

View file

@ -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' #import <net/if_dl.h> // for 'struct sockaddr_dl'
#endif #endif
#ifdef __sun
#include <sys/filio.h>
#endif
static cvar_t *noudp; static cvar_t *noudp;
netadr_t net_local_adr; netadr_t net_local_adr;

View file

@ -76,7 +76,7 @@ int Sys_Milliseconds (void)
return curtime; return curtime;
} }
#if (defined(__linux__) || defined(__FreeBSD__)) && !defined(DEDICATED) #if (defined(__linux__) || defined(__FreeBSD__) || defined(__sun)) && !defined(DEDICATED)
/* /*
================ ================
Sys_XTimeToSysTime Sys_XTimeToSysTime