From be0873d5d7b4af0f9ce0d6e64460472e93c3e9f4 Mon Sep 17 00:00:00 2001 From: Milxnor Date: Wed, 26 Apr 2023 21:44:16 -0400 Subject: [PATCH] fix 3.0, 3.1, 3.2, and add cube spawning event, mybe fix s19 crash? --- Project Reboot 3.0/BGA.h | 8 ++- Project Reboot 3.0/FortGameModeAthena.cpp | 21 ++++++- .../FortPlayerControllerAthena.h | 2 + Project Reboot 3.0/NetConnection.cpp | 2 +- Project Reboot 3.0/NetDriver.cpp | 4 ++ Project Reboot 3.0/Project Reboot 3.0.vcxproj | 1 + .../Project Reboot 3.0.vcxproj.filters | 7 ++- Project Reboot 3.0/addresses.cpp | 9 ++- Project Reboot 3.0/events.h | 62 ++++++++++++++++++- Project Reboot 3.0/finder.h | 34 +++++++--- Project Reboot 3.0/gui.h | 34 ++++++++++ Project Reboot 3.0/moderation.h | 2 + 12 files changed, 166 insertions(+), 20 deletions(-) create mode 100644 Project Reboot 3.0/moderation.h diff --git a/Project Reboot 3.0/BGA.h b/Project Reboot 3.0/BGA.h index a3c17b7..3959b42 100644 --- a/Project Reboot 3.0/BGA.h +++ b/Project Reboot 3.0/BGA.h @@ -5,7 +5,7 @@ #include "FortLootPackage.h" #include "FortPickup.h" -void SpawnBGAs() +void SpawnBGAs() // hahah not "proper", there's a function that we can hook and it gets called on each spawner whenever playlist gets set, but it's fine. { static auto BGAConsumableSpawnerClass = FindObject("/Script/FortniteGame.BGAConsumableSpawner"); @@ -30,10 +30,10 @@ void SpawnBGAs() for (auto& LootDrop : LootDrops) { static auto ConsumableClassOffset = LootDrop.ItemDefinition->GetOffset("ConsumableClass"); - auto& ConsumableClassSoft = LootDrop.ItemDefinition->Get>(ConsumableClassOffset); + auto ConsumableClassSoft = LootDrop.ItemDefinition->GetPtr>(ConsumableClassOffset); static auto BlueprintGeneratedClassClass = FindObject("/Script/Engine.BlueprintGeneratedClass"); - auto StrongConsumableClass = ConsumableClassSoft.Get(BlueprintGeneratedClassClass, true); + auto StrongConsumableClass = ConsumableClassSoft->Get(BlueprintGeneratedClassClass, true); if (!StrongConsumableClass) { @@ -46,4 +46,6 @@ void SpawnBGAs() } AllBGAConsumableSpawners.Free(); + + LOG_INFO(LogDev, "Spawned BGAS!"); } \ No newline at end of file diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index 56467be..220b153 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -160,7 +160,10 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game } else { - GameState->Get("CurrentPlaylistData") = Playlist; + static auto CurrentPlaylistDataOffset = GameState->GetOffset("CurrentPlaylistData", false); + + if (CurrentPlaylistDataOffset != -1) + GameState->Get(CurrentPlaylistDataOffset) = Playlist; } if (bOnRep) @@ -553,6 +556,22 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game // return false; + static auto NewFn = FindObject("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.New"); + + if (NewFn && (Fortnite_Version == 5.30 ? !Globals::bGoingToPlayEvent : true)) + { + auto Loader = GetEventLoader("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C"); + + LOG_INFO(LogDev, "Loader: {}", __int64(Loader)); + + if (Loader) + { + int32 NewParam = 1; + // Loader->ProcessEvent(NextFn, &NewParam); + Loader->ProcessEvent(NewFn, &NewParam); + } + } + LoopMutators([&](AFortAthenaMutator* Mutator) { LOG_INFO(LogGame, "Mutator {}", Mutator->GetPathName()); }); Globals::AmountOfListens++; diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.h b/Project Reboot 3.0/FortPlayerControllerAthena.h index afd593d..7c6bc81 100644 --- a/Project Reboot 3.0/FortPlayerControllerAthena.h +++ b/Project Reboot 3.0/FortPlayerControllerAthena.h @@ -98,6 +98,8 @@ static bool ApplyCID(AFortPlayerPawn* Pawn, UObject* CID, bool bUseServerChooseP static auto HeroTypeOffset = PlayerState->GetOffset("HeroType"); // PlayerState->Get(HeroTypeOffset) = HeroDefinition; + + return true; } struct FGhostModeRepData diff --git a/Project Reboot 3.0/NetConnection.cpp b/Project Reboot 3.0/NetConnection.cpp index a633b5d..0b8ba3f 100644 --- a/Project Reboot 3.0/NetConnection.cpp +++ b/Project Reboot 3.0/NetConnection.cpp @@ -1,7 +1,7 @@ #include "NetConnection.h" bool UNetConnection::ClientHasInitializedLevelFor(const AActor* TestActor) const { - // return true; + return true; static auto ClientHasInitializedLevelForAddr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 8B 5A 20 48 8B F1 4C 8B C3").Get(); if (!ClientHasInitializedLevelForAddr) diff --git a/Project Reboot 3.0/NetDriver.cpp b/Project Reboot 3.0/NetDriver.cpp index f7798a2..92e7336 100644 --- a/Project Reboot 3.0/NetDriver.cpp +++ b/Project Reboot 3.0/NetDriver.cpp @@ -344,12 +344,16 @@ static FORCEINLINE bool IsActorDormant(FNetworkObjectInfo* ActorInfo, const TWea bool UNetDriver::IsLevelInitializedForActor(const AActor* InActor, const UNetConnection* InConnection) const { if (Fortnite_Version >= 2.42) // idk + { return true; + } +/* #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) if (!InActor || !InConnection) return false; // check(World == InActor->GetWorld()); +#endif */ // return true; // damn const bool bCorrectWorld = (InConnection->GetClientWorldPackageName() == GetWorldPackage()->NamePrivate && InConnection->ClientHasInitializedLevelFor(InActor)); diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj b/Project Reboot 3.0/Project Reboot 3.0.vcxproj index 83344f3..3f7de4e 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj @@ -386,6 +386,7 @@ + diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters index 9366272..96d5bbd 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters @@ -79,7 +79,6 @@ Engine\Source\Runtime\Engine\Private\Components - FortniteGame\Source\FortniteGame\Private\Items @@ -254,6 +253,9 @@ Engine\Source\Runtime\Engine\Private + + Reboot\Public + @@ -809,6 +811,9 @@ FortniteGame\Source\FortniteGame\Public\Items + + Reboot\Public + diff --git a/Project Reboot 3.0/addresses.cpp b/Project Reboot 3.0/addresses.cpp index 2ffde1f..8303f28 100644 --- a/Project Reboot 3.0/addresses.cpp +++ b/Project Reboot 3.0/addresses.cpp @@ -406,11 +406,16 @@ void Offsets::FindAll() { Offsets::ClientWorldPackageName = 0x17F8; } - if (Fortnite_Version == 2.5) + if (Fortnite_Version >= 2.5 && Fortnite_Version <= 3.1) // checked 2.5, 3.0, 3.1 { Offsets::NetworkObjectList = 0x4F0; Offsets::ReplicationFrame = 0x328; } + if (Fortnite_Version == 3.1 || Fortnite_Version == 3.2) + { + Offsets::NetworkObjectList = 0x4F8; + Offsets::ClientWorldPackageName = 0x1818; + } if (Engine_Version == 419) // checked 2.4.2 & 1.11 { Offsets::NetworkObjectList = 0x490; @@ -531,7 +536,7 @@ std::vector Addresses::GetFunctionsToNull() if (Engine_Version == 500) { // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 F6 0F 29 70 A8 44 38 35").Get()); // zone - // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 55 56 57 41 54 41 55 41 56 41 57 48 8D 68 A8 48 81 EC ? ? ? ? 45 33 FF").Get()); // Garbage collection + toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 55 56 57 41 54 41 55 41 56 41 57 48 8D 68 A8 48 81 EC ? ? ? ? 45").Get()); // GC } toNull.push_back(Addresses::ChangeGameSessionId); diff --git a/Project Reboot 3.0/events.h b/Project Reboot 3.0/events.h index 18fdf8e..8407000 100644 --- a/Project Reboot 3.0/events.h +++ b/Project Reboot 3.0/events.h @@ -50,6 +50,64 @@ static inline std::vector Events = false ), Event + ( + "Crack Closure", + "/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C", + "", + 0, + { + + }, + { + { + { + false, + "/Game/Athena/Events/BP_Athena_Event_Components.BP_Athena_Event_Components_C.Final" + }, + + 0 + }, + { + { + true, + "/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.Final" + }, + + 0 + }, + }, + + "/Game/Athena/Events/BP_Athena_Event_Components.BP_Athena_Event_Components_C", + "/Game/Athena/Playlists/Playlist_DefaultSolo.Playlist_DefaultSolo", + 5.30, + false + ), + /* Event + ( + "Impact Lake", + "/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C", + "", + 0, + { + + }, + { + { + { + true, + "/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.PlayFinalSink" + }, + + 0 + }, + }, + + "/Game/Athena/Events/BP_Athena_Event_Components.BP_Athena_Event_Components_C", + "/Game/Athena/Playlists/Playlist_DefaultSolo.Playlist_DefaultSolo", + 5.41, + false + ), */ + Event ( "Butterfly", "/Game/Athena/Prototype/Blueprints/Island/BP_Butterfly.BP_Butterfly_C", @@ -411,7 +469,7 @@ static inline UObject* GetEventScripting() return AllScripters.at(0); } -static inline UObject* GetEventLoader() +static inline UObject* GetEventLoader(const std::string& OverrideLoaderName = "NULL") { Event OurEvent; @@ -427,7 +485,7 @@ static inline UObject* GetEventLoader() if (!OurEvent.Version) return nullptr; - auto LoaderClass = FindObject(OurEvent.LoaderClass); + auto LoaderClass = FindObject(OverrideLoaderName == "NULL" ? OurEvent.LoaderClass : OverrideLoaderName); if (!LoaderClass) { diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index 5d4713b..b74037c 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -398,7 +398,7 @@ static inline uint64 FindIsNetRelevantForOffset() { if (Engine_Version == 416) // checked on 1.7.2 & 1.8 return 0x420 / 8; - if (Fortnite_Version == 1.11 || Fortnite_Version == 2.42 || Fortnite_Version == 2.5) + if (Fortnite_Version == 1.11 || (Fortnite_Version >= 2.42 && Fortnite_Version <= 3.2)) // checked 1.11, 2.4.2, 2.5, 3.0, 3.1 return 0x418 / 8; return 0; @@ -426,7 +426,7 @@ static inline uint64 FindSpawnActor() auto Addr = Memcury::Scanner::FindStringRef(L"SpawnActor failed because no class was specified"); - if (Engine_Version >= 416 && Fortnite_Version <= 2.5) + if (Engine_Version >= 416 && Fortnite_Version <= 3.2) return FindBytes(Addr, { 0x40, 0x55 }, 3000, 0, true); return FindBytes(Addr, { 0x4C, 0x8B, 0xDC }, 3000, 0, true); @@ -552,7 +552,14 @@ static inline uint64 FindCompletePickupAnimation() return Memcury::Scanner::FindPattern("4C 8B DC 53 55 56 48 83 EC 60 48 8B F1 48 8B 89 ? ? ? ? 48 85 C9").Get(); if (Engine_Version == 420) - return Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 48 8B D9 48 8B 89 ? ? ? ? 48 85 C9 74 20 48 8D 44 24").Get(); + { + auto addy = Memcury::Scanner::FindPattern("4C 8B DC 53 55 56 48 83 EC 60 48 8B F1 48 8B 89", false).Get(); // 3.1 + + if (!addy) + addy = Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 48 8B D9 48 8B 89 ? ? ? ? 48 85 C9 74 20 48 8D 44 24").Get(); + + return addy; + } if (Engine_Version == 421) { @@ -920,7 +927,7 @@ static inline uint64 FindTickFlush() return addr; } - auto Addr = Memcury::Scanner::FindStringRef(L"STAT_NetTickFlush"); + auto Addr = Memcury::Scanner::FindStringRef(L"STAT_NetTickFlush", false); if (!Addr.Get()) { @@ -1516,7 +1523,7 @@ static inline uint64 FindReplaceBuildingActor() static inline uint64 FindSendClientAdjustment() { - if (Fortnite_Version <= 2.5) + 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(); return 0; @@ -1526,15 +1533,22 @@ 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 (Engine_Version >= 419 && Fortnite_Version <= 2.5) - return Memcury::Scanner::FindPattern("40 55 56 41 54 41 55 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 4C 8B E9 48 8B 49 68 48").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? + + if (!addr) + addr = Memcury::Scanner::FindPattern("40 55 56 41 54 41 55 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 4C 8B E9 48 8B 49 68 48").Get(); + + return addr; + } return 0; } static inline uint64 FindCreateChannel() { - if (Fortnite_Version <= 2.5) + if (Fortnite_Version <= 3.2) 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(); return 0; @@ -1544,7 +1558,7 @@ static inline uint64 FindSetChannelActor() { 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 <= 2.5) + if (Engine_Version >= 419 && Fortnite_Version <= 3.2) { 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(); @@ -1563,7 +1577,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) + if (Fortnite_Version >= 2.5 && Fortnite_Version <= 3.2) return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 56 41 56 48 83 EC 38 4C 8B F2").Get(); return 0; diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index 278d2b6..484bb8a 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -406,6 +406,40 @@ void MainUI() UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), cmd, nullptr); } + /* + if (ImGui::Button("New")) + { + static auto NextFn = FindObject("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.Next"); + static auto NewFn = FindObject("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.New"); + auto Loader = GetEventLoader("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C"); + + LOG_INFO(LogDev, "Loader: {}", __int64(Loader)); + + if (Loader) + { + int32 NewParam = 1; + // Loader->ProcessEvent(NextFn, &NewParam); + Loader->ProcessEvent(NewFn, &NewParam); + } + } + + if (ImGui::Button("Next")) + { + static auto NextFn = FindObject("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.Next"); + static auto NewFn = FindObject("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.New"); + auto Loader = GetEventLoader("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C"); + + LOG_INFO(LogDev, "Loader: {}", __int64(Loader)); + + if (Loader) + { + int32 NewParam = 1; + Loader->ProcessEvent(NextFn, &NewParam); + // Loader->ProcessEvent(NewFn, &NewParam); + } + } + */ + if (Engine_Version < 424 && ImGui::Button("Restart")) { if (Engine_Version < 424) diff --git a/Project Reboot 3.0/moderation.h b/Project Reboot 3.0/moderation.h new file mode 100644 index 0000000..3f59c93 --- /dev/null +++ b/Project Reboot 3.0/moderation.h @@ -0,0 +1,2 @@ +#pragma once +