1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-06-08 06:57:46 +00:00

Only enable Steam API if the steam option is turned on

This commit is contained in:
Joshua Goins 2022-09-05 18:06:36 -04:00
parent b15473ddf0
commit 28c8b0918d
6 changed files with 28 additions and 17 deletions

View file

@ -19,7 +19,7 @@ FetchContent_Declare(
FetchContent_MakeAvailable(libphysis) FetchContent_MakeAvailable(libphysis)
corrosion_import_crate(MANIFEST_PATH ${libphysis_SOURCE_DIR}/Cargo.toml) corrosion_import_crate(MANIFEST_PATH /home/josh/Development/libphysis/Cargo.toml)
target_include_directories(physis INTERFACE ${libphysis_SOURCE_DIR}/target/public) target_include_directories(physis INTERFACE /home/josh/Development/libphysis/target/public)
target_link_libraries(physis INTERFACE unshield) target_link_libraries(physis INTERFACE unshield)

View file

@ -226,6 +226,8 @@ public:
QVector<QString> expansionNames; QVector<QString> expansionNames;
bool isSteam = false;
signals: signals:
void settingsChanged(); void settingsChanged();
void successfulLaunch(); void successfulLaunch();

View file

@ -1,6 +1,8 @@
#pragma once #pragma once
class LauncherCore;
class SteamAPI { class SteamAPI {
public: public:
SteamAPI(); SteamAPI(LauncherCore& core);
}; };

View file

@ -463,7 +463,7 @@ LauncherCore::LauncherCore()
squareLauncher = new SquareLauncher(*this); squareLauncher = new SquareLauncher(*this);
squareBoot = new SquareBoot(*this, *squareLauncher); squareBoot = new SquareBoot(*this, *squareLauncher);
assetUpdater = new AssetUpdater(*this); assetUpdater = new AssetUpdater(*this);
steamApi = new SteamAPI(); steamApi = new SteamAPI(*this);
#ifdef ENABLE_WATCHDOG #ifdef ENABLE_WATCHDOG
watchdog = new Watchdog(*this); watchdog = new Watchdog(*this);

View file

@ -1,11 +1,14 @@
#include "steamapi.h" #include "steamapi.h"
#include "launchercore.h"
#ifdef ENABLE_STEAM #ifdef ENABLE_STEAM
#include <steam/steam_api.h> #include <steam/steam_api.h>
#endif #endif
SteamAPI::SteamAPI() { SteamAPI::SteamAPI(LauncherCore& core) {
#ifdef ENABLE_STEAM #ifdef ENABLE_STEAM
SteamAPI_Init(); if(core.isSteam) {
SteamAPI_Init();
}
#endif #endif
} }

View file

@ -47,6 +47,11 @@ int main(int argc, char* argv[]) {
parser.addOption(cliOption); parser.addOption(cliOption);
#endif #endif
QCommandLineOption steamOption("steam", "Simulate booting the launcher via Steam.");
#ifdef ENABLE_STEAM
parser.addOption(steamOption);
#endif
auto cmd = std::make_unique<CMDInterface>(parser); auto cmd = std::make_unique<CMDInterface>(parser);
parser.process(app); parser.process(app);
@ -59,21 +64,20 @@ int main(int argc, char* argv[]) {
parser.showHelp(); parser.showHelp();
} }
for(auto& argument : QCoreApplication::arguments()) {
if(argument.contains("iscriptevaluator")) {
QFile testFile("/home/josh/testargs.txt");
testFile.open(QFile::Text | QFile::Append);
testFile.write(QCoreApplication::arguments().join(',').toStdString().c_str());
//return 0;
}
}
LauncherCore c; LauncherCore c;
std::unique_ptr<DesktopInterface> desktopInterface; std::unique_ptr<DesktopInterface> desktopInterface;
std::unique_ptr<TabletInterface> tabletInterface; std::unique_ptr<TabletInterface> tabletInterface;
if(parser.isSet(steamOption)) {
c.isSteam = true;
for(auto& argument : QCoreApplication::arguments()) {
if(argument.contains("iscriptevaluator")) {
return 0;
}
}
}
if (parser.isSet(tabletOption)) { if (parser.isSet(tabletOption)) {
#ifdef ENABLE_TABLET #ifdef ENABLE_TABLET
tabletInterface = std::make_unique<TabletInterface>(c); tabletInterface = std::make_unique<TabletInterface>(c);