1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-27 14:37:46 +00:00

Protect against crashes when running in non-Steam mode in Steam builds

This commit is contained in:
Joshua Goins 2022-09-08 00:03:59 -04:00
parent 9c02ea2157
commit 840539485d
2 changed files with 12 additions and 3 deletions

View file

@ -9,4 +9,7 @@ public:
void setLauncherMode(bool isLauncher); void setLauncherMode(bool isLauncher);
bool isDeck() const; bool isDeck() const;
private:
LauncherCore& core;
}; };

View file

@ -7,7 +7,7 @@
#include <steam/steam_api.h> #include <steam/steam_api.h>
#endif #endif
SteamAPI::SteamAPI(LauncherCore& core) { SteamAPI::SteamAPI(LauncherCore& core) : core(core) {
#ifdef ENABLE_STEAM #ifdef ENABLE_STEAM
if(core.isSteam) { if(core.isSteam) {
qputenv("SteamAppId", "39210"); qputenv("SteamAppId", "39210");
@ -21,13 +21,19 @@ SteamAPI::SteamAPI(LauncherCore& core) {
void SteamAPI::setLauncherMode(bool isLauncher) { void SteamAPI::setLauncherMode(bool isLauncher) {
#ifdef ENABLE_STEAM #ifdef ENABLE_STEAM
if(core.isSteam) {
SteamUtils()->SetGameLauncherMode(isLauncher); SteamUtils()->SetGameLauncherMode(isLauncher);
}
#endif #endif
} }
bool SteamAPI::isDeck() const { bool SteamAPI::isDeck() const {
#ifdef ENABLE_STEAM #ifdef ENABLE_STEAM
if(core.isSteam) {
return SteamUtils()->IsSteamRunningOnSteamDeck(); return SteamUtils()->IsSteamRunningOnSteamDeck();
} else {
return false;
}
#else #else
return false; return false;
#endif #endif