Skip to content

Commit

Permalink
Add GameType value for Skyrim VR
Browse files Browse the repository at this point in the history
Also update libloadorder for Skyrim VR support.
  • Loading branch information
Ortham committed Apr 8, 2018
1 parent 498a9f0 commit 0920c3d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions include/loot/enum/game_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ enum struct GameType : unsigned int {
tes5se,
/** Fallout 4 VR */
fo4vr,
/** Skyrim VR */
tes5vr,
};
}

Expand Down
49 changes: 25 additions & 24 deletions src/api/game/load_order_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_); }
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0920c3d

Please sign in to comment.