From 9f0288d744cd8dbd9b4213bd7a1a73a0c822b5a6 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Sun, 29 Aug 2021 04:51:22 +0100 Subject: add mod vpk support --- NorthstarDedicatedTest/modmanager.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'NorthstarDedicatedTest/modmanager.cpp') diff --git a/NorthstarDedicatedTest/modmanager.cpp b/NorthstarDedicatedTest/modmanager.cpp index 63115ea4..f5deed1a 100644 --- a/NorthstarDedicatedTest/modmanager.cpp +++ b/NorthstarDedicatedTest/modmanager.cpp @@ -247,9 +247,22 @@ void ModManager::LoadMods() // read vpk paths if (fs::exists(mod->ModDirectory / "vpk")) + { for (fs::directory_entry file : fs::directory_iterator(mod->ModDirectory / "vpk")) - if (fs::is_regular_file(file) && file.path().extension() == "vpk") - mod->Vpks.push_back(file.path().string()); + { + // a bunch of checks to make sure we're only adding dir vpks and their paths are good + // note: the game will literally only load vpks with the english prefix + if (fs::is_regular_file(file) && file.path().extension() == ".vpk" && + file.path().string().find("english") != std::string::npos && file.path().string().find(".bsp.pak000_dir") != std::string::npos) + { + std::string formattedPath = file.path().filename().string(); + + // this really fucking sucks but it'll work + mod->Vpks.push_back((file.path().parent_path() / formattedPath.substr(strlen("english"), formattedPath.find(".bsp") - 3)).string()); + } + } + } + // read keyvalues paths if (fs::exists(mod->ModDirectory / "keyvalues")) -- cgit v1.2.3