From f7bf341d78364ba1975447963c7042e5fe3e2887 Mon Sep 17 00:00:00 2001 From: phobos2077 Date: Sat, 1 Jun 2024 22:14:11 +0200 Subject: [PATCH] Add PAUSEWIN (Ctrl+P) to LoadGameHook game modes --- artifacts/scripting/headers/sfall.h | 1 + sfall/Modules/LoadGameHook.cpp | 11 +++++++++++ sfall/Modules/LoadGameHook.h | 1 + 3 files changed, 13 insertions(+) diff --git a/artifacts/scripting/headers/sfall.h b/artifacts/scripting/headers/sfall.h index 3094cef3..42076785 100644 --- a/artifacts/scripting/headers/sfall.h +++ b/artifacts/scripting/headers/sfall.h @@ -23,6 +23,7 @@ #define HEROWIN (0x40000) #define DIALOGVIEW (0x80000) #define COUNTERWIN (0x100000) // counter window for moving multiple items or setting a timer +#define PAUSEWIN (0x200000) // Ctrl+P pause window #define SPECIAL (0x80000000) // Valid arguments to register_hook_proc diff --git a/sfall/Modules/LoadGameHook.cpp b/sfall/Modules/LoadGameHook.cpp index 15edc8ab..33410d93 100644 --- a/sfall/Modules/LoadGameHook.cpp +++ b/sfall/Modules/LoadGameHook.cpp @@ -569,6 +569,15 @@ static void __declspec(naked) HelpMenuHook() { } } +static void __declspec(naked) PauseWindowHook() { + __asm { + _InLoop(1, PAUSEWIN); + call fo::funcoffs::PauseWindow_; + _InLoop(0, PAUSEWIN); + retn; + } +} + static void __declspec(naked) CharacterHook() { __asm { push edx; @@ -865,6 +874,8 @@ void LoadGameHook::init() { HookCall(0x447A7E, gdialog_bk_hook); // set when switching from dialog mode to barter mode (unset when entering barter) HookCall(0x4457B1, gdialogUpdatePartyStatus_hook1); // set when a party member joins/leaves HookCall(0x4457BC, gdialogUpdatePartyStatus_hook0); // unset + + HookCall(0x443482, PauseWindowHook); } Delegate<>& LoadGameHook::OnBeforeGameInit() { diff --git a/sfall/Modules/LoadGameHook.h b/sfall/Modules/LoadGameHook.h index 054d1bac..ea97a088 100644 --- a/sfall/Modules/LoadGameHook.h +++ b/sfall/Modules/LoadGameHook.h @@ -101,6 +101,7 @@ enum LoopFlag : unsigned long { HEROWIN = 1 << 18, // 0x40000 Hero Appearance mod DIALOGVIEW = 1 << 19, // 0x80000 COUNTERWIN = 1 << 20, // 0x100000 Counter window for moving multiple items or setting a timer + PAUSEWIN = 1 << 21, // 0x200000 Ctrl+P pause window SPECIAL = 1UL << 31 // 0x80000000 Additional special flag for all modes };