1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-22 04:37:46 +00:00
astra/launcher/src/steamapi.cpp

45 lines
814 B
C++
Raw Normal View History

#include "steamapi.h"
2022-09-05 18:03:59 -04:00
#ifdef ENABLE_STEAM
#include <steam/steam_api.h>
#endif
#include "launchercore.h"
SteamAPI::SteamAPI(LauncherCore &core, QObject *parent)
: QObject(parent)
, core(core)
{
2022-09-05 18:03:59 -04:00
#ifdef ENABLE_STEAM
if (core.isSteam()) {
2022-09-06 10:54:34 -04:00
qputenv("SteamAppId", "39210");
qputenv("SteamGameId", "39210");
if (!SteamAPI_Init())
2022-09-06 10:54:34 -04:00
qDebug() << "Failed to initialize steam api!";
}
#endif
}
void SteamAPI::setLauncherMode(bool isLauncher)
{
#ifdef ENABLE_STEAM
if (core.isSteam()) {
SteamUtils()->SetGameLauncherMode(isLauncher);
}
#endif
}
bool SteamAPI::isDeck() const
{
#ifdef ENABLE_STEAM
if (core.isSteam()) {
return SteamUtils()->IsSteamRunningOnSteamDeck();
} else {
return false;
}
#else
return false;
#endif
}