diff --git a/3rdParty/find_steam_game/CMakeLists.txt b/3rdParty/find_steam_game/CMakeLists.txt new file mode 100644 index 000000000..353f7ab1f --- /dev/null +++ b/3rdParty/find_steam_game/CMakeLists.txt @@ -0,0 +1,11 @@ +include(FetchContent_MakeAvailableExcludeFromAll) + +include(FetchContent) +FetchContent_Declare(find_steam_game + URL https://github.com/cxong/find_steam_game/archive/94e9046bcf94a655bdc051b6e6662fabd18e3f30.zip + URL_HASH MD5=c2742aff3d2a2dd162200fdab1b2b4a4 +) +FetchContent_MakeAvailableExcludeFromAll(find_steam_game) + +add_library(find_steam_game INTERFACE) +target_include_directories(find_steam_game INTERFACE ${find_steam_game_SOURCE_DIR}) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37493b104..46759879b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -290,6 +290,10 @@ add_library(smacker STATIC 3rdParty/libsmacker/smacker.c) target_include_directories(smacker PUBLIC 3rdParty/libsmacker) +if(WIN32) +add_subdirectory(3rdParty/find_steam_game) +endif() + add_subdirectory(3rdParty/simpleini) add_library(StormLib STATIC @@ -645,6 +649,10 @@ target_link_libraries(libdevilutionx PUBLIC smacker simpleini) +if(WIN32) + target_link_libraries(libdevilutionx PUBLIC find_steam_game) +endif() + if(NOT NONET) if(NOT DISABLE_TCP) target_link_libraries(libdevilutionx PUBLIC asio) diff --git a/Source/init.cpp b/Source/init.cpp index fdbbd5921..c320224d2 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -8,6 +8,10 @@ #include #include +#if defined(_WIN64) || defined(_WIN32) +#include +#endif + #include "DiabloUI/diabloui.h" #include "dx.h" #include "pfile.h" @@ -148,6 +152,13 @@ void init_archives() paths.emplace_back("/usr/local/share/diasurgical/devilutionx/"); #elif defined(__3DS__) paths.emplace_back("romfs:/"); +#elif defined(_WIN64) || defined(_WIN32) + char gogpath[_FSG_PATH_MAX]; + fsg_get_gog_game_path(gogpath, "1412601690"); + if (strlen(gogpath) > 0) { + paths.emplace_back(std::string(gogpath) + "/"); + paths.emplace_back(std::string(gogpath) + "/hellfire/"); + } #endif paths.emplace_back(""); // PWD