GSRunner: Fix log file writing

Wasn't getting flushed/closed on shutdown.
This commit is contained in:
Stenzek 2023-05-21 16:29:30 +10:00 committed by refractionpcsx2
parent 338a2beaf0
commit 90a6088d61
4 changed files with 14 additions and 5 deletions

View File

@ -644,6 +644,7 @@ int main(int argc, char* argv[])
VMManager::Internal::CPUThreadShutdown();
GSRunner::DestroyPlatformWindow();
LogSink::CloseFileLog();
return EXIT_SUCCESS;
}

View File

@ -1837,11 +1837,7 @@ int main(int argc, char* argv[])
s_base_settings_interface->Save();
// Ensure emulog is flushed.
if (emuLog)
{
std::fclose(emuLog);
emuLog = nullptr;
}
LogSink::CloseFileLog();
return result;
}

View File

@ -383,6 +383,15 @@ void LogSink::SetFileLogPath(std::string path)
}
}
void LogSink::CloseFileLog()
{
if (!emuLog)
return;
std::fclose(emuLog);
emuLog = nullptr;
}
void LogSink::SetBlockSystemConsole(bool block)
{
s_block_system_console = block;

View File

@ -22,6 +22,9 @@ namespace LogSink
/// Overrides the filename used for the file log.
void SetFileLogPath(std::string path);
/// Ensures file log is flushed and closed.
void CloseFileLog();
/// Prevents the system console from being displayed.
void SetBlockSystemConsole(bool block);