mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-27 06:27:45 +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);
|
void setLauncherMode(bool isLauncher);
|
||||||
|
|
||||||
bool isDeck() const;
|
bool isDeck() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
LauncherCore& core;
|
||||||
};
|
};
|
|
@ -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
|
||||||
SteamUtils()->SetGameLauncherMode(isLauncher);
|
if(core.isSteam) {
|
||||||
|
SteamUtils()->SetGameLauncherMode(isLauncher);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SteamAPI::isDeck() const {
|
bool SteamAPI::isDeck() const {
|
||||||
#ifdef ENABLE_STEAM
|
#ifdef ENABLE_STEAM
|
||||||
return SteamUtils()->IsSteamRunningOnSteamDeck();
|
if(core.isSteam) {
|
||||||
|
return SteamUtils()->IsSteamRunningOnSteamDeck();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue