From 3c47288e702cdfc0d7e4cc6d1ff233c092992ee9 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Mon, 1 Apr 2019 21:22:27 +0800 Subject: [PATCH] Fixed "out of bounds" bug when printing the automap list. --- sfall/Bugs.cpp | 13 +++++++++++++ sfall/QuestList.cpp | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sfall/Bugs.cpp b/sfall/Bugs.cpp index dbc74a71..b9d80156 100644 --- a/sfall/Bugs.cpp +++ b/sfall/Bugs.cpp @@ -2004,6 +2004,16 @@ static void __declspec(naked) obj_load_dude_hook1() { } } +static void __declspec(naked) PrintAMList_hook() { + __asm { + cmp ebp, 20; // max line count + jle skip; + mov ebp, 20; +skip: + jmp qsort_; + } +} + void BugsInit() { // fix vanilla negate operator on float values @@ -2531,4 +2541,7 @@ void BugsInit() HookCall(0x48D666, obj_load_dude_hook1); BlockCall(0x48D675); BlockCall(0x48D69D); + + // Fix "out of bounds" bug when printing the automap list + HookCall(0x499240, PrintAMList_hook); } diff --git a/sfall/QuestList.cpp b/sfall/QuestList.cpp index cf304a50..2eb0a740 100644 --- a/sfall/QuestList.cpp +++ b/sfall/QuestList.cpp @@ -483,6 +483,6 @@ void QuestListInit() { dlogr(" Done", DL_INIT); } else { - HookCall(0x498186, PipStatus_hook_printfix); // fix "out of range" bug when printing a list of quests + HookCall(0x498186, PipStatus_hook_printfix); // fix "out of bounds" bug when printing a list of quests } }