This commit is contained in:
catfromplan9 2026-06-26 17:11:25 +05:00 committed by GitHub
commit b3cd11b5e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 4 deletions

View file

@ -307,7 +307,9 @@ endif()
find_package(cmark REQUIRED)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
option(Launcher_ENABLE_GAMEMODE "Enable Feral Gamemode support" ON)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND Launcher_ENABLE_GAMEMODE)
find_package(PkgConfig REQUIRED)
pkg_check_modules(gamemode REQUIRED IMPORTED_TARGET gamemode)
endif()

View file

@ -131,8 +131,10 @@
#ifdef Q_OS_LINUX
#include <dlfcn.h>
#include "LibraryUtils.h"
#ifdef ENABLE_GAMEMODE
#include "gamemode_client.h"
#endif
#endif
#if defined(Q_OS_LINUX)
#include <sys/statvfs.h>
@ -1834,8 +1836,10 @@ void Application::updateCapabilities()
m_capabilities |= SupportsFlame;
#ifdef Q_OS_LINUX
#ifdef ENABLE_GAMEMODE
if (gamemode_query_status() >= 0)
m_capabilities |= SupportsGameMode;
#endif
if (!LibraryUtils::findMangoHud().isEmpty())
m_capabilities |= SupportsMangoHud;

View file

@ -1278,10 +1278,11 @@ else()
target_link_libraries(Launcher_logic LibArchive::LibArchive)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND Launcher_ENABLE_GAMEMODE)
target_link_libraries(Launcher_logic
gamemode
)
add_compile_definitions(ENABLE_GAMEMODE)
endif()
target_link_libraries(Launcher_logic

View file

@ -44,7 +44,7 @@
#include "launch/LaunchTask.h"
#include "minecraft/MinecraftInstance.h"
#ifdef Q_OS_LINUX
#if defined(Q_OS_LINUX) && ENABLE_GAMEMODE
#include "gamemode_client.h"
#endif
@ -149,7 +149,7 @@ void LauncherPartLaunch::executeTask()
m_process.start(javaPath, args);
}
#ifdef Q_OS_LINUX
#if defined(Q_OS_LINUX) && ENABLE_GAMEMODE
if (instance->settings()->get("EnableFeralGamemode").toBool() && APPLICATION->capabilities() & Application::SupportsGameMode) {
auto pid = m_process.processId();
if (pid) {