mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 11:47:46 +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:
parent
7d9d59d9af
commit
aaa614519e
4 changed files with 28 additions and 2 deletions
|
@ -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(USE_OWN_LIBRARIES "Build with own libraries" OFF)
|
||||||
option(BUILD_FLATPAK "Build with Flatpak support in mind" OFF)
|
option(BUILD_FLATPAK "Build with Flatpak support in mind" OFF)
|
||||||
option(USE_STEAM "Build with Steam support" OFF)
|
option(USE_STEAM "Build with Steam support" OFF)
|
||||||
|
option(USE_GAMEMODE "Build with GameMode support" ON)
|
||||||
|
|
||||||
if (ENABLE_WATCHDOG)
|
if (ENABLE_WATCHDOG)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
|
@ -17,6 +18,11 @@ if (ENABLE_WATCHDOG)
|
||||||
pkg_search_module(LEPTONICA REQUIRED lept)
|
pkg_search_module(LEPTONICA REQUIRED lept)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (USE_GAMEMODE)
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_search_module(GAMEMODE REQUIRED gamemode)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
if (NOT USE_OWN_LIBRARIES)
|
if (NOT USE_OWN_LIBRARIES)
|
||||||
|
|
|
@ -38,6 +38,11 @@ if(USE_STEAM)
|
||||||
Steamworks)
|
Steamworks)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(USE_GAMEMODE)
|
||||||
|
set(LIBRARIES ${LIBRARIES}
|
||||||
|
${GAMEMODE_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(astra_core STATIC ${HEADERS} ${SRC})
|
add_library(astra_core STATIC ${HEADERS} ${SRC})
|
||||||
target_include_directories(astra_core PUBLIC
|
target_include_directories(astra_core PUBLIC
|
||||||
${KEYCHAIN_INCLUDE_DIRS}
|
${KEYCHAIN_INCLUDE_DIRS}
|
||||||
|
@ -62,6 +67,10 @@ if (ENABLE_WATCHDOG)
|
||||||
target_compile_definitions(astra_core PUBLIC ENABLE_WATCHDOG)
|
target_compile_definitions(astra_core PUBLIC ENABLE_WATCHDOG)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if(USE_GAMEMODE)
|
||||||
|
target_compile_definitions(astra_core PUBLIC USE_GAMEMODE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(USE_STEAM)
|
if(USE_STEAM)
|
||||||
target_compile_definitions(astra_core PUBLIC USE_STEAM)
|
target_compile_definitions(astra_core PUBLIC USE_STEAM)
|
||||||
endif()
|
endif()
|
|
@ -21,6 +21,10 @@
|
||||||
#include <keychain.h>
|
#include <keychain.h>
|
||||||
#include <cotp.h>
|
#include <cotp.h>
|
||||||
|
|
||||||
|
#ifdef USE_GAMEMODE
|
||||||
|
#include <gamemode_client.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "assetupdater.h"
|
#include "assetupdater.h"
|
||||||
#include "encryptedarg.h"
|
#include "encryptedarg.h"
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
|
@ -211,9 +215,12 @@ void LauncherCore::launchExecutable(
|
||||||
if (profile.gamescope.refreshRate > 0)
|
if (profile.gamescope.refreshRate > 0)
|
||||||
arguments.push_back("-r " + QString::number(profile.gamescope.refreshRate));
|
arguments.push_back("-r " + QString::number(profile.gamescope.refreshRate));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (profile.useGamemode)
|
#if USE_GAMEMODE
|
||||||
arguments.push_back("gamemoderun");
|
if(isGame && profile.useGamemode) {
|
||||||
|
gamemode_request_start();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -237,6 +237,10 @@ void SettingsWindow::reloadControls() {
|
||||||
useGamescope->setChecked(profile.useGamescope);
|
useGamescope->setChecked(profile.useGamescope);
|
||||||
useGamemode->setChecked(profile.useGamemode);
|
useGamemode->setChecked(profile.useGamemode);
|
||||||
|
|
||||||
|
#ifndef USE_GAMEMODE
|
||||||
|
useGameMode->setEnabled(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
useGamemode->setEnabled(core.gamemodeAvailable);
|
useGamemode->setEnabled(core.gamemodeAvailable);
|
||||||
useGamescope->setEnabled(core.gamescopeAvailable);
|
useGamescope->setEnabled(core.gamescopeAvailable);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue