From 72a2afcb726ff1cf57e56ec90f0ffdd77cdf9b03 Mon Sep 17 00:00:00 2001 From: Gray <84999745+Milxnor@users.noreply.github.com> Date: Tue, 12 Mar 2024 19:58:43 -0400 Subject: [PATCH] test --- Project Reboot 3.0/FortGameModeAthena.cpp | 10 ++++++++- Project Reboot 3.0/FortPickup.cpp | 10 ++++++++- .../FortPlayerControllerAthena.h | 6 ++--- Project Reboot 3.0/NetDriver.cpp | 11 +++++----- Project Reboot 3.0/addresses.cpp | 16 +++++++++++++- Project Reboot 3.0/addresses.h | 2 +- Project Reboot 3.0/dllmain.cpp | 10 ++++++--- Project Reboot 3.0/finder.h | 22 ++++++++++--------- Project Reboot 3.0/globals.h | 1 + 9 files changed, 62 insertions(+), 26 deletions(-) diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index ca872d6..527d2cf 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -918,6 +918,13 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game } } + static auto ReplicationDriverOffset = GetWorld()->GetNetDriver()->GetOffset("ReplicationDriver", false); // If netdriver is null the world blows up + + Globals::bShouldUseReplicationGraph = (!(ReplicationDriverOffset == -1 || Fortnite_Version >= 20)) + && Fortnite_Version != 3.3; // RepGraph is half implemented + + LOG_INFO(LogDev, "bShouldUseReplicationGraph: {}", Globals::bShouldUseReplicationGraph); + Globals::bStartedListening = true; } @@ -1351,7 +1358,8 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena } } - NewPlayer->GetMatchReport() = (UAthenaPlayerMatchReport*)UGameplayStatics::SpawnObject(UAthenaPlayerMatchReport::StaticClass(), NewPlayer); // idk when to do this + if (auto MatchReportPtr = NewPlayer->GetMatchReport()) + *MatchReportPtr = (UAthenaPlayerMatchReport*)UGameplayStatics::SpawnObject(UAthenaPlayerMatchReport::StaticClass(), NewPlayer); // idk when to do this static auto SquadIdOffset = PlayerStateAthena->GetOffset("SquadId", false); diff --git a/Project Reboot 3.0/FortPickup.cpp b/Project Reboot 3.0/FortPickup.cpp index 52d71d8..d949116 100644 --- a/Project Reboot 3.0/FortPickup.cpp +++ b/Project Reboot 3.0/FortPickup.cpp @@ -26,7 +26,15 @@ void AFortPickup::SpawnMovementComponent() static auto ProjectileMovementComponentClass = FindObject("/Script/Engine.ProjectileMovementComponent"); // UFortProjectileMovementComponent static auto MovementComponentOffset = this->GetOffset("MovementComponent"); - this->Get(MovementComponentOffset) = UGameplayStatics::SpawnObject(ProjectileMovementComponentClass, this); + + if (auto NewComponent = UGameplayStatics::SpawnObject(ProjectileMovementComponentClass, this)) + { + this->Get(MovementComponentOffset) = NewComponent; + } + else + { + + } } AFortPickup* AFortPickup::SpawnPickup(PickupCreateData& PickupData) diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.h b/Project Reboot 3.0/FortPlayerControllerAthena.h index 33d4f84..50dedc1 100644 --- a/Project Reboot 3.0/FortPlayerControllerAthena.h +++ b/Project Reboot 3.0/FortPlayerControllerAthena.h @@ -201,10 +201,10 @@ public: this->ProcessEvent(ClientClearDeathNotificationFn); } - UAthenaPlayerMatchReport*& GetMatchReport() + UAthenaPlayerMatchReport** GetMatchReport() { - static auto MatchReportOffset = GetOffset("MatchReport"); - return Get(MatchReportOffset); + static auto MatchReportOffset = GetOffset("MatchReport", false); + return MatchReportOffset == -1 ? nullptr : GetPtr(MatchReportOffset); } void ClientSendTeamStatsForPlayer(FAthenaMatchTeamStats* TeamStats) diff --git a/Project Reboot 3.0/NetDriver.cpp b/Project Reboot 3.0/NetDriver.cpp index d8ba9a5..fa84500 100644 --- a/Project Reboot 3.0/NetDriver.cpp +++ b/Project Reboot 3.0/NetDriver.cpp @@ -56,17 +56,14 @@ void UNetDriver::TickFlushHook(UNetDriver* NetDriver) if (Globals::bStartedListening) { - static auto ReplicationDriverOffset = NetDriver->GetOffset("ReplicationDriver"/*, false */); - - // LOG_INFO(LogDev, "ReplicationDriverOffset{}", ReplicationDriverOffset); - - // if (ReplicationDriverOffset == -1) - if (ReplicationDriverOffset == -1 || Fortnite_Version >= 20) + if (!Globals::bShouldUseReplicationGraph) { NetDriver->ServerReplicateActors(); } else { + static auto ReplicationDriverOffset = NetDriver->GetOffset("ReplicationDriver"/*, false */); + if (auto ReplicationDriver = NetDriver->Get(ReplicationDriverOffset)) { reinterpret_cast(ReplicationDriver->VFTable[Offsets::ServerReplicateActors])(ReplicationDriver); @@ -654,6 +651,7 @@ int32 UNetDriver::ServerReplicateActors() std::vector DeletionEntries; +#if 0 auto ConnectionDestroyedStartupOrDormantActors = GetDestroyedStartupOrDormantActors(Connection); if (ConnectionDestroyedStartupOrDormantActors) @@ -683,6 +681,7 @@ int32 UNetDriver::ServerReplicateActors() } LOG_INFO(LogDev, "DeletionEntries: {}", DeletionEntries.size()); +#endif for (FActorDestructionInfo* DeletionEntry : DeletionEntries) { diff --git a/Project Reboot 3.0/addresses.cpp b/Project Reboot 3.0/addresses.cpp index b39f93b..46ec684 100644 --- a/Project Reboot 3.0/addresses.cpp +++ b/Project Reboot 3.0/addresses.cpp @@ -471,11 +471,25 @@ void Offsets::FindAll() Offsets::NetworkObjectList = 0x4F0; Offsets::ReplicationFrame = 0x328; } - if (Fortnite_Version == 3.1 || Fortnite_Version == 3.2) + if (Fortnite_Version == 3.1) { Offsets::NetworkObjectList = 0x4F8; Offsets::ClientWorldPackageName = 0x1818; } + if (Fortnite_Version == 3.2) + { + Offsets::NetworkObjectList = 0x4F8; + Offsets::ClientWorldPackageName = 0x1820; + } + if (Fortnite_Version == 3.2 || Fortnite_Version == 3.3) + { + Offsets::ReplicationFrame = 0x330; + } + if (Fortnite_Version == 3.3) + { + Offsets::NetworkObjectList = 0x508; + Offsets::ClientWorldPackageName = 0x1828; + } if (Engine_Version == 419) // checked 2.4.2 & 2.2 & 1.11 { Offsets::NetworkObjectList = 0x490; diff --git a/Project Reboot 3.0/addresses.h b/Project Reboot 3.0/addresses.h index d5b6879..ce593e0 100644 --- a/Project Reboot 3.0/addresses.h +++ b/Project Reboot 3.0/addresses.h @@ -95,7 +95,7 @@ namespace Offsets extern inline uint64 SuperStruct = 0; extern inline uint64 Offset_Internal = 0; extern inline uint64 ServerReplicateActors = 0; - extern inline uint64 ReplicationFrame = 0; + extern inline uint64 ReplicationFrame = 0; // Attempt to replicate function '%s' on Actor '%s' while it is in the middle of variable replication! extern inline uint64 IsNetRelevantFor = 0; extern inline uint64 NetworkObjectList = 0; extern inline uint64 ClientWorldPackageName = 0; diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index af094d5..c29b576 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -970,7 +970,7 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook, (PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false, false, true); - if (Fortnite_Version != 3.3) // 0xE9 on 3.3 + if (Fortnite_Version > 3.3) // 0xE9 on 3.3 (assumed every build below) { Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/FortniteGame.FortGameModeAthena.OnAircraftEnteredDropZone"), AFortGameModeAthena::OnAircraftEnteredDropZoneHook, (PVOID*)&AFortGameModeAthena::OnAircraftEnteredDropZoneOriginal, false, false, true, true); @@ -1094,8 +1094,12 @@ DWORD WINAPI Main(LPVOID) AFortPlayerController::ServerLoadingScreenDroppedHook, (PVOID*)&AFortPlayerController::ServerLoadingScreenDroppedOriginal, false, true); Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerReadyToStartMatch"), AFortPlayerControllerAthena::ServerReadyToStartMatchHook, (PVOID*)&AFortPlayerControllerAthena::ServerReadyToStartMatchOriginal, false); - Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerControllerZone.ServerRequestSeatChange"), - AFortPlayerControllerAthena::ServerRequestSeatChangeHook, (PVOID*)&AFortPlayerControllerAthena::ServerRequestSeatChangeOriginal, false); + + auto ServerRequestSeatChangeFn = FindObject(L"/Script/FortniteGame.FortPlayerControllerZone.ServerRequestSeatChange"); + + if (ServerRequestSeatChangeFn) + Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerControllerZone.ServerRequestSeatChange"), + AFortPlayerControllerAthena::ServerRequestSeatChangeHook, (PVOID*)&AFortPlayerControllerAthena::ServerRequestSeatChangeOriginal, false); // if (false) if (Fortnite_Version > 6.10) // so on 6.10 there isa param and our little finder dont work for that so diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index 3f904bc..a9d8465 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -1760,18 +1760,15 @@ static inline uint64 FindReplaceBuildingActor() static inline uint64 FindSendClientAdjustment() { - if (Fortnite_Version <= 3.2) - return Memcury::Scanner::FindPattern("40 53 48 83 EC 20 48 8B 99 ? ? ? ? 48 39 99 ? ? ? ? 74 0A 48 83 B9").Get(); - if (Fortnite_Version >= 20) - return Memcury::Scanner::FindPattern("40 53 48 83 EC 20 48 8B 99 ? ? ? ? 48 39 99 ? ? ? ? 74 0A 48 83 B9").Get(); - - return 0; + return Memcury::Scanner::FindPattern("40 53 48 83 EC 20 48 8B 99 ? ? ? ? 48 39 99 ? ? ? ? 74 0A 48 83 B9", false).Get(); } static inline uint64 FindReplicateActor() { if (Engine_Version == 416) return Memcury::Scanner::FindPattern("40 55 53 57 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8D 59 68 4C 8B F1 48 8B").Get(); + if (Fortnite_Version == 3.3) + return Memcury::Scanner::FindPattern("48 8B C4 55 53 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 70 A8 0F 29 78 98 48 89 70 E8 4C").Get(); if (Engine_Version >= 419 && Fortnite_Version <= 3.2) { auto addr = Memcury::Scanner::FindPattern("40 55 56 57 41 54 41 55 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 4C", false).Get(); // 3.0, we could just use this sig for everything? @@ -1790,7 +1787,7 @@ static inline uint64 FindReplicateActor() static inline uint64 FindCreateChannel() { - if (Fortnite_Version <= 3.2) + if (Fortnite_Version <= 3.3) return Memcury::Scanner::FindPattern("40 56 57 41 54 41 55 41 57 48 83 EC 60 48 8B 01 41 8B F9 45 0F B6 E0").Get(); if (Fortnite_Version >= 20) return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 44 89 4C 24 ? 55 57 41 54 41 56 41 57 48 8B EC 48 83 EC 50 45 33 E4 48 8D 05 ? ? ? ? 44 38 25").Get(); @@ -1800,14 +1797,19 @@ static inline uint64 FindCreateChannel() static inline uint64 FindSetChannelActor() { + // string ref?? + if (Engine_Version == 416) return Memcury::Scanner::FindPattern("4C 8B DC 55 53 57 41 54 49 8D AB ? ? ? ? 48 81 EC ? ? ? ? 45 33").Get(); - if (Engine_Version >= 419 && Fortnite_Version <= 3.2) + if (Engine_Version >= 419 && Fortnite_Version <= 3.3) { + if (Fortnite_Version == 3.3) + return Memcury::Scanner::FindPattern("48 8B C4 55 53 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 89 70 10 48 8B D9 48 89 78 18 48 8D 35").Get(); + auto aa = Memcury::Scanner::FindPattern("48 8B C4 55 53 57 41 54 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 45 33 E4 48 89 70", false).Get(); if (!aa) - return Memcury::Scanner::FindPattern("48 8B C4 55 53 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 89 70 E8 48 8B D9").Get(); + return Memcury::Scanner::FindPattern("48 8B C4 55 53 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 89 70 E8 48 8B D9").Get(); // 3.2 return aa; } @@ -1823,7 +1825,7 @@ static inline uint64 FindCallPreReplication() return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 48 8B C4 55 57 41 57 48 8D 68 A1 48 81 EC").Get(); if (Engine_Version == 419) return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 48 8B C4 55 57 41 54 48 8D 68 A1 48 81 EC ? ? ? ? 48 89 58 08 4C").Get(); - if (Fortnite_Version >= 2.5 && Fortnite_Version <= 3.2) + if (Fortnite_Version >= 2.5 && Fortnite_Version <= 3.3) return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 56 41 56 48 83 EC 38 4C 8B F2").Get(); if (Fortnite_Version >= 20) return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC 40 F6 41 58 30 48 8B EA 48 8B D9 40 B6 01").Get(); diff --git a/Project Reboot 3.0/globals.h b/Project Reboot 3.0/globals.h index ca18762..856b9d8 100644 --- a/Project Reboot 3.0/globals.h +++ b/Project Reboot 3.0/globals.h @@ -16,6 +16,7 @@ namespace Globals extern inline bool bInfiniteMaterials = false; extern inline bool bInfiniteAmmo = false; + extern inline bool bShouldUseReplicationGraph = false; extern inline bool bHitReadyToStartMatch = false; extern inline bool bInitializedPlaylist = false;