- check +logfile explicitly at the start of execution. Due to the custom CVAR rewrite it would get called so late that it'd miss half of the log.

- added version check for Windows 8. I also would have liked to add 8.1 but due to some incredibly stupid changes in the version API it's no longer possible to reliably retrieve the correct Windows version for later builds.
This commit is contained in:
Christoph Oelckers 2014-04-16 09:53:07 +02:00
parent 361341e07e
commit 48b926e5b4
4 changed files with 37 additions and 10 deletions

View File

@ -441,27 +441,33 @@ CCMD (exec)
}
}
void execLogfile(const char *fn)
{
if ((Logfile = fopen(fn, "w")))
{
const char *timestr = myasctime();
Printf("Log started: %s\n", timestr);
}
else
{
Printf("Could not start log\n");
}
}
CCMD (logfile)
{
const char *timestr = myasctime ();
if (Logfile)
{
Printf ("Log stopped: %s\n", timestr);
const char *timestr = myasctime();
Printf("Log stopped: %s\n", timestr);
fclose (Logfile);
Logfile = NULL;
}
if (argv.argc() >= 2)
{
if ( (Logfile = fopen (argv[1], "w")) )
{
Printf ("Log started: %s\n", timestr);
}
else
{
Printf ("Could not start log\n");
}
execLogfile(argv[1]);
}
}

View File

@ -168,4 +168,6 @@ extern unsigned int MakeKey (const char *s);
extern unsigned int MakeKey (const char *s, size_t len);
extern unsigned int SuperFastHash (const char *data, size_t len);
void execLogfile(const char *fn);
#endif //__C_DISPATCH_H__

View File

@ -2223,6 +2223,13 @@ void D_DoomMain (void)
FString *args;
int argcount;
// +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");
if (logfile != NULL)
{
execLogfile(logfile);
}
D_DoomInit();
PClass::StaticInit ();
atterm(FinalGC);

View File

@ -581,6 +581,18 @@ void I_DetectOS(void)
osname = "Server 2008 R2";
}
}
else if (info.dwMinorVersion == 2)
{
// Microsoft broke this API for 8.1 so without jumping through hoops it won't be possible anymore to detect never versions aside from the build number, especially for older compilers.
if (info.wProductType == VER_NT_WORKSTATION)
{
osname = "8 (or higher)";
}
else
{
osname = "Server 2012 (or higher)";
}
}
}
break;