From 134dc03dc9950d7cf3ed435eeac96357ca02e144 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Sat, 20 Oct 2018 09:53:16 +0800 Subject: [PATCH] Added an option to skip loading game settings from a saved game (from Mr.Stalin) Minor edits to ddraw.ini. --- artifacts/ddraw.ini | 7 +++++-- sfall/Modules/Graphics.cpp | 2 +- sfall/Modules/MiscPatches.cpp | 17 +++++++++++++++++ sfall/Modules/MiscPatches.h | 6 ++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 7e84c275..570e81c7 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -76,7 +76,6 @@ Use32BitHeadGraphics=0 AllowDShowMovies=0 ;Fade effect time length percentage modifier -;Default is 100. Larger values make it slower, smaller values make it faster FadeMultiplier=100 ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @@ -142,7 +141,7 @@ ReloadWeaponKey=0 ;A key to hold down to let you move/drop a whole stack of items at once without the 'Move Items' window ;Set to 0 if you don't want to use a modifier key, or a DX scancode otherwise -ItemFastMoveKey=0x1d +ItemFastMoveKey=29 ;Set to 1 to skip the 'Move Items' window when taking items from containers or corpses and not holding down ItemFastMoveKey ;Requires ItemFastMoveKey to be enabled @@ -632,6 +631,10 @@ DisplaySwiftLearnerExp=1 ;Set to 1 to display party member's current level/AC/addict flag on the combat control panel PartyMemberExtraInfo=0 +;Set to 1 to skip loading game settings from a saved game, except for the game/combat difficulty settings +;Set to 2 to also skip loading the game/combat difficulty settings +SkipLoadingGameSettings=0 + ;Set to 1 to prevent the inventory/loot/automap interfaces from being placed on top of other script-created windows InterfaceDontMoveOnTop=0 diff --git a/sfall/Modules/Graphics.cpp b/sfall/Modules/Graphics.cpp index df2c32cf..60849553 100644 --- a/sfall/Modules/Graphics.cpp +++ b/sfall/Modules/Graphics.cpp @@ -1059,7 +1059,7 @@ void Graphics::init() { Graphics::mode = 0; } if (Graphics::mode == 4 || Graphics::mode == 5) { - dlog("Applying dx9 graphics patch.", DL_INIT); + dlog("Applying DX9 graphics patch.", DL_INIT); #define _DLL_NAME "d3dx9_43.dll" HMODULE h = LoadLibraryEx(_DLL_NAME, 0, LOAD_LIBRARY_AS_DATAFILE); if (!h) { diff --git a/sfall/Modules/MiscPatches.cpp b/sfall/Modules/MiscPatches.cpp index 70e9e935..971cfa9e 100644 --- a/sfall/Modules/MiscPatches.cpp +++ b/sfall/Modules/MiscPatches.cpp @@ -855,6 +855,21 @@ void KeepWeaponSelectModePatch() { } } +void SkipLoadingGameSettingsPatch() { + int skipLoading = GetConfigInt("Misc", "SkipLoadingGameSettings", 0); + if (skipLoading) { + dlog("Applying skip loading game settings from a saved game patch.", DL_INIT); + BlockCall(0x493421); + SafeWrite8(0x4935A8, 0x1F); + SafeWrite32(0x4935AB, 0x90901B75); + CodeData PatchData; + if (skipLoading == 2) SafeWriteBatch(PatchData, {0x49341C, 0x49343B}); + SafeWriteBatch(PatchData, {0x493450, 0x493465, 0x49347A, 0x49348F, 0x4934A4, 0x4934B9, 0x4934CE, 0x4934E3, + 0x4934F8, 0x49350D, 0x493522, 0x493547, 0x493558, 0x493569, 0x49357A}); + dlogr(" Done", DL_INIT); + } +} + void InterfaceDontMoveOnTopPatch() { if (GetConfigInt("Misc", "InterfaceDontMoveOnTop", 0)) { dlog("Applying InterfaceDontMoveOnTop patch.", DL_INIT); @@ -953,6 +968,8 @@ void MiscPatches::init() { DisplaySecondWeaponRangePatch(); KeepWeaponSelectModePatch(); + + SkipLoadingGameSettingsPatch(); InterfaceDontMoveOnTopPatch(); } diff --git a/sfall/Modules/MiscPatches.h b/sfall/Modules/MiscPatches.h index df252bf8..274844e0 100644 --- a/sfall/Modules/MiscPatches.h +++ b/sfall/Modules/MiscPatches.h @@ -29,6 +29,12 @@ public: void exit() override; }; +#pragma pack(1) +struct CodeData { + DWORD dd = 0x0024548D; + BYTE db = 0x90; +}; + extern bool npcAutoLevelEnabled; void _stdcall SetMapMulti(float d);