diff --git a/CMakeModules/GenerateSCMRev.cmake b/CMakeModules/GenerateSCMRev.cmake index 2d7081b7db..1ae608c085 100644 --- a/CMakeModules/GenerateSCMRev.cmake +++ b/CMakeModules/GenerateSCMRev.cmake @@ -31,7 +31,11 @@ set(GIT_DESC ${BUILD_VERSION}) set(REPO_NAME "Eden") set(BUILD_ID ${GIT_REFSPEC}) set(BUILD_FULLNAME "${REPO_NAME} ${BUILD_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) diff --git a/src/common/scm_rev.cpp.in b/src/common/scm_rev.cpp.in index 1630ceae83..08b8c68835 100644 --- a/src/common/scm_rev.cpp.in +++ b/src/common/scm_rev.cpp.in @@ -18,6 +18,9 @@ #define TITLE_BAR_FORMAT_RUNNING "@TITLE_BAR_FORMAT_RUNNING@" #define IS_DEV_BUILD @IS_DEV_BUILD@ #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 { @@ -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 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 diff --git a/src/common/scm_rev.h b/src/common/scm_rev.h index 8f48241557..b89de95a3d 100644 --- a/src/common/scm_rev.h +++ b/src/common/scm_rev.h @@ -21,5 +21,8 @@ extern const char g_title_bar_format_running[]; extern const char g_shader_cache_version[]; extern const char g_compiler_id[]; extern const bool g_is_dev_build; +extern const char g_build_auto_update_website[]; +extern const char g_build_auto_update_api[]; +extern const char g_build_auto_update_repo[]; } // namespace Common diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp index b7c0cd58d5..9f7597f471 100644 --- a/src/yuzu/about_dialog.cpp +++ b/src/yuzu/about_dialog.cpp @@ -14,11 +14,12 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent) , ui{std::make_unique()} { - 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 compiler = std::string{Common::g_compiler_id}; - - static const std::string yuzu_build = fmt::format("Eden | {} | {}", description, compiler); + static const std::string yuzu_build = fmt::format("{} | {} | {}", + std::string{Common::g_build_name}, + std::string{Common::g_build_version}, + std::string{Common::g_compiler_id} + ); const auto override_build = fmt::format(fmt::runtime( std::string(Common::g_title_bar_format_idle)), diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index d2c12c9d40..71cc0a7e6b 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -4192,23 +4192,25 @@ void GMainWindow::OnEmulatorUpdateAvailable() { update_prompt.addButton(QMessageBox::Yes); update_prompt.addButton(QMessageBox::Ignore); 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(); if (update_prompt.button(QMessageBox::Yes) == update_prompt.clickedButton()) { - QDesktopServices::openUrl( - QUrl(QString::fromStdString("https://github.com/eden-emulator/Releases/releases/tag/") + - version_string)); + auto const full_url = fmt::format("{}/{}/releases/tag/", + std::string{Common::g_build_auto_update_website}, + std::string{Common::g_build_auto_update_repo} + ); + QDesktopServices::openUrl(QUrl(QString::fromStdString(full_url) + version_string)); } } #endif void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_view title_version, std::string_view gpu_vendor) { - 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 compiler = std::string{Common::g_compiler_id}; - - static const std::string yuzu_title = fmt::format("Eden | {} | {}", description, compiler); + static const std::string yuzu_title = fmt::format("{} | {} | {}", + std::string{Common::g_build_name}, + std::string{Common::g_build_version}, + std::string{Common::g_compiler_id} + ); const auto override_title = fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id); diff --git a/src/yuzu/update_checker.cpp b/src/yuzu/update_checker.cpp index 8291987d73..76b436d1d1 100644 --- a/src/yuzu/update_checker.cpp +++ b/src/yuzu/update_checker.cpp @@ -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 // Licensed under GPLv2 or any later version // Refer to the license.txt file included. @@ -12,6 +15,7 @@ #include #include #include +#include "common/scm_rev.h" std::optional UpdateChecker::GetResponse(std::string url, std::string path) { @@ -54,8 +58,8 @@ std::optional UpdateChecker::GetResponse(std::string url, std::stri std::optional UpdateChecker::GetLatestRelease(bool include_prereleases) { - constexpr auto update_check_url = "http://api.github.com"; - std::string update_check_path = "/repos/eden-emulator/Releases"; + constexpr auto update_check_url = std::string{Common::g_build_auto_update_api}; + std::string update_check_path = fmt::format("/repos/{}", std::string{Common::g_build_auto_update_repo}); try { if (include_prereleases) { // This can return either a prerelease or a stable release, // whichever is more recent. diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index 9ec6b1d594..4b56f3794b 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp @@ -229,7 +229,7 @@ void EmuWindow_SDL2::WaitEvent() { const u32 current_time = SDL_GetTicks(); if (current_time > last_time + 2000) { const auto results = system.GetAndResetPerfStats(); - const auto title = fmt::format("Eden {} | {}-{} | FPS: {:.0f} ({:.0f}%)", + const auto title = fmt::format("{} | {}-{} | FPS: {:.0f} ({:.0f}%)", Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc, diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp index 4b012fe134..32f365e0d0 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp @@ -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-License-Identifier: GPL-2.0-or-later @@ -90,7 +93,7 @@ EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsyste } SDL_GL_SetSwapInterval(0); - std::string window_title = fmt::format("Eden {} | {}-{}", Common::g_build_fullname, + std::string window_title = fmt::format("{} | {}-{}", Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc); render_window = SDL_CreateWindow(window_title.c_str(), @@ -138,7 +141,7 @@ EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsyste OnResize(); OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); SDL_PumpEvents(); - LOG_INFO(Frontend, "Eden Version: {} | {}-{}", Common::g_build_fullname, Common::g_scm_branch, + LOG_INFO(Frontend, "Build string: {} | {}-{}", Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc); Settings::LogSettings(); }