diff options
author | HappyDOGE <28511119+HappyDOGE@users.noreply.github.com> | 2022-01-04 14:19:22 +0300 |
---|---|---|
committer | HappyDOGE <28511119+HappyDOGE@users.noreply.github.com> | 2022-01-04 14:19:22 +0300 |
commit | 0adbb7b60f5134a27558404c6c0ffacd42cb38c2 (patch) | |
tree | 53bcd279a5f2145955abe4449e83bebb230a8b09 /NorthstarDedicatedTest/modmanager.cpp | |
parent | 7d804649313949c1236463e7277c68200eb97769 (diff) | |
download | NorthstarLauncher-0adbb7b60f5134a27558404c6c0ffacd42cb38c2.tar.gz NorthstarLauncher-0adbb7b60f5134a27558404c6c0ffacd42cb38c2.zip |
audio override
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(); |