1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-21 18:22:33 +01:00

Updater API V3 (macOS only) (#16086)

This commit is contained in:
nastys 2024-09-19 21:58:00 +02:00 committed by GitHub
parent 3d9c8a670e
commit 5b5bfaf696
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,7 @@
#include "Emu/system_utils.hpp"
#include "Crypto/utils.h"
#include "util/logs.hpp"
#include "util/types.hpp"
#include <QApplication>
#include <QDateTime>
@ -43,6 +44,16 @@
#include <sys/stat.h>
#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> 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);
}