diff --git a/CMakeLists.txt b/CMakeLists.txt index ceead590..a142847c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,7 +100,7 @@ set(LIBGIT2_LIBRARIES "${BINARY_DIR}/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_ ExternalProject_Add(libloadorder PREFIX "external" - URL "https://github.com/WrinklyNinja/libloadorder/archive/11.1.0.tar.gz" + URL "https://github.com/WrinklyNinja/libloadorder/archive/11.2.0.tar.gz" CONFIGURE_COMMAND "" BUILD_IN_SOURCE 1 BUILD_COMMAND cargo build --release --all --all-features --target ${RUST_TARGET} diff --git a/include/loot/enum/game_type.h b/include/loot/enum/game_type.h index f66a34b9..38a94ed9 100644 --- a/include/loot/enum/game_type.h +++ b/include/loot/enum/game_type.h @@ -45,6 +45,8 @@ enum struct GameType : unsigned int { tes5se, /** Fallout 4 VR */ fo4vr, + /** Skyrim VR */ + tes5vr, }; } diff --git a/src/api/game/load_order_handler.cpp b/src/api/game/load_order_handler.cpp index af332efe..81df7c9b 100644 --- a/src/api/game/load_order_handler.cpp +++ b/src/api/game/load_order_handler.cpp @@ -34,6 +34,29 @@ using boost::format; using std::string; namespace loot { +unsigned int mapGameId(GameType gameType) { + switch (gameType) { + case GameType::tes4: + return LIBLO_GAME_TES4; + case GameType::tes5: + return LIBLO_GAME_TES5; + case GameType::tes5se: + return LIBLO_GAME_TES5SE; + case GameType::tes5vr: + return LIBLO_GAME_TES5VR; + case GameType::fo3: + return LIBLO_GAME_FO3; + case GameType::fonv: + return LIBLO_GAME_FNV; + case GameType::fo4: + return LIBLO_GAME_FO4; + case GameType::fo4vr: + return LIBLO_GAME_FO4VR; + default: + return (unsigned int)-1; + } +} + LoadOrderHandler::LoadOrderHandler() : gh_(nullptr) {} LoadOrderHandler::~LoadOrderHandler() { lo_destroy_handle(gh_); } @@ -56,30 +79,8 @@ void LoadOrderHandler::Init(const GameType& gameType, gh_ = nullptr; } - int ret; - if (gameType == GameType::tes4) - ret = lo_create_handle( - &gh_, LIBLO_GAME_TES4, gamePath.string().c_str(), gameLocalDataPath); - else if (gameType == GameType::tes5) - ret = lo_create_handle( - &gh_, LIBLO_GAME_TES5, gamePath.string().c_str(), gameLocalDataPath); - else if (gameType == GameType::tes5se) - ret = lo_create_handle( - &gh_, LIBLO_GAME_TES5SE, gamePath.string().c_str(), gameLocalDataPath); - else if (gameType == GameType::fo3) - ret = lo_create_handle( - &gh_, LIBLO_GAME_FO3, gamePath.string().c_str(), gameLocalDataPath); - else if (gameType == GameType::fonv) - ret = lo_create_handle( - &gh_, LIBLO_GAME_FNV, gamePath.string().c_str(), gameLocalDataPath); - else if (gameType == GameType::fo4) - ret = lo_create_handle( - &gh_, LIBLO_GAME_FO4, gamePath.string().c_str(), gameLocalDataPath); - else if (gameType == GameType::fo4vr) - ret = lo_create_handle( - &gh_, LIBLO_GAME_FO4VR, gamePath.string().c_str(), gameLocalDataPath); - else - ret = LIBLO_ERROR_INVALID_ARGS; + int ret = lo_create_handle( + &gh_, mapGameId(gameType), gamePath.string().c_str(), gameLocalDataPath); HandleError("create a game handle", ret); } diff --git a/src/api/plugin.cpp b/src/api/plugin.cpp index fcb9cc76..88f42bd7 100644 --- a/src/api/plugin.cpp +++ b/src/api/plugin.cpp @@ -363,7 +363,7 @@ bool hasPluginFileExtension(const std::string& filename, GameType gameType) { boost::iends_with(filename, ".esm"); bool lightMaster = (gameType == GameType::fo4 || gameType == GameType::fo4vr || - gameType == GameType::tes5se) && + gameType == GameType::tes5se || gameType == GameType::tes5vr) && boost::iends_with(filename, ".esl"); return espOrEsm || lightMaster;