@@ -17,9 +17,9 @@ using std::recursive_mutex;
1717
1818namespace lootcli
1919{
20- static const std::set<std::string> oldDefaultBranches ({ " master " , " v0.7 " , " v0.8 " ,
21- " v0.10" , " v0.13" , " v0.14" ,
22- " v0.15 " , " v0.17 " , " v0.18 " });
20+ static const std::set<std::string>
21+ oldDefaultBranches ({ " master " , " v0.7 " , " v0.8 " , " v0.10" , " v0.13" , " v0.14" , " v0.15 " ,
22+ " v0.17 " , " v0.18 " , " v0.21 " });
2323static const std::regex GITHUB_REPO_URL_REGEX =
2424 std::regex (R"( ^https://github\.com/([^/]+)/([^/]+?)(?:\.git)?/?$)" ,
2525 std::regex::ECMAScript | std::regex::icase);
@@ -55,13 +55,20 @@ std::string ToLower(std::string text)
5555void LOOTWorker::setGame (const std::string& gameName)
5656{
5757 static std::map<std::string, loot::GameId> gameMap = {
58- {" morrowind" , loot::GameId::tes3}, {" oblivion" , loot::GameId::tes4},
59- {" fallout3" , loot::GameId::fo3}, {" fallout4" , loot::GameId::fo4},
60- {" fallout4vr" , loot::GameId::fo4vr}, {" falloutnv" , loot::GameId::fonv},
61- {" skyrim" , loot::GameId::tes5}, {" skyrimse" , loot::GameId::tes5se},
62- {" skyrimvr" , loot::GameId::tes5vr}, {" nehrim" , loot::GameId::nehrim},
63- {" enderal" , loot::GameId::enderal}, {" enderalse" , loot::GameId::enderalse},
64- {" starfield" , loot::GameId::starfield}};
58+ {" morrowind" , loot::GameId::tes3},
59+ {" oblivion" , loot::GameId::tes4},
60+ {" fallout3" , loot::GameId::fo3},
61+ {" fallout4" , loot::GameId::fo4},
62+ {" fallout4vr" , loot::GameId::fo4vr},
63+ {" falloutnv" , loot::GameId::fonv},
64+ {" skyrim" , loot::GameId::tes5},
65+ {" skyrimse" , loot::GameId::tes5se},
66+ {" skyrimvr" , loot::GameId::tes5vr},
67+ {" nehrim" , loot::GameId::nehrim},
68+ {" enderal" , loot::GameId::enderal},
69+ {" enderalse" , loot::GameId::enderalse},
70+ {" starfield" , loot::GameId::starfield},
71+ {" oblivionremastered" , loot::GameId::oblivionRemastered}};
6572
6673 auto iter = gameMap.find (ToLower (gameName));
6774
@@ -197,6 +204,12 @@ void LOOTWorker::getSettings(const fs::path& file)
197204 gameId = GameId::fo4;
198205 } else if (gameType == " Fallout4VR" ) {
199206 gameId = GameId::fo4vr;
207+ } else if (gameType == " Starfield" ) {
208+ gameId = GameId::starfield;
209+ } else if (gameType == " OpenMW" ) {
210+ gameId = GameId::openmw;
211+ } else if (gameType == " Oblivion Remastered" ) {
212+ gameId = GameId::oblivionRemastered;
200213 } else {
201214 throw std::runtime_error (
202215 " invalid value for 'type' key in game settings table" );
@@ -667,7 +680,7 @@ int LOOTWorker::run()
667680 std::locale::global (gen (" en.UTF-8" ));
668681 }
669682
670- loot::SetLoggingCallback ([&](loot::LogLevel level, const char * message) {
683+ loot::SetLoggingCallback ([&](loot::LogLevel level, std::string_view message) {
671684 log (level, message);
672685 });
673686
@@ -784,21 +797,23 @@ int LOOTWorker::run()
784797
785798 progress (Progress::LoadingLists);
786799
800+ gameHandle->GetDatabase ().LoadMasterlist (masterlistPath ().string ());
787801 fs::path userlist = userlistPath ();
788- gameHandle->GetDatabase ().LoadLists (masterlistPath ().string (),
789- fs::exists (userlist) ? userlistPath ().string ()
790- : fs::path ());
802+ if (fs::exists (userlist))
803+ gameHandle->GetDatabase ().LoadUserlist (userlist.string ());
791804
792805 progress (Progress::ReadingPlugins);
793806 gameHandle->LoadCurrentLoadOrderState ();
807+ auto loadOrder = gameHandle->GetLoadOrder ();
794808 std::vector<std::filesystem::path> pluginsList;
795809 for (auto plugin : gameHandle->GetLoadOrder ()) {
796810 std::filesystem::path pluginPath (plugin);
797811 pluginsList.push_back (pluginPath);
798812 }
813+ gameHandle->LoadPlugins (pluginsList, false );
799814
800815 progress (Progress::SortingPlugins);
801- std::vector<std::string> sortedPlugins = gameHandle->SortPlugins (pluginsList );
816+ std::vector<std::string> sortedPlugins = gameHandle->SortPlugins (loadOrder );
802817
803818 progress (Progress::WritingLoadorder);
804819
@@ -1040,14 +1055,7 @@ void LOOTWorker::progress(Progress p)
10401055 std::cout.flush ();
10411056}
10421057
1043- std::string escapeNewlines (const std::string& s)
1044- {
1045- auto ss = boost::replace_all_copy (s, " \n " , " \\ n" );
1046- boost::replace_all (ss, " \r " , " \\ r" );
1047- return ss;
1048- }
1049-
1050- void LOOTWorker::log (loot::LogLevel level, const std::string& message) const
1058+ void LOOTWorker::log (loot::LogLevel level, const std::string_view message) const
10511059{
10521060 if (level < m_LogLevel) {
10531061 return ;
@@ -1056,7 +1064,7 @@ void LOOTWorker::log(loot::LogLevel level, const std::string& message) const
10561064 const auto ll = fromLootLogLevel (level);
10571065 const auto levelName = logLevelToString (ll);
10581066
1059- std::cout << " [" << levelName << " ] " << escapeNewlines ( message) << " \n " ;
1067+ std::cout << " [" << levelName << " ] " << message << " \n " ;
10601068 std::cout.flush ();
10611069}
10621070
0 commit comments