Skip to content

Commit

Permalink
Fix Ares' Academy on InitialPayload
Browse files Browse the repository at this point in the history
  • Loading branch information
chaserli committed Dec 21, 2024
1 parent f0791ed commit 3b63de7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Misc/Hooks.Ares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ DEFINE_HOOK(0x44E9FA, BuildingClass_Detach_RestoreAnims, 0x6)
// Patches presented here are exceptions rather that the rule. They must be short, concise and correct.
// DO NOT POLLUTE ISSUEs and PRs.

ObjectClass* __fastcall CreateInitialPayload(TechnoTypeClass* type, void*, HouseClass* owner)
{
// temporarily reset the mutex since it's not part of the design
int mutex_old = std::exchange(Unsorted::IKnowWhatImDoing(), 0);
auto instance = type->CreateObject(owner);
Unsorted::IKnowWhatImDoing = mutex_old;
return instance;
}

void Apply_Ares3_0_Patches()
{
// Abductor fix:
Expand All @@ -36,6 +45,9 @@ void Apply_Ares3_0_Patches()
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x62267, &Helpers::Alex::getCellSpreadItems);
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x528C8, &Helpers::Alex::getCellSpreadItems);
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x5273A, &Helpers::Alex::getCellSpreadItems);

// InitialPayload creation:
Patch::Apply_CALL6(AresHelper::AresBaseAddress + 0x43D5D, &CreateInitialPayload);
}

void Apply_Ares3_0p1_Patches()
Expand All @@ -49,4 +61,7 @@ void Apply_Ares3_0p1_Patches()
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x62FB7, &Helpers::Alex::getCellSpreadItems);
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x53578, &Helpers::Alex::getCellSpreadItems);
Patch::Apply_CALL(AresHelper::AresBaseAddress + 0x533EA, &Helpers::Alex::getCellSpreadItems);

// InitialPayload creation:
Patch::Apply_CALL6(AresHelper::AresBaseAddress + 0x4483D, &CreateInitialPayload);
}

0 comments on commit 3b63de7

Please sign in to comment.