extend to auto updater

Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2025-09-26 09:04:32 +00:00
parent 9fc154a8c9
commit 689c8c819b
Signed by: Lizzie
GPG key ID: 00287378CADCAB13
6 changed files with 37 additions and 16 deletions

View file

@ -31,7 +31,11 @@ set(GIT_DESC ${BUILD_VERSION})
set(REPO_NAME "Eden") set(REPO_NAME "Eden")
set(BUILD_ID ${GIT_REFSPEC}) set(BUILD_ID ${GIT_REFSPEC})
set(BUILD_FULLNAME "${REPO_NAME} ${BUILD_VERSION} ") set(BUILD_FULLNAME "${REPO_NAME} ${BUILD_VERSION} ")
set(CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}") set(CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
# Auto-updater metadata! Must somewhat mirror GitHub API endpoint
set(BUILD_AUTO_UPDATE_WEBSITE "https://github.com")
set(BUILD_AUTO_UPDATE_API "http://api.github.com")
set(BUILD_AUTO_UPDATE_REPO "eden-emulator/Releases")
configure_file(scm_rev.cpp.in scm_rev.cpp @ONLY) configure_file(scm_rev.cpp.in scm_rev.cpp @ONLY)

View file

@ -18,6 +18,9 @@
#define TITLE_BAR_FORMAT_RUNNING "@TITLE_BAR_FORMAT_RUNNING@" #define TITLE_BAR_FORMAT_RUNNING "@TITLE_BAR_FORMAT_RUNNING@"
#define IS_DEV_BUILD @IS_DEV_BUILD@ #define IS_DEV_BUILD @IS_DEV_BUILD@
#define COMPILER_ID "@CXX_COMPILER@" #define COMPILER_ID "@CXX_COMPILER@"
#define BUILD_AUTO_UPDATE_WEBISTE "@BUILD_AUTO_UPDATE_WEBISTE@"
#define BUILD_AUTO_UPDATE_API "@BUILD_AUTO_UPDATE_API@"
#define BUILD_AUTO_UPDATE_REPO "@BUILD_AUTO_UPDATE_REPO@"
namespace Common { namespace Common {
@ -34,4 +37,8 @@ constexpr const char g_title_bar_format_running[] = TITLE_BAR_FORMAT_RUNNING;
constexpr const char g_compiler_id[] = COMPILER_ID; constexpr const char g_compiler_id[] = COMPILER_ID;
constexpr const bool g_is_dev_build = IS_DEV_BUILD; constexpr const bool g_is_dev_build = IS_DEV_BUILD;
constexpr const char g_build_auto_update_website[] = BUILD_AUTO_UPDATE_WEBISTE;
constexpr const char g_build_auto_update_api[] = BUILD_AUTO_UPDATE_API;
constexpr const char g_build_auto_update_repo[] = BUILD_AUTO_UPDATE_REPO;
} // namespace Common } // namespace Common

View file

@ -14,11 +14,12 @@ AboutDialog::AboutDialog(QWidget* parent)
: QDialog(parent) : QDialog(parent)
, ui{std::make_unique<Ui::AboutDialog>()} , ui{std::make_unique<Ui::AboutDialog>()}
{ {
static const std::string description = std::string{Common::g_build_version};
static const std::string build_id = std::string{Common::g_build_id}; static const std::string build_id = std::string{Common::g_build_id};
static const std::string compiler = std::string{Common::g_compiler_id}; static const std::string yuzu_build = fmt::format("{} | {} | {}",
std::string{Common::g_build_name},
static const std::string yuzu_build = fmt::format("Eden | {} | {}", description, compiler); std::string{Common::g_build_version},
std::string{Common::g_compiler_id}
);
const auto override_build = fmt::format(fmt::runtime( const auto override_build = fmt::format(fmt::runtime(
std::string(Common::g_title_bar_format_idle)), std::string(Common::g_title_bar_format_idle)),

View file

@ -4192,23 +4192,25 @@ void GMainWindow::OnEmulatorUpdateAvailable() {
update_prompt.addButton(QMessageBox::Yes); update_prompt.addButton(QMessageBox::Yes);
update_prompt.addButton(QMessageBox::Ignore); update_prompt.addButton(QMessageBox::Ignore);
update_prompt.setText( update_prompt.setText(
tr("Update %1 for Eden is available.\nWould you like to download it?").arg(version_string)); tr("Download the %1 update?").arg(version_string));
update_prompt.exec(); update_prompt.exec();
if (update_prompt.button(QMessageBox::Yes) == update_prompt.clickedButton()) { if (update_prompt.button(QMessageBox::Yes) == update_prompt.clickedButton()) {
QDesktopServices::openUrl( auto const full_url = fmt::format("{}/{}/releases/tag/",
QUrl(QString::fromStdString("https://github.com/eden-emulator/Releases/releases/tag/") + std::string{Common::g_build_auto_update_website},
version_string)); std::string{Common::g_build_auto_update_repo}
);
QDesktopServices::openUrl(QUrl(QString::fromStdString(full_url) + version_string));
} }
} }
#endif #endif
void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_view title_version, void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_view title_version,
std::string_view gpu_vendor) { std::string_view gpu_vendor) {
static const std::string description = std::string{Common::g_build_version}; static const std::string yuzu_title = fmt::format("{} | {} | {}",
static const std::string build_id = std::string{Common::g_build_id}; std::string{Common::g_build_name},
static const std::string compiler = std::string{Common::g_compiler_id}; std::string{Common::g_build_version},
std::string{Common::g_compiler_id}
static const std::string yuzu_title = fmt::format("Eden | {} | {}", description, compiler); );
const auto override_title = const auto override_title =
fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id); fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id);

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright Citra Emulator Project / Azahar Emulator Project // Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -12,6 +15,7 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <optional> #include <optional>
#include <string> #include <string>
#include "common/scm_rev.h"
std::optional<std::string> UpdateChecker::GetResponse(std::string url, std::string path) std::optional<std::string> UpdateChecker::GetResponse(std::string url, std::string path)
{ {
@ -54,8 +58,8 @@ std::optional<std::string> UpdateChecker::GetResponse(std::string url, std::stri
std::optional<std::string> UpdateChecker::GetLatestRelease(bool include_prereleases) std::optional<std::string> UpdateChecker::GetLatestRelease(bool include_prereleases)
{ {
constexpr auto update_check_url = "http://api.github.com"; constexpr auto update_check_url = std::string{Common::g_build_auto_update_api};
std::string update_check_path = "/repos/eden-emulator/Releases"; std::string update_check_path = fmt::format("/repos/{}", std::string{Common::g_build_auto_update_repo});
try { try {
if (include_prereleases) { // This can return either a prerelease or a stable release, if (include_prereleases) { // This can return either a prerelease or a stable release,
// whichever is more recent. // whichever is more recent.

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later