1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 20:27:45 +00:00

When running on the Steam Deck, launcher mode is now handled

Steamworks recommends not using launchers on the Deck, but it has a
special mode that specifically enables a KB/M layout to assist - we now
enable that before launching the game.
This commit is contained in:
Joshua Goins 2022-09-06 11:00:53 -04:00
parent 8d7f6afa0a
commit 3df6e79fad
3 changed files with 24 additions and 2 deletions

View file

@ -4,5 +4,9 @@ class LauncherCore;
class SteamAPI { class SteamAPI {
public: public:
SteamAPI(LauncherCore& core); explicit SteamAPI(LauncherCore& core);
void setLauncherMode(bool isLauncher);
bool isDeck() const;
}; };

View file

@ -58,6 +58,8 @@ void LauncherCore::buildRequest(const ProfileSettings& settings, QNetworkRequest
} }
void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth& auth) { void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth& auth) {
steamApi->setLauncherMode(false);
#ifdef ENABLE_WATCHDOG #ifdef ENABLE_WATCHDOG
if (profile.enableWatchdog) { if (profile.enableWatchdog) {
watchdog->launchGame(profile, auth); watchdog->launchGame(profile, auth);
@ -486,6 +488,8 @@ LauncherCore::LauncherCore(bool isSteam)
#endif #endif
readInitialInformation(); readInitialInformation();
steamApi->setLauncherMode(true);
} }
ProfileSettings& LauncherCore::getProfile(int index) { ProfileSettings& LauncherCore::getProfile(int index) {

View file

@ -18,3 +18,17 @@ SteamAPI::SteamAPI(LauncherCore& core) {
} }
#endif #endif
} }
void SteamAPI::setLauncherMode(bool isLauncher) {
#ifdef ENABLE_STEAM
SteamUtils()->SetGameLauncherMode(isLauncher);
#endif
}
bool SteamAPI::isDeck() const {
#ifdef ENABLE_STEAM
return SteamUtils()->IsSteamRunningOnSteamDeck();
#else
return false;
#endif
}