Added AutoSearchSFX option for automatic search of SFX files

Excluded ANIM_walk from the debug log about missing critter art files.
This commit is contained in:
NovaRain
2021-08-08 22:42:56 +08:00
parent 077774fad0
commit e3b524dd3c
3 changed files with 36 additions and 3 deletions
+6 -1
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v3.8.30
;v3.8.31
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -116,6 +116,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
+18 -2
View File
@@ -310,9 +310,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:
@@ -336,6 +336,17 @@ display:
}
}
static void __declspec(naked) art_data_size_hook_check() {
__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 {
@@ -434,11 +445,16 @@ static void DebugModePatch() {
} else {
SafeWrite32(0x4C6D9C, (DWORD)debugGnw);
}
if (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) {
+12
View File
@@ -950,6 +950,13 @@ skip:
}
}
static void __declspec(naked) sfxl_init_hook() {
__asm {
xor eax, eax;
retn;
}
}
static const int SampleRate = 44100; // 44.1kHz
void Sound_OnAfterGameInit() {
@@ -1028,6 +1035,11 @@ void Sound_Init() {
// Support for ACM audio file playback and volume control for the soundplay script function
HookCall(0x4661B3, soundStartInterpret_hook);
if (GetConfigInt("Sound", "AutoSearchSFX", 1)) {
const DWORD sfxlInitAddr[] = {0x4A9999, 0x4A9B34};
HookCalls(sfxl_init_hook, sfxlInitAddr);
}
}
void Sound_Exit() {