From a6b6e393ef9af58700dc65484e05700272392742 Mon Sep 17 00:00:00 2001 From: TheRedDaemon <66257843+TheRedDaemon@users.noreply.github.com> Date: Thu, 21 May 2026 22:01:14 +0200 Subject: [PATCH 1/2] reimplement: SHC_3BB0A8C1_0x00479F30 100% --- .../deactivateSoundFromMenuFuncUnk.cpp | 39 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/Audio/mss/SoundSystem/deactivateSoundFromMenuFuncUnk.cpp diff --git a/src/OpenSHC/Audio/mss/SoundSystem/deactivateSoundFromMenuFuncUnk.cpp b/src/OpenSHC/Audio/mss/SoundSystem/deactivateSoundFromMenuFuncUnk.cpp new file mode 100644 index 0000000..09f67cc --- /dev/null +++ b/src/OpenSHC/Audio/mss/SoundSystem/deactivateSoundFromMenuFuncUnk.cpp @@ -0,0 +1,39 @@ +#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" + +#include + +namespace OpenSHC { +namespace Audio { + namespace MSS { + + // FUNCTION: STRONGHOLDCRUSADER 0x00479F30 + void SoundSystem::deactivateSoundFromMenuFuncUnk() + { + if (!this->waveOutOpenUnk_0x8) { + return; + } + + for (int i = 0; i < 5; ++i) { + unsigned int const copy = *((unsigned int*)&this->streamFlagsUnkAndLoopCount_0x34[i]) & 0x7fffffff; + this->streamFlagsUnkAndLoopCount_0x34[i] = *((UnkSoundFlagsAndLoopCount*)©); + MACRO_CALL_MEMBER(SoundSystem_Func::endSoundStream, this)(i); + } + + int* piVar1 = this->sampleSoundIndex_0x20c + 1; + unsigned int iVar3 = 32; + do { + AIL_end_sample((HSAMPLE)piVar1[-0x20]); + *piVar1 = 0; + piVar1 = piVar1 + 1; + iVar3 = iVar3 + -1; + } while (iVar3 != 1); + + for (int i = 1; i < this->loadedSoundsCountAndIndex_0x316c; ++i) { + this->soundFileCurrSampleNum_0x28c[i] = -1; + } + this->soundActiveUnk_0x0 = 0; + } + + } +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 4e9089a..dc44d86 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -10891,7 +10891,7 @@ SHC_3BB0A8C1_0x00479CF0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00479D90 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00479DF0 | 0.0% | Pending SHC_3BB0A8C1_0x00479E60 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00479F30 | 0.0% | Pending +SHC_3BB0A8C1_0x00479F30 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00479FC0 | 0.0% | Pending SHC_3BB0A8C1_0x0047A080 | 0.0% | Pending SHC_3BB0A8C1_0x0047A130 | 0.0% | Pending From fd41d7bf6c161aac6807bc41f22dfd15f247310b Mon Sep 17 00:00:00 2001 From: TheRedDaemon <66257843+TheRedDaemon@users.noreply.github.com> Date: Fri, 22 May 2026 19:41:25 +0200 Subject: [PATCH 2/2] reimplement: SHC_3BB0A8C1_0x00479F30 fix loop --- .../SoundSystem/deactivateSoundFromMenuFuncUnk.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/OpenSHC/Audio/mss/SoundSystem/deactivateSoundFromMenuFuncUnk.cpp b/src/OpenSHC/Audio/mss/SoundSystem/deactivateSoundFromMenuFuncUnk.cpp index 09f67cc..24fa3f8 100644 --- a/src/OpenSHC/Audio/mss/SoundSystem/deactivateSoundFromMenuFuncUnk.cpp +++ b/src/OpenSHC/Audio/mss/SoundSystem/deactivateSoundFromMenuFuncUnk.cpp @@ -19,14 +19,10 @@ namespace Audio { MACRO_CALL_MEMBER(SoundSystem_Func::endSoundStream, this)(i); } - int* piVar1 = this->sampleSoundIndex_0x20c + 1; - unsigned int iVar3 = 32; - do { - AIL_end_sample((HSAMPLE)piVar1[-0x20]); - *piVar1 = 0; - piVar1 = piVar1 + 1; - iVar3 = iVar3 + -1; - } while (iVar3 != 1); + for (int i = 0; i < 31; ++i) { + AIL_end_sample(this->sample_0x190[i]); + this->sampleSoundIndex_0x20c[i + 1] = 0; + } for (int i = 1; i < this->loadedSoundsCountAndIndex_0x316c; ++i) { this->soundFileCurrSampleNum_0x28c[i] = -1;