diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index e0bee64f..a58791df 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -1,5 +1,5 @@ ;sfall configuration settings -;v4.3 +;v4.3.1 [Main] ;Change to 1 if you want to use command line args to tell sfall to use another ini file. @@ -143,6 +143,11 @@ AllowDShowSound=0 ;Set to 2 to overwrite all occurrences of the music path OverrideMusicDir=1 +;Set to 1 to automatically search for new SFX sound files at game startup +;Note: With this option enabled, you will no longer need to use the utility regsnd.exe to register new SFX sounds +;This will also increase the loading time of the game +AutoSearchSFX=1 + ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX [Input] ;Set to 1 to enable the mouse scroll wheel to scroll through the inventory, barter, and loot screens diff --git a/sfall/Modules/DebugEditor.cpp b/sfall/Modules/DebugEditor.cpp index 8b33af3d..fdd7c36e 100644 --- a/sfall/Modules/DebugEditor.cpp +++ b/sfall/Modules/DebugEditor.cpp @@ -313,9 +313,9 @@ hide: } static void __declspec(naked) art_data_size_hook() { - static const char* artDbgMsg = "\nERROR: File not found: %s\n"; + static const char* artDbgMsg = "\nERROR: Art file not found: %s\n"; __asm { - test edi, edi; + test edi, edi; // 1 - isExistsArt jz artNotExist; retn; artNotExist: @@ -339,6 +339,18 @@ display: } } +static void __declspec(naked) art_data_size_hook_check() { + using namespace fo; + __asm { + xor esi, esi; + mov eax, ebx; // ebx - FID + shr eax, 16; // al - animation code (ID2) + cmp al, ANIM_walk; + cmove ecx, esi; + retn; + } +} + static void __declspec(naked) proto_load_pid_hack() { static const char* proDbgMsg = "\nERROR: Reading prototype file: %s\n"; __asm { @@ -437,11 +449,16 @@ static void DebugModePatch() { } else { SafeWrite32(0x4C6D9C, (DWORD)debugGnw); } + if (IniReader::GetIntDefaultConfig("Debugging", "HideObjIsNullMsg", 0)) { MakeJump(0x453FD2, dbg_error_hack); } + // prints a debug message about a missing critter art file to both debug.log and the message window in sfall debugging mode HookCall(0x419B65, art_data_size_hook); + // checks the animation code, if ANIM_walk then skip printing the debug message + HookCall(0x419AA0, art_data_size_hook_check); + SafeWrite8(0x419B61, CodeType::JumpNZ); // jz > jnz // Fix to prevent crashes when there is a '%' character in the printed message if (dbgMode > 1) { diff --git a/sfall/Modules/Sound.cpp b/sfall/Modules/Sound.cpp index 786c9418..33500d44 100644 --- a/sfall/Modules/Sound.cpp +++ b/sfall/Modules/Sound.cpp @@ -938,6 +938,13 @@ skip: } } +static void __declspec(naked) sfxl_init_hook() { + __asm { + xor eax, eax; + retn; + } +} + constexpr int SampleRate = 44100; // 44.1kHz void Sound::init() { @@ -1013,6 +1020,10 @@ void Sound::init() { // Support for ACM audio file playback and volume control for the soundplay script function HookCall(0x4661B3, soundStartInterpret_hook); + + if (IniReader::GetConfigInt("Sound", "AutoSearchSFX", 1)) { + HookCalls(sfxl_init_hook, {0x4A9999, 0x4A9B34}); + } } void Sound::exit() {