total nukage of Con_*Printf calls from libs (except for video). Sys_*Printf

(Sys_DPrintf is new) is now used exclusively for all lib printing. Con_Init
sets the sys printf recirection to Con_Print (which has been revamped
appropriatly) and the server sets it to SV_Print (which was SV_Printf and
the new SV_Printf calls /it/). This should fix the rcon print redirection
issues.
This commit is contained in:
Bill Currie 2001-09-21 04:22:46 +00:00
parent 4416404982
commit 49a85718f8
50 changed files with 513 additions and 500 deletions

View file

@ -28,9 +28,8 @@
#ifndef __console_h
#define __console_h
//
// console
//
#include <stdarg.h>
#include "QF/qtypes.h"
#include "QF/gcc_attr.h"
@ -77,7 +76,7 @@ void Con_ProcessInputLine (inputline_t *il, int ch);
void Con_DrawConsole (int lines);
void Con_DrawDownload (int lines);
void Con_Print (const char *txt);
void Con_Print (const char *fmt, va_list args);
void Con_Printf (const char *fmt, ...) __attribute__((format(printf,1,2)));
void Con_DPrintf (const char *fmt, ...) __attribute__((format(printf,1,2)));
void Con_Clear_f (void);
@ -99,8 +98,6 @@ void Con_DisplayList(const char **list, int con_linewidth);
inputline_t *Con_CreateInputLine (int lines, int width, char prompt);
void Con_DestroyInputLine (inputline_t *inputline);
extern struct cvar_s *developer;
// init/shutdown functions
void Con_Init (const char *plugin_name);
void Con_Init_Cvars (void);

View file

@ -29,6 +29,7 @@
#ifndef __pcx_h
#define __pcx_h
#include "QF/qtypes.h"
#include "QF/vfile.h"
typedef struct

View file

@ -38,6 +38,9 @@ extern struct cvar_s *sys_extrasleep;
extern struct cvar_s *sys_dead_sleep;
extern struct cvar_s *sys_sleep;
extern struct cvar_s *developer;
extern const char sys_char_map[256];
int Sys_FileTime (const char *path);
@ -48,6 +51,7 @@ typedef void (*sys_printf_t) (const char *fmt, va_list args);
void Sys_SetPrintf (sys_printf_t func);
void Sys_Printf (const char *fmt, ...) __attribute__((format(printf,1,2)));
void Sys_DPrintf (const char *fmt, ...) __attribute__((format(printf,1,2)));
void Sys_Error (const char *error, ...) __attribute__((format(printf,1,2), noreturn));
void Sys_Quit (void);
double Sys_DoubleTime (void);

View file

@ -30,10 +30,10 @@
#include "QF/cdaudio.h"
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/plugin.h"
#include "QF/qtypes.h"
#include "QF/sys.h"
cvar_t *cd_plugin;
plugin_t *cdmodule = NULL;
@ -88,7 +88,7 @@ CDAudio_Init (void)
"CD Plugin to use");
cdmodule = PI_LoadPlugin ("cd", cd_plugin->string);
if (!cdmodule) {
Con_Printf ("Loading of cd module: %s failed!\n", cd_plugin->string);
Sys_Printf ("Loading of cd module: %s failed!\n", cd_plugin->string);
return -1;
} else {
cdmodule->functions->general->p_Init ();
@ -108,5 +108,5 @@ CDAudio_Init (void)
"pause - Pause the CD playback.\n"
"play (track number) - Plays the specified track one time.\n"
"stop - Stops the currently playing track.");
Con_Printf ("CD Audio Initialized\n");
Sys_Printf ("CD Audio Initialized\n");
}

View file

@ -49,12 +49,12 @@
#include <linux/cdrom.h>
#include "QF/cdaudio.h"
#include "QF/console.h"
#include "QF/cmd.h"
#include "QF/cvar.h"
#include "QF/plugin.h"
#include "QF/qargs.h"
#include "QF/sound.h"
#include "QF/sys.h"
#include "compat.h"
@ -87,7 +87,7 @@ I_CDAudio_CloseDoor (void)
return; // no cd init'd
if (ioctl (cdfile, CDROMCLOSETRAY) == -1)
Con_DPrintf ("CDAudio: ioctl cdromclosetray failed\n");
Sys_DPrintf ("CDAudio: ioctl cdromclosetray failed\n");
}
static void
@ -97,7 +97,7 @@ I_CDAudio_Eject (void)
return; // no cd init'd
if (ioctl (cdfile, CDROMEJECT) == -1)
Con_DPrintf ("CDAudio: ioctl cdromeject failed\n");
Sys_DPrintf ("CDAudio: ioctl cdromeject failed\n");
}
static int
@ -108,12 +108,12 @@ I_CDAudio_GetAudioDiskInfo (void)
cdValid = false;
if (ioctl (cdfile, CDROMREADTOCHDR, &tochdr) == -1) {
Con_DPrintf ("CDAudio: ioctl cdromreadtochdr failed\n");
Sys_DPrintf ("CDAudio: ioctl cdromreadtochdr failed\n");
return -1;
}
if (tochdr.cdth_trk0 < 1) {
Con_DPrintf ("CDAudio: no music tracks\n");
Sys_DPrintf ("CDAudio: no music tracks\n");
return -1;
}
@ -133,7 +133,7 @@ I_CDAudio_Pause (void)
return;
if (ioctl (cdfile, CDROMPAUSE) == -1)
Con_DPrintf ("CDAudio: ioctl cdrompause failed\n");
Sys_DPrintf ("CDAudio: ioctl cdrompause failed\n");
wasPlaying = playing;
playing = false;
@ -149,7 +149,7 @@ I_CDAudio_Stop (void)
return;
if (ioctl (cdfile, CDROMSTOP) == -1)
Con_DPrintf ("CDAudio: ioctl cdromstop failed (%d)\n", errno);
Sys_DPrintf ("CDAudio: ioctl cdromstop failed (%d)\n", errno);
wasPlaying = false;
playing = false;
@ -181,7 +181,7 @@ I_CDAudio_Play (byte track, qboolean looping)
entry0.cdte_track = track;
entry0.cdte_format = CDROM_MSF;
if (ioctl (cdfile, CDROMREADTOCENTRY, &entry0) == -1) {
Con_DPrintf ("CDAudio: ioctl cdromreadtocentry failed\n");
Sys_DPrintf ("CDAudio: ioctl cdromreadtocentry failed\n");
return;
}
entry1.cdte_track = track + 1;
@ -190,11 +190,11 @@ I_CDAudio_Play (byte track, qboolean looping)
entry1.cdte_track = CDROM_LEADOUT;
}
if (ioctl (cdfile, CDROMREADTOCENTRY, &entry1) == -1) {
Con_DPrintf ("CDAudio: ioctl cdromreadtocentry failed\n");
Sys_DPrintf ("CDAudio: ioctl cdromreadtocentry failed\n");
return;
}
if (entry0.cdte_ctrl == CDROM_DATA_TRACK) {
Con_Printf ("track %i is not audio\n", track);
Sys_Printf ("track %i is not audio\n", track);
return;
}
@ -212,19 +212,19 @@ I_CDAudio_Play (byte track, qboolean looping)
msf.cdmsf_sec1 = entry1.cdte_addr.msf.second;
msf.cdmsf_frame1 = entry1.cdte_addr.msf.frame;
Con_DPrintf ("%2d:%02d:%02d %2d:%02d:%02d\n",
Sys_DPrintf ("%2d:%02d:%02d %2d:%02d:%02d\n",
msf.cdmsf_min0,
msf.cdmsf_sec0,
msf.cdmsf_frame0,
msf.cdmsf_min1, msf.cdmsf_sec1, msf.cdmsf_frame1);
if (ioctl (cdfile, CDROMPLAYMSF, &msf) == -1) {
Con_DPrintf ("CDAudio: ioctl cdromplaytrkind failed (%s)\n",
Sys_DPrintf ("CDAudio: ioctl cdromplaytrkind failed (%s)\n",
strerror (errno));
return;
}
// if ( ioctl(cdfile, CDROMRESUME) == -1 )
// Con_DPrintf("CDAudio: ioctl cdromresume failed\n");
// Sys_DPrintf("CDAudio: ioctl cdromresume failed\n");
playLooping = looping;
playTrack = track;
@ -247,7 +247,7 @@ I_CDAudio_Resume (void)
return;
if (ioctl (cdfile, CDROMRESUME) == -1)
Con_DPrintf ("CDAudio: ioctl cdromresume failed\n");
Sys_DPrintf ("CDAudio: ioctl cdromresume failed\n");
playing = true;
}
@ -302,7 +302,7 @@ I_CD_f (void)
if (ret <= 0) {
for (n = 1; n < 100; n++)
if (remap[n] != n)
Con_Printf (" %u -> %u\n", n, remap[n]);
Sys_Printf (" %u -> %u\n", n, remap[n]);
return;
}
for (n = 1; n <= ret; n++)
@ -318,7 +318,7 @@ I_CD_f (void)
if (!cdValid) {
I_CDAudio_GetAudioDiskInfo ();
if (!cdValid) {
Con_Printf ("No CD in player.\n");
Sys_Printf ("No CD in player.\n");
return;
}
}
@ -357,14 +357,14 @@ I_CD_f (void)
}
if (strequal (command, "info")) {
Con_Printf ("%u tracks\n", maxTrack);
Sys_Printf ("%u tracks\n", maxTrack);
if (playing)
Con_Printf ("Currently %s track %u\n",
Sys_Printf ("Currently %s track %u\n",
playLooping ? "looping" : "playing", playTrack);
else if (wasPlaying)
Con_Printf ("Paused %s track %u\n",
Sys_Printf ("Paused %s track %u\n",
playLooping ? "looping" : "playing", playTrack);
Con_Printf ("Volume is %g\n", cdvolume);
Sys_Printf ("Volume is %g\n", cdvolume);
return;
}
}
@ -394,7 +394,7 @@ I_CDAudio_Update (void)
lastchk = time (NULL) + 2; // two seconds between chks
subchnl.cdsc_format = CDROM_MSF;
if (ioctl (cdfile, CDROMSUBCHNL, &subchnl) == -1) {
Con_DPrintf ("CDAudio: ioctl cdromsubchnl failed\n");
Sys_DPrintf ("CDAudio: ioctl cdromsubchnl failed\n");
playing = false;
return;
}
@ -421,14 +421,14 @@ Mus_CDChange (cvar_t *mus_cdaudio)
cdfile = open (mus_cdaudio->string, O_RDONLY | O_NONBLOCK);
if (cdfile == -1)
{
Con_DPrintf ("Mus_CDInit: open of device \"%s\" failed (error %i)\n",
Sys_DPrintf ("Mus_CDInit: open of device \"%s\" failed (error %i)\n",
mus_cdaudio->string, errno);
return;
}
if (I_CDAudio_GetAudioDiskInfo ())
{
Con_Printf ("CDAudio_Init: No CD in player.\n");
Sys_Printf ("CDAudio_Init: No CD in player.\n");
cdValid = false;
}

View file

@ -43,11 +43,11 @@
#include "QF/cdaudio.h"
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/plugin.h"
#include "QF/qargs.h"
#include "QF/sound.h"
#include "QF/sys.h"
#include "compat.h"
@ -75,7 +75,7 @@ I_CDAudio_Eject (void)
return;
if (SDL_CDEject (cd_id))
Con_DPrintf ("Unable to eject CD-ROM tray.\n");
Sys_DPrintf ("Unable to eject CD-ROM tray.\n");
}
static void
@ -87,7 +87,7 @@ I_CDAudio_Pause (void)
return;
if (SDL_CDPause (cd_id))
Con_DPrintf ("CDAudio_Pause: Failed to pause track.\n");
Sys_DPrintf ("CDAudio_Pause: Failed to pause track.\n");
}
static void
@ -102,7 +102,7 @@ I_CDAudio_Stop (void)
return;
if (SDL_CDStop (cd_id))
Con_DPrintf ("CDAudio_Stop: Failed to stop track.\n");
Sys_DPrintf ("CDAudio_Stop: Failed to stop track.\n");
}
static void
@ -135,7 +135,7 @@ I_CDAudio_Play (byte track, qboolean looping)
if (SDL_CDPlay (cd_id, cd_id->track[track].offset,
cd_id->track[track].length)) {
Con_DPrintf ("CDAudio_Play: Unable to play track: %d\n", track + 1);
Sys_DPrintf ("CDAudio_Play: Unable to play track: %d\n", track + 1);
return;
}
playLooping = looping;
@ -150,7 +150,7 @@ I_CDAudio_Resume (void)
return;
if (SDL_CDResume (cd_id))
Con_DPrintf ("CDAudio_Resume: Failed tp resume track.\n");
Sys_DPrintf ("CDAudio_Resume: Failed tp resume track.\n");
}
static void
@ -236,13 +236,13 @@ I_CD_f (void)
if (!cd_id)
return;
cdstate = SDL_CDStatus (cd_id);
Con_Printf ("%d tracks\n", cd_id->numtracks);
Sys_Printf ("%d tracks\n", cd_id->numtracks);
if (cdstate == CD_PLAYING)
Con_Printf ("Currently %s track %d\n",
Sys_Printf ("Currently %s track %d\n",
playLooping ? "looping" : "playing",
cd_id->cur_track + 1);
else if (cdstate == CD_PAUSED)
Con_Printf ("Paused %s track %d\n",
Sys_Printf ("Paused %s track %d\n",
playLooping ? "looping" : "playing",
cd_id->cur_track + 1);
return;
@ -253,12 +253,12 @@ static void
I_CDAudio_Init (void)
{
if (SDL_Init (SDL_INIT_CDROM) < 0) {
Con_Printf ("Couldn't initialize SDL CD-AUDIO: %s\n", SDL_GetError ());
Sys_Printf ("Couldn't initialize SDL CD-AUDIO: %s\n", SDL_GetError ());
return; // was -1
}
cd_id = SDL_CDOpen (0);
if (!cd_id) {
Con_Printf ("CDAudio_Init: Unable to open default CD-ROM drive: %s\n",
Sys_Printf ("CDAudio_Init: Unable to open default CD-ROM drive: %s\n",
SDL_GetError ());
return; // was -1
}
@ -268,15 +268,15 @@ I_CDAudio_Init (void)
cdValid = true;
if (!CD_INDRIVE (SDL_CDStatus (cd_id))) {
Con_Printf ("CDAudio_Init: No CD in drive.\n");
Sys_Printf ("CDAudio_Init: No CD in drive.\n");
cdValid = false;
}
if (!cd_id->numtracks) {
Con_Printf ("CDAudio_Init: CD contains no audio tracks.\n");
Sys_Printf ("CDAudio_Init: CD contains no audio tracks.\n");
cdValid = false;
}
Con_Printf ("CD Audio Initialized.\n");
Sys_Printf ("CD Audio Initialized.\n");
}
plugin_t *

View file

@ -37,9 +37,9 @@
#include "QF/cdaudio.h"
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/qargs.h"
#include "QF/sound.h"
#include "QF/sys.h"
static qboolean initialized = false;
static qboolean enabled = true;
@ -60,7 +60,7 @@ pCDAudio_Eject (void)
return; // no cd init'd
if (CDeject (cdp) == 0)
Con_DPrintf ("CDAudio_Eject: CDeject failed\n");
Sys_DPrintf ("CDAudio_Eject: CDeject failed\n");
}
static int
@ -72,7 +72,7 @@ pCDAudio_GetState (void)
return -1; // no cd init'd
if (CDgetstatus (cdp, &cds) == 0) {
Con_DPrintf ("CDAudio_GetStatus: CDgetstatus failed\n");
Sys_DPrintf ("CDAudio_GetStatus: CDgetstatus failed\n");
return -1;
}
@ -88,7 +88,7 @@ pCDAudio_MaxTrack (void)
return -1; // no cd init'd
if (CDgetstatus (cdp, &cds) == 0) {
Con_DPrintf ("CDAudio_MaxTrack: CDgetstatus failed\n");
Sys_DPrintf ("CDAudio_MaxTrack: CDgetstatus failed\n");
return -1;
}
@ -102,7 +102,7 @@ pCDAudio_Pause (void)
return;
if (CDtogglepause (cdp) == 0)
Con_DPrintf ("CDAudio_PAUSE: CDtogglepause failed (%d)\n", errno);
Sys_DPrintf ("CDAudio_PAUSE: CDtogglepause failed (%d)\n", errno);
}
void
@ -115,12 +115,12 @@ pCDAudio_Play (byte track, qboolean looping)
/* cd == audio cd? */
if (CDAudio_GetState () != CD_READY) {
Con_Printf ("CDAudio_Play: CD in player not an audio CD.\n");
Sys_Printf ("CDAudio_Play: CD in player not an audio CD.\n");
return;
}
if (maxtrack < 0) {
Con_DPrintf ("CDAudio_Play: Error getting maximum track number\n");
Sys_DPrintf ("CDAudio_Play: Error getting maximum track number\n");
return;
}
@ -133,16 +133,16 @@ pCDAudio_Play (byte track, qboolean looping)
// don't try to play a non-audio track
/* mw: how to do this on irix? entry0.cdte_track = track;
entry0.cdte_format = CDROM_MSF; if ( ioctl(cdfile, CDROMREADTOCENTRY,
&entry0) == -1 ) { Con_DPrintf("CDAudio: ioctl cdromreadtocentry
&entry0) == -1 ) { Sys_DPrintf("CDAudio: ioctl cdromreadtocentry
failed\n"); return; }
entry1.cdte_track = track + 1; entry1.cdte_format = CDROM_MSF; if
(entry1.cdte_track > maxTrack) { entry1.cdte_track = CDROM_LEADOUT; }
if ( ioctl(cdfile, CDROMREADTOCENTRY, &entry1) == -1 ) {
Con_DPrintf("CDAudio: ioctl cdromreadtocentry failed\n"); return; }
Sys_DPrintf("CDAudio: ioctl cdromreadtocentry failed\n"); return; }
if (entry0.cdte_ctrl == CDROM_DATA_TRACK) { Con_Printf("track %i is
if (entry0.cdte_ctrl == CDROM_DATA_TRACK) { Sys_Printf("track %i is
not audio\n", track); return; }
*/
@ -154,7 +154,7 @@ pCDAudio_Play (byte track, qboolean looping)
}
if (CDplaytrack (cdp, track, cdvolume == 0.0 ? 0 : 1) == 0) {
Con_DPrintf ("CDAudio_Play: CDplay failed (%d)\n", errno);
Sys_DPrintf ("CDAudio_Play: CDplay failed (%d)\n", errno);
return;
}
@ -169,7 +169,7 @@ pCDAudio_Resume (void)
return;
if (CDtogglepause (cdp) == 0)
Con_DPrintf ("CDAudio_Resume: CDtogglepause failed (%d)\n", errno);
Sys_DPrintf ("CDAudio_Resume: CDtogglepause failed (%d)\n", errno);
}
void
@ -191,7 +191,7 @@ pCDAudio_Stop (void)
return;
if (CDstop (cdp) == 0)
Con_DPrintf ("CDAudio_Stop: CDStop failed (%d)\n", errno);
Sys_DPrintf ("CDAudio_Stop: CDStop failed (%d)\n", errno);
}
void
@ -256,7 +256,7 @@ pCD_f (void)
if (ret <= 0) {
for (n = 1; n < 100; n++)
if (remap[n] != n)
Con_Printf (" %u -> %u\n", n, remap[n]);
Sys_Printf (" %u -> %u\n", n, remap[n]);
return;
}
@ -298,15 +298,15 @@ pCD_f (void)
}
if (strequal (command, "info")) {
Con_Printf ("%u tracks\n", CDAudio_MaxTrack ());
Sys_Printf ("%u tracks\n", CDAudio_MaxTrack ());
if (CDAudio_GetState () == CD_PLAYING)
Con_Printf ("Currently %s track %u\n",
Sys_Printf ("Currently %s track %u\n",
playLooping ? "looping" : "playing", playTrack);
else if (CDAudio_GetState () == CD_PAUSED)
Con_Printf ("Paused %s track %u\n",
Sys_Printf ("Paused %s track %u\n",
playLooping ? "looping" : "playing", playTrack);
Con_Printf ("Volume is %g\n", cdvolume);
Sys_Printf ("Volume is %g\n", cdvolume);
return;
}
}
@ -327,7 +327,7 @@ pCDAudio_Init (void)
cdp = CDopen (cd_dev, "r");
if (cdp == NULL) {
Con_Printf ("CDAudio_Init: open of \"%s\" failed (%i)\n",
Sys_Printf ("CDAudio_Init: open of \"%s\" failed (%i)\n",
cd_dev, errno);
return -1;
}
@ -338,7 +338,7 @@ pCDAudio_Init (void)
initialized = true;
enabled = true;
Con_Printf ("CD Audio Initialized\n");
Sys_Printf ("CD Audio Initialized\n");
return 0;
}

View file

@ -34,11 +34,11 @@
#include "QF/cdaudio.h"
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/plugin.h"
#include "QF/qargs.h"
#include "QF/sound.h"
#include "QF/sys.h"
#include "compat.h"
@ -77,7 +77,7 @@ I_CDAudio_CloseDoor (void)
dwReturn =
mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD) NULL);
if (dwReturn) {
Con_DPrintf ("MCI_SET_DOOR_CLOSED failed (%li)\n", dwReturn);
Sys_DPrintf ("MCI_SET_DOOR_CLOSED failed (%li)\n", dwReturn);
}
}
@ -89,7 +89,7 @@ I_CDAudio_Eject (void)
dwReturn = mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN,
(DWORD) NULL);
if (dwReturn) {
Con_DPrintf ("MCI_SET_DOOR_OPEN failed (%li)\n", dwReturn);
Sys_DPrintf ("MCI_SET_DOOR_OPEN failed (%li)\n", dwReturn);
}
}
@ -106,11 +106,11 @@ I_CDAudio_GetAudioDiskInfo (void)
mciSendCommand (wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT,
(DWORD) (LPVOID) & mciStatusParms);
if (dwReturn) {
Con_DPrintf ("CDAudio: drive ready test - get status failed\n");
Sys_DPrintf ("CDAudio: drive ready test - get status failed\n");
return -1;
}
if (!mciStatusParms.dwReturn) {
Con_DPrintf ("CDAudio: drive not ready\n");
Sys_DPrintf ("CDAudio: drive not ready\n");
return -1;
}
@ -119,11 +119,11 @@ I_CDAudio_GetAudioDiskInfo (void)
mciSendCommand (wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT,
(DWORD) (LPVOID) & mciStatusParms);
if (dwReturn) {
Con_DPrintf ("CDAudio: get tracks - status failed\n");
Sys_DPrintf ("CDAudio: get tracks - status failed\n");
return -1;
}
if (mciStatusParms.dwReturn < 1) {
Con_DPrintf ("CDAudio: no music tracks\n");
Sys_DPrintf ("CDAudio: no music tracks\n");
return -1;
}
@ -153,13 +153,13 @@ static I_CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa
break;
case MCI_NOTIFY_FAILURE:
Con_DPrintf ("MCI_NOTIFY_FAILURE\n");
Sys_DPrintf ("MCI_NOTIFY_FAILURE\n");
I_CDAudio_Stop ();
cdValid = false;
break;
default:
Con_DPrintf ("Unexpected MM_MCINOTIFY type (%i)\n", wParam);
Sys_DPrintf ("Unexpected MM_MCINOTIFY type (%i)\n", wParam);
return 1;
}
@ -183,7 +183,7 @@ I_CDAudio_Pause (void)
mciSendCommand (wDeviceID, MCI_PAUSE, 0,
(DWORD) (LPVOID) & mciGenericParms);
if (dwReturn) {
Con_DPrintf ("MCI_PAUSE failed (%li)", dwReturn);
Sys_DPrintf ("MCI_PAUSE failed (%li)", dwReturn);
}
wasPlaying = playing;
@ -220,11 +220,11 @@ I_CDAudio_Play (byte track, qboolean looping)
MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT,
(DWORD) (LPVOID) & mciStatusParms);
if (dwReturn) {
Con_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn);
Sys_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn);
return;
}
if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO) {
Con_Printf ("CDAudio: track %i is not audio\n", track);
Sys_Printf ("CDAudio: track %i is not audio\n", track);
return;
}
// get the length of the track to be played
@ -235,7 +235,7 @@ I_CDAudio_Play (byte track, qboolean looping)
MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT,
(DWORD) (LPVOID) & mciStatusParms);
if (dwReturn) {
Con_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn);
Sys_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn);
return;
}
@ -252,7 +252,7 @@ I_CDAudio_Play (byte track, qboolean looping)
mciSendCommand (wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO,
(DWORD) (LPVOID) & mciPlayParms);
if (dwReturn) {
Con_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
Sys_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
return;
}
@ -286,7 +286,7 @@ I_CDAudio_Resume (void)
mciSendCommand (wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY,
(DWORD) (LPVOID) & mciPlayParms);
if (dwReturn) {
Con_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
Sys_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
return;
}
playing = true;
@ -299,7 +299,7 @@ I_CDAudio_Shutdown (void)
return;
I_CDAudio_Stop ();
if (mciSendCommand (wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD) NULL))
Con_DPrintf ("CDAudio_Shutdown: MCI_CLOSE failed\n");
Sys_DPrintf ("CDAudio_Shutdown: MCI_CLOSE failed\n");
}
static void
@ -315,7 +315,7 @@ I_CDAudio_Stop (void)
dwReturn = mciSendCommand (wDeviceID, MCI_STOP, 0, (DWORD) NULL);
if (dwReturn) {
Con_DPrintf ("MCI_STOP failed (%li)", dwReturn);
Sys_DPrintf ("MCI_STOP failed (%li)", dwReturn);
}
wasPlaying = false;
@ -380,7 +380,7 @@ I_CD_f (void)
if (ret <= 0) {
for (n = 1; n < 100; n++)
if (remap[n] != n)
Con_Printf (" %u -> %u\n", n, remap[n]);
Sys_Printf (" %u -> %u\n", n, remap[n]);
return;
}
for (n = 1; n <= ret; n++)
@ -396,7 +396,7 @@ I_CD_f (void)
if (!cdValid) {
I_CDAudio_GetAudioDiskInfo ();
if (!cdValid) {
Con_Printf ("No CD in player.\n");
Sys_Printf ("No CD in player.\n");
return;
}
}
@ -435,14 +435,14 @@ I_CD_f (void)
}
if (strequal (command, "info")) {
Con_Printf ("%u tracks\n", maxTrack);
Sys_Printf ("%u tracks\n", maxTrack);
if (playing)
Con_Printf ("Currently %s track %u\n",
Sys_Printf ("Currently %s track %u\n",
playLooping ? "looping" : "playing", playTrack);
else if (wasPlaying)
Con_Printf ("Paused %s track %u\n",
Sys_Printf ("Paused %s track %u\n",
playLooping ? "looping" : "playing", playTrack);
Con_Printf ("Volume is %f\n", cdvolume);
Sys_Printf ("Volume is %f\n", cdvolume);
return;
}
}
@ -460,7 +460,7 @@ I_CDAudio_Init (void)
mciSendCommand (0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE,
(DWORD) (LPVOID) & mciOpenParms);
if (dwReturn) {
Con_Printf ("CDAudio_Init: MCI_OPEN failed (%li)\n", dwReturn);
Sys_Printf ("CDAudio_Init: MCI_OPEN failed (%li)\n", dwReturn);
return; // was -1
}
wDeviceID = mciOpenParms.wDeviceID;
@ -471,7 +471,7 @@ I_CDAudio_Init (void)
mciSendCommand (wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT,
(DWORD) (LPVOID) & mciSetParms);
if (dwReturn) {
Con_Printf ("MCI_SET_TIME_FORMAT failed (%li)\n", dwReturn);
Sys_Printf ("MCI_SET_TIME_FORMAT failed (%li)\n", dwReturn);
mciSendCommand (wDeviceID, MCI_CLOSE, 0, (DWORD) NULL);
return; // was -1
}
@ -482,7 +482,7 @@ I_CDAudio_Init (void)
enabled = true;
if (I_CDAudio_GetAudioDiskInfo ()) {
Con_Printf ("CDAudio_Init: No CD in player.\n");
Sys_Printf ("CDAudio_Init: No CD in player.\n");
cdValid = false;
enabled = false;
}

View file

@ -44,7 +44,6 @@
#include "QF/cmd.h"
#include "QF/cvar.h"
#include "QF/console.h"
#include "QF/model.h"
#include "QF/qargs.h"
#include "QF/sys.h"
@ -145,18 +144,18 @@ void
SND_SoundInfo_f (void)
{
if (!sound_started || !shm) {
Con_Printf ("sound system not started\n");
Sys_Printf ("sound system not started\n");
return;
}
Con_Printf ("%5d stereo\n", shm->channels - 1);
Con_Printf ("%5d samples\n", shm->samples);
Con_Printf ("%5d samplepos\n", shm->samplepos);
Con_Printf ("%5d samplebits\n", shm->samplebits);
Con_Printf ("%5d submission_chunk\n", shm->submission_chunk);
Con_Printf ("%5d speed\n", shm->speed);
Con_Printf ("0x%lx dma buffer\n", (unsigned long) shm->buffer);
Con_Printf ("%5d total_channels\n", total_channels);
Sys_Printf ("%5d stereo\n", shm->channels - 1);
Sys_Printf ("%5d samples\n", shm->samples);
Sys_Printf ("%5d samplepos\n", shm->samplepos);
Sys_Printf ("%5d samplebits\n", shm->samplebits);
Sys_Printf ("%5d submission_chunk\n", shm->submission_chunk);
Sys_Printf ("%5d speed\n", shm->speed);
Sys_Printf ("0x%lx dma buffer\n", (unsigned long) shm->buffer);
Sys_Printf ("%5d total_channels\n", total_channels);
}
void
@ -172,7 +171,7 @@ SND_Startup (void)
if (!rc) {
#ifndef _WIN32
Con_Printf ("S_Startup: S_O_Init failed.\n");
Sys_Printf ("S_Startup: S_O_Init failed.\n");
#endif
sound_started = 0;
return;
@ -185,7 +184,7 @@ SND_Startup (void)
void
SND_Init (void)
{
Con_Printf ("\nSound Initialization\n");
Sys_Printf ("\nSound Initialization\n");
Cmd_AddCommand ("play", SND_Play,
"Play selected sound effect (play pathto/sound.wav)");
@ -209,7 +208,7 @@ SND_Init (void)
// FIXME
// if (host_parms.memsize < 0x800000) {
// Cvar_Set (snd_loadas8bit, "1");
// Con_Printf ("loading all sounds as 8bit\n");
// Sys_Printf ("loading all sounds as 8bit\n");
// }
snd_initialized = true;
@ -239,7 +238,7 @@ SND_Init (void)
shm->submission_chunk = 1;
shm->buffer = Hunk_AllocName (1 << 16, "shmbuf");
}
// Con_Printf ("Sound sampling rate: %i\n", shm->speed);
// Sys_Printf ("Sound sampling rate: %i\n", shm->speed);
// provides a tick sound until washed clean
@ -602,7 +601,7 @@ SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation)
return;
if (total_channels == MAX_CHANNELS) {
Con_Printf ("total_channels == MAX_CHANNELS\n");
Sys_Printf ("total_channels == MAX_CHANNELS\n");
return;
}
@ -614,7 +613,7 @@ SND_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation)
return;
if (sc->loopstart == -1) {
Con_Printf ("Sound %s not looped\n", sfx->name);
Sys_Printf ("Sound %s not looped\n", sfx->name);
Cache_Release (&sfx->cache);
return;
}
@ -753,12 +752,12 @@ SND_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up)
ch = channels;
for (i = 0; i < total_channels; i++, ch++)
if (ch->sfx && (ch->leftvol || ch->rightvol)) {
// Con_Printf ("%3i %3i %s\n", ch->leftvol, ch->rightvol,
// Sys_Printf ("%3i %3i %s\n", ch->leftvol, ch->rightvol,
// ch->sfx->name);
total++;
}
Con_Printf ("----(%i)----\n", total);
Sys_Printf ("----(%i)----\n", total);
}
// mix some sound
@ -814,7 +813,7 @@ SND_Update_ (void)
// check to make sure that we haven't overshot
if (paintedtime < soundtime) {
// Con_Printf ("S_Update_ : overflow\n");
// Sys_Printf ("S_Update_ : overflow\n");
paintedtime = soundtime;
}
// mix ahead of current position
@ -902,15 +901,15 @@ SND_SoundList (void)
size = sc->length * sc->width * (sc->stereo + 1);
total += size;
if (sc->loopstart >= 0)
Con_Printf ("L");
Sys_Printf ("L");
else
Con_Printf (" ");
Con_Printf ("(%2db) %6i : %s\n", sc->width * 8, size, sfx->name);
Sys_Printf (" ");
Sys_Printf ("(%2db) %6i : %s\n", sc->width * 8, size, sfx->name);
if (load)
Cache_Release (&sfx->cache);
}
Con_Printf ("Total resident: %i\n", total);
Sys_Printf ("Total resident: %i\n", total);
}
void
@ -925,7 +924,7 @@ SND_LocalSound (const char *sound)
sfx = SND_PrecacheSound (sound);
if (!sfx) {
Con_Printf ("S_LocalSound: can't cache %s\n", sound);
Sys_Printf ("S_LocalSound: can't cache %s\n", sound);
return;
}
SND_StartSound (*plugin_info_snd_render_data.viewentity, -1, sfx,

View file

@ -36,7 +36,6 @@
# include <strings.h>
#endif
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/qendian.h"
#include "QF/sound.h"
@ -169,13 +168,13 @@ SND_LoadSound (sfx_t *sfx, cache_allocator_t allocator)
data = COM_LoadStackFile (namebuffer, stackbuf, sizeof (stackbuf));
if (!data) {
Con_Printf ("Couldn't load %s\n", namebuffer);
Sys_Printf ("Couldn't load %s\n", namebuffer);
return NULL;
}
info = SND_GetWavinfo (sfx->name, data, com_filesize);
if (info.channels != 1) {
Con_Printf ("%s is a stereo sample\n", sfx->name);
Sys_Printf ("%s is a stereo sample\n", sfx->name);
return NULL;
}
@ -285,7 +284,7 @@ SND_DumpChunks (void)
memcpy (str, data_p, 4);
data_p += 4;
iff_chunk_len = SND_GetLittleLong ();
Con_Printf ("0x%x : %s (%d)\n", (int) (data_p - 4), str,
Sys_Printf ("0x%x : %s (%d)\n", (int) (data_p - 4), str,
iff_chunk_len);
data_p += (iff_chunk_len + 1) & ~1;
} while (data_p < iff_end);
@ -308,7 +307,7 @@ SND_GetWavinfo (const char *name, byte * wav, int wavlength)
// find "RIFF" chunk
SND_FindChunk ("RIFF");
if (!(data_p && !strncmp (data_p + 8, "WAVE", 4))) {
Con_Printf ("Missing RIFF/WAVE chunks\n");
Sys_Printf ("Missing RIFF/WAVE chunks\n");
return info;
}
// get "fmt " chunk
@ -317,13 +316,13 @@ SND_GetWavinfo (const char *name, byte * wav, int wavlength)
SND_FindChunk ("fmt ");
if (!data_p) {
Con_Printf ("Missing fmt chunk\n");
Sys_Printf ("Missing fmt chunk\n");
return info;
}
data_p += 8;
format = SND_GetLittleShort ();
if (format != 1) {
Con_Printf ("Microsoft PCM format only\n");
Sys_Printf ("Microsoft PCM format only\n");
return info;
}
@ -354,7 +353,7 @@ SND_GetWavinfo (const char *name, byte * wav, int wavlength)
// find data chunk
SND_FindChunk ("data");
if (!data_p) {
Con_Printf ("Missing data chunk\n");
Sys_Printf ("Missing data chunk\n");
return info;
}

View file

@ -36,9 +36,9 @@
# include <strings.h>
#endif
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/sound.h"
#include "QF/sys.h"
#include "compat.h"
@ -99,7 +99,7 @@ SND_TransferStereo16 (int endtime)
if (pDSBuf) {
pbuf = DSOUND_LockBuffer (true);
if (!pbuf) {
Con_Printf ("DSOUND_LockBuffer fails!\n");
Sys_Printf ("DSOUND_LockBuffer fails!\n");
return;
}
} else
@ -156,7 +156,7 @@ SND_TransferPaintBuffer (int endtime)
if (pDSBuf) {
pbuf = DSOUND_LockBuffer (true);
if (!pbuf) {
Con_Printf ("DSOUND_LockBuffer fails!\n");
Sys_Printf ("DSOUND_LockBuffer fails!\n");
return;
}
} else

View file

@ -28,11 +28,11 @@
$Id$
*/
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/sound.h"
#include "QF/model.h"
#include "QF/plugin.h"
#include "QF/sys.h"
// =======================================================================
// Various variables also defined in snd_dma.c
@ -65,18 +65,18 @@ S_Init (void)
{
S_Init_Cvars ();
if (!*snd_output->string || !*snd_render->string) {
Con_Printf ("Not loading sound due to no renderer/output\n");
Sys_Printf ("Not loading sound due to no renderer/output\n");
return;
}
snd_output_module = PI_LoadPlugin ("snd_output", snd_output->string);
if (!snd_output_module) {
Con_Printf ("Loading of sound output module: %s failed!\n",
Sys_Printf ("Loading of sound output module: %s failed!\n",
snd_output->string);
} else {
snd_render_module = PI_LoadPlugin ("snd_render", snd_render->string);
if (!snd_render_module) {
Con_Printf ("Loading of sound render module: %s failed!\n",
Sys_Printf ("Loading of sound render module: %s failed!\n",
snd_render->string);
PI_UnloadPlugin (snd_output_module);
snd_output_module = NULL;

View file

@ -53,7 +53,6 @@
#include <sys/asoundlib.h>
#include <sys/types.h>
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/plugin.h"
#include "QF/qargs.h"
@ -111,11 +110,11 @@ check_card (int card)
snd_ctl_hw_info_t info;
if ((rc = snd_ctl_open (&handle, card)) < 0) {
Con_Printf ("Error: control open (%i): %s\n", card, snd_strerror (rc));
Sys_Printf ("Error: control open (%i): %s\n", card, snd_strerror (rc));
return rc;
}
if ((rc = snd_ctl_hw_info (handle, &info)) < 0) {
Con_Printf ("Error: control hardware info (%i): %s\n", card,
Sys_Printf ("Error: control hardware info (%i): %s\n", card,
snd_strerror (rc));
snd_ctl_close (handle);
return rc;
@ -151,7 +150,7 @@ SNDDMA_Init (void)
mask = snd_cards_mask ();
if (!mask) {
Con_Printf ("No sound cards detected\n");
Sys_Printf ("No sound cards detected\n");
return 0;
}
if (snd_device->string[0]) {
@ -164,14 +163,14 @@ SNDDMA_Init (void)
} else if (i == 8) {
format = SND_PCM_SFMT_U8;
} else {
Con_Printf ("Error: invalid sample bits: %d\n", i);
Sys_Printf ("Error: invalid sample bits: %d\n", i);
return 0;
}
}
if (snd_rate->int_val) {
rate = snd_rate->int_val;
if (rate != 44100 && rate != 22050 && rate != 11025) {
Con_Printf ("Error: invalid sample rate: %d\n", rate);
Sys_Printf ("Error: invalid sample rate: %d\n", rate);
return 0;
}
}
@ -197,22 +196,22 @@ SNDDMA_Init (void)
if ((rc = snd_pcm_open (&pcm_handle, card, dev,
SND_PCM_OPEN_PLAYBACK
| SND_PCM_OPEN_NONBLOCK)) < 0) {
Con_Printf ("Error: audio open error: %s\n",
Sys_Printf ("Error: audio open error: %s\n",
snd_strerror (rc));
return 0;
}
goto dev_openned;
}
}
Con_Printf ("Error: audio open error: %s\n", snd_strerror (rc));
Sys_Printf ("Error: audio open error: %s\n", snd_strerror (rc));
return 0;
dev_openned:
Con_Printf ("Using card %d, device %d.\n", card, dev);
Sys_Printf ("Using card %d, device %d.\n", card, dev);
memset (&cinfo, 0, sizeof (cinfo));
cinfo.channel = SND_PCM_CHANNEL_PLAYBACK;
snd_pcm_channel_info (pcm_handle, &cinfo);
Con_Printf ("%08x %08x %08x\n", cinfo.flags, cinfo.formats, cinfo.rates);
Sys_Printf ("%08x %08x %08x\n", cinfo.flags, cinfo.formats, cinfo.rates);
if ((rate == -1 || rate == 44100) && cinfo.rates & SND_PCM_RATE_44100) {
rate = 44100;
frag_size = 512; /* assuming stereo 8 bit */
@ -225,7 +224,7 @@ SNDDMA_Init (void)
rate = 11025;
frag_size = 128; /* assuming stereo 8 bit */
} else {
Con_Printf ("ALSA: desired rates not supported\n");
Sys_Printf ("ALSA: desired rates not supported\n");
goto error_2;
}
if ((format == -1 || format == SND_PCM_SFMT_S16_LE)
@ -238,7 +237,7 @@ SNDDMA_Init (void)
format = SND_PCM_SFMT_U8;
bps = 8;
} else {
Con_Printf ("ALSA: desired formats not supported\n");
Sys_Printf ("ALSA: desired formats not supported\n");
goto error_2;
}
if (stereo && cinfo.max_voices >= 2) {
@ -302,19 +301,19 @@ SNDDMA_Init (void)
(shm->samplebits / 8); // mono samples in buffer
shm->speed = setup.format.rate;
shm->buffer = (unsigned char *) mmap_data;
Con_Printf ("%5d stereo\n", shm->channels - 1);
Con_Printf ("%5d samples\n", shm->samples);
Con_Printf ("%5d samplepos\n", shm->samplepos);
Con_Printf ("%5d samplebits\n", shm->samplebits);
Con_Printf ("%5d submission_chunk\n", shm->submission_chunk);
Con_Printf ("%5d speed\n", shm->speed);
Con_Printf ("0x%x dma buffer\n", (int) shm->buffer);
Con_Printf ("%5d total_channels\n", total_channels);
Sys_Printf ("%5d stereo\n", shm->channels - 1);
Sys_Printf ("%5d samples\n", shm->samples);
Sys_Printf ("%5d samplepos\n", shm->samplepos);
Sys_Printf ("%5d samplebits\n", shm->samplebits);
Sys_Printf ("%5d submission_chunk\n", shm->submission_chunk);
Sys_Printf ("%5d speed\n", shm->speed);
Sys_Printf ("0x%x dma buffer\n", (int) shm->buffer);
Sys_Printf ("%5d total_channels\n", total_channels);
snd_inited = 1;
return 1;
error:
Con_Printf ("Error: %s: %s\n", err_msg, snd_strerror (rc));
Sys_Printf ("Error: %s: %s\n", err_msg, snd_strerror (rc));
error_2:
snd_pcm_close (pcm_handle);
return 0;

View file

@ -34,11 +34,11 @@
#include <stdio.h>
#include <alsa/asoundlib.h>
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/plugin.h"
#include "QF/qargs.h"
#include "QF/sound.h"
#include "QF/sys.h"
static int snd_inited;
@ -93,14 +93,14 @@ SNDDMA_Init (void)
if (snd_bits->int_val) {
bps = snd_bits->int_val;
if (bps != 16 && bps != 8) {
Con_Printf ("Error: invalid sample bits: %d\n", bps);
Sys_Printf ("Error: invalid sample bits: %d\n", bps);
return 0;
}
}
if (snd_rate->int_val) {
rate = snd_rate->int_val;
if (rate != 44100 && rate != 22050 && rate != 11025) {
Con_Printf ("Error: invalid sample rate: %d\n", rate);
Sys_Printf ("Error: invalid sample rate: %d\n", rate);
return 0;
}
}
@ -109,11 +109,11 @@ SNDDMA_Init (void)
pcmname = "plug:0,0";
if ((err = snd_pcm_open (&pcm, pcmname,
SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) {
Con_Printf ("Error: audio open error: %s\n", snd_strerror (err));
Sys_Printf ("Error: audio open error: %s\n", snd_strerror (err));
return 0;
}
Con_Printf ("Using PCM %s.\n", pcmname);
Sys_Printf ("Using PCM %s.\n", pcmname);
snd_pcm_hw_params_any (pcm, hw);
switch (rate) {
@ -130,7 +130,7 @@ SNDDMA_Init (void)
frag_size = 64; /* assuming stereo 8 bit */
rate = 11025;
} else {
Con_Printf ("ALSA: no useable rates\n");
Sys_Printf ("ALSA: no useable rates\n");
goto error;
}
break;
@ -143,7 +143,7 @@ SNDDMA_Init (void)
}
/* Fall through */
default:
Con_Printf ("ALSA: desired rate not supported\n");
Sys_Printf ("ALSA: desired rate not supported\n");
goto error;
}
@ -157,7 +157,7 @@ SNDDMA_Init (void)
>= 0) {
bps = 8;
} else {
Con_Printf ("ALSA: no useable formats\n");
Sys_Printf ("ALSA: no useable formats\n");
goto error;
}
break;
@ -170,13 +170,13 @@ SNDDMA_Init (void)
}
/* Fall through */
default:
Con_Printf ("ALSA: desired format not supported\n");
Sys_Printf ("ALSA: desired format not supported\n");
goto error;
}
if (snd_pcm_hw_params_set_access (pcm, hw,
SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) {
Con_Printf ("ALSA: interleaved is not supported\n");
Sys_Printf ("ALSA: interleaved is not supported\n");
goto error;
}
@ -187,7 +187,7 @@ SNDDMA_Init (void)
} else if (snd_pcm_hw_params_set_channels (pcm, hw, 1) >= 0) {
stereo = 0;
} else {
Con_Printf ("ALSA: no useable channels\n");
Sys_Printf ("ALSA: no useable channels\n");
goto error;
}
break;
@ -197,7 +197,7 @@ SNDDMA_Init (void)
break;
/* Fall through */
default:
Con_Printf ("ALSA: desired channels not supported\n");
Sys_Printf ("ALSA: desired channels not supported\n");
goto error;
}
@ -205,7 +205,7 @@ SNDDMA_Init (void)
err = snd_pcm_hw_params (pcm, hw);
if (err < 0) {
Con_Printf ("ALSA: unable to install hw params\n");
Sys_Printf ("ALSA: unable to install hw params\n");
goto error;
}
@ -215,7 +215,7 @@ SNDDMA_Init (void)
err = snd_pcm_sw_params (pcm, sw);
if (err < 0) {
Con_Printf ("ALSA: unable to install sw params\n");
Sys_Printf ("ALSA: unable to install sw params\n");
goto error;
}
@ -231,14 +231,14 @@ SNDDMA_Init (void)
shm->samples = buffer_size * shm->channels; // mono samples in buffer
shm->speed = rate;
SNDDMA_GetDMAPos ();//XXX sets shm->buffer
Con_Printf ("%5d stereo\n", shm->channels - 1);
Con_Printf ("%5d samples\n", shm->samples);
Con_Printf ("%5d samplepos\n", shm->samplepos);
Con_Printf ("%5d samplebits\n", shm->samplebits);
Con_Printf ("%5d submission_chunk\n", shm->submission_chunk);
Con_Printf ("%5d speed\n", shm->speed);
Con_Printf ("0x%x dma buffer\n", (int) shm->buffer);
Con_Printf ("%5d total_channels\n", total_channels);
Sys_Printf ("%5d stereo\n", shm->channels - 1);
Sys_Printf ("%5d samples\n", shm->samples);
Sys_Printf ("%5d samplepos\n", shm->samplepos);
Sys_Printf ("%5d samplebits\n", shm->samplebits);
Sys_Printf ("%5d submission_chunk\n", shm->submission_chunk);
Sys_Printf ("%5d speed\n", shm->speed);
Sys_Printf ("0x%x dma buffer\n", (int) shm->buffer);
Sys_Printf ("%5d total_channels\n", total_channels);
snd_inited = 1;
return 1;

View file

@ -45,11 +45,11 @@
#include <stdlib.h>
#include <sys/types.h>
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/plugin.h"
#include "QF/qargs.h"
#include "QF/sound.h"
#include "QF/sys.h"
static int snd_inited;
static VFile *snd_file;
@ -80,14 +80,14 @@ SNDDMA_Init (void)
shm->speed = 44100;
shm->buffer = malloc (shm->samples * shm->channels * shm->samplebits / 8);
Con_Printf ("%5d stereo\n", shm->channels - 1);
Con_Printf ("%5d samples\n", shm->samples);
Con_Printf ("%5d samplepos\n", shm->samplepos);
Con_Printf ("%5d samplebits\n", shm->samplebits);
Con_Printf ("%5d submission_chunk\n", shm->submission_chunk);
Con_Printf ("%5d speed\n", shm->speed);
Con_Printf ("0x%x dma buffer\n", (int) shm->buffer);
Con_Printf ("%5d total_channels\n", total_channels);
Sys_Printf ("%5d stereo\n", shm->channels - 1);
Sys_Printf ("%5d samples\n", shm->samples);
Sys_Printf ("%5d samplepos\n", shm->samplepos);
Sys_Printf ("%5d samplebits\n", shm->samplebits);
Sys_Printf ("%5d submission_chunk\n", shm->submission_chunk);
Sys_Printf ("%5d speed\n", shm->speed);
Sys_Printf ("0x%x dma buffer\n", (int) shm->buffer);
Sys_Printf ("%5d total_channels\n", total_channels);
if (!(snd_file = Qopen ("qf.raw", "wb")))
return 0;

View file

@ -38,8 +38,8 @@
# include <mme/mme_public.h>
#endif
#include "console.h"
#include "sound.h"
#include "QF/sys.h"
// 64K is > 1 second at 16-bit, 11025 Hz
#define WAV_BUFFERS 64
@ -123,7 +123,7 @@ SNDDMA_InitWav ( void )
if ((format = (LPPCMWAVEFORMAT)
mmeAllocMem(sizeof(*format))) == NULL) {
Con_Printf("Failed to allocate PCMWAVEFORMAT struct\n");
Sys_Printf("Failed to allocate PCMWAVEFORMAT struct\n");
return false;
}
@ -155,10 +155,10 @@ SNDDMA_InitWav ( void )
{
if (hr != MMSYSERR_ALLOCATED) {
mmeFreeMem(format);
Con_Printf ("waveOutOpen failed: %d\n", hr);
Sys_Printf ("waveOutOpen failed: %d\n", hr);
return false;
} else {
Con_Printf ("waveOutOpen failed 2222\n");
Sys_Printf ("waveOutOpen failed 2222\n");
}
}
mmeFreeMem(format);
@ -171,7 +171,7 @@ SNDDMA_InitWav ( void )
gSndBufSize = WAV_BUFFERS*WAV_BUFFER_SIZE;
lpData = mmeAllocBuffer(gSndBufSize);
if (!lpData) {
Con_Printf ("Sound: Out of memory.\n");
Sys_Printf ("Sound: Out of memory.\n");
FreeSound ();
return false;
}
@ -186,7 +186,7 @@ SNDDMA_InitWav ( void )
if (lpWaveHdr == NULL)
{
Con_Printf ("Sound: Failed to Alloc header.\n");
Sys_Printf ("Sound: Failed to Alloc header.\n");
FreeSound ();
return false;
}
@ -229,9 +229,9 @@ SNDDMA_Init ( void )
if (snd_iswave) {
if (snd_firsttime)
Con_Printf ("Wave sound initialized\n");
Sys_Printf ("Wave sound initialized\n");
} else {
Con_Printf ("Wave sound failed to init\n");
Sys_Printf ("Wave sound failed to init\n");
}
}
@ -239,7 +239,7 @@ SNDDMA_Init ( void )
if (!wav_init) {
if (snd_firsttime)
Con_Printf ("No sound device initialized\n");
Sys_Printf ("No sound device initialized\n");
return 0;
}
@ -286,7 +286,7 @@ SNDDMA_Submit ( void )
if (mmeCheckForCallbacks()) mmeProcessCallbacks();
if (snd_completed == snd_sent) {
Con_DPrintf ("Sound overrun\n");
Sys_DPrintf ("Sound overrun\n");
}
// submit two new sound blocks
@ -309,7 +309,7 @@ SNDDMA_Submit ( void )
if (wResult != MMSYSERR_NOERROR)
{
Con_Printf ("Failed to write block to device\n");
Sys_Printf ("Failed to write block to device\n");
FreeSound ();
return;
}

View file

@ -53,11 +53,11 @@
#include <sys/wait.h>
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/plugin.h"
#include "QF/qargs.h"
#include "QF/sound.h"
#include "QF/sys.h"
#ifndef MAP_FAILED
# define MAP_FAILED ((void *) -1)
@ -124,34 +124,34 @@ SNDDMA_Init (void)
}
if (audio_fd < 0) {
perror (snd_dev);
Con_Printf ("Could not open %s\n", snd_dev);
Sys_Printf ("Could not open %s\n", snd_dev);
return 0;
}
}
if ((rc = ioctl (audio_fd, SNDCTL_DSP_RESET, 0)) < 0) {
perror (snd_dev);
Con_Printf ("Could not reset %s\n", snd_dev);
Sys_Printf ("Could not reset %s\n", snd_dev);
close (audio_fd);
return 0;
}
if (ioctl (audio_fd, SNDCTL_DSP_GETCAPS, &caps) == -1) {
perror (snd_dev);
Con_Printf ("Sound driver too old\n");
Sys_Printf ("Sound driver too old\n");
close (audio_fd);
return 0;
}
if (!(caps & DSP_CAP_TRIGGER) || !(caps & DSP_CAP_MMAP)) {
Con_Printf ("Sound device can't do memory-mapped I/O.\n");
Sys_Printf ("Sound device can't do memory-mapped I/O.\n");
close (audio_fd);
return 0;
}
if (ioctl (audio_fd, SNDCTL_DSP_GETOSPACE, &info) == -1) {
perror ("GETOSPACE");
Con_Printf ("Um, can't do GETOSPACE?\n");
Sys_Printf ("Um, can't do GETOSPACE?\n");
close (audio_fd);
return 0;
}
@ -200,14 +200,14 @@ SNDDMA_Init (void)
if (shm->buffer == MAP_FAILED) {
perror (snd_dev);
Con_Printf ("Could not mmap %s\n", snd_dev);
Sys_Printf ("Could not mmap %s\n", snd_dev);
close (audio_fd);
return 0;
}
} else {
shm->buffer = malloc (shm->samples * (shm->samplebits / 8) * 2);
if (!shm->buffer) {
Con_Printf ("SNDDMA_Init: memory allocation failure\n");
Sys_Printf ("SNDDMA_Init: memory allocation failure\n");
close (audio_fd);
return 0;
}
@ -219,7 +219,7 @@ SNDDMA_Init (void)
rc = ioctl (audio_fd, SNDCTL_DSP_STEREO, &tmp);
if (rc < 0) {
perror (snd_dev);
Con_Printf ("Could not set %s to stereo=%d", snd_dev, shm->channels);
Sys_Printf ("Could not set %s to stereo=%d", snd_dev, shm->channels);
close (audio_fd);
return 0;
}
@ -232,7 +232,7 @@ SNDDMA_Init (void)
rc = ioctl (audio_fd, SNDCTL_DSP_SPEED, &shm->speed);
if (rc < 0) {
perror (snd_dev);
Con_Printf ("Could not set %s speed to %d", snd_dev, shm->speed);
Sys_Printf ("Could not set %s speed to %d", snd_dev, shm->speed);
close (audio_fd);
return 0;
}
@ -242,7 +242,7 @@ SNDDMA_Init (void)
rc = ioctl (audio_fd, SNDCTL_DSP_SETFMT, &rc);
if (rc < 0) {
perror (snd_dev);
Con_Printf ("Could not support 16-bit data. Try 8-bit.\n");
Sys_Printf ("Could not support 16-bit data. Try 8-bit.\n");
close (audio_fd);
return 0;
}
@ -251,13 +251,13 @@ SNDDMA_Init (void)
rc = ioctl (audio_fd, SNDCTL_DSP_SETFMT, &rc);
if (rc < 0) {
perror (snd_dev);
Con_Printf ("Could not support 8-bit data.\n");
Sys_Printf ("Could not support 8-bit data.\n");
close (audio_fd);
return 0;
}
} else {
perror (snd_dev);
Con_Printf ("%d-bit sound not supported.", shm->samplebits);
Sys_Printf ("%d-bit sound not supported.", shm->samplebits);
close (audio_fd);
return 0;
}
@ -267,7 +267,7 @@ SNDDMA_Init (void)
rc = ioctl (audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp);
if (rc < 0) {
perror (snd_dev);
Con_Printf ("Could not toggle.\n");
Sys_Printf ("Could not toggle.\n");
close (audio_fd);
return 0;
}
@ -275,7 +275,7 @@ SNDDMA_Init (void)
rc = ioctl (audio_fd, SNDCTL_DSP_SETTRIGGER, &tmp);
if (rc < 0) {
perror (snd_dev);
Con_Printf ("Could not toggle.\n");
Sys_Printf ("Could not toggle.\n");
close (audio_fd);
return 0;
}
@ -296,7 +296,7 @@ SNDDMA_GetDMAPos (void)
if (ioctl (audio_fd, SNDCTL_DSP_GETOPTR, &count) == -1) {
perror (snd_dev);
Con_Printf ("Uh, sound dead.\n");
Sys_Printf ("Uh, sound dead.\n");
close (audio_fd);
snd_inited = 0;
return 0;

View file

@ -42,7 +42,6 @@
#include <stdlib.h>
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/plugin.h"
#include "QF/qargs.h"
#include "QF/sound.h"
@ -104,7 +103,7 @@ SNDDMA_Init (void)
snd_inited = 0;
if (SDL_Init (SDL_INIT_AUDIO) < 0) {
Con_Printf ("Couldn't initialize SDL AUDIO: %s\n", SDL_GetError ());
Sys_Printf ("Couldn't initialize SDL AUDIO: %s\n", SDL_GetError ());
return 0;
};
@ -121,7 +120,7 @@ SNDDMA_Init (void)
desired.format = AUDIO_S16LSB;
break;
default:
Con_Printf ("Unknown number of audio bits: %d\n", desired_bits);
Sys_Printf ("Unknown number of audio bits: %d\n", desired_bits);
return 0;
}
desired.channels = 2;
@ -130,7 +129,7 @@ SNDDMA_Init (void)
/* Open the audio device */
if (SDL_OpenAudio (&desired, &obtained) < 0) {
Con_Printf ("Couldn't open SDL audio: %s\n", SDL_GetError ());
Sys_Printf ("Couldn't open SDL audio: %s\n", SDL_GetError ());
return 0;
}
@ -153,7 +152,7 @@ SNDDMA_Init (void)
/* Not supported -- force SDL to do our bidding */
SDL_CloseAudio ();
if (SDL_OpenAudio (&desired, NULL) < 0) {
Con_Printf ("Couldn't open SDL audio: %s\n", SDL_GetError ());
Sys_Printf ("Couldn't open SDL audio: %s\n", SDL_GetError ());
return 0;
}
memcpy (&obtained, &desired, sizeof (desired));

View file

@ -33,11 +33,11 @@
#include <limits.h>
#include <dmedia/audio.h>
#include "QF/console.h"
#include "QF/plugin.h"
#include "QF/qargs.h"
#include "QF/qtypes.h"
#include "QF/sound.h"
#include "QF/sys.h"
static int snd_inited = 0;
static ALconfig alc;
@ -70,7 +70,7 @@ SNDDMA_Init (void)
alc = alNewConfig ();
if (!alc) {
Con_Printf ("Could not make an new sound config: %s\n",
Sys_Printf ("Could not make an new sound config: %s\n",
alGetErrorString (oserror ()));
return 0;
}
@ -81,7 +81,7 @@ SNDDMA_Init (void)
/* get & probe settings */
/* sample format */
if (alSetSampFmt (alc, AL_SAMPFMT_TWOSCOMP) < 0) {
Con_Printf ("Could not sample format of default output to two's "
Sys_Printf ("Could not sample format of default output to two's "
"complement\n");
alFreeConfig (alc);
return 0;
@ -98,7 +98,7 @@ SNDDMA_Init (void)
alpv.param = AL_WORDSIZE;
if (alGetParams (AL_DEFAULT_OUTPUT, &alpv, 1) < 0) {
Con_Printf ("Could not get supported wordsize of default "
Sys_Printf ("Could not get supported wordsize of default "
"output: %s\n", alGetErrorString (oserror ()));
return 0;
}
@ -109,7 +109,7 @@ SNDDMA_Init (void)
if (alpv.value.i >= 8)
shm->samplebits = 8;
else {
Con_Printf ("Sound disabled since interface "
Sys_Printf ("Sound disabled since interface "
"doesn't even support 8 bit.");
alFreeConfig (alc);
return 0;
@ -134,7 +134,7 @@ SNDDMA_Init (void)
}
if (i >= sizeof (tryrates) / sizeof (int)) {
Con_Printf ("Sound disabled since interface doesn't even "
Sys_Printf ("Sound disabled since interface doesn't even "
"support a sample rate of %d\n", tryrates[i - 1]);
alFreeConfig (alc);
return 0;
@ -159,7 +159,7 @@ SNDDMA_Init (void)
/* channels */
while (shm->channels > 0) {
if (alSetChannels (alc, shm->channels) < 0) {
Con_Printf ("Unable to set number of channels to %d, "
Sys_Printf ("Unable to set number of channels to %d, "
"trying half\n", shm->channels);
shm->channels /= 2;
} else
@ -167,7 +167,7 @@ SNDDMA_Init (void)
}
if (shm->channels <= 0) {
Con_Printf ("Sound disabled since interface doesn't even support 1 "
Sys_Printf ("Sound disabled since interface doesn't even support 1 "
"channel\n");
alFreeConfig (alc);
return 0;
@ -178,7 +178,7 @@ SNDDMA_Init (void)
alpv.value.ll = alDoubleToFixed (shm->speed);
if (alSetParams (AL_DEFAULT_OUTPUT, &alpv, 1) < 0) {
Con_Printf ("Could not set samplerate of default output to %d: %s\n",
Sys_Printf ("Could not set samplerate of default output to %d: %s\n",
shm->speed, alGetErrorString (oserror ()));
alFreeConfig (alc);
return 0;
@ -193,7 +193,7 @@ SNDDMA_Init (void)
dma_buffer = malloc (bufsize);
if (dma_buffer == NULL) {
Con_Printf ("Could not get %d bytes of memory for audio dma buffer\n",
Sys_Printf ("Could not get %d bytes of memory for audio dma buffer\n",
bufsize);
alFreeConfig (alc);
return 0;
@ -202,7 +202,7 @@ SNDDMA_Init (void)
write_buffer = malloc (bufsize);
if (write_buffer == NULL) {
Con_Printf ("Could not get %d bytes of memory for audio write "
Sys_Printf ("Could not get %d bytes of memory for audio write "
"buffer\n", bufsize);
free (dma_buffer);
alFreeConfig (alc);
@ -225,7 +225,7 @@ SNDDMA_Init (void)
}
if (alSetWidth (alc, i) < 0) {
Con_Printf ("Could not set wordsize of default output to %d: %s\n",
Sys_Printf ("Could not set wordsize of default output to %d: %s\n",
shm->samplebits, alGetErrorString (oserror ()));
free (write_buffer);
free (dma_buffer);
@ -236,7 +236,7 @@ SNDDMA_Init (void)
alp = alOpenPort ("quakeforge", "w", alc);
if (!alp) {
Con_Printf ("Could not open sound port: %s\n",
Sys_Printf ("Could not open sound port: %s\n",
alGetErrorString (oserror ()));
free (write_buffer);
free (dma_buffer);
@ -259,7 +259,7 @@ SNDDMA_Init (void)
static int
SNDDMA_GetDMAPos (void)
{
/* Con_Printf("framecount: %d %d\n", (framecount * shm->channels) %
/* Sys_Printf("framecount: %d %d\n", (framecount * shm->channels) %
shm->samples, alGetFilled(alp)); */
shm->samplepos = ((framecount - alGetFilled (alp))
* shm->channels) % shm->samples;

View file

@ -46,11 +46,11 @@
#include <sys/types.h>
#include <sys/wait.h>
#include "QF/console.h"
#include "QF/plugin.h"
#include "QF/qargs.h"
#include "QF/qtypes.h"
#include "QF/sound.h"
#include "QF/sys.h"
static int audio_fd;
static int snd_inited;
@ -90,16 +90,16 @@ SNDDMA_Init (void)
if (audio_fd < 0) {
if (errno == EBUSY) {
Con_Printf ("Audio device is being used by another process\n");
Sys_Printf ("Audio device is being used by another process\n");
}
perror ("/dev/audio");
Con_Printf ("Could not open /dev/audio\n");
Sys_Printf ("Could not open /dev/audio\n");
return (0);
}
if (ioctl (audio_fd, AUDIO_GETINFO, &info) < 0) {
perror ("/dev/audio");
Con_Printf ("Could not communicate with audio device.\n");
Sys_Printf ("Could not communicate with audio device.\n");
close (audio_fd);
return 0;
}
@ -126,15 +126,15 @@ SNDDMA_Init (void)
info.play.channels = 1;
info.play.precision = 16;
if (ioctl (audio_fd, AUDIO_SETINFO, &info) < 0) {
Con_Printf ("Incapable sound hardware.\n");
Sys_Printf ("Incapable sound hardware.\n");
close (audio_fd);
return 0;
}
Con_Printf ("16 bit mono sound initialized\n");
Sys_Printf ("16 bit mono sound initialized\n");
shm->samplebits = 16;
shm->channels = 1;
} else { // 16 bit stereo
Con_Printf ("16 bit stereo sound initialized\n");
Sys_Printf ("16 bit stereo sound initialized\n");
shm->samplebits = 16;
shm->channels = 2;
}
@ -158,7 +158,7 @@ SNDDMA_GetDMAPos (void)
if (ioctl (audio_fd, AUDIO_GETINFO, &info) < 0) {
perror ("/dev/audio");
Con_Printf ("Could not communicate with audio device.\n");
Sys_Printf ("Could not communicate with audio device.\n");
close (audio_fd);
snd_inited = 0;
return (0);
@ -175,7 +175,7 @@ SNDDMA_GetSamples (void)
if (ioctl (audio_fd, AUDIO_GETINFO, &info) < 0) {
perror ("/dev/audio");
Con_Printf ("Could not communicate with audio device.\n");
Sys_Printf ("Could not communicate with audio device.\n");
close (audio_fd);
snd_inited = 0;
return (0);

View file

@ -34,8 +34,8 @@
#include "winquake.h"
#include "QF/qargs.h"
#include "QF/console.h"
#include "QF/sound.h"
#include "QF/sys.h"
#define iDirectSoundCreate(a,b,c) pDirectSoundCreate(a,b,c)
@ -198,7 +198,7 @@ static sndinitstat SNDDMA_InitDirect (void)
hInstDS = LoadLibrary ("dsound.dll");
if (hInstDS == NULL) {
Con_Printf ("Couldn't load dsound.dll\n");
Sys_Printf ("Couldn't load dsound.dll\n");
return SIS_FAILURE;
}
@ -206,35 +206,35 @@ static sndinitstat SNDDMA_InitDirect (void)
(void *) GetProcAddress (hInstDS, "DirectSoundCreate");
if (!pDirectSoundCreate) {
Con_Printf ("Couldn't get DS proc addr\n");
Sys_Printf ("Couldn't get DS proc addr\n");
return SIS_FAILURE;
}
}
while ((hresult = iDirectSoundCreate (NULL, &pDS, NULL)) != DS_OK) {
if (hresult != DSERR_ALLOCATED) {
Con_Printf ("DirectSound create failed\n");
Sys_Printf ("DirectSound create failed\n");
return SIS_FAILURE;
}
Con_Printf ("DirectSoundCreate failure\n"
Sys_Printf ("DirectSoundCreate failure\n"
" hardware already in use\n");
return SIS_NOTAVAIL;
}
dscaps.dwSize = sizeof (dscaps);
if (DS_OK != IDirectSound_GetCaps (pDS, &dscaps)) {
Con_Printf ("Couldn't get DS caps\n");
Sys_Printf ("Couldn't get DS caps\n");
}
if (dscaps.dwFlags & DSCAPS_EMULDRIVER) {
Con_Printf ("No DirectSound driver installed\n");
Sys_Printf ("No DirectSound driver installed\n");
FreeSound ();
return SIS_FAILURE;
}
if (DS_OK !=
IDirectSound_SetCooperativeLevel (pDS, mainwindow, DSSCL_EXCLUSIVE)) {
Con_Printf ("Set coop level failed\n");
Sys_Printf ("Set coop level failed\n");
FreeSound ();
return SIS_FAILURE;
}
@ -274,7 +274,7 @@ static sndinitstat SNDDMA_InitDirect (void)
if (DS_OK !=
IDirectSound_CreateSoundBuffer (pDS, &dsbuf, &pDSBuf, NULL)) {
Con_Printf ("DS:CreateSoundBuffer Failed");
Sys_Printf ("DS:CreateSoundBuffer Failed");
FreeSound ();
return SIS_FAILURE;
}
@ -284,7 +284,7 @@ static sndinitstat SNDDMA_InitDirect (void)
shm->speed = format.nSamplesPerSec;
if (DS_OK != IDirectSound_GetCaps (pDSBuf, &dsbcaps)) {
Con_Printf ("DS:GetCaps failed\n");
Sys_Printf ("DS:GetCaps failed\n");
FreeSound ();
return SIS_FAILURE;
}
@ -292,13 +292,13 @@ static sndinitstat SNDDMA_InitDirect (void)
if (DS_OK !=
IDirectSound_SetCooperativeLevel (pDS, mainwindow,
DSSCL_WRITEPRIMARY)) {
Con_Printf ("Set coop level failed\n");
Sys_Printf ("Set coop level failed\n");
FreeSound ();
return SIS_FAILURE;
}
if (DS_OK != IDirectSound_GetCaps (pDSPBuf, &dsbcaps)) {
Con_Printf ("DS:GetCaps failed\n");
Sys_Printf ("DS:GetCaps failed\n");
return SIS_FAILURE;
}
@ -317,13 +317,13 @@ static sndinitstat SNDDMA_InitDirect (void)
(LPVOID *) & lpData, &dwSize,
NULL, NULL, 0)) != DS_OK) {
if (hresult != DSERR_BUFFERLOST) {
Con_Printf ("SNDDMA_InitDirect: DS::Lock Sound Buffer Failed\n");
Sys_Printf ("SNDDMA_InitDirect: DS::Lock Sound Buffer Failed\n");
FreeSound ();
return SIS_FAILURE;
}
if (++reps > 10000) {
Con_Printf ("SNDDMA_InitDirect: DS: couldn't restore buffer\n");
Sys_Printf ("SNDDMA_InitDirect: DS: couldn't restore buffer\n");
FreeSound ();
return SIS_FAILURE;
}
@ -392,10 +392,10 @@ SNDDMA_InitWav (void)
&format, 0, 0L,
CALLBACK_NULL)) != MMSYSERR_NOERROR) {
if (hr != MMSYSERR_ALLOCATED) {
Con_Printf ("waveOutOpen failed\n");
Sys_Printf ("waveOutOpen failed\n");
return false;
}
Con_Printf ("waveOutOpen failure;\n" " hardware already in use\n");
Sys_Printf ("waveOutOpen failure;\n" " hardware already in use\n");
return false;
}
@ -407,13 +407,13 @@ SNDDMA_InitWav (void)
gSndBufSize = WAV_BUFFERS * WAV_BUFFER_SIZE;
hData = GlobalAlloc (GMEM_MOVEABLE | GMEM_SHARE, gSndBufSize);
if (!hData) {
Con_Printf ("Sound: Out of memory.\n");
Sys_Printf ("Sound: Out of memory.\n");
FreeSound ();
return false;
}
lpData = GlobalLock (hData);
if (!lpData) {
Con_Printf ("Sound: Failed to lock.\n");
Sys_Printf ("Sound: Failed to lock.\n");
FreeSound ();
return false;
}
@ -428,7 +428,7 @@ SNDDMA_InitWav (void)
(DWORD) sizeof (WAVEHDR) * WAV_BUFFERS);
if (hWaveHdr == NULL) {
Con_Printf ("Sound: Failed to Alloc header.\n");
Sys_Printf ("Sound: Failed to Alloc header.\n");
FreeSound ();
return false;
}
@ -436,7 +436,7 @@ SNDDMA_InitWav (void)
lpWaveHdr = (LPWAVEHDR) GlobalLock (hWaveHdr);
if (lpWaveHdr == NULL) {
Con_Printf ("Sound: Failed to lock header.\n");
Sys_Printf ("Sound: Failed to lock header.\n");
FreeSound ();
return false;
}
@ -450,7 +450,7 @@ SNDDMA_InitWav (void)
if (waveOutPrepareHeader (hWaveOut, lpWaveHdr + i, sizeof (WAVEHDR)) !=
MMSYSERR_NOERROR) {
Con_Printf ("Sound: failed to prepare wave headers\n");
Sys_Printf ("Sound: failed to prepare wave headers\n");
FreeSound ();
return false;
}
@ -497,10 +497,10 @@ SNDDMA_Init (void)
snd_isdirect = true;
if (snd_firsttime)
Con_Printf ("DirectSound initialized\n");
Sys_Printf ("DirectSound initialized\n");
} else {
snd_isdirect = false;
Con_Printf ("DirectSound failed to init\n");
Sys_Printf ("DirectSound failed to init\n");
}
}
}
@ -515,9 +515,9 @@ SNDDMA_Init (void)
if (snd_iswave) {
if (snd_firsttime)
Con_Printf ("Wave sound initialized\n");
Sys_Printf ("Wave sound initialized\n");
} else {
Con_Printf ("Wave sound failed to init\n");
Sys_Printf ("Wave sound failed to init\n");
}
}
}
@ -526,7 +526,7 @@ SNDDMA_Init (void)
if (!dsound_init && !wav_init) {
if (snd_firsttime)
Con_Printf ("No sound device initialized\n");
Sys_Printf ("No sound device initialized\n");
return 0;
}
@ -582,7 +582,7 @@ SNDDMA_Submit (void)
// find which sound blocks have completed
while (1) {
if (snd_completed == snd_sent) {
Con_DPrintf ("Sound overrun\n");
Sys_DPrintf ("Sound overrun\n");
break;
}
@ -606,7 +606,7 @@ SNDDMA_Submit (void)
wResult = waveOutWrite (hWaveOut, h, sizeof (WAVEHDR));
if (wResult != MMSYSERR_NOERROR) {
Con_Printf ("Failed to write block to device\n");
Sys_Printf ("Failed to write block to device\n");
FreeSound ();
return;
}
@ -644,7 +644,7 @@ DSOUND_LockBuffer (qboolean lockit)
(pDSBuf, 0, gSndBufSize, (LPVOID *) & pbuf1, &dwSize,
(LPVOID *) & pbuf2, &dwSize2, 0)) != DS_OK) {
if (hresult != DSERR_BUFFERLOST) {
Con_Printf
Sys_Printf
("S_TransferStereo16: DS::Lock Sound Buffer Failed\n");
S_Shutdown ();
S_Startup ();
@ -652,7 +652,7 @@ DSOUND_LockBuffer (qboolean lockit)
}
if (++reps > 10000) {
Con_Printf
Sys_Printf
("S_TransferStereo16: DS: couldn't restore buffer\n");
S_Shutdown ();
S_Startup ();
@ -690,7 +690,7 @@ DSOUND_Restore (void)
return;
if (IDirectSoundBuffer_GetStatus (pDSBuf, &dwStatus) != DD_OK)
Con_Printf ("Couldn't get sound buffer status\n");
Sys_Printf ("Couldn't get sound buffer status\n");
if (dwStatus & DSBSTATUS_BUFFERLOST)
IDirectSoundBuffer_Restore (pDSBuf);

View file

@ -39,6 +39,7 @@
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/plugin.h"
#include "QF/sys.h"
int con_linewidth; // characters across screen
@ -48,10 +49,12 @@ void
Con_Init (const char *plugin_name)
{
con_module = PI_LoadPlugin ("console", plugin_name);
if (con_module)
if (con_module) {
con_module->functions->general->p_Init ();
else
Sys_SetPrintf (con_module->functions->console->pC_Print);
} else {
setvbuf (stdout, 0, _IOLBF, BUFSIZ);
}
}
void

View file

@ -43,11 +43,11 @@
#include "QF/clip_hull.h"
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/mathlib.h"
#include "QF/msg.h"
#include "QF/progs.h"
#include "QF/sys.h"
#include "QF/va.h"
#include "QF/zone.h"
@ -58,7 +58,7 @@
/* BUILT-IN FUNCTIONS */
// FIXME: Hunk_TempAlloc, Con_Printf, Cvar_*, PR_SetString, PR_RunError, ED_PrintEdicts, PF_traceon, PF_traceoff, ED_PrintNum, PR_FindBuiltin isn't threadsafe/reentrant
// FIXME: Hunk_TempAlloc, Sys_Printf, Cvar_*, PR_SetString, PR_RunError, ED_PrintEdicts, PF_traceon, PF_traceoff, ED_PrintNum, PR_FindBuiltin isn't threadsafe/reentrant
const char *
@ -209,7 +209,7 @@ PF_random (progs_t *pr)
void
PF_break (progs_t *pr)
{
Con_Printf ("break statement\n");
Sys_Printf ("break statement\n");
*(int *) -4 = 0; // dump to debugger
// PR_RunError (pr, "break statement");
}
@ -265,7 +265,7 @@ PF_cvar_set (progs_t *pr)
var = Cvar_FindAlias (var_name);
if (!var) {
// FIXME: make Con_DPrint?
Con_Printf ("PF_cvar_set: variable %s not found\n", var_name);
Sys_Printf ("PF_cvar_set: variable %s not found\n", var_name);
return;
}
@ -411,7 +411,7 @@ PF_eprint (progs_t *pr)
void
PF_dprint (progs_t *pr)
{
Con_Printf ("%s", PF_VarString (pr, 0));
Sys_Printf ("%s", PF_VarString (pr, 0));
}
void

View file

@ -40,14 +40,13 @@
#include "QF/cmd.h"
#include "compat.h"
#include "QF/console.h"
#include "QF/crc.h"
#include "QF/cvar.h"
#include "QF/hash.h"
#include "QF/progs.h"
#include "QF/qdefs.h"
#include "QF/qendian.h"
#include "QF/sys.h" //XXX
#include "QF/sys.h"
#include "QF/zone.h"
#include "QF/va.h"
#include "QF/vfs.h"
@ -138,7 +137,7 @@ ED_Alloc (progs_t * pr)
}
if (i == max_edicts) {
Con_Printf ("WARNING: ED_Alloc: no free edicts\n");
Sys_Printf ("WARNING: ED_Alloc: no free edicts\n");
i--; // step on whatever is the last edict
e = EDICT_NUM (pr, i);
if (pr->unlink)
@ -165,7 +164,7 @@ ED_FreeRefs (progs_t * pr, edict_t *ed)
def = &pr->pr_globaldefs[i];
if ((def->type & ~DEF_SAVEGLOBAL) == ev_entity) {
if (ed == G_EDICT (pr, def->ofs)) {
Con_Printf ("Reference found to free'd edict: %p\n", ed);
Sys_Printf ("Reference found to free'd edict: %p\n", ed);
}
}
}
@ -175,7 +174,7 @@ ED_FreeRefs (progs_t * pr, edict_t *ed)
for (j = 0; j < *pr->num_edicts; j++) {
k = E_var (EDICT_NUM (pr, j), def->ofs, entity);
if (ed == PROG_TO_EDICT (pr, k))
Con_Printf ("Reference found to free'd edict: %p\n", ed);
Sys_Printf ("Reference found to free'd edict: %p\n", ed);
}
}
}
@ -540,11 +539,11 @@ ED_Print (progs_t * pr, edict_t *ed)
int type;
if (ed->free) {
Con_Printf ("FREE\n");
Sys_Printf ("FREE\n");
return;
}
Con_Printf ("\nEDICT %i:\n", NUM_FOR_EDICT (pr, ed));
Sys_Printf ("\nEDICT %i:\n", NUM_FOR_EDICT (pr, ed));
for (i = 1; i < pr->progs->numfielddefs; i++) {
d = &pr->pr_fielddefs[i];
name = PR_GetString (pr, d->s_name);
@ -580,12 +579,12 @@ ED_Print (progs_t * pr, edict_t *ed)
PR_Error (pr, "ED_Print: Unhandled type %d\n", type);
}
Con_Printf ("%s", name);
Sys_Printf ("%s", name);
l = strlen (name);
while (l++ < 15)
Con_Printf (" ");
Sys_Printf (" ");
Con_Printf ("%s\n", PR_ValueString (pr, d->type, v));
Sys_Printf ("%s\n", PR_ValueString (pr, d->type, v));
}
}
@ -660,11 +659,11 @@ ED_PrintEdicts (progs_t *pr, const char *fieldval)
ED_PrintNum (pr, i);
count++;
}
Con_Printf ("%i entities\n", count);
Sys_Printf ("%i entities\n", count);
} else {
for (i = 0; i < *(pr)->num_edicts; i++)
ED_PrintNum (pr, i);
Con_Printf ("%i entities\n", *(pr)->num_edicts);
Sys_Printf ("%i entities\n", *(pr)->num_edicts);
}
}
@ -699,11 +698,11 @@ ED_Count (progs_t * pr)
models++;
}
Con_Printf ("num_edicts:%3i\n", *(pr)->num_edicts);
Con_Printf ("active :%3i\n", active);
Con_Printf ("view :%3i\n", models);
Con_Printf ("touch :%3i\n", solid);
Con_Printf ("zombie :%3i\n", zombie);
Sys_Printf ("num_edicts:%3i\n", *(pr)->num_edicts);
Sys_Printf ("active :%3i\n", active);
Sys_Printf ("view :%3i\n", models);
Sys_Printf ("touch :%3i\n", solid);
Sys_Printf ("zombie :%3i\n", zombie);
}
/*
@ -771,7 +770,7 @@ ED_ParseGlobals (progs_t * pr, const char *data)
key = PR_FindGlobal (pr, keyname);
if (!key) {
Con_Printf ("'%s' is not a global\n", keyname);
Sys_Printf ("'%s' is not a global\n", keyname);
continue;
}
@ -858,7 +857,7 @@ ED_ParseEpair (progs_t * pr, pr_type_t *base, ddef_t *key, const char *s)
case ev_field:
def = ED_FindField (pr, s);
if (!def) {
Con_Printf ("Can't find field %s\n", s);
Sys_Printf ("Can't find field %s\n", s);
return false;
}
d->integer_var = G_INT (pr, def->ofs);
@ -867,7 +866,7 @@ ED_ParseEpair (progs_t * pr, pr_type_t *base, ddef_t *key, const char *s)
case ev_func:
func = ED_FindFunction (pr, s);
if (!func) {
Con_Printf ("Can't find function %s\n", s);
Sys_Printf ("Can't find function %s\n", s);
return false;
}
d->func_var = func - pr->pr_functions;
@ -949,7 +948,7 @@ ED_ParseEdict (progs_t * pr, const char *data, edict_t *ent)
key = ED_FindField (pr, keyname);
if (!key) {
if (!pr->parse_field || !pr->parse_field (pr, keyname, com_token)) {
Con_Printf ("'%s' is not a field\n", keyname);
Sys_Printf ("'%s' is not a field\n", keyname);
continue;
}
} else {
@ -1025,7 +1024,7 @@ ED_LoadFromFile (progs_t * pr, const char *data)
//
def = ED_FindField (pr, "classname");
if (!def) {
Con_Printf ("No classname for:\n");
Sys_Printf ("No classname for:\n");
ED_Print (pr, ent);
ED_Free (pr, ent);
continue;
@ -1035,7 +1034,7 @@ ED_LoadFromFile (progs_t * pr, const char *data)
func = ED_FindFunction (pr, PR_GetString (pr, classname->string_var));
if (!func) {
Con_Printf ("No spawn function for:\n");
Sys_Printf ("No spawn function for:\n");
ED_Print (pr, ent);
ED_Free (pr, ent);
continue;
@ -1047,7 +1046,7 @@ ED_LoadFromFile (progs_t * pr, const char *data)
pr->flush ();
}
Con_DPrintf ("%i entities inhibited\n", inhibit);
Sys_DPrintf ("%i entities inhibited\n", inhibit);
}
static const char *
@ -1079,7 +1078,7 @@ PR_LoadProgsFile (progs_t * pr, const char *progsname)
return;
pr->progs_size = com_filesize;
Con_DPrintf ("Programs occupy %iK.\n", com_filesize / 1024);
Sys_DPrintf ("Programs occupy %iK.\n", com_filesize / 1024);
// store prog crc
pr->crc = CRC_Block ((byte *) pr->progs, com_filesize);

View file

@ -38,7 +38,6 @@
#include <stdarg.h>
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/mathlib.h"
#include "QF/progs.h"
@ -60,36 +59,36 @@ PR_PrintStatement (progs_t * pr, dstatement_t *s)
const char *source_line = PR_Get_Source_Line (pr, addr);
if (source_line)
Con_Printf ("%s\n", source_line);
Sys_Printf ("%s\n", source_line);
}
Con_Printf ("%-7d ", addr);
Sys_Printf ("%-7d ", addr);
op = PR_Opcode (s->op);
if (!op) {
Con_Printf ("unknown opcode %d\n", s->op);
Sys_Printf ("unknown opcode %d\n", s->op);
return;
}
Con_Printf ("%-9s ", op->opname);
Sys_Printf ("%-9s ", op->opname);
if (s->op == OP_IF || s->op == OP_IFNOT)
Con_Printf ("%sbranch %i (%i)",
Sys_Printf ("%sbranch %i (%i)",
PR_GlobalString (pr, s->a, ev_integer), s->b, addr + s->b);
else if (s->op == OP_GOTO) {
Con_Printf ("branch %i (%i)", s->a, addr + s->a);
Sys_Printf ("branch %i (%i)", s->a, addr + s->a);
} else if (s->op == OP_RETURN || s->op == OP_DONE) {
Con_Printf ("%s", PR_GlobalString (pr, s->a, ev_void));
Sys_Printf ("%s", PR_GlobalString (pr, s->a, ev_void));
} else {
if (op->type_a != ev_void)
Con_Printf ("%s", PR_GlobalString (pr, s->a, op->type_a));
Sys_Printf ("%s", PR_GlobalString (pr, s->a, op->type_a));
if (op->type_b != ev_void) {
if (op->type_c != ev_void)
Con_Printf ("%s", PR_GlobalString (pr, s->b, op->type_b));
Sys_Printf ("%s", PR_GlobalString (pr, s->b, op->type_b));
else
Con_Printf ("%s", PR_GlobalStringNoContents (pr, s->b));
Sys_Printf ("%s", PR_GlobalStringNoContents (pr, s->b));
}
if (op->type_c != ev_void)
Con_Printf ("%s", PR_GlobalStringNoContents (pr, s->c));
Sys_Printf ("%s", PR_GlobalStringNoContents (pr, s->c));
}
Con_Printf ("\n");
Sys_Printf ("\n");
}
void
@ -99,7 +98,7 @@ PR_StackTrace (progs_t * pr)
dfunction_t *f;
if (pr->pr_depth == 0) {
Con_Printf ("<NO STACK>\n");
Sys_Printf ("<NO STACK>\n");
return;
}
@ -108,9 +107,9 @@ PR_StackTrace (progs_t * pr)
f = pr->pr_stack[i].f;
if (!f) {
Con_Printf ("<NO FUNCTION>\n");
Sys_Printf ("<NO FUNCTION>\n");
} else
Con_Printf ("%12s : %s\n", PR_GetString (pr, f->s_file),
Sys_Printf ("%12s : %s\n", PR_GetString (pr, f->s_file),
PR_GetString (pr, f->s_name));
}
}
@ -134,7 +133,7 @@ PR_Profile (progs_t * pr)
}
if (best) {
if (num < 10)
Con_Printf ("%7i %s\n", best->profile,
Sys_Printf ("%7i %s\n", best->profile,
PR_GetString (pr, best->s_name));
num++;
best->profile = 0;
@ -167,7 +166,7 @@ PR_RunError (progs_t * pr, const char *error, ...)
}
PR_PrintStatement (pr, pr->pr_statements + pr->pr_xstatement);
PR_StackTrace (pr);
Con_Printf ("%s\n", string);
Sys_Printf ("%s\n", string);
pr->pr_depth = 0; // dump the stack so PR_Error can
// shutdown functions

View file

@ -35,8 +35,8 @@
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/gib.h"
#include "QF/sys.h"
#include "QF/vfs.h"
#include "compat.h"
@ -63,11 +63,11 @@ GIB_Gib_f (void)
gib_sub_t *sub;
if (!(mod = GIB_Get_ModSub_Mod (Cmd_Argv (1)))) {
Con_Printf ("Module not found!\n");
Sys_Printf ("Module not found!\n");
return;
}
if (!(sub = GIB_Get_ModSub_Sub (Cmd_Argv (1))))
Con_Printf ("Subroutine not found!\n");
Sys_Printf ("Subroutine not found!\n");
else {
gib_subargc = Cmd_Argc () - 1;
gib_subargv[0] = sub->name;
@ -75,7 +75,7 @@ GIB_Gib_f (void)
gib_subargv[i] = Cmd_Argv (i + 1);
ret = GIB_Run_Sub (mod, sub);
if (ret != 0)
Con_Printf ("Error in execution of %s!\nError code: %i\n",
Sys_Printf ("Error in execution of %s!\nError code: %i\n",
Cmd_Argv (1), ret);
}
}
@ -93,5 +93,5 @@ GIB_Load_f (void)
GIB_Module_Load (Cmd_Argv (1), f);
Qclose (f);
} else
Con_Printf ("gibload: File not found.\n");
Sys_Printf ("gibload: File not found.\n");
}

View file

@ -42,9 +42,9 @@
#include <ctype.h>
#include <stdlib.h>
#include "QF/console.h"
#include "QF/cmd.h"
#include "QF/gib.h"
#include "QF/sys.h"
#include "gib_error.h"
#include "gib_instructions.h"
@ -96,7 +96,7 @@ GIB_Init_Instructions (void)
int
GIB_Echo_f (void)
{
Con_Printf (GIB_Argv (1));
Sys_Printf (GIB_Argv (1));
return 0;
}
@ -136,9 +136,9 @@ GIB_VarPrint_f (void)
var = GIB_Var_FindLocal (GIB_Argv (i));
if (!var)
return GIB_E_NOVAR;
Con_Printf ("%s", var->value);
Sys_Printf ("%s", var->value);
}
Con_Printf ("\n");
Sys_Printf ("\n");
return 0;
}

View file

@ -45,8 +45,8 @@
#include <ctype.h>
#include <stdlib.h>
#include "QF/console.h"
#include "QF/gib.h"
#include "QF/sys.h"
#include "QF/vfile.h"
#include "gib_modules.h"
@ -135,7 +135,7 @@ GIB_Read_Sub (gib_sub_t * sub, VFile *f)
Qsetpos (f, &begin);
Qread (f, sub->code, sublen);
sub->code[sublen] = 0;
Con_Printf ("Loaded sub %s\n", sub->name);
Sys_Printf ("Loaded sub %s\n", sub->name);
}
gib_module_t *
@ -172,19 +172,19 @@ GIB_Stats_f (void)
gib_sub_t *sub;
modc = 0;
Con_Printf ("---=== GIB statistics ===---\n");
Sys_Printf ("---=== GIB statistics ===---\n");
for (mod = gibmodules; mod; mod = mod->next) {
Con_Printf ("\nSubroutines for module %s:\n", mod->name);
Con_Printf ("-------------------------------------\n");
Sys_Printf ("\nSubroutines for module %s:\n", mod->name);
Sys_Printf ("-------------------------------------\n");
subc = 0;
for (sub = mod->subs; sub; sub = sub->next) {
Con_Printf ("%s::%s\n", mod->name, sub->name);
Sys_Printf ("%s::%s\n", mod->name, sub->name);
subc++;
}
Con_Printf ("-------------------------------------\nSubroutines: %i\n",
Sys_Printf ("-------------------------------------\nSubroutines: %i\n",
subc);
modc++;
}
Con_Printf ("Modules installed: %i\n", modc);
Con_Printf ("---=== GIB statistics ===---\n");
Sys_Printf ("Modules installed: %i\n", modc);
Sys_Printf ("---=== GIB statistics ===---\n");
}

View file

@ -38,7 +38,6 @@
#include <stdio.h>
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/mdfour.h"
#include "QF/model.h"
@ -330,7 +329,7 @@ BuildTris (void)
add_command (0); // end of list marker
Con_DPrintf ("%3i tri %3i vert %3i cmd\n", pheader->mdl.numtris, numorder,
Sys_DPrintf ("%3i tri %3i vert %3i cmd\n", pheader->mdl.numtris, numorder,
numcommands);
allverts += numorder;
@ -440,7 +439,7 @@ GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s)
}
if (remesh) {
// build it from scratch
Con_DPrintf ("meshing %s...\n", m->name);
Sys_DPrintf ("meshing %s...\n", m->name);
BuildTris (); // trifans or lists

View file

@ -40,7 +40,6 @@
#endif
#include "compat.h"
#include "QF/console.h"
#include "QF/model.h"
#include "QF/qendian.h"
#include "QF/skin.h"
@ -213,7 +212,7 @@ Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
}
} else {
// animating skin group. yuck.
// Con_Printf("Animating Skin Group, if you get this message
// Sys_Printf("Animating Skin Group, if you get this message
// please notify warp@debian.org\n");
pskintype++;
pinskingroup = (daliasskingroup_t *) pskintype;

View file

@ -39,9 +39,9 @@
# include <strings.h>
#endif
#include "QF/console.h"
#include "QF/model.h"
#include "QF/qendian.h"
#include "QF/sys.h"
#include "QF/vfs.h"
#include "QF/GL/qf_textures.h"
@ -89,13 +89,13 @@ Mod_LoadLighting (lump_t *l)
&& data[3] == 'T') {
i = LittleLong (((int *) data)[1]);
if (i == 1) {
Con_DPrintf ("%s loaded", litfilename);
Sys_DPrintf ("%s loaded", litfilename);
loadmodel->lightdata = data + 8;
return;
} else
Con_Printf ("Unknown .lit file version (%d)\n", i);
Sys_Printf ("Unknown .lit file version (%d)\n", i);
} else
Con_Printf ("Corrupt .lit file (old version?), ignoring\n");
Sys_Printf ("Corrupt .lit file (old version?), ignoring\n");
}
// LordHavoc: oh well, expand the white lighting data
if (!l->filelen)

View file

@ -37,7 +37,6 @@
#include "QF/GL/qf_textures.h"
#include "QF/checksum.h"
#include "QF/console.h"
#include "QF/qendian.h"
#include "QF/sys.h"
@ -73,7 +72,7 @@ Mod_Fullbright (byte * skin, int width, int height, char *name)
// ptexels = Hunk_Alloc(s);
ptexels = malloc (pixels);
if (Mod_CalcFullbright (skin, ptexels, pixels)) {
Con_DPrintf ("FB Model ID: '%s'\n", name);
Sys_DPrintf ("FB Model ID: '%s'\n", name);
texnum = GL_LoadTexture (name, width, height, ptexels, true, true, 1);
}
free (ptexels);

View file

@ -41,7 +41,6 @@
# include <strings.h>
#endif
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/model.h"
#include "QF/qendian.h"
@ -238,7 +237,7 @@ Mod_ForName (const char *name, qboolean crash)
mod = Mod_FindName (name);
Con_DPrintf ("Mod_ForName: %s, %p\n", name, mod);
Sys_DPrintf ("Mod_ForName: %s, %p\n", name, mod);
return Mod_LoadModel (mod, crash);
}
@ -261,8 +260,8 @@ Mod_Print (void)
int i;
model_t *mod;
Con_Printf ("Cached models:\n");
Sys_Printf ("Cached models:\n");
for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) {
Con_Printf ("%8p : %s\n", mod->cache.data, mod->name);
Sys_Printf ("%8p : %s\n", mod->cache.data, mod->name);
}
}

View file

@ -39,7 +39,6 @@
#include <ctype.h>
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/hash.h"
#include "QF/qargs.h"
@ -108,7 +107,7 @@ Cbuf_AddText (const char *text)
l = strlen (text);
if (cmd_text.cursize + l >= cmd_text.maxsize) {
Con_Printf ("Cbuf_AddText: overflow\n");
Sys_Printf ("Cbuf_AddText: overflow\n");
return;
}
SZ_Write (&cmd_text, text, strlen (text));
@ -128,7 +127,7 @@ Cbuf_InsertText (const char *text)
textlen = strlen (text);
if (cmd_text.cursize + 1 + textlen >= cmd_text.maxsize) {
Con_Printf ("Cbuf_InsertText: overflow\n");
Sys_Printf ("Cbuf_InsertText: overflow\n");
return;
}
@ -189,7 +188,7 @@ Cbuf_Execute (void)
while (cmd_text.cursize) {
extract_line (line);
// execute the command line
// Con_DPrintf("+%s\n",line),
// Sys_DPrintf("+%s\n",line),
Cmd_ExecuteString (line, src_command);
if (cmd_wait) { // skip out while text still remains
@ -210,10 +209,10 @@ Cbuf_Execute_Sets (void)
extract_line (line);
// execute the command line
if (strnequal (line, "set", 3) && isspace ((int) line[3])) {
// Con_DPrintf ("+%s\n",line);
// Sys_DPrintf ("+%s\n",line);
Cmd_ExecuteString (line, src_command);
} else if (strnequal (line, "setrom", 6) && isspace ((int) line[6])) {
// Con_DPrintf ("+%s\n",line);
// Sys_DPrintf ("+%s\n",line);
Cmd_ExecuteString (line, src_command);
}
}
@ -265,7 +264,7 @@ Cmd_StuffCmds_f (void)
}
}
// Con_Printf("[\n%s]\n",build);
// Sys_Printf("[\n%s]\n",build);
if (build[0])
Cbuf_InsertText (build);
@ -301,19 +300,19 @@ Cmd_Exec_f (void)
int mark;
if (Cmd_Argc () != 2) {
Con_Printf ("exec <filename> : execute a script file\n");
Sys_Printf ("exec <filename> : execute a script file\n");
return;
}
// FIXME: is this safe freeing the hunk here?
mark = Hunk_LowMark ();
f = (char *) COM_LoadHunkFile (Cmd_Argv (1));
if (!f) {
Con_Printf ("couldn't exec %s\n", Cmd_Argv (1));
Sys_Printf ("couldn't exec %s\n", Cmd_Argv (1));
return;
}
if (!Cvar_Command () && ((cl_warncmd && cl_warncmd->int_val)
|| (developer && developer->int_val)))
Con_Printf ("execing %s\n", Cmd_Argv (1));
Sys_Printf ("execing %s\n", Cmd_Argv (1));
Cbuf_InsertText (f);
Hunk_FreeToLowMark (mark);
@ -330,8 +329,8 @@ Cmd_Echo_f (void)
int i;
for (i = 1; i < Cmd_Argc (); i++)
Con_Printf ("%s ", Cmd_Argv (i));
Con_Printf ("\n");
Sys_Printf ("%s ", Cmd_Argv (i));
Sys_Printf ("\n");
}
/*
@ -358,9 +357,9 @@ Cmd_Alias_f (void)
const char *s;
if (Cmd_Argc () == 1) {
Con_Printf ("Current alias commands:\n");
Sys_Printf ("Current alias commands:\n");
for (alias = cmd_alias; alias; alias = alias->next)
Con_Printf ("%s : %s\n", alias->name, alias->value);
Sys_Printf ("%s : %s\n", alias->name, alias->value);
return;
}
@ -403,7 +402,7 @@ Cmd_UnAlias_f (void)
const char *s;
if (Cmd_Argc () != 2) {
Con_Printf ("unalias <alias>: erase an existing alias\n");
Sys_Printf ("unalias <alias>: erase an existing alias\n");
return;
}
@ -421,7 +420,7 @@ Cmd_UnAlias_f (void)
free ((char*)alias->value);
free (alias);
} else {
Con_Printf ("Unknown alias \"%s\"\n", s);
Sys_Printf ("Unknown alias \"%s\"\n", s);
}
}
@ -514,7 +513,7 @@ Cmd_TokenizeString (const char *text)
if (cmd_argc < MAX_ARGS) {
if (argv_idx + strlen (com_token) + 1 > MAX_COM_TOKEN) {
Con_Printf ("Cmd_TokenizeString: overflow\n");
Sys_Printf ("Cmd_TokenizeString: overflow\n");
return;
}
cmd_argv[cmd_argc] = argv_buf + argv_idx;
@ -534,13 +533,13 @@ Cmd_AddCommand (const char *cmd_name, xcommand_t function, const char *descripti
// fail if the command is a variable name
if (Cvar_FindVar (cmd_name)) {
Con_Printf ("Cmd_AddCommand: %s already defined as a var\n", cmd_name);
Sys_Printf ("Cmd_AddCommand: %s already defined as a var\n", cmd_name);
return;
}
// fail if the command already exists
cmd = (cmd_function_t*)Hash_Find (cmd_hash, cmd_name);
if (cmd) {
Con_Printf ("Cmd_AddCommand: %s already defined\n", cmd_name);
Sys_Printf ("Cmd_AddCommand: %s already defined\n", cmd_name);
return;
}
@ -860,7 +859,7 @@ Cmd_ExecuteString (const char *text, cmd_source_t src)
}
if (cl_warncmd->int_val || developer->int_val)
Con_Printf ("Unknown command \"%s\"\n", Cmd_Argv (0));
Sys_Printf ("Unknown command \"%s\"\n", Cmd_Argv (0));
}
/*
@ -895,13 +894,13 @@ Cmd_CmdList_f (void)
show_description = 1;
for (cmd = cmd_functions, i = 0; cmd; cmd = cmd->next, i++) {
if (show_description) {
Con_Printf ("%-20s :\n%s\n", cmd->name, cmd->description);
Sys_Printf ("%-20s :\n%s\n", cmd->name, cmd->description);
} else {
Con_Printf ("%s\n", cmd->name);
Sys_Printf ("%s\n", cmd->name);
}
}
Con_Printf ("------------\n%d commands\n", i);
Sys_Printf ("------------\n%d commands\n", i);
}
void
@ -912,7 +911,7 @@ Cmd_Help_f (void)
cmd_function_t *cmd;
if (Cmd_Argc () != 2) {
Con_Printf ("usage: help <cvar/command>\n");
Sys_Printf ("usage: help <cvar/command>\n");
return;
}
@ -922,7 +921,7 @@ Cmd_Help_f (void)
cmd = cmd->next)
;
if (cmd) {
Con_Printf ("%s\n", cmd->description);
Sys_Printf ("%s\n", cmd->description);
return;
}
@ -930,11 +929,11 @@ Cmd_Help_f (void)
if (!var)
var = Cvar_FindAlias (name);
if (var) {
Con_Printf ("%s\n", var->description);
Sys_Printf ("%s\n", var->description);
return;
}
Con_Printf ("variable/command not found\n");
Sys_Printf ("variable/command not found\n");
}
static void

View file

@ -34,18 +34,11 @@
#include "QF/sys.h"
/*
Con_Print
Handles cursor positioning, line wrapping, etc
All console printing must go through this in order to be logged to disk
If no console is visible, the notify window will pop up.
*/
void
QFutil_Con_Print (char *txt)
QFutil_Con_Print (const char *fmt, va_list args)
{
// echo to debugging console
Sys_Printf ("%s", txt);
vfprintf (stdout, fmt, args);
}
void Con_Print (const char *) __attribute ((weak, alias ("QFutil_Con_Print")));
void Con_Print (const char *, va_list)
__attribute ((weak, alias ("QFutil_Con_Print")));

View file

@ -56,14 +56,10 @@ void
Con_Printf (const char *fmt, ...)
{
va_list argptr;
char msg[MAXPRINTMSG];
va_start (argptr, fmt);
vsnprintf (msg, sizeof (msg), fmt, argptr);
Con_Print (fmt, argptr);
va_end (argptr);
// write it to the scrollable buffer
Con_Print (msg);
}
/*
@ -75,17 +71,14 @@ void
Con_DPrintf (const char *fmt, ...)
{
va_list argptr;
char msg[MAXPRINTMSG];
if (!developer->int_val)
return; // don't confuse non-developers with
// techie stuff...
va_start (argptr, fmt);
vsnprintf (msg, sizeof (msg), fmt, argptr);
Con_Print (fmt, argptr);
va_end (argptr);
Con_Print (msg);
}
/*

View file

@ -42,10 +42,10 @@
#include <stdlib.h>
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/hash.h"
#include "QF/qargs.h"
#include "QF/sys.h"
#include "QF/vfs.h"
#include "compat.h"
@ -86,11 +86,11 @@ Cvar_Alias_Get (const char *name, cvar_t *cvar)
cvar_t *var;
if (Cmd_Exists (name)) {
Con_Printf ("CAlias_Get: %s is a command\n", name);
Sys_Printf ("CAlias_Get: %s is a command\n", name);
return;
}
if (Cvar_FindVar (name)) {
Con_Printf ("CAlias_Get: tried to alias used cvar name %s\n", name);
Sys_Printf ("CAlias_Get: tried to alias used cvar name %s\n", name);
return;
}
var = Cvar_FindAlias (name);
@ -232,7 +232,7 @@ Cvar_Set (cvar_t *var, const char *value)
return;
if (var->flags & CVAR_ROM) {
Con_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n", var->name);
Sys_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n", var->name);
return;
}
@ -307,7 +307,7 @@ Cvar_Command (void)
// perform a variable print or set
if (Cmd_Argc () == 1) {
Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->string);
Sys_Printf ("\"%s\" is \"%s\"\n", v->name, v->string);
return true;
}
@ -339,7 +339,7 @@ Cvar_Set_f (void)
const char *var_name;
if (Cmd_Argc () != 3) {
Con_Printf ("usage: set <cvar> <value>\n");
Sys_Printf ("usage: set <cvar> <value>\n");
return;
}
var_name = Cmd_Argv (1);
@ -351,7 +351,7 @@ Cvar_Set_f (void)
if (var) {
if (var->flags & CVAR_ROM) {
Con_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n",
Sys_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n",
var_name);
} else {
Cvar_Set (var, value);
@ -370,7 +370,7 @@ Cvar_Setrom_f (void)
const char *var_name;
if (Cmd_Argc () != 3) {
Con_Printf ("usage: setrom <cvar> <value>\n");
Sys_Printf ("usage: setrom <cvar> <value>\n");
return;
}
var_name = Cmd_Argv (1);
@ -382,7 +382,7 @@ Cvar_Setrom_f (void)
if (var) {
if (var->flags & CVAR_ROM) {
Con_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n",
Sys_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n",
var_name);
} else {
Cvar_Set (var, value);
@ -400,7 +400,7 @@ Cvar_Toggle_f (void)
cvar_t *var;
if (Cmd_Argc () != 2) {
Con_Printf ("toggle <cvar> : toggle a cvar on/off\n");
Sys_Printf ("toggle <cvar> : toggle a cvar on/off\n");
return;
}
@ -408,7 +408,7 @@ Cvar_Toggle_f (void)
if (!var)
var = Cvar_FindAlias (Cmd_Argv (1));
if (!var) {
Con_Printf ("Unknown variable \"%s\"\n", Cmd_Argv (1));
Sys_Printf ("Unknown variable \"%s\"\n", Cmd_Argv (1));
return;
}
@ -425,18 +425,18 @@ Cvar_CvarList_f (void)
if (Cmd_Argc () > 1)
showhelp = 1;
for (var = cvar_vars, i = 0; var; var = var->next, i++) {
Con_Printf ("%c%c%c%c ",
Sys_Printf ("%c%c%c%c ",
var->flags & CVAR_ROM ? 'r' : ' ',
var->flags & CVAR_ARCHIVE ? '*' : ' ',
var->flags & CVAR_USERINFO ? 'u' : ' ',
var->flags & CVAR_SERVERINFO ? 's' : ' ');
if (showhelp)
Con_Printf ("%-20s : %s\n", var->name, var->description);
Sys_Printf ("%-20s : %s\n", var->name, var->description);
else
Con_Printf ("%s\n", var->name);
Sys_Printf ("%s\n", var->name);
}
Con_Printf ("------------\n%d variables\n", i);
Sys_Printf ("------------\n%d variables\n", i);
}
static void
@ -525,7 +525,7 @@ Cvar_Get (const char *name, const char *string, int cvarflags,
cvar_t *var;
if (Cmd_Exists (name)) {
Con_Printf ("Cvar_Get: %s is a command\n", name);
Sys_Printf ("Cvar_Get: %s is a command\n", name);
return NULL;
}
var = Cvar_FindVar (name);

View file

@ -39,8 +39,8 @@
#include <stdio.h>
#include <ctype.h>
#include "QF/console.h"
#include "QF/info.h"
#include "QF/sys.h"
#include "compat.h"
@ -119,7 +119,7 @@ Info_RemoveKey (char *s, const char *key)
char *o;
if (strstr (key, "\\")) {
Con_Printf ("Can't use a key with a \\\n");
Sys_Printf ("Can't use a key with a \\\n");
return;
}
@ -205,17 +205,17 @@ Info_SetValueForStarKey (char *s, const char *key, const char *value, size_t max
int c;
if (strstr (key, "\\") || strstr (value, "\\")) {
Con_Printf ("Can't use keys or values with a \\\n");
Sys_Printf ("Can't use keys or values with a \\\n");
return;
}
if (strstr (key, "\"") || strstr (value, "\"")) {
Con_Printf ("Can't use keys or values with a \"\n");
Sys_Printf ("Can't use keys or values with a \"\n");
return;
}
if (strlen (key) > 63 || strlen (value) > 63) {
Con_Printf ("Keys and values must be < 64 characters.\n");
Sys_Printf ("Keys and values must be < 64 characters.\n");
return;
}
// this next line is kinda trippy
@ -224,7 +224,7 @@ Info_SetValueForStarKey (char *s, const char *key, const char *value, size_t max
// don't,
// don't change it!
if (strlen (value) - strlen (v) + strlen (s) > maxsize) {
Con_Printf ("Info string length exceeded\n");
Sys_Printf ("Info string length exceeded\n");
return;
}
}
@ -235,7 +235,7 @@ Info_SetValueForStarKey (char *s, const char *key, const char *value, size_t max
snprintf (newstr, sizeof (newstr), "\\%s\\%s", key, value);
if ((int) (strlen (newstr) + strlen (s)) > maxsize) {
Con_Printf ("Info string length exceeded\n");
Sys_Printf ("Info string length exceeded\n");
return;
}
// only copy ascii values
@ -263,7 +263,7 @@ Info_SetValueForKey (char *s, const char *key, const char *value,
size_t maxsize, int flags)
{
if (key[0] == '*') {
Con_Printf ("Can't set * keys\n");
Sys_Printf ("Can't set * keys\n");
return;
}
@ -291,10 +291,10 @@ Info_Print (const char *s)
key[20] = 0;
} else
*o = 0;
Con_Printf ("%s", key);
Sys_Printf ("%s", key);
if (!*s) {
Con_Printf ("MISSING VALUE\n");
Sys_Printf ("MISSING VALUE\n");
return;
}
@ -306,7 +306,7 @@ Info_Print (const char *s)
if (*s)
s++;
Con_Printf ("%s\n", value);
Sys_Printf ("%s\n", value);
}
}

View file

@ -36,10 +36,10 @@
# include <strings.h>
#endif
#include "QF/console.h"
#include "QF/pcx.h"
#include "QF/qendian.h"
#include "QF/qtypes.h"
#include "QF/sys.h"
#include "QF/texture.h"
#include "QF/vfs.h"
#include "QF/zone.h"
@ -78,7 +78,7 @@ LoadPCX (VFile *f, int convert, byte *pal)
|| pcx->version != 5
|| pcx->encoding != 1
|| pcx->bits_per_pixel != 8 || pcx->xmax >= 320 || pcx->ymax >= 256) {
Con_Printf ("Bad pcx file\n");
Sys_Printf ("Bad pcx file\n");
return 0;
}
@ -138,7 +138,7 @@ LoadPCX (VFile *f, int convert, byte *pal)
}
Hunk_FreeToLowMark (pcx_mark);
if (count || runLength) {
Con_Printf ("PCX was malformed. You should delete it.\n");
Sys_Printf ("PCX was malformed. You should delete it.\n");
return 0;
}
return tex;
@ -153,7 +153,7 @@ EncodePCX (byte * data, int width, int height,
byte *pack;
if (!(pcx = Hunk_TempAlloc (width * height * 2 + 1000))) {
Con_Printf ("EncodePCX: not enough memory\n");
Sys_Printf ("EncodePCX: not enough memory\n");
return 0;
}

View file

@ -55,7 +55,7 @@
#include "QF/cvar.h"
#include "QF/plugin.h"
#include "QF/console.h"
#include "QF/sys.h"
#include "compat.h"
@ -119,13 +119,13 @@ PI_LoadPlugin (const char *type, const char *name)
#if defined(HAVE_DLOPEN)
if (!(dlhand = dlopen (realname, RTLD_GLOBAL | RTLD_NOW))) {
// lib not found
Con_Printf ("Could not load plugin \"%s\": %s\n", realname,
Sys_Printf ("Could not load plugin \"%s\": %s\n", realname,
dlerror ());
return NULL;
}
#elif defined (_WIN32)
if (!(dlhand = LoadLibrary (realname))) { // lib not found
Con_Printf ("Could not load plugin \"%s\".\n", realname);
Sys_Printf ("Could not load plugin \"%s\".\n", realname);
return NULL;
}
#endif
@ -134,7 +134,7 @@ PI_LoadPlugin (const char *type, const char *name)
if (!(plugin_info = dlsym (dlhand, plugin_info_name))) {
// info function not found
dlclose (dlhand);
Con_Printf ("Plugin info function not found\n");
Sys_Printf ("Plugin info function not found\n");
return NULL;
}
#elif defined (_WIN32)
@ -142,7 +142,7 @@ PI_LoadPlugin (const char *type, const char *name)
plugin_info_name))) {
// info function not found
FreeLibrary (dlhand);
Con_Printf ("Plugin info function not found\n");
Sys_Printf ("Plugin info function not found\n");
return NULL;
}
#endif
@ -153,7 +153,7 @@ PI_LoadPlugin (const char *type, const char *name)
#elif defined (_WIN32)
FreeLibrary (dlhand);
#endif
Con_Printf ("Something went badly wrong.\n");
Sys_Printf ("Something went badly wrong.\n");
return NULL;
}
@ -170,7 +170,7 @@ PI_UnloadPlugin (plugin_t *plugin)
&& plugin->functions->general->p_Shutdown) {
plugin->functions->general->p_Shutdown ();
} else {
Con_Printf ("Warning: No shutdown function for type %d plugin!\n", plugin->type);
Sys_Printf ("Warning: No shutdown function for type %d plugin!\n", plugin->type);
}
#if defined(HAVE_DLOPEN)
return (dlclose (plugin->handle) == 0);

View file

@ -42,7 +42,6 @@
#include <stdlib.h>
#include <assert.h>
#include "QF/console.h"
#include "QF/cmd.h"
#include "QF/crc.h"
#include "QF/qtypes.h"

View file

@ -62,7 +62,6 @@
#include <limits.h>
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/hash.h"
#include "QF/qargs.h"
@ -225,15 +224,15 @@ COM_Path_f (void)
{
searchpath_t *s;
Con_Printf ("Current search path:\n");
Sys_Printf ("Current search path:\n");
for (s = com_searchpaths; s; s = s->next) {
if (s == com_base_searchpaths)
Con_Printf ("----------\n");
Sys_Printf ("----------\n");
if (s->pack)
Con_Printf ("%s (%i files)\n", s->pack->filename,
Sys_Printf ("%s (%i files)\n", s->pack->filename,
s->pack->numfiles);
else
Con_Printf ("%s\n", s->filename);
Sys_Printf ("%s\n", s->filename);
}
}
@ -305,12 +304,12 @@ maplist_print (struct maplist *maplist)
for (i = 0; i < maplist->count - 1; i++) {
name = maplist->list[i];
end = strstr (name, ".bsp");
Con_Printf ("%-8.*s%c", end - name, name,
Sys_Printf ("%-8.*s%c", end - name, name,
((i + 1) % 4) ? ' ' : '\n');
}
name = maplist->list[i];
end = strstr (name, ".bsp");
Con_Printf ("%-9.*s\n", end - name, name);
Sys_Printf ("%-9.*s\n", end - name, name);
}
}
@ -333,7 +332,7 @@ COM_Maplist_f (void)
pack_t *pak = search->pack;
struct maplist *maplist = maplist_new ();
Con_Printf ("Looking in %s...\n", search->pack->filename);
Sys_Printf ("Looking in %s...\n", search->pack->filename);
for (i = 0; i < pak->numfiles; i++) {
char *name = pak->files[i].name;
@ -348,7 +347,7 @@ COM_Maplist_f (void)
snprintf (buf, sizeof (buf), "%s/maps", search->filename);
dir_ptr = opendir (buf);
Con_Printf ("Looking in %s...\n", buf);
Sys_Printf ("Looking in %s...\n", buf);
if (!dir_ptr)
continue;
while ((dirent = readdir (dir_ptr)))
@ -578,7 +577,7 @@ _COM_FOpenFile (const char *filename, VFile **gzfile, char *foundname, int zip)
// make sure they're not trying to do wierd stuff with our private files
if (contains_updir(filename)) {
Con_Printf ("FindFile: %s: attempt to escape directory tree!\n", filename);
Sys_Printf ("FindFile: %s: attempt to escape directory tree!\n", filename);
goto error;
}
@ -596,7 +595,7 @@ _COM_FOpenFile (const char *filename, VFile **gzfile, char *foundname, int zip)
gzfilename);
#endif
if (packfile) {
Con_DPrintf ("PackFile: %s : %s\n", search->pack->filename,
Sys_DPrintf ("PackFile: %s : %s\n", search->pack->filename,
packfile->name);
// open a new file on the pakfile
strncpy (foundname, packfile->name, MAX_OSPATH);
@ -625,7 +624,7 @@ _COM_FOpenFile (const char *filename, VFile **gzfile, char *foundname, int zip)
continue;
}
Con_DPrintf ("FindFile: %s\n", netpath);
Sys_DPrintf ("FindFile: %s\n", netpath);
*gzfile = COM_OpenRead (netpath, -1, -1, zip);
return com_filesize;
@ -633,7 +632,7 @@ _COM_FOpenFile (const char *filename, VFile **gzfile, char *foundname, int zip)
}
Con_DPrintf ("FindFile: can't find %s\n", filename);
Sys_DPrintf ("FindFile: can't find %s\n", filename);
error:
*gzfile = NULL;
com_filesize = -1;
@ -796,7 +795,7 @@ COM_LoadPackFile (char *packfile)
pack->files = newfiles;
pack->file_hash = hash;
Con_Printf ("Added packfile %s (%i files)\n", packfile, numpackfiles);
Sys_Printf ("Added packfile %s (%i files)\n", packfile, numpackfiles);
return pack;
}
@ -846,7 +845,7 @@ COM_LoadGameDirectory (const char *dir)
char **pakfiles = NULL;
int i = 0, bufsize = 0, count = 0;
Con_DPrintf ("COM_LoadGameDirectory (\"%s\")\n", dir);
Sys_DPrintf ("COM_LoadGameDirectory (\"%s\")\n", dir);
pakfiles = calloc (1, FBLOCK_SIZE * sizeof (char *));
@ -952,7 +951,7 @@ COM_AddDirectory (const char *dir)
void
COM_AddGameDirectory (const char *dir)
{
Con_DPrintf ("COM_AddGameDirectory (\"%s/%s\")\n",
Sys_DPrintf ("COM_AddGameDirectory (\"%s/%s\")\n",
fs_sharepath->string, dir);
if (strcmp (fs_sharepath->string, fs_userpath->string) != 0)
@ -972,7 +971,7 @@ COM_Gamedir (const char *dir)
if (strstr (dir, "..") || strstr (dir, "/")
|| strstr (dir, "\\") || strstr (dir, ":")) {
Con_Printf ("Gamedir should be a single filename, not a path\n");
Sys_Printf ("Gamedir should be a single filename, not a path\n");
return;
}

View file

@ -36,7 +36,6 @@
# include <strings.h>
#endif
#include "QF/console.h"
#include "QF/sizebuf.h"
#include "QF/sys.h"
#include "QF/zone.h"
@ -72,7 +71,7 @@ SZ_GetSpace (sizebuf_t *buf, int length)
if (length > buf->maxsize)
Sys_Error ("SZ_GetSpace: %i is > full buffer size", length);
Con_Printf ("SZ_GetSpace: overflow\n");
Sys_Printf ("SZ_GetSpace: overflow\n");
SZ_Clear (buf);
buf->overflowed = true;
}

View file

@ -191,6 +191,18 @@ Sys_Printf (const char *fmt, ...)
va_end (args);
}
void
Sys_DPrintf (const char *fmt, ...)
{
va_list args;
if (!developer || !developer->int_val)
return;
va_start (args, fmt);
sys_printf_function (fmt, args);
va_end (args);
}
double
Sys_DoubleTime (void)
{

View file

@ -54,7 +54,6 @@
#endif
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/qargs.h"
#include "QF/sys.h"
@ -231,21 +230,21 @@ Z_Print (memzone_t *zone)
{
memblock_t *block;
Con_Printf ("zone size: %i location: %p\n",zone->size,zone);
Sys_Printf ("zone size: %i location: %p\n",zone->size,zone);
for (block = zone->blocklist.next ; ; block = block->next)
{
Con_Printf ("block:%p size:%7i tag:%3i\n",
Sys_Printf ("block:%p size:%7i tag:%3i\n",
block, block->size, block->tag);
if (block->next == &zone->blocklist)
break; // all blocks have been hit
if ( (byte *)block + block->size != (byte *)block->next)
Con_Printf ("ERROR: block size does not touch the next block\n");
Sys_Printf ("ERROR: block size does not touch the next block\n");
if ( block->next->prev != block)
Con_Printf ("ERROR: next block doesn't have proper back link\n");
Sys_Printf ("ERROR: next block doesn't have proper back link\n");
if (!block->tag && !block->next->tag)
Con_Printf ("ERROR: two consecutive free blocks\n");
Sys_Printf ("ERROR: two consecutive free blocks\n");
}
}
@ -332,16 +331,16 @@ Hunk_Print (qboolean all)
starthigh = (hunk_t *) (hunk_base + hunk_size - hunk_high_used);
endhigh = (hunk_t *) (hunk_base + hunk_size);
Con_Printf (" :%8i total hunk size\n", hunk_size);
Con_Printf ("-------------------------\n");
Sys_Printf (" :%8i total hunk size\n", hunk_size);
Sys_Printf ("-------------------------\n");
while (1) {
// skip to the high hunk if done with low hunk
if (h == endlow) {
Con_Printf ("-------------------------\n");
Con_Printf (" :%8i REMAINING\n",
Sys_Printf ("-------------------------\n");
Sys_Printf (" :%8i REMAINING\n",
hunk_size - hunk_low_used - hunk_high_used);
Con_Printf ("-------------------------\n");
Sys_Printf ("-------------------------\n");
h = starthigh;
}
// if totally done, break
@ -362,13 +361,13 @@ Hunk_Print (qboolean all)
// print the single block
memcpy (name, h->name, 8);
if (all)
Con_Printf ("%8p :%8i %8s\n", h, h->size, name);
Sys_Printf ("%8p :%8i %8s\n", h, h->size, name);
// print the total
if (next == endlow || next == endhigh ||
strncmp (h->name, next->name, 8)) {
if (!all)
Con_Printf (" :%8i %8s (TOTAL)\n", sum, name);
Sys_Printf (" :%8i %8s (TOTAL)\n", sum, name);
count = 0;
sum = 0;
}
@ -376,8 +375,8 @@ Hunk_Print (qboolean all)
h = next;
}
Con_Printf ("-------------------------\n");
Con_Printf ("%8i total blocks\n", totalblocks);
Sys_Printf ("-------------------------\n");
Sys_Printf ("%8i total blocks\n", totalblocks);
}
void *
@ -486,7 +485,7 @@ Hunk_HighAllocName (int size, const char *name)
size = sizeof (hunk_t) + ((size + 15) & ~15);
if (hunk_size - hunk_low_used - hunk_high_used < size) {
Con_Printf ("Hunk_HighAlloc: failed on %i bytes\n", size);
Sys_Printf ("Hunk_HighAlloc: failed on %i bytes\n", size);
return NULL;
}
@ -566,7 +565,7 @@ Cache_Move (cache_system_t * c)
// we are clearing up space at the bottom, so only allocate it late
new = Cache_TryAlloc (c->size, true);
if (new) {
Con_DPrintf ("cache_move ok\n");
Sys_DPrintf ("cache_move ok\n");
memcpy (new + 1, c + 1, c->size - sizeof (cache_system_t));
new->user = c->user;
@ -574,7 +573,7 @@ Cache_Move (cache_system_t * c)
Cache_RealFree (c->user);
new->user->data = (void *) (new + 1);
} else {
Con_DPrintf ("cache_move failed\n");
Sys_DPrintf ("cache_move failed\n");
Cache_RealFree (c->user); // tough luck...
}
@ -683,7 +682,7 @@ Cache_TryAlloc (int size, qboolean nobottom)
if (!nobottom && cache_head.prev == &cache_head) {
if (hunk_size - hunk_high_used - hunk_low_used < size) {
Con_Printf ("Cache_TryAlloc: %i is greater then free hunk", size);
Sys_Printf ("Cache_TryAlloc: %i is greater then free hunk", size);
return NULL;
}
@ -787,7 +786,7 @@ Cache_Print (void)
CACHE_WRITE_LOCK;
for (cd = cache_head.next; cd != &cache_head; cd = cd->next) {
Con_Printf ("%8i : %s\n", cd->size, cd->name);
Sys_Printf ("%8i : %s\n", cd->size, cd->name);
}
CACHE_WRITE_UNLOCK;
}
@ -796,7 +795,7 @@ void
Cache_Report (void)
{
CACHE_WRITE_LOCK;
Con_DPrintf ("%4.1f megabyte data cache\n",
Sys_DPrintf ("%4.1f megabyte data cache\n",
(hunk_size - hunk_high_used -
hunk_low_used) / (float) (1024 * 1024));
CACHE_WRITE_UNLOCK;
@ -842,7 +841,7 @@ Cache_RealFree (cache_user_t *c)
cs = ((cache_system_t *) c->data) - 1;
Con_DPrintf ("Cache_Free: freeing '%s'\n", cs->name);
Sys_DPrintf ("Cache_Free: freeing '%s'\n", cs->name);
cs->prev->next = cs->next;
cs->next->prev = cs->prev;
@ -946,18 +945,18 @@ Cache_Profile (void)
count++;
cs = cs->next;
}
Con_Printf ("Cache Profile:\n");
Con_Printf ("%8s %8s %8s %8s %8s\n",
Sys_Printf ("Cache Profile:\n");
Sys_Printf ("%8s %8s %8s %8s %8s\n",
"count", "min", "max", "average", "percent");
for (i = 0; i < 31; i++) {
if (!items[i])
continue;
Con_Printf ("%8d %8d %8d %8d %7d%%\n",
Sys_Printf ("%8d %8d %8d %8d %7d%%\n",
items[i], 1 << i, (1 << (i + 1)) - 1,
sizes[i] / items[i],
(sizes[i] * 100) / total);
}
Con_Printf ("Total allocations: %d in %d allocations, average of"
Sys_Printf ("Total allocations: %d in %d allocations, average of"
" %d per allocation\n", total, count, total / count);
CACHE_WRITE_UNLOCK;

View file

@ -221,6 +221,8 @@ Con_Init (const char *plugin_name)
con_linewidth = -1;
Con_CheckResize ();
Sys_SetPrintf (Con_Print);
Con_Printf ("Console initialized.\n");
// register our commands
@ -265,12 +267,15 @@ Con_Linefeed (void)
If no console is visible, the notify window will pop up.
*/
void
Con_Print (const char *txt)
Con_Print (const char *fmt, va_list args)
{
int mask, c, l, y;
static int cr;
char txt[1024];
const char *s;
vsnprintf (txt, sizeof (txt), fmt, args);
// echo to debugging console
for (s = txt; *s; s++)
fputc (sys_char_map[(byte)*s], stdout);
@ -282,23 +287,25 @@ Con_Print (const char *txt)
if (!con_initialized)
return;
if (txt[0] == 1 || txt[0] == 2) {
s = txt;
if (s[0] == 1 || s[0] == 2) {
mask = 128; // go to colored text
txt++;
s++;
} else
mask = 0;
while ((c = *txt)) {
while ((c = *s)) {
// count word length
for (l = 0; l < con_linewidth; l++)
if (txt[l] <= ' ')
if (s[l] <= ' ')
break;
// word wrap
if (l != con_linewidth && (con->x + l > con_linewidth))
con->x = 0;
txt++;
s++;
if (cr) {
con->current--;

View file

@ -30,6 +30,8 @@
#ifndef _SERVER_H
#define _SERVER_H
#include <stdarg.h>
#include "QF/gcc_attr.h"
#include "QF/model.h"
#include "QF/sizebuf.h"
@ -489,6 +491,7 @@ void SV_SetMoveVars(void);
//
// sv_send.c
//
void SV_Print (const char *fmt, va_list args);
void SV_Printf (const char *fmt, ...) __attribute__((format(printf,1,2)));
void SV_SendClientMessages (void);

View file

@ -222,6 +222,8 @@ Con_Init (const char *plugin_name)
con_linewidth = -1;
Con_CheckResize ();
Sys_SetPrintf (Con_Print);
Con_Printf ("Console initialized.\n");
// register our commands
@ -266,12 +268,15 @@ Con_Linefeed (void)
If no console is visible, the notify window will pop up.
*/
void
Con_Print (const char *txt)
Con_Print (const char *fmt, va_list args)
{
int mask, c, l, y;
static int cr;
static char txt[1024];
const char *s;
vsnprintf (txt, sizeof (txt), fmt, args);
// echo to debugging console
for (s = txt; *s; s++)
fputc (sys_char_map[(byte)*s], stdout);
@ -283,23 +288,25 @@ Con_Print (const char *txt)
if (!con_initialized)
return;
if (txt[0] == 1 || txt[0] == 2) {
s = txt;
if (s[0] == 1 || s[0] == 2) {
mask = 128; // go to colored text
txt++;
s++;
} else
mask = 0;
while ((c = *txt)) {
while ((c = *s)) {
// count word length
for (l = 0; l < con_linewidth; l++)
if (txt[l] <= ' ')
if (s[l] <= ' ')
break;
// word wrap
if (l != con_linewidth && (con->x + l > con_linewidth))
con->x = 0;
txt++;
s++;
if (cr) {
con->current--;

View file

@ -2371,6 +2371,7 @@ SV_Init (void)
sv_console_plugin = Cvar_Get ("sv_console_plugin", "server",
CVAR_ROM, 0, "Plugin used for the console");
Con_Init (sv_console_plugin->string);
Sys_SetPrintf (SV_Print);
COM_Filesystem_Init_Cvars ();
Game_Init_Cvars ();

View file

@ -119,10 +119,9 @@ SV_EndRedirect (void)
Handles cursor positioning, line wrapping, etc
*/
void
SV_Printf (const char *fmt, ...)
SV_Print (const char *fmt, va_list args)
{
static int pending = 0; // partial line being printed
va_list argptr;
char msg[MAXPRINTMSG];
char msg2[MAXPRINTMSG];
char msg3[MAXPRINTMSG];
@ -131,9 +130,7 @@ SV_Printf (const char *fmt, ...)
struct tm *local = NULL;
qboolean timestamps = false;
va_start (argptr, fmt);
vsnprintf (msg, sizeof (msg), fmt, argptr);
va_end (argptr);
vsnprintf (msg, sizeof (msg), fmt, args);
if (sv_redirected) { // Add to redirected message
if (strlen (msg) + strlen (outputbuf) > sizeof (outputbuf) - 1)
@ -167,6 +164,16 @@ SV_Printf (const char *fmt, ...)
}
}
void
SV_Printf (const char *fmt, ...)
{
va_list argptr;
va_start (argptr, fmt);
SV_Print (fmt, argptr);
va_end (argptr);
}
/* EVENT MESSAGES */
static void