Removed support for parsing BOSS masterlists.

This commit is contained in:
WrinklyNinja
2014-05-08 19:54:20 +01:00
parent 7acec3d3f3
commit 5f8daa2db5
5 changed files with 7 additions and 965 deletions
+1 -9
View File
@@ -114,7 +114,7 @@ ELSEIF (MSVC)
set (CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "Platform Toolset" FORCE)
set (BOOST_SUFFIX "-vc120-mt-1_55")
ELSEIF (MSVC_VERSION EQUAL 1700)
set (BOOST_SUFFIX "-vc110-mt-1_55")
set (BOOST_SUFFIX "-vc110-mt-1_55")
ENDIF ()
include_directories("${PROJECT_LIBS_DIR}/wxWidgets/lib/vc_lib/mswu")
link_directories("${PROJECT_LIBS_DIR}/wxWidgets/lib/vc_lib")
@@ -158,11 +158,3 @@ target_link_libraries (loot${PROJECT_ARCH} ${LOOT_LIBS})
# Build application.
add_executable (LOOT ${LOOT_GUI_SRC})
target_link_libraries (LOOT ${LOOT_GUI_LIBS})
# Build converter.
add_executable (masterlist-converter ${LOOT_SRC} "${CMAKE_SOURCE_DIR}/src/converter.cpp")
IF (MSVC)
set_target_properties (masterlist-converter PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")
ENDIF ()
target_link_libraries (masterlist-converter ${LOOT_LIBS})
+4 -12
View File
@@ -29,7 +29,6 @@
#include "../backend/generators.h"
#include "../backend/error.h"
#include "../backend/streams.h"
#include "../backend/legacy-parser.h"
#include <yaml-cpp/yaml.h>
@@ -277,17 +276,10 @@ LOOT_API unsigned int loot_load_lists (loot_db db, const char * const masterlist
try {
if (boost::filesystem::exists(masterlistPath)) {
if (boost::algorithm::iends_with(masterlistPath, ".yaml")) {
loot::ifstream in(masterlistPath);
YAML::Node tempNode = YAML::Load(in);
in.close();
temp = tempNode["plugins"].as< std::list<loot::Plugin> >();
}
else {
boost::filesystem::path p(masterlistPath);
std::list<loot::Message> filler;
LoadBOSSMasterlist(p, temp, filler);
}
loot::ifstream in(masterlistPath);
YAML::Node tempNode = YAML::Load(in);
in.close();
temp = tempNode["plugins"].as< std::list<loot::Plugin> >();
}
} catch (std::exception& e) {
return c_error(loot_error_parse_fail, e.what());
+2 -2
View File
@@ -274,8 +274,8 @@ LOOT_API void loot_destroy_db (loot_db db);
@brief Loads the masterlist and userlist from the paths specified.
@details Can be called multiple times, each time replacing the previously-loaded data.
@param db The database the function acts on.
@param masterlistPath A string containing the relative or absolute path to the masterlist file that should be loaded. The API supports loading both LOOT and BOSS masterlists.
@param userlistPath A string containing the relative or absolute path to the userlist file that should be loaded, or `NULL`. If `NULL`, no userlist will be loaded. The API only upports loading v3 userlists.
@param masterlistPath A string containing the relative or absolute path to the masterlist file that should be loaded.
@param userlistPath A string containing the relative or absolute path to the userlist file that should be loaded, or `NULL`. If `NULL`, no userlist will be loaded.
@returns A return code.
*/
LOOT_API unsigned int loot_load_lists (loot_db db, const char * const masterlistPath,
File diff suppressed because it is too large Load Diff
-111
View File
@@ -1,111 +0,0 @@
/* LOOT
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
Fallout: New Vegas.
Copyright (C) 2013-2014 WrinklyNinja
This file is part of LOOT.
LOOT is free software: you can redistribute
it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
LOOT is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LOOT. If not, see
<http://www.gnu.org/licenses/>.
*/
#include "backend/legacy-parser.h"
#include "backend/generators.h"
#include "backend/streams.h"
#include "backend/metadata.h"
using namespace std;
/**
@file converter.cpp
@brief The masterlist converter utility.
@section about_sec About
The masterlist converter is a command line utility that takes two optional
command line arguments:
```
masterlist-converter.exe [BOSS masterlist input] [LOOT masterlist output]
```
If only one argument is given, or if no arguments are given, the converter
assumes it was called as
```
masterlist-converter.exe masterlist.txt masterlist.yaml
```
On encountering an error, it will print an error message to the console,
and will not output a LOOT masterlist.
The converter does not perform a lossless conversion. The following do not
get transferred into the new masterlist:
* Silent comments. (Search regex: `^(/\*|//)`)
* Plugin conditions. (Search regex: `^IF(NOT)?.+MOD:`)
* Requirement messages containing plugin filenames. (Search regex:
`REQ:.+(\.esp|\.esm)`)
* Dirty message content. The ITM, UDR and Navmesh counts, along with CRCs
and the dirty utility referenced are transferred, but any additional
content, such as links to additional instructions, are lost. (Search
regex: `DIRTY:`.)
In addition, while other data is retained, it needs some manual adjustment,
eg. translated messages need are converted as separate messages and should
be placed into message content objects.
*/
int main(int argc, char * argv[]) {
string in_str, out_str;
if (argc < 3) {
in_str = "masterlist.txt";
out_str = "masterlist.yaml";
} else {
in_str = argv[1];
out_str = argv[2];
}
boost::log::core::get()->set_logging_enabled(false);
// Set up emitter.
YAML::Emitter yout;
yout.SetIndent(2);
list<loot::Plugin> test_plugins;
list<loot::Message> globalMessages;
//Parse the BOSS masterlist and output it as a LOOT masterlist.
try {
LoadBOSSMasterlist(boost::filesystem::path(in_str), test_plugins, globalMessages);
} catch (exception& e) {
cout << "An error was encountered during masterlist parsing. Message: " << e.what() << endl;
return 1;
}
yout << YAML::BeginMap
<< YAML::Key << "globals" << YAML::Value << globalMessages
<< YAML::Key << "plugins" << YAML::Value << test_plugins
<< YAML::EndMap;
// Save output.
boost::filesystem::path out_path(out_str);
loot::ofstream out(out_path);
out << yout.c_str();
out.close();
return 0;
}