mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
@@ -106,7 +106,7 @@ namespace loot {
|
||||
Game& Game::SetDetails(const std::string& name, const std::string& masterFile,
|
||||
const std::string& repositoryURL, const std::string& repositoryBranch, const std::string& path, const std::string& registry) {
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Setting new details for game: " << _name;
|
||||
BOOST_LOG_TRIVIAL(info) << "Setting new details for game: " << _name;
|
||||
|
||||
if (!name.empty())
|
||||
_name = name;
|
||||
@@ -136,7 +136,7 @@ namespace loot {
|
||||
}
|
||||
|
||||
Game& Game::Init() {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Initialising filesystem-related data for game: " << _name;
|
||||
BOOST_LOG_TRIVIAL(info) << "Initialising filesystem-related data for game: " << _name;
|
||||
|
||||
//First look for local install, then look for Registry.
|
||||
if (gamePath.empty() || !fs::exists(gamePath / "Data" / _masterFile)) {
|
||||
@@ -234,7 +234,7 @@ namespace loot {
|
||||
}
|
||||
|
||||
void Game::RefreshActivePluginsList() {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Refreshing active plugins list for game: " << _name;
|
||||
BOOST_LOG_TRIVIAL(debug) << "Refreshing active plugins list for game: " << _name;
|
||||
|
||||
lo_game_handle gh;
|
||||
char ** pluginArr;
|
||||
@@ -314,7 +314,7 @@ namespace loot {
|
||||
}
|
||||
|
||||
void Game::GetLoadOrder(std::list<std::string>& loadOrder) const {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Setting load order for game: " << _name;
|
||||
BOOST_LOG_TRIVIAL(debug) << "Getting load order for game: " << _name;
|
||||
|
||||
lo_game_handle gh;
|
||||
char ** pluginArr;
|
||||
@@ -391,7 +391,7 @@ namespace loot {
|
||||
}
|
||||
|
||||
void Game::SetLoadOrder(const std::list<Plugin>& loadOrder) const {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Setting load order for game: " << _name;
|
||||
BOOST_LOG_TRIVIAL(debug) << "Setting load order for game: " << _name;
|
||||
|
||||
lo_game_handle gh = NULL;
|
||||
char ** pluginArr = NULL;
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace loot {
|
||||
BOOST_LOG_TRIVIAL(error) << "Unable to open \"" << filename.string() << "\" for CRC calculation.";
|
||||
throw error(error::path_read_fail, (boost::format(lc::translate("Unable to open \"%1%\" for CRC calculation.")) % filename.string()).str());
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(debug) << "CRC32(\"" << filename.string() << "\"):" << chksum;
|
||||
BOOST_LOG_TRIVIAL(debug) << "CRC32(\"" << filename.string() << "\"): " << std::hex << chksum << std::dec;
|
||||
return chksum;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace loot {
|
||||
4. Compare the file and blob buffers.
|
||||
*/
|
||||
pointers_struct ptrs;
|
||||
BOOST_LOG_TRIVIAL(trace) << "Existing repository found, attempting to open it.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Existing repository found, attempting to open it.";
|
||||
handle_error(git_repository_open(&ptrs.repo, game.MasterlistPath().parent_path().string().c_str()), ptrs);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Getting HEAD masterlist object.";
|
||||
@@ -123,7 +123,7 @@ namespace loot {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Getting blob for masterlist object.";
|
||||
handle_error(git_blob_lookup(&ptrs.blob, ptrs.repo, git_object_id(ptrs.obj)), ptrs);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Opening masterlist in working directory.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Opening masterlist in working directory.";
|
||||
std::string mlist;
|
||||
loot::ifstream ifile(game.MasterlistPath().string().c_str(), ios::binary);
|
||||
if (ifile.fail())
|
||||
@@ -135,7 +135,7 @@ namespace loot {
|
||||
back_inserter(mlist)
|
||||
);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Comparing files.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Comparing files.";
|
||||
if (are_files_equal(git_blob_rawcontent(ptrs.blob), git_blob_rawsize(ptrs.blob), mlist.data(), mlist.length())) {
|
||||
char revision[10];
|
||||
//Need to get the HEAD object, because the individual file has a different SHA.
|
||||
@@ -157,7 +157,7 @@ namespace loot {
|
||||
std::pair<std::string, std::string> UpdateMasterlist(Game& game, std::list<Message>& parsingErrors, std::list<Plugin>& plugins, std::list<Message>& messages) {
|
||||
pointers_struct ptrs;
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Checking for a Git repository.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Checking for a Git repository.";
|
||||
|
||||
//Checking for a ".git" folder.
|
||||
if (fs::exists(game.MasterlistPath().parent_path() / ".git")) {
|
||||
@@ -175,13 +175,13 @@ namespace loot {
|
||||
//Get the remote URL.
|
||||
const char * url = git_remote_url(ptrs.remote);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Checking to see if remote URL matches URL in settings.";
|
||||
BOOST_LOG_TRIVIAL(info) << "Checking to see if remote URL matches URL in settings.";
|
||||
|
||||
//Check if the repo URLs match.
|
||||
BOOST_LOG_TRIVIAL(info) << "Remote URL given: " << game.RepoURL();
|
||||
BOOST_LOG_TRIVIAL(info) << "Remote URL in repository settings: " << url;
|
||||
if (url != game.RepoURL()) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "URLs do not match, setting repository URL to URL in settings.";
|
||||
BOOST_LOG_TRIVIAL(info) << "URLs do not match, setting repository URL to URL in settings.";
|
||||
//The URLs don't match. Change the remote URL to match the one LOOT has.
|
||||
handle_error(git_remote_set_url(ptrs.remote, game.RepoURL().c_str()), ptrs);
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace loot {
|
||||
string revision, date;
|
||||
do {
|
||||
string filespec = "refs/remotes/origin/" + game.RepoBranch() + "~" + IntToString(rollbacks);
|
||||
BOOST_LOG_TRIVIAL(trace) << "Getting the Git object for the tree at " << filespec;
|
||||
BOOST_LOG_TRIVIAL(info) << "Getting the Git object for the tree at " << filespec;
|
||||
handle_error(git_revparse_single(&ptrs.obj, ptrs.repo, filespec.c_str()), ptrs);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Getting the Git object ID.";
|
||||
@@ -271,7 +271,7 @@ namespace loot {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Performing a Git checkout of HEAD.";
|
||||
handle_error(git_checkout_head(ptrs.repo, &opts), ptrs);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Tree hash is: " << revision;
|
||||
BOOST_LOG_TRIVIAL(debug) << "Tree hash is: " << revision;
|
||||
BOOST_LOG_TRIVIAL(trace) << "Freeing pointers.";
|
||||
git_object_free(ptrs.obj);
|
||||
git_reference_free(ptrs.ref);
|
||||
@@ -280,7 +280,7 @@ namespace loot {
|
||||
ptrs.ref = NULL;
|
||||
ptrs.commit = NULL;
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Testing masterlist parsing.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Testing masterlist parsing.";
|
||||
|
||||
//Now try parsing the masterlist.
|
||||
list<loot::Message> messages;
|
||||
|
||||
+16
-17
@@ -198,7 +198,7 @@ bool LOOT::OnInit() {
|
||||
try {
|
||||
if (!fs::exists(g_path_settings.parent_path()))
|
||||
fs::create_directory(g_path_settings.parent_path());
|
||||
} catch (fs::filesystem_error& e) {
|
||||
} catch (fs::filesystem_error& /*e*/) {
|
||||
wxMessageBox(
|
||||
translate("Error: Could not create local app data LOOT folder."),
|
||||
translate("LOOT: Error"),
|
||||
@@ -650,7 +650,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
plugin_list_loader pll(graph, *_game);
|
||||
for (boost::unordered_map<string, size_t>::const_iterator it=tempMap.begin(), endit=tempMap.end(); it != endit; ++it) {
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Found plugin: " << it->first;
|
||||
BOOST_LOG_TRIVIAL(info) << "Found plugin: " << it->first;
|
||||
|
||||
vertex_t v = boost::add_vertex(loot::Plugin(it->first), graph);
|
||||
|
||||
@@ -701,14 +701,14 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
|
||||
|
||||
//Merge all global message lists.
|
||||
BOOST_LOG_TRIVIAL(trace) << "Merging all global message lists.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Merging all global message lists.";
|
||||
if (!mlist_messages.empty())
|
||||
messages.insert(messages.end(), mlist_messages.begin(), mlist_messages.end());
|
||||
if (!ulist_messages.empty())
|
||||
messages.insert(messages.end(), ulist_messages.begin(), ulist_messages.end());
|
||||
|
||||
//Evaluate any conditions in the global messages.
|
||||
BOOST_LOG_TRIVIAL(trace) << "Evaluating global message conditions.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Evaluating global message conditions.";
|
||||
try {
|
||||
list<loot::Message>::iterator it=messages.begin();
|
||||
while (it != messages.end()) {
|
||||
@@ -784,32 +784,31 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
//Check for back-edges, then perform a topological sort.
|
||||
try {
|
||||
bool applyLoadOrder = false;
|
||||
long ret;
|
||||
do {
|
||||
BOOST_LOG_TRIVIAL(debug) << "Building the plugin dependency graph...";
|
||||
BOOST_LOG_TRIVIAL(info) << "Building the plugin dependency graph...";
|
||||
|
||||
//Now add the interactions between plugins to the graph as edges.
|
||||
BOOST_LOG_TRIVIAL(trace) << "Adding non-overlap edges.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Adding non-overlap edges.";
|
||||
AddSpecificEdges(graph);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Adding priority edges.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Adding priority edges.";
|
||||
AddPriorityEdges(graph);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Adding overlap edges.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Adding overlap edges.";
|
||||
AddOverlapEdges(graph);
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "Checking to see if the graph is cyclic.";
|
||||
BOOST_LOG_TRIVIAL(info) << "Checking to see if the graph is cyclic.";
|
||||
loot::CheckForCycles(graph);
|
||||
|
||||
progDia->Pulse();
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "Performing a topological sort.";
|
||||
BOOST_LOG_TRIVIAL(info) << "Performing a topological sort.";
|
||||
loot::Sort(graph, plugins);
|
||||
|
||||
progDia->Destroy();
|
||||
progDia = NULL;
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "Displaying load order preview.";
|
||||
BOOST_LOG_TRIVIAL(info) << "Displaying load order preview.";
|
||||
MiniEditor editor(this, translate("LOOT: Calculated Load Order"), plugins, *_game);
|
||||
|
||||
long ret = editor.ShowModal();
|
||||
@@ -840,13 +839,13 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
}
|
||||
|
||||
//Clear all existing edges from the graph.
|
||||
BOOST_LOG_TRIVIAL(trace) << "Clearing all existing edges from the plugin graph.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Clearing all existing edges from the plugin graph.";
|
||||
for (boost::tie(vit, vitend) = boost::vertices(graph); vit != vitend; ++vit) {
|
||||
boost::clear_vertex(*vit, graph);
|
||||
}
|
||||
|
||||
//Merge edits down to the userlist entries.
|
||||
BOOST_LOG_TRIVIAL(trace) << "Merging down edits to the userlist.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Merging down edits to the userlist.";
|
||||
for (list<loot::Plugin>::const_iterator it = edits.begin(), endit = edits.end(); it != endit; ++it) {
|
||||
list<loot::Plugin>::iterator jt = find(ulist_plugins.begin(), ulist_plugins.end(), *it);
|
||||
|
||||
@@ -859,7 +858,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
}
|
||||
|
||||
//Save edits to userlist.
|
||||
BOOST_LOG_TRIVIAL(debug) << "Saving edited userlist.";
|
||||
BOOST_LOG_TRIVIAL(info) << "Saving edited userlist.";
|
||||
YAML::Emitter yout;
|
||||
yout.SetIndent(2);
|
||||
yout << YAML::BeginMap
|
||||
@@ -884,9 +883,9 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to set the load order. Details: " << e.what();
|
||||
messages.push_back(loot::Message(loot::Message::error, (format(loc::translate("Failed to set the load order. Details: %1%")) % e.what()).str()));
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(trace) << "Load order set:";
|
||||
BOOST_LOG_TRIVIAL(info) << "Load order set:";
|
||||
for (list<loot::Plugin>::iterator it = plugins.begin(), endIt = plugins.end(); it != endIt; ++it) {
|
||||
BOOST_LOG_TRIVIAL(trace) << '\t' << it->Name();
|
||||
BOOST_LOG_TRIVIAL(info) << '\t' << it->Name();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user