From 94fdfb49efb61c71ac42197e50d72e58c4c18c5f Mon Sep 17 00:00:00 2001 From: NovaRain Date: Wed, 18 Oct 2017 14:54:53 +0800 Subject: [PATCH] Fix crash when calling partyMemberGetCurLevel_ on a critter that has no data in party.txt. Updated version number. --- artifacts/ddraw.ini | 2 +- sfall/Modules/BugFixes.cpp | 12 ++++++++++++ sfall/version.h | 6 +++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 65e9bfe4..dc98c23a 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -1,5 +1,5 @@ ;sfall configuration settings -;v4.0 +;v4.0.1 [Main] ;Change to 1 if you want to use command line args to tell sfall to use another ini file. diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index 71e359f3..baaee1dc 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -1079,6 +1079,15 @@ end: } } +static void __declspec(naked) partyMemberGetCurLevel_hack() { + __asm { + mov esi, 0xFFFFFFFF; // initialize party member index + mov edi, dword ptr ds:[FO_VAR_partyMemberMaxCount]; + push 0x495FFC; + retn; + } +} + void BugFixes::init() { @@ -1377,6 +1386,9 @@ void BugFixes::init() HookCall(0x423A99, &compute_attack_hook); dlogr(" Done", DL_INIT); //} + + // Fix crash when calling partyMemberGetCurLevel_ on a critter that has no data in party.txt + MakeJump(0x495FF6, partyMemberGetCurLevel_hack); } } diff --git a/sfall/version.h b/sfall/version.h index 1c81d685..172f55d6 100644 --- a/sfall/version.h +++ b/sfall/version.h @@ -24,13 +24,13 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_BUILD 0 +#define VERSION_BUILD 1 #define VERSION_REV 0 #ifdef WIN2K -#define VERSION_STRING "4.0 win2k" +#define VERSION_STRING "4.0.1 win2k" #else -#define VERSION_STRING "4.0" +#define VERSION_STRING "4.0.1" #endif #define CHECK_VAL (4)