mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-18 21:38:56 +02:00
[gamemode] Make available on other platforms (#353)
Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/353 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
3141019fcd
commit
83332316aa
29 changed files with 123 additions and 775 deletions
52
src/qt_common/gamemode.cpp
Normal file
52
src/qt_common/gamemode.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
// While technically available on al *NIX platforms, Linux is only available
|
||||
// as the primary target of libgamemode.so - so warnings are suppressed
|
||||
#ifdef __unix__
|
||||
#include <gamemode_client.h>
|
||||
#endif
|
||||
#include "qt_common/gamemode.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "qt_common/config/uisettings.h"
|
||||
|
||||
namespace Common::FeralGamemode {
|
||||
|
||||
/// @brief Start the gamemode client
|
||||
void Start() noexcept {
|
||||
if (UISettings::values.enable_gamemode) {
|
||||
#ifdef __unix__
|
||||
if (gamemode_request_start() < 0) {
|
||||
#ifdef __linux__
|
||||
LOG_WARNING(Frontend, "{}", gamemode_error_string());
|
||||
#else
|
||||
LOG_INFO(Frontend, "{}", gamemode_error_string());
|
||||
#endif
|
||||
} else {
|
||||
LOG_INFO(Frontend, "Done");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// @brief Stop the gmemode client
|
||||
void Stop() noexcept {
|
||||
if (UISettings::values.enable_gamemode) {
|
||||
#ifdef __unix__
|
||||
if (gamemode_request_end() < 0) {
|
||||
#ifdef __linux__
|
||||
LOG_WARNING(Frontend, "{}", gamemode_error_string());
|
||||
#else
|
||||
LOG_INFO(Frontend, "{}", gamemode_error_string());
|
||||
#endif
|
||||
} else {
|
||||
LOG_INFO(Frontend, "Done");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Common::Linux
|
||||
Loading…
Add table
Add a link
Reference in a new issue