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