diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index eb91199d..fb8ec539 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -85,7 +85,7 @@ GraphicsHeight=0 ;Set to 0 to reset if the window position is incorrect WindowData=0 -;Uncomment the option to use a hardware shader (requires DX9 graphics mode 4 or 5) +;Uncomment the option to use a hardware shader (requires DX9 graphics mode) ;The shader file .fx must be placed in \\shaders\ and must contain one technique with one or more passes ;GlobalShaderFile=global.fx @@ -103,7 +103,7 @@ GPUBlt=0 Use32BitHeadGraphics=0 ;Set to 1 to automatically search for alternative avi video files when Fallout tries to play the game movies -;Requires DX9 graphics mode 4 or 5 +;Requires DX9 graphics mode AllowDShowMovies=0 ;Fade effect time percentage modifier @@ -188,7 +188,7 @@ SpeedKey7=0x00 SpeedKey8=0x00 SpeedKey9=0x00 -;A key to hold down to move the window around when using graphics mode 5 +;A key to hold down to move the window around when using DX9 graphics mode 5 ;Set to 0 if you don't want to use a modifier key, or a DX scancode otherwise ;Set to -1 for either ctrl key, -2 for either alt key or -3 for either shift key WindowScrollKey=0 diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index 8d3d30ae..811565a5 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -3265,9 +3265,6 @@ void BugFixes::init() // Place the player on a nearby empty tile if the entrance tile is blocked by another object when entering a map HookCall(0x4836F8, map_check_state_hook); - // Remove duplicate code from intface_redraw_ engine function - BlockCall(0x45EBBF); - // Fix for critter_add/rm_trait functions ignoring the value of the "amount" argument // Note: pass negative amount values to critter_rm_trait to remove all ranks of the perk (vanilla behavior) HookCall(0x458CDB, op_critter_rm_trait_hook); diff --git a/sfall/Modules/DebugEditor.cpp b/sfall/Modules/DebugEditor.cpp index 026dde7f..affd8133 100644 --- a/sfall/Modules/DebugEditor.cpp +++ b/sfall/Modules/DebugEditor.cpp @@ -352,16 +352,6 @@ static void __declspec(naked) debug_log_hack() { } } -static void __declspec(naked) op_display_msg_hook() { - __asm { - cmp dword ptr ds:FO_VAR_debug_func, 0; - jne debug; - retn; -debug: - jmp fo::funcoffs::config_get_value_; - } -} - static void DebugModePatch() { int dbgMode = iniGetInt("Debugging", "DebugMode", 0, ::sfall::ddrawIni); if (dbgMode > 0) { @@ -402,8 +392,6 @@ static void DebugModePatch() { dlogr(" Done", DL_INIT); } - // Just for speeding up display_msg function (optional) - HookCall(0x455404, op_display_msg_hook); } static void DontDeleteProtosPatch() { diff --git a/sfall/Modules/MiscPatches.cpp b/sfall/Modules/MiscPatches.cpp index 9bb8136a..027f0047 100644 --- a/sfall/Modules/MiscPatches.cpp +++ b/sfall/Modules/MiscPatches.cpp @@ -596,7 +596,38 @@ void F1EngineBehaviorPatch() { } } +static void __declspec(naked) op_display_msg_hook() { + __asm { + cmp dword ptr ds:FO_VAR_debug_func, 0; + jne debug; + retn; +debug: + jmp fo::funcoffs::config_get_value_; + } +} + +void EngineOptimizationPatches() { + // Speed up display_msg script function + HookCall(0x455404, op_display_msg_hook); + + // Remove duplicate code from intface_redraw_ engine function + BlockCall(0x45EBBF); + + // Improve performance of the data conversion of script interpreter + // mov eax, [edx+eax]; bswap eax; ret; + SafeWrite32(0x4672A4, 0x0F02048B); + SafeWrite16(0x4672A8, 0xC3C8); + // mov eax, [edx+eax]; bswap eax; + SafeWrite32(0x4673E5, 0x0F02048B); + SafeWrite8(0x4673E9, 0xC8); + // mov ax, [eax]; rol ax, 8; ret; + SafeWrite32(0x467292, 0x66008B66); + SafeWrite32(0x467296, 0xC308C0C1); +} + void MiscPatches::init() { + EngineOptimizationPatches(); + if (GetConfigString("Misc", "StartingMap", "", mapName, 64)) { dlog("Applying starting map patch.", DL_INIT); SafeWrite32(0x480AAA, (DWORD)&mapName); diff --git a/sfall/Modules/Scripting/Handlers/Memory.cpp b/sfall/Modules/Scripting/Handlers/Memory.cpp index 286a704b..67084511 100644 --- a/sfall/Modules/Scripting/Handlers/Memory.cpp +++ b/sfall/Modules/Scripting/Handlers/Memory.cpp @@ -44,7 +44,7 @@ result: // retn; error: xor edx, edx; - jmp result; + jmp result; } } @@ -60,7 +60,7 @@ result: // retn; error: xor edx, edx; - jmp result; + jmp result; } } @@ -76,7 +76,7 @@ result: // retn; error: xor edx, edx; - jmp result; + jmp result; } }