mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fixed libloadorder 6 compatibility.
Didn't take into account behavioural differences when last updating the code.
This commit is contained in:
+60
-52
@@ -253,7 +253,7 @@ namespace loot {
|
|||||||
else if (Id() == Game::fonv)
|
else if (Id() == Game::fonv)
|
||||||
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL);
|
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL);
|
||||||
|
|
||||||
if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) {
|
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||||
const char * e = nullptr;
|
const char * e = nullptr;
|
||||||
string err;
|
string err;
|
||||||
lo_get_error_message(&e);
|
lo_get_error_message(&e);
|
||||||
@@ -269,26 +269,28 @@ namespace loot {
|
|||||||
throw error(error::liblo_error, err);
|
throw error(error::liblo_error, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = lo_set_game_master(gh, _masterFile.c_str());
|
if (id != Game::tes5) {
|
||||||
|
ret = lo_set_game_master(gh, _masterFile.c_str());
|
||||||
if (ret != LIBLO_OK) {
|
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||||
const char * e = nullptr;
|
const char * e = nullptr;
|
||||||
string err;
|
string err;
|
||||||
lo_get_error_message(&e);
|
lo_get_error_message(&e);
|
||||||
lo_destroy_handle(gh);
|
lo_destroy_handle(gh);
|
||||||
if (e == nullptr) {
|
if (e == nullptr) {
|
||||||
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details could not be fetched.";
|
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details could not be fetched.";
|
||||||
err = lc::translate("libloadorder failed to initialise game master file support. Details could not be fetched.").str();
|
err = lc::translate("libloadorder failed to initialise game master file support. Details could not be fetched.").str();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details: " << e;
|
||||||
|
err = lc::translate("libloadorder failed to initialise game master file support. Details:").str() + " " + e;
|
||||||
|
}
|
||||||
|
lo_cleanup();
|
||||||
|
throw error(error::liblo_error, err);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details: " << e;
|
|
||||||
err = lc::translate("libloadorder failed to initialise game master file support. Details:").str() + " " + e;
|
|
||||||
}
|
|
||||||
lo_cleanup();
|
|
||||||
throw error(error::liblo_error, err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lo_get_active_plugins(gh, &pluginArr, &pluginArrSize) != LIBLO_OK) {
|
ret = lo_get_active_plugins(gh, &pluginArr, &pluginArrSize);
|
||||||
|
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||||
const char * e = nullptr;
|
const char * e = nullptr;
|
||||||
string err;
|
string err;
|
||||||
lo_get_error_message(&e);
|
lo_get_error_message(&e);
|
||||||
@@ -334,7 +336,7 @@ namespace loot {
|
|||||||
else if (Id() == Game::fonv)
|
else if (Id() == Game::fonv)
|
||||||
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL);
|
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL);
|
||||||
|
|
||||||
if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) {
|
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||||
const char * e = nullptr;
|
const char * e = nullptr;
|
||||||
string err;
|
string err;
|
||||||
lo_get_error_message(&e);
|
lo_get_error_message(&e);
|
||||||
@@ -350,26 +352,29 @@ namespace loot {
|
|||||||
throw error(error::liblo_error, err);
|
throw error(error::liblo_error, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = lo_set_game_master(gh, _masterFile.c_str());
|
if (id != Game::tes5) {
|
||||||
|
ret = lo_set_game_master(gh, _masterFile.c_str());
|
||||||
|
|
||||||
if (ret != LIBLO_OK) {
|
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||||
const char * e = nullptr;
|
const char * e = nullptr;
|
||||||
string err;
|
string err;
|
||||||
lo_get_error_message(&e);
|
lo_get_error_message(&e);
|
||||||
lo_destroy_handle(gh);
|
lo_destroy_handle(gh);
|
||||||
if (e == nullptr) {
|
if (e == nullptr) {
|
||||||
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details could not be fetched.";
|
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details could not be fetched.";
|
||||||
err = lc::translate("libloadorder failed to initialise game master file support. Details could not be fetched.").str();
|
err = lc::translate("libloadorder failed to initialise game master file support. Details could not be fetched.").str();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details: " << e;
|
||||||
|
err = lc::translate("libloadorder failed to initialise game master file support. Details:").str() + " " + e;
|
||||||
|
}
|
||||||
|
lo_cleanup();
|
||||||
|
throw error(error::liblo_error, err);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details: " << e;
|
|
||||||
err = lc::translate("libloadorder failed to initialise game master file support. Details:").str() + " " + e;
|
|
||||||
}
|
|
||||||
lo_cleanup();
|
|
||||||
throw error(error::liblo_error, err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lo_get_load_order(gh, &pluginArr, &pluginArrSize) != LIBLO_OK) {
|
ret = lo_get_load_order(gh, &pluginArr, &pluginArrSize);
|
||||||
|
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||||
const char * e = nullptr;
|
const char * e = nullptr;
|
||||||
string err;
|
string err;
|
||||||
lo_get_error_message(&e);
|
lo_get_error_message(&e);
|
||||||
@@ -410,7 +415,7 @@ namespace loot {
|
|||||||
else if (Id() == Game::fonv)
|
else if (Id() == Game::fonv)
|
||||||
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL);
|
ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str(), NULL);
|
||||||
|
|
||||||
if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) {
|
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||||
const char * e = nullptr;
|
const char * e = nullptr;
|
||||||
string err;
|
string err;
|
||||||
lo_get_error_message(&e);
|
lo_get_error_message(&e);
|
||||||
@@ -426,22 +431,24 @@ namespace loot {
|
|||||||
throw error(error::liblo_error, err);
|
throw error(error::liblo_error, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = lo_set_game_master(gh, _masterFile.c_str());
|
if (id != Game::tes5) {
|
||||||
if (ret != LIBLO_OK) {
|
ret = lo_set_game_master(gh, _masterFile.c_str());
|
||||||
const char * e = nullptr;
|
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||||
string err;
|
const char * e = nullptr;
|
||||||
lo_get_error_message(&e);
|
string err;
|
||||||
lo_destroy_handle(gh);
|
lo_get_error_message(&e);
|
||||||
if (e == nullptr) {
|
lo_destroy_handle(gh);
|
||||||
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details could not be fetched.";
|
if (e == nullptr) {
|
||||||
err = lc::translate("libloadorder failed to initialise game master file support. Details could not be fetched.").str();
|
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details could not be fetched.";
|
||||||
|
err = lc::translate("libloadorder failed to initialise game master file support. Details could not be fetched.").str();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details: " << e;
|
||||||
|
err = lc::translate("libloadorder failed to initialise game master file support. Details:").str() + " " + e;
|
||||||
|
}
|
||||||
|
lo_cleanup();
|
||||||
|
throw error(error::liblo_error, err);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details: " << e;
|
|
||||||
err = lc::translate("libloadorder failed to initialise game master file support. Details:").str() + " " + e;
|
|
||||||
}
|
|
||||||
lo_cleanup();
|
|
||||||
throw error(error::liblo_error, err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginArrSize = loadOrder.size();
|
pluginArrSize = loadOrder.size();
|
||||||
@@ -453,7 +460,8 @@ namespace loot {
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lo_set_load_order(gh, pluginArr, pluginArrSize) != LIBLO_OK) {
|
ret = lo_set_load_order(gh, pluginArr, pluginArrSize);
|
||||||
|
if (ret != LIBLO_OK && ret != LIBLO_WARN_BAD_FILENAME && ret != LIBLO_WARN_INVALID_LIST && ret != LIBLO_WARN_LO_MISMATCH) {
|
||||||
for (size_t i=0; i < pluginArrSize; i++)
|
for (size_t i=0; i < pluginArrSize; i++)
|
||||||
delete [] pluginArr[i];
|
delete [] pluginArr[i];
|
||||||
delete [] pluginArr;
|
delete [] pluginArr;
|
||||||
|
|||||||
Reference in New Issue
Block a user