Skip to content

Commit 0920c3d

Browse files
committed
Add GameType value for Skyrim VR
Also update libloadorder for Skyrim VR support.
1 parent 498a9f0 commit 0920c3d

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ set(LIBGIT2_LIBRARIES "${BINARY_DIR}/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_
100100

101101
ExternalProject_Add(libloadorder
102102
PREFIX "external"
103-
URL "https://github.com/WrinklyNinja/libloadorder/archive/11.1.0.tar.gz"
103+
URL "https://github.com/WrinklyNinja/libloadorder/archive/11.2.0.tar.gz"
104104
CONFIGURE_COMMAND ""
105105
BUILD_IN_SOURCE 1
106106
BUILD_COMMAND cargo build --release --all --all-features --target ${RUST_TARGET}

include/loot/enum/game_type.h

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ enum struct GameType : unsigned int {
4545
tes5se,
4646
/** Fallout 4 VR */
4747
fo4vr,
48+
/** Skyrim VR */
49+
tes5vr,
4850
};
4951
}
5052

src/api/game/load_order_handler.cpp

+25-24
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,29 @@ using boost::format;
3434
using std::string;
3535

3636
namespace loot {
37+
unsigned int mapGameId(GameType gameType) {
38+
switch (gameType) {
39+
case GameType::tes4:
40+
return LIBLO_GAME_TES4;
41+
case GameType::tes5:
42+
return LIBLO_GAME_TES5;
43+
case GameType::tes5se:
44+
return LIBLO_GAME_TES5SE;
45+
case GameType::tes5vr:
46+
return LIBLO_GAME_TES5VR;
47+
case GameType::fo3:
48+
return LIBLO_GAME_FO3;
49+
case GameType::fonv:
50+
return LIBLO_GAME_FNV;
51+
case GameType::fo4:
52+
return LIBLO_GAME_FO4;
53+
case GameType::fo4vr:
54+
return LIBLO_GAME_FO4VR;
55+
default:
56+
return (unsigned int)-1;
57+
}
58+
}
59+
3760
LoadOrderHandler::LoadOrderHandler() : gh_(nullptr) {}
3861

3962
LoadOrderHandler::~LoadOrderHandler() { lo_destroy_handle(gh_); }
@@ -56,30 +79,8 @@ void LoadOrderHandler::Init(const GameType& gameType,
5679
gh_ = nullptr;
5780
}
5881

59-
int ret;
60-
if (gameType == GameType::tes4)
61-
ret = lo_create_handle(
62-
&gh_, LIBLO_GAME_TES4, gamePath.string().c_str(), gameLocalDataPath);
63-
else if (gameType == GameType::tes5)
64-
ret = lo_create_handle(
65-
&gh_, LIBLO_GAME_TES5, gamePath.string().c_str(), gameLocalDataPath);
66-
else if (gameType == GameType::tes5se)
67-
ret = lo_create_handle(
68-
&gh_, LIBLO_GAME_TES5SE, gamePath.string().c_str(), gameLocalDataPath);
69-
else if (gameType == GameType::fo3)
70-
ret = lo_create_handle(
71-
&gh_, LIBLO_GAME_FO3, gamePath.string().c_str(), gameLocalDataPath);
72-
else if (gameType == GameType::fonv)
73-
ret = lo_create_handle(
74-
&gh_, LIBLO_GAME_FNV, gamePath.string().c_str(), gameLocalDataPath);
75-
else if (gameType == GameType::fo4)
76-
ret = lo_create_handle(
77-
&gh_, LIBLO_GAME_FO4, gamePath.string().c_str(), gameLocalDataPath);
78-
else if (gameType == GameType::fo4vr)
79-
ret = lo_create_handle(
80-
&gh_, LIBLO_GAME_FO4VR, gamePath.string().c_str(), gameLocalDataPath);
81-
else
82-
ret = LIBLO_ERROR_INVALID_ARGS;
82+
int ret = lo_create_handle(
83+
&gh_, mapGameId(gameType), gamePath.string().c_str(), gameLocalDataPath);
8384

8485
HandleError("create a game handle", ret);
8586
}

src/api/plugin.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ bool hasPluginFileExtension(const std::string& filename, GameType gameType) {
363363
boost::iends_with(filename, ".esm");
364364
bool lightMaster =
365365
(gameType == GameType::fo4 || gameType == GameType::fo4vr ||
366-
gameType == GameType::tes5se) &&
366+
gameType == GameType::tes5se || gameType == GameType::tes5vr) &&
367367
boost::iends_with(filename, ".esl");
368368

369369
return espOrEsm || lightMaster;

0 commit comments

Comments
 (0)