Skip to content

Commit a082bfe

Browse files
committed
Attempt to fix 0x42A525/0x42C507/0x42C554 pathfinding crashes (#1811)
Need testing. --------- Co-authored-by: Kerbiter <[email protected]>
1 parent eb50605 commit a082bfe

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
@@ -446,6 +446,7 @@ This page lists all the individual contributions to the project by their author.
446446
- Fix an issue that `Spawned` aircraft will fly towards the edge of the map when its `Spawner` is under EMP
447447
- Fix an issue that if the garrison unload occupants when there is no open space around it would result in the disappearance of the occupants
448448
- Fix an issue where Ares' `Convert.Deploy` triggers repeatedly when the unit is turning or moving
449+
- Fix for pathfinding crashes on big maps due to too small pathfinding node buffer
449450
- **Ollerus**:
450451
- Build limit group enhancement
451452
- Customizable rocker amplitude

docs/Fixed-or-Improved-Logics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
238238
- Fixed the bug that Locomotor warhead won't stop working when firer (except for vehicle) stop firing.
239239
- Fixed the bug that hover vehicle will sink if destroyed on bridge.
240240
- Fixed the fact that when the selected unit is in a rearmed state, it can unconditionally use attack mouse on the target.
241+
- Fixed pathfinding crashes (EIP 0x42A525, 0x42C507, 0x42C554) that happened on bigger maps due to too small pathfinding node buffer.
241242

242243
## Fixes / interactions with other extensions
243244

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ Vanilla fixes:
619619
- Fixed the bug that Locomotor warhead won't stop working when firer (except for vehicle) stop firing (by NetsuNegi)
620620
- Fixed the bug that hover vehicle will sink if destroyed on bridge (by NetsuNegi)
621621
- Fixed the fact that when the selected unit is in a rearmed state, it can unconditionally use attack mouse on the target (by FlyStar)
622+
- Fixed pathfinding crashes (EIP 0x42A525, 0x42C507, 0x42C554) that happened on bigger maps due to too small pathfinding node buffer (by CrimRecya)
622623
623624
Phobos fixes:
624625
- 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
@@ -2375,3 +2375,30 @@ DEFINE_HOOK(0x6FC8F5, TechnoClass_CanFire_SkipROF, 0x6)
23752375
}
23762376

23772377
#pragma endregion
2378+
2379+
#pragma region AStarBuffer
2380+
2381+
// AStarClass_CTOR
2382+
// Path queue nodes buffer doubled
2383+
2384+
// 42A74F: 68 04 00 04 00
2385+
// For `new` to use (sizeof(Node*) == 4)
2386+
DEFINE_PATCH(0x42A752, 0x08);
2387+
// push 40004h ((65536 + 1) * 4) -> push 80004h ((131072 + 1) * 4)
2388+
2389+
// 42A760: C7 47 04 00 00 01 00
2390+
// Set the total amount of valid nodes
2391+
DEFINE_PATCH(0x42A765, 0x02);
2392+
// mov dword ptr [edi+4], 10000h (65536) -> mov dword ptr [edi+4], 20000h (131072)
2393+
2394+
// 42A7E0: 68 04 00 10 00
2395+
// For `new` to use (sizeof(Node) == 16)
2396+
DEFINE_PATCH(0x42A7E3, 0x20);
2397+
// push 100004h ((65536 + 1) * 16) -> push 200004h ((131072 + 1) * 16)
2398+
2399+
// 42A7F7: BA 00 00 01 00
2400+
// Set the loops count of initialization
2401+
DEFINE_PATCH(0x42A7FA, 0x02);
2402+
// mov edx, 10000h (65536) -> mov edx, 20000h (131072)
2403+
2404+
#pragma endregion

0 commit comments

Comments
 (0)