summaryrefslogtreecommitdiff
path: root/src/common/linux/gamemode.cpp
diff options
context:
space:
mode:
authorGravatar flodavid2023-11-03 15:41:16 +0100
committerGravatar flodavid2023-11-25 19:30:37 +0100
commit40644d43f700cb0075db0eea288078bda7cf4527 (patch)
tree876d26a64a803d2b1509e71a13fe822f1e851c00 /src/common/linux/gamemode.cpp
parentyuzu: integrate gamemode support on linux (diff)
downloadyuzu-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 '')
-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 @@
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
9namespace Common::Linux {
10
11void 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
21void 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
31void SetGamemodeState(bool state) {
32 if (state) {
33 StartGamemode();
34 } else {
35 StopGamemode();
36 }
37}
38
39} // namespace Common::Linux