summaryrefslogtreecommitdiffstats
path: root/src/common/linux/gamemode.cpp
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-11-29 18:33:09 +0100
committerGitHub <noreply@github.com>2023-11-29 18:33:09 +0100
commit337e37f91dcc7d5b6a0a5da3f3196aa0f8df4143 (patch)
tree70d10b1f7919e6ed6709acab3259c69b038add6c /src/common/linux/gamemode.cpp
parentMerge pull request #11902 from ameerj/ssbo-align (diff)
parentcmake: move gamemode target include into its file (diff)
downloadyuzu-337e37f91dcc7d5b6a0a5da3f3196aa0f8df4143.tar
yuzu-337e37f91dcc7d5b6a0a5da3f3196aa0f8df4143.tar.gz
yuzu-337e37f91dcc7d5b6a0a5da3f3196aa0f8df4143.tar.bz2
yuzu-337e37f91dcc7d5b6a0a5da3f3196aa0f8df4143.tar.lz
yuzu-337e37f91dcc7d5b6a0a5da3f3196aa0f8df4143.tar.xz
yuzu-337e37f91dcc7d5b6a0a5da3f3196aa0f8df4143.tar.zst
yuzu-337e37f91dcc7d5b6a0a5da3f3196aa0f8df4143.zip
Diffstat (limited to 'src/common/linux/gamemode.cpp')
-rw-r--r--src/common/linux/gamemode.cpp39
1 files changed, 39 insertions, 0 deletions
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 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <gamemode_client.h>
+
+#include "common/linux/gamemode.h"
+#include "common/settings.h"
+
+namespace Common::Linux {
+
+void StartGamemode() {
+ if (Settings::values.enable_gamemode) {
+ if (gamemode_request_start() < 0) {
+ LOG_WARNING(Frontend, "Failed to start gamemode: {}", gamemode_error_string());
+ } else {
+ LOG_INFO(Frontend, "Started gamemode");
+ }
+ }
+}
+
+void StopGamemode() {
+ if (Settings::values.enable_gamemode) {
+ if (gamemode_request_end() < 0) {
+ LOG_WARNING(Frontend, "Failed to stop gamemode: {}", gamemode_error_string());
+ } else {
+ LOG_INFO(Frontend, "Stopped gamemode");
+ }
+ }
+}
+
+void SetGamemodeState(bool state) {
+ if (state) {
+ StartGamemode();
+ } else {
+ StopGamemode();
+ }
+}
+
+} // namespace Common::Linux