- added an errorlog option.

This cuts down on as much message noise as possible, outputs everything to a file specified as a parameter and then quits immediately, allowing this to run from a batch that's supposed to check a larger list of files for errors.
Multiple outputs get appended if the file already exists.
This commit is contained in:
Christoph Oelckers 2016-02-09 14:20:49 +01:00
commit 4d2a52418f
22 changed files with 96 additions and 70 deletions

View file

@ -228,6 +228,7 @@ bool nospriterename;
FStartupInfo DoomStartupInfo;
FString lastIWAD;
int restart = 0;
bool batchrun; // just run the startup and collect all error messages in a logfile, then quit without any interaction
cycle_t FrameCycles;
@ -1868,7 +1869,6 @@ static FString ParseGameInfo(TArray<FString> &pwads, const char *fn, const char
static FString CheckGameInfo(TArray<FString> & pwads)
{
DWORD t = I_FPSTime();
// scan the list of WADs backwards to find the last one that contains a GAMEINFO lump
for(int i=pwads.Size()-1; i>=0; i--)
{
@ -1920,8 +1920,6 @@ static FString CheckGameInfo(TArray<FString> & pwads)
delete resfile;
}
}
t = I_FPSTime() - t;
Printf("Gameinfo scan took %d ms\n", t);
return "";
}
@ -2002,7 +2000,7 @@ static void D_DoomInit()
{
rngseed = staticrngseed = atoi(v);
use_staticrng = true;
Printf("D_DoomInit: Static RNGseed %d set.\n", rngseed);
if (!batchrun) Printf("D_DoomInit: Static RNGseed %d set.\n", rngseed);
}
else
{
@ -2012,7 +2010,7 @@ static void D_DoomInit()
FRandom::StaticClearRandom ();
Printf ("M_LoadDefaults: Load system defaults.\n");
if (!batchrun) Printf ("M_LoadDefaults: Load system defaults.\n");
M_LoadDefaults (); // load before initing other systems
}
@ -2080,7 +2078,7 @@ static void CheckCmdLine()
int p;
const char *v;
Printf ("Checking cmd-line parameters...\n");
if (!batchrun) Printf ("Checking cmd-line parameters...\n");
if (Args->CheckParm ("-nomonsters")) flags |= DF_NO_MONSTERS;
if (Args->CheckParm ("-respawn")) flags |= DF_MONSTERS_RESPAWN;
if (Args->CheckParm ("-fast")) flags |= DF_FAST_MONSTERS;
@ -2222,6 +2220,7 @@ void D_DoomMain (void)
FString *args;
int argcount;
FIWadManager *iwad_man;
const char *batchout = Args->CheckValue("-errorlog");
// +logfile gets checked too late to catch the full startup log in the logfile so do some extra check for it here.
FString logfile = Args->TakeValue("+logfile");
@ -2229,6 +2228,17 @@ void D_DoomMain (void)
{
execLogfile(logfile);
}
else if (batchout != NULL && *batchout != 0)
{
batchrun = true;
execLogfile(batchout, true);
Printf("Command line: ");
for (int i = 0; i < Args->NumArgs(); i++)
{
Printf("%s ", Args->GetArg(i));
}
Printf("\n");
}
if (Args->CheckParm("-hashfiles"))
{
@ -2339,7 +2349,7 @@ void D_DoomMain (void)
Printf("Notice: File hashing is incredibly verbose. Expect loading files to take much longer than usual.\n");
}
Printf ("W_Init: Init WADfiles.\n");
if (!batchrun) Printf ("W_Init: Init WADfiles.\n");
Wads.InitMultipleFiles (allwads);
allwads.Clear();
allwads.ShrinkToFit();
@ -2370,21 +2380,21 @@ void D_DoomMain (void)
if (!restart)
{
Printf ("I_Init: Setting up machine state.\n");
if (!batchrun) Printf ("I_Init: Setting up machine state.\n");
I_Init ();
I_CreateRenderer();
}
Printf ("V_Init: allocate screen.\n");
if (!batchrun) Printf ("V_Init: allocate screen.\n");
V_Init (!!restart);
// Base systems have been inited; enable cvar callbacks
FBaseCVar::EnableCallbacks ();
Printf ("S_Init: Setting up sound.\n");
if (!batchrun) Printf ("S_Init: Setting up sound.\n");
S_Init ();
Printf ("ST_Init: Init startup screen.\n");
if (!batchrun) Printf ("ST_Init: Init startup screen.\n");
if (!restart)
{
StartScreen = FStartupScreen::CreateInstance (TexMan.GuesstimateNumTextures() + 5);
@ -2402,23 +2412,23 @@ void D_DoomMain (void)
S_ParseReverbDef ();
// [RH] Parse any SNDINFO lumps
Printf ("S_InitData: Load sound definitions.\n");
if (!batchrun) Printf ("S_InitData: Load sound definitions.\n");
S_InitData ();
// [RH] Parse through all loaded mapinfo lumps
Printf ("G_ParseMapInfo: Load map definitions.\n");
if (!batchrun) Printf ("G_ParseMapInfo: Load map definitions.\n");
G_ParseMapInfo (iwad_info->MapInfo);
ReadStatistics();
// MUSINFO must be parsed after MAPINFO
S_ParseMusInfo();
Printf ("Texman.Init: Init texture manager.\n");
if (!batchrun) Printf ("Texman.Init: Init texture manager.\n");
TexMan.Init();
C_InitConback();
// [CW] Parse any TEAMINFO lumps.
Printf ("ParseTeamInfo: Load team definitions.\n");
if (!batchrun) Printf ("ParseTeamInfo: Load team definitions.\n");
TeamLibrary.ParseTeamInfo ();
PClassActor::StaticInit ();
@ -2437,11 +2447,11 @@ void D_DoomMain (void)
StartScreen->Progress ();
Printf ("R_Init: Init %s refresh subsystem.\n", gameinfo.ConfigName.GetChars());
if (!batchrun) Printf ("R_Init: Init %s refresh subsystem.\n", gameinfo.ConfigName.GetChars());
StartScreen->LoadingStatus ("Loading graphics", 0x3f);
R_Init ();
Printf ("DecalLibrary: Load decals.\n");
if (!batchrun) Printf ("DecalLibrary: Load decals.\n");
DecalLibrary.ReadAllDecals ();
// [RH] Add any .deh and .bex files on the command line.
@ -2458,7 +2468,7 @@ void D_DoomMain (void)
{
if (stricmp (key, "Path") == 0 && FileExists (value))
{
Printf ("Applying patch %s\n", value);
if (!batchrun) Printf ("Applying patch %s\n", value);
D_LoadDehFile(value);
}
}
@ -2483,10 +2493,10 @@ void D_DoomMain (void)
bglobal.spawn_tries = 0;
bglobal.wanted_botnum = bglobal.getspawned.Size();
Printf ("M_Init: Init menus.\n");
if (!batchrun) Printf ("M_Init: Init menus.\n");
M_Init ();
Printf ("P_Init: Init Playloop state.\n");
if (!batchrun) Printf ("P_Init: Init Playloop state.\n");
StartScreen->LoadingStatus ("Init game engine", 0x3f);
AM_StaticInit();
P_Init ();
@ -2497,22 +2507,25 @@ void D_DoomMain (void)
SBarInfo::Load();
HUD_InitHud();
// [RH] User-configurable startup strings. Because BOOM does.
static const char *startupString[5] = {
"STARTUP1", "STARTUP2", "STARTUP3", "STARTUP4", "STARTUP5"
};
for (p = 0; p < 5; ++p)
if (!batchrun)
{
const char *str = GStrings[startupString[p]];
if (str != NULL && str[0] != '\0')
// [RH] User-configurable startup strings. Because BOOM does.
static const char *startupString[5] = {
"STARTUP1", "STARTUP2", "STARTUP3", "STARTUP4", "STARTUP5"
};
for (p = 0; p < 5; ++p)
{
Printf ("%s\n", str);
const char *str = GStrings[startupString[p]];
if (str != NULL && str[0] != '\0')
{
Printf("%s\n", str);
}
}
}
if (!restart)
{
Printf ("D_CheckNetGame: Checking network game status.\n");
if (!batchrun) Printf ("D_CheckNetGame: Checking network game status.\n");
StartScreen->LoadingStatus ("Checking network game status.", 0x3f);
D_CheckNetGame ();
}
@ -2545,7 +2558,7 @@ void D_DoomMain (void)
StartScreen = NULL;
S_Sound (CHAN_BODY, "misc/startupdone", 1, ATTN_NONE);
if (Args->CheckParm("-norun"))
if (Args->CheckParm("-norun") || batchrun)
{
throw CNoRunExit();
}