Skip to content

Commit 26ae049

Browse files
authored
[Vanilla Fix] Two fixes related to abnormal deaths (#1637)
- Fixed an issue that game crashes (EIP:7FB178) when infantry are about to enter an occupiable building that has been removed and is not real dead. - Fixed an issue that game crashes when spawnee has been removed and is not real dead. --- PS: such as sell action, vanish by auto death or removed by temporal weapon.
1 parent 77d7b79 commit 26ae049

File tree

5 files changed

+43
-2
lines changed

5 files changed

+43
-2
lines changed

CREDITS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,8 @@ This page lists all the individual contributions to the project by their author.
446446
- Fix an issue that MCV will self-destruct when using trigger 107 to teleport
447447
- Fix an issue that moving MCV with Teleport locomotion will cause reconnection error
448448
- Jumpjet Tilts While Moving
449+
- Fix an issue that game crashes (EIP:7FB178) when infantry are about to enter an occupiable building that has been removed and is not real dead
450+
- Fix an issue that game crashes when spawnee has been removed and is not real dead
449451
- **Ollerus**:
450452
- Build limit group enhancement
451453
- Customizable rocker amplitude

docs/Fixed-or-Improved-Logics.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
216216
- Fixed an issue that MCV will self-destruct when using trigger 107 to teleport.
217217
- Fixed an issue that moving MCV with Teleport locomotion will cause reconnection error.
218218
- Fixed wrong shadow when a vehicle has hover locomotor and is being lifted by `IsLocomotor=yes` warhead.
219-
- Fixed the bug that a unit can overlap with `Teleport` units after it's been damaged by a fallen unit lifted by `IsLocomotor=yes` warheads
219+
- Fixed the bug that a unit can overlap with `Teleport` units after it's been damaged by a fallen unit lifted by `IsLocomotor=yes` warheads.
220+
- Fixed an issue that game crashes (EIP:7FB178) when infantry are about to enter an occupiable building that has been removed and is not real dead.
221+
- Fixed an issue that game crashes when spawnee has been removed and is not real dead.
220222

221223
## Fixes / interactions with other extensions
222224

docs/Whats-New.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ Vanilla fixes:
379379
- Fixed an issue that teleport units board transport vehicles on the bridge will create an impassable invisible barrier, which may cause the game to freeze or even crash (by NetsuNegi)
380380
- Fixed an issue that moving MCV with Teleport locomotion will cause reconnection error (by CrimRecya)
381381
- Fixed wrong shadow when a vehicle has hover locomotor and is being lifted by `IsLocomotor=yes` warhead (by NetsuNegi)
382+
- Fixed an issue that game crashes (EIP:7FB178) when infantry are about to enter an occupiable building that has been removed and is not real dead (by CrimRecya)
383+
- Fixed an issue that game crashes when spawnee has been removed and is not real dead (by CrimRecya)
382384
383385
Phobos fixes:
384386
- Fixed an issue that MCV will self-destruct when using trigger 107 to teleport (by CrimRecya)

src/Misc/Hooks.BugFixes.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,6 +1647,41 @@ DEFINE_HOOK(0x5F530B, ObjectClass_Disappear_AnnounceExpiredPointer, 0x6)
16471647
return 0x5F5311;
16481648
}
16491649

1650+
// I think no one wants to see wild pointers caused by WW's negligence
1651+
DEFINE_HOOK(0x4D9A1B, FootClass_PointerExpired_RemoveDestination, 0x6)
1652+
{
1653+
GET_STACK(bool, removed, STACK_OFFSET(0x1C, 0x8));
1654+
1655+
if (removed)
1656+
return 0x4D9ABD;
1657+
1658+
R->BL(true);
1659+
return 0x4D9A25;
1660+
}
1661+
1662+
namespace RemoveSpawneeHelper
1663+
{
1664+
bool removed = false;
1665+
}
1666+
1667+
DEFINE_HOOK(0x707B23, TechnoClass_PointerExpired_RemoveSpawnee, 0x6)
1668+
{
1669+
GET(SpawnManagerClass*, pSpawnManager, ECX);
1670+
GET(AbstractClass*, pRemove, EBP);
1671+
GET_STACK(bool, removed, STACK_OFFSET(0x20, 0x8));
1672+
1673+
RemoveSpawneeHelper::removed = removed;
1674+
pSpawnManager->UnlinkPointer(pRemove);
1675+
RemoveSpawneeHelper::removed = false;
1676+
1677+
return 0x707B29;
1678+
}
1679+
1680+
DEFINE_HOOK(0x6B7CE4, SpawnManagerClass_UnlinkPointer_RemoveSpawnee, 0x6)
1681+
{
1682+
return RemoveSpawneeHelper::removed ? 0x6B7CF4 : 0;
1683+
}
1684+
16501685
#pragma endregion
16511686

16521687
// IsSonic wave drawing uses fixed-size arrays accessed with index that is determined based on factors like wave lifetime,

0 commit comments

Comments
 (0)