From 5b5bfaf6964d7f87a8f0ac3ab47f1ea8c49a2af6 Mon Sep 17 00:00:00 2001 From: nastys <7950891+nastys@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:58:00 +0200 Subject: [PATCH] Updater API V3 (macOS only) (#16086) --- rpcs3/rpcs3qt/update_manager.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/rpcs3/rpcs3qt/update_manager.cpp b/rpcs3/rpcs3qt/update_manager.cpp index 080f031f69..8afd0e56e6 100644 --- a/rpcs3/rpcs3qt/update_manager.cpp +++ b/rpcs3/rpcs3qt/update_manager.cpp @@ -10,6 +10,7 @@ #include "Emu/system_utils.hpp" #include "Crypto/utils.h" #include "util/logs.hpp" +#include "util/types.hpp" #include #include @@ -43,6 +44,16 @@ #include #endif +#if defined(__APPLE__) +// sysinfo_darwin.mm +namespace Darwin_Version +{ + extern int getNSmajorVersion(); + extern int getNSminorVersion(); + extern int getNSpatchVersion(); +} +#endif + LOG_CHANNEL(update_log, "UPDATER"); update_manager::update_manager(QObject* parent, std::shared_ptr gui_settings) @@ -96,7 +107,26 @@ void update_manager::check_for_updates(bool automatic, bool check_only, bool aut Q_EMIT signal_update_available(result_json && !m_update_message.isEmpty()); }); +#if defined(__APPLE__) + const std::string url = fmt::format("https://update.rpcs3.net/" + "?api=v3" + "&c=%s" + "&os_type=macos" + "&os_arch=" +#if defined(ARCH_X64) + "x64" +#elif defined(ARCH_ARM64) + "arm64" +#endif + "&os_version=%i.%i.%i", + rpcs3::get_commit_and_hash().second, + Darwin_Version::getNSmajorVersion(), + Darwin_Version::getNSminorVersion(), + Darwin_Version::getNSpatchVersion()); +#else const std::string url = "https://update.rpcs3.net/?api=v2&c=" + rpcs3::get_commit_and_hash().second; +#endif + m_downloader->start(url, true, !automatic, tr("Checking For Updates"), true); }