diff --git a/src/core/game_overrides.cpp b/src/core/game_overrides.cpp index 626091fb0f..7f75e00c15 100644 --- a/src/core/game_overrides.cpp +++ b/src/core/game_overrides.cpp @@ -516,7 +516,25 @@ s.setting.SetValue(new_value); \ } std::optional GetOverridesFileVersion() { - // later used for/if download check override version + const auto path = GetOverridesPath(); + std::ifstream file(path); + if (!file.is_open()) { + return std::nullopt; + } + + std::string line; + if (std::getline(file, line)) { + line = Trim(line); + if (line.starts_with(kVersionPrefix)) { + const auto version_str = line.substr(std::strlen(kVersionPrefix)); + std::uint32_t version = 0; + auto [ptr, ec] = std::from_chars(version_str.data(), + version_str.data() + version_str.size(), version); + if (ec == std::errc{}) { + return version; + } + } + } return std::nullopt; } diff --git a/src/qt_common/config/shared_translation.cpp b/src/qt_common/config/shared_translation.cpp index e55e867cb8..38d239024f 100644 --- a/src/qt_common/config/shared_translation.cpp +++ b/src/qt_common/config/shared_translation.cpp @@ -447,6 +447,11 @@ std::unique_ptr InitializeTranslations(QObject* parent) enable_global_overrides, tr("Enable global game overrides"), tr("When enabled, per-game settings from the global overrides.ini file will be applied.")); + INSERT(UISettings, + auto_update_overrides, + tr("Auto-update game overrides"), + tr("Automatically download the latest game overrides list from GitHub on startup.")); + INSERT(UISettings, overrides_consent_given, QString(), QString()); // Linux INSERT(UISettings, enable_gamemode, tr("Enable Gamemode"), QString()); diff --git a/src/qt_common/config/uisettings.h b/src/qt_common/config/uisettings.h index 3ec7988300..52ea0012eb 100644 --- a/src/qt_common/config/uisettings.h +++ b/src/qt_common/config/uisettings.h @@ -143,6 +143,8 @@ struct Values { Setting check_for_updates{linkage, true, "check_for_updates", Category::UiGeneral}; Setting enable_global_overrides{linkage, true, "enable_global_overrides", Category::UiGeneral}; + Setting auto_update_overrides{linkage, false, "auto_update_overrides", Category::UiGeneral}; + Setting overrides_consent_given{linkage, false, "overrides_consent_given", Category::UiGeneral}; // Linux/MinGW may support (requires libdl support) SwitchableSetting enable_gamemode{linkage, diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index dad32f2316..bd15f940b0 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -239,6 +239,9 @@ add_executable(yuzu ryujinx_dialog.h ryujinx_dialog.cpp ryujinx_dialog.ui main_window.h main_window.cpp main.ui + overrides_updater.h + overrides_updater.cpp + configuration/system/new_user_dialog.h configuration/system/new_user_dialog.cpp configuration/system/new_user_dialog.ui configuration/system/profile_avatar_dialog.h configuration/system/profile_avatar_dialog.cpp configuration/addon/mod_select_dialog.h configuration/addon/mod_select_dialog.cpp configuration/addon/mod_select_dialog.ui @@ -361,6 +364,7 @@ target_sources(yuzu if (ENABLE_OPENSSL) target_link_libraries(yuzu PRIVATE OpenSSL::SSL OpenSSL::Crypto) + target_compile_definitions(yuzu PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT) endif() if (APPLE) diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index 7ca84e60dd..a198244704 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -45,6 +45,8 @@ #include "configuration/configure_per_game.h" #include "configuration/configure_tas.h" +#include "overrides_updater.h" + #include "util/clickable_label.h" #include "util/overlay_dialog.h" #include "util/controller_navigation.h" @@ -548,6 +550,13 @@ MainWindow::MainWindow(bool has_broken_vulkan) } #endif + // Check for game overrides updates + auto* overrides_updater = new OverridesUpdater(this); + connect(overrides_updater, &OverridesUpdater::ConfigChanged, this, [this]() { + config->SaveAllValues(); + }); + overrides_updater->CheckAndUpdate(); + QtCommon::system->SetContentProvider(std::make_unique()); QtCommon::system->RegisterContentProvider(FileSys::ContentProviderUnionSlot::FrontendManual, QtCommon::provider.get());