diff options
author | flodavid <fl.david.53@gmail.com> | 2023-11-03 15:41:16 +0100 |
---|---|---|
committer | flodavid <fl.david.53@gmail.com> | 2023-11-25 19:30:37 +0100 |
commit | 40644d43f700cb0075db0eea288078bda7cf4527 (patch) | |
tree | 876d26a64a803d2b1509e71a13fe822f1e851c00 /src/common/linux/gamemode.cpp | |
parent | yuzu: integrate gamemode support on linux (diff) | |
download | yuzu-40644d43f700cb0075db0eea288078bda7cf4527.tar yuzu-40644d43f700cb0075db0eea288078bda7cf4527.tar.gz yuzu-40644d43f700cb0075db0eea288078bda7cf4527.tar.bz2 yuzu-40644d43f700cb0075db0eea288078bda7cf4527.tar.lz yuzu-40644d43f700cb0075db0eea288078bda7cf4527.tar.xz yuzu-40644d43f700cb0075db0eea288078bda7cf4527.tar.zst yuzu-40644d43f700cb0075db0eea288078bda7cf4527.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/linux/gamemode.cpp | 39 |
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 |