From 3b63de7a0fe10eb9a4fd1271387e7674544d1199 Mon Sep 17 00:00:00 2001 From: Trsdy <914137150@qq.com> Date: Sat, 21 Dec 2024 14:52:20 +0800 Subject: [PATCH] Fix Ares' Academy on InitialPayload --- src/Misc/Hooks.Ares.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Misc/Hooks.Ares.cpp b/src/Misc/Hooks.Ares.cpp index a8f9853597..e4e0016b77 100644 --- a/src/Misc/Hooks.Ares.cpp +++ b/src/Misc/Hooks.Ares.cpp @@ -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: @@ -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() @@ -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); }