mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-26 22:27:44 +00:00
Protect against crashes when running in non-Steam mode in Steam builds
This commit is contained in:
parent
9c02ea2157
commit
840539485d
2 changed files with 12 additions and 3 deletions
|
@ -9,4 +9,7 @@ public:
|
|||
void setLauncherMode(bool isLauncher);
|
||||
|
||||
bool isDeck() const;
|
||||
|
||||
private:
|
||||
LauncherCore& core;
|
||||
};
|
|
@ -7,7 +7,7 @@
|
|||
#include <steam/steam_api.h>
|
||||
#endif
|
||||
|
||||
SteamAPI::SteamAPI(LauncherCore& core) {
|
||||
SteamAPI::SteamAPI(LauncherCore& core) : core(core) {
|
||||
#ifdef ENABLE_STEAM
|
||||
if(core.isSteam) {
|
||||
qputenv("SteamAppId", "39210");
|
||||
|
@ -21,13 +21,19 @@ SteamAPI::SteamAPI(LauncherCore& core) {
|
|||
|
||||
void SteamAPI::setLauncherMode(bool isLauncher) {
|
||||
#ifdef ENABLE_STEAM
|
||||
SteamUtils()->SetGameLauncherMode(isLauncher);
|
||||
if(core.isSteam) {
|
||||
SteamUtils()->SetGameLauncherMode(isLauncher);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SteamAPI::isDeck() const {
|
||||
#ifdef ENABLE_STEAM
|
||||
return SteamUtils()->IsSteamRunningOnSteamDeck();
|
||||
if(core.isSteam) {
|
||||
return SteamUtils()->IsSteamRunningOnSteamDeck();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue