diff --git a/src/OpenSHC/Audio/SFX/SFXState/loadWavSounds.cpp b/src/OpenSHC/Audio/SFX/SFXState/loadWavSounds.cpp new file mode 100644 index 00000000..735c4fb9 --- /dev/null +++ b/src/OpenSHC/Audio/SFX/SFXState/loadWavSounds.cpp @@ -0,0 +1,72 @@ +#include "../SFXState.func.hpp" + +#include "OpenSHC/Audio/mss/SoundSystem.func.hpp" +#include "OpenSHC/UI/Rendering/TextureRenderCore.func.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_LoadingBarProgress.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" +#include "OpenSHC/Globals/DAT_TextureRenderCoreObject.hpp" + +namespace OpenSHC { +namespace Audio { + namespace SFX { + + // FUNCTION: STRONGHOLDCRUSADER 0x00449B30 + void SFXState::loadWavSounds(char* param_1) + { + // Might have arrived in a different format, maybe it was void, or an char(param_1)[270][8][1000] and they + // casted it to perform arithmetic? + char* soundNames = param_1; + int soundStructure2Index = 0; + while (soundStructure2Index < 270) { + this->DAT_SoundStructures2[soundStructure2Index].soundID = 0; + this->DAT_SoundStructures2[soundStructure2Index].field1_0x4 = 0; + this->DAT_SoundStructures2[soundStructure2Index].variationCount = 0; + this->DAT_SoundStructures2[soundStructure2Index].variationCounter = 0; + + char* variation = soundNames; + for (int i = 0; i < 8; ++i) { + if (!strcmp(variation, s_Null_wav_005a4cf8)) + break; + + ++this->DAT_SoundStructures2[soundStructure2Index].field1_0x4; + variation += sizeof(char[1000]); + } + + variation = soundNames; + for (int i = 0; i < 8; ++i) { + if (!strcmp(variation, s_Null_wav_005a4cf8)) + break; + + int soundID + = MACRO_CALL_MEMBER(MSS::SoundSystem_Func::meth_0x479c20, DAT_SoundSystemState::ptr)(variation); + + if (soundID < 0) + break; + + ++this->DAT_SoundStructures2[soundStructure2Index].variationCount; + + if (this->DAT_SoundStructures2[soundStructure2Index].soundID == 0) + this->DAT_SoundStructures2[soundStructure2Index].soundID = soundID; + + this->DAT_SoundStructures[soundID].pointerToFilename = variation; + + variation += sizeof(char[1000]); + } + soundNames += sizeof(char[8][1000]); + + ++soundStructure2Index; + int loadingBar = soundStructure2Index * 80; + + IO::Graphics::GmID currentGmId + = (IO::Graphics::GmID)(loadingBar / 270 + DAT_LoadingBarProgress::instance); + + MACRO_CALL_MEMBER(UI::Rendering::TextureRenderCore_Func::drawLoadingBarUnk, + DAT_TextureRenderCoreObject::ptr)(currentGmId, DAT_LoadingBarProgress::instance + 180); + } + } + + } +} +} diff --git a/src/OpenSHC/Audio/SFX/SoundStructure1.hpp b/src/OpenSHC/Audio/SFX/SoundStructure1.hpp index a962d45f..e57af9dc 100644 --- a/src/OpenSHC/Audio/SFX/SoundStructure1.hpp +++ b/src/OpenSHC/Audio/SFX/SoundStructure1.hpp @@ -21,7 +21,7 @@ namespace Audio { int scheduledPlayCounter; // 0x00000008 length: 4 int field3_0xc; // 0x0000000C length: 4 int baseVolumePercentageUnk; // 0x00000010 length: 4 - pointer* pointerToFilename; // 0x00000014 length: 4 + char* pointerToFilename; // 0x00000014 length: 4 } SoundStructure1; #pragma pack(pop) diff --git a/src/OpenSHC/Globals/DAT_LoadingBarProgress.hpp b/src/OpenSHC/Globals/DAT_LoadingBarProgress.hpp index 4eb86fec..e708495b 100644 --- a/src/OpenSHC/Globals/DAT_LoadingBarProgress.hpp +++ b/src/OpenSHC/Globals/DAT_LoadingBarProgress.hpp @@ -9,7 +9,7 @@ #pragma once // GLOBAL: STRONGHOLDCRUSADER 0x00D7D2D0 -// StructResolver::Instance::instance +// StructResolver::Instance::instance namespace OpenSHC { diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 9896e695..27b78c50 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -8123,7 +8123,7 @@ SHC_3BB0A8C1_0x00449B08 | 0.0% | Pending SHC_3BB0A8C1_0x00449B0C | 0.0% | Pending SHC_3BB0A8C1_0x00449B10 | 0.0% | Pending SHC_3BB0A8C1_0x00449B20 | 0.0% | Pending -SHC_3BB0A8C1_0x00449B30 | 0.0% | Pending +SHC_3BB0A8C1_0x00449B30 | 100.0% | Pending SHC_3BB0A8C1_0x00449C40 | 0.0% | Pending SHC_3BB0A8C1_0x00449CC0 | 0.0% | Pending SHC_3BB0A8C1_0x00449D50 | 0.0% | Pending