1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 03:37:47 +00:00

Use the actual gamemode library, instead of the helper

Sometimes gamemoderun is not packaged on certain systems, so use the
actual library if available instead to sidestep this problem.
This commit is contained in:
Joshua Goins 2022-09-05 17:10:37 -04:00
parent 7d9d59d9af
commit aaa614519e
4 changed files with 28 additions and 2 deletions

View file

@ -10,6 +10,7 @@ option(ENABLE_WATCHDOG "Build with Tesseract support (needed for Watchdog)" OFF)
option(USE_OWN_LIBRARIES "Build with own libraries" OFF)
option(BUILD_FLATPAK "Build with Flatpak support in mind" OFF)
option(USE_STEAM "Build with Steam support" OFF)
option(USE_GAMEMODE "Build with GameMode support" ON)
if (ENABLE_WATCHDOG)
find_package(PkgConfig REQUIRED)
@ -17,6 +18,11 @@ if (ENABLE_WATCHDOG)
pkg_search_module(LEPTONICA REQUIRED lept)
endif ()
if (USE_GAMEMODE)
find_package(PkgConfig REQUIRED)
pkg_search_module(GAMEMODE REQUIRED gamemode)
endif()
include(FetchContent)
if (NOT USE_OWN_LIBRARIES)

View file

@ -38,6 +38,11 @@ if(USE_STEAM)
Steamworks)
endif()
if(USE_GAMEMODE)
set(LIBRARIES ${LIBRARIES}
${GAMEMODE_LIBRARIES})
endif()
add_library(astra_core STATIC ${HEADERS} ${SRC})
target_include_directories(astra_core PUBLIC
${KEYCHAIN_INCLUDE_DIRS}
@ -62,6 +67,10 @@ if (ENABLE_WATCHDOG)
target_compile_definitions(astra_core PUBLIC ENABLE_WATCHDOG)
endif ()
if(USE_GAMEMODE)
target_compile_definitions(astra_core PUBLIC USE_GAMEMODE)
endif()
if(USE_STEAM)
target_compile_definitions(astra_core PUBLIC USE_STEAM)
endif()

View file

@ -21,6 +21,10 @@
#include <keychain.h>
#include <cotp.h>
#ifdef USE_GAMEMODE
#include <gamemode_client.h>
#endif
#include "assetupdater.h"
#include "encryptedarg.h"
#include "launchercore.h"
@ -211,9 +215,12 @@ void LauncherCore::launchExecutable(
if (profile.gamescope.refreshRate > 0)
arguments.push_back("-r " + QString::number(profile.gamescope.refreshRate));
}
}
#endif
if (profile.useGamemode)
arguments.push_back("gamemoderun");
#if USE_GAMEMODE
if(isGame && profile.useGamemode) {
gamemode_request_start();
}
#endif

View file

@ -237,6 +237,10 @@ void SettingsWindow::reloadControls() {
useGamescope->setChecked(profile.useGamescope);
useGamemode->setChecked(profile.useGamemode);
#ifndef USE_GAMEMODE
useGameMode->setEnabled(false);
#endif
useGamemode->setEnabled(core.gamemodeAvailable);
useGamescope->setEnabled(core.gamescopeAvailable);