diff options
Diffstat (limited to 'NorthstarDedicatedTest/modmanager.cpp')
-rw-r--r-- | NorthstarDedicatedTest/modmanager.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/modmanager.cpp b/NorthstarDedicatedTest/modmanager.cpp index 23dd2d6e..34bba6af 100644 --- a/NorthstarDedicatedTest/modmanager.cpp +++ b/NorthstarDedicatedTest/modmanager.cpp @@ -2,6 +2,7 @@ #include "modmanager.h" #include "convar.h" #include "concommand.h" +#include "audio.h" #include "rapidjson/error/en.h" #include "rapidjson/document.h" @@ -330,6 +331,22 @@ void ModManager::LoadMods() mod.Pdiff = pdiffStringStream.str(); } } + + // try to load audio + if (fs::exists(mod.ModDirectory / "audio")) + { + for (fs::directory_entry file : fs::directory_iterator(mod.ModDirectory / "audio")) + { + if (fs::is_regular_file(file) && file.path().extension().string() == ".json") + { + if (!g_CustomAudioManager.TryLoadAudioOverride(file.path())) + { + spdlog::warn("Mod {} has an invalid audio def {}", mod.Name, file.path().filename().string()); + continue; + } + } + } + } } // in a seperate loop because we register mod files in reverse order, since mods loaded later should have their files prioritised @@ -364,6 +381,8 @@ void ModManager::UnloadMods() m_modFiles.clear(); fs::remove_all(COMPILED_ASSETS_PATH); + g_CustomAudioManager.ClearAudioOverrides(); + if (!m_hasEnabledModsCfg) m_enabledModsCfg.SetObject(); |