diff --git a/src/OpenSHC/Audio/SFX/SFXState/playOnSpeechSfxStream.cpp b/src/OpenSHC/Audio/SFX/SFXState/playOnSpeechSfxStream.cpp new file mode 100644 index 00000000..3183115f --- /dev/null +++ b/src/OpenSHC/Audio/SFX/SFXState/playOnSpeechSfxStream.cpp @@ -0,0 +1,39 @@ +// disable deprecation warnings for strcpy +#pragma warning(disable : 4996) + +#include "../SFXState.func.hpp" + +#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_LastSpeechSFXFilename.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" + +namespace OpenSHC { +namespace Audio { + namespace SFX { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044A500 + void SFXState::playOnSpeechSfxStream(char* filename) + { + if (!MACRO_CALL(OS_Func::__stricmp)(filename, DAT_LastSpeechSFXFilename::instance)) { + if (MACRO_CALL_MEMBER(MSS::SoundSystem_Func::isSampleOrStreamPlaying, DAT_SoundSystemState::ptr)( + MSS::enums::SND_STR_SPEECH_1) + || MACRO_CALL_MEMBER(MSS::SoundSystem_Func::isSampleOrStreamPlaying, DAT_SoundSystemState::ptr)( + MSS::enums::SND_STR_SPEECH_2)) { + if (MACRO_CALL(OS_Func::__stricmp)(filename, s_buildingwreck_01_wav_005a4d78)) { + return; + } + } + } + strcpy(DAT_LastSpeechSFXFilename::instance, filename); + + char fullSoundPath[64]; + MACRO_CALL(OS_Func::_sprintf)(fullSoundPath, s_fx_speech_s_005a4d68, filename); + MACRO_CALL_MEMBER(MSS::SoundSystem_Func::playSpeechSfx, DAT_SoundSystemState::ptr)(fullSoundPath); + } + + } +} +} diff --git a/src/OpenSHC/Audio/SFX/SFXState/playWAVSFX.cpp b/src/OpenSHC/Audio/SFX/SFXState/playWAVSFX.cpp new file mode 100644 index 00000000..616a4fab --- /dev/null +++ b/src/OpenSHC/Audio/SFX/SFXState/playWAVSFX.cpp @@ -0,0 +1,39 @@ +// disable deprecation warnings for strcpy +#pragma warning(disable : 4996) + +#include "../SFXState.func.hpp" + +#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" +#include "OpenSHC/OS.func.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_LastSpeechSFXFilename.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" + +namespace OpenSHC { +namespace Audio { + namespace SFX { + + // FUNCTION: STRONGHOLDCRUSADER 0x0044A460 + void SFXState::playWAVSFX(char const* wav_filename) + { + if (!MACRO_CALL(OS_Func::__stricmp)(wav_filename, DAT_LastSpeechSFXFilename::instance)) { + if (MACRO_CALL_MEMBER(MSS::SoundSystem_Func::isSampleOrStreamPlaying, DAT_SoundSystemState::ptr)( + MSS::enums::SND_STR_SPEECH_1) + || MACRO_CALL_MEMBER(MSS::SoundSystem_Func::isSampleOrStreamPlaying, DAT_SoundSystemState::ptr)( + MSS::enums::SND_STR_SPEECH_2)) { + if (MACRO_CALL(OS_Func::__stricmp)(wav_filename, s_buildingwreck_01_wav_005a4d78)) { + return; + } + } + } + strcpy(DAT_LastSpeechSFXFilename::instance, wav_filename); + + char fullSoundPath[64]; + MACRO_CALL(OS_Func::_sprintf)(fullSoundPath, s_fx_speech_s_005a4d68, wav_filename); + MACRO_CALL_MEMBER(MSS::SoundSystem_Func::playSoundOnSpeechStream, DAT_SoundSystemState::ptr)(fullSoundPath); + } + + } +} +} diff --git a/src/OpenSHC/OS/OS.cpp b/src/OpenSHC/OS/OS.cpp index 5f8c7a59..a65d5c41 100644 --- a/src/OpenSHC/OS/OS.cpp +++ b/src/OpenSHC/OS/OS.cpp @@ -28,7 +28,7 @@ namespace OS { void* _memset(void* _Dst, int _Val, size_t _Size) { return memset(_Dst, _Val, _Size); } // STUB: STRONGHOLDCRUSADER 0x0057F6DA - int _sprintf(char* _Dest, char* _Format, ...) + int _sprintf(char* _Dest, char const* _Format, ...) { // needed for proxy va_list args; @@ -39,7 +39,7 @@ namespace OS { } // STUB: STRONGHOLDCRUSADER 0x0057F8EE - int __stricmp(char* _Str1, char* _Str2) { return _stricmp(_Str1, _Str2); } + int __stricmp(char const* _Str1, char const* _Str2) { return _stricmp(_Str1, _Str2); } // STUB: STRONGHOLDCRUSADER 0x0057FA62 int _atexit(_atexit_t* param_1) { return atexit(param_1); } diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 28755a8b..9f6fdc65 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -16281,9 +16281,9 @@ SHC_3BB0A8C1_0x0044A360 | 0.0% | Pending SHC_3BB0A8C1_0x0044A3A0 | 0.0% | Pending -SHC_3BB0A8C1_0x0044A460 | 0.0% | Pending +SHC_3BB0A8C1_0x0044A460 | 100.0% | Reimplemented, Security Cookie of DLL -SHC_3BB0A8C1_0x0044A500 | 0.0% | Pending +SHC_3BB0A8C1_0x0044A500 | 100.0% | Reimplemented, Security Cookie of DLL SHC_3BB0A8C1_0x0044A5A0 | 0.0% | Pending