ioctl(cdfile, CDIOCALLOW);
if (ioctl(cdfile, CDIOCEJECT) == -1)
- Con_DPrint("ioctl CDIOCEJECT failed\n");
+ Con_Print("ioctl CDIOCEJECT failed\n");
}
ioctl(cdfile, CDIOCALLOW);
if (ioctl(cdfile, CDIOCCLOSE) == -1)
- Con_DPrint("ioctl CDIOCCLOSE failed\n");
+ Con_Print("ioctl CDIOCCLOSE failed\n");
}
int CDAudio_SysGetAudioDiskInfo (void)
if (ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1)
{
- Con_DPrint("ioctl CDIOREADTOCHEADER failed\n");
+ Con_Print("ioctl CDIOREADTOCHEADER failed\n");
return -1;
}
if (tochdr.starting_track < 1)
{
- Con_DPrint("CDAudio: no music tracks\n");
+ Con_Print("CDAudio: no music tracks\n");
return -1;
}
if (ioctl (cdfile, CDIOCGETVOL, &vol) == -1)
{
- Con_DPrint("ioctl CDIOCGETVOL failed\n");
+ Con_Print("ioctl CDIOCGETVOL failed\n");
return -1.0f;
}
vol.vol[2] = vol.vol[3] = 0;
if (ioctl (cdfile, CDIOCSETVOL, &vol) == -1)
- Con_DPrintf ("ioctl CDIOCSETVOL failed\n");
+ Con_Printf ("ioctl CDIOCSETVOL failed\n");
}
rte.data = &entry;
if (ioctl(cdfile, CDIOREADTOCENTRYS, &rte) == -1)
{
- Con_DPrint("ioctl CDIOREADTOCENTRYS failed\n");
+ Con_Print("ioctl CDIOREADTOCENTRYS failed\n");
return -1;
}
if (entry.control & 4) // if it's a data track
if (ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1)
{
- Con_DPrint("ioctl CDIOCPLAYTRACKS failed\n");
+ Con_Print("ioctl CDIOCPLAYTRACKS failed\n");
return -1;
}
if (ioctl(cdfile, CDIOCRESUME) == -1)
{
- Con_DPrint("ioctl CDIOCRESUME failed\n");
+ Con_Print("ioctl CDIOCRESUME failed\n");
return -1;
}
if (ioctl(cdfile, CDIOCSTOP) == -1)
{
- Con_DPrintf("ioctl CDIOCSTOP failed (%d)\n", errno);
+ Con_Printf("ioctl CDIOCSTOP failed (%d)\n", errno);
return -1;
}
ioctl(cdfile, CDIOCALLOW);
if (ioctl(cdfile, CDIOCPAUSE) == -1)
{
- Con_DPrint("ioctl CDIOCPAUSE failed\n");
+ Con_Print("ioctl CDIOCPAUSE failed\n");
return -1;
}
return -1;
if (ioctl(cdfile, CDIOCRESUME) == -1)
- Con_DPrint("ioctl CDIOCRESUME failed\n");
+ Con_Print("ioctl CDIOCRESUME failed\n");
return 0;
}
if (ioctl(cdfile, CDIOCREADSUBCHANNEL, &subchnl) == -1)
{
- Con_DPrint("ioctl CDIOCREADSUBCHANNEL failed\n");
+ Con_Print("ioctl CDIOCREADSUBCHANNEL failed\n");
cdPlaying = false;
return -1;
}
if ((cdfile = open(cd_dev, O_RDONLY)) < 0)
#endif
{
- Con_DPrintf("CDAudio_SysStartup: open of \"%s\" failed (%i)\n",
+ Con_Printf("CDAudio_SysStartup: open of \"%s\" failed (%i)\n",
cd_dev, errno);
cdfile = -1;
return -1;
return;
if (ioctl(cdfile, CDROMEJECT) == -1)
- Con_DPrint("ioctl CDROMEJECT failed\n");
+ Con_Print("ioctl CDROMEJECT failed\n");
}
return;
if (ioctl(cdfile, CDROMCLOSETRAY) == -1)
- Con_DPrint("ioctl CDROMCLOSETRAY failed\n");
+ Con_Print("ioctl CDROMCLOSETRAY failed\n");
}
int CDAudio_SysGetAudioDiskInfo (void)
if (ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1)
{
- Con_DPrint("ioctl CDROMREADTOCHDR failed\n");
+ Con_Print("ioctl CDROMREADTOCHDR failed\n");
return -1;
}
if (tochdr.cdth_trk0 < 1)
{
- Con_DPrint("CDAudio: no music tracks\n");
+ Con_Print("CDAudio: no music tracks\n");
return -1;
}
if (ioctl (cdfile, CDROMVOLREAD, &vol) == -1)
{
- Con_DPrint("ioctl CDROMVOLREAD failed\n");
+ Con_Print("ioctl CDROMVOLREAD failed\n");
return -1.0f;
}
vol.channel2 = vol.channel3 = 0;
if (ioctl (cdfile, CDROMVOLCTRL, &vol) == -1)
- Con_DPrint("ioctl CDROMVOLCTRL failed\n");
+ Con_Print("ioctl CDROMVOLCTRL failed\n");
}
entry.cdte_format = CDROM_MSF;
if (ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1)
{
- Con_DPrint("ioctl CDROMREADTOCENTRY failed\n");
+ Con_Print("ioctl CDROMREADTOCENTRY failed\n");
return -1;
}
if (entry.cdte_ctrl == CDROM_DATA_TRACK)
if (ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1)
{
- Con_DPrint("ioctl CDROMPLAYTRKIND failed\n");
+ Con_Print("ioctl CDROMPLAYTRKIND failed\n");
return -1;
}
if (ioctl(cdfile, CDROMRESUME) == -1)
{
- Con_DPrint("ioctl CDROMRESUME failed\n");
+ Con_Print("ioctl CDROMRESUME failed\n");
return -1;
}
if (ioctl(cdfile, CDROMSTOP) == -1)
{
- Con_DPrintf("ioctl CDROMSTOP failed (%d)\n", errno);
+ Con_Printf("ioctl CDROMSTOP failed (%d)\n", errno);
return -1;
}
if (ioctl(cdfile, CDROMPAUSE) == -1)
{
- Con_DPrint("ioctl CDROMPAUSE failed\n");
+ Con_Print("ioctl CDROMPAUSE failed\n");
return -1;
}
return -1;
if (ioctl(cdfile, CDROMRESUME) == -1)
- Con_DPrint("ioctl CDROMRESUME failed\n");
+ Con_Print("ioctl CDROMRESUME failed\n");
return 0;
}
subchnl.cdsc_format = CDROM_MSF;
if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1)
{
- Con_DPrint("ioctl CDROMSUBCHNL failed\n");
+ Con_Print("ioctl CDROMSUBCHNL failed\n");
cdPlaying = false;
return -1;
}
{
if ((cdfile = open(cd_dev, O_RDONLY | O_NONBLOCK)) == -1)
{
- Con_DPrintf("CDAudio_SysStartup: open of \"%s\" failed (%i)\n",
+ Con_Printf("CDAudio_SysStartup: open of \"%s\" failed (%i)\n",
cd_dev, errno);
cdfile = -1;
return -1;
if( numdrives == -1 ) // was the CDROM system initialized correctly?
return -1;
- Con_DPrintf( "Found %i cdrom drives.\n", numdrives );
+ Con_Printf( "Found %i cdrom drives.\n", numdrives );
for( i = 0 ; i < numdrives ; i++, cd = NULL ) {
cd = SDL_CDOpen( i );
if( !cd ) {
- Con_DPrintf( "CD drive %i is invalid.\n", i );
+ Con_Printf( "CD drive %i is invalid.\n", i );
continue;
}
if( IsAudioCD() )
break;
else
- Con_DPrintf( "The CD in drive %i is not an audio cd.\n", i );
+ Con_Printf( "The CD in drive %i is not an audio cd.\n", i );
else
- Con_DPrintf( "No CD in drive %i.\n", i );
+ Con_Printf( "No CD in drive %i.\n", i );
SDL_CDClose( cd );
}
track = remap[track];
if (track < 1)
{
- Con_DPrintf("CDAudio: Bad track number %u.\n", track);
+ Con_Printf("CDAudio: Bad track number %u.\n", track);
return;
}
if (looping)
S_SetChannelFlag (faketrack, CHANNELFLAG_FORCELOOP, true);
S_SetChannelFlag (faketrack, CHANNELFLAG_FULLVOLUME, true);
- Con_DPrintf ("Fake CD track %u playing...\n", track);
+ Con_Printf ("Fake CD track %u playing...\n", track);
}
}
if (CDAudio_GetAudioDiskInfo())
{
- Con_DPrint("CDAudio_Init: No CD in player.\n");
+ Con_Print("CDAudio_Init: No CD in player.\n");
cdValid = false;
}
saved_vol = CDAudio_SysGetVolume ();
if (saved_vol < 0.0f)
{
- Con_DPrint ("Can't get initial CD volume\n");
+ Con_Print ("Can't get initial CD volume\n");
saved_vol = 1.0f;
}
else
- Con_DPrintf ("Initial CD volume: %g\n", saved_vol);
+ Con_Printf ("Initial CD volume: %g\n", saved_vol);
initialized = true;
- Con_DPrint("CD Audio Initialized\n");
+ Con_Print("CD Audio Initialized\n");
return 0;
}
DWORD dwReturn;
if ((dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD)NULL)))
- Con_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn);
+ Con_Printf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn);
}
DWORD dwReturn;
if ((dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD)NULL)))
- Con_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn);
+ Con_Printf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn);
}
int CDAudio_SysGetAudioDiskInfo(void)
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms);
if (dwReturn)
{
- Con_DPrint("CDAudio: drive ready test - get status failed\n");
+ Con_Print("CDAudio: drive ready test - get status failed\n");
return -1;
}
if (!mciStatusParms.dwReturn)
{
- Con_DPrint("CDAudio: drive not ready\n");
+ Con_Print("CDAudio: drive not ready\n");
return -1;
}
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms);
if (dwReturn)
{
- Con_DPrint("CDAudio: get tracks - status failed\n");
+ Con_Print("CDAudio: get tracks - status failed\n");
return -1;
}
if (mciStatusParms.dwReturn < 1)
{
- Con_DPrint("CDAudio: no music tracks\n");
+ Con_Print("CDAudio: no music tracks\n");
return -1;
}
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms);
if (dwReturn)
{
- Con_DPrintf("MCI_STATUS failed (%i)\n", dwReturn);
+ Con_Printf("MCI_STATUS failed (%i)\n", dwReturn);
return -1;
}
if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO)
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms);
if (dwReturn)
{
- Con_DPrintf("MCI_STATUS failed (%i)\n", dwReturn);
+ Con_Printf("MCI_STATUS failed (%i)\n", dwReturn);
return -1;
}
dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD)(LPVOID) &mciPlayParms);
if (dwReturn)
{
- Con_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
+ Con_Printf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
return -1;
}
if ((dwReturn = mciSendCommand(wDeviceID, MCI_STOP, 0, (DWORD)NULL)))
{
- Con_DPrintf("MCI_STOP failed (%i)\n", dwReturn);
+ Con_Printf("MCI_STOP failed (%i)\n", dwReturn);
return -1;
}
return 0;
mciGenericParms.dwCallback = (DWORD)mainwindow;
if ((dwReturn = mciSendCommand(wDeviceID, MCI_PAUSE, 0, (DWORD)(LPVOID) &mciGenericParms)))
{
- Con_DPrintf("MCI_PAUSE failed (%i)\n", dwReturn);
+ Con_Printf("MCI_PAUSE failed (%i)\n", dwReturn);
return -1;
}
return 0;
dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (DWORD)(LPVOID) &mciPlayParms);
if (dwReturn)
{
- Con_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
+ Con_Printf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
return -1;
}
return 0;
break;
case MCI_NOTIFY_FAILURE:
- Con_DPrint("MCI_NOTIFY_FAILURE\n");
+ Con_Print("MCI_NOTIFY_FAILURE\n");
CDAudio_Stop ();
cdValid = false;
break;
default:
- Con_DPrintf("Unexpected MM_MCINOTIFY type (%i)\n", wParam);
+ Con_Printf("Unexpected MM_MCINOTIFY type (%i)\n", wParam);
return 1;
}
void CDAudio_SysShutdown (void)
{
if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL))
- Con_DPrint("CDAudio_Shutdown: MCI_CLOSE failed\n");
+ Con_Print("CDAudio_Shutdown: MCI_CLOSE failed\n");
}
return;
}
cl.protocol = i;
- Con_DPrintf("Protocol %i\n", cl.protocol);
+ Con_DPrintf("Server protocol is %i\n", cl.protocol);
// parse maxclients
cl.maxclients = MSG_ReadByte ();
}
}
+/* The translation table between the graphical font and plain ASCII --KB */
+static char qfont_table[256] = {
+ '\0', '#', '#', '#', '#', '.', '#', '#',
+ '#', 9, 10, '#', ' ', 13, '.', '.',
+ '[', ']', '0', '1', '2', '3', '4', '5',
+ '6', '7', '8', '9', '.', '<', '=', '>',
+ ' ', '!', '"', '#', '$', '%', '&', '\'',
+ '(', ')', '*', '+', ',', '-', '.', '/',
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', ':', ';', '<', '=', '>', '?',
+ '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+ 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
+ '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+ 'x', 'y', 'z', '{', '|', '}', '~', '<',
+
+ '<', '=', '>', '#', '#', '.', '#', '#',
+ '#', '#', ' ', '#', ' ', '>', '.', '.',
+ '[', ']', '0', '1', '2', '3', '4', '5',
+ '6', '7', '8', '9', '.', '<', '=', '>',
+ ' ', '!', '"', '#', '$', '%', '&', '\'',
+ '(', ')', '*', '+', ',', '-', '.', '/',
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', ':', ';', '<', '=', '>', '?',
+ '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+ 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
+ '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+ 'x', 'y', 'z', '{', '|', '}', '~', '<'
+};
+
/*
================
Con_Print
-Prints to all appropriate console targets
+Prints to all appropriate console targets, and adds timestamps
================
*/
+extern cvar_t timestamps;
+extern cvar_t timeformat;
+extern qboolean sys_nostdout;
void Con_Print(const char *msg)
{
- // also echo to debugging console
- Sys_Print(msg);
+ static int index = 0;
+ static char line[16384];
- // log all messages to file
- Log_ConPrint (msg);
-
- if (!con_initialized)
- return;
-
- if (cls.state == ca_dedicated)
- return; // no graphics mode
-
- // write it to the scrollable buffer
- Con_PrintToHistory(msg);
+ for (;*msg;msg++)
+ {
+ if (index == 0)
+ {
+ // if this is the beginning of a new line, print timestamp
+ char *timestamp = timestamps.integer ? Sys_TimeString(timeformat.string) : "";
+ // special color codes for chat messages must always come first
+ // for Con_PrintToHistory to work properly
+ if (*msg <= 2)
+ line[index++] = *msg++;
+ // store timestamp
+ for (;*timestamp;index++, timestamp++)
+ if (index < sizeof(line) - 2)
+ line[index] = *timestamp;
+ }
+ // append the character
+ line[index++] = *msg;
+ // if this is a newline character, we have a complete line to print
+ if (*msg == '\n' || index >= 16000)
+ {
+ // terminate the line
+ line[index] = 0;
+ // send to log file
+ Log_ConPrint(line);
+ // send to scrollable buffer
+ if (con_initialized && cls.state != ca_dedicated)
+ Con_PrintToHistory(line);
+ // send to terminal or dedicated server window
+ if (!sys_nostdout)
+ {
+ unsigned char *p;
+ for (p = (unsigned char *) line;*p; p++)
+ *p = qfont_table[*p];
+ Sys_PrintToTerminal(line);
+ }
+ // empty the line buffer
+ index = 0;
+ }
+ }
}
if (!diff)
{
if (!quiet)
- Sys_Printf("FS_FindFile: %s in %s\n",
+ Con_DPrintf("FS_FindFile: %s in %s\n",
pak->files[middle].name, pak->filename);
if (index != NULL)
if (FS_SysFileExists (netpath))
{
if (!quiet)
- Sys_Printf("FS_FindFile: %s\n", netpath);
+ Con_DPrintf("FS_FindFile: %s\n", netpath);
if (index != NULL)
*index = -1;
}
if (!quiet)
- Sys_Printf("FS_FindFile: can't find %s\n", name);
+ Con_DPrintf("FS_FindFile: can't find %s\n", name);
if (index != NULL)
*index = -1;
if (liststart == NULL)
liststart = listcurrent;
if (!quiet)
- Sys_Printf("SearchPackFile: %s : %s\n", pak->filename, temp);
+ Con_DPrintf("SearchPackFile: %s : %s\n", pak->filename, temp);
}
}
// strip off one path element at a time until empty
if (liststart == NULL)
liststart = listcurrent;
if (!quiet)
- Sys_Printf("SearchDirFile: %s\n", temp);
+ Con_DPrintf("SearchDirFile: %s\n", temp);
}
}
}
static void gl_backend_start(void)
{
- Con_DPrint("OpenGL Backend started\n");
+ Con_Print("OpenGL Backend started\n");
if (qglDrawRangeElements != NULL)
{
CHECKGLERROR
CHECKGLERROR
qglGetIntegerv(GL_MAX_ELEMENTS_INDICES, &gl_maxdrawrangeelementsindices);
CHECKGLERROR
- Con_DPrintf("glDrawRangeElements detected (max vertices %i, max indices %i)\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices);
+ Con_Printf("glDrawRangeElements detected (max vertices %i, max indices %i)\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices);
}
backendunits = min(MAX_TEXTUREUNITS, gl_textureunits);
backendunits = 0;
backendactive = false;
- Con_DPrint("OpenGL Backend shutting down\n");
+ Con_Print("OpenGL Backend shutting down\n");
GL_Backend_FreeArrays();
}
}
if (sv_echobprint.integer && cls.state == ca_dedicated)
- Sys_Print(msg);
+ Con_Print(msg);
}
/*
SV_ClientPrint(text);
host_client = save;
- Sys_Print(&text[1]);
+ //Con_Print(&text[1]);
}
PR_ExecuteProgram (pr_global_struct->ClientConnect, "QC function ClientConnect is missing");
if ((Sys_DoubleTime() - host_client->connecttime) <= sv.time)
- Sys_Printf("%s entered the game\n", host_client->name);
+ Con_Printf("%s entered the game\n", host_client->name);
PR_ExecuteProgram (pr_global_struct->PutClientInServer, "QC function PutClientInServer is missing");
}
Con_Printf("Max %i demos in demoloop\n", MAX_DEMOS);
c = MAX_DEMOS;
}
- Con_DPrintf("%i demo(s) in loop\n", c);
+ Con_Printf("%i demo(s) in loop\n", c);
for (i=1 ; i<c+1 ; i++)
strlcpy (cls.demos[i-1], Cmd_Argv(i), sizeof (cls.demos[i-1]));
{
if (in == inend)
{
- Con_DPrintf("Mod_Q1BSP_DecompressVis: input underrun on model \"%s\" (decompressed %i of %i output bytes)\n", loadmodel->name, out - outstart, outend - outstart);
+ Con_Printf("Mod_Q1BSP_DecompressVis: input underrun on model \"%s\" (decompressed %i of %i output bytes)\n", loadmodel->name, out - outstart, outend - outstart);
return;
}
c = *in++;
{
if (in == inend)
{
- Con_DPrintf("Mod_Q1BSP_DecompressVis: input underrun (during zero-run) on model \"%s\" (decompressed %i of %i output bytes)\n", loadmodel->name, out - outstart, outend - outstart);
+ Con_Printf("Mod_Q1BSP_DecompressVis: input underrun (during zero-run) on model \"%s\" (decompressed %i of %i output bytes)\n", loadmodel->name, out - outstart, outend - outstart);
return;
}
for (c = *in++;c > 0;c--)
{
if (out == outend)
{
- Con_DPrintf("Mod_Q1BSP_DecompressVis: output overrun on model \"%s\" (decompressed %i of %i output bytes)\n", loadmodel->name, out - outstart, outend - outstart);
+ Con_Printf("Mod_Q1BSP_DecompressVis: output overrun on model \"%s\" (decompressed %i of %i output bytes)\n", loadmodel->name, out - outstart, outend - outstart);
return;
}
*out++ = 0;
err = snd_pcm_open (&pcm, pcmname, SND_PCM_STREAM_PLAYBACK,
SND_PCM_NONBLOCK);
if (0 > err) {
- Sys_Printf ("Error: audio open error: %s\n", snd_strerror (err));
+ Con_Printf ("Error: audio open error: %s\n", snd_strerror (err));
return 0;
}
- Sys_Printf ("ALSA: Using PCM %s.\n", pcmname);
+ Con_Printf ("ALSA: Using PCM %s.\n", pcmname);
err = snd_pcm_hw_params_any (pcm, hw);
if (0 > err) {
- Sys_Printf ("ALSA: error setting hw_params_any. %s\n",
+ Con_Printf ("ALSA: error setting hw_params_any. %s\n",
snd_strerror (err));
goto error;
}
err = snd_pcm_hw_params_set_access (pcm, hw,
SND_PCM_ACCESS_MMAP_INTERLEAVED);
if (0 > err) {
- Sys_Printf ("ALSA: Failure to set noninterleaved PCM access. %s\n"
+ Con_Printf ("ALSA: Failure to set noninterleaved PCM access. %s\n"
"Note: Interleaved is not supported\n",
snd_strerror (err));
goto error;
SND_PCM_FORMAT_U8))) {
bps = 8;
} else {
- Sys_Printf ("ALSA: no useable formats. %s\n",
+ Con_Printf ("ALSA: no useable formats. %s\n",
snd_strerror (err));
goto error;
}
SND_PCM_FORMAT_U8 :
SND_PCM_FORMAT_S16);
if (0 > err) {
- Sys_Printf ("ALSA: no usable formats. %s\n",
+ Con_Printf ("ALSA: no usable formats. %s\n",
snd_strerror (err));
goto error;
}
break;
default:
- Sys_Printf ("ALSA: desired format not supported\n");
+ Con_Printf ("ALSA: desired format not supported\n");
goto error;
}
1))) {
stereo = 0;
} else {
- Sys_Printf ("ALSA: no usable channels. %s\n",
+ Con_Printf ("ALSA: no usable channels. %s\n",
snd_strerror (err));
goto error;
}
case 1:
err = snd_pcm_hw_params_set_channels (pcm, hw, stereo ? 2 : 1);
if (0 > err) {
- Sys_Printf ("ALSA: no usable channels. %s\n",
+ Con_Printf ("ALSA: no usable channels. %s\n",
snd_strerror (err));
goto error;
}
break;
default:
- Sys_Printf ("ALSA: desired channels not supported\n");
+ Con_Printf ("ALSA: desired channels not supported\n");
goto error;
}
if (0 <= err) {
frag_size = 8 * bps;
} else {
- Sys_Printf ("ALSA: no usable rates. %s\n",
+ Con_Printf ("ALSA: no usable rates. %s\n",
snd_strerror (err));
goto error;
}
case 44100:
err = snd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
if (0 > err) {
- Sys_Printf ("ALSA: desired rate %i not supported. %s\n", rate,
+ Con_Printf ("ALSA: desired rate %i not supported. %s\n", rate,
snd_strerror (err));
goto error;
}
frag_size = 8 * bps * rate / 11025;
break;
default:
- Sys_Printf ("ALSA: desired rate %i not supported.\n", rate);
+ Con_Printf ("ALSA: desired rate %i not supported.\n", rate);
goto error;
}
err = snd_pcm_hw_params_set_period_size_near (pcm, hw, &frag_size, 0);
if (0 > err) {
- Sys_Printf ("ALSA: unable to set period size near %i. %s\n",
+ Con_Printf ("ALSA: unable to set period size near %i. %s\n",
(int) frag_size, snd_strerror (err));
goto error;
}
err = snd_pcm_hw_params (pcm, hw);
if (0 > err) {
- Sys_Printf ("ALSA: unable to install hw params: %s\n",
+ Con_Printf ("ALSA: unable to install hw params: %s\n",
snd_strerror (err));
goto error;
}
err = snd_pcm_sw_params_current (pcm, sw);
if (0 > err) {
- Sys_Printf ("ALSA: unable to determine current sw params. %s\n",
+ Con_Printf ("ALSA: unable to determine current sw params. %s\n",
snd_strerror (err));
goto error;
}
err = snd_pcm_sw_params_set_start_threshold (pcm, sw, ~0U);
if (0 > err) {
- Sys_Printf ("ALSA: unable to set playback threshold. %s\n",
+ Con_Printf ("ALSA: unable to set playback threshold. %s\n",
snd_strerror (err));
goto error;
}
err = snd_pcm_sw_params_set_stop_threshold (pcm, sw, ~0U);
if (0 > err) {
- Sys_Printf ("ALSA: unable to set playback stop threshold. %s\n",
+ Con_Printf ("ALSA: unable to set playback stop threshold. %s\n",
snd_strerror (err));
goto error;
}
err = snd_pcm_sw_params (pcm, sw);
if (0 > err) {
- Sys_Printf ("ALSA: unable to install sw params. %s\n",
+ Con_Printf ("ALSA: unable to install sw params. %s\n",
snd_strerror (err));
goto error;
}
err = snd_pcm_hw_params_get_buffer_size (hw, &buffer_size);
if (0 > err) {
- Sys_Printf ("ALSA: unable to get buffer size. %s\n",
+ Con_Printf ("ALSA: unable to get buffer size. %s\n",
snd_strerror (err));
goto error;
}
srclength = in_length * in_format->channels;
outcount = (double)in_length * shm->format.speed / in_format->speed;
- Con_DPrintf("ResampleSfx(%s): %d samples @ %dHz -> %d samples @ %dHz\n",
- sfxname, in_length, in_format->speed, outcount, shm->format.speed);
+ //Con_DPrintf("ResampleSfx(%s): %d samples @ %dHz -> %d samples @ %dHz\n",
+ // sfxname, in_length, in_format->speed, outcount, shm->format.speed);
// Trivial case (direct transfer)
if (in_format->speed == shm->format.speed)
if (len >= sizeof (namebuffer))
{
// name too long
- Con_DPrintf("S_LoadSound: name \"%s\" is too long\n", s->name);
+ Con_Printf("S_LoadSound: name \"%s\" is too long\n", s->name);
return false;
}
if (S_LoadWavFile (namebuffer, s))
if (len >= sizeof (namebuffer))
{
// name too long
- Con_DPrintf("S_LoadSound: name \"%s\" is too long\n", s->name);
+ Con_Printf("S_LoadSound: name \"%s\" is too long\n", s->name);
return false;
}
if (S_LoadWavFile (namebuffer, s))
SV_LinkEdict (pusher, false);
return;
default:
- Con_DPrintf("SV_PushMove: unrecognized solid type %f\n", pusher->v->solid);
+ Con_Printf("SV_PushMove: unrecognized solid type %f\n", pusher->v->solid);
return;
}
index = (int) pusher->v->modelindex;
if (index < 1 || index >= MAX_MODELS)
{
- Con_DPrintf("SV_PushMove: invalid modelindex %f\n", pusher->v->modelindex);
+ Con_Printf("SV_PushMove: invalid modelindex %f\n", pusher->v->modelindex);
return;
}
pushermodel = sv.models[index];
void Sys_UnloadLibrary (dllhandle_t* handle);
void* Sys_GetProcAddress (dllhandle_t handle, const char* name);
-void Sys_Print(const char *msg);
-void Sys_Printf(const char *fmt, ...);
-// send text to the quake console (and possibly to terminal)
-
// called after Com_InitArgv
void Sys_Shared_EarlyInit (void);
// called after Host_init
# include <dlfcn.h>
#endif
-extern cvar_t timestamps;
-extern cvar_t timeformat;
-
-static int sys_nostdout = false;
-
-/* The translation table between the graphical font and plain ASCII --KB */
-static char qfont_table[256] = {
- '\0', '#', '#', '#', '#', '.', '#', '#',
- '#', 9, 10, '#', ' ', 13, '.', '.',
- '[', ']', '0', '1', '2', '3', '4', '5',
- '6', '7', '8', '9', '.', '<', '=', '>',
- ' ', '!', '"', '#', '$', '%', '&', '\'',
- '(', ')', '*', '+', ',', '-', '.', '/',
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', ':', ';', '<', '=', '>', '?',
- '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
- 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
- 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
- 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
- '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
- 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
- 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
- 'x', 'y', 'z', '{', '|', '}', '~', '<',
-
- '<', '=', '>', '#', '#', '.', '#', '#',
- '#', '#', ' ', '#', ' ', '>', '.', '.',
- '[', ']', '0', '1', '2', '3', '4', '5',
- '6', '7', '8', '9', '.', '<', '=', '>',
- ' ', '!', '"', '#', '$', '%', '&', '\'',
- '(', ')', '*', '+', ',', '-', '.', '/',
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', ':', ';', '<', '=', '>', '?',
- '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
- 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
- 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
- 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
- '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
- 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
- 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
- 'x', 'y', 'z', '{', '|', '}', '~', '<'
-};
+qboolean sys_nostdout = false;
static char sys_timestring[128];
char *Sys_TimeString(const char *timeformat)
}
-#define MAXPRINTMSG 16384
-
-void Sys_Print(const char *msg)
-{
- unsigned char *p;
- // String we print
- char final[MAXPRINTMSG];
-
- if (sys_nostdout)
- return;
-
- if (timestamps.integer)
- snprintf(final, sizeof(final), "%s%s", Sys_TimeString(timeformat.string), msg);
- else
- strlcpy (final, msg, sizeof (final));
-
- // LordHavoc: make sure the string is terminated
- final[MAXPRINTMSG-1] = 0;
- for (p = (unsigned char *) final;*p; p++)
- *p = qfont_table[*p];
- Sys_PrintToTerminal(final);
-}
-
-void Sys_Printf(const char *fmt, ...)
-{
- va_list argptr;
- char msg[MAXPRINTMSG]; // String we started with
-
- va_start(argptr,fmt);
- vsnprintf(msg,sizeof(msg),fmt,argptr);
- va_end(argptr);
-
- Sys_Print(msg);
-}
-
extern qboolean host_shuttingdown;
void Sys_Quit (void)
{
}
*handle = dllhandle;
- Con_DPrintf("\"%s\" loaded.\n", dllname);
+ Con_Printf("\"%s\" loaded.\n", dllname);
return true;
}
{
const SDL_version *version;
version = SDL_Linked_Version();
- Con_DPrintf( "Linked against SDL version %d.%d.%d\n"
+ Con_Printf( "Linked against SDL version %d.%d.%d\n"
"Using SDL library version %d.%d.%d\n",
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL,
version->major, version->minor, version->patch );
int failed = false;
const dllfunction_t *func;
- Con_DPrintf("checking for %s... ", name);
+ Con_Printf("checking for %s... ", name);
for (func = funcs;func && func->name;func++)
*func->funcvariable = NULL;
if (disableparm && (COM_CheckParm(disableparm) || COM_CheckParm("-safe")))
{
- Con_DPrint("disabled by commandline\n");
+ Con_Print("disabled by commandline\n");
return false;
}
// delay the return so it prints all missing functions
if (failed)
return false;
- Con_DPrint("enabled\n");
+ Con_Print("enabled\n");
return true;
}
else
{
- Con_DPrint("not detected\n");
+ Con_Print("not detected\n");
return false;
}
}
if (!GL_CheckExtension("OpenGL 1.1.0", opengl110funcs, NULL, false))
Sys_Error("OpenGL 1.1.0 functions not found\n");
- Con_DPrintf("GL_VENDOR: %s\n", gl_vendor);
- Con_DPrintf("GL_RENDERER: %s\n", gl_renderer);
- Con_DPrintf("GL_VERSION: %s\n", gl_version);
- Con_DPrintf("GL_EXTENSIONS: %s\n", gl_extensions);
- Con_DPrintf("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions);
+ Con_Printf("GL_VENDOR: %s\n", gl_vendor);
+ Con_Printf("GL_RENDERER: %s\n", gl_renderer);
+ Con_Printf("GL_VERSION: %s\n", gl_version);
+ Con_Printf("GL_EXTENSIONS: %s\n", gl_extensions);
+ Con_Printf("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions);
- Con_DPrint("Checking OpenGL extensions...\n");
+ Con_Print("Checking OpenGL extensions...\n");
// COMMANDLINEOPTION: GL: -nodrawrangeelements disables GL_EXT_draw_range_elements (renders faster)
if (!GL_CheckExtension("glDrawRangeElements", drawrangeelementsfuncs, "-nodrawrangeelements", true))
Cvar_SetQuick(&vid_bitsperpixel, com_argv[i+1]);
}
- Con_DPrint("Starting video system\n");
+ Con_Print("Starting video system\n");
success = VID_Mode(vid_fullscreen.integer, vid_width.integer, vid_height.integer, vid_bitsperpixel.integer);
if (!success)
{
int modelindex = ent->v->modelindex;
if (modelindex < 0 || modelindex > MAX_MODELS)
{
- Con_DPrintf("edict %i: SOLID_BSP with invalid modelindex!\n", NUM_FOR_EDICT(ent));
+ Con_Printf("edict %i: SOLID_BSP with invalid modelindex!\n", NUM_FOR_EDICT(ent));
modelindex = 0;
}
model = sv.models[modelindex];
{
Mod_CheckLoaded(model);
if (!model->TraceBox)
- Con_DPrintf("edict %i: SOLID_BSP with non-collidable model\n", NUM_FOR_EDICT(ent));
+ Con_Printf("edict %i: SOLID_BSP with non-collidable model\n", NUM_FOR_EDICT(ent));
if (ent->v->angles[0] || ent->v->angles[2] || ent->v->avelocity[0] || ent->v->avelocity[2])
{
// if the modelindex is 0, it shouldn't be SOLID_BSP!
if (modelindex == 0)
{
- Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with no model\n", NUM_FOR_EDICT(ent));
+ Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with no model\n", NUM_FOR_EDICT(ent));
return trace;
}
if (modelindex >= MAX_MODELS)
{
- Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent));
+ Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent));
return trace;
}
model = sv.models[modelindex];
if (modelindex != 0 && model == NULL)
{
- Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent));
+ Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with invalid modelindex\n", NUM_FOR_EDICT(ent));
return trace;
}
{
if (!model->TraceBox)
{
- Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with a non-collidable model\n", NUM_FOR_EDICT(ent));
+ Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP with a non-collidable model\n", NUM_FOR_EDICT(ent));
return trace;
}
//if (ent->v->movetype != MOVETYPE_PUSH)
//{
- // Con_DPrintf("SV_ClipMoveToEntity: edict %i: SOLID_BSP without MOVETYPE_PUSH\n", NUM_FOR_EDICT(ent));
+ // Con_Printf("SV_ClipMoveToEntity: edict %i: SOLID_BSP without MOVETYPE_PUSH\n", NUM_FOR_EDICT(ent));
// return trace;
//}
}