diff options
| author | 2023-11-03 15:41:16 +0100 | |
|---|---|---|
| committer | 2023-11-25 19:30:37 +0100 | |
| commit | 40644d43f700cb0075db0eea288078bda7cf4527 (patch) | |
| tree | 876d26a64a803d2b1509e71a13fe822f1e851c00 /src | |
| parent | yuzu: integrate gamemode support on linux (diff) | |
| download | yuzu-40644d43f700cb0075db0eea288078bda7cf4527.tar.gz yuzu-40644d43f700cb0075db0eea288078bda7cf4527.tar.xz yuzu-40644d43f700cb0075db0eea288078bda7cf4527.zip | |
yuzu: create linux group in general settings
- Create files dedicated to starting and stopping gamemode functions
- Use them in yuzu and yuzu_cmd modules
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | src/common/linux/gamemode.cpp | 39 | ||||
| -rw-r--r-- | src/common/linux/gamemode.h | 24 | ||||
| -rw-r--r-- | src/common/settings.cpp | 2 | ||||
| -rw-r--r-- | src/common/settings.h | 5 | ||||
| -rw-r--r-- | src/common/settings_common.h | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_general.cpp | 46 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_general.ui | 27 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_system.ui | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/shared_translation.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 64 | ||||
| -rw-r--r-- | src/yuzu/main.h | 1 | ||||
| -rw-r--r-- | src/yuzu/uisettings.h | 3 | ||||
| -rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 24 |
14 files changed, 172 insertions, 79 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index e216eb3de..57cbb9d07 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -174,6 +174,15 @@ if(ANDROID) | |||
| 174 | ) | 174 | ) |
| 175 | endif() | 175 | endif() |
| 176 | 176 | ||
| 177 | if (UNIX) | ||
| 178 | target_sources(common PRIVATE | ||
| 179 | linux/gamemode.cpp | ||
| 180 | linux/gamemode.h | ||
| 181 | ) | ||
| 182 | |||
| 183 | target_link_libraries(common PRIVATE gamemode) | ||
| 184 | endif() | ||
| 185 | |||
| 177 | if(ARCHITECTURE_x86_64) | 186 | if(ARCHITECTURE_x86_64) |
| 178 | target_sources(common | 187 | target_sources(common |
| 179 | PRIVATE | 188 | PRIVATE |
diff --git a/src/common/linux/gamemode.cpp b/src/common/linux/gamemode.cpp new file mode 100644 index 000000000..8876d8dc4 --- /dev/null +++ b/src/common/linux/gamemode.cpp | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include <gamemode_client.h> | ||
| 5 | |||
| 6 | #include "common/linux/gamemode.h" | ||
| 7 | #include "common/settings.h" | ||
| 8 | |||
| 9 | namespace Common::Linux { | ||
| 10 | |||
| 11 | void StartGamemode() { | ||
| 12 | if (Settings::values.enable_gamemode) { | ||
| 13 | if (gamemode_request_start() < 0) { | ||
| 14 | LOG_WARNING(Frontend, "Failed to start gamemode: {}", gamemode_error_string()); | ||
| 15 | } else { | ||
| 16 | LOG_INFO(Frontend, "Started gamemode"); | ||
| 17 | } | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | void StopGamemode() { | ||
| 22 | if (Settings::values.enable_gamemode) { | ||
| 23 | if (gamemode_request_end() < 0) { | ||
| 24 | LOG_WARNING(Frontend, "Failed to stop gamemode: {}", gamemode_error_string()); | ||
| 25 | } else { | ||
| 26 | LOG_INFO(Frontend, "Stopped gamemode"); | ||
| 27 | } | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | void SetGamemodeState(bool state) { | ||
| 32 | if (state) { | ||
| 33 | StartGamemode(); | ||
| 34 | } else { | ||
| 35 | StopGamemode(); | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | } // namespace Common::Linux | ||
diff --git a/src/common/linux/gamemode.h b/src/common/linux/gamemode.h new file mode 100644 index 000000000..b80646ae2 --- /dev/null +++ b/src/common/linux/gamemode.h | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | namespace Common::Linux { | ||
| 7 | |||
| 8 | /** | ||
| 9 | * Start the (Feral Interactive) Linux gamemode if it is installed and it is activated | ||
| 10 | */ | ||
| 11 | void StartGamemode(); | ||
| 12 | |||
| 13 | /** | ||
| 14 | * Stop the (Feral Interactive) Linux gamemode if it is installed and it is activated | ||
| 15 | */ | ||
| 16 | void StopGamemode(); | ||
| 17 | |||
| 18 | /** | ||
| 19 | * Start or stop the (Feral Interactive) Linux gamemode if it is installed and it is activated | ||
| 20 | * @param state The new state the gamemode should have | ||
| 21 | */ | ||
| 22 | void SetGamemodeState(bool state); | ||
| 23 | |||
| 24 | } // namespace Common::Linux | ||
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index a10131eb2..3e829253f 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -219,6 +219,8 @@ const char* TranslateCategory(Category category) { | |||
| 219 | return "Services"; | 219 | return "Services"; |
| 220 | case Category::Paths: | 220 | case Category::Paths: |
| 221 | return "Paths"; | 221 | return "Paths"; |
| 222 | case Category::Linux: | ||
| 223 | return "Linux"; | ||
| 222 | case Category::MaxEnum: | 224 | case Category::MaxEnum: |
| 223 | break; | 225 | break; |
| 224 | } | 226 | } |
diff --git a/src/common/settings.h b/src/common/settings.h index 788020bde..491f0d3e0 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -178,8 +178,6 @@ struct Values { | |||
| 178 | true, | 178 | true, |
| 179 | &use_speed_limit}; | 179 | &use_speed_limit}; |
| 180 | 180 | ||
| 181 | Setting<bool> enable_gamemode{linkage, false, "enable_gamemode", Category::Core}; | ||
| 182 | |||
| 183 | // Cpu | 181 | // Cpu |
| 184 | SwitchableSetting<CpuAccuracy, true> cpu_accuracy{linkage, CpuAccuracy::Auto, | 182 | SwitchableSetting<CpuAccuracy, true> cpu_accuracy{linkage, CpuAccuracy::Auto, |
| 185 | CpuAccuracy::Auto, CpuAccuracy::Paranoid, | 183 | CpuAccuracy::Auto, CpuAccuracy::Paranoid, |
| @@ -429,6 +427,9 @@ struct Values { | |||
| 429 | true, | 427 | true, |
| 430 | true}; | 428 | true}; |
| 431 | 429 | ||
| 430 | // Linux | ||
| 431 | SwitchableSetting<bool> enable_gamemode{linkage, true, "enable_gamemode", Category::Linux}; | ||
| 432 | |||
| 432 | // Controls | 433 | // Controls |
| 433 | InputSetting<std::array<PlayerInput, 10>> players; | 434 | InputSetting<std::array<PlayerInput, 10>> players; |
| 434 | 435 | ||
diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 7943223eb..344c04439 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h | |||
| @@ -41,6 +41,7 @@ enum class Category : u32 { | |||
| 41 | Multiplayer, | 41 | Multiplayer, |
| 42 | Services, | 42 | Services, |
| 43 | Paths, | 43 | Paths, |
| 44 | Linux, | ||
| 44 | MaxEnum, | 45 | MaxEnum, |
| 45 | }; | 46 | }; |
| 46 | 47 | ||
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index ce7e17850..701b895e7 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp | |||
| @@ -29,9 +29,6 @@ ConfigureGeneral::ConfigureGeneral(const Core::System& system_, | |||
| 29 | if (!Settings::IsConfiguringGlobal()) { | 29 | if (!Settings::IsConfiguringGlobal()) { |
| 30 | ui->button_reset_defaults->setVisible(false); | 30 | ui->button_reset_defaults->setVisible(false); |
| 31 | } | 31 | } |
| 32 | #ifndef __linux__ | ||
| 33 | ui->enable_gamemode->setVisible(false); | ||
| 34 | #endif | ||
| 35 | } | 32 | } |
| 36 | 33 | ||
| 37 | ConfigureGeneral::~ConfigureGeneral() = default; | 34 | ConfigureGeneral::~ConfigureGeneral() = default; |
| @@ -39,12 +36,29 @@ ConfigureGeneral::~ConfigureGeneral() = default; | |||
| 39 | void ConfigureGeneral::SetConfiguration() {} | 36 | void ConfigureGeneral::SetConfiguration() {} |
| 40 | 37 | ||
| 41 | void ConfigureGeneral::Setup(const ConfigurationShared::Builder& builder) { | 38 | void ConfigureGeneral::Setup(const ConfigurationShared::Builder& builder) { |
| 42 | QLayout& layout = *ui->general_widget->layout(); | 39 | QLayout& general_layout = *ui->general_widget->layout(); |
| 40 | QLayout& linux_layout = *ui->linux_widget->layout(); | ||
| 41 | |||
| 42 | std::map<u32, QWidget*> general_hold{}; | ||
| 43 | std::map<u32, QWidget*> linux_hold{}; | ||
| 44 | |||
| 45 | std::vector<Settings::BasicSetting*> settings; | ||
| 46 | |||
| 47 | auto push = [&settings](auto& list) { | ||
| 48 | for (auto setting : list) { | ||
| 49 | settings.push_back(setting); | ||
| 50 | } | ||
| 51 | }; | ||
| 43 | 52 | ||
| 44 | std::map<u32, QWidget*> hold{}; | 53 | push(UISettings::values.linkage.by_category[Settings::Category::UiGeneral]); |
| 54 | push(Settings::values.linkage.by_category[Settings::Category::Linux]); | ||
| 45 | 55 | ||
| 46 | for (const auto setting : | 56 | // Only show Linux group on Unix |
| 47 | UISettings::values.linkage.by_category[Settings::Category::UiGeneral]) { | 57 | #ifndef __unix__ |
| 58 | ui->LinuxGroupBox->setVisible(false); | ||
| 59 | #endif | ||
| 60 | |||
| 61 | for (const auto setting : settings) { | ||
| 48 | auto* widget = builder.BuildWidget(setting, apply_funcs); | 62 | auto* widget = builder.BuildWidget(setting, apply_funcs); |
| 49 | 63 | ||
| 50 | if (widget == nullptr) { | 64 | if (widget == nullptr) { |
| @@ -55,11 +69,23 @@ void ConfigureGeneral::Setup(const ConfigurationShared::Builder& builder) { | |||
| 55 | continue; | 69 | continue; |
| 56 | } | 70 | } |
| 57 | 71 | ||
| 58 | hold.emplace(setting->Id(), widget); | 72 | switch (setting->GetCategory()) { |
| 73 | case Settings::Category::UiGeneral: | ||
| 74 | general_hold.emplace(setting->Id(), widget); | ||
| 75 | break; | ||
| 76 | case Settings::Category::Linux: | ||
| 77 | linux_hold.emplace(setting->Id(), widget); | ||
| 78 | break; | ||
| 79 | default: | ||
| 80 | widget->deleteLater(); | ||
| 81 | } | ||
| 59 | } | 82 | } |
| 60 | 83 | ||
| 61 | for (const auto& [id, widget] : hold) { | 84 | for (const auto& [id, widget] : general_hold) { |
| 62 | layout.addWidget(widget); | 85 | general_layout.addWidget(widget); |
| 86 | } | ||
| 87 | for (const auto& [id, widget] : linux_hold) { | ||
| 88 | linux_layout.addWidget(widget); | ||
| 63 | } | 89 | } |
| 64 | } | 90 | } |
| 65 | 91 | ||
diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui index a10e7d3a5..ef20891a3 100644 --- a/src/yuzu/configuration/configure_general.ui +++ b/src/yuzu/configuration/configure_general.ui | |||
| @@ -47,6 +47,33 @@ | |||
| 47 | </widget> | 47 | </widget> |
| 48 | </item> | 48 | </item> |
| 49 | <item> | 49 | <item> |
| 50 | <widget class="QGroupBox" name="LinuxGroupBox"> | ||
| 51 | <property name="title"> | ||
| 52 | <string>Linux</string> | ||
| 53 | </property> | ||
| 54 | <layout class="QVBoxLayout" name="LinuxVerticalLayout_1"> | ||
| 55 | <item> | ||
| 56 | <widget class="QWidget" name="linux_widget" native="true"> | ||
| 57 | <layout class="QVBoxLayout" name="LinuxVerticalLayout_2"> | ||
| 58 | <property name="leftMargin"> | ||
| 59 | <number>0</number> | ||
| 60 | </property> | ||
| 61 | <property name="topMargin"> | ||
| 62 | <number>0</number> | ||
| 63 | </property> | ||
| 64 | <property name="rightMargin"> | ||
| 65 | <number>0</number> | ||
| 66 | </property> | ||
| 67 | <property name="bottomMargin"> | ||
| 68 | <number>0</number> | ||
| 69 | </property> | ||
| 70 | </layout> | ||
| 71 | </widget> | ||
| 72 | </item> | ||
| 73 | </layout> | ||
| 74 | </widget> | ||
| 75 | </item> | ||
| 76 | <item> | ||
| 50 | <spacer name="verticalSpacer"> | 77 | <spacer name="verticalSpacer"> |
| 51 | <property name="orientation"> | 78 | <property name="orientation"> |
| 52 | <enum>Qt::Vertical</enum> | 79 | <enum>Qt::Vertical</enum> |
diff --git a/src/yuzu/configuration/configure_system.ui b/src/yuzu/configuration/configure_system.ui index 2a735836e..04b771129 100644 --- a/src/yuzu/configuration/configure_system.ui +++ b/src/yuzu/configuration/configure_system.ui | |||
| @@ -57,7 +57,7 @@ | |||
| 57 | </widget> | 57 | </widget> |
| 58 | </item> | 58 | </item> |
| 59 | <item> | 59 | <item> |
| 60 | <widget class="QGroupBox" name="groupBox"> | 60 | <widget class="QGroupBox" name="coreGroup"> |
| 61 | <property name="title"> | 61 | <property name="title"> |
| 62 | <string>Core</string> | 62 | <string>Core</string> |
| 63 | </property> | 63 | </property> |
diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index 903805e75..ee0ca4aa7 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp | |||
| @@ -175,7 +175,9 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) { | |||
| 175 | INSERT(UISettings, hide_mouse, tr("Hide mouse on inactivity"), QStringLiteral()); | 175 | INSERT(UISettings, hide_mouse, tr("Hide mouse on inactivity"), QStringLiteral()); |
| 176 | INSERT(UISettings, controller_applet_disabled, tr("Disable controller applet"), | 176 | INSERT(UISettings, controller_applet_disabled, tr("Disable controller applet"), |
| 177 | QStringLiteral()); | 177 | QStringLiteral()); |
| 178 | INSERT(UISettings, enable_gamemode, tr("Enable Gamemode"), QStringLiteral()); | 178 | |
| 179 | // Linux | ||
| 180 | INSERT(Settings, enable_gamemode, tr("Enable Gamemode"), QStringLiteral()); | ||
| 179 | 181 | ||
| 180 | // Ui Debugging | 182 | // Ui Debugging |
| 181 | 183 | ||
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index cf61d4258..6ef518b6a 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #ifdef __unix__ | 17 | #ifdef __unix__ |
| 18 | #include <csignal> | 18 | #include <csignal> |
| 19 | #include <sys/socket.h> | 19 | #include <sys/socket.h> |
| 20 | #include "common/linux/gamemode.h" | ||
| 20 | #endif | 21 | #endif |
| 21 | 22 | ||
| 22 | #include <boost/container/flat_set.hpp> | 23 | #include <boost/container/flat_set.hpp> |
| @@ -185,10 +186,6 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; | |||
| 185 | } | 186 | } |
| 186 | #endif | 187 | #endif |
| 187 | 188 | ||
| 188 | #ifdef __linux__ | ||
| 189 | #include <gamemode_client.h> | ||
| 190 | #endif | ||
| 191 | |||
| 192 | constexpr int default_mouse_hide_timeout = 2500; | 189 | constexpr int default_mouse_hide_timeout = 2500; |
| 193 | constexpr int default_mouse_center_timeout = 10; | 190 | constexpr int default_mouse_center_timeout = 10; |
| 194 | constexpr int default_input_update_timeout = 1; | 191 | constexpr int default_input_update_timeout = 1; |
| @@ -323,6 +320,7 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk | |||
| 323 | provider{std::make_unique<FileSys::ManualContentProvider>()} { | 320 | provider{std::make_unique<FileSys::ManualContentProvider>()} { |
| 324 | #ifdef __unix__ | 321 | #ifdef __unix__ |
| 325 | SetupSigInterrupts(); | 322 | SetupSigInterrupts(); |
| 323 | SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue()); | ||
| 326 | #endif | 324 | #endif |
| 327 | system->Initialize(); | 325 | system->Initialize(); |
| 328 | 326 | ||
| @@ -2130,14 +2128,8 @@ void GMainWindow::OnEmulationStopped() { | |||
| 2130 | 2128 | ||
| 2131 | discord_rpc->Update(); | 2129 | discord_rpc->Update(); |
| 2132 | 2130 | ||
| 2133 | #ifdef __linux__ | 2131 | #ifdef __unix__ |
| 2134 | if (UISettings::values.enable_gamemode) { | 2132 | Common::Linux::StopGamemode(); |
| 2135 | if (gamemode_request_end() < 0) { | ||
| 2136 | LOG_WARNING(Frontend, "Failed to stop gamemode: {}", gamemode_error_string()); | ||
| 2137 | } else { | ||
| 2138 | LOG_INFO(Frontend, "Stopped gamemode"); | ||
| 2139 | } | ||
| 2140 | } | ||
| 2141 | #endif | 2133 | #endif |
| 2142 | 2134 | ||
| 2143 | // The emulation is stopped, so closing the window or not does not matter anymore | 2135 | // The emulation is stopped, so closing the window or not does not matter anymore |
| @@ -3519,14 +3511,8 @@ void GMainWindow::OnStartGame() { | |||
| 3519 | 3511 | ||
| 3520 | discord_rpc->Update(); | 3512 | discord_rpc->Update(); |
| 3521 | 3513 | ||
| 3522 | #ifdef __linux__ | 3514 | #ifdef __unix__ |
| 3523 | if (UISettings::values.enable_gamemode) { | 3515 | Common::Linux::StartGamemode(); |
| 3524 | if (gamemode_request_start() < 0) { | ||
| 3525 | LOG_WARNING(Frontend, "Failed to start gamemode: {}", gamemode_error_string()); | ||
| 3526 | } else { | ||
| 3527 | LOG_INFO(Frontend, "Started gamemode"); | ||
| 3528 | } | ||
| 3529 | } | ||
| 3530 | #endif | 3516 | #endif |
| 3531 | } | 3517 | } |
| 3532 | 3518 | ||
| @@ -3549,14 +3535,8 @@ void GMainWindow::OnPauseGame() { | |||
| 3549 | UpdateMenuState(); | 3535 | UpdateMenuState(); |
| 3550 | AllowOSSleep(); | 3536 | AllowOSSleep(); |
| 3551 | 3537 | ||
| 3552 | #ifdef __linux__ | 3538 | #ifdef __unix__ |
| 3553 | if (UISettings::values.enable_gamemode) { | 3539 | Common::Linux::StopGamemode(); |
| 3554 | if (gamemode_request_end() < 0) { | ||
| 3555 | LOG_WARNING(Frontend, "Failed to stop gamemode: {}", gamemode_error_string()); | ||
| 3556 | } else { | ||
| 3557 | LOG_INFO(Frontend, "Stopped gamemode"); | ||
| 3558 | } | ||
| 3559 | } | ||
| 3560 | #endif | 3540 | #endif |
| 3561 | } | 3541 | } |
| 3562 | 3542 | ||
| @@ -3839,6 +3819,9 @@ void GMainWindow::OnConfigure() { | |||
| 3839 | const auto old_theme = UISettings::values.theme; | 3819 | const auto old_theme = UISettings::values.theme; |
| 3840 | const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); | 3820 | const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); |
| 3841 | const auto old_language_index = Settings::values.language_index.GetValue(); | 3821 | const auto old_language_index = Settings::values.language_index.GetValue(); |
| 3822 | #ifdef __unix__ | ||
| 3823 | const bool old_gamemode = Settings::values.enable_gamemode.GetValue(); | ||
| 3824 | #endif | ||
| 3842 | 3825 | ||
| 3843 | Settings::SetConfiguringGlobal(true); | 3826 | Settings::SetConfiguringGlobal(true); |
| 3844 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), | 3827 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), |
| @@ -3900,6 +3883,11 @@ void GMainWindow::OnConfigure() { | |||
| 3900 | if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) { | 3883 | if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) { |
| 3901 | SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue()); | 3884 | SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue()); |
| 3902 | } | 3885 | } |
| 3886 | #ifdef __unix__ | ||
| 3887 | if (Settings::values.enable_gamemode.GetValue() != old_gamemode) { | ||
| 3888 | SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue()); | ||
| 3889 | } | ||
| 3890 | #endif | ||
| 3903 | 3891 | ||
| 3904 | if (!multiplayer_state->IsHostingPublicRoom()) { | 3892 | if (!multiplayer_state->IsHostingPublicRoom()) { |
| 3905 | multiplayer_state->UpdateCredentials(); | 3893 | multiplayer_state->UpdateCredentials(); |
| @@ -5215,25 +5203,13 @@ void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { | |||
| 5215 | discord_rpc->Update(); | 5203 | discord_rpc->Update(); |
| 5216 | } | 5204 | } |
| 5217 | 5205 | ||
| 5218 | void GMainWindow::SetGamemodeDisabled([[maybe_unused]] bool state) { | 5206 | #ifdef __unix__ |
| 5219 | #ifdef __linux__ | 5207 | void GMainWindow::SetGamemodeEnabled(bool state) { |
| 5220 | if (emulation_running) { | 5208 | if (emulation_running) { |
| 5221 | if (state) { | 5209 | Common::Linux::SetGamemodeState(state); |
| 5222 | if (gamemode_request_end() < 0) { | ||
| 5223 | LOG_WARNING(Frontend, "Failed to stop gamemode: {}", gamemode_error_string()); | ||
| 5224 | } else { | ||
| 5225 | LOG_INFO(Frontend, "Stopped gamemode"); | ||
| 5226 | } | ||
| 5227 | } else { | ||
| 5228 | if (gamemode_request_start() < 0) { | ||
| 5229 | LOG_WARNING(Frontend, "Failed to start gamemode: {}", gamemode_error_string()); | ||
| 5230 | } else { | ||
| 5231 | LOG_INFO(Frontend, "Started gamemode"); | ||
| 5232 | } | ||
| 5233 | } | ||
| 5234 | } | 5210 | } |
| 5235 | #endif | ||
| 5236 | } | 5211 | } |
| 5212 | #endif | ||
| 5237 | 5213 | ||
| 5238 | void GMainWindow::changeEvent(QEvent* event) { | 5214 | void GMainWindow::changeEvent(QEvent* event) { |
| 5239 | #ifdef __unix__ | 5215 | #ifdef __unix__ |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index c989c079d..2e13e1834 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -340,6 +340,7 @@ private: | |||
| 340 | void SetupSigInterrupts(); | 340 | void SetupSigInterrupts(); |
| 341 | static void HandleSigInterrupt(int); | 341 | static void HandleSigInterrupt(int); |
| 342 | void OnSigInterruptNotifierActivated(); | 342 | void OnSigInterruptNotifierActivated(); |
| 343 | void SetGamemodeEnabled(bool state); | ||
| 343 | #endif | 344 | #endif |
| 344 | 345 | ||
| 345 | private slots: | 346 | private slots: |
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 3e5ddc07a..549a39e1b 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -140,9 +140,6 @@ struct Values { | |||
| 140 | Settings::Specialization::Default, | 140 | Settings::Specialization::Default, |
| 141 | true, | 141 | true, |
| 142 | true}; | 142 | true}; |
| 143 | // Gamemode | ||
| 144 | Setting<bool> enable_gamemode{linkage, false, "enable_gamemode", Category::UiGeneral}; | ||
| 145 | |||
| 146 | Setting<bool> disable_web_applet{linkage, true, "disable_web_applet", Category::Ui}; | 143 | Setting<bool> disable_web_applet{linkage, true, "disable_web_applet", Category::Ui}; |
| 147 | 144 | ||
| 148 | // Discord RPC | 145 | // Discord RPC |
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 1c3a1809b..a81635fa4 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp | |||
| @@ -63,8 +63,8 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; | |||
| 63 | } | 63 | } |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | #ifdef __linux__ | 66 | #ifdef __unix__ |
| 67 | #include <gamemode_client.h> | 67 | #include "common/linux/gamemode.h" |
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | static void PrintHelp(const char* argv0) { | 70 | static void PrintHelp(const char* argv0) { |
| @@ -429,14 +429,8 @@ int main(int argc, char** argv) { | |||
| 429 | exit(0); | 429 | exit(0); |
| 430 | }); | 430 | }); |
| 431 | 431 | ||
| 432 | #ifdef __linux__ | 432 | #ifdef __unix__ |
| 433 | if (Settings::values.disable_gamemode) { | 433 | Common::Linux::StartGamemode(); |
| 434 | if (gamemode_request_start() < 0) { | ||
| 435 | LOG_WARNING(Frontend, "Failed to start gamemode: {}", gamemode_error_string()); | ||
| 436 | } else { | ||
| 437 | LOG_INFO(Frontend, "Started gamemode"); | ||
| 438 | } | ||
| 439 | } | ||
| 440 | #endif | 434 | #endif |
| 441 | 435 | ||
| 442 | void(system.Run()); | 436 | void(system.Run()); |
| @@ -450,14 +444,8 @@ int main(int argc, char** argv) { | |||
| 450 | void(system.Pause()); | 444 | void(system.Pause()); |
| 451 | system.ShutdownMainProcess(); | 445 | system.ShutdownMainProcess(); |
| 452 | 446 | ||
| 453 | #ifdef __linux__ | 447 | #ifdef __unix__ |
| 454 | if (Settings::values.disable_gamemode) { | 448 | Common::Linux::StopGamemode(); |
| 455 | if (gamemode_request_end() < 0) { | ||
| 456 | LOG_WARNING(Frontend, "Failed to stop gamemode: {}", gamemode_error_string()); | ||
| 457 | } else { | ||
| 458 | LOG_INFO(Frontend, "Stopped gamemode"); | ||
| 459 | } | ||
| 460 | } | ||
| 461 | #endif | 449 | #endif |
| 462 | 450 | ||
| 463 | detached_tasks.WaitForAllTasks(); | 451 | detached_tasks.WaitForAllTasks(); |