From d596baf9b8d5ef2feccc7e6f65f64c5ca2abb969 Mon Sep 17 00:00:00 2001 From: ApfelTeeSaft <91074565+ApfelTeeSaft@users.noreply.github.com> Date: Sat, 28 Jun 2025 01:12:29 +0200 Subject: [PATCH] atp just go fuck yourself 4.20 --- Blizzard/Actor.h | 75 ----------------------------------------- Blizzard/ProcessEvent.h | 67 +++++++++++++++++++++++++++++++----- Blizzard/Replication.h | 29 +++++++++------- 3 files changed, 74 insertions(+), 97 deletions(-) diff --git a/Blizzard/Actor.h b/Blizzard/Actor.h index abb1a6c..d4871a4 100644 --- a/Blizzard/Actor.h +++ b/Blizzard/Actor.h @@ -111,81 +111,6 @@ namespace ActorNamespace return; } - // Create CheatManager - try - { - Logging::SafeLog(ELogEvent::Info, ELogType::Athena, "Setting up CheatManager..."); - - auto engine = Globals::GetEngine(); - if (!engine) - { - Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to get engine for CheatManager setup"); - return; - } - Logging::SafeLog(ELogEvent::Info, ELogType::Athena, "Engine retrieved successfully"); - - if (!engine->GameInstance) - { - Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "GameInstance is null"); - return; - } - Logging::SafeLog(ELogEvent::Info, ELogType::Athena, "GameInstance validated"); - - if (!engine->GameInstance->LocalPlayers.IsValid() || engine->GameInstance->LocalPlayers.Num() == 0) - { - Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "LocalPlayers array is invalid or empty"); - return; - } - Logging::SafeLog(ELogEvent::Info, ELogType::Athena, "LocalPlayers array validated, count: %d", engine->GameInstance->LocalPlayers.Num()); - - auto localPlayer = engine->GameInstance->LocalPlayers[0]; - if (!localPlayer) - { - Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "First LocalPlayer is null"); - return; - } - Logging::SafeLog(ELogEvent::Info, ELogType::Athena, "First LocalPlayer validated"); - - auto playerController = localPlayer->PlayerController; - if (!playerController) - { - Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "PlayerController is null"); - return; - } - Logging::SafeLog(ELogEvent::Info, ELogType::Athena, "PlayerController validated"); - - Logging::SafeLog(ELogEvent::Info, ELogType::Athena, "Spawning CheatManager object..."); - auto gameplayStatics = SDK::UGameplayStatics::GetDefaultObj(); - if (!gameplayStatics) - { - Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to get UGameplayStatics default object"); - return; - } - - auto cheatManagerClass = SDK::UCheatManager::StaticClass(); - if (!cheatManagerClass) - { - Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to get UCheatManager static class"); - return; - } - - auto NewCheatManager = gameplayStatics->SpawnObject(cheatManagerClass, playerController); - if (!NewCheatManager) - { - Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to spawn CheatManager object"); - return; - } - Logging::SafeLog(ELogEvent::Info, ELogType::Athena, "CheatManager object spawned successfully"); - - playerController->CheatManager = (SDK::UCheatManager*)(NewCheatManager); - Logging::SafeLog(ELogEvent::Info, ELogType::Athena, "CheatManager assigned to PlayerController successfully"); - } - catch (...) - { - Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Exception during CheatManager setup"); - return; - } - Logging::SafeLog(ELogEvent::Info, ELogType::Athena, "=== ACTOR NAMESPACE INITIALIZATION COMPLETED SUCCESSFULLY ==="); } catch (...) diff --git a/Blizzard/ProcessEvent.h b/Blizzard/ProcessEvent.h index fdc8200..cea6ad1 100644 --- a/Blizzard/ProcessEvent.h +++ b/Blizzard/ProcessEvent.h @@ -423,14 +423,63 @@ namespace ProcessEventNamespace void Initialize() { // Globals::CreateHook(Globals::GetAddress(SDK::Offsets::ProcessEvent), ProcessEventHook, (void**)&ProcessEvent); - Globals::CreateHook(Globals::GetAddress(0x236E670), hkCollectGarbage); - Globals::CreateHook(Globals::GetAddress(0x240F4A0), hkReadyToStartMatch, (void**)(&oReadyToStartMatch)); - Globals::CreateHook(Globals::GetAddress(0x1072E40), hkServerReadyToStartMatch, (void**)(&oServerReadyToStartMatch)); - Globals::CreateHook(Globals::GetAddress(0x1071E10), hkServerExecuteInventoryItem); - Globals::CreateHook(Globals::GetAddress(0x107B910), ServerAttemptAircraftJumpHook); - Globals::CreateHook(Globals::GetAddress(0x1073830), hkServerReturnToMainMenu); - Globals::CreateHook(Globals::GetAddress(0x1084A90), hkServerHandlePickup, (void**)(&oServerHandlePickup)); - Globals::CreateHook(Globals::GetAddress(0x10715A0), hkServerCreateBuildingActor); - Globals::CreateHook(Globals::GetAddress(0x1072D80), hkServerPlayEmoteItem); + + auto result1 = Globals::CreateHook(Globals::GetAddress(0x236E670), hkCollectGarbage); + if (result1 != MH_OK) + { + Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to hook CollectGarbage: %d", result1); + return; + } + + auto result2 = Globals::CreateHook(Globals::GetAddress(0x240F4A0), hkReadyToStartMatch, (void**)(&oReadyToStartMatch)); + if (result2 != MH_OK) + { + Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to hook ReadyToStartMatch: %d", result1); + return; + } + auto result3 = Globals::CreateHook(Globals::GetAddress(0x1072E40), hkServerReadyToStartMatch, (void**)(&oServerReadyToStartMatch)); + if (result3 != MH_OK) + { + Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to hook ServerReadyToStartMatch: %d", result1); + return; + } + + auto result4 = Globals::CreateHook(Globals::GetAddress(0x1071E10), hkServerExecuteInventoryItem); + if (result4 != MH_OK) + { + Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to hook ServerExecuteInventoryItem: %d", result1); + return; + } + auto result5 = Globals::CreateHook(Globals::GetAddress(0x107B910), ServerAttemptAircraftJumpHook); + if (result5 != MH_OK) + { + Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to hook ServerAttemptAircraftJump: %d", result1); + return; + } + auto result6 = Globals::CreateHook(Globals::GetAddress(0x1073830), hkServerReturnToMainMenu); + if (result6 != MH_OK) + { + Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to hook ServerReturnToMainMenu: %d", result1); + return; + } + auto result7 = Globals::CreateHook(Globals::GetAddress(0x1084A90), hkServerHandlePickup, (void**)(&oServerHandlePickup)); + if (result7 != MH_OK) + { + Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to hook ServerHandlePickup: %d", result1); + return; + } + + auto result8 = Globals::CreateHook(Globals::GetAddress(0x10715A0), hkServerCreateBuildingActor); + if (result8 != MH_OK) + { + Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to hook ServerCreateBuildingActor: %d", result1); + return; + } + auto result9 = Globals::CreateHook(Globals::GetAddress(0x1072D80), hkServerPlayEmoteItem); + if (result9 != MH_OK) + { + Logging::SafeLog(ELogEvent::Error, ELogType::Athena, "Failed to hook ServerPlayEmoteItem: %d", result1); + return; + } } } \ No newline at end of file diff --git a/Blizzard/Replication.h b/Blizzard/Replication.h index 1412919..4148b69 100644 --- a/Blizzard/Replication.h +++ b/Blizzard/Replication.h @@ -41,7 +41,7 @@ namespace Replication return Channel; } - return NULL; + return nullptr; } int PrepConnections(SDK::UNetDriver* NetDriver) @@ -113,7 +113,7 @@ namespace Replication } } - return NULL; + return nullptr; } SDK::UNetConnection* GetOwningConnection(SDK::AActor* Actor) @@ -125,6 +125,8 @@ namespace Replication return ((SDK::APlayerController*)Actor)->NetConnection; } } + + return nullptr; } void BuildConsiderList(SDK::UNetDriver* NetDriver, std::vector& OutConsiderList) @@ -139,11 +141,6 @@ namespace Replication if (!Actor) continue; - if (!Actor) - { - continue; - } - if (Actor->bActorIsBeingDestroyed) { continue; @@ -171,8 +168,11 @@ namespace Replication } } - SDK::FreeInternal((__int64)Actors.GetData()); - Actors.SetData(0); + if (Actors.GetData()) + { + SDK::FreeInternal((__int64)Actors.GetData()); + } + Actors.SetData(nullptr); Actors.SetNum(0); Actors.SetMax(0); } @@ -206,7 +206,7 @@ namespace Replication for (int32_t ChildIdx = 0; ChildIdx < Connection->Children.Num(); ChildIdx++) { - if (Connection->Children[ChildIdx]->PlayerController != NULL) + if (Connection->Children[ChildIdx]->PlayerController != nullptr) { SendClientAdjustment(Connection->Children[ChildIdx]->PlayerController); } @@ -229,23 +229,26 @@ namespace Replication { if (ReplicateActor(Channel)) { + // bim bim bam bam } } } } - ConsiderList.empty(); + for (auto* Info : ConsiderList) + { + delete Info; + } ConsiderList.clear(); } void InitOffsets() { - CreateChannel = decltype(CreateChannel)(Globals::GetAddress(0x2105540)); SetChannelActor = decltype(SetChannelActor)(Globals::GetAddress(0x1F9C260)); ReplicateActor = decltype(ReplicateActor)(Globals::GetAddress(0x1F97D80)); CallPreReplication = decltype(CallPreReplication)(Globals::GetAddress(0x1D84F70)); - SendClientAdjustment = decltype(SendClientAdjustment)(Globals::GetAddress(0x1D84F70)); + SendClientAdjustment = decltype(SendClientAdjustment)(Globals::GetAddress(0x221FEC0)); ActorChannelClose = decltype(ActorChannelClose)(Globals::GetAddress(0x1F7E9C0)); } } \ No newline at end of file