the majority of raptor's sgi build patch. I'll look at the last two bits

(server.c and vid_sdl.c) later.
This commit is contained in:
Bill Currie 2002-03-03 06:03:51 +00:00
parent 119731e90e
commit 26d7463be7
16 changed files with 152 additions and 103 deletions

View file

@ -133,7 +133,7 @@ AC_HEADER_STDC
AC_HEADER_MAJOR
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(
alsa/asoundlib.h \
alloca.h alsa/asoundlib.h \
arpa/inet.h asm/io.h assert.h conio.h ctype.h ddraw.h dinput.h \
direct.h dirent.h dlfcn.h dmedia/audio.h dmedia/cdaudio.h dpmi.h \
dsound.h errno.h execinfo.h fcntl.h io.h libc.h limits.h linux/cdrom.h \

View file

@ -56,12 +56,12 @@
#endif
/* These may be underscored... */
#if defined(HAVE__SNPRINTF)
#if defined(HAVE__SNPRINTF) && !defined(HAVE_SNPRINTF)
# undef snprintf
# define snprintf Q_snprintfz
# define need_qstring_h
#endif
#if defined(HAVE__VSNPRINTF)
#if defined(HAVE__VSNPRINTF) && !defined(HAVE_VSNPRINTF)
# undef vsnprintf
# define vsnprintf Q_vsnprintfz
# define need_qstring_h

View file

@ -33,14 +33,26 @@ static const char rcsid[] =
#endif
#include <errno.h>
#include <dmedia/cdaudio.h>
#include <sys/types.h>
#include <dmedia/cdaudio.h>
#include "QF/cdaudio.h"
#include "QF/cmd.h"
#include "QF/qargs.h"
#include "QF/sound.h"
#include "QF/sys.h"
#include "QF/plugin.h"
#include "compat.h"
#include "QF/cvar.h"
static plugin_t plugin_info;
static plugin_data_t plugin_info_data;
static plugin_funcs_t plugin_info_funcs;
static general_data_t plugin_info_general_data;
static general_funcs_t plugin_info_general_funcs;
static cd_funcs_t plugin_info_cd_funcs;
static qboolean initialized = false;
static qboolean enabled = true;
@ -53,19 +65,20 @@ static char cd_dev[64] = "/dev/cdrom";
static CDPLAYER *cdp = NULL;
void I_SGI_Stop (void);
static void
pCDAudio_Eject (void)
I_SGI_Eject (void)
{
if (cdp == NULL || !enabled)
return; // no cd init'd
if (CDeject (cdp) == 0)
Sys_DPrintf ("CDAudio_Eject: CDeject failed\n");
Sys_DPrintf ("I_SGI_Eject: CDeject failed\n");
}
static int
pCDAudio_GetState (void)
I_SGI_GetState (void)
{
CDSTATUS cds;
@ -81,7 +94,7 @@ pCDAudio_GetState (void)
}
static int
pCDAudio_MaxTrack (void)
I_SGI_MaxTrack (void)
{
CDSTATUS cds;
@ -89,7 +102,7 @@ pCDAudio_MaxTrack (void)
return -1; // no cd init'd
if (CDgetstatus (cdp, &cds) == 0) {
Sys_DPrintf ("CDAudio_MaxTrack: CDgetstatus failed\n");
Sys_DPrintf ("I_SGI_MaxTrack: CDgetstatus failed\n");
return -1;
}
@ -97,9 +110,9 @@ pCDAudio_MaxTrack (void)
}
void
pCDAudio_Pause (void)
I_SGI_Pause (void)
{
if (cdp == NULL || !enabled || CDAudio_GetState () != CD_PLAYING)
if (cdp == NULL || !enabled || I_SGI_GetState () != CD_PLAYING)
return;
if (CDtogglepause (cdp) == 0)
@ -107,15 +120,15 @@ pCDAudio_Pause (void)
}
void
pCDAudio_Play (int track, qboolean looping)
I_SGI_Play (int track, qboolean looping)
{
int maxtrack = CDAudio_MaxTrack ();
int maxtrack = I_SGI_MaxTrack ();
if (!initialized || !enabled)
return;
/* cd == audio cd? */
if (CDAudio_GetState () != CD_READY) {
if (I_SGI_GetState () != CD_READY) {
Sys_Printf ("CDAudio_Play: CD in player not an audio CD.\n");
return;
}
@ -133,7 +146,7 @@ pCDAudio_Play (int track, qboolean looping)
track = remap[track];
if (track < 1 || track > maxtrack) {
CDAudio_Stop ();
I_SGI_Stop ();
return;
}
// don't try to play a non-audio track
@ -152,11 +165,11 @@ pCDAudio_Play (int track, qboolean looping)
not audio\n", track); return; }
*/
if (CDAudio_GetState () == CD_PLAYING) {
if (I_SGI_GetState () == CD_PLAYING) {
if (playTrack == track)
return;
CDAudio_Stop ();
I_SGI_Stop ();
}
if (CDplaytrack (cdp, track, cdvolume == 0.0 ? 0 : 1) == 0) {
@ -169,9 +182,9 @@ pCDAudio_Play (int track, qboolean looping)
}
void
pCDAudio_Resume (void)
I_SGI_Resume (void)
{
if (cdp == NULL || !enabled || CDAudio_GetState () != CD_PAUSED)
if (cdp == NULL || !enabled || I_SGI_GetState () != CD_PAUSED)
return;
if (CDtogglepause (cdp) == 0)
@ -179,29 +192,29 @@ pCDAudio_Resume (void)
}
void
pCDAudio_Shutdown (void)
I_SGI_Shutdown (void)
{
if (!initialized)
return;
CDAudio_Stop ();
I_SGI_Stop ();
CDclose (cdp);
cdp = NULL;
initialized = false;
}
void
pCDAudio_Stop (void)
I_SGI_Stop (void)
{
if (cdp == NULL || !enabled || CDAudio_GetState () != CD_PLAYING)
if (cdp == NULL || !enabled || I_SGI_GetState () != CD_PLAYING)
return;
if (CDstop (cdp) == 0)
Sys_DPrintf ("CDAudio_Stop: CDStop failed (%d)\n", errno);
Sys_DPrintf ("I_SGI_Stop: CDStop failed (%d)\n", errno);
}
void
pCDAudio_Update (void)
I_SGI_Update (void)
{
if (!initialized || !enabled)
return;
@ -218,15 +231,15 @@ pCDAudio_Update (void)
}
}
if (CDAudio_GetState () != CD_PLAYING &&
CDAudio_GetState () != CD_PAUSED && playLooping)
if (I_SGI_GetState () != CD_PLAYING &&
I_SGI_GetState () != CD_PAUSED && playLooping)
CDAudio_Play (playTrack, true);
}
static void
pCD_f (void)
I_SGI_f (void)
{
char *command;
const char *command;
int ret;
int n;
@ -241,14 +254,14 @@ pCD_f (void)
}
if (strequal (command, "off")) {
CDAudio_Stop ();
I_SGI_Stop ();
enabled = false;
return;
}
if (strequal (command, "reset")) {
enabled = true;
CDAudio_Stop ();
I_SGI_Stop ();
for (n = 0; n < 100; n++)
remap[n] = n;
@ -283,7 +296,7 @@ pCD_f (void)
}
if (strequal (command, "stop")) {
CDAudio_Stop ();
I_SGI_Stop ();
return;
}
@ -298,17 +311,17 @@ pCD_f (void)
}
if (strequal (command, "eject")) {
CDAudio_Stop ();
CDAudio_Eject ();
I_SGI_Stop ();
I_SGI_Eject ();
return;
}
if (strequal (command, "info")) {
Sys_Printf ("%u tracks\n", CDAudio_MaxTrack ());
if (CDAudio_GetState () == CD_PLAYING)
Sys_Printf ("%u tracks\n", I_SGI_MaxTrack ());
if (I_SGI_GetState () == CD_PLAYING)
Sys_Printf ("Currently %s track %u\n",
playLooping ? "looping" : "playing", playTrack);
else if (CDAudio_GetState () == CD_PAUSED)
else if (I_SGI_GetState () == CD_PAUSED)
Sys_Printf ("Paused %s track %u\n",
playLooping ? "looping" : "playing", playTrack);
@ -317,13 +330,13 @@ pCD_f (void)
}
}
int
pCDAudio_Init (void)
static void
I_SGI_Init (void)
{
int i;
if (COM_CheckParm ("-nocdaudio"))
return -1;
return ;
if ((i = COM_CheckParm ("-cddev")) != 0 && i < com_argc - 1) {
strncpy (cd_dev, com_argv[i + 1], sizeof (cd_dev));
@ -335,7 +348,7 @@ pCDAudio_Init (void)
if (cdp == NULL) {
Sys_Printf ("CDAudio_Init: open of \"%s\" failed (%i)\n",
cd_dev, errno);
return -1;
return ;
}
for (i = 0; i < 100; i++)
@ -346,5 +359,37 @@ pCDAudio_Init (void)
Sys_Printf ("CD Audio Initialized\n");
return 0;
return ;
}
QFPLUGIN plugin_t *
cd_sgi_PluginInfo (void)
{
plugin_info.type = qfp_cd;
plugin_info.api_version = QFPLUGIN_VERSION;
plugin_info.plugin_version = "0.1";
plugin_info.description = "SGI (CD) Audio output"
"Copyright (C) 2001 contributors of the QuakeForge project\n"
"Please see the file \"AUTHORS\" for a list of contributors\n";
plugin_info.functions = &plugin_info_funcs;
plugin_info.data = &plugin_info_data;
plugin_info_data.general = &plugin_info_general_data;
// plugin_info_data.cd = &plugin_info_cd_data;
plugin_info_data.input = NULL;
plugin_info_funcs.general = &plugin_info_general_funcs;
plugin_info_funcs.cd = &plugin_info_cd_funcs;
plugin_info_funcs.input = NULL;
plugin_info_general_funcs.p_Init = I_SGI_Init;
plugin_info_general_funcs.p_Shutdown = I_SGI_Shutdown;
plugin_info_cd_funcs.pCDAudio_Pause = I_SGI_Pause;
plugin_info_cd_funcs.pCDAudio_Play = I_SGI_Play;
plugin_info_cd_funcs.pCDAudio_Resume = I_SGI_Resume;
plugin_info_cd_funcs.pCDAudio_Update = I_SGI_Update;
plugin_info_cd_funcs.pCD_f = I_SGI_f;
return &plugin_info;
}

View file

@ -32,7 +32,9 @@ static const char rcsid[] =
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <dmedia/audio.h>
#include <stdlib.h>
#include "QF/plugin.h"
#include "QF/qargs.h"
@ -57,8 +59,8 @@ static plugin_data_t plugin_info_data;
static plugin_funcs_t plugin_info_funcs;
static general_data_t plugin_info_general_data;
static general_funcs_t plugin_info_general_funcs;
static sound_data_t plugin_info_sound_data;
static sound_funcs_t plugin_info_sound_funcs;
static snd_output_data_t plugin_info_snd_output_data;
static snd_output_funcs_t plugin_info_snd_output_funcs;
static qboolean
@ -257,6 +259,11 @@ SNDDMA_Init (void)
return 1;
}
static void
SNDDMA_Init_Cvars (void)
{
}
static int
SNDDMA_GetDMAPos (void)
{
@ -333,46 +340,36 @@ SNDDMA_UnblockSound (void)
}
QFPLUGIN plugin_t *
snd_output_sgi_PluginInfo (void) {
plugin_info.type = qfp_sound;
snd_output_sgi_PluginInfo (void)
{
plugin_info.type = qfp_snd_output;
plugin_info.api_version = QFPLUGIN_VERSION;
plugin_info.plugin_version = "0.1";
plugin_info.description = "SGI digital output";
plugin_info.description = "SGI IRIX digital output";
plugin_info.copyright = "Copyright (C) 1996-1997 id Software, Inc.\n"
"Copyright (C) 1999,2000,2001 contributors of the QuakeForge "
"project\n"
"Please see the file \"AUTHORS\" for a list of contributors";
plugin_info.functions = &plugin_info_funcs;
plugin_info.data = &plugin_info_data;
"Copyright (C) 1999,2000,2001 contributors of the QuakeForge "
"project\n"
"Please see the file \"AUTHORS\" for a list of contributors";
plugin_info.functions = &plugin_info_funcs;
plugin_info.data = &plugin_info_data;
plugin_info_data.general = &plugin_info_general_data;
plugin_info_data.input = NULL;
plugin_info_data.sound = &plugin_info_sound_data;
plugin_info_data.general = &plugin_info_general_data;
plugin_info_data.input = NULL;
plugin_info_data.snd_output = &plugin_info_snd_output_data;
plugin_info_funcs.general = &plugin_info_general_funcs;
plugin_info_funcs.input = NULL;
plugin_info_funcs.sound = &plugin_info_sound_funcs;
plugin_info_funcs.general = &plugin_info_general_funcs;
plugin_info_funcs.input = NULL;
plugin_info_funcs.snd_output = &plugin_info_snd_output_funcs;
plugin_info_general_funcs.p_Init = SND_Init;
plugin_info_general_funcs.p_Shutdown = SND_Shutdown;
plugin_info_general_funcs.p_Init = SNDDMA_Init_Cvars;
plugin_info_general_funcs.p_Shutdown = NULL;
plugin_info_snd_output_funcs.pS_O_Init = SNDDMA_Init;
plugin_info_snd_output_funcs.pS_O_Shutdown = SNDDMA_Shutdown;
plugin_info_snd_output_funcs.pS_O_GetDMAPos = SNDDMA_GetDMAPos;
plugin_info_snd_output_funcs.pS_O_Submit = SNDDMA_Submit;
plugin_info_snd_output_funcs.pS_O_BlockSound = SNDDMA_BlockSound;
plugin_info_snd_output_funcs.pS_O_UnblockSound = SNDDMA_UnblockSound;
plugin_info_sound_funcs.pS_AmbientOff = SND_AmbientOff;
plugin_info_sound_funcs.pS_AmbientOn = SND_AmbientOn;
plugin_info_sound_funcs.pS_TouchSound = SND_TouchSound;
plugin_info_sound_funcs.pS_ClearBuffer = SND_ClearBuffer;
plugin_info_sound_funcs.pS_StaticSound = SND_StaticSound;
plugin_info_sound_funcs.pS_StartSound = SND_StartSound;
plugin_info_sound_funcs.pS_StopSound = SND_StopSound;
plugin_info_sound_funcs.pS_PrecacheSound = SND_PrecacheSound;
plugin_info_sound_funcs.pS_ClearPrecache = SND_ClearPrecache;
plugin_info_sound_funcs.pS_Update = SND_Update;
plugin_info_sound_funcs.pS_StopAllSounds = SND_StopAllSounds;
plugin_info_sound_funcs.pS_BeginPrecaching = SND_BeginPrecaching;
plugin_info_sound_funcs.pS_EndPrecaching = SND_EndPrecaching;
plugin_info_sound_funcs.pS_ExtraUpdate = SND_ExtraUpdate;
plugin_info_sound_funcs.pS_LocalSound = SND_LocalSound;
plugin_info_sound_funcs.pS_BlockSound = SND_BlockSound;
plugin_info_sound_funcs.pS_UnblockSound = SND_UnblockSound;
return &plugin_info;
return &plugin_info;
}

View file

@ -130,7 +130,7 @@ GIB_Interpret_Inst (const char *inst)
buffer = malloc (strlen (inst) + 1);
i = 0;
while (isspace (inst[i]))
while (isspace ((unsigned char) inst[i]))
i++;
for (n = 0; i <= strlen (inst); i++) {
@ -158,7 +158,7 @@ GIB_Interpret_Inst (const char *inst)
strncpy (gib_argv[0], buffer3, i);
gib_argv[0][i] = 0;
for (n = 0;; n++) {
for (; isspace (buffer3[i]); i++);
for (; isspace ((int) buffer3[i]); i++);
if (buffer3[i] == 0)
break;
if ((len = GIB_Get_Arg (buffer3 + i)) < 0)

View file

@ -58,7 +58,7 @@ static gib_module_t *gibmodules;
void
GIB_Module_Load (const char *name, VFile *f)
{
char line[1024];
unsigned char line[1024];
int namelen, nameofs;
gib_module_t *newmod;
gib_sub_t *newsub;

View file

@ -40,7 +40,6 @@ static const char rcsid[] =
# include <strings.h>
#endif
#include "compat.h"
#include "QF/model.h"
#include "QF/qendian.h"
#include "QF/skin.h"
@ -51,6 +50,8 @@ static const char rcsid[] =
#include "QF/vid.h"
#include "QF/GL/qf_textures.h"
#include "compat.h"
byte player_8bit_texels[320 * 200];

View file

@ -40,7 +40,6 @@ static const char rcsid[] =
# include <strings.h>
#endif
#include "compat.h"
#include "QF/crc.h"
#include "QF/model.h"
#include "QF/msg.h"
@ -51,6 +50,7 @@ static const char rcsid[] =
#include "d_iface.h"
#include "r_local.h"
#include "compat.h"
/*
ALIAS MODELS

View file

@ -105,7 +105,7 @@ PL_SkipSpace (pldata_t *pl)
while (pl->pos < pl->end) {
char c = pl->ptr[pl->pos];
if (!isspace (c)) {
if (!isspace ((byte) c)) {
if (c == '/' && pl->pos < pl->end - 1) { // check for comments
if (pl->ptr[pl->pos + 1] == '/') {
pl->pos += 2;
@ -178,7 +178,7 @@ PL_ParseQuotedString (pldata_t *pl)
hex = true;
shrink++;
escaped++;
} else if (hex && isxdigit (c)) {
} else if (hex && isxdigit ((byte) c)) {
shrink++;
escaped++;
} else if (c >= '0' && c <= '7') {
@ -235,7 +235,7 @@ PL_ParseQuotedString (pldata_t *pl)
if (escaped == 2 && c == 'x') {
hex = true;
escaped++;
} else if (hex && isxdigit (c)) {
} else if (hex && isxdigit ((byte) c)) {
chars[k] <<= 4;
chars[k] |= char2num (c);
escaped++;
@ -301,7 +301,7 @@ PL_ParseUnquotedString (pldata_t *pl)
char *str;
while (pl->pos < pl->end) {
if (!isalnum (pl->ptr[pl->pos]) && pl->ptr[pl->pos] != '_')
if (!isalnum ((byte) pl->ptr[pl->pos]) && pl->ptr[pl->pos] != '_')
break;
pl->pos++;
}

View file

@ -36,6 +36,9 @@ static const char rcsid[] =
#include "compat.h"
#ifdef IRIX
#define _vsnprintf vsnprintf
#endif
/*
Q_strcasestr
@ -67,7 +70,7 @@ Q_strnlen (const char *s, size_t maxlen)
return i;
}
#ifdef HAVE__VSNPRINTF
#if defined(HAVE__VSNPRINTF) && !defined(HAVE_VSNPRINTF)
size_t
Q_snprintfz (char *dest, size_t size, const char *fmt, ...)
{

View file

@ -50,15 +50,13 @@ static const char rcsid[] =
#include <QF/cvar.h>
#include <QF/console.h>
#include <QF/sys.h>
#include <QF/GL/extensions.h>
#include <QF/GL/funcs.h>
#include <QF/GL/types.h>
#include "r_cvar.h"
// First we need to get all the function pointers declared.
#define QFGL_NEED(ret, name, args) \
ret (GLAPIENTRY * qf##name) args = NULL;
ret (GLAPIENTRY * qf##name) args
#include "QF/GL/qf_funcs_list.h"
#undef QFGL_NEED
@ -124,7 +122,7 @@ GLF_Init (void)
libgl_handle = QFGL_LoadLibrary ();
#define QFGL_NEED(ret, name, args) \
qf##name = QFGL_ProcAddress (libgl_handle, #name, true);
qf##name = QFGL_ProcAddress (libgl_handle, #name, true)
#include "QF/GL/qf_funcs_list.h"
#undef QFGL_NEED

View file

@ -37,8 +37,12 @@ static const char rcsid[] =
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#endif
#include <stdarg.h>
#include <stdlib.h>
#include "QF/cvar.h"
#include "QF/render.h"
@ -52,6 +56,8 @@ static const char rcsid[] =
#include "r_shared.h"
#include "view.h"
#include "compat.h"
#define BOX_WIDTH 2056
/* cube face to sky texture offset conversion */

View file

@ -39,6 +39,9 @@ static const char rcsid[] =
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#endif
#include <ctype.h>
#include <stdlib.h>

View file

@ -31,12 +31,7 @@ static const char rcsid[] =
# include "config.h"
#endif
#include <stdarg.h>
#include "QF/sys.h"
#include "compat.h"
#include "host.h"
#include "QF/qtypes.h"
qboolean

View file

@ -43,6 +43,7 @@ static const char rcsid[] =
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# define INET6
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H

View file

@ -416,9 +416,9 @@ Team_F_Skins (char *args)
{
int totalfb, l;
while(isspace(*args))
while(isspace((byte) *args))
args++;
for (l = 0;args[l] && !isspace(args[l]);l++);
for (l = 0;args[l] && !isspace((byte) args[l]);l++);
if (l == 0) {
totalfb = Skin_FbPercent (0);
@ -453,12 +453,12 @@ Team_ParseChat (const char *string)
if (!(s = strchr(string, ':')))
return;
s++;
while (isspace(*s))
while (isspace((byte) *s))
s++;
for (i = 0; f_replies[i].name; i++) {
if (!strncmp(f_replies[i].name, s, strlen(f_replies[i].name)) && cl_freply->value) {
while (*s && !isspace(*s))
while (*s && !isspace((byte) *s))
s++;
Cbuf_AddText(f_replies[i].func(s));
f_replies[i].lasttime = realtime;