summaryrefslogtreecommitdiff
path: root/src/common/linux/gamemode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/linux/gamemode.cpp')
-rw-r--r--src/common/linux/gamemode.cpp40
1 files changed, 40 insertions, 0 deletions
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
10namespace Common::Linux {
11
12void 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
22void 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
32void SetGamemodeState(bool state) {
33 if (state) {
34 StartGamemode();
35 } else {
36 StopGamemode();
37 }
38}
39
40} // namespace Common::Linux