diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2024-08-25 19:18:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-25 19:18:42 +0200 |
commit | 5472a3630762db2d6880a4dafda9402dbbc872f8 (patch) | |
tree | a8602200e2f5052c6a7ccc9e75e03a428d2c7936 /primedev/mods | |
parent | fff09b8b6805f66c87da2ac39ef5509bffb129cf (diff) | |
parent | 5aae42126a062f1d184aff1c8217ef50259ccc53 (diff) | |
download | NorthstarLauncher-5472a3630762db2d6880a4dafda9402dbbc872f8.tar.gz NorthstarLauncher-5472a3630762db2d6880a4dafda9402dbbc872f8.zip |
Merge branch 'main' into feat/overhaul-mod-loading-locations
Diffstat (limited to 'primedev/mods')
-rw-r--r-- | primedev/mods/modmanager.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/primedev/mods/modmanager.cpp b/primedev/mods/modmanager.cpp index b3c8ab7a..cc6195c7 100644 --- a/primedev/mods/modmanager.cpp +++ b/primedev/mods/modmanager.cpp @@ -883,16 +883,24 @@ void ModManager::LoadMods() if (fs::is_regular_file(file) && file.path().extension() == ".rpak") { std::string pakName(file.path().filename().string()); - ModRpakEntry& modPak = mod.Rpaks.emplace_back(); - modPak.m_bAutoLoad = - !bUseRpakJson || (dRpakJson.HasMember("Preload") && dRpakJson["Preload"].IsObject() && - dRpakJson["Preload"].HasMember(pakName) && dRpakJson["Preload"][pakName].IsTrue()); - - // postload things - if (!bUseRpakJson || - (dRpakJson.HasMember("Postload") && dRpakJson["Postload"].IsObject() && dRpakJson["Postload"].HasMember(pakName))) - modPak.m_sLoadAfterPak = dRpakJson["Postload"][pakName].GetString(); + + if (!bUseRpakJson) + { + spdlog::warn("Mod {} contains rpaks without valid rpak.json, rpaks might not be loaded", mod.Name); + } + else + { + modPak.m_bAutoLoad = + (dRpakJson.HasMember("Preload") && dRpakJson["Preload"].IsObject() && dRpakJson["Preload"].HasMember(pakName) && + dRpakJson["Preload"][pakName].IsTrue()); + + // postload things + if (dRpakJson.HasMember("Postload") && dRpakJson["Postload"].IsObject() && dRpakJson["Postload"].HasMember(pakName)) + { + modPak.m_sLoadAfterPak = dRpakJson["Postload"][pakName].GetString(); + } + } modPak.m_sPakName = pakName; |