Fixed possible crash in BoxBarCount

Edits to ddraw.ini and comments in Message.cpp.
This commit is contained in:
NovaRain
2024-06-03 09:28:36 +08:00
parent 657ae595b1
commit 1a844e4e7d
3 changed files with 7 additions and 10 deletions
+1 -1
View File
@@ -384,7 +384,7 @@ TownMapHotkeysFix=1
DisableHorrigan=0
;Set to 1 to disable the random element in party member leveling
;This will prevent party members from randomly leveling up 'earlier' and instead level them up at defined regular intervals
;This will prevent party members from randomly leveling up early and instead level them up at defined intervals
PartyMemberNonRandomLevelUp=0
;Change the initial starting location and world map viewport
+1 -1
View File
@@ -263,7 +263,7 @@ static void __declspec(naked) refresh_box_bar_win_hack() {
void BarBoxes::init() {
initCount += IniReader::GetConfigInt("Misc", "BoxBarCount", 5);
if (initCount < 5) initCount = 5; // exclude the influence of negative values from the config
if (initCount < 6) initCount = 6; // minimum of one extra box
if (initCount > 100) initCount = 100;
actualBoxCount = initCount - 5;
+5 -8
View File
@@ -183,7 +183,6 @@ static long __fastcall MessageFindHook(fo::MessageList** list, long num, DWORD*
return fo::func::message_find(*list, num, outIndex);
}
static void __fastcall MessageExitHook(fo::MessageList* list) {
// Delete fallback message file.
auto& listIt = messageListMap.find(list);
@@ -203,9 +202,8 @@ static void __declspec(naked) message_load__db_fopen_hook() {
__asm {
push esi; // message list
push ebp; // relative path
// edx - mode
mov ecx, eax; // full path
call MessageLoadHook;
call MessageLoadHook; // edx - mode
retn;
}
}
@@ -213,10 +211,9 @@ static void __declspec(naked) message_load__db_fopen_hook() {
static void __declspec(naked) message_search__message_find_hook() {
__asm {
push ecx; // save msg list
push ebx; // out index
// edx - msg num
push ebx; // out index
lea ecx, [esp + 4]; // msg list **
call MessageFindHook;
call MessageFindHook; // edx - msg num
pop ecx; // restore, possibly modified list ptr
retn;
}
@@ -224,10 +221,10 @@ static void __declspec(naked) message_search__message_find_hook() {
static void __declspec(naked) message_exit__mem_free_hook() {
__asm {
push eax;
push eax; // save msgList->nodes
mov ecx, ebx; // message list
call MessageExitHook;
pop eax;
pop eax; // restore
jmp fo::funcoffs::mem_free_;
}
}