Log facility changes: log_Always removed; log_User, log_Fatal and log_Error added; some info messages changed to log_Info level; minor formatting fixes

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2397 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2006-08-08 01:37:42 +00:00
parent f2704a66dc
commit 9af62d8997
36 changed files with 234 additions and 233 deletions
+19 -19
View File
@@ -135,13 +135,13 @@ prepareContentDir (const char *contentDirName, const char **addons)
} }
if (loc == NULL) if (loc == NULL)
{ {
log_add (log_Always, "Fatal error: Could not find content."); log_add (log_Fatal, "Fatal error: Could not find content.");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
if (expandPath (path, sizeof path, loc, EP_ALL_SYSTEM) == -1) if (expandPath (path, sizeof path, loc, EP_ALL_SYSTEM) == -1)
{ {
log_add (log_Always, "Fatal error: Could not expand path to content " log_add (log_Fatal, "Fatal error: Could not expand path to content "
"directory: %s", strerror (errno)); "directory: %s", strerror (errno));
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -170,7 +170,7 @@ prepareConfigDir (const char *configDirName) {
{ {
// Doesn't have to be fatal, but might mess up things when saving // Doesn't have to be fatal, but might mess up things when saving
// config files. // config files.
log_add (log_Always, "Fatal error: Invalid path to config files."); log_add (log_Fatal, "Fatal error: Invalid path to config files.");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
configDirName = buf; configDirName = buf;
@@ -190,7 +190,7 @@ prepareConfigDir (const char *configDirName) {
uio_MOUNT_TOP, NULL); uio_MOUNT_TOP, NULL);
if (contentHandle == NULL) if (contentHandle == NULL)
{ {
log_add (log_Always, "Fatal error: Could not mount config dir: %s", log_add (log_Fatal, "Fatal error: Could not mount config dir: %s",
strerror (errno)); strerror (errno));
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -198,7 +198,7 @@ prepareConfigDir (const char *configDirName) {
configDir = uio_openDir (repository, "/", 0); configDir = uio_openDir (repository, "/", 0);
if (configDir == NULL) if (configDir == NULL)
{ {
log_add (log_Always, "Fatal error: Could not open config dir: %s", log_add (log_Fatal, "Fatal error: Could not open config dir: %s",
strerror (errno)); strerror (errno));
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -217,7 +217,7 @@ prepareSaveDir (void) {
{ {
// Doesn't have to be fatal, but might mess up things when saving // Doesn't have to be fatal, but might mess up things when saving
// config files. // config files.
log_add (log_Always, "Fatal error: Invalid path to config files."); log_add (log_Fatal, "Fatal error: Invalid path to config files.");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -235,7 +235,7 @@ prepareSaveDir (void) {
// "save" in the config dir. // "save" in the config dir.
if (saveDir == NULL) if (saveDir == NULL)
{ {
log_add (log_Always, "Fatal error: Could not open save dir: %s", log_add (log_Fatal, "Fatal error: Could not open save dir: %s",
strerror (errno)); strerror (errno));
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -254,7 +254,7 @@ prepareMeleeDir (void) {
{ {
// Doesn't have to be fatal, but might mess up things when saving // Doesn't have to be fatal, but might mess up things when saving
// config files. // config files.
log_add (log_Always, "Fatal error: Invalid path to config files."); log_add (log_Fatal, "Fatal error: Invalid path to config files.");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -270,7 +270,7 @@ prepareMeleeDir (void) {
// "teams" in the config dir. // "teams" in the config dir.
if (meleeDir == NULL) if (meleeDir == NULL)
{ {
log_add (log_Always, "Fatal error: Could not open melee teams dir: %s", log_add (log_Fatal, "Fatal error: Could not open melee teams dir: %s",
strerror (errno)); strerror (errno));
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -289,7 +289,7 @@ mountContentDir (uio_Repository *repository, const char *contentPath,
uio_MOUNT_TOP | uio_MOUNT_RDONLY, NULL); uio_MOUNT_TOP | uio_MOUNT_RDONLY, NULL);
if (contentHandle == NULL) if (contentHandle == NULL)
{ {
log_add (log_Always, "Fatal error: Could not mount content dir: %s", log_add (log_Fatal, "Fatal error: Could not mount content dir: %s",
strerror (errno)); strerror (errno));
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -297,7 +297,7 @@ mountContentDir (uio_Repository *repository, const char *contentPath,
contentDir = uio_openDir (repository, "/", 0); contentDir = uio_openDir (repository, "/", 0);
if (contentDir == NULL) if (contentDir == NULL)
{ {
log_add (log_Always, "Fatal error: Could not open content dir: %s", log_add (log_Fatal, "Fatal error: Could not open content dir: %s",
strerror (errno)); strerror (errno));
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -308,7 +308,7 @@ mountContentDir (uio_Repository *repository, const char *contentPath,
if (addons[0] != NULL) if (addons[0] != NULL)
{ // addons were specified, but there's no /packages dir, { // addons were specified, but there's no /packages dir,
// let alone a /packages/addons dir. // let alone a /packages/addons dir.
log_add (log_Always, "Warning: There's no 'packages/addons' " log_add (log_Error, "Warning: There's no 'packages/addons' "
"directory in the 'content' directory;\n\t'--addon' " "directory in the 'content' directory;\n\t'--addon' "
"options are ignored."); "options are ignored.");
} }
@@ -323,7 +323,7 @@ mountContentDir (uio_Repository *repository, const char *contentPath,
addonsDir = uio_openDirRelative (packagesDir, "addons", 0); addonsDir = uio_openDirRelative (packagesDir, "addons", 0);
if (addonsDir == NULL) if (addonsDir == NULL)
{ // No addon dir found. { // No addon dir found.
log_add (log_Always, "Warning: There's no 'packages/addons' " log_add (log_Error, "Warning: There's no 'packages/addons' "
"directory in the 'content' directory;\n\t'--addon' " "directory in the 'content' directory;\n\t'--addon' "
"options are ignored."); "options are ignored.");
uio_closeDir (packagesDir); uio_closeDir (packagesDir);
@@ -340,21 +340,21 @@ mountContentDir (uio_Repository *repository, const char *contentPath,
if (count != 1) if (count != 1)
{ {
log_add (log_Always, "%d available addon packs.", count); log_add (log_Info, "%d available addon packs.", count);
} }
else else
{ {
log_add (log_Always, "1 available addon pack."); log_add (log_Info, "1 available addon pack.");
} }
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
log_add (log_Always, " %d. %s", i+1, log_add (log_Info, " %d. %s", i+1,
availableAddons->names[i]); availableAddons->names[i]);
} }
} }
else else
{ {
log_add (log_Always, "0 available addon packs."); log_add (log_Info, "0 available addon packs.");
} }
for (; *addons != NULL; addons++) for (; *addons != NULL; addons++)
@@ -362,7 +362,7 @@ mountContentDir (uio_Repository *repository, const char *contentPath,
addonDir = uio_openDirRelative (addonsDir, *addons, 0); addonDir = uio_openDirRelative (addonsDir, *addons, 0);
if (addonDir == NULL) if (addonDir == NULL)
{ {
log_add (log_Always, "Warning: directory 'packages/addons/%s' " log_add (log_Error, "Warning: directory 'packages/addons/%s' "
"not found; addon skipped.", *addons); "not found; addon skipped.", *addons);
continue; continue;
} }
@@ -394,7 +394,7 @@ mountDirZips (uio_MountHandle *contentHandle, uio_DirHandle *dirHandle)
uio_MOUNT_BELOW | uio_MOUNT_RDONLY, uio_MOUNT_BELOW | uio_MOUNT_RDONLY,
contentHandle) == NULL) contentHandle) == NULL)
{ {
log_add (log_Always, "Warning: Could not mount '%s': %s.", log_add (log_Error, "Warning: Could not mount '%s': %s.",
dirList->names[i], strerror (errno)); dirList->names[i], strerror (errno));
} }
} }
+2 -2
View File
@@ -226,7 +226,7 @@ SuspendGameClock (void)
{ {
if (!clock_mutex) if (!clock_mutex)
{ {
log_add (log_Always, "BUG: " log_add (log_Fatal, "BUG: "
"Attempted to suspend non-existent game clock"); "Attempted to suspend non-existent game clock");
#ifdef DEBUG #ifdef DEBUG
explode (); explode ();
@@ -247,7 +247,7 @@ ResumeGameClock (void)
{ {
if (!clock_mutex) if (!clock_mutex)
{ {
log_add (log_Always, "BUG: " log_add (log_Fatal, "BUG: "
"Attempted to resume non-existent game clock\n"); "Attempted to resume non-existent game clock\n");
#ifdef DEBUG #ifdef DEBUG
explode (); explode ();
+1 -1
View File
@@ -1552,7 +1552,7 @@ DoConvSummary (PSUMMARY_STATE pSS)
if ((unsigned)space_index >= sizeof (buffer)) if ((unsigned)space_index >= sizeof (buffer))
{ {
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
log_add (log_Always, "DoConvSummary() BUG: " log_add (log_Fatal, "DoConvSummary() BUG: "
"buffer[%u] too small to fit %d bytes\n", "buffer[%u] too small to fit %d bytes\n",
sizeof (buffer), space_index); sizeof (buffer), space_index);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
+1 -1
View File
@@ -286,7 +286,7 @@ construct_response (UNICODE *buf, int R /* promoted from RESPONSE_REF */, ...)
if ((buf_start == shared_phrase_buf) && if ((buf_start == shared_phrase_buf) &&
(buf > shared_phrase_buf + sizeof (shared_phrase_buf))) (buf > shared_phrase_buf + sizeof (shared_phrase_buf)))
{ {
log_add (log_Always, "Error: shared_phrase_buf size exceeded," log_add (log_Fatal, "Error: shared_phrase_buf size exceeded,"
" please increase!\n"); " please increase!\n");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
+1 -1
View File
@@ -348,7 +348,7 @@ CaptureCodeRes (MEM_HANDLE hCode, PVOID pData, PVOID *ppLocData)
if (hCode == 0) if (hCode == 0)
{ {
log_add (log_Always, "dummy.c::CaptureCodeRes() hCode==0! FATAL!"); log_add (log_Fatal, "dummy.c::CaptureCodeRes() hCode==0! FATAL!");
return(0); return(0);
} }
+2 -2
View File
@@ -106,7 +106,7 @@ mkdirhier (const char *path)
{ {
if (errno != ENOENT) if (errno != ENOENT)
{ {
log_add (log_Always, "Can't stat %s: %s", buf, log_add (log_Error, "Can't stat %s: %s", buf,
strerror (errno)); strerror (errno));
return -1; return -1;
} }
@@ -132,7 +132,7 @@ mkdirhier (const char *path)
{ {
if (createDirectory (buf, 0777) == -1) if (createDirectory (buf, 0777) == -1)
{ {
log_add (log_Always, "Error: Can't create %s: %s", buf, log_add (log_Error, "Error: Can't create %s: %s", buf,
strerror (errno)); strerror (errno));
return -1; return -1;
} }
+5 -5
View File
@@ -100,7 +100,7 @@ getTempDir (char *buf, size_t buflen) {
tryTempDir (buf, buflen, "/tmp/") && tryTempDir (buf, buflen, "/tmp/") &&
tryTempDir (buf, buflen, getcwd (cwd, sizeof cwd))) tryTempDir (buf, buflen, getcwd (cwd, sizeof cwd)))
{ {
log_add (log_Always, "Fatal Error: Cannot find a suitable location " log_add (log_Fatal, "Fatal Error: Cannot find a suitable location "
"to store temporary files."); "to store temporary files.");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -118,7 +118,7 @@ mountTempDir(const char *name) {
uio_MOUNT_TOP, NULL); uio_MOUNT_TOP, NULL);
if (tempHandle == NULL) { if (tempHandle == NULL) {
int saveErrno = errno; int saveErrno = errno;
log_add (log_Always, "Fatal error: Couldn't mount temp dir '%s': " log_add (log_Fatal, "Fatal error: Couldn't mount temp dir '%s': "
"%s", name, strerror (errno)); "%s", name, strerror (errno));
errno = saveErrno; errno = saveErrno;
return -1; return -1;
@@ -127,7 +127,7 @@ mountTempDir(const char *name) {
tempDir = uio_openDir (repository, "/tmp", 0); tempDir = uio_openDir (repository, "/tmp", 0);
if (tempDir == NULL) { if (tempDir == NULL) {
int saveErrno = errno; int saveErrno = errno;
log_add (log_Always, "Fatal error: Could not open temp dir: %s", log_add (log_Fatal, "Fatal error: Could not open temp dir: %s",
strerror (errno)); strerror (errno));
errno = saveErrno; errno = saveErrno;
return -1; return -1;
@@ -169,7 +169,7 @@ initTempDir (void) {
} }
// Failure, could not make a temporary directory. // Failure, could not make a temporary directory.
log_add (log_Always, "Fatal error: Cannot get a name for a temporary " log_add (log_Fatal, "Fatal error: Cannot get a name for a temporary "
"directory."); "directory.");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -187,7 +187,7 @@ tempFilePath (const char *filename) {
static char file[PATH_MAX]; static char file[PATH_MAX];
if (snprintf (file, PATH_MAX, "%s/%s", tempDirName, filename) == -1) { if (snprintf (file, PATH_MAX, "%s/%s", tempDirName, filename) == -1) {
log_add (log_Always, "Path to temp file too long."); log_add (log_Fatal, "Path to temp file too long.");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
return file; return file;
+2 -2
View File
@@ -178,7 +178,7 @@ get_colormap (int index)
map = colormaps[index]; map = colormaps[index];
if (!map) if (!map)
{ {
log_add (log_Always, "BUG: get_colormap(): map not present"); log_add (log_Fatal, "BUG: get_colormap(): map not present");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -453,7 +453,7 @@ XFormColorMap_step (void)
if (!curmap) if (!curmap)
{ {
UnlockMutex (maplock); UnlockMutex (maplock);
log_add (log_Always, "BUG: XFormColorMap_step(): no current map"); log_add (log_Error, "BUG: XFormColorMap_step(): no current map");
finish_colormap_xform (x); finish_colormap_xform (x);
continue; continue;
} }
+5 -5
View File
@@ -400,7 +400,7 @@ TFB_DrawCanvas_New_TrueColor (int w, int h, BOOLEAN hasalpha)
hasalpha ? fmt->Amask : 0); hasalpha ? fmt->Amask : 0);
if (!new_surf) if (!new_surf)
{ {
log_add (log_Always, "INTERNAL PANIC: Failed to create TFB_Canvas: %s", log_add (log_Fatal, "INTERNAL PANIC: Failed to create TFB_Canvas: %s",
SDL_GetError()); SDL_GetError());
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -432,7 +432,7 @@ TFB_DrawCanvas_New_ForScreen (int w, int h, BOOLEAN withalpha)
if (!new_surf) if (!new_surf)
{ {
log_add (log_Always, "TFB_DrawCanvas_New_ForScreen() INTERNAL PANIC:" log_add (log_Fatal, "TFB_DrawCanvas_New_ForScreen() INTERNAL PANIC:"
"Failed to create TFB_Canvas: %s", SDL_GetError()); "Failed to create TFB_Canvas: %s", SDL_GetError());
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -446,7 +446,7 @@ TFB_DrawCanvas_New_Paletted (int w, int h, TFB_Palette *palette, int transparent
new_surf = SDL_CreateRGBSurface (SDL_SWSURFACE, w, h, 8, 0, 0, 0, 0); new_surf = SDL_CreateRGBSurface (SDL_SWSURFACE, w, h, 8, 0, 0, 0, 0);
if (!new_surf) if (!new_surf)
{ {
log_add (log_Always, "INTERNAL PANIC: Failed to create TFB_Canvas: %s", log_add (log_Fatal, "INTERNAL PANIC: Failed to create TFB_Canvas: %s",
SDL_GetError()); SDL_GetError());
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -535,7 +535,7 @@ TFB_DrawCanvas_New_RotationTarget (TFB_Canvas src_canvas, int angle)
src->format->Amask); src->format->Amask);
if (!newsurf) if (!newsurf)
{ {
log_add (log_Always, "TFB_DrawCanvas_New_RotationTarget()" log_add (log_Fatal, "TFB_DrawCanvas_New_RotationTarget()"
" INTERNAL PANIC: Failed to create TFB_Canvas: %s", " INTERNAL PANIC: Failed to create TFB_Canvas: %s",
SDL_GetError()); SDL_GetError());
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
@@ -597,7 +597,7 @@ TFB_DrawCanvas_ToScreenFormat (TFB_Canvas canvas)
SDL_Surface *result = TFB_DisplayFormatAlpha ((SDL_Surface *)canvas); SDL_Surface *result = TFB_DisplayFormatAlpha ((SDL_Surface *)canvas);
if (result == NULL) if (result == NULL)
{ {
log_add (log_Always, "WARNING: Could not convert" log_add (log_Debug, "WARNING: Could not convert"
" sprite-canvas to display format."); " sprite-canvas to display format.");
return canvas; return canvas;
} }
+11 -11
View File
@@ -54,7 +54,7 @@ Create_Screen (SDL_Surface *template, int w, int h)
template->format->Rmask, template->format->Gmask, template->format->Rmask, template->format->Gmask,
template->format->Bmask, 0); template->format->Bmask, 0);
if (newsurf == 0) { if (newsurf == 0) {
log_add (log_Always, "Couldn't create screen buffers: %s", log_add (log_Error, "Couldn't create screen buffers: %s",
SDL_GetError()); SDL_GetError());
} }
return newsurf; return newsurf;
@@ -118,20 +118,20 @@ AttemptColorDepth (int flags, int width, int height, int bpp)
bpp, videomode_flags); bpp, videomode_flags);
if (SDL_Video == NULL) if (SDL_Video == NULL)
{ {
log_add (log_Always, "Couldn't set OpenGL %ix%ix%i video mode: %s", log_add (log_Error, "Couldn't set OpenGL %ix%ix%i video mode: %s",
ScreenWidthActual, ScreenHeightActual, bpp, ScreenWidthActual, ScreenHeightActual, bpp,
SDL_GetError ()); SDL_GetError ());
return -1; return -1;
} }
else else
{ {
log_add (log_Always, "Set the resolution to: %ix%ix%i" log_add (log_Info, "Set the resolution to: %ix%ix%i"
" (surface reports %ix%ix%i)", " (surface reports %ix%ix%i)",
width, height, bpp, width, height, bpp,
SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h, SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h,
SDL_GetVideoSurface()->format->BitsPerPixel); SDL_GetVideoSurface()->format->BitsPerPixel);
log_add (log_Always, "OpenGL renderer: %s version: %s", log_add (log_Info, "OpenGL renderer: %s version: %s",
glGetString (GL_RENDERER), glGetString (GL_VERSION)); glGetString (GL_RENDERER), glGetString (GL_VERSION));
} }
return 0; return 0;
@@ -147,7 +147,7 @@ TFB_GL_ConfigureVideo (int driver, int flags, int width, int height)
AttemptColorDepth (flags, width, height, 24) && AttemptColorDepth (flags, width, height, 24) &&
AttemptColorDepth (flags, width, height, 16)) AttemptColorDepth (flags, width, height, 16))
{ {
log_add (log_Always, "Couldn't set any OpenGL %ix%i video mode!", log_add (log_Error, "Couldn't set any OpenGL %ix%i video mode!",
width, height); width, height);
return -1; return -1;
} }
@@ -158,7 +158,7 @@ TFB_GL_ConfigureVideo (int driver, int flags, int width, int height)
R_MASK, G_MASK, B_MASK, A_MASK); R_MASK, G_MASK, B_MASK, A_MASK);
if (format_conv_surf == NULL) if (format_conv_surf == NULL)
{ {
log_add (log_Always, "Couldn't create format_conv_surf: %s", log_add (log_Error, "Couldn't create format_conv_surf: %s",
SDL_GetError()); SDL_GetError());
return -1; return -1;
} }
@@ -233,19 +233,19 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height)
{ {
char VideoName[256]; char VideoName[256];
log_add (log_Always, "Initializing SDL with OpenGL support."); log_add (log_Info, "Initializing SDL with OpenGL support.");
SDL_VideoDriverName (VideoName, sizeof (VideoName)); SDL_VideoDriverName (VideoName, sizeof (VideoName));
log_add (log_Always, "SDL driver used: %s", VideoName); log_add (log_Info, "SDL driver used: %s", VideoName);
log_add (log_Always, "SDL initialized."); log_add (log_Info, "SDL initialized.");
log_add (log_Always, "Initializing Screen."); log_add (log_Info, "Initializing Screen.");
ScreenWidth = 320; ScreenWidth = 320;
ScreenHeight = 240; ScreenHeight = 240;
if (TFB_GL_ConfigureVideo (driver, flags, width, height)) if (TFB_GL_ConfigureVideo (driver, flags, width, height))
{ {
log_add (log_Always, "Could not initialize video: " log_add (log_Fatal, "Could not initialize video: "
"no fallback at start of program!"); "no fallback at start of program!");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
+13 -13
View File
@@ -37,7 +37,7 @@ Create_Screen (SDL_Surface *template, int w, int h)
template->format->Rmask, template->format->Gmask, template->format->Rmask, template->format->Gmask,
template->format->Bmask, 0); template->format->Bmask, 0);
if (newsurf == 0) { if (newsurf == 0) {
log_add (log_Always, "Couldn't create screen buffers: %s", log_add (log_Error, "Couldn't create screen buffers: %s",
SDL_GetError()); SDL_GetError());
} }
return newsurf; return newsurf;
@@ -76,7 +76,7 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height)
ScreenHeightActual = 480; ScreenHeightActual = 480;
if (width != 640 || height != 480) if (width != 640 || height != 480)
log_add (log_Always, "Screen resolution of %dx%d not supported " log_add (log_Error, "Screen resolution of %dx%d not supported "
"under pure SDL, using 640x480", width, height); "under pure SDL, using 640x480", width, height);
} }
@@ -91,14 +91,14 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height)
if (SDL_Video == NULL) if (SDL_Video == NULL)
{ {
log_add (log_Always, "Couldn't set %ix%i video mode: %s", log_add (log_Error, "Couldn't set %ix%i video mode: %s",
ScreenWidthActual, ScreenHeightActual, ScreenWidthActual, ScreenHeightActual,
SDL_GetError ()); SDL_GetError ());
return -1; return -1;
} }
else else
{ {
log_add (log_Always, "Set the resolution to: %ix%ix%i", log_add (log_Info, "Set the resolution to: %ix%ix%i",
SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h, SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h,
SDL_GetVideoSurface()->format->BitsPerPixel); SDL_GetVideoSurface()->format->BitsPerPixel);
ScreenColorDepth = SDL_GetVideoSurface()->format->BitsPerPixel; ScreenColorDepth = SDL_GetVideoSurface()->format->BitsPerPixel;
@@ -126,7 +126,7 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height)
} }
if (!format_conv_surf) if (!format_conv_surf)
{ {
log_add (log_Always, "Couldn't create format_conv_surf: %s", log_add (log_Error, "Couldn't create format_conv_surf: %s",
SDL_GetError()); SDL_GetError());
return -1; return -1;
} }
@@ -179,24 +179,24 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height)
{ {
char VideoName[256]; char VideoName[256];
log_add (log_Always, "Initializing Pure-SDL graphics."); log_add (log_Info, "Initializing Pure-SDL graphics.");
SDL_VideoDriverName (VideoName, sizeof (VideoName)); SDL_VideoDriverName (VideoName, sizeof (VideoName));
log_add (log_Always, "SDL driver used: %s", VideoName); log_add (log_Info, "SDL driver used: %s", VideoName);
// Set the environment variable SDL_VIDEODRIVER to override // Set the environment variable SDL_VIDEODRIVER to override
// For Linux: x11 (default), dga, fbcon, directfb, svgalib, // For Linux: x11 (default), dga, fbcon, directfb, svgalib,
// ggi, aalib // ggi, aalib
// For Windows: directx (default), windib // For Windows: directx (default), windib
log_add (log_Always, "SDL initialized."); log_add (log_Info, "SDL initialized.");
log_add (log_Always, "Initializing Screen."); log_add (log_Info, "Initializing Screen.");
ScreenWidth = 320; ScreenWidth = 320;
ScreenHeight = 240; ScreenHeight = 240;
if (TFB_Pure_ConfigureVideo (driver, flags, width, height)) if (TFB_Pure_ConfigureVideo (driver, flags, width, height))
{ {
log_add (log_Always, "Could not initialize video: " log_add (log_Fatal, "Could not initialize video: "
"no fallback at start of program!"); "no fallback at start of program!");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -369,13 +369,13 @@ Scale_PerfTest (void)
if (!scaler) if (!scaler)
{ {
log_add (log_Always, "No scaler configured! " log_add (log_Error, "No scaler configured! "
"Run with larger resolution, please"); "Run with larger resolution, please");
return; return;
} }
if (!scaled_display) if (!scaled_display)
{ {
log_add (log_Always, "Run scaler performance tests " log_add (log_Error, "Run scaler performance tests "
"in Pure mode, please"); "in Pure mode, please");
return; return;
} }
@@ -401,7 +401,7 @@ Scale_PerfTest (void)
} }
} }
log_add (log_Always, "Full frames scaled: %d; over %u ms; %d fps\n", log_add (log_Debug, "Full frames scaled: %d; over %u ms; %d fps\n",
(i - 1), Now - TimeStart, i * 1000 / (Now - TimeStart)); (i - 1), Now - TimeStart, i * 1000 / (Now - TimeStart));
SDL_UnlockSurface (scaled_display); SDL_UnlockSurface (scaled_display);
+6 -6
View File
@@ -215,7 +215,7 @@ Scale_PrepPlatform (int flags, const SDL_PixelFormat* fmt)
if ( (!force_platform && (SDL_HasSSE () || SDL_HasMMXExt ())) if ( (!force_platform && (SDL_HasSSE () || SDL_HasMMXExt ()))
|| force_platform == SCALEPLAT_SSE) || force_platform == SCALEPLAT_SSE)
{ {
log_add (log_Always, "Screen scalers are using SSE/MMX-Ext/MMX code"); log_add (log_Info, "Screen scalers are using SSE/MMX-Ext/MMX code");
Scale_Platform = SCALEPLAT_SSE; Scale_Platform = SCALEPLAT_SSE;
Scale_SSE_PrepPlatform (fmt); Scale_SSE_PrepPlatform (fmt);
@@ -224,7 +224,7 @@ Scale_PrepPlatform (int flags, const SDL_PixelFormat* fmt)
if ( (!force_platform && SDL_HasAltiVec ()) if ( (!force_platform && SDL_HasAltiVec ())
|| force_platform == SCALEPLAT_ALTIVEC) || force_platform == SCALEPLAT_ALTIVEC)
{ {
log_add (log_Always, "Screen scalers would use AltiVec code " log_add (log_Info, "Screen scalers would use AltiVec code "
"if someone actually wrote it"); "if someone actually wrote it");
//Scale_Platform = SCALEPLAT_ALTIVEC; //Scale_Platform = SCALEPLAT_ALTIVEC;
} }
@@ -232,7 +232,7 @@ Scale_PrepPlatform (int flags, const SDL_PixelFormat* fmt)
if ( (!force_platform && SDL_Has3DNow ()) if ( (!force_platform && SDL_Has3DNow ())
|| force_platform == SCALEPLAT_3DNOW) || force_platform == SCALEPLAT_3DNOW)
{ {
log_add (log_Always, "Screen scalers are using 3DNow/MMX code"); log_add (log_Info, "Screen scalers are using 3DNow/MMX code");
Scale_Platform = SCALEPLAT_3DNOW; Scale_Platform = SCALEPLAT_3DNOW;
Scale_3DNow_PrepPlatform (fmt); Scale_3DNow_PrepPlatform (fmt);
@@ -241,7 +241,7 @@ Scale_PrepPlatform (int flags, const SDL_PixelFormat* fmt)
if ( (!force_platform && SDL_HasMMX ()) if ( (!force_platform && SDL_HasMMX ())
|| force_platform == SCALEPLAT_MMX) || force_platform == SCALEPLAT_MMX)
{ {
log_add (log_Always, "Screen scalers are using MMX code"); log_add (log_Info, "Screen scalers are using MMX code");
Scale_Platform = SCALEPLAT_MMX; Scale_Platform = SCALEPLAT_MMX;
Scale_MMX_PrepPlatform (fmt); Scale_MMX_PrepPlatform (fmt);
@@ -266,9 +266,9 @@ Scale_PrepPlatform (int flags, const SDL_PixelFormat* fmt)
} }
if (Scale_Platform == SCALEPLAT_C) if (Scale_Platform == SCALEPLAT_C)
log_add (log_Always, "Screen scalers are using slow generic C code"); log_add (log_Info, "Screen scalers are using slow generic C code");
else else
log_add (log_Always, "Screen scalers are using optimized C code"); log_add (log_Info, "Screen scalers are using optimized C code");
} }
// Lookup the scaling function // Lookup the scaling function
@@ -64,14 +64,14 @@ TFB_Abort (void)
void void
TFB_PreInit (void) TFB_PreInit (void)
{ {
log_add (log_Always, "Initializing base SDL functionality."); log_add (log_Info, "Initializing base SDL functionality.");
log_add (log_Always, "Using SDL version %d.%d.%d (compiled with " log_add (log_Info, "Using SDL version %d.%d.%d (compiled with "
"%d.%d.%d)", SDL_Linked_Version ()->major, "%d.%d.%d)", SDL_Linked_Version ()->major,
SDL_Linked_Version ()->minor, SDL_Linked_Version ()->patch, SDL_Linked_Version ()->minor, SDL_Linked_Version ()->patch,
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL); SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
if ((SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) == -1)) if ((SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) == -1))
{ {
log_add (log_Always, "Could not initialize SDL: %s.", SDL_GetError()); log_add (log_Fatal, "Could not initialize SDL: %s.", SDL_GetError());
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
} }
@@ -90,7 +90,7 @@ TFB_ReInitGraphics (int driver, int flags, int width, int height)
result = TFB_GL_ConfigureVideo (driver, flags, width, height); result = TFB_GL_ConfigureVideo (driver, flags, width, height);
#else #else
driver = TFB_GFXDRIVER_SDL_PURE; driver = TFB_GFXDRIVER_SDL_PURE;
log_add (log_Always, "OpenGL support not compiled in," log_add (log_Warning, "OpenGL support not compiled in,"
" so using pure SDL driver"); " so using pure SDL driver");
result = TFB_Pure_ConfigureVideo (driver, flags, width, height); result = TFB_Pure_ConfigureVideo (driver, flags, width, height);
#endif #endif
@@ -127,7 +127,7 @@ TFB_InitGraphics (int driver, int flags, int width, int height)
result = TFB_GL_InitGraphics (driver, flags, width, height); result = TFB_GL_InitGraphics (driver, flags, width, height);
#else #else
driver = TFB_GFXDRIVER_SDL_PURE; driver = TFB_GFXDRIVER_SDL_PURE;
log_add (log_Always, "OpenGL support not compiled in," log_add (log_Warning, "OpenGL support not compiled in,"
" so using pure SDL driver"); " so using pure SDL driver");
result = TFB_Pure_InitGraphics (driver, flags, width, height); result = TFB_Pure_InitGraphics (driver, flags, width, height);
#endif #endif
@@ -507,7 +507,7 @@ TFB_ComputeFPS (void)
fps_counter += delta_time; fps_counter += delta_time;
if (fps_counter > FPS_PERIOD) if (fps_counter > FPS_PERIOD)
{ {
log_add (log_Always, "fps %.2f, effective %.2f", log_add (log_User, "fps %.2f, effective %.2f",
1000.0 / delta_time, 1000.0 / delta_time,
1000.0 * RenderedFrames / fps_counter); 1000.0 * RenderedFrames / fps_counter);
@@ -801,12 +801,12 @@ TFB_FlushGraphics () // Only call from main thread!!
if (TFB_ReInitGraphics (DC.data.reinitvideo.driver, DC.data.reinitvideo.flags, if (TFB_ReInitGraphics (DC.data.reinitvideo.driver, DC.data.reinitvideo.flags,
DC.data.reinitvideo.width, DC.data.reinitvideo.height)) DC.data.reinitvideo.width, DC.data.reinitvideo.height))
{ {
log_add (log_Always, "Could not provide requested mode: " log_add (log_Error, "Could not provide requested mode: "
"reverting to last known driver."); "reverting to last known driver.");
if (TFB_ReInitGraphics (oldDriver, DC.data.reinitvideo.flags, if (TFB_ReInitGraphics (oldDriver, DC.data.reinitvideo.flags,
DC.data.reinitvideo.width, DC.data.reinitvideo.height)) DC.data.reinitvideo.width, DC.data.reinitvideo.height))
{ {
log_add (log_Always, "Couldn't reinit at that point either." log_add (log_Fatal, "Couldn't reinit at that point either."
" Your video has been somehow tied in knots."); " Your video has been somehow tied in knots.");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
+13 -13
View File
@@ -122,7 +122,7 @@ initKeyConfig (void)
if (copyFile (contentDir, "starcon.key", if (copyFile (contentDir, "starcon.key",
configDir, "keys.cfg") == -1) configDir, "keys.cfg") == -1)
{ {
log_add (log_Always, "Error: Could not copy default key config " log_add (log_Fatal, "Error: Could not copy default key config "
"to user config dir: %s.", strerror (errno)); "to user config dir: %s.", strerror (errno));
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -131,7 +131,7 @@ initKeyConfig (void)
if ((fp = res_OpenResFile (configDir, "keys.cfg", "rt")) == NULL) if ((fp = res_OpenResFile (configDir, "keys.cfg", "rt")) == NULL)
{ {
log_add (log_Always, "Error: Could not open keys.cfg"); log_add (log_Fatal, "Error: Could not open keys.cfg");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
} }
@@ -147,41 +147,41 @@ initKeyConfig (void)
if (VControl_GetValidCount () == 0) if (VControl_GetValidCount () == 0)
{ {
log_add (log_Always, "\nI didn't understand a single line in your configuration file."); log_add (log_Error, "\nI didn't understand a single line in your configuration file.");
log_add (log_Always, "This is likely because you're still using a 0.2 era or earlier keys.cfg."); log_add (log_Error, "This is likely because you're still using a 0.2 era or earlier keys.cfg.");
do_rename = true; do_rename = true;
} }
if (VControl_GetConfigFileVersion () != VCONTROL_VERSION) if (VControl_GetConfigFileVersion () != VCONTROL_VERSION)
{ {
log_add (log_Always, "\nThe control scheme for UQM has changed since you last updated keys.cfg."); log_add (log_Error, "\nThe control scheme for UQM has changed since you last updated keys.cfg.");
log_add (log_Always, "(I'm using control scheme version %d, while your config file appears to be\nfor version %d.)", VCONTROL_VERSION, VControl_GetConfigFileVersion ()); log_add (log_Error, "(I'm using control scheme version %d, while your config file appears to be\nfor version %d.)", VCONTROL_VERSION, VControl_GetConfigFileVersion ());
do_rename = true; do_rename = true;
} }
if (do_rename) if (do_rename)
{ {
log_add (log_Always, "\nRenaming keys.cfg to keys.old and retrying."); log_add (log_Error, "\nRenaming keys.cfg to keys.old and retrying.");
if (fileExists2 (configDir, "keys.old")) if (fileExists2 (configDir, "keys.old"))
uio_unlink (configDir, "keys.old"); uio_unlink (configDir, "keys.old");
if ((uio_rename (configDir, "keys.cfg", configDir, "keys.old")) == -1) if ((uio_rename (configDir, "keys.cfg", configDir, "keys.old")) == -1)
{ {
log_add (log_Always, "Error: Renaming failed!"); log_add (log_Fatal, "Error: Renaming failed!");
log_add (log_Always, "You must delete keys.cfg manually before you can run the game."); log_add (log_Fatal, "You must delete keys.cfg manually before you can run the game.");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
continue; continue;
} }
log_add (log_Always, "\nRepair your keys.cfg file to continue."); log_add (log_Fatal, "\nRepair your keys.cfg file to continue.");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
return; return;
} }
log_add (log_Always, "Error: Something went wrong and we were looping again and again so aborting."); log_add (log_Fatal, "Error: Something went wrong and we were looping again and again so aborting.");
log_add (log_Always, "Possible cause is your content dir not being up-to-date."); log_add (log_Fatal, "Possible cause is your content dir not being up-to-date.");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -206,7 +206,7 @@ TFB_InitInput (int driver, int flags)
if ((SDL_InitSubSystem(SDL_INIT_JOYSTICK)) == -1) if ((SDL_InitSubSystem(SDL_INIT_JOYSTICK)) == -1)
{ {
log_add (log_Always, "Couldn't initialize joystick subsystem: %s", log_add (log_Fatal, "Couldn't initialize joystick subsystem: %s",
SDL_GetError()); SDL_GetError());
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
+1 -1
View File
@@ -38,7 +38,7 @@ static log_Entry queue[MAX_LOG_ENTRIES];
static log_Entry msgNoThread; static log_Entry msgNoThread;
static char msgBuf[16384]; static char msgBuf[16384];
static int maxLevel = log_Always; static int maxLevel = log_Error;
static int maxStreamLevel = log_Debug; static int maxStreamLevel = log_Debug;
static int maxDisp = 10; static int maxDisp = 10;
static int qtotal = 0; static int qtotal = 0;
+5 -3
View File
@@ -35,12 +35,14 @@ extern void log_captureLines (int num);
typedef enum typedef enum
{ {
log_Nothing = -1, log_Nothing = 0,
log_Always = 0, log_User,
log_Fatal = log_User,
log_Error,
log_Warning, log_Warning,
log_Info, log_Info,
log_Debug, log_Debug,
log_Never, log_All,
} log_Level; } log_Level;
+6 -6
View File
@@ -104,7 +104,7 @@ static int MessageWithRetry(char *fmt, ...)
vsprintf(buffer, fmt, ap); vsprintf(buffer, fmt, ap);
va_end(ap); va_end(ap);
log_add (log_Always, "%s", buffer); log_add (log_User, "%s", buffer);
// fflush(stderr); // fflush(stderr);
#if 0 #if 0
@@ -210,7 +210,7 @@ MallocWithRetry(int bytes, char *diagStr)
if (ptr) if (ptr)
return (ptr); return (ptr);
log_add (log_Always, "Malloc failed for %s. #Bytes %d.", diagStr, bytes); log_add (log_Fatal, "Malloc failed for %s. #Bytes %d.", diagStr, bytes);
fflush (stderr); fflush (stderr);
explode (); explode ();
#if 0 #if 0
@@ -221,7 +221,7 @@ MallocWithRetry(int bytes, char *diagStr)
if (MessageWithRetry ("Really OK to stop tfbtool?")) if (MessageWithRetry ("Really OK to stop tfbtool?"))
{ {
/* User says "die". */ /* User says "die". */
log_add (log_Always, "Killed by the user (%s).", diagStr); log_add (log_Error, "Killed by the user (%s).", diagStr);
log_showBox (false, false); log_showBox (false, false);
exit (EXIT_SUCCESS); exit (EXIT_SUCCESS);
} }
@@ -243,10 +243,10 @@ mem_allocate (MEM_SIZE coreSize, MEM_FLAGS flags, MEM_PRIORITY priority,
#endif #endif
if ((node = freeListHead) == NULL) if ((node = freeListHead) == NULL)
log_add (log_Always, "mem_allocate: out of extents."); log_add (log_Error, "mem_allocate: out of extents.");
else if ((node->memory = MallocWithRetry (coreSize, "mem_allocate:")) == 0 else if ((node->memory = MallocWithRetry (coreSize, "mem_allocate:")) == 0
&& coreSize) && coreSize)
log_add (log_Always, "mem_allocate: couldn't allocate %ld bytes.", log_add (log_Error, "mem_allocate: couldn't allocate %ld bytes.",
coreSize); coreSize);
else else
{ {
@@ -586,7 +586,7 @@ HMalloc (int size)
if (size == 0) return (0); if (size == 0) return (0);
if ((p = _alloc_mem(size)) == NULL) { if ((p = _alloc_mem(size)) == NULL) {
log_add (log_Always, "Fatal Error: HMalloc(): out of memory."); log_add (log_Fatal, "Fatal Error: HMalloc(): out of memory.");
fflush (stderr); fflush (stderr);
explode (); explode ();
} }
+1 -1
View File
@@ -189,7 +189,7 @@ loadResourceIndex (uio_Stream *stream, const char *fileName) {
// We need the list to be sorted, as we binary search through it. // We need the list to be sorted, as we binary search through it.
if (res <= lastResource) if (res <= lastResource)
{ {
log_add (log_Always, "Fatal: resource index '%s' is not sorted " log_add (log_Fatal, "Fatal: resource index '%s' is not sorted "
"on the resource number, or contains a double entry. " "on the resource number, or contains a double entry. "
"Problem encountered on line %d.", fileName, lineNum); "Problem encountered on line %d.", fileName, lineNum);
explode (); explode ();
+2 -2
View File
@@ -57,7 +57,7 @@ initAudio (sint32 driver, sint32 flags)
#else #else
if (driver == audio_DRIVER_OPENAL) if (driver == audio_DRIVER_OPENAL)
{ {
log_add (log_Always, "OpenAL driver not compiled in, so using MixSDL"); log_add (log_Warning, "OpenAL driver not compiled in, so using MixSDL");
driver = audio_DRIVER_MIXSDL; driver = audio_DRIVER_MIXSDL;
} }
if (driver == audio_DRIVER_MIXSDL) if (driver == audio_DRIVER_MIXSDL)
@@ -68,7 +68,7 @@ initAudio (sint32 driver, sint32 flags)
if (ret != 0) if (ret != 0)
{ {
log_add (log_Always, "Sound driver initialization failed.\n" log_add (log_Fatal, "Sound driver initialization failed.\n"
"This may happen when a soundcard is " "This may happen when a soundcard is "
"not present or not available.\n" "not present or not available.\n"
"NOTICE: Try running UQM with '--sound=none' option"); "NOTICE: Try running UQM with '--sound=none' option");
@@ -178,7 +178,7 @@ SoundDecoder_Init (int flags, TFB_DecoderFormats *formats)
if (!formats) if (!formats)
{ {
log_add (log_Always, "SoundDecoder_Init(): missing decoder formats"); log_add (log_Error, "SoundDecoder_Init(): missing decoder formats");
return 1; return 1;
} }
decoder_formats = *formats; decoder_formats = *formats;
@@ -188,7 +188,7 @@ SoundDecoder_Init (int flags, TFB_DecoderFormats *formats)
{ {
if (!info->funcs->InitModule (flags, &decoder_formats)) if (!info->funcs->InitModule (flags, &decoder_formats))
{ {
log_add (log_Always, "SoundDecoder_Init(): " log_add (log_Error, "SoundDecoder_Init(): "
"%s audio decoder init failed", "%s audio decoder init failed",
info->funcs->GetName ()); info->funcs->GetName ());
ret = 1; ret = 1;
+1 -1
View File
@@ -270,7 +270,7 @@ moda_InitModule (int flags, const TFB_DecoderFormats* fmts)
if (MikMod_Init ("")) if (MikMod_Init (""))
{ {
log_add (log_Always, "MikMod_Init() failed, %s", log_add (log_Error, "MikMod_Init() failed, %s",
MikMod_strerror (MikMod_errno)); MikMod_strerror (MikMod_errno));
return false; return false;
} }
@@ -110,26 +110,26 @@ noSound_Init (audio_Driver *driver, sint32 flags)
audio_FORMAT_MONO16, audio_FORMAT_STEREO16 audio_FORMAT_MONO16, audio_FORMAT_STEREO16
}; };
log_add (log_Always, "Using nosound audio driver."); log_add (log_Info, "Using nosound audio driver.");
log_add (log_Always, "Initializing mixer."); log_add (log_Info, "Initializing mixer.");
if (!mixer_Init (nosound_freq, MIX_FORMAT_MAKE (1, 1), if (!mixer_Init (nosound_freq, MIX_FORMAT_MAKE (1, 1),
MIX_QUALITY_LOW, MIX_FAKE_DATA)) MIX_QUALITY_LOW, MIX_FAKE_DATA))
{ {
log_add (log_Always, "Mixer initialization failed: %x", log_add (log_Error, "Mixer initialization failed: %x",
mixer_GetError ()); mixer_GetError ());
return -1; return -1;
} }
log_add (log_Always, "Mixer initialized."); log_add (log_Info, "Mixer initialized.");
log_add (log_Always, "Initializing sound decoders."); log_add (log_Info, "Initializing sound decoders.");
if (SoundDecoder_Init (flags, &formats)) if (SoundDecoder_Init (flags, &formats))
{ {
log_add (log_Always, "Sound decoders initialization failed."); log_add (log_Error, "Sound decoders initialization failed.");
mixer_Uninit (); mixer_Uninit ();
return -1; return -1;
} }
log_add (log_Always, "Sound decoders initialized."); log_add (log_Info, "Sound decoders initialized.");
*driver = noSound_Driver; *driver = noSound_Driver;
for (i = 0; i < NUM_SOUNDSOURCES; ++i) for (i = 0; i < NUM_SOUNDSOURCES; ++i)
@@ -111,14 +111,14 @@ mixSDL_Init (audio_Driver *driver, sint32 flags)
audio_FORMAT_MONO16, audio_FORMAT_STEREO16 audio_FORMAT_MONO16, audio_FORMAT_STEREO16
}; };
log_add (log_Always, "Initializing SDL audio subsystem."); log_add (log_Info, "Initializing SDL audio subsystem.");
if ((SDL_InitSubSystem(SDL_INIT_AUDIO)) == -1) if ((SDL_InitSubSystem(SDL_INIT_AUDIO)) == -1)
{ {
log_add (log_Always, "Couldn't initialize audio subsystem: %s", log_add (log_Error, "Couldn't initialize audio subsystem: %s",
SDL_GetError()); SDL_GetError());
return -1; return -1;
} }
log_add (log_Always, "SDL audio subsystem initialized."); log_add (log_Info, "SDL audio subsystem initialized.");
if (flags & audio_QUALITY_HIGH) if (flags & audio_QUALITY_HIGH)
{ {
@@ -143,10 +143,10 @@ mixSDL_Init (audio_Driver *driver, sint32 flags)
desired.channels = 2; desired.channels = 2;
desired.callback = mixer_MixChannels; desired.callback = mixer_MixChannels;
log_add (log_Always, "Opening SDL audio device."); log_add (log_Info, "Opening SDL audio device.");
if (SDL_OpenAudio (&desired, &obtained) < 0) if (SDL_OpenAudio (&desired, &obtained) < 0)
{ {
log_add (log_Always, "Unable to open audio device: %s", log_add (log_Error, "Unable to open audio device: %s",
SDL_GetError ()); SDL_GetError ());
SDL_QuitSubSystem (SDL_INIT_AUDIO); SDL_QuitSubSystem (SDL_INIT_AUDIO);
return -1; return -1;
@@ -154,41 +154,41 @@ mixSDL_Init (audio_Driver *driver, sint32 flags)
if (obtained.format != desired.format || if (obtained.format != desired.format ||
(obtained.channels != 1 && obtained.channels != 2)) (obtained.channels != 1 && obtained.channels != 2))
{ {
log_add (log_Always, "Unable to obtain desired audio format."); log_add (log_Error, "Unable to obtain desired audio format.");
SDL_CloseAudio (); SDL_CloseAudio ();
SDL_QuitSubSystem (SDL_INIT_AUDIO); SDL_QuitSubSystem (SDL_INIT_AUDIO);
return -1; return -1;
} }
SDL_AudioDriverName (devicename, sizeof (devicename)); SDL_AudioDriverName (devicename, sizeof (devicename));
log_add (log_Always, " using %s at %d Hz 16 bit %s, " log_add (log_Info, " using %s at %d Hz 16 bit %s, "
"%d samples audio buffer", "%d samples audio buffer",
devicename, obtained.freq, devicename, obtained.freq,
obtained.channels > 1 ? "stereo" : "mono", obtained.channels > 1 ? "stereo" : "mono",
obtained.samples); obtained.samples);
log_add (log_Always, "Initializing mixer."); log_add (log_Info, "Initializing mixer.");
if (!mixer_Init (obtained.freq, MIX_FORMAT_MAKE (2, obtained.channels), if (!mixer_Init (obtained.freq, MIX_FORMAT_MAKE (2, obtained.channels),
quality, 0)) quality, 0))
{ {
log_add (log_Always, "Mixer initialization failed: %x", log_add (log_Error, "Mixer initialization failed: %x",
mixer_GetError ()); mixer_GetError ());
SDL_CloseAudio (); SDL_CloseAudio ();
SDL_QuitSubSystem (SDL_INIT_AUDIO); SDL_QuitSubSystem (SDL_INIT_AUDIO);
return -1; return -1;
} }
log_add (log_Always, "Mixer initialized."); log_add (log_Info, "Mixer initialized.");
log_add (log_Always, "Initializing sound decoders."); log_add (log_Info, "Initializing sound decoders.");
if (SoundDecoder_Init (flags, &formats)) if (SoundDecoder_Init (flags, &formats))
{ {
log_add (log_Always, "Sound decoders initialization failed."); log_add (log_Error, "Sound decoders initialization failed.");
SDL_CloseAudio (); SDL_CloseAudio ();
mixer_Uninit (); mixer_Uninit ();
SDL_QuitSubSystem (SDL_INIT_AUDIO); SDL_QuitSubSystem (SDL_INIT_AUDIO);
return -1; return -1;
} }
log_add (log_Always, "Sound decoders initialized."); log_add (log_Info, "Sound decoders initialized.");
*driver = mixSDL_Driver; *driver = mixSDL_Driver;
for (i = 0; i < NUM_SOUNDSOURCES; ++i) for (i = 0; i < NUM_SOUNDSOURCES; ++i)
@@ -115,7 +115,7 @@ openAL_Init (audio_Driver *driver, sint32 flags)
audio_FORMAT_MONO16, audio_FORMAT_STEREO16 audio_FORMAT_MONO16, audio_FORMAT_STEREO16
}; };
log_add (log_Always, "Initializing OpenAL."); log_add (log_Info, "Initializing OpenAL.");
#ifdef WIN32 #ifdef WIN32
alcDevice = alcOpenDevice ((ALubyte*)"DirectSound3D"); alcDevice = alcOpenDevice ((ALubyte*)"DirectSound3D");
#else #else
@@ -124,7 +124,7 @@ openAL_Init (audio_Driver *driver, sint32 flags)
if (!alcDevice) if (!alcDevice)
{ {
log_add (log_Always, "Couldn't initialize OpenAL: %d", log_add (log_Error, "Couldn't initialize OpenAL: %d",
alcGetError (NULL)); alcGetError (NULL));
return -1; return -1;
} }
@@ -135,7 +135,7 @@ openAL_Init (audio_Driver *driver, sint32 flags)
alcContext = alcCreateContext (alcDevice, NULL); alcContext = alcCreateContext (alcDevice, NULL);
if (!alcContext) if (!alcContext)
{ {
log_add (log_Always, "Couldn't create OpenAL context: %d", log_add (log_Error, "Couldn't create OpenAL context: %d",
alcGetError (alcDevice)); alcGetError (alcDevice));
alcCloseDevice (alcDevice); alcCloseDevice (alcDevice);
alcDevice = NULL; alcDevice = NULL;
@@ -144,7 +144,7 @@ openAL_Init (audio_Driver *driver, sint32 flags)
alcMakeContextCurrent (alcContext); alcMakeContextCurrent (alcContext);
log_add (log_Always, "OpenAL initialized.\n" log_add (log_Info, "OpenAL initialized.\n"
" version: %s\n", " version: %s\n",
" vendor: %s\n", " vendor: %s\n",
" renderer: %s\n", " renderer: %s\n",
@@ -154,10 +154,10 @@ openAL_Init (audio_Driver *driver, sint32 flags)
alcGetString (alcDevice, ALC_DEFAULT_DEVICE_SPECIFIER)); alcGetString (alcDevice, ALC_DEFAULT_DEVICE_SPECIFIER));
//log_add (log_Info, " extensions: %s", alGetString (AL_EXTENSIONS)); //log_add (log_Info, " extensions: %s", alGetString (AL_EXTENSIONS));
log_add (log_Always, "Initializing sound decoders."); log_add (log_Info, "Initializing sound decoders.");
if (SoundDecoder_Init (flags, &formats)) if (SoundDecoder_Init (flags, &formats))
{ {
log_add (log_Always, "Sound decoders initialization failed."); log_add (log_Error, "Sound decoders initialization failed.");
alcMakeContextCurrent (NULL); alcMakeContextCurrent (NULL);
alcDestroyContext (alcContext); alcDestroyContext (alcContext);
alcContext = NULL; alcContext = NULL;
@@ -165,7 +165,7 @@ openAL_Init (audio_Driver *driver, sint32 flags)
alcDevice = NULL; alcDevice = NULL;
return -1; return -1;
} }
log_add (log_Always, "Sound decoders initialized."); log_add (log_Error, "Sound decoders initialized.");
alListenerfv (AL_POSITION, listenerPos); alListenerfv (AL_POSITION, listenerPos);
alListenerfv (AL_VELOCITY, listenerVel); alListenerfv (AL_VELOCITY, listenerVel);
+1 -1
View File
@@ -42,7 +42,7 @@ AssignTask (ThreadFunction task_func, SDWORD stackSize, const char *name)
return task_array+i; return task_array+i;
} }
} }
log_add (log_Always, "Task error! Task array exhausted. Check for thread leaks."); log_add (log_Error, "Task error! Task array exhausted. Check for thread leaks.");
return NULL; return NULL;
} }
@@ -363,10 +363,10 @@ CreateMutex_SDL (void)
#ifdef NAMED_SYNCHRO #ifdef NAMED_SYNCHRO
/* logging depends on Mutexes, so we have to use the /* logging depends on Mutexes, so we have to use the
* non-threaded version instead */ * non-threaded version instead */
log_add_nothread (log_Always, "Could not initialize mutex '%s':" log_add_nothread (log_Fatal, "Could not initialize mutex '%s':"
"aborting.", name); "aborting.", name);
#else #else
log_add_nothread (log_Always, "Could not initialize mutex:" log_add_nothread (log_Fatal, "Could not initialize mutex:"
"aborting."); "aborting.");
#endif #endif
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
@@ -452,10 +452,10 @@ CreateSemaphore_SDL (DWORD initial
if (sem->sem == NULL) if (sem->sem == NULL)
{ {
#ifdef NAMED_SYNCHRO #ifdef NAMED_SYNCHRO
log_add (log_Always, "Could not initialize semaphore '%s':" log_add (log_Fatal, "Could not initialize semaphore '%s':"
" aborting.", name); " aborting.", name);
#else #else
log_add (log_Always, "Could not initialize semaphore:" log_add (log_Fatal, "Could not initialize semaphore:"
" aborting."); " aborting.");
#endif #endif
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
@@ -533,10 +533,10 @@ CreateRecursiveMutex_SDL (void)
if (mtx->mutex == NULL) if (mtx->mutex == NULL)
{ {
#ifdef NAMED_SYNCHRO #ifdef NAMED_SYNCHRO
log_add (log_Always, "Could not initialize recursive " log_add (log_Fatal, "Could not initialize recursive "
"mutex '%s': aborting.", name); "mutex '%s': aborting.", name);
#else #else
log_add (log_Always, "Could not initialize recursive " log_add (log_Fatal, "Could not initialize recursive "
"mutex: aborting."); "mutex: aborting.");
#endif #endif
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
@@ -630,10 +630,10 @@ CreateCondVar_SDL (void)
if ((cv->cond == NULL) || (cv->mutex == NULL)) if ((cv->cond == NULL) || (cv->mutex == NULL))
{ {
#ifdef NAMED_SYNCHRO #ifdef NAMED_SYNCHRO
log_add (log_Always, "Could not initialize condition variable '%s':" log_add (log_Fatal, "Could not initialize condition variable '%s':"
" aborting.", name); " aborting.", name);
#else #else
log_add (log_Always, "Could not initialize condition variable:" log_add (log_Fatal, "Could not initialize condition variable:"
" aborting."); " aborting.");
#endif #endif
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
+2 -2
View File
@@ -86,7 +86,7 @@ FlagStartThread (SpawnRequest s)
return NULL; return NULL;
} }
} }
log_add (log_Always, "Thread Lifecycle array filled. This is a fatal error! Make LIFECYCLE_SIZE something larger than %d.", LIFECYCLE_SIZE); log_add (log_Fatal, "Thread Lifecycle array filled. This is a fatal error! Make LIFECYCLE_SIZE something larger than %d.", LIFECYCLE_SIZE);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -104,7 +104,7 @@ FinishThread (Thread thread)
return; return;
} }
} }
log_add (log_Always, "Thread Lifecycle array filled. This is a fatal error! Make LIFECYCLE_SIZE something larger than %d.", LIFECYCLE_SIZE); log_add (log_Fatal, "Thread Lifecycle array filled. This is a fatal error! Make LIFECYCLE_SIZE something larger than %d.", LIFECYCLE_SIZE);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
+3 -3
View File
@@ -58,7 +58,7 @@ VideoDecoder_Init (int flags, int depth, uint32 Rmask, uint32 Gmask,
if (depth < 15 || depth > 32) if (depth < 15 || depth > 32)
{ {
log_add (log_Always, "VideoDecoder_Init: " log_add (log_Error, "VideoDecoder_Init: "
"Unsupported video depth %d", depth); "Unsupported video depth %d", depth);
return false; return false;
} }
@@ -66,7 +66,7 @@ VideoDecoder_Init (int flags, int depth, uint32 Rmask, uint32 Gmask,
if ((Rmask & Gmask) || (Rmask & Bmask) || (Rmask & Amask) || if ((Rmask & Gmask) || (Rmask & Bmask) || (Rmask & Amask) ||
(Gmask & Bmask) || (Gmask & Amask) || (Bmask & Amask)) (Gmask & Bmask) || (Gmask & Amask) || (Bmask & Amask))
{ {
log_add (log_Always, "VideoDecoder_Init: Invalid channel masks"); log_add (log_Error, "VideoDecoder_Init: Invalid channel masks");
return false; return false;
} }
@@ -88,7 +88,7 @@ VideoDecoder_Init (int flags, int depth, uint32 Rmask, uint32 Gmask,
{ {
if (!info->funcs->InitModule (flags)) if (!info->funcs->InitModule (flags))
{ {
log_add (log_Always, "VideoDecoder_Init(): " log_add (log_Error, "VideoDecoder_Init(): "
"%s video decoder init failed", "%s video decoder init failed",
info->funcs->GetName ()); info->funcs->GetName ());
} }
+3 -3
View File
@@ -440,7 +440,7 @@ LoadGame (COUNT which_game, SUMMARY_DESC *SummPtr)
if (!LoadSummary (&loc_sd, in_fp)) if (!LoadSummary (&loc_sd, in_fp))
{ {
log_add (log_Always, "Warning: Savegame is corrupt"); log_add (log_Error, "Warning: Savegame is corrupt");
res_CloseResFile (in_fp); res_CloseResFile (in_fp);
return FALSE; return FALSE;
} }
@@ -465,7 +465,7 @@ LoadGame (COUNT which_game, SUMMARY_DESC *SummPtr)
1 /* time to destroy all races, plenty */ + 1 /* time to destroy all races, plenty */ +
25 /* for cheaters */) 25 /* for cheaters */)
{ {
log_add (log_Always, "Warning: Savegame corrupt or from an " log_add (log_Error, "Warning: Savegame corrupt or from "
"an incompatible platform."); "an incompatible platform.");
res_CloseResFile (in_fp); res_CloseResFile (in_fp);
return FALSE; return FALSE;
@@ -494,7 +494,7 @@ LoadGame (COUNT which_game, SUMMARY_DESC *SummPtr)
// But if it does happen, it needs to be reset to 0, since on load // But if it does happen, it needs to be reset to 0, since on load
// the clock semaphore is gauranteed to be 0 // the clock semaphore is gauranteed to be 0
if (GLOBAL (GameClock.TimeCounter) != 0) if (GLOBAL (GameClock.TimeCounter) != 0)
log_add (log_Always, "Warning: Game clock wasn't stopped during " log_add (log_Warning, "Warning: Game clock wasn't stopped during "
"save, Savegame may be corrupt!\n"); "save, Savegame may be corrupt!\n");
GLOBAL (GameClock.TimeCounter) = 0; GLOBAL (GameClock.TimeCounter) = 0;
+2 -2
View File
@@ -1069,13 +1069,13 @@ GetNewList:
{ {
BOOLEAN deleteStatus; BOOLEAN deleteStatus;
log_add (log_Always, "Could not load '%s'", file); log_add (log_Error, "Could not load '%s', deleting", file);
deleteStatus = DeleteResFile (meleeDir, file); deleteStatus = DeleteResFile (meleeDir, file);
if (deleteStatus == FALSE) if (deleteStatus == FALSE)
{ {
// XXX: see bug #823 // XXX: see bug #823
log_add (log_Always, "FATAL: Could not delete '%s'", file); log_add (log_Fatal, "FATAL: Could not delete '%s'", file);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
goto GetNewList; goto GetNewList;
+2 -2
View File
@@ -79,7 +79,7 @@ DrawPCMenu (BYTE beg_index, BYTE end_index, BYTE NewState, BYTE hilite, RECT *r)
r->extent.width += 1; r->extent.width += 1;
DrawFilledRectangle (r); DrawFilledRectangle (r);
if (num_items * PC_MENU_HEIGHT > r->extent.height) if (num_items * PC_MENU_HEIGHT > r->extent.height)
log_add (log_Always, "Warning, no room for all menu items!"); log_add (log_Error, "Warning, no room for all menu items!");
else else
r->corner.y += (r->extent.height - num_items * PC_MENU_HEIGHT) / 2; r->corner.y += (r->extent.height - num_items * PC_MENU_HEIGHT) / 2;
r->extent.height = num_items * PC_MENU_HEIGHT + 4; r->extent.height = num_items * PC_MENU_HEIGHT + 4;
@@ -284,7 +284,7 @@ GetAlternateMenu (BYTE *BaseState, BYTE *CurState)
*CurState = PM_ALT_EXITMENU0 - PM_ALT_CARGO; *CurState = PM_ALT_EXITMENU0 - PM_ALT_CARGO;
return (TRUE); return (TRUE);
} }
log_add (log_Always, "Unknown state combination: %d, %d", log_add (log_Error, "Unknown state combination: %d, %d",
*BaseState, *CurState); *BaseState, *CurState);
return (FALSE); return (FALSE);
} }
+1 -1
View File
@@ -241,7 +241,7 @@ initIO (void)
rootDir = uio_openDir (repository, "/", 0); rootDir = uio_openDir (repository, "/", 0);
if (rootDir == NULL) if (rootDir == NULL)
{ {
log_add (log_Always, "Could not open '/' dir."); log_add (log_Fatal, "Could not open '/' dir.");
return -1; return -1;
} }
return 0; return 0;
+15 -15
View File
@@ -505,7 +505,7 @@ init_widgets (void)
if (count < 3) if (count < 3)
{ {
log_add (log_Always, "PANIC: Setup string table too short to even hold all indices!"); log_add (log_Fatal, "PANIC: Setup string table too short to even hold all indices!");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -514,7 +514,7 @@ init_widgets (void)
if (SplitString (GetStringAddress (SetAbsStringTableIndex (SetupTab, 1)), '\n', 100, buffer, bank) != MENU_COUNT) if (SplitString (GetStringAddress (SetAbsStringTableIndex (SetupTab, 1)), '\n', 100, buffer, bank) != MENU_COUNT)
{ {
/* TODO: Ignore extras instead of dying. */ /* TODO: Ignore extras instead of dying. */
log_add (log_Always, "PANIC: Incorrect number of Menu Subtitles"); log_add (log_Fatal, "PANIC: Incorrect number of Menu Subtitles");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -540,7 +540,7 @@ init_widgets (void)
if (SplitString (GetStringAddress (SetAbsStringTableIndex (SetupTab, 2)), '\n', 100, buffer, bank) != CHOICE_COUNT) if (SplitString (GetStringAddress (SetAbsStringTableIndex (SetupTab, 2)), '\n', 100, buffer, bank) != CHOICE_COUNT)
{ {
/* TODO: Ignore extras instead of dying. */ /* TODO: Ignore extras instead of dying. */
log_add (log_Always, "PANIC: Incorrect number of Choice Options"); log_add (log_Fatal, "PANIC: Incorrect number of Choice Options");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -568,7 +568,7 @@ init_widgets (void)
if (index >= count) if (index >= count)
{ {
log_add (log_Always, "PANIC: String table cut short while reading choices"); log_add (log_Fatal, "PANIC: String table cut short while reading choices");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
str = GetStringAddress (SetAbsStringTableIndex (SetupTab, index++)); str = GetStringAddress (SetAbsStringTableIndex (SetupTab, index++));
@@ -588,7 +588,7 @@ init_widgets (void)
if (index >= count) if (index >= count)
{ {
log_add (log_Always, "PANIC: String table cut short while reading choices"); log_add (log_Fatal, "PANIC: String table cut short while reading choices");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
str = GetStringAddress (SetAbsStringTableIndex (SetupTab, index++)); str = GetStringAddress (SetAbsStringTableIndex (SetupTab, index++));
@@ -610,14 +610,14 @@ init_widgets (void)
/* Sliders */ /* Sliders */
if (index >= count) if (index >= count)
{ {
log_add (log_Always, "PANIC: String table cut short while reading sliders"); log_add (log_Fatal, "PANIC: String table cut short while reading sliders");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
if (SplitString (GetStringAddress (SetAbsStringTableIndex (SetupTab, index++)), '\n', 100, buffer, bank) != SLIDER_COUNT) if (SplitString (GetStringAddress (SetAbsStringTableIndex (SetupTab, index++)), '\n', 100, buffer, bank) != SLIDER_COUNT)
{ {
/* TODO: Ignore extras instead of dying. */ /* TODO: Ignore extras instead of dying. */
log_add (log_Always, "PANIC: Incorrect number of Slider Options"); log_add (log_Fatal, "PANIC: Incorrect number of Slider Options");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -646,7 +646,7 @@ init_widgets (void)
if (index >= count) if (index >= count)
{ {
log_add (log_Always, "PANIC: String table cut short while reading sliders"); log_add (log_Fatal, "PANIC: String table cut short while reading sliders");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
str = GetStringAddress (SetAbsStringTableIndex (SetupTab, index++)); str = GetStringAddress (SetAbsStringTableIndex (SetupTab, index++));
@@ -664,14 +664,14 @@ init_widgets (void)
/* Buttons */ /* Buttons */
if (index >= count) if (index >= count)
{ {
log_add (log_Always, "PANIC: String table cut short while reading buttons"); log_add (log_Fatal, "PANIC: String table cut short while reading buttons");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
if (SplitString (GetStringAddress (SetAbsStringTableIndex (SetupTab, index++)), '\n', 100, buffer, bank) != BUTTON_COUNT) if (SplitString (GetStringAddress (SetAbsStringTableIndex (SetupTab, index++)), '\n', 100, buffer, bank) != BUTTON_COUNT)
{ {
/* TODO: Ignore extras instead of dying. */ /* TODO: Ignore extras instead of dying. */
log_add (log_Always, "PANIC: Incorrect number of Button Options"); log_add (log_Fatal, "PANIC: Incorrect number of Button Options");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -695,7 +695,7 @@ init_widgets (void)
if (index >= count) if (index >= count)
{ {
log_add (log_Always, "PANIC: String table cut short while reading buttons"); log_add (log_Fatal, "PANIC: String table cut short while reading buttons");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
str = GetStringAddress (SetAbsStringTableIndex (SetupTab, index++)); str = GetStringAddress (SetAbsStringTableIndex (SetupTab, index++));
@@ -713,14 +713,14 @@ init_widgets (void)
/* Labels */ /* Labels */
if (index >= count) if (index >= count)
{ {
log_add (log_Always, "PANIC: String table cut short while reading labels"); log_add (log_Fatal, "PANIC: String table cut short while reading labels");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
if (SplitString (GetStringAddress (SetAbsStringTableIndex (SetupTab, index++)), '\n', 100, buffer, bank) != LABEL_COUNT) if (SplitString (GetStringAddress (SetAbsStringTableIndex (SetupTab, index++)), '\n', 100, buffer, bank) != LABEL_COUNT)
{ {
/* TODO: Ignore extras instead of dying. */ /* TODO: Ignore extras instead of dying. */
log_add (log_Always, "PANIC: Incorrect number of Label Options"); log_add (log_Fatal, "PANIC: Incorrect number of Label Options");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@@ -742,7 +742,7 @@ init_widgets (void)
if (index >= count) if (index >= count)
{ {
log_add (log_Always, "PANIC: String table cut short while reading labels"); log_add (log_Fatal, "PANIC: String table cut short while reading labels");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
str = GetStringAddress (SetAbsStringTableIndex (SetupTab, index++)); str = GetStringAddress (SetAbsStringTableIndex (SetupTab, index++));
@@ -838,7 +838,7 @@ SetupMenu (void)
} }
else else
{ {
log_add (log_Always, "PANIC: Could not find strings for the setup menu!"); log_add (log_Fatal, "PANIC: Could not find strings for the setup menu!");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
done = FALSE; done = FALSE;
+1 -1
View File
@@ -1543,7 +1543,7 @@ SetFlashRect (PRECT pRect, FRAME f)
flash_screen_frame = 0; flash_screen_frame = 0;
} }
else else
log_add (log_Always, "Couldn't locate flash_screen_rect"); log_add (log_Debug, "Couldn't locate flash_screen_rect");
} }
if (flash_rect.extent.width) if (flash_rect.extent.width)
+1 -1
View File
@@ -275,7 +275,7 @@ while (--ac > 0)
} }
else else
{ {
log_add (log_Always, "Kernel failed to load!"); log_add (log_Fatal, "Kernel failed to load!");
} }
FreeKernel (); FreeKernel ();
+61 -62
View File
@@ -81,9 +81,9 @@ struct options_struct {
float speechVolumeScale; float speechVolumeScale;
}; };
static int preParseOptions(int argc, char *argv[], static int preParseOptions (int argc, char *argv[],
struct options_struct *options); struct options_struct *options);
static int parseOptions(int argc, char *argv[], static int parseOptions (int argc, char *argv[],
struct options_struct *options); struct options_struct *options);
static void usage (FILE *out, const struct options_struct *defaultOptions); static void usage (FILE *out, const struct options_struct *defaultOptions);
static int parseIntOption (const char *str, int *result, static int parseIntOption (const char *str, int *result,
@@ -91,7 +91,7 @@ static int parseIntOption (const char *str, int *result,
static int parseFloatOption (const char *str, float *f, static int parseFloatOption (const char *str, float *f,
const char *optName); const char *optName);
static int parseVolume (const char *str, float *vol, const char *optName); static int parseVolume (const char *str, float *vol, const char *optName);
static int InvalidArgument(const char *supplied, const char *opt_name); static int InvalidArgument (const char *supplied, const char *opt_name);
static int Check_PC_3DO_opt (const char *value, DWORD mask, const char *opt, static int Check_PC_3DO_opt (const char *value, DWORD mask, const char *opt,
int *result); int *result);
static const char *PC_3DO_optString (DWORD optMask); static const char *PC_3DO_optString (DWORD optMask);
@@ -144,7 +144,7 @@ main (int argc, char *argv[])
int i; int i;
freopen (options.logFile, "w", stderr); freopen (options.logFile, "w", stderr);
for (i = 0; i < argc; ++i) for (i = 0; i < argc; ++i)
log_add (log_Always, "argv[%d] = [%s]", i, argv[i]); log_add (log_User, "argv[%d] = [%s]", i, argv[i]);
} }
if (options.runMode == runMode_version) if (options.runMode == runMode_version)
@@ -155,7 +155,7 @@ main (int argc, char *argv[])
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
log_add (log_Always, "The Ur-Quan Masters v%d.%d.%d%s (compiled %s %s)\n" log_add (log_User, "The Ur-Quan Masters v%d.%d.%d%s (compiled %s %s)\n"
"This software comes with ABSOLUTELY NO WARRANTY;\n" "This software comes with ABSOLUTELY NO WARRANTY;\n"
"for details see the included 'COPYING' file.\n", "for details see the included 'COPYING' file.\n",
UQM_MAJOR_VERSION, UQM_MINOR_VERSION, UQM_MAJOR_VERSION, UQM_MINOR_VERSION,
@@ -325,7 +325,7 @@ main (int argc, char *argv[])
/* This is an unsigned, so no < 0 check is necessary */ /* This is an unsigned, so no < 0 check is necessary */
if (PlayerOne >= NUM_TEMPLATES) if (PlayerOne >= NUM_TEMPLATES)
{ {
log_add (log_Always, "Illegal control template '%d' for Player One.", PlayerOne); log_add (log_Error, "Illegal control template '%d' for Player One.", PlayerOne);
PlayerOne = CONTROL_TEMPLATE_KB_1; PlayerOne = CONTROL_TEMPLATE_KB_1;
} }
} }
@@ -335,23 +335,23 @@ main (int argc, char *argv[])
PlayerTwo = res_GetInteger ("config.player2control"); PlayerTwo = res_GetInteger ("config.player2control");
if (PlayerTwo >= NUM_TEMPLATES) if (PlayerTwo >= NUM_TEMPLATES)
{ {
log_add (log_Always, "Illegal control template '%d' for Player Two.", PlayerTwo); log_add (log_Error, "Illegal control template '%d' for Player Two.", PlayerTwo);
PlayerTwo = CONTROL_TEMPLATE_KB_2; PlayerTwo = CONTROL_TEMPLATE_KB_2;
} }
} }
if (res_HasKey ("config.musicvol")) if (res_HasKey ("config.musicvol"))
{ {
parseVolume(res_GetString ("config.musicvol"), parseVolume (res_GetString ("config.musicvol"),
&options.musicVolumeScale, "music volume"); &options.musicVolumeScale, "music volume");
} }
if (res_HasKey ("config.sfxvol")) if (res_HasKey ("config.sfxvol"))
{ {
parseVolume(res_GetString ("config.sfxvol"), parseVolume (res_GetString ("config.sfxvol"),
&options.sfxVolumeScale, "SFX volume"); &options.sfxVolumeScale, "SFX volume");
} }
if (res_HasKey ("config.speechvol")) if (res_HasKey ("config.speechvol"))
{ {
parseVolume(res_GetString ("config.speechvol"), parseVolume (res_GetString ("config.speechvol"),
&options.speechVolumeScale, "speech volume"); &options.speechVolumeScale, "speech volume");
} }
@@ -476,7 +476,7 @@ static struct option longOptions[] =
}; };
static int static int
preParseOptions(int argc, char *argv[], struct options_struct *options) preParseOptions (int argc, char *argv[], struct options_struct *options)
{ {
/* /*
* "pre-process" the cmdline args looking for a -l ("logfile") * "pre-process" the cmdline args looking for a -l ("logfile")
@@ -516,7 +516,7 @@ preParseOptions(int argc, char *argv[], struct options_struct *options)
} }
static int static int
parseOptions(int argc, char *argv[], struct options_struct *options) parseOptions (int argc, char *argv[], struct options_struct *options)
{ {
int optionIndex; int optionIndex;
BOOLEAN badArg = FALSE; BOOLEAN badArg = FALSE;
@@ -527,7 +527,7 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
if (argc == 0) if (argc == 0)
{ {
log_add (log_Always, "Error: Bad command line."); log_add (log_Fatal, "Error: Bad command line.");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -545,7 +545,7 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
int width, height; int width, height;
if (sscanf (optarg, "%dx%d", &width, &height) != 2) if (sscanf (optarg, "%dx%d", &width, &height) != 2)
{ {
log_add (log_Always, "Error: invalid argument specified " log_add (log_Fatal, "Error: invalid argument specified "
"as resolution."); "as resolution.");
badArg = TRUE; badArg = TRUE;
break; break;
@@ -575,7 +575,7 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
options->gfxFlags |= TFB_GFXFLAGS_SCALE_HQXX; options->gfxFlags |= TFB_GFXFLAGS_SCALE_HQXX;
else if (strcmp (optarg, "none") != 0) else if (strcmp (optarg, "none") != 0)
{ {
InvalidArgument(optarg, "--scale or -c"); InvalidArgument (optarg, "--scale or -c");
badArg = TRUE; badArg = TRUE;
} }
break; break;
@@ -586,7 +586,7 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
options->meleeScale = TFB_SCALE_STEP; options->meleeScale = TFB_SCALE_STEP;
else else
{ {
InvalidArgument(optarg, "--meleezoom or -b"); InvalidArgument (optarg, "--meleezoom or -b");
badArg = TRUE; badArg = TRUE;
} }
break; break;
@@ -601,7 +601,7 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
break; break;
case 'M': case 'M':
{ {
int err = parseVolume(optarg, &options->musicVolumeScale, int err = parseVolume (optarg, &options->musicVolumeScale,
"music volume"); "music volume");
if (err) if (err)
badArg = TRUE; badArg = TRUE;
@@ -609,7 +609,7 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
} }
case 'S': case 'S':
{ {
int err = parseVolume(optarg, &options->sfxVolumeScale, int err = parseVolume (optarg, &options->sfxVolumeScale,
"sfx volume"); "sfx volume");
if (err) if (err)
badArg = TRUE; badArg = TRUE;
@@ -617,7 +617,7 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
} }
case 'T': case 'T':
{ {
int err = parseVolume(optarg, &options->speechVolumeScale, int err = parseVolume (optarg, &options->speechVolumeScale,
"speech volume"); "speech volume");
if (err) if (err)
badArg = TRUE; badArg = TRUE;
@@ -644,7 +644,7 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
} }
else else
{ {
InvalidArgument(optarg, "--audioquality or -q"); InvalidArgument (optarg, "--audioquality or -q");
badArg = TRUE; badArg = TRUE;
} }
break; break;
@@ -723,7 +723,7 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
} }
else else
{ {
log_add (log_Always, "Error: Invalid sound driver " log_add (log_Fatal, "Error: Invalid sound driver "
"specified."); "specified.");
badArg = TRUE; badArg = TRUE;
} }
@@ -755,7 +755,7 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
} }
break; break;
default: default:
log_add (log_Always, "Error: Invalid option '%s' not found.", log_add (log_Fatal, "Error: Invalid option '%s' not found.",
longOptions[optionIndex].name); longOptions[optionIndex].name);
badArg = TRUE; badArg = TRUE;
break; break;
@@ -764,14 +764,14 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
if (optind != argc) if (optind != argc)
{ {
log_add (log_Always, "\nError: Extra arguments found on the command " log_add (log_Fatal, "\nError: Extra arguments found on the command "
"line."); "line.");
badArg = TRUE; badArg = TRUE;
} }
if (badArg) if (badArg)
{ {
log_add (log_Always, "Run with -h to see the allowed arguments."); log_add (log_Fatal, "Run with -h to see the allowed arguments.");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -786,13 +786,13 @@ parseVolume (const char *str, float *vol, const char *optName)
if (str[0] == '\0') if (str[0] == '\0')
{ {
log_add (log_Always, "Error: Invalid value for '%s'.", optName); log_add (log_Error, "Error: Invalid value for '%s'.", optName);
return -1; return -1;
} }
intVol = (int) strtol(str, &endPtr, 10); intVol = (int) strtol(str, &endPtr, 10);
if (*endPtr != '\0') if (*endPtr != '\0')
{ {
log_add (log_Always, "Error: Junk characters in volume specified " log_add (log_Error, "Error: Junk characters in volume specified "
"for '%s'.", optName); "for '%s'.", optName);
return -1; return -1;
} }
@@ -821,13 +821,13 @@ parseIntOption (const char *str, int *result, const char *optName)
if (str[0] == '\0') if (str[0] == '\0')
{ {
log_add (log_Always, "Error: Invalid value for '%s'.", optName); log_add (log_Error, "Error: Invalid value for '%s'.", optName);
return -1; return -1;
} }
temp = (int) strtol(str, &endPtr, 10); temp = (int) strtol(str, &endPtr, 10);
if (*endPtr != '\0') if (*endPtr != '\0')
{ {
log_add (log_Always, "Error: Junk characters in argument '%s'.", log_add (log_Error, "Error: Junk characters in argument '%s'.",
optName); optName);
return -1; return -1;
} }
@@ -844,13 +844,13 @@ parseFloatOption (const char *str, float *f, const char *optName)
if (str[0] == '\0') if (str[0] == '\0')
{ {
log_add (log_Always, "Error: Invalid value for '%s'.", optName); log_add (log_Error, "Error: Invalid value for '%s'.", optName);
return -1; return -1;
} }
temp = (float) strtod(str, &endPtr); temp = (float) strtod(str, &endPtr);
if (*endPtr != '\0') if (*endPtr != '\0')
{ {
log_add (log_Always, "Error: Junk characters in argument '%s'.", log_add (log_Error, "Error: Junk characters in argument '%s'.",
optName); optName);
return -1; return -1;
} }
@@ -865,52 +865,52 @@ usage (FILE *out, const struct options_struct *defaultOptions)
FILE *old = log_setOutput (out); FILE *old = log_setOutput (out);
log_captureLines (LOG_CAPTURE_ALL); log_captureLines (LOG_CAPTURE_ALL);
log_add (log_Always, "Options:"); log_add (log_User, "Options:");
log_add (log_Always, " -r, --res=WIDTHxHEIGHT (default 640x480, bigger " log_add (log_User, " -r, --res=WIDTHxHEIGHT (default 640x480, bigger "
"works only with --opengl)"); "works only with --opengl)");
log_add (log_Always, " -f, --fullscreen (default off)"); log_add (log_User, " -f, --fullscreen (default off)");
log_add (log_Always, " -o, --opengl (default off)"); log_add (log_User, " -o, --opengl (default off)");
log_add (log_Always, " -c, --scale=MODE (bilinear, biadapt, biadv, triscan, " log_add (log_User, " -c, --scale=MODE (bilinear, biadapt, biadv, triscan, "
"hq or none (default) )"); "hq or none (default) )");
log_add (log_Always, " -b, --meleezoom=MODE (step, aka pc, or smooth, aka 3do; " log_add (log_User, " -b, --meleezoom=MODE (step, aka pc, or smooth, aka 3do; "
"default is 3do)"); "default is 3do)");
log_add (log_Always, " -s, --scanlines (default off)"); log_add (log_User, " -s, --scanlines (default off)");
log_add (log_Always, " -p, --fps (default off)"); log_add (log_User, " -p, --fps (default off)");
log_add (log_Always, " -g, --gamma=CORRECTIONVALUE (default 1.0, which " log_add (log_User, " -g, --gamma=CORRECTIONVALUE (default 1.0, which "
"causes no change)"); "causes no change)");
log_add (log_Always, " -C, --configdir=CONFIGDIR"); log_add (log_User, " -C, --configdir=CONFIGDIR");
log_add (log_Always, " -n, --contentdir=CONTENTDIR"); log_add (log_User, " -n, --contentdir=CONTENTDIR");
log_add (log_Always, " -M, --musicvol=VOLUME (0-100, default 100)"); log_add (log_User, " -M, --musicvol=VOLUME (0-100, default 100)");
log_add (log_Always, " -S, --sfxvol=VOLUME (0-100, default 100)"); log_add (log_User, " -S, --sfxvol=VOLUME (0-100, default 100)");
log_add (log_Always, " -T, --speechvol=VOLUME (0-100, default 100)"); log_add (log_User, " -T, --speechvol=VOLUME (0-100, default 100)");
log_add (log_Always, " -q, --audioquality=QUALITY (high, medium or low, " log_add (log_User, " -q, --audioquality=QUALITY (high, medium or low, "
"default medium)"); "default medium)");
log_add (log_Always, " -u, --nosubtitles"); log_add (log_User, " -u, --nosubtitles");
log_add (log_Always, " -l, --logfile=FILE (sends console output to logfile " log_add (log_User, " -l, --logfile=FILE (sends console output to logfile "
"FILE)"); "FILE)");
log_add (log_Always, " --addon ADDON (using a specific addon; " log_add (log_User, " --addon ADDON (using a specific addon; "
"may be specified multiple times)"); "may be specified multiple times)");
log_add (log_Always, " --sound=DRIVER (openal, mixsdl, none; default " log_add (log_User, " --sound=DRIVER (openal, mixsdl, none; default "
"mixsdl)"); "mixsdl)");
log_add (log_Always, " --stereosfx (enables positional sound effects, " log_add (log_User, " --stereosfx (enables positional sound effects, "
"currently only for openal)"); "currently only for openal)");
log_add (log_Always, "The following options can take either '3do' or 'pc' " log_add (log_User, "The following options can take either '3do' or 'pc' "
"as an option:"); "as an option:");
log_add (log_Always, " -m, --music : Music version (default %s)", log_add (log_User, " -m, --music : Music version (default %s)",
PC_3DO_optString(defaultOptions->whichMusic)); PC_3DO_optString(defaultOptions->whichMusic));
log_add (log_Always, " -i, --intro : Intro/ending version (default %s)", log_add (log_User, " -i, --intro : Intro/ending version (default %s)",
PC_3DO_optString(defaultOptions->whichIntro)); PC_3DO_optString(defaultOptions->whichIntro));
log_add (log_Always, " --cscan : coarse-scan display, pc=text, " log_add (log_User, " --cscan : coarse-scan display, pc=text, "
"3do=hieroglyphs (default %s)", "3do=hieroglyphs (default %s)",
PC_3DO_optString(defaultOptions->whichCoarseScan)); PC_3DO_optString(defaultOptions->whichCoarseScan));
log_add (log_Always, " --menu : menu type, pc=text, 3do=graphical " log_add (log_User, " --menu : menu type, pc=text, 3do=graphical "
"(default %s)", PC_3DO_optString(defaultOptions->whichMenu)); "(default %s)", PC_3DO_optString(defaultOptions->whichMenu));
log_add (log_Always, " --font : font types and colors (default %s)", log_add (log_User, " --font : font types and colors (default %s)",
PC_3DO_optString(defaultOptions->whichFonts)); PC_3DO_optString(defaultOptions->whichFonts));
log_add (log_Always, " --shield : slave shield type; pc=static, " log_add (log_User, " --shield : slave shield type; pc=static, "
"3do=throbbing (default %s)", "3do=throbbing (default %s)",
PC_3DO_optString(defaultOptions->whichShield)); PC_3DO_optString(defaultOptions->whichShield));
log_add (log_Always, " --scroll : ff/frev during comm. pc=per-page, " log_add (log_User, " --scroll : ff/frev during comm. pc=per-page, "
"3do=smooth (default %s)", "3do=smooth (default %s)",
PC_3DO_optString(defaultOptions->smoothScroll)); PC_3DO_optString(defaultOptions->smoothScroll));
@@ -920,9 +920,8 @@ usage (FILE *out, const struct options_struct *defaultOptions)
static int static int
InvalidArgument (const char *supplied, const char *opt_name) InvalidArgument (const char *supplied, const char *opt_name)
{ {
log_add (log_Always, "Invalid argument '%s' to option %s.", log_add (log_Fatal, "Invalid argument '%s' to option %s.",
supplied, opt_name); supplied, opt_name);
log_add (log_Always, "Use -h to see the allowed arguments.");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -932,7 +931,7 @@ Check_PC_3DO_opt (const char *value, DWORD mask, const char *optName,
{ {
if (value == NULL) if (value == NULL)
{ {
log_add (log_Always, "Error: option '%s' requires a value.", log_add (log_Error, "Error: option '%s' requires a value.",
optName); optName);
return -1; return -1;
} }
@@ -947,7 +946,7 @@ Check_PC_3DO_opt (const char *value, DWORD mask, const char *optName,
*result = OPT_PC; *result = OPT_PC;
return 0; return 0;
} }
log_add (log_Always, "Error: Invalid option '%s %s' found.", log_add (log_Error, "Error: Invalid option '%s %s' found.",
optName, value); optName, value);
return -1; return -1;
} }