Add command line switch -Z to write detailed version information
This commit is contained in:
@@ -508,6 +508,26 @@ char *CrashLog::FillDesyncCrashLog(char *buffer, const char *last, const DesyncE
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill the version info log buffer.
|
||||
* @param buffer The begin where to write at.
|
||||
* @param last The last position in the buffer to write to.
|
||||
* @return the position of the \c '\0' character after the buffer.
|
||||
*/
|
||||
char *CrashLog::FillVersionInfoLog(char *buffer, const char *last) const
|
||||
{
|
||||
buffer += seprintf(buffer, last, "*** OpenTTD Version Info Report ***\n\n");
|
||||
|
||||
buffer = this->LogOpenTTDVersion(buffer, last);
|
||||
buffer = this->LogOSVersion(buffer, last);
|
||||
buffer = this->LogCompiler(buffer, last);
|
||||
buffer = this->LogOSVersionDetail(buffer, last);
|
||||
buffer = this->LogLibraries(buffer, last);
|
||||
|
||||
buffer += seprintf(buffer, last, "*** End of OpenTTD Version Info Report ***\n");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the crash log to a file.
|
||||
* @note On success the filename will be filled with the full path of the
|
||||
@@ -705,6 +725,19 @@ bool CrashLog::MakeDesyncCrashLog(const std::string *log_in, std::string *log_ou
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a version info log, writes it to a file. It uses DEBUG to write
|
||||
* information like paths to the console.
|
||||
* @return true when everything is made successfully.
|
||||
*/
|
||||
bool CrashLog::MakeVersionInfoLog() const
|
||||
{
|
||||
char buffer[65536];
|
||||
this->FillVersionInfoLog(buffer, lastof(buffer));
|
||||
printf("%s\n", buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a crash dump and crash savegame. It uses DEBUG to write
|
||||
* information like paths to the console.
|
||||
|
@@ -129,6 +129,7 @@ public:
|
||||
|
||||
char *FillCrashLog(char *buffer, const char *last) const;
|
||||
char *FillDesyncCrashLog(char *buffer, const char *last, const DesyncExtraInfo &info) const;
|
||||
char *FillVersionInfoLog(char *buffer, const char *last) const;
|
||||
bool WriteCrashLog(const char *buffer, char *filename, const char *filename_last, const char *name = "crash", FILE **crashlog_file = nullptr) const;
|
||||
|
||||
/**
|
||||
@@ -146,6 +147,7 @@ public:
|
||||
|
||||
bool MakeCrashLog() const;
|
||||
bool MakeDesyncCrashLog(const std::string *log_in, std::string *log_out, const DesyncExtraInfo &info) const;
|
||||
bool MakeVersionInfoLog() const;
|
||||
bool MakeCrashSavegameAndScreenshot() const;
|
||||
|
||||
/**
|
||||
@@ -156,6 +158,7 @@ public:
|
||||
static void InitialiseCrashLog();
|
||||
|
||||
static void DesyncCrashLog(const std::string *log_in, std::string *log_out, const DesyncExtraInfo &info);
|
||||
static void VersionInfoLog();
|
||||
|
||||
static void SetErrorMessage(const char *message);
|
||||
static void AfterCrashLogCleanup();
|
||||
|
@@ -231,6 +231,7 @@ static void ShowHelp()
|
||||
" -c config_file = Use 'config_file' instead of 'openttd.cfg'\n"
|
||||
" -x = Do not automatically save to config file on exit\n"
|
||||
" -q savegame = Write some information about the savegame and exit\n"
|
||||
" -Z = Write detailed version information and exit\n"
|
||||
"\n",
|
||||
lastof(buf)
|
||||
);
|
||||
@@ -649,6 +650,7 @@ static const OptionData _options[] = {
|
||||
GETOPT_SHORT_VALUE('K'),
|
||||
GETOPT_SHORT_NOVAL('h'),
|
||||
GETOPT_SHORT_VALUE('J'),
|
||||
GETOPT_SHORT_NOVAL('Z'),
|
||||
GETOPT_END()
|
||||
};
|
||||
|
||||
@@ -804,6 +806,10 @@ int openttd_main(int argc, char *argv[])
|
||||
case 'c': free(_config_file); _config_file = stredup(mgo.opt); break;
|
||||
case 'x': scanner->save_config = false; break;
|
||||
case 'J': _quit_after_days = Clamp(atoi(mgo.opt), 0, INT_MAX); break;
|
||||
case 'Z': {
|
||||
CrashLog::VersionInfoLog();
|
||||
goto exit_noshutdown;
|
||||
}
|
||||
case 'h':
|
||||
i = -2; // Force printing of help.
|
||||
break;
|
||||
|
@@ -521,3 +521,9 @@ void CDECL HandleCrash(int signum, siginfo_t *si, void *context)
|
||||
CrashLogOSX log(CrashLogOSX::DesyncTag{});
|
||||
log.MakeDesyncCrashLog(log_in, log_out, info);
|
||||
}
|
||||
|
||||
/* static */ void CrashLog::VersionInfoLog()
|
||||
{
|
||||
CrashLogOSX log(CrashLogOSX::DesyncTag{});
|
||||
log.MakeVersionInfoLog();
|
||||
}
|
||||
|
@@ -625,3 +625,9 @@ static void CDECL HandleCrash(int signum)
|
||||
CrashLogUnix log(CrashLogUnix::DesyncTag{});
|
||||
log.MakeDesyncCrashLog(log_in, log_out, info);
|
||||
}
|
||||
|
||||
/* static */ void CrashLog::VersionInfoLog()
|
||||
{
|
||||
CrashLogUnix log(CrashLogUnix::DesyncTag{});
|
||||
log.MakeVersionInfoLog();
|
||||
}
|
||||
|
@@ -621,6 +621,12 @@ static void CDECL CustomAbort(int signal)
|
||||
log.MakeDesyncCrashLog(log_in, log_out, info);
|
||||
}
|
||||
|
||||
/* static */ void CrashLog::VersionInfoLog()
|
||||
{
|
||||
CrashLogWindows log(nullptr);
|
||||
log.MakeVersionInfoLog();
|
||||
}
|
||||
|
||||
/* The crash log GUI */
|
||||
|
||||
static bool _expanded;
|
||||
|
Reference in New Issue
Block a user