diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f42178..3a4a307 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ find_package(Qt5 COMPONENTS Core Widgets Network Quick CONFIG REQUIRED) option(ENABLE_WATCHDOG "Build with Tesseract support (needed for Watchdog)" OFF) option(USE_OWN_LIBRARIES "Build with own libraries" OFF) option(BUILD_FLATPAK "Build with Flatpak support in mind" OFF) +option(USE_STEAM "Build with Steam support" OFF) if (ENABLE_WATCHDOG) find_package(PkgConfig REQUIRED) @@ -22,6 +23,13 @@ if (NOT USE_OWN_LIBRARIES) find_package(Qt5Keychain QUIET) endif () +if(USE_STEAM) + add_library(Steamworks IMPORTED STATIC) + set_target_properties(Steamworks PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${STEAMWORKS_INCLUDE_DIR} + IMPORTED_LOCATION ${STEAMWORKS_LIBRARIES}) +endif() + if (TARGET Qt5Keychain::Qt5Keychain) message("Using system library for Qt5 Keychain") diff --git a/launcher/core/CMakeLists.txt b/launcher/core/CMakeLists.txt index 0eef15d..ed6dc17 100644 --- a/launcher/core/CMakeLists.txt +++ b/launcher/core/CMakeLists.txt @@ -8,7 +8,8 @@ set(HEADERS include/sapphirelauncher.h include/squareboot.h include/squarelauncher.h - include/patcher.h) + include/patcher.h + include/steamapi.h) set(SRC src/dxvkinstaller.cpp @@ -19,7 +20,8 @@ set(SRC src/sapphirelauncher.cpp src/squareboot.cpp src/squarelauncher.cpp - src/patcher.cpp) + src/patcher.cpp + src/steamapi.cpp) if (ENABLE_WATCHDOG) set(HEADERS ${HEADERS} @@ -28,9 +30,14 @@ if (ENABLE_WATCHDOG) set(SRC ${SRC} src/gameparser.cpp - src/watchdog.cpp) + src/watchdog.cpp include/steamapi.h src/steamapi.cpp) endif () +if(USE_STEAM) + set(LIBRARIES ${LIBRARIES} + Steamworks) +endif() + add_library(astra_core STATIC ${HEADERS} ${SRC}) target_include_directories(astra_core PUBLIC ${KEYCHAIN_INCLUDE_DIRS} @@ -53,3 +60,7 @@ if (ENABLE_WATCHDOG) target_compile_definitions(astra_core PUBLIC ENABLE_WATCHDOG) endif () + +if(USE_STEAM) + target_compile_definitions(astra_core PUBLIC USE_STEAM) +endif() \ No newline at end of file diff --git a/launcher/core/include/launchercore.h b/launcher/core/include/launchercore.h index 57cd860..6c021e2 100755 --- a/launcher/core/include/launchercore.h +++ b/launcher/core/include/launchercore.h @@ -10,6 +10,7 @@ #include #include "squareboot.h" +#include "steamapi.h" class SapphireLauncher; class SquareLauncher; @@ -223,4 +224,6 @@ private: QString getDefaultWinePrefixPath(); QVector profileSettings; + + SteamAPI* steamApi = nullptr; }; diff --git a/launcher/core/include/steamapi.h b/launcher/core/include/steamapi.h new file mode 100644 index 0000000..4fa1b29 --- /dev/null +++ b/launcher/core/include/steamapi.h @@ -0,0 +1,6 @@ +#pragma once + +class SteamAPI { +public: + SteamAPI(); +}; \ No newline at end of file diff --git a/launcher/core/src/launchercore.cpp b/launcher/core/src/launchercore.cpp index b1f9079..19c49d8 100755 --- a/launcher/core/src/launchercore.cpp +++ b/launcher/core/src/launchercore.cpp @@ -526,6 +526,7 @@ LauncherCore::LauncherCore() squareLauncher = new SquareLauncher(*this); squareBoot = new SquareBoot(*this, *squareLauncher); assetUpdater = new AssetUpdater(*this); + steamApi = new SteamAPI(); #ifdef ENABLE_WATCHDOG watchdog = new Watchdog(*this); diff --git a/launcher/core/src/steamapi.cpp b/launcher/core/src/steamapi.cpp new file mode 100644 index 0000000..d4e6cc5 --- /dev/null +++ b/launcher/core/src/steamapi.cpp @@ -0,0 +1,9 @@ +#include "steamapi.h" + +#include + +SteamAPI::SteamAPI() { +#ifdef USE_STEAM + SteamAPI_Init(); +#endif +} \ No newline at end of file