|
24 | 24 | #include "cpuinfo.h" |
25 | 25 |
|
26 | 26 | #include <functional> |
| 27 | +#include <ctime> |
27 | 28 | #include <QtCore/QCoreApplication> |
28 | 29 | #include <QtCore/QDir> |
29 | 30 | #include <QtCore/QFile> |
@@ -640,8 +641,8 @@ bool AutoUpdaterDialog::doUpdate(const std::string& application_dir, const std:: |
640 | 641 |
|
641 | 642 | const std::wstring wupdater_path = StringUtil::UTF8StringToWideString(updater_path); |
642 | 643 | const std::wstring wapplication_dir = StringUtil::UTF8StringToWideString(application_dir); |
643 | | - const std::wstring arguments = StringUtil::UTF8StringToWideString(fmt::format("{} \"{}\" \"{}\" \"{}\"", |
644 | | - QCoreApplication::applicationPid(), application_dir, zip_path, program_path)); |
| 644 | + const std::wstring arguments = StringUtil::UTF8StringToWideString(fmt::format("{} \"{}\" \"{}\" \"{}\" \"{}\" \"{}\"", |
| 645 | + QCoreApplication::applicationPid(), application_dir, zip_path, program_path, BuildVersion::GitRev, m_latest_version.toStdString())); |
645 | 646 |
|
646 | 647 | const bool needs_elevation = doesUpdaterNeedElevation(application_dir); |
647 | 648 |
|
@@ -756,6 +757,18 @@ bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& data, QProgressDial |
756 | 757 | return false; |
757 | 758 | } |
758 | 759 |
|
| 760 | + // Log the version transition for regression bisecting |
| 761 | + if (auto fp = FileSystem::OpenManagedCFile( |
| 762 | + Path::Combine(EmuFolders::DataRoot, "update_log.txt").c_str(), "ab")) |
| 763 | + { |
| 764 | + const std::time_t t = std::time(nullptr); |
| 765 | + char timestamp[32]; |
| 766 | + std::strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S", std::localtime(&t)); |
| 767 | + const std::string entry = fmt::format("[{}] Updated PCSX2 from {} to {}\n", |
| 768 | + timestamp, BuildVersion::GitRev, m_latest_version.toStdString()); |
| 769 | + std::fwrite(entry.c_str(), 1, entry.size(), fp.get()); |
| 770 | + } |
| 771 | + |
759 | 772 | // We exit once we return. |
760 | 773 | return true; |
761 | 774 | } |
@@ -894,6 +907,19 @@ bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& data, QProgressDial |
894 | 907 | reportError("Failed to start new application"); |
895 | 908 | return false; |
896 | 909 | } |
| 910 | + |
| 911 | + // Log the version transition for regression bisecting |
| 912 | + if (auto fp = FileSystem::OpenManagedCFile( |
| 913 | + Path::Combine(EmuFolders::DataRoot, "update_log.txt").c_str(), "ab")) |
| 914 | + { |
| 915 | + const std::time_t t = std::time(nullptr); |
| 916 | + char timestamp[32]; |
| 917 | + std::strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S", std::localtime(&t)); |
| 918 | + const std::string entry = fmt::format("[{}] Updated PCSX2 from {} to {}\n", |
| 919 | + timestamp, BuildVersion::GitRev, m_latest_version.toStdString()); |
| 920 | + std::fwrite(entry.c_str(), 1, entry.size(), fp.get()); |
| 921 | + } |
| 922 | + |
897 | 923 | return true; |
898 | 924 | } |
899 | 925 |
|
|
0 commit comments