Skip to content

Commit e8e77c9

Browse files
CrimRecyaMetadorius
andcommitted
Attempt to fix 0x42A525/0x42C507/0x42C554 pathfinding crashes (Phobos-developers#1811)
Need testing. --------- Co-authored-by: Kerbiter <[email protected]>
1 parent 2f1fc0e commit e8e77c9

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ This page lists all the individual contributions to the project by their author.
538538
- Fix an issue that `FireAngle` was not taken into account when drawing barrel in `TurretShadow`
539539
- 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
540540
- Jumpjet Climbing Logic Enhancement
541+
- Fix for pathfinding crashes on big maps due to too small pathfinding node buffer
541542
- **Ollerus**:
542543
- Build limit group enhancement
543544
- Customizable rocker amplitude

docs/Fixed-or-Improved-Logics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
255255
- Fixed the fact that when the selected unit is in a rearmed state, it can unconditionally use attack mouse on the target.
256256
- 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.
257257
- 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.
258+
- Fixed pathfinding crashes (EIP 0x42A525, 0x42C507, 0x42C554) that happened on bigger maps due to too small pathfinding node buffer.
258259

259260
## Fixes / interactions with other extensions
260261

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,7 @@ Vanilla fixes:
772772
- Fixed the bug that Locomotor warhead won't stop working when firer (except for vehicle) stop firing (by NetsuNegi)
773773
- Fixed the bug that hover vehicle will sink if destroyed on bridge (by NetsuNegi)
774774
- Fixed the fact that when the selected unit is in a rearmed state, it can unconditionally use attack mouse on the target (by FlyStar)
775+
- Fixed pathfinding crashes (EIP 0x42A525, 0x42C507, 0x42C554) that happened on bigger maps due to too small pathfinding node buffer (by CrimRecya)
775776
776777
Phobos fixes:
777778
- Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy)

src/Misc/Hooks.BugFixes.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,3 +2493,30 @@ DEFINE_HOOK(0x6FC8F5, TechnoClass_CanFire_SkipROF, 0x6)
24932493
}
24942494

24952495
#pragma endregion
2496+
2497+
#pragma region AStarBuffer
2498+
2499+
// AStarClass_CTOR
2500+
// Path queue nodes buffer doubled
2501+
2502+
// 42A74F: 68 04 00 04 00
2503+
// For `new` to use (sizeof(Node*) == 4)
2504+
DEFINE_PATCH(0x42A752, 0x08);
2505+
// push 40004h ((65536 + 1) * 4) -> push 80004h ((131072 + 1) * 4)
2506+
2507+
// 42A760: C7 47 04 00 00 01 00
2508+
// Set the total amount of valid nodes
2509+
DEFINE_PATCH(0x42A765, 0x02);
2510+
// mov dword ptr [edi+4], 10000h (65536) -> mov dword ptr [edi+4], 20000h (131072)
2511+
2512+
// 42A7E0: 68 04 00 10 00
2513+
// For `new` to use (sizeof(Node) == 16)
2514+
DEFINE_PATCH(0x42A7E3, 0x20);
2515+
// push 100004h ((65536 + 1) * 16) -> push 200004h ((131072 + 1) * 16)
2516+
2517+
// 42A7F7: BA 00 00 01 00
2518+
// Set the loops count of initialization
2519+
DEFINE_PATCH(0x42A7FA, 0x02);
2520+
// mov edx, 10000h (65536) -> mov edx, 20000h (131072)
2521+
2522+
#pragma endregion

0 commit comments

Comments
 (0)