diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 315473d1f7..d3993065db 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -65,8 +65,6 @@ add_library( fs/fs_util.h fs/path_util.cpp fs/path_util.h - gamemode.cpp - gamemode.h hash.h heap_tracker.cpp heap_tracker.h diff --git a/src/common/settings.h b/src/common/settings.h index 97cb8c7e59..0dfd36ad5a 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -621,19 +621,6 @@ struct Values { true, true}; - // Linux/MinGW may support (requires libdl support) - SwitchableSetting enable_gamemode{linkage, -#ifndef _MSC_VER - true, -#else - false, -#endif - "enable_gamemode", Category::UiGeneral}; -#ifdef __unix__ - SwitchableSetting gui_force_x11{linkage, false, "gui_force_x11", Category::UiGeneral}; - Setting gui_hide_backend_warning{linkage, false, "gui_hide_backend_warning", Category::UiGeneral}; -#endif - // Controls InputSetting> players; diff --git a/src/qt_common/CMakeLists.txt b/src/qt_common/CMakeLists.txt index 2100760d9c..877140acef 100644 --- a/src/qt_common/CMakeLists.txt +++ b/src/qt_common/CMakeLists.txt @@ -5,6 +5,9 @@ add_library(qt_common STATIC qt_common.h qt_common.cpp + gamemode.cpp + gamemode.h + config/uisettings.cpp config/uisettings.h config/qt_config.cpp diff --git a/src/qt_common/config/shared_translation.cpp b/src/qt_common/config/shared_translation.cpp index c601d25d80..48190eda79 100644 --- a/src/qt_common/config/shared_translation.cpp +++ b/src/qt_common/config/shared_translation.cpp @@ -433,10 +433,10 @@ std::unique_ptr InitializeTranslations(QObject* parent) tr("Whether or not to check for updates upon startup.")); // Linux - INSERT(Settings, enable_gamemode, tr("Enable Gamemode"), QString()); + INSERT(UISettings, enable_gamemode, tr("Enable Gamemode"), QString()); #ifdef __unix__ - INSERT(Settings, gui_force_x11, tr("Force X11 as Graphics Backend"), QString()); - INSERT(Settings, gui_hide_backend_warning, QString(), QString()); + INSERT(UISettings, gui_force_x11, tr("Force X11 as Graphics Backend"), QString()); + INSERT(UISettings, gui_hide_backend_warning, QString(), QString()); #endif // Ui Debugging diff --git a/src/qt_common/config/uisettings.h b/src/qt_common/config/uisettings.h index 65d03cc990..c5a7d0b483 100644 --- a/src/qt_common/config/uisettings.h +++ b/src/qt_common/config/uisettings.h @@ -142,6 +142,19 @@ struct Values { Setting check_for_updates{linkage, true, "check_for_updates", Category::UiGeneral}; + // Linux/MinGW may support (requires libdl support) + SwitchableSetting enable_gamemode{linkage, +#ifndef _MSC_VER + true, +#else + false, +#endif + "enable_gamemode", Category::UiGeneral}; +#ifdef __unix__ + SwitchableSetting gui_force_x11{linkage, false, "gui_force_x11", Category::UiGeneral}; + Setting gui_hide_backend_warning{linkage, false, "gui_hide_backend_warning", Category::UiGeneral}; +#endif + // Discord RPC Setting enable_discord_presence{linkage, false, "enable_discord_presence", Category::Ui}; diff --git a/src/common/gamemode.cpp b/src/qt_common/gamemode.cpp similarity index 88% rename from src/common/gamemode.cpp rename to src/qt_common/gamemode.cpp index 8bc1a63bab..afa626623d 100644 --- a/src/common/gamemode.cpp +++ b/src/qt_common/gamemode.cpp @@ -9,15 +9,15 @@ #ifdef __unix__ #include #endif -#include "common/gamemode.h" +#include "qt_common/gamemode.h" #include "common/logging/log.h" -#include "common/settings.h" +#include "qt_common/config/uisettings.h" namespace Common::FeralGamemode { /// @brief Start the gamemode client void Start() noexcept { - if (Settings::values.enable_gamemode) { + if (UISettings::values.enable_gamemode) { #ifdef __unix__ if (gamemode_request_start() < 0) { #ifdef __linux__ @@ -34,7 +34,7 @@ void Start() noexcept { /// @brief Stop the gmemode client void Stop() noexcept { - if (Settings::values.enable_gamemode) { + if (UISettings::values.enable_gamemode) { #ifdef __unix__ if (gamemode_request_end() < 0) { #ifdef __linux__ diff --git a/src/common/gamemode.h b/src/qt_common/gamemode.h similarity index 100% rename from src/common/gamemode.h rename to src/qt_common/gamemode.h diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index a04688bf96..32f15156f7 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -164,7 +164,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #endif -#include "common/gamemode.h" +#include "qt_common/gamemode.h" #ifdef _WIN32 #include "core/core_timing.h" @@ -421,7 +421,7 @@ MainWindow::MainWindow(bool has_broken_vulkan) SetupSigInterrupts(); #endif - SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue()); + SetGamemodeEnabled(UISettings::values.enable_gamemode.GetValue()); UISettings::RestoreWindowState(config); @@ -3371,9 +3371,9 @@ void MainWindow::OnConfigure() { const auto old_theme = UISettings::values.theme; const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); const auto old_language_index = Settings::values.language_index.GetValue(); - const bool old_gamemode = Settings::values.enable_gamemode.GetValue(); + const bool old_gamemode = UISettings::values.enable_gamemode.GetValue(); #ifdef __unix__ - const bool old_force_x11 = Settings::values.gui_force_x11.GetValue(); + const bool old_force_x11 = UISettings::values.gui_force_x11.GetValue(); #endif Settings::SetConfiguringGlobal(true); @@ -3434,12 +3434,12 @@ void MainWindow::OnConfigure() { if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) { SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue()); } - if (Settings::values.enable_gamemode.GetValue() != old_gamemode) { - SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue()); + if (UISettings::values.enable_gamemode.GetValue() != old_gamemode) { + SetGamemodeEnabled(UISettings::values.enable_gamemode.GetValue()); } #ifdef __unix__ - if (Settings::values.gui_force_x11.GetValue() != old_force_x11) { - GraphicsBackend::SetForceX11(Settings::values.gui_force_x11.GetValue()); + if (UISettings::values.gui_force_x11.GetValue() != old_force_x11) { + GraphicsBackend::SetForceX11(UISettings::values.gui_force_x11.GetValue()); } #endif @@ -4386,7 +4386,7 @@ void MainWindow::OnCheckGraphicsBackend() { if (!isWayland) return; - const bool currently_hidden = Settings::values.gui_hide_backend_warning.GetValue(); + const bool currently_hidden = UISettings::values.gui_hide_backend_warning.GetValue(); if (currently_hidden) return; @@ -4409,11 +4409,11 @@ void MainWindow::OnCheckGraphicsBackend() { const bool hide = cb->isChecked(); if (hide != currently_hidden) { - Settings::values.gui_hide_backend_warning.SetValue(hide); + UISettings::values.gui_hide_backend_warning.SetValue(hide); } if (msgbox.clickedButton() == okButton) { - Settings::values.gui_force_x11.SetValue(true); + UISettings::values.gui_force_x11.SetValue(true); GraphicsBackend::SetForceX11(true); QMessageBox::information(this, tr("Restart Required"), diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index e64abbd0d1..975e72e00c 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -59,7 +59,6 @@ __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; } #endif -#include "common/gamemode.h" static void PrintHelp(const char* argv0) { std::cout << "Usage: " << argv0 @@ -424,8 +423,6 @@ int main(int argc, char** argv) { // Just exit right away. exit(0); }); - Common::FeralGamemode::Start(); - void(system.Run()); if (system.DebuggerEnabled()) { system.InitializeDebugger(); @@ -436,7 +433,6 @@ int main(int argc, char** argv) { system.DetachDebugger(); void(system.Pause()); system.ShutdownMainProcess(); - Common::FeralGamemode::Stop(); detached_tasks.WaitForAllTasks(); return 0; }