Browse Source
yuzu: create linux group in general settings
yuzu: create linux group in general settings
- Create files dedicated to starting and stopping gamemode functions - Use them in yuzu and yuzu_cmd modulesnce_cpp
16 changed files with 177 additions and 81 deletions
-
3externals/CMakeLists.txt
-
4externals/gamemode/CMakeLists.txt
-
9src/common/CMakeLists.txt
-
39src/common/linux/gamemode.cpp
-
24src/common/linux/gamemode.h
-
2src/common/settings.cpp
-
5src/common/settings.h
-
1src/common/settings_common.h
-
46src/yuzu/configuration/configure_general.cpp
-
27src/yuzu/configuration/configure_general.ui
-
2src/yuzu/configuration/configure_system.ui
-
4src/yuzu/configuration/shared_translation.cpp
-
62src/yuzu/main.cpp
-
1src/yuzu/main.h
-
3src/yuzu/uisettings.h
-
24src/yuzu_cmd/yuzu.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
|
||||
@ -0,0 +1,24 @@ |
|||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
||||
|
// SPDX-License-Identifier: GPL-2.0-or-later |
||||
|
|
||||
|
#pragma once |
||||
|
|
||||
|
namespace Common::Linux { |
||||
|
|
||||
|
/** |
||||
|
* Start the (Feral Interactive) Linux gamemode if it is installed and it is activated |
||||
|
*/ |
||||
|
void StartGamemode(); |
||||
|
|
||||
|
/** |
||||
|
* Stop the (Feral Interactive) Linux gamemode if it is installed and it is activated |
||||
|
*/ |
||||
|
void StopGamemode(); |
||||
|
|
||||
|
/** |
||||
|
* Start or stop the (Feral Interactive) Linux gamemode if it is installed and it is activated |
||||
|
* @param state The new state the gamemode should have |
||||
|
*/ |
||||
|
void SetGamemodeState(bool state); |
||||
|
|
||||
|
} // namespace Common::Linux |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue