mirror of https://github.com/PCSX2/pcsx2.git
Qt: Support overriding log file on command line
This commit is contained in:
parent
c404bd9f17
commit
5e9710a8c6
|
@ -1595,6 +1595,7 @@ void QtHost::PrintCommandLineHelp(const std::string_view& progname)
|
|||
std::fprintf(stderr, " -nogui: Hides main window while running (implies batch mode).\n");
|
||||
std::fprintf(stderr, " -elf <file>: Overrides the boot ELF with the specified filename.\n");
|
||||
std::fprintf(stderr, " -disc <path>: Uses the specified host DVD drive as a source.\n");
|
||||
std::fprintf(stderr, " -logfile <path>: Writes the application log to path instead of emulog.txt.\n");
|
||||
std::fprintf(stderr, " -bios: Starts the BIOS (System Menu/OSDSYS).\n");
|
||||
std::fprintf(stderr, " -fastboot: Force fast boot for provided filename.\n");
|
||||
std::fprintf(stderr, " -slowboot: Force slow boot for provided filename.\n");
|
||||
|
@ -1689,6 +1690,11 @@ bool QtHost::ParseCommandLineOptions(const QStringList& args, std::shared_ptr<VM
|
|||
AutoBoot(autoboot)->filename = (++it)->toStdString();
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG_PARAM(QStringLiteral("-logfile")))
|
||||
{
|
||||
CommonHost::SetFileLogPath((++it)->toStdString());
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG(QStringLiteral("-bios")))
|
||||
{
|
||||
AutoBoot(autoboot)->source_type = CDVD_SourceType::NoDisc;
|
||||
|
|
|
@ -343,7 +343,9 @@ static void UpdateLoggingSinks(bool system_console, bool file_log)
|
|||
{
|
||||
if (!emuLog)
|
||||
{
|
||||
emuLogName = Path::Combine(EmuFolders::Logs, "emulog.txt");
|
||||
if (emuLogName.empty())
|
||||
emuLogName = Path::Combine(EmuFolders::Logs, "emulog.txt");
|
||||
|
||||
emuLog = FileSystem::OpenCFile(emuLogName.c_str(), "wb");
|
||||
file_log = (emuLog != nullptr);
|
||||
}
|
||||
|
@ -365,6 +367,22 @@ static void UpdateLoggingSinks(bool system_console, bool file_log)
|
|||
Console_SetActiveHandler(ConsoleWriter_Null);
|
||||
}
|
||||
|
||||
void CommonHost::SetFileLogPath(std::string path)
|
||||
{
|
||||
if (emuLogName == path)
|
||||
return;
|
||||
|
||||
emuLogName = std::move(path);
|
||||
|
||||
// reopen on change
|
||||
if (emuLog)
|
||||
{
|
||||
std::fclose(emuLog);
|
||||
if (!emuLogName.empty())
|
||||
emuLog = FileSystem::OpenCFile(emuLogName.c_str(), "wb");
|
||||
}
|
||||
}
|
||||
|
||||
void CommonHost::SetBlockSystemConsole(bool block)
|
||||
{
|
||||
s_block_system_console = block;
|
||||
|
|
|
@ -19,6 +19,9 @@ class SettingsInterface;
|
|||
|
||||
namespace CommonHost
|
||||
{
|
||||
/// Overrides the filename used for the file log.
|
||||
void SetFileLogPath(std::string path);
|
||||
|
||||
/// Prevents the system console from being displayed.
|
||||
void SetBlockSystemConsole(bool block);
|
||||
|
||||
|
|
Loading…
Reference in New Issue