From 0adbb7b60f5134a27558404c6c0ffacd42cb38c2 Mon Sep 17 00:00:00 2001 From: HappyDOGE <28511119+HappyDOGE@users.noreply.github.com> Date: Tue, 4 Jan 2022 14:19:22 +0300 Subject: audio override --- NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj') diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj index 299cf2ec..2b1cfb2d 100644 --- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj +++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj @@ -34,6 +34,7 @@ + @@ -60,6 +61,8 @@ pch.h stdcpp17 $(ProjectDir)include;%(AdditionalIncludeDirectories) + + Windows @@ -88,6 +91,8 @@ stdcpp17 $(ProjectDir)include;%(AdditionalIncludeDirectories) MultiThreadedDLL + + Windows @@ -106,6 +111,7 @@ + @@ -545,6 +551,7 @@ + @@ -619,7 +626,11 @@ + + + + \ No newline at end of file -- cgit v1.2.3 From 550a5daa072fe1c1a963f3ee0a6b7578a770338a Mon Sep 17 00:00:00 2001 From: HappyDOGE <28511119+HappyDOGE@users.noreply.github.com> Date: Tue, 4 Jan 2022 20:15:36 +0300 Subject: fix crash when reloading mods when an override is played --- .../NorthstarDedicatedTest.vcxproj | 6 ++++-- NorthstarDedicatedTest/audio.cpp | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj') diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj index 2b1cfb2d..abd50fc8 100644 --- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj +++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj @@ -22,13 +22,13 @@ DynamicLibrary true - v143 + v142 Unicode DynamicLibrary false - v143 + v142 true Unicode @@ -63,6 +63,7 @@ $(ProjectDir)include;%(AdditionalIncludeDirectories) + Async Windows @@ -93,6 +94,7 @@ MultiThreadedDLL + Async Windows diff --git a/NorthstarDedicatedTest/audio.cpp b/NorthstarDedicatedTest/audio.cpp index 5aa7354f..d56762e0 100644 --- a/NorthstarDedicatedTest/audio.cpp +++ b/NorthstarDedicatedTest/audio.cpp @@ -214,6 +214,9 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa bool CustomAudioManager::TryLoadAudioOverride(const fs::path& defPath) { + if (IsDedicated()) + return true; // silently fail + std::ifstream jsonStream(defPath); std::stringstream jsonStringStream; @@ -249,8 +252,24 @@ bool CustomAudioManager::TryLoadAudioOverride(const fs::path& defPath) return true; } +typedef void (*MilesStopAll_Type)(); +MilesStopAll_Type MilesStopAll; + void CustomAudioManager::ClearAudioOverrides() { + if (IsDedicated()) + return; + + if (m_loadedAudioOverrides.size() > 0 || m_loadedAudioOverridesRegex.size() > 0) + { + // stop all miles sounds beforehand + // miles_stop_all + MilesStopAll(); + + // this is cancer but it works + Sleep(50); + } + m_loadedAudioOverrides.clear(); m_loadedAudioOverridesRegex.clear(); } @@ -440,4 +459,6 @@ void InitialiseMilesAudioHooks(HMODULE baseAddress) ENABLER_CREATEHOOK(hook, (char*)milesAudioBase + 0xF110, &LoadSampleMetadata_Hook, reinterpret_cast(&LoadSampleMetadata_Original)); ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x57DAD0, &MilesLog_Hook, reinterpret_cast(&MilesLog_Original)); + + MilesStopAll = (MilesStopAll_Type)((char*)baseAddress + 0x580850); } \ No newline at end of file -- cgit v1.2.3 From b9b8fb4cde19b3bdcf6f327b82cc7797af85a8c9 Mon Sep 17 00:00:00 2001 From: HappyDOGE <28511119+HappyDOGE@users.noreply.github.com> Date: Tue, 4 Jan 2022 20:17:30 +0300 Subject: revert vcxproj --- NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj') diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj index abd50fc8..c6f0c8c0 100644 --- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj +++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj @@ -22,13 +22,13 @@ DynamicLibrary true - v142 + v143 Unicode DynamicLibrary false - v142 + v143 true Unicode @@ -63,7 +63,8 @@ $(ProjectDir)include;%(AdditionalIncludeDirectories) - Async + + Windows @@ -94,7 +95,8 @@ MultiThreadedDLL - Async + + Windows -- cgit v1.2.3