diff --git a/CREDITS.md b/CREDITS.md index 9070250701..04829a13b8 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -538,6 +538,7 @@ This page lists all the individual contributions to the project by their author. - Fix an issue that `FireAngle` was not taken into account when drawing barrel in `TurretShadow` - Fix an issue that barrel anim data will be incorrectly overwritten by turret anim data if the techno's section exists in the map file - Jumpjet Climbing Logic Enhancement + - Fix for pathfinding crashes on big maps due to too small pathfinding node buffer - **Ollerus**: - Build limit group enhancement - Customizable rocker amplitude diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 12c758c278..92859daaf8 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -255,6 +255,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Fixed the fact that when the selected unit is in a rearmed state, it can unconditionally use attack mouse on the target. - When `Speed=0` or the TechnoTypes cell cannot move due to `MovementRestrictedTo`, vehicles cannot attack targets beyond the weapon's range. `Area Guard` and `Hunt` missions will also become ineffective. - Fixed an issue that barrel anim data will be incorrectly overwritten by turret anim data if the techno's section exists in the map file. +- Fixed pathfinding crashes (EIP 0x42A525, 0x42C507, 0x42C554) that happened on bigger maps due to too small pathfinding node buffer. ## Fixes / interactions with other extensions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 102b3efae7..d3028fb8a6 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -772,6 +772,7 @@ Vanilla fixes: - Fixed the bug that Locomotor warhead won't stop working when firer (except for vehicle) stop firing (by NetsuNegi) - Fixed the bug that hover vehicle will sink if destroyed on bridge (by NetsuNegi) - Fixed the fact that when the selected unit is in a rearmed state, it can unconditionally use attack mouse on the target (by FlyStar) +- Fixed pathfinding crashes (EIP 0x42A525, 0x42C507, 0x42C554) that happened on bigger maps due to too small pathfinding node buffer (by CrimRecya) Phobos fixes: - Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy) diff --git a/src/Misc/Hooks.BugFixes.cpp b/src/Misc/Hooks.BugFixes.cpp index d7573a09d0..b6632a2571 100644 --- a/src/Misc/Hooks.BugFixes.cpp +++ b/src/Misc/Hooks.BugFixes.cpp @@ -2493,3 +2493,30 @@ DEFINE_HOOK(0x6FC8F5, TechnoClass_CanFire_SkipROF, 0x6) } #pragma endregion + +#pragma region AStarBuffer + +// AStarClass_CTOR +// Path queue nodes buffer doubled + +// 42A74F: 68 04 00 04 00 +// For `new` to use (sizeof(Node*) == 4) +DEFINE_PATCH(0x42A752, 0x08); +// push 40004h ((65536 + 1) * 4) -> push 80004h ((131072 + 1) * 4) + +// 42A760: C7 47 04 00 00 01 00 +// Set the total amount of valid nodes +DEFINE_PATCH(0x42A765, 0x02); +// mov dword ptr [edi+4], 10000h (65536) -> mov dword ptr [edi+4], 20000h (131072) + +// 42A7E0: 68 04 00 10 00 +// For `new` to use (sizeof(Node) == 16) +DEFINE_PATCH(0x42A7E3, 0x20); +// push 100004h ((65536 + 1) * 16) -> push 200004h ((131072 + 1) * 16) + +// 42A7F7: BA 00 00 01 00 +// Set the loops count of initialization +DEFINE_PATCH(0x42A7FA, 0x02); +// mov edx, 10000h (65536) -> mov edx, 20000h (131072) + +#pragma endregion