add prompt and function for auto update override settings

This commit is contained in:
Maufeat 2026-02-08 06:01:06 +01:00
parent 2e7832762e
commit d5be379a45
5 changed files with 39 additions and 1 deletions

View File

@ -516,7 +516,25 @@ s.setting.SetValue(new_value); \
}
std::optional<std::uint32_t> 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;
}

View File

@ -447,6 +447,11 @@ std::unique_ptr<TranslationMap> 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());

View File

@ -143,6 +143,8 @@ struct Values {
Setting<bool> check_for_updates{linkage, true, "check_for_updates", Category::UiGeneral};
Setting<bool> enable_global_overrides{linkage, true, "enable_global_overrides", Category::UiGeneral};
Setting<bool> auto_update_overrides{linkage, false, "auto_update_overrides", Category::UiGeneral};
Setting<bool> overrides_consent_given{linkage, false, "overrides_consent_given", Category::UiGeneral};
// Linux/MinGW may support (requires libdl support)
SwitchableSetting<bool> enable_gamemode{linkage,

View File

@ -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)

View File

@ -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<FileSys::ContentProviderUnion>());
QtCommon::system->RegisterContentProvider(FileSys::ContentProviderUnionSlot::FrontendManual,
QtCommon::provider.get());