diff --git a/src/OpenSHC/Audio/mss/SoundSystem.hpp b/src/OpenSHC/Audio/mss/SoundSystem.hpp index 130e015..e469844 100644 --- a/src/OpenSHC/Audio/mss/SoundSystem.hpp +++ b/src/OpenSHC/Audio/mss/SoundSystem.hpp @@ -8,11 +8,12 @@ #pragma once -#include "Mss32.h" #include "OpenSHC/Audio/MSS/UnkSoundFlagsAndLoopCount.hpp" #include "OpenSHC/Audio/MSS/enums/SHC_SoundStreamInt.hpp" #include "OpenSHC/DE/SHCDE/eMusicIDsInt.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" + +#include "Mss32.h" #include "WinDef.h" namespace OpenSHC { @@ -60,7 +61,7 @@ namespace Audio { int sampleVolume; // 0x00003170 length: 4 int sampleSndStructVolumePercentage_0x3174[32]; // 0x00003174 length: 128 int samplePaused_0x31f4[32]; // 0x000031F4 length: 128 - undefined4 sec_Section1055_0x3274; // 0x00003274 length: 4 + int sec_Section1055_0x3274; // 0x00003274 length: 4 int currentSoundID_0x3278; // 0x00003278 length: 4 dword currentSoundIDVolumeUnk_0x327c; // 0x0000327C length: 4 dword mbr_0x3280; // 0x00003280 length: 4 diff --git a/src/OpenSHC/Audio/mss/SoundSystem/setSomeSoundTime.cpp b/src/OpenSHC/Audio/mss/SoundSystem/setSomeSoundTime.cpp new file mode 100644 index 0000000..94935b5 --- /dev/null +++ b/src/OpenSHC/Audio/mss/SoundSystem/setSomeSoundTime.cpp @@ -0,0 +1,30 @@ +#include "../SoundSystem.func.hpp" + +namespace OpenSHC { +namespace Audio { + namespace MSS { + + // FUNCTION: STRONGHOLDCRUSADER 0x0047A2A0 + void SoundSystem::setSomeSoundTime() + { + if (!(0 < this->sec_Section1055_0x3274 && this->mbr_0x154 != 2)) { + return; + } + + if (this->mbr_0x154 == 1) { + DWORD _currentTime = timeGetTime(); + // This logic seems to smooth out a time difference by not having the timestamp jump directly on + // bigger delays. Instead, it settles slightly behind the real time, basically pushing the current + // timestamp back a small bit, but in such a way that is gets closer and closer to the real time. + this->someSoundTime_0x158 + = (_currentTime + ((_currentTime - this->someSoundTime_0x158) / 200) * -10) - 1; + this->mbr_0x154 = 2; + } else { + this->mbr_0x154 = 2; + this->someSoundTime_0x158 = timeGetTime(); + } + } + } + +} +} diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 00e10f4..e12a5cf 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -10898,7 +10898,7 @@ SHC_3BB0A8C1_0x0047A130 | 0.0% | Pending SHC_3BB0A8C1_0x0047A1B0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047A220 | 0.0% | Pending SHC_3BB0A8C1_0x0047A290 | 0.0% | Pending -SHC_3BB0A8C1_0x0047A2A0 | 0.0% | Pending +SHC_3BB0A8C1_0x0047A2A0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0047A310 | 0.0% | Pending SHC_3BB0A8C1_0x0047A340 | 0.0% | Pending SHC_3BB0A8C1_0x0047A554 | 0.0% | Pending