diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | src/common/linux/gamemode.cpp | 40 | ||||
| -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 |
6 files changed, 81 insertions, 0 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index d38d5c6d1..bbc55eb56 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -182,6 +182,15 @@ if(ANDROID) | |||
| 182 | ) | 182 | ) |
| 183 | endif() | 183 | endif() |
| 184 | 184 | ||
| 185 | if (CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
| 186 | target_sources(common PRIVATE | ||
| 187 | linux/gamemode.cpp | ||
| 188 | linux/gamemode.h | ||
| 189 | ) | ||
| 190 | |||
| 191 | target_link_libraries(common PRIVATE gamemode) | ||
| 192 | endif() | ||
| 193 | |||
| 185 | if(ARCHITECTURE_x86_64) | 194 | if(ARCHITECTURE_x86_64) |
| 186 | target_sources(common | 195 | target_sources(common |
| 187 | PRIVATE | 196 | PRIVATE |
diff --git a/src/common/linux/gamemode.cpp b/src/common/linux/gamemode.cpp new file mode 100644 index 000000000..8d3e2934a --- /dev/null +++ b/src/common/linux/gamemode.cpp | |||
| @@ -0,0 +1,40 @@ | |||
| 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/logging/log.h" | ||
| 8 | #include "common/settings.h" | ||
| 9 | |||
| 10 | namespace Common::Linux { | ||
| 11 | |||
| 12 | void StartGamemode() { | ||
| 13 | if (Settings::values.enable_gamemode) { | ||
| 14 | if (gamemode_request_start() < 0) { | ||
| 15 | LOG_WARNING(Frontend, "Failed to start gamemode: {}", gamemode_error_string()); | ||
| 16 | } else { | ||
| 17 | LOG_INFO(Frontend, "Started gamemode"); | ||
| 18 | } | ||
| 19 | } | ||
| 20 | } | ||
| 21 | |||
| 22 | void StopGamemode() { | ||
| 23 | if (Settings::values.enable_gamemode) { | ||
| 24 | if (gamemode_request_end() < 0) { | ||
| 25 | LOG_WARNING(Frontend, "Failed to stop gamemode: {}", gamemode_error_string()); | ||
| 26 | } else { | ||
| 27 | LOG_INFO(Frontend, "Stopped gamemode"); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | void SetGamemodeState(bool state) { | ||
| 33 | if (state) { | ||
| 34 | StartGamemode(); | ||
| 35 | } else { | ||
| 36 | StopGamemode(); | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | } // 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 16c2feeab..4666bd0a0 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -236,6 +236,8 @@ const char* TranslateCategory(Category category) { | |||
| 236 | return "Services"; | 236 | return "Services"; |
| 237 | case Category::Paths: | 237 | case Category::Paths: |
| 238 | return "Paths"; | 238 | return "Paths"; |
| 239 | case Category::Linux: | ||
| 240 | return "Linux"; | ||
| 239 | case Category::MaxEnum: | 241 | case Category::MaxEnum: |
| 240 | break; | 242 | break; |
| 241 | } | 243 | } |
diff --git a/src/common/settings.h b/src/common/settings.h index 508615011..98341ad96 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -393,6 +393,8 @@ struct Values { | |||
| 393 | Category::RendererDebug}; | 393 | Category::RendererDebug}; |
| 394 | // TODO: remove this once AMDVLK supports VK_EXT_depth_bias_control | 394 | // TODO: remove this once AMDVLK supports VK_EXT_depth_bias_control |
| 395 | bool renderer_amdvlk_depth_bias_workaround{}; | 395 | bool renderer_amdvlk_depth_bias_workaround{}; |
| 396 | Setting<bool> disable_buffer_reorder{linkage, false, "disable_buffer_reorder", | ||
| 397 | Category::RendererDebug}; | ||
| 396 | 398 | ||
| 397 | // System | 399 | // System |
| 398 | SwitchableSetting<Language, true> language_index{linkage, | 400 | SwitchableSetting<Language, true> language_index{linkage, |
| @@ -436,6 +438,9 @@ struct Values { | |||
| 436 | true, | 438 | true, |
| 437 | true}; | 439 | true}; |
| 438 | 440 | ||
| 441 | // Linux | ||
| 442 | SwitchableSetting<bool> enable_gamemode{linkage, true, "enable_gamemode", Category::Linux}; | ||
| 443 | |||
| 439 | // Controls | 444 | // Controls |
| 440 | InputSetting<std::array<PlayerInput, 10>> players; | 445 | InputSetting<std::array<PlayerInput, 10>> players; |
| 441 | 446 | ||
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 | ||