From 70021429ea7ae379f9f7a4aa3d80ecd49543f909 Mon Sep 17 00:00:00 2001 From: Gray <84999745+Milxnor@users.noreply.github.com> Date: Mon, 15 Jan 2024 13:41:41 -0500 Subject: [PATCH 01/14] kilfeed --- Project Reboot 3.0/FortPlayerController.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index b2a3582..b040ccc 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -1346,6 +1346,18 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo DeathCause = ToDeathCause(Tags, false, DeadPawn); // DeadPawn->IsDBNO() ?? + FGameplayTagContainer CopyTags; + + for (int i = 0; i < Tags.GameplayTags.Num(); ++i) + { + CopyTags.GameplayTags.Add(Tags.GameplayTags.at(i)); + } + + for (int i = 0; i < Tags.ParentTags.Num(); ++i) + { + CopyTags.ParentTags.Add(Tags.ParentTags.at(i)); + } + LOG_INFO(LogDev, "DeathCause: {}", (int)DeathCause); LOG_INFO(LogDev, "DeadPawn->IsDBNO(): {}", DeadPawn->IsDBNO()); LOG_INFO(LogDev, "KillerPlayerState: {}", __int64(KillerPlayerState)); @@ -1358,7 +1370,7 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo *(FVector*)(__int64(DeathInfo) + MemberOffsets::DeathInfo::DeathLocation) = DeathLocation; if (MemberOffsets::DeathInfo::DeathTags != -1) - *(FGameplayTagContainer*)(__int64(DeathInfo) + MemberOffsets::DeathInfo::DeathTags) = Tags; + *(FGameplayTagContainer*)(__int64(DeathInfo) + MemberOffsets::DeathInfo::DeathTags) = CopyTags; if (MemberOffsets::DeathInfo::bInitialized != -1) *(bool*)(__int64(DeathInfo) + MemberOffsets::DeathInfo::bInitialized) = true; From b0901b9659901c8e4d66a4f5ce463d9d88df8ae9 Mon Sep 17 00:00:00 2001 From: ILoveTacosFromJITB <89064551+ILoveTacosFromJITB@users.noreply.github.com> Date: Mon, 15 Jan 2024 13:25:52 -0800 Subject: [PATCH 02/14] Some Event Fixes, 18.10 Crash fix, random crash after a few minutes for s17+ --- Project Reboot 3.0/Actor.cpp | 22 ++ Project Reboot 3.0/Actor.h | 1 + Project Reboot 3.0/GameModeBase.cpp | 15 +- Project Reboot 3.0/dllmain.cpp | 332 +++++++++++++++++++++++++++- Project Reboot 3.0/events.h | 36 +++ Project Reboot 3.0/finder.h | 3 + Project Reboot 3.0/gui.h | 17 ++ 7 files changed, 418 insertions(+), 8 deletions(-) diff --git a/Project Reboot 3.0/Actor.cpp b/Project Reboot 3.0/Actor.cpp index 105e8c9..07ac52a 100644 --- a/Project Reboot 3.0/Actor.cpp +++ b/Project Reboot 3.0/Actor.cpp @@ -205,6 +205,28 @@ bool AActor::IsPendingKillPending() return IsActorBeingDestroyed() || !IsValidChecked(this); } +UObject* AActor::AddComponentByClass(UClass* Class) +{ + struct + { + UClass* Class; + bool bManualAttachment; + FTransform RelativeTransform; + bool bDeferredFinish; + UObject* ReturnValue; + } params; + params.Class = Class; + params.bManualAttachment = false; + params.RelativeTransform = FTransform(); + params.bDeferredFinish = true; + + static UFunction* AddComp = FindObject("/Script/Engine.Actor:AddComponentByClass"); + + this->ProcessEvent(AddComp, ¶ms); + + return params.ReturnValue; +} + float& AActor::GetNetUpdateFrequency() { static auto NetUpdateFrequencyOffset = GetOffset("NetUpdateFrequency"); diff --git a/Project Reboot 3.0/Actor.h b/Project Reboot 3.0/Actor.h index 2c48346..fceac71 100644 --- a/Project Reboot 3.0/Actor.h +++ b/Project Reboot 3.0/Actor.h @@ -48,6 +48,7 @@ public: void ForceNetUpdate(); bool IsNetStartupActor(); bool IsPendingKillPending(); + UObject* AddComponentByClass(UClass* Class); float& GetNetUpdateFrequency(); float& GetMinNetUpdateFrequency(); const AActor* GetNetOwner() const; diff --git a/Project Reboot 3.0/GameModeBase.cpp b/Project Reboot 3.0/GameModeBase.cpp index a4d1521..19a1217 100644 --- a/Project Reboot 3.0/GameModeBase.cpp +++ b/Project Reboot 3.0/GameModeBase.cpp @@ -159,7 +159,20 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll auto& StartingItems = ((AFortGameModeAthena*)GameMode)->GetStartingItems(); - NewPlayerAsAthena->AddPickaxeToInventory(); + if (Globals::bGoingToPlayEvent && Fortnite_Version >= 16.00) + { + auto WID = Cast(FindObject("WID_EventMode_Activator", nullptr, ANY_PACKAGE)); // Empty Hands + + bool bShouldUpdate = false; + WorldInventory->AddItem(WID, &bShouldUpdate, 1); + + if (bShouldUpdate) + WorldInventory->Update(); + } + else + { + NewPlayerAsAthena->AddPickaxeToInventory(); + } for (int i = 0; i < StartingItems.Num(); ++i) { diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index e385230..c3bf42c 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -211,9 +211,305 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index) static auto OnRep_ReplicatedActivePhaseIndexFn = FindObject("/Script/SpecialEventGameplayRuntime.SpecialEventScript.OnRep_ReplicatedActivePhaseIndex"); SpecialEventScript->ProcessEvent(OnRep_ReplicatedActivePhaseIndexFn); + auto ClientConnections = GetWorld()->GetNetDriver()->GetClientConnections(); + + // Rift Tour + if (Fortnite_Version == 17.30) + { + auto EventPlaylist = GetEventPlaylist(); + + struct { UObject* GameState; UObject* Playlist; FGameplayTagContainer PlaylistContextTags; } OnReadyParams{ Cast(GetWorld()->GetGameState()), EventPlaylist }; + + { + if (Index == 0) // Start of Event + { + auto MasterScripting = FindObject("/Buffet/Levels/Buffet_P.Buffet_P:PersistentLevel.BP_Event_Master_Scripting_2"); + + auto AllSatelliteDishes = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Game/Athena/Apollo/Environments/BuildingActors/Complex/Props/Apollo_Complex_Satellite_Dish_Top_01.Apollo_Complex_Satellite_Dish_Top_01_C")); + + for (int i = 0; i < AllSatelliteDishes.Num(); i++) + { + AllSatelliteDishes.At(i)->K2_DestroyActor(); + } + + MasterScripting->ProcessEvent(MasterScripting->FindFunction("EnableTheMutator")); + + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + auto CurrentController = ClientConnections.At(i)->GetPlayerController(); + + CurrentController->AddComponentByClass(FindObject("/Script/SpecialEventGameplayRuntime.FortControllerComponent_SpecialEvent")); + CurrentPawn->AddComponentByClass(FindObject("/Script/BuffetRuntime.FortSpecialRelevancyPawnAttachComponent")); + } + } + if (Index == 1) // Memories, BP_Buffet_PhaseScripting_Phase1_C + { + //EventPawn->TeleportTo(FVector(-963.630f, 25453.090f, 359392.125f), EventPawn->GetActorRotation()); + + auto Phase1Scripting = FindObject("/Buffet/Levels/Buffet_Part_3.Buffet_Part_3:PersistentLevel.BP_Buffet_PhaseScripting_Phase1_2"); + + auto TeleportRef = Phase1Scripting->Get(Phase1Scripting->GetOffset("TeleportRef")); + + //EventPawn->TeleportTo(TeleportRef->GetActorLocation(), EventPawn->GetActorRotation()); + + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + + //CurrentPawn->TeleportTo(TeleportRef->GetActorLocation(), CurrentPawn->GetActorRotation()); + + //Globals::PawnTeleportRotDefault = CurrentPawn->GetActorRotation(); + + CurrentPawn->ForceNetUpdate(); + } + } + if (Index == 2) // Slide + { + auto Script = FindObject("/Buffet/Levels/Buffet_Part_4.Buffet_Part_4.PersistentLevel.BP_Buffet_PhaseScripting_Paint_4"); + + Script->Get(Script->GetOffset("bRaceStarted")) = true; + Script->ProcessEvent(Script->FindFunction("OnRep_bRaceStarted")); + + Script->ProcessEvent(Script->FindFunction("OnReady_4E0ADA484A9A29A99CA6DD97BE645F09"), &OnReadyParams); + + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + auto CurrentController = ClientConnections.At(i)->GetPlayerController(); + + auto PlayerComponent = CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_PlayerComponent.BP_Buffet_Paint_PlayerComponent_C")); + CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_IntroTrackFinder.BP_Buffet_Paint_IntroTrackFinder_C")); + auto MovementComponent = CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_MovementComponent.BP_Buffet_Paint_MovementComponent_C")); + + PlayerComponent->Get(PlayerComponent->GetOffset("MovementComponent")) = MovementComponent; + + PlayerComponent->ProcessEvent(PlayerComponent->FindFunction("InitializePaintComponent")); + PlayerComponent->ProcessEvent(PlayerComponent->FindFunction("InitializeMovementComponent")); + } + } + if (Index == 4) // Storm King + { + auto StormScript = FindObject("/Buffet/Levels/Buffet_Part_6.Buffet_Part_6:PersistentLevel.BP_Buffet_PhaseScripting_4"); + + auto DefaultPlane = FindObject("/Buffet/Gameplay/Blueprints/WolfMother/BP_PlanePrototype.Default__BP_PlanePrototype_C"); + + { + auto WID = Cast(FindObject("WID_Buffet_BeatMatchingBoomBox", nullptr, ANY_PACKAGE)); // Storm King weapon thing + + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + auto CurrentController = (AFortPlayerControllerAthena*)ClientConnections.At(i)->GetPlayerController(); + + auto WorldInventory = CurrentController->GetWorldInventory(); + + bool bShouldUpdate = false; + WorldInventory->AddItem(WID, &bShouldUpdate, 1); + + if (bShouldUpdate) + WorldInventory->Update(); + + SendMessageToConsole(CurrentController, L"Gave WID_Buffet_BeatMatchingBoomBox!"); + } + + auto AllWeps = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Buffet/Gameplay/Blueprints/WolfMother/BeatmatchingWeapon/B_Buffet_BeatMatchingWeaponPrototype.B_Buffet_BeatMatchingWeaponPrototype_C")); + + for (int i = 0; i < AllWeps.Num(); i++) + { + auto CurrentWep = AllWeps.At(i); + + if (CurrentWep != nullptr) + { + CurrentWep->Get(CurrentWep->GetOffset("Phase4ScriptingRef")) = StormScript; + } + } + } + } + if (Index == 5) // Ariana Knocked + { + auto ReviveScripting = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Revive_2"); + + auto ManualTeleportLocation = ReviveScripting->Get(ReviveScripting->GetOffset("ManualTeleportLocation")); + + auto ManualTeleportRotation = ReviveScripting->Get(ReviveScripting->GetOffset("Manual_Teleport_Rotation")); + + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + } + } + if (Index == 6) // Ariana + { + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + + CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Stars/BP_Buffet_Stars_PlayerComponent.BP_Buffet_Stars_PlayerComponent_C")); + } + } + if (Index == 7) // Ariana Dance + { + auto ReviveScripting = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Revive_2"); + + auto ReflectScripting = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Reflect_2"); + + auto ManualTeleportRotation = ReviveScripting->Get(ReviveScripting->GetOffset("Manual_Teleport_Rotation")); + + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + + CurrentPawn->AddComponentByClass(FindObject("/BuffetPlaylist/Playlist/BuffetCharacterMovementMutatorComponent.BuffetCharacterMovementMutatorComponent_C")); + } + } + if (Index == 8) // Bubbles + { + auto BubblesScripting = FindObject("/Buffet/Levels/Buffet_Bubbles.Buffet_Bubbles:PersistentLevel.BP_Buffet_PhaseScripting_Bubble_4"); + + BubblesScripting->Get(BubblesScripting->GetOffset("bUsePlayerMovementMode")) = false; + + BubblesScripting->Get(BubblesScripting->GetOffset("FollowActor")) = FindObject("/Buffet/Levels/Buffet_Bubbles.Buffet_Bubbles:PersistentLevel.BP_Buffet_BubbleFollowActor_2"); + } + if (Index == 9) // Clouds + { + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + + auto RemoveComponent = CurrentPawn->GetComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Stars/BP_Buffet_Stars_PlayerComponent.BP_Buffet_Stars_PlayerComponent_C")); + + CurrentPawn->ProcessEvent(CurrentPawn->FindFunction("K2_DestroyComponent"), RemoveComponent); + + CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Llama/BP_Buffet_Llama_PlayerComponent.BP_Buffet_Llama_PlayerComponent_C")); + CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/PostEvent/LlamaSpeedControlComponent.LlamaSpeedControlComponent_C")); + } + } + if (Index == 10) // Escher + { + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + + CurrentPawn->TeleportTo(FVector(36.34f, 1044.07f, 504.50f), CurrentPawn->GetActorRotation()); + } + } + } + } + + if (Fortnite_Version == 18.40) + { + if (Index == 0) + { + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentController = (AFortPlayerControllerAthena*)ClientConnections.At(i)->GetPlayerController(); + + static auto StormEffectClass = FindObject(L"/Game/Athena/SafeZone/GE_OutsideSafeZoneDamage.GE_OutsideSafeZoneDamage_C"); + auto PlayerState = CurrentController->GetPlayerStateAthena(); + PlayerState->GetAbilitySystemComponent()->RemoveActiveGameplayEffectBySourceEffect(StormEffectClass, 1, PlayerState->GetAbilitySystemComponent()); + } + + auto AssultWID = Cast(FindObject("WID_Guava_Assault_AutoHigh_Athena_SR_Ore_T03", nullptr, ANY_PACKAGE)); + auto RevolveWID = Cast(FindObject("WID_Guava_Pistol_SixShooter_Athena_SR_Ore_T03", nullptr, ANY_PACKAGE)); + + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + auto CurrentController = (AFortPlayerControllerAthena*)ClientConnections.At(i)->GetPlayerController(); + + auto WorldInventory = CurrentController->GetWorldInventory(); + + bool bShouldUpdate = true; + WorldInventory->AddItem(AssultWID, &bShouldUpdate, 1); + WorldInventory->AddItem(RevolveWID, &bShouldUpdate, 1); + + + if (bShouldUpdate) + WorldInventory->Update(); + + SendMessageToConsole(CurrentController, L"Gave Event Weapons!"); + } + + auto AllSatelliteDishes = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Game/Athena/Apollo/Environments/BuildingActors/Complex/Props/Apollo_Complex_Satellite_Dish_Top_01.Apollo_Complex_Satellite_Dish_Top_01_C")); + + for (int i = 0; i < AllSatelliteDishes.Num(); i++) + { + AllSatelliteDishes.At(i)->K2_DestroyActor(); + } + } + } + return ActivatePhaseAtIndexOriginal(SpecialEventScript, Index); } +static void (*AttemptFinishPhaseOriginal)(AActor* SpecialEventScript, FGameplayTag PhaseTag); +void AttemptFinishPhaseHook(AActor* SpecialEventScript, FGameplayTag PhaseTag) +{ + LOG_INFO(LogDev, "SpecialEventScript::AttemptFinishPhase PhaseTag: {}", PhaseTag.TagName.ToString()); + + static auto ReplicatedActivePhaseIndexOffset = SpecialEventScript->GetOffset("ReplicatedActivePhaseIndex"); // Sets what Map/Phase were replicating to clients. + auto LastTag = PhaseTag.TagName.ToString(); + + static auto OnRep_ReplicatedActivePhaseIndexFn = FindObject("/Script/SpecialEventGameplayRuntime.SpecialEventScript.OnRep_ReplicatedActivePhaseIndex"); + + auto Connections = GetWorld()->GetNetDriver()->GetClientConnections(); + + if (LastTag == "Kiwi.Phase.Islands") // PrisonBlocks (Event Start) + { + SpecialEventScript->Get(ReplicatedActivePhaseIndexOffset) = 1; + + for (int i = 0; i < Connections.Num(); i++) + { + auto CurrentPawn = Cast(Connections.At(i)->GetPlayerController()->GetPawn()); + + CurrentPawn->TeleportTo(FVector(34640.0f, 32350.0f, 100600.0f), CurrentPawn->GetActorRotation()); + + CurrentPawn->ServerChoosePart(EFortCustomPartType::Backpack, FindObject("/Kiwi/Gameplay/Blueprints/Backpack/CP_Backpack_Kiwi.CP_Backpack_Kiwi")); + } + } + if (LastTag == "Kiwi.Phase.Prison") // Kevin + { + SpecialEventScript->Get(ReplicatedActivePhaseIndexOffset) = 2; + } + if (LastTag == "Kiwi.Phase.ObservationRoom") // Hangar + { + SpecialEventScript->Get(ReplicatedActivePhaseIndexOffset) = 3; + } + if (LastTag == "Kiwi.Phase.Hanger") // Ending + { + SpecialEventScript->Get(ReplicatedActivePhaseIndexOffset) = 4; + } + SpecialEventScript->ProcessEvent(OnRep_ReplicatedActivePhaseIndexFn); + + return AttemptFinishPhaseOriginal(SpecialEventScript, PhaseTag); +} + +// Used to teleport the pawn in some events, not used in all parts of rift tour for some reason. +static void (*TeleportPlayerPawnOriginal)(UObject* Context, FFrame& Stack, void* Ret); +void TeleportPlayerPawnHook(UObject* Context, FFrame& Stack, void* Ret) +{ + LOG_INFO(LogEvent, "Teleported PlayerPawn!"); + + UObject* WorldContextObject; + AFortPlayerPawn* PlayerPawn; //(Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + FVector DestLocation; //(Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + FRotator DestRotation; //(Parm, ZeroConstructor, IsPlainOldData, NoDestructor, NativeAccessSpecifierPublic) + bool bIgnoreCollision; //(Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + bool bIgnoreSupplementalKillVolumeSweep; //(Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + + Stack.StepCompiledIn(&WorldContextObject); + Stack.StepCompiledIn(&PlayerPawn); + Stack.StepCompiledIn(&DestLocation); + Stack.StepCompiledIn(&DestRotation); + Stack.StepCompiledIn(&bIgnoreCollision); + Stack.StepCompiledIn(&bIgnoreSupplementalKillVolumeSweep); + + PlayerPawn->TeleportTo(DestLocation, DestRotation); + + return TeleportPlayerPawnOriginal(Context, Stack, Ret); +} + static __int64 (*FlowStep_SetPhaseToActiveOriginal)(AActor* SpecialEventPhase); __int64 FlowStep_SetPhaseToActiveHook(AActor* SpecialEventPhase) @@ -297,14 +593,17 @@ void ChangeLevels() } else { - if (FindGIsServer()) + if (Fortnite_Version != 18.10) { - *(bool*)FindGIsServer() = true; - } + if (FindGIsServer()) + { + *(bool*)FindGIsServer() = true; + } - if (FindGIsClient()) - { - *(bool*)FindGIsClient() = false; + if (FindGIsClient()) + { + *(bool*)FindGIsClient() = false; + } } if (bShouldRemoveLocalPlayer) @@ -523,7 +822,8 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3E5496C), (PVOID)ReturnTrueHook, nullptr); // 7FF638A0496C Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3E54A68), (PVOID)ReturnTrueHook, nullptr); // 7FF638A04A68 // Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + ), (PVOID)ReturnFalseHook, nullptr); - Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3E4D768), (PVOID)ActivatePhaseAtIndexHook, (PVOID*)&ActivatePhaseAtIndexOriginal); // 07FF6389FD768 + Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3E4D768), (PVOID)ActivatePhaseAtIndexHook, (PVOID*)&ActivatePhaseAtIndexOriginal); // 07FF6389FD768 + Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3E4DFA4), (PVOID)AttemptFinishPhaseHook, (PVOID*)&AttemptFinishPhaseOriginal); } else if (Fortnite_Version == 18.40) { @@ -535,6 +835,24 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x41624C8), (PVOID)ActivatePhaseAtIndexHook, (PVOID*)&ActivatePhaseAtIndexOriginal); // 7FF79E3E24C8 } + if (Globals::bGoingToPlayEvent) + { + if (Fortnite_Version >= 17.30) + { + Hooking::MinHook::Hook(FindObject("/Script/FortniteGame.Default__FortMissionLibrary"), FindObject(L"/Script/FortniteGame.FortMissionLibrary:TeleportPlayerPawn"), TeleportPlayerPawnHook, + (PVOID*)&TeleportPlayerPawnOriginal, false, true); + } + } + + if (Fortnite_Version >= 17.00) // Fixes random crash that happens a couple minutes after server starts for s17+ + { + uintptr_t ServerCrashFix = Memcury::Scanner::FindPattern("48 89 5C 24 10 48 89 6C 24 20 56 57 41 54 41 56 41 57 48 81 EC ? ? ? ? 65 48 8B 04 25 ? ? ? ? 4C 8B F9").Get(); + + LOG_INFO(LogDev, "ServerCrashFix: 0x{:x}", ServerCrashFix); + + Hooking::MinHook::Hook((PVOID)ServerCrashFix, (PVOID)ReturnFalseHook, nullptr); + } + /* if (Fortnite_Version == 6.21) diff --git a/Project Reboot 3.0/events.h b/Project Reboot 3.0/events.h index 0068514..a98e8d5 100644 --- a/Project Reboot 3.0/events.h +++ b/Project Reboot 3.0/events.h @@ -756,6 +756,42 @@ static inline void StartEvent() auto SpecialEventScriptMeshActorClass = FindObject("/Script/SpecialEventGameplayRuntime.SpecialEventScriptMeshActor"); auto AllSpecialEventScriptMeshActors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), SpecialEventScriptMeshActorClass); + if (Fortnite_Version == 17.50) + { + auto Scripting = FindObject("/Kiwi/Levels/Kiwi_P.Kiwi_P:PersistentLevel.BP_Kiwi_Master_Scripting_2"); + + float SecondsSinceEventBegan = 0; + + auto EventPlaylist = GetEventPlaylist(); + + struct { UObject* GameState; UObject* Playlist; FGameplayTagContainer PlaylistContextTags; } OnReadyParams{ Cast(GetWorld()->GetGameState()), EventPlaylist }; + if (EventPlaylist) + { + static auto GameplayTagContainerOffset = EventPlaylist->GetOffset("GameplayTagContainer"); + OnReadyParams.PlaylistContextTags = EventPlaylist->Get(GameplayTagContainerOffset); + } + else + { + OnReadyParams.PlaylistContextTags = FGameplayTagContainer(); + } + auto BB = FindObject("/Kiwi/Gameplay/BP_Kiwi_Master_Scripting.BP_Kiwi_Master_Scripting_C.OnReady_F1A32853487CB7603278E6847A5F2625"); + Scripting->ProcessEvent(BB, &OnReadyParams); + + auto eventscript = FindObject("/Kiwi/Levels/Kiwi_P.Kiwi_P:PersistentLevel.Kiwi_EventScript_2"); + auto CC = FindObject("/Kiwi/Gameplay/Kiwi_EventScript.Kiwi_EventScript_C.OnReady_F51BF8E143832CE6C552938B26BEFA93"); + auto DD = FindObject("/Kiwi/Gameplay/Kiwi_EventScript.Kiwi_EventScript_C.LoadKiwiAssets"); + auto StartEventAtIndex = FindObject("/Script/SpecialEventGameplayRuntime.SpecialEventScript.StartEventAtIndex"); + auto BP_OnScriptReady = FindObject("/Kiwi/Gameplay/Kiwi_EventScript.Kiwi_EventScript_C.BP_OnScriptReady"); + + // eventscript->ProcessEvent(CC, &bbparms); + eventscript->ProcessEvent(DD, &OnReadyParams); + eventscript->ProcessEvent(BP_OnScriptReady, &OnReadyParams); + eventscript->ProcessEvent(StartEventAtIndex, &SecondsSinceEventBegan); + + static auto StartEvent = FindObject("/Kiwi/Gameplay/BP_Kiwi_Master_Scripting.BP_Kiwi_Master_Scripting_C.startevent"); + Scripting->ProcessEvent(StartEvent, &SecondsSinceEventBegan); + } + if (AllSpecialEventScriptMeshActors.Num() > 0) { auto SpecialEventScriptMeshActor = AllSpecialEventScriptMeshActors.at(0); diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index d59e684..b5df0ec 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -347,6 +347,9 @@ static inline uint64 FindInitHost() if (!addr) // s18 addr = Memcury::Scanner::FindPattern("48 8B C4 48 89 58 10 48 89 70 18 48 89 78 20 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 48 8B F1 4C 8D 35 ? ? ? ? 4D").Get(); + if (Fortnite_Version == 18.10) + addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 55 57 41 56 48 8D 6C 24 ? 48 81 EC ? ? ? ? 48 8B F1 48 8D 1D ? ? ? ? 4C 8B C3 48 8D 4D D7 45").Get(); + return addr; } diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index cc57bb3..bb1b4e0 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -902,6 +902,23 @@ static inline void MainUI() StartEvent(); } + if (Fortnite_Version == 18.40) + { + if (ImGui::Button("Remove Storm Effect")) + { + auto ClientConnections = GetWorld()->GetNetDriver()->GetClientConnections(); + + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentController = (AFortPlayerControllerAthena*)ClientConnections.At(i)->GetPlayerController(); + + static auto StormEffectClass = FindObject(L"/Game/Athena/SafeZone/GE_OutsideSafeZoneDamage.GE_OutsideSafeZoneDamage_C"); + auto PlayerState = CurrentController->GetPlayerStateAthena(); + PlayerState->GetAbilitySystemComponent()->RemoveActiveGameplayEffectBySourceEffect(StormEffectClass, 1, PlayerState->GetAbilitySystemComponent()); + } + } + } + if (Fortnite_Version == 8.51) { if (ImGui::Button("Unvault DrumGun")) From 7a138e9519608bf33c6726baf18c0e8a16ebb166 Mon Sep 17 00:00:00 2001 From: Twin1 <64933300+Twin1dev@users.noreply.github.com> Date: Thu, 15 Feb 2024 23:55:34 -0600 Subject: [PATCH 03/14] add back 9.41 event --- Project Reboot 3.0/events.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Project Reboot 3.0/events.h b/Project Reboot 3.0/events.h index a98e8d5..143c663 100644 --- a/Project Reboot 3.0/events.h +++ b/Project Reboot 3.0/events.h @@ -185,6 +185,34 @@ static inline std::vector Events = false ), Event + ( + "The Showdown", + "/Game/Athena/Prototype/Blueprints/Cattus/BP_CattusDoggus_Scripting.BP_CattusDoggus_Scripting_C", + "/Game/Athena/Prototype/Blueprints/Cattus/BP_CattusDoggus_Scripting.BP_CattusDoggus_Scripting_C.LoadCattusLevel", + 1, + { + { + true, + "/Game/Athena/Prototype/Blueprints/Cattus/BP_CattusDoggus_Scripting.BP_CattusDoggus_Scripting_C.OnReady_C11CA7624A74FBAEC54753A3C2BD4506" + } + }, + { + { + { + true, + "/Game/Athena/Prototype/Blueprints/Cattus/BP_CattusDoggus_Scripting.BP_CattusDoggus_Scripting_C.startevent" + }, + + 0 + } + }, + + "/Game/Athena/Prototype/Blueprints/Cattus/BP_CattusDoggus_Scripting.BP_CattusDoggus_Scripting_C", + "/Game/Athena/Playlists/Music/Playlist_Music_High.Playlist_Music_High", + 9.41, + false + ), + Event ( "The Unvaulting", "/Game/Athena/Prototype/Blueprints/White/BP_SnowScripting.BP_SnowScripting_C", @@ -860,4 +888,4 @@ static inline bool DoesEventRequireLoading() } return false; -} \ No newline at end of file +} From 914d4746a4691a85cafbe59ee78f86f82c578628 Mon Sep 17 00:00:00 2001 From: Weyn <105912992+Weynbtw@users.noreply.github.com> Date: Thu, 7 Mar 2024 16:58:41 +0100 Subject: [PATCH 04/14] 15.00 & 15.10 storm crashing fix --- Project Reboot 3.0/extra.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project Reboot 3.0/extra.cpp b/Project Reboot 3.0/extra.cpp index 0929dde..38d3afc 100644 --- a/Project Reboot 3.0/extra.cpp +++ b/Project Reboot 3.0/extra.cpp @@ -4,7 +4,7 @@ void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int OverridePhaseMaybeIDFK) { - static auto ZoneDurationsOffset = Fortnite_Version >= 15 && Fortnite_Version < 18 ? 0x258 + static auto ZoneDurationsOffset = Fortnite_Version >= 15.20 && Fortnite_Version < 18 ? 0x258 : std::floor(Fortnite_Version) >= 18 ? 0x248 : 0x1F8; // S13-S14 @@ -170,4 +170,4 @@ void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int OverridePhaseMa else LOG_WARN(LogZone, "Invalid SafeZoneIndicator!"); } -} \ No newline at end of file +} From be2fc81942e66aad173ba05aef269453bd3844ef Mon Sep 17 00:00:00 2001 From: Gray <84999745+Milxnor@users.noreply.github.com> Date: Fri, 8 Mar 2024 18:16:32 -0500 Subject: [PATCH 05/14] blow up --- Project Reboot 3.0/Controller.cpp | 6 +++ Project Reboot 3.0/Controller.h | 1 + Project Reboot 3.0/FortAthenaVehicle.cpp | 2 + Project Reboot 3.0/FortGameModeAthena.cpp | 2 + Project Reboot 3.0/FortPlayerController.cpp | 50 +++++-------------- .../FortPlayerControllerAthena.cpp | 7 +++ Project Reboot 3.0/PlayerController.cpp | 7 +++ Project Reboot 3.0/PlayerController.h | 1 + Project Reboot 3.0/dllmain.cpp | 5 +- 9 files changed, 43 insertions(+), 38 deletions(-) diff --git a/Project Reboot 3.0/Controller.cpp b/Project Reboot 3.0/Controller.cpp index 7eedeab..267020b 100644 --- a/Project Reboot 3.0/Controller.cpp +++ b/Project Reboot 3.0/Controller.cpp @@ -14,4 +14,10 @@ void AController::Possess(class APawn* Pawn) { auto PossessFn = FindFunction("Possess"); this->ProcessEvent(PossessFn, &Pawn); +} + +void AController::UnPossess() +{ + auto UnPossessFn = FindFunction("UnPossess"); + this->ProcessEvent(UnPossessFn); } \ No newline at end of file diff --git a/Project Reboot 3.0/Controller.h b/Project Reboot 3.0/Controller.h index 52a1422..ec09160 100644 --- a/Project Reboot 3.0/Controller.h +++ b/Project Reboot 3.0/Controller.h @@ -7,6 +7,7 @@ class AController : public AActor public: AActor* GetViewTarget(); void Possess(class APawn* Pawn); + void UnPossess(); FName& GetStateName() { diff --git a/Project Reboot 3.0/FortAthenaVehicle.cpp b/Project Reboot 3.0/FortAthenaVehicle.cpp index d69505b..b0e7088 100644 --- a/Project Reboot 3.0/FortAthenaVehicle.cpp +++ b/Project Reboot 3.0/FortAthenaVehicle.cpp @@ -27,6 +27,8 @@ UFortWeaponItemDefinition* AFortAthenaVehicle::GetVehicleWeaponForSeat(int SeatI static auto WeaponSeatDefinitionsOffset = WeaponComponent->GetOffset("WeaponSeatDefinitions"); auto& WeaponSeatDefinitions = WeaponComponent->Get>(WeaponSeatDefinitionsOffset); + // VehicleWeaponDefinition = *(UFortWeaponItemDefinition**)(__int64(WeaponSeatDefinitions.at(SeatIdx)) + VehicleWeaponOffset); + for (int i = 0; i < WeaponSeatDefinitions.Num(); i++) { auto WeaponSeat = WeaponSeatDefinitions.AtPtr(i, WeaponSeatDefinitionStructSize); diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index 1eda51f..9065cb3 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -65,6 +65,8 @@ static UFortPlaylistAthena* GetPlaylistToUse() if (Globals::bCreative) Playlist = FindObject(L"/Game/Athena/Playlists/Creative/Playlist_PlaygroundV2.Playlist_PlaygroundV2"); + // Playlist = FindObject(L"/Game/Athena/Playlists/Respawn/Variants/Respawn_Vamp/Playlist_Respawn_Vamp_Solo.Playlist_Respawn_Vamp_Solo"); + return Playlist; } diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index b040ccc..3099d43 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -499,54 +499,30 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame* if (!WorldInventory) return; - auto NewAndModifiedInstances = WorldInventory->AddItem(VehicleWeaponDefinition, nullptr); + auto NewAndModifiedInstances = WorldInventory->AddItem(VehicleWeaponDefinition, nullptr, 1, 9999); + auto NewVehicleInstance = NewAndModifiedInstances.first[0]; if (!NewVehicleInstance) return; - WorldInventory->Update(); + static auto FortItemEntrySize = FFortItemEntry::GetStructSize(); - auto VehicleWeapon = Pawn->EquipWeaponDefinition(VehicleWeaponDefinition, NewVehicleInstance->GetItemEntry()->GetItemGuid()); - // PlayerController->ServerExecuteInventoryItemHook(PlayerController, newitem->GetItemEntry()->GetItemGuid()); + auto& ReplicatedEntries = WorldInventory->GetItemList().GetReplicatedEntries(); - /* static auto GetSeatWeaponComponentFn = FindObject("/Script/FortniteGame.FortAthenaVehicle.GetSeatWeaponComponent"); - - if (GetSeatWeaponComponentFn) + for (int i = 0; i < ReplicatedEntries.Num(); i++) { - struct { int SeatIndex; UObject* ReturnValue; } AFortAthenaVehicle_GetSeatWeaponComponent_Params{}; + auto ReplicatedEntry = ReplicatedEntries.AtPtr(i, FortItemEntrySize); - Vehicle->ProcessEvent(GetSeatWeaponComponentFn, &AFortAthenaVehicle_GetSeatWeaponComponent_Params); - - UObject* WeaponComponent = AFortAthenaVehicle_GetSeatWeaponComponent_Params.ReturnValue; - - if (!WeaponComponent) - return; - - static auto WeaponSeatDefinitionStructSize = FindObject("/Script/FortniteGame.WeaponSeatDefinition")->GetPropertiesSize(); - static auto VehicleWeaponOffset = FindOffsetStruct("/Script/FortniteGame.WeaponSeatDefinition", "VehicleWeapon"); - static auto SeatIndexOffset = FindOffsetStruct("/Script/FortniteGame.WeaponSeatDefinition", "SeatIndex"); - static auto WeaponSeatDefinitionsOffset = WeaponComponent->GetOffset("WeaponSeatDefinitions"); - auto& WeaponSeatDefinitions = WeaponComponent->Get>(WeaponSeatDefinitionsOffset); - - for (int i = 0; i < WeaponSeatDefinitions.Num(); ++i) + if (ReplicatedEntry->GetItemGuid() == NewVehicleInstance->GetItemEntry()->GetItemGuid()) { - auto WeaponSeat = WeaponSeatDefinitions.AtPtr(i, WeaponSeatDefinitionStructSize); + WorldInventory->GetItemList().MarkItemDirty(ReplicatedEntry); + WorldInventory->GetItemList().MarkItemDirty(NewVehicleInstance->GetItemEntry()); + WorldInventory->HandleInventoryLocalUpdate(); - if (*(int*)(__int64(WeaponSeat) + SeatIndexOffset) != Vehicle->FindSeatIndex(Pawn)) - continue; - - auto VehicleGrantedWeaponItem = (TWeakObjectPtr*)(__int64(WeaponSeat) + 0x20); - - VehicleGrantedWeaponItem->ObjectIndex = NewVehicleInstance->InternalIndex; - VehicleGrantedWeaponItem->ObjectSerialNumber = GetItemByIndex(NewVehicleInstance->InternalIndex)->SerialNumber; - - static auto bWeaponEquippedOffset = WeaponComponent->GetOffset("bWeaponEquipped"); - WeaponComponent->Get(bWeaponEquippedOffset) = true; - - break; + PlayerController->ServerExecuteInventoryItemHook(PlayerController, NewVehicleInstance->GetItemEntry()->GetItemGuid()); } - } */ + } return; } @@ -776,7 +752,7 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* { if (false) { - // honestly idk why this doesnt work + // honestly idk why this doesnt work ( ithink its suppsoed to be spectator) auto NAME_Inactive = UKismetStringLibrary::Conv_StringToName(L"NAME_Inactive"); diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.cpp b/Project Reboot 3.0/FortPlayerControllerAthena.cpp index 0022705..bac31f0 100644 --- a/Project Reboot 3.0/FortPlayerControllerAthena.cpp +++ b/Project Reboot 3.0/FortPlayerControllerAthena.cpp @@ -334,6 +334,13 @@ void AFortPlayerControllerAthena::ServerRestartPlayerHook(AFortPlayerControllerA static auto ZoneServerRestartPlayer = __int64(FortPlayerControllerZoneDefault->VFTable[GetFunctionIdxOrPtr(ServerRestartPlayerFn) / 8]); static void (*ZoneServerRestartPlayerOriginal)(AFortPlayerController*) = decltype(ZoneServerRestartPlayerOriginal)(__int64(ZoneServerRestartPlayer)); + // auto NAME_Spectating = UKismetStringLibrary::Conv_StringToName(L"NAME_Spectating"); + + // LOG_INFO(LogDev, "ISplayerwaiting: {}", Controller->IsPlayerWaiting()); + + // Controller->GetStateName() = NAME_Spectating; + // Controller->SetPlayerIsWaiting(true); + LOG_INFO(LogDev, "ServerRestartPlayerHook Call 0x{:x} returning with 0x{:x}!", ZoneServerRestartPlayer - __int64(_ReturnAddress()), __int64(ZoneServerRestartPlayerOriginal) - __int64(GetModuleHandleW(0))); return ZoneServerRestartPlayerOriginal(Controller); } diff --git a/Project Reboot 3.0/PlayerController.cpp b/Project Reboot 3.0/PlayerController.cpp index 8993917..db2dfae 100644 --- a/Project Reboot 3.0/PlayerController.cpp +++ b/Project Reboot 3.0/PlayerController.cpp @@ -16,6 +16,13 @@ void APlayerController::SetPlayerIsWaiting(bool NewValue) this->SetBitfieldValue(bPlayerIsWaitingOffset, bPlayerIsWaitingFieldMask, NewValue); } +bool APlayerController::IsPlayerWaiting() +{ + static auto bPlayerIsWaitingOffset = GetOffset("bPlayerIsWaiting"); + static auto bPlayerIsWaitingFieldMask = GetFieldMask(this->GetProperty("bPlayerIsWaiting")); + return this->ReadBitfieldValue(bPlayerIsWaitingOffset, bPlayerIsWaitingFieldMask); +} + UCheatManager*& APlayerController::SpawnCheatManager(UClass* CheatManagerClass) { GetCheatManager() = UGameplayStatics::SpawnObject(CheatManagerClass, this, true); diff --git a/Project Reboot 3.0/PlayerController.h b/Project Reboot 3.0/PlayerController.h index 7625905..ae61bae 100644 --- a/Project Reboot 3.0/PlayerController.h +++ b/Project Reboot 3.0/PlayerController.h @@ -23,6 +23,7 @@ public: } void SetPlayerIsWaiting(bool NewValue); + bool IsPlayerWaiting(); void ServerChangeName(FString& S); UCheatManager*& SpawnCheatManager(UClass* CheatManagerClass); FRotator GetControlRotation(); diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index c3bf42c..2ff6591 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -79,6 +79,7 @@ static ENetMode GetNetModeHook2() { return NetMode; } static bool ReturnTrueHook() { return true; } static bool ReturnFalseHook() { return false; } static int Return2Hook() { return 2; } +static void EmptyHook() { return; } static bool NoMCPHook() { return Globals::bNoMCP; } static void CollectGarbageHook() { return; } @@ -305,7 +306,7 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index) auto WorldInventory = CurrentController->GetWorldInventory(); bool bShouldUpdate = false; - WorldInventory->AddItem(WID, &bShouldUpdate, 1); + WorldInventory->AddItem(WID, &bShouldUpdate, 1, 9999); if (bShouldUpdate) WorldInventory->Update(); @@ -808,6 +809,8 @@ DWORD WINAPI Main(LPVOID) if (Fortnite_Version == 17.30) // Rift Tour stuff { + auto busCrash = Hooking::MinHook::Hook(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 54 41 56 41 57 48 83 EC 40 48 8B 59 28 45 33 E4").GetAs(), (PVOID)EmptyHook); + Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3E07910), (PVOID)GetMeshNetworkNodeTypeHook, nullptr); Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3DED158), (PVOID)ReturnTrueHook, nullptr); // 7FF7E556D158 Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3DECFC8), (PVOID)ReturnTrueHook, nullptr); // 7FF7E556CFC8 From ec515a12023c29a504dea8455d4e7a942ea8bf6a Mon Sep 17 00:00:00 2001 From: Gray <84999745+Milxnor@users.noreply.github.com> Date: Sat, 9 Mar 2024 14:31:03 -0500 Subject: [PATCH 06/14] Fixed GIsClient (BIG) --- Project Reboot 3.0/FortGameModeAthena.cpp | 11 ++- Project Reboot 3.0/FortPlayerController.cpp | 6 +- .../Project Reboot 3.0.vcxproj.filters | 4 +- Project Reboot 3.0/finder.cpp | 84 +++++++++++++++++++ Project Reboot 3.0/finder.h | 78 +---------------- Project Reboot 3.0/gui.h | 7 +- vendor/memcury.h | 8 +- 7 files changed, 112 insertions(+), 86 deletions(-) diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index 9065cb3..ca872d6 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -547,7 +547,16 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game ShowFoundation(FindObject(L"/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Lobby_Foundation3")); // Aircraft Carrier } - auto TheBlock = FindObject(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.SLAB_2"); // SLAB_3 is blank + AActor* TheBlock = nullptr; + + if (Fortnite_Version > 10) // todo only checked on 10.40 + { + TheBlock = FindObject(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.SLAB_4"); + } + else + { + TheBlock = FindObject(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.SLAB_2"); // SLAB_3 is blank + } if (TheBlock) ShowFoundation(TheBlock); diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 3099d43..0eef95f 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -429,9 +429,6 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame* static auto ReceivingActorOffset = FindOffsetStruct(StructName, "ReceivingActor"); auto ReceivingActor = *(AActor**)(__int64(Params) + ReceivingActorOffset); - static auto InteractionBeingAttemptedOffset = FindOffsetStruct(StructName, "InteractionBeingAttempted"); - auto InteractionBeingAttempted = *(EInteractionBeingAttempted*)(__int64(Params) + InteractionBeingAttemptedOffset); - // LOG_INFO(LogInteraction, "ReceivingActor: {}", __int64(ReceivingActor)); if (!ReceivingActor) @@ -530,6 +527,9 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame* { if (Engine_Version >= 424 && Fortnite_Version < 15 && ReceivingActor->GetFullName().contains("Wumba")) { + static auto InteractionBeingAttemptedOffset = FindOffsetStruct(StructName, "InteractionBeingAttempted"); + auto InteractionBeingAttempted = *(EInteractionBeingAttempted*)(__int64(Params) + InteractionBeingAttemptedOffset); + bool bIsSidegrading = InteractionBeingAttempted == EInteractionBeingAttempted::SecondInteraction ? true : false; LOG_INFO(LogDev, "bIsSidegrading: {}", (bool)bIsSidegrading); 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 62285ea..5311c96 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters @@ -307,7 +307,6 @@ - Engine\Source\Runtime\Core\Public\Containers @@ -960,6 +959,9 @@ FortniteGame\Source\FortniteGame\Public + + Reboot\Public + diff --git a/Project Reboot 3.0/finder.cpp b/Project Reboot 3.0/finder.cpp index ac42fd7..69bac66 100644 --- a/Project Reboot 3.0/finder.cpp +++ b/Project Reboot 3.0/finder.cpp @@ -44,6 +44,90 @@ uint64 FindStartAircraftPhase() return 0; } +uint64 FindGIsClient() +{ + /* if (Fortnite_Version >= 20) + return 0; */ + + auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering"); + + std::vector> BytesArray = { + // {0x88, 0x05}, // Idk what version this is + {0xC6, 0x05}, // mov cs X // Checked on 1.11, 12.41 + {0x88, 0x1D}, // mov cs bl // Checked on 17.50, 19.10 + // {0x44, 0x88} // IDK WHAT VERSION This for but it scuffs older builds + }; + + int Skip = Engine_Version <= 420 ? 1 : 2; // Skip GIsServer and some variable i forgot + + uint64 Addy; + + for (int i = 0; i < 50; i++) // we should subtract from skip if go up + { + auto CurrentByte = *(Memcury::ASM::MNEMONIC*)(Addr.Get() - i); + + // if (bPrint) + // std::cout << "CurrentByte: " << std::hex << (int)CurrentByte << '\n'; + + bool ShouldBreak = false; + + // LOG_INFO(LogDev, "[{}] Byte: 0x{:x}", i, (int)CurrentByte); + + for (auto& Bytes : BytesArray) + { + if (CurrentByte == Bytes[0]) + { + bool Found = true; + for (int j = 1; j < Bytes.size(); j++) + { + if (*(Memcury::ASM::MNEMONIC*)(Addr.Get() - i + j) != Bytes[j]) + { + Found = false; + break; + } + } + if (Found) + { + int Relative = Bytes[0] == 0x44 ? 3 : 2; + auto current = Memcury::Scanner(Addr.Get() - i); + // LOG_INFO(LogDev, "[{}] No Rel 0x{:x} Rel: 0x{:x}", Skip, current.Get() - __int64(GetModuleHandleW(0)), Memcury::Scanner(Addr.Get() - i).RelativeOffset(Relative).Get() - __int64(GetModuleHandleW(0))); + + if (Skip > 0) + { + Skip--; + continue; + } + + Addy = Bytes[0] == 0xC6 + ? current.RelativeOffset(Relative, 1).Get() // If mov cs then we add 1 because the last byte is the value and makes whole instructions 1 byte longer + : current.RelativeOffset(Relative).Get(); + ShouldBreak = true; + break; + } + } + } + + if (ShouldBreak) + break; + + // std::cout << std::format("CurrentByte: 0x{:x}\n", (uint8_t)CurrentByte); + } + + // LOG_INFO(LogDev, "Addy: 0x{:x}", Addy - __int64(GetModuleHandleW(0))); + + return Addy; // 0; // Memcury::Scanner(Addy3).RelativeOffset(2).Get(); + + /* + auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering"); + int Skip = 1; + auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, Skip); + Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, Skip); + Addy = Addy ? Addy : FindBytes(Addr, { 0x88, 0x1D }, 50, 0, true, Skip); + + return Memcury::Scanner(Addy).RelativeOffset(2).Get(); + */ +} + uint64 FindGetSessionInterface() { auto strRef = Memcury::Scanner::FindStringRef(L"OnDestroyReservedSessionComplete %s bSuccess: %d", true, 0, Fortnite_Version >= 19).Get(); diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index b5df0ec..d993c6f 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -1109,7 +1109,7 @@ static inline uint64 FindCollectGarbage() static inline uint64 FindActorGetNetMode() { - // return 0; + return 0; // We *shouldnt* need to hook this now because I fixed FindGIsClient if (Engine_Version == 500) // hah well this and 427 does like nothing cuz inline mostly { @@ -1463,81 +1463,7 @@ static inline uint64 FindMcpIsDedicatedServerOffset() return 0x60; // 1.7.2 & 1.11 & 4.1 } -static inline uint64 FindGIsClient() -{ - /* if (Fortnite_Version >= 20) - return 0; */ - - auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering"); - - std::vector> BytesArray = { {0x88, 0x05}, {0xC6, 0x05}, {0x88, 0x1D}, {0x44, 0x88}}; - - int Skip = Engine_Version <= 420 ? 1 : 2; - - uint64 Addy; - - for (int i = 0; i < 50; i++) // we should subtract from skip if goup - { - auto CurrentByte = *(Memcury::ASM::MNEMONIC*)(Addr.Get() - i); - - // if (bPrint) - // std::cout << "CurrentByte: " << std::hex << (int)CurrentByte << '\n'; - - bool ShouldBreak = false; - - // LOG_INFO(LogDev, "[{}] Byte: 0x{:x}", i, (int)CurrentByte); - - for (auto& Bytes : BytesArray) - { - if (CurrentByte == Bytes[0]) - { - bool Found = true; - for (int j = 1; j < Bytes.size(); j++) - { - if (*(Memcury::ASM::MNEMONIC*)(Addr.Get() - i + j) != Bytes[j]) - { - Found = false; - break; - } - } - if (Found) - { - int Relative = Bytes[0] == 0x44 ? 3 : 2; - // LOG_INFO(LogDev, "[{}] No Rel 0x{:x} Rel: 0x{:x}", Skip, Memcury::Scanner(Addr.Get() - i).Get() - __int64(GetModuleHandleW(0)), Memcury::Scanner(Addr.Get() - i).RelativeOffset(Relative).Get() - __int64(GetModuleHandleW(0))); - - if (Skip > 0) - { - Skip--; - continue; - } - - Addy = Memcury::Scanner(Addr.Get() - i).RelativeOffset(Relative).Get(); - ShouldBreak = true; - break; - } - } - } - - if (ShouldBreak) - break; - - // std::cout << std::format("CurrentByte: 0x{:x}\n", (uint8_t)CurrentByte); - } - - // LOG_INFO(LogDev, "Addy: 0x{:x}", Addy - __int64(GetModuleHandleW(0))); - - return Addy; // 0; // Memcury::Scanner(Addy3).RelativeOffset(2).Get(); - - /* - auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering"); - int Skip = 1; - auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, Skip); - Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, Skip); - Addy = Addy ? Addy : FindBytes(Addr, { 0x88, 0x1D }, 50, 0, true, Skip); - - return Memcury::Scanner(Addy).RelativeOffset(2).Get(); - */ -} +uint64 FindGIsClient(); // AHHH static inline uint64 FindGetNetMode() { diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index bb1b4e0..211a235 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -110,6 +110,11 @@ static inline void SetIsLategame(bool Value) StartingShield = Value ? 100 : 0; } +static inline bool HasAnyCalendarModification() +{ + return Calendar::HasSnowModification() || Calendar::HasNYE() || std::floor(Fortnite_Version) == 13; +} + static inline void Restart() // todo move? { FString LevelA = Engine_Version < 424 @@ -378,7 +383,7 @@ static inline void MainTabs() } } - if (ImGui::BeginTabItem("Calendar Events")) + if (HasAnyCalendarModification() && ImGui::BeginTabItem("Calendar Events")) { Tab = CALENDAR_TAB; PlayerTab = -1; diff --git a/vendor/memcury.h b/vendor/memcury.h index bd14498..f691aa1 100644 --- a/vendor/memcury.h +++ b/vendor/memcury.h @@ -512,9 +512,9 @@ return _address != address._address; } - auto RelativeOffset(uint32_t offset) -> Address + auto RelativeOffset(uint32_t offset, uint32_t off2 = 0) -> Address { - _address = ((_address + offset + 4) + *(int32_t*)(_address + offset)); + _address = ((_address + offset + 4 + off2) + *(int32_t*)(_address + offset)); return *this; } @@ -1010,7 +1010,7 @@ return *this; } - auto RelativeOffset(uint32_t offset) -> Scanner + auto RelativeOffset(uint32_t offset, uint32_t off2 = 0) -> Scanner { if (!_address.Get()) { @@ -1018,7 +1018,7 @@ return *this; } - _address.RelativeOffset(offset); + _address.RelativeOffset(offset, off2); return *this; } From 1169eb80cc3d419cf79d6d0314136a37326c9ca0 Mon Sep 17 00:00:00 2001 From: Gray <84999745+Milxnor@users.noreply.github.com> Date: Sat, 9 Mar 2024 22:03:15 -0500 Subject: [PATCH 07/14] edit thing --- Project Reboot 3.0/BuildingSMActor.h | 2 +- Project Reboot 3.0/BuildingWeapons.h | 9 +++++++++ Project Reboot 3.0/FortPlayerController.cpp | 17 ++++++----------- Project Reboot 3.0/addresses.cpp | 7 ++++++- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Project Reboot 3.0/BuildingSMActor.h b/Project Reboot 3.0/BuildingSMActor.h index bcff2be..7b52424 100644 --- a/Project Reboot 3.0/BuildingSMActor.h +++ b/Project Reboot 3.0/BuildingSMActor.h @@ -55,7 +55,7 @@ public: ) { SetNetDormancy((ENetDormancy)(2 - (NewEditingPlayer != 0))); - // they do something here + this->ForceNetUpdate(); GetEditingPlayer() = NewEditingPlayer; } } diff --git a/Project Reboot 3.0/BuildingWeapons.h b/Project Reboot 3.0/BuildingWeapons.h index c8d5473..56b89fe 100644 --- a/Project Reboot 3.0/BuildingWeapons.h +++ b/Project Reboot 3.0/BuildingWeapons.h @@ -22,5 +22,14 @@ public: void OnRep_EditActor(); + void SetEditActor(ABuildingSMActor* EditActor) + { + // if (HasAuthority()) + { + GetEditActor() = EditActor; + OnRep_EditActor(); + } + } + static UClass* StaticClass(); }; \ No newline at end of file diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 0eef95f..065ebeb 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -1694,8 +1694,7 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr if (!EditTool) return; - EditTool->GetEditActor() = BuildingActorToEdit; - EditTool->OnRep_EditActor(); + EditTool->SetEditActor(BuildingActorToEdit); } void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame& Stack, void* Ret) @@ -1762,21 +1761,17 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl if (!WorldInventory) return; + BuildingActorToStopEditing->SetEditingPlayer(nullptr); + auto EditToolInstance = WorldInventory->FindItemInstance(EditToolDef); if (!EditToolInstance) return; - Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid()); + // Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid()); // ERM - auto EditTool = Cast(Pawn->GetCurrentWeapon()); - - BuildingActorToStopEditing->GetEditingPlayer() = nullptr; - // BuildingActorToStopEditing->OnRep_EditingPlayer(); - - if (EditTool) + if (auto EditTool = Cast(Pawn->GetCurrentWeapon())) { - EditTool->GetEditActor() = nullptr; - EditTool->OnRep_EditActor(); + EditTool->SetEditActor(nullptr); } } diff --git a/Project Reboot 3.0/addresses.cpp b/Project Reboot 3.0/addresses.cpp index eb97228..b39f93b 100644 --- a/Project Reboot 3.0/addresses.cpp +++ b/Project Reboot 3.0/addresses.cpp @@ -583,8 +583,13 @@ std::vector Addresses::GetFunctionsToNull() toNull.push_back(Memcury::Scanner::FindStringRef(L"Widget Class %s - Running Initialize On Archetype, %s.").ScanFor({ 0x40, 0x55 }, false).Get()); // Widget class } - if (Engine_Version == 422) + if (Engine_Version == 422 + || Engine_Version == 423 + || Engine_Version == 424 // guessed + ) { + // This sig is valid on 7.40, 8.51, 11.31 (3 refs), but on 12.41 it has 1 ref which isn't widget class + // Also this isn't the actual function but something the widget class thing calls toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 30 48 8B 41 28 48 8B DA 48 8B F9 48 85 C0 74 34 48 8B 4B 08 48 8D").Get()); // widget class } From 512fb16ee4be05b944b080b7b5c8aa8a9714c22d Mon Sep 17 00:00:00 2001 From: Gray <84999745+Milxnor@users.noreply.github.com> Date: Tue, 12 Mar 2024 19:10:18 -0400 Subject: [PATCH 08/14] more --- Project Reboot 3.0/BuildingWeapons.cpp | 2 +- Project Reboot 3.0/Channel.h | 6 + Project Reboot 3.0/FortPlayerController.cpp | 60 +++--- Project Reboot 3.0/NetConnection.h | 6 + Project Reboot 3.0/NetDriver.cpp | 221 +++++++++++++++++++- Project Reboot 3.0/Object.h | 2 +- Project Reboot 3.0/dllmain.cpp | 18 +- Project Reboot 3.0/finder.cpp | 2 +- Project Reboot 3.0/finder.h | 29 ++- Project Reboot 3.0/hooking.h | 4 +- 10 files changed, 302 insertions(+), 48 deletions(-) diff --git a/Project Reboot 3.0/BuildingWeapons.cpp b/Project Reboot 3.0/BuildingWeapons.cpp index 2c86a43..8d69779 100644 --- a/Project Reboot 3.0/BuildingWeapons.cpp +++ b/Project Reboot 3.0/BuildingWeapons.cpp @@ -4,7 +4,7 @@ void AFortWeap_EditingTool::OnRep_EditActor() { - static auto OnRep_EditActorFn = FindObject("/Script/FortniteGame.FortWeap_EditingTool.OnRep_EditActor"); + static auto OnRep_EditActorFn = FindObject(L"/Script/FortniteGame.FortWeap_EditingTool.OnRep_EditActor"); this->ProcessEvent(OnRep_EditActorFn); } diff --git a/Project Reboot 3.0/Channel.h b/Project Reboot 3.0/Channel.h index f110fd8..55acb0a 100644 --- a/Project Reboot 3.0/Channel.h +++ b/Project Reboot 3.0/Channel.h @@ -23,5 +23,11 @@ public: return ((PlaceholderBitfield*)(__int64(this) + BitfieldOffset))->Third; } + class UNetConnection*& GetConnection() + { + static auto ConnectionOffset = GetOffset("Connection"); + return *(UNetConnection**)(__int64(this) + ConnectionOffset); + } + int32 IsNetReady(bool Saturate); }; \ No newline at end of file diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 065ebeb..2b133c0 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -930,20 +930,28 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra auto MatDefinition = UFortKismetLibrary::K2_GetResourceItemDefinition(BuildingActor->GetResourceType()); - auto MatInstance = WorldInventory->FindItemInstance(MatDefinition); - bool bBuildFree = PlayerController->DoesBuildFree(); // LOG_INFO(LogDev, "MatInstance->GetItemEntry()->GetCount(): {}", MatInstance->GetItemEntry()->GetCount()); - - int MinimumMaterial = 10; - bool bShouldDestroy = MatInstance && MatInstance->GetItemEntry() ? MatInstance->GetItemEntry()->GetCount() < MinimumMaterial : true; - - if (bShouldDestroy && !bBuildFree) + + if (!bBuildFree) { - ExistingBuildings.Free(); - BuildingActor->SilentDie(); - return ServerCreateBuildingActorOriginal(Context, Stack, Ret); + int MaterialCost = 10; + + UFortItem* MatInstance = WorldInventory->FindItemInstance(MatDefinition); + + if (!MatInstance || MatInstance->GetItemEntry()->GetCount() < MaterialCost) + { + ExistingBuildings.Free(); + BuildingActor->SilentDie(); + return ServerCreateBuildingActorOriginal(Context, Stack, Ret); + } + + bool bShouldUpdate = false; + WorldInventory->RemoveItem(MatInstance->GetItemEntry()->GetItemGuid(), &bShouldUpdate, MaterialCost); + + if (bShouldUpdate) + WorldInventory->Update(); } for (int i = 0; i < ExistingBuildings.Num(); ++i) @@ -959,15 +967,6 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra BuildingActor->InitializeBuildingActor(PlayerController, BuildingActor, true); BuildingActor->SetTeam(PlayerStateAthena->GetTeamIndex()); // required? - if (!bBuildFree) - { - bool bShouldUpdate = false; - WorldInventory->RemoveItem(MatInstance->GetItemEntry()->GetItemGuid(), &bShouldUpdate, 10); - - if (bShouldUpdate) - WorldInventory->Update(); - } - /* GET_PLAYLIST(GameState); @@ -1687,9 +1686,13 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr if (!EditToolInstance) return; - Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid()); + AFortWeap_EditingTool* EditTool = nullptr; +#if 1 + EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); +#else auto EditTool = Cast(Pawn->GetCurrentWeapon()); +#endif if (!EditTool) return; @@ -1727,7 +1730,7 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame // if (!PlayerState || PlayerState->GetTeamIndex() != BuildingActorToEdit->GetTeamIndex()) //return ServerEditBuildingActorOriginal(Context, Frame, Ret); - BuildingActorToEdit->SetEditingPlayer(nullptr); + // BuildingActorToEdit->SetEditingPlayer(nullptr); // uh? static ABuildingSMActor* (*BuildingSMActorReplaceBuildingActor)(ABuildingSMActor*, __int64, UClass*, int, int, uint8_t, AFortPlayerController*) = decltype(BuildingSMActorReplaceBuildingActor)(Addresses::ReplaceBuildingActor); @@ -1761,17 +1764,26 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl if (!WorldInventory) return; - BuildingActorToStopEditing->SetEditingPlayer(nullptr); + AFortWeap_EditingTool* EditTool = nullptr; +#if 0 auto EditToolInstance = WorldInventory->FindItemInstance(EditToolDef); if (!EditToolInstance) return; - // Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid()); // ERM + EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); // ERM +#else + EditTool = Cast(Pawn->GetCurrentWeapon()); +#endif - if (auto EditTool = Cast(Pawn->GetCurrentWeapon())) + if (EditTool) { + static auto bEditConfirmedOffset = EditTool->GetOffset("bEditConfirmed"); + + if (bEditConfirmedOffset == -1) + EditTool->Get(bEditConfirmedOffset) = true; + EditTool->SetEditActor(nullptr); } } diff --git a/Project Reboot 3.0/NetConnection.h b/Project Reboot 3.0/NetConnection.h index 774b7ec..43db1cc 100644 --- a/Project Reboot 3.0/NetConnection.h +++ b/Project Reboot 3.0/NetConnection.h @@ -71,5 +71,11 @@ public: return Get>(SentTemporariesOffset); } + UObject*& GetPackageMap() + { + static auto PackageMapOffset = GetOffset("PackageMap"); + return Get(PackageMapOffset); + } + bool ClientHasInitializedLevelFor(const AActor* TestActor) const; }; \ No newline at end of file diff --git a/Project Reboot 3.0/NetDriver.cpp b/Project Reboot 3.0/NetDriver.cpp index 713c7bf..d8ba9a5 100644 --- a/Project Reboot 3.0/NetDriver.cpp +++ b/Project Reboot 3.0/NetDriver.cpp @@ -56,7 +56,9 @@ void UNetDriver::TickFlushHook(UNetDriver* NetDriver) if (Globals::bStartedListening) { - static auto ReplicationDriverOffset = NetDriver->GetOffset("ReplicationDriver", false); + static auto ReplicationDriverOffset = NetDriver->GetOffset("ReplicationDriver"/*, false */); + + // LOG_INFO(LogDev, "ReplicationDriverOffset{}", ReplicationDriverOffset); // if (ReplicationDriverOffset == -1) if (ReplicationDriverOffset == -1 || Fortnite_Version >= 20) @@ -66,13 +68,25 @@ void UNetDriver::TickFlushHook(UNetDriver* NetDriver) else { if (auto ReplicationDriver = NetDriver->Get(ReplicationDriverOffset)) + { reinterpret_cast(ReplicationDriver->VFTable[Offsets::ServerReplicateActors])(ReplicationDriver); + } + else + { + // LOG_INFO(LogDev, "ReplicationDriver is nul!!?1//33/221/4/124/123"); // 3.3 MOMENT + } } } return TickFlushOriginal(NetDriver); } +enum class EChannelCreateFlags : uint32_t +{ + None = (1 << 0), + OpenedLocally = (1 << 1) +}; + int32 ServerReplicateActors_PrepConnections(UNetDriver* NetDriver) { auto& ClientConnections = NetDriver->GetClientConnections(); @@ -448,6 +462,117 @@ bool UNetDriver::IsLevelInitializedForActor(const AActor* InActor, const UNetCon return bCorrectWorld || bIsConnectionPC; } +TMap* GetDestroyedStartupOrDormantActors(UNetDriver* Driver) +{ + static int off = Fortnite_Version == 1.11 ? 0x228 : 0; // 0x240 + + return off == 0 ? nullptr : (TMap*)(__int64(Driver) + off); +} + +TSet* GetDestroyedStartupOrDormantActors(UNetConnection* NetConnection) +{ + static int off = Fortnite_Version == 1.11 ? 0x33678 : 0; + + return off == 0 ? nullptr : (TSet*)(__int64(NetConnection) + off); +} + +using FArchive = void; + +bool IsError(FArchive* Ar) +{ + return false; +} + +void SerializeChecksum(FArchive* Ar, uint32 x, bool ErrorOK) +{ + /* + if (Ar->IsLoading()) + { + uint32 Magic = 0; + Ar << Magic; + if ((!ErrorOK || !IsError(Ar)) + // && !ensure(Magic == x) + ) + { + // UE_LOG(LogCoreNet, Warning, TEXT("%d == %d"), Magic, x); + } + + } + else + { + uint32 Magic = x; + Ar << Magic; + } + */ +} + +#define NET_CHECKSUM(Ser) \ +{ \ + SerializeChecksum(Ser,0xE282FA84, false); \ +} + +struct FPacketIdRange +{ + FPacketIdRange(int32 _First, int32 _Last) : First(_First), Last(_Last) { } + FPacketIdRange(int32 PacketId) : First(PacketId), Last(PacketId) { } + FPacketIdRange() : First(INDEX_NONE), Last(INDEX_NONE) { } + int32 First; + int32 Last; + + bool InRange(int32 PacketId) const + { + return (First <= PacketId && PacketId <= Last); + } +}; + +void SetChannelActorForDestroy(UActorChannel* Channel, FActorDestructionInfo* DestructInfo) +{ + auto Connection = Channel->GetConnection(); + + if ( + true + // && !Channel->IsClosing() + // && (Connection->State == USOCK_Open || Connection->State == USOCK_Pending) + ) + { + + // Send a close notify, and wait for ack. + struct FOutBunch + { + char pad[0x600]; // idk real size + }; + + FOutBunch CloseBunch{}; + FOutBunch(*ConstructorFOutBunch)(FOutBunch*, UChannel* , bool) = decltype(ConstructorFOutBunch)(__int64(GetModuleHandleW(0)) + 0x194E800); + ConstructorFOutBunch(&CloseBunch, Channel, 1); + // check(!CloseBunch.IsError()); + // check(CloseBunch.bClose); + + // https://imgur.com/a/EtKFkrD + + *(bool*)(__int64(&CloseBunch) + 0xE8) = 1; + *(bool*)(__int64(&CloseBunch) + 0xE6) = 0; + + // Serialize DestructInfo + // NET_CHECKSUM(CloseBunch); // This is to mirror the Checksum in UPackageMapClient::SerializeNewActor + + using UPackageMap = UObject; + + reinterpret_cast(Connection->GetPackageMap()->VFTable[0x238 / 8])(Connection->GetPackageMap(), &CloseBunch, DestructInfo->ObjOuter.Get(), DestructInfo->NetGUID, DestructInfo->PathName); + + // UE_LOG(LogNetTraffic, Log, TEXT("SetChannelActorForDestroy: Channel %d. NetGUID <%s> Path: %s. Bits: %d"), ChIndex, *DestructInfo->NetGUID.ToString(), *DestructInfo->PathName, CloseBunch.GetNumBits()); + // UE_LOG(LogNetDormancy, Verbose, TEXT("SetChannelActorForDestroy: Channel %d. NetGUID <%s> Path: %s. Bits: %d"), ChIndex, *DestructInfo->NetGUID.ToString(), *DestructInfo->PathName, CloseBunch.GetNumBits()); + + // 0x196E9C0 + reinterpret_cast(Channel->VFTable[0x288 / 8])(Channel, &CloseBunch, false); + } +} + +TSet* GetClientVisibleLevelNames(UNetConnection* NetConnection) +{ + return (TSet*)(__int64(NetConnection) + 0x336C8); +} + int32 UNetDriver::ServerReplicateActors() { int32 Updated = 0; @@ -487,6 +612,11 @@ int32 UNetDriver::ServerReplicateActors() // LOG_INFO(LogReplication, "Considering {} actors.", ConsiderList.size()); + static UChannel* (*CreateChannel)(UNetConnection*, int, bool, int32_t) = decltype(CreateChannel)(Addresses::CreateChannel); + static __int64 (*ReplicateActor)(UActorChannel*) = decltype(ReplicateActor)(Addresses::ReplicateActor); + static UObject* (*CreateChannelByName)(UNetConnection * Connection, FName * ChName, EChannelCreateFlags CreateFlags, int32_t ChannelIndex) = decltype(CreateChannelByName)(Addresses::CreateChannel); + static __int64 (*SetChannelActor)(UActorChannel*, AActor*) = decltype(SetChannelActor)(Addresses::SetChannelActor); + for (int32 i = 0; i < this->GetClientConnections().Num(); i++) { UNetConnection* Connection = this->GetClientConnections().at(i); @@ -522,6 +652,85 @@ int32 UNetDriver::ServerReplicateActors() Connection->GetSentTemporaries().at(j)->GetNetTag() = GetNetTag(); } */ + std::vector DeletionEntries; + + auto ConnectionDestroyedStartupOrDormantActors = GetDestroyedStartupOrDormantActors(Connection); + + if (ConnectionDestroyedStartupOrDormantActors) + { + auto DriverDestroyedStartupOrDormantActors = GetDestroyedStartupOrDormantActors(this); + + if (DriverDestroyedStartupOrDormantActors) + { + for (FNetworkGUID& ConnectionIt : *ConnectionDestroyedStartupOrDormantActors) + { + FActorDestructionInfo* DInfo = nullptr; + + for (TPair& DriverIt : *DriverDestroyedStartupOrDormantActors) + { + if (DriverIt.First == ConnectionIt) + { + DInfo = &DriverIt.Second; + break; + } + } + + if (!DInfo) continue; // should never happen + + DeletionEntries.push_back(DInfo); + } + } + } + + LOG_INFO(LogDev, "DeletionEntries: {}", DeletionEntries.size()); + + for (FActorDestructionInfo* DeletionEntry : DeletionEntries) + { + LOG_INFO(LogDev, "AA: {}", DeletionEntry->PathName.Data.Data ? DeletionEntry->PathName.ToString() : "Null"); + + if (DeletionEntry->StreamingLevelName != -1) + { + auto ClientVisibleLevelNames = GetClientVisibleLevelNames(Connection); + + bool bFound = false; + + for (FName& ClientVisibleLevelName : *ClientVisibleLevelNames) + { + if (ClientVisibleLevelName == DeletionEntry->StreamingLevelName) + { + bFound = true; + break; + } + } + + if (!bFound) + continue; + } + + UActorChannel* Channel = nullptr; + + if (Engine_Version >= 422) + { + FString ActorStr = L"Actor"; + FName ActorName = UKismetStringLibrary::Conv_StringToName(ActorStr); + + int ChannelIndex = -1; // 4294967295 + Channel = (UActorChannel*)CreateChannelByName(Connection, &ActorName, EChannelCreateFlags::OpenedLocally, ChannelIndex); + } + else + { + Channel = (UActorChannel*)CreateChannel(Connection, 2, true, -1); + } + + if (Channel) + { + // FinalRelevantCount++; + + SetChannelActorForDestroy(Channel, DeletionEntry); // Send a close bunch on the new channel + GetDestroyedStartupOrDormantActors(Connection)->Remove(DeletionEntry->NetGUID); // Remove from connections to-be-destroyed list (close bunch of reliable, so it will make it there) + } + } + for (auto& ActorInfo : ConsiderList) { if (!ActorInfo || !ActorInfo->Actor) @@ -592,16 +801,6 @@ int32 UNetDriver::ServerReplicateActors() } } - enum class EChannelCreateFlags : uint32_t - { - None = (1 << 0), - OpenedLocally = (1 << 1) - }; - - static UChannel* (*CreateChannel)(UNetConnection*, int, bool, int32_t) = decltype(CreateChannel)(Addresses::CreateChannel); - static __int64 (*ReplicateActor)(UActorChannel*) = decltype(ReplicateActor)(Addresses::ReplicateActor); - static UObject* (*CreateChannelByName)(UNetConnection* Connection, FName* ChName, EChannelCreateFlags CreateFlags, int32_t ChannelIndex) = decltype(CreateChannelByName)(Addresses::CreateChannel); - static __int64 (*SetChannelActor)(UActorChannel*, AActor*) = decltype(SetChannelActor)(Addresses::SetChannelActor); if (!Channel) { diff --git a/Project Reboot 3.0/Object.h b/Project Reboot 3.0/Object.h index a5f0dfa..d03ee4d 100644 --- a/Project Reboot 3.0/Object.h +++ b/Project Reboot 3.0/Object.h @@ -68,7 +68,7 @@ public: int GetOffset(const std::string& ChildName, bool bWarnIfNotFound = true) const; template - T& Get(int Offset) const { return *(T*)(__int64(this) + Offset); } + inline T& Get(int Offset) const { return *(T*)(__int64(this) + Offset); } void* GetInterfaceAddress(UClass* InterfaceClass); diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 2ff6591..af094d5 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -969,8 +969,13 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook, (PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false, false, true); - Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/FortniteGame.FortGameModeAthena.OnAircraftEnteredDropZone"), AFortGameModeAthena::OnAircraftEnteredDropZoneHook, - (PVOID*)&AFortGameModeAthena::OnAircraftEnteredDropZoneOriginal, false, false, true, true); + + if (Fortnite_Version != 3.3) // 0xE9 on 3.3 + { + Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/FortniteGame.FortGameModeAthena.OnAircraftEnteredDropZone"), AFortGameModeAthena::OnAircraftEnteredDropZoneHook, + (PVOID*)&AFortGameModeAthena::OnAircraftEnteredDropZoneOriginal, false, false, true, true); + } + Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"), AGameModeBase::SpawnDefaultPawnForHook, nullptr, false); Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameModeBase.HandleStartingNewPlayer"), AFortGameModeAthena::Athena_HandleStartingNewPlayerHook, @@ -1125,8 +1130,13 @@ DWORD WINAPI Main(LPVOID) AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessageHook, nullptr, false); } - Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerTeleportToPlaygroundLobbyIsland"), - AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook, nullptr, false); + auto ServerTeleportToPlaygroundIslandFn = FindObject(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerTeleportToPlaygroundLobbyIsland"); + + if (ServerTeleportToPlaygroundIslandFn) + { + Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, ServerTeleportToPlaygroundIslandFn, + AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook, nullptr, false); + } // Hooking::MinHook::Hook(FortPlayerStateAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerStateAthena.ServerSetInAircraft"), // AFortPlayerStateAthena::ServerSetInAircraftHook, (PVOID*)&AFortPlayerStateAthena::ServerSetInAircraftOriginal, false, true); // We could use second method but eh diff --git a/Project Reboot 3.0/finder.cpp b/Project Reboot 3.0/finder.cpp index 69bac66..ef9ef91 100644 --- a/Project Reboot 3.0/finder.cpp +++ b/Project Reboot 3.0/finder.cpp @@ -58,7 +58,7 @@ uint64 FindGIsClient() // {0x44, 0x88} // IDK WHAT VERSION This for but it scuffs older builds }; - int Skip = Engine_Version <= 420 ? 1 : 2; // Skip GIsServer and some variable i forgot + int Skip = 2; // Skip GIsServer and some variable i forgot uint64 Addy; diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index d993c6f..3f904bc 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -171,6 +171,9 @@ static inline uint64 FindAddToAlivePlayers() static inline uint64 FindFinishResurrection() { + if (Engine_Version < 423) + return 0; + uintptr_t Addrr = Engine_Version >= 427 ? FindNameRef(L"OnResurrectionCompleted") : FindFunctionCall(L"OnResurrectionCompleted"); // Call is inlined if (!Addrr) @@ -244,7 +247,12 @@ static inline uint64 FindPickupInitialize() if (Engine_Version == 419) return Memcury::Scanner::FindPattern("48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 80 B9 ? ? ? ? ? 41 0F B6 E9").Get(); // 1.11 if (Engine_Version == 420) + { + if (Fortnite_Version <= 3.3) + return Memcury::Scanner::FindPattern("48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 80 B9 ? ? ? ? ? 41 0F B6 E9 49 8B F8 48 8B F1 0F 85 ? ? ? ? 48 83 7A").Get(); // 3.3 + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 41 56 48 83 EC 20 80 B9 ? ? ? ? ? 45 0F B6 F1 49 8B E8").Get(); // 4.1 + } if (Engine_Version == 421) { auto addr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 55 57 41 57 48 83 EC 30 80 B9 ? ? ? ? ? 41 0F B6", false).Get(); // 6.21 @@ -507,7 +515,9 @@ static inline uint64 FindFree() { uint64 addr = 0; - if (Engine_Version >= 420 && Engine_Version <= 426) + if (Fortnite_Version <= 3.3) // todo check 3.4 + addr = Memcury::Scanner::FindPattern("48 85 C9 74 1D 4C 8B 05 ? ? ? ? 4D 85 C0 0F 84").Get(); + else if (Engine_Version >= 420 && Engine_Version <= 426) addr = Memcury::Scanner::FindPattern("48 85 C9 74 2E 53 48 83 EC 20 48 8B D9").Get(); else if (Engine_Version >= 427) addr = Memcury::Scanner::FindPattern("48 85 C9 0F 84 ? ? ? ? 53 48 83 EC 20 48 89 7C 24 ? 48 8B D9 48 8B 3D").Get(); @@ -547,7 +557,7 @@ static inline uint64 FindSpawnActor() auto Addr = Memcury::Scanner::FindStringRef(L"SpawnActor failed because no class was specified"); - if (Engine_Version >= 416 && Fortnite_Version <= 3.2) + if (Engine_Version >= 416 && Fortnite_Version <= 3.3) return FindBytes(Addr, { 0x40, 0x55 }, 3000, 0, true); return FindBytes(Addr, { 0x4C, 0x8B, 0xDC }, 3000, 0, true); @@ -671,7 +681,9 @@ static inline uint64 FindSpecConstructor() static inline uint64 FindCreateBuildingActorCallForDeco() // kill me { - auto Addrr = Memcury::Scanner::FindStringRef(L"ServerCreateBuildingAndSpawnDeco called without a valid DecoItemDef").Get(); // honestly L (we should get it from the ufunc not string) + return 0; + + auto Addrr = Memcury::Scanner::FindStringRef(L"ServerCreateBuildingAndSpawnDeco called without a valid DecoItemDef", false).Get(); // honestly L (we should get it from the ufunc not string) if (!Addrr) return 0; @@ -824,7 +836,14 @@ static inline uint64 FindNoMCP() return Memcury::Scanner::FindPattern("E8 ? ? ? ? 90 EB EA").RelativeOffset(1).Get(); if (std::floor(Fortnite_Version) == 3) - return Memcury::Scanner::FindPattern("E8 ? ? ? ? 83 A7 ? ? ? ? ? 48 8D 4C 24 ?").RelativeOffset(1).Get(); + { + auto cuh = Memcury::Scanner::FindPattern("E8 ? ? ? ? 83 A7 ? ? ? ? ? 48 8D 4C 24 ?"); + + if (!cuh.Get()) + cuh = Memcury::Scanner::FindPattern(""); // 3.3 + + return cuh.RelativeOffset(1).Get(); + } if (std::floor(Fortnite_Version) == 4) return Memcury::Scanner::FindPattern("E8 ? ? ? ? 83 A7 ? ? ? ? ? 83 E0 01").RelativeOffset(1).Get(); @@ -1460,7 +1479,7 @@ static inline uint64 FindMcpIsDedicatedServerOffset() if (Engine_Version == 421 || Engine_Version == 422) // checked on 5.41 & 6.21 & 7.30 return 0x28; - return 0x60; // 1.7.2 & 1.11 & 4.1 + return 0x60; // 1.7.2 & 1.11 3.3 & & 4.1 } uint64 FindGIsClient(); // AHHH diff --git a/Project Reboot 3.0/hooking.h b/Project Reboot 3.0/hooking.h index 1f05cd0..6b32486 100644 --- a/Project Reboot 3.0/hooking.h +++ b/Project Reboot 3.0/hooking.h @@ -253,7 +253,9 @@ inline __int64 GetFunctionIdxOrPtr(UFunction* Function, bool bBreakWhenHitRet = { // LOG_INFO(LogDev, "[{}] 0x{:x}", i, *(uint8_t*)CurrentAddy); - if (*(uint8_t*)CurrentAddy == 0xE8) + if (*(uint8_t*)CurrentAddy == 0xE8 + // || *(uint8_t*)CurrentAddy == 0xE9 + ) { // LOG_INFO(LogDev, "CurrentAddy 0x{:x}", CurrentAddy - __int64(GetModuleHandleW(0))); functionAddy = (CurrentAddy + 1 + 4) + *(int*)(CurrentAddy + 1); 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 09/14] 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; From 072ffb312c07502f376877252a8e5f7b30568343 Mon Sep 17 00:00:00 2001 From: Gray <84999745+Milxnor@users.noreply.github.com> Date: Tue, 12 Mar 2024 20:05:50 -0400 Subject: [PATCH 10/14] Fix 1.7.2 --- Project Reboot 3.0/FortPlayerController.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Project Reboot 3.0/FortPlayerController.h b/Project Reboot 3.0/FortPlayerController.h index bd7599c..7169897 100644 --- a/Project Reboot 3.0/FortPlayerController.h +++ b/Project Reboot 3.0/FortPlayerController.h @@ -131,6 +131,10 @@ public: FFortAthenaLoadout* GetCosmeticLoadout() { static auto CosmeticLoadoutPCOffset = GetCosmeticLoadoutOffset(); + + if (CosmeticLoadoutPCOffset == -1) + return nullptr; + auto CosmeticLoadout = this->GetPtr(CosmeticLoadoutPCOffset); return CosmeticLoadout; @@ -143,7 +147,7 @@ public: static auto WeaponDefinitionOffset = FindOffsetStruct("/Script/FortniteGame.AthenaPickaxeItemDefinition", "WeaponDefinition"); - auto PickaxeDefinition = CosmeticLoadoutPickaxe ? CosmeticLoadoutPickaxe->Get(WeaponDefinitionOffset) + auto PickaxeDefinition = /* WeaponDefinitionOffset != -1 && */ CosmeticLoadoutPickaxe ? CosmeticLoadoutPickaxe->Get(WeaponDefinitionOffset) : FindObject(L"/Game/Athena/Items/Weapons/WID_Harvest_Pickaxe_Athena_C_T01.WID_Harvest_Pickaxe_Athena_C_T01"); auto WorldInventory = GetWorldInventory(); From 134bd42ade61482b3febc5736cb920c3010e5ceb Mon Sep 17 00:00:00 2001 From: Gray <84999745+Milxnor@users.noreply.github.com> Date: Tue, 12 Mar 2024 20:18:39 -0400 Subject: [PATCH 11/14] fix loot spawn on 1.7.2 probably --- Project Reboot 3.0/BuildingContainer.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Project Reboot 3.0/BuildingContainer.h b/Project Reboot 3.0/BuildingContainer.h index 847251c..6246ba3 100644 --- a/Project Reboot 3.0/BuildingContainer.h +++ b/Project Reboot 3.0/BuildingContainer.h @@ -26,9 +26,17 @@ public: return this->ReadBitfieldValue(bAlreadySearchedOffset, bAlreadySearchedFieldMask); } - FVector& GetLootSpawnLocation_Athena() + FVector/*&*/ GetLootSpawnLocation_Athena() { - static auto LootSpawnLocation_AthenaOffset = this->GetOffset("LootSpawnLocation_Athena"); + static auto LootSpawnLocation_AthenaOffset = this->GetOffset("LootSpawnLocation_Athena", false); + + if (LootSpawnLocation_AthenaOffset == -1) + { + static auto LootSpawnLocationOffset = this->GetOffset("LootSpawnLocation", false); + // return this->Get(LootSpawnLocationOffset); + return FVector(); + } + return this->Get(LootSpawnLocation_AthenaOffset); } From 215d7b81d08eba3b38616a77dbd58ee50211b5b0 Mon Sep 17 00:00:00 2001 From: Gray <84999745+Milxnor@users.noreply.github.com> Date: Thu, 14 Mar 2024 17:20:14 -0400 Subject: [PATCH 12/14] Try editing again, fix 1.7.2 zone --- Project Reboot 3.0/FortGameModeAthena.cpp | 17 +++++++---- Project Reboot 3.0/FortPlayerController.cpp | 15 ++++++---- Project Reboot 3.0/GameModeBase.cpp | 16 ++++++++++ Project Reboot 3.0/GameModeBase.h | 4 +++ Project Reboot 3.0/World.h | 33 +++++++++++++++++++-- Project Reboot 3.0/die.h | 3 +- Project Reboot 3.0/dllmain.cpp | 4 +++ Project Reboot 3.0/events.h | 2 +- Project Reboot 3.0/finder.h | 4 +-- 9 files changed, 81 insertions(+), 17 deletions(-) diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index 527d2cf..08ad073 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -416,6 +416,12 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game // SpawnIsland->RepData->Soemthing = FoundationSetup->LobbyLocation; } + if (Fortnite_Version == 14.60 && Globals::bGoingToPlayEvent) + { + // Auto with SetDynamicFoundationEnabled + // ShowFoundation(FindObject(L"/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Lobby_Foundation3")); // Aircraft Carrier + } + if (Fortnite_Version == 12.41) { ShowFoundation(FindObject("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.LF_Athena_POI_19x19_2")); @@ -542,11 +548,6 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game } } - if (Fortnite_Version == 14.60 && Globals::bGoingToPlayEvent) - { - ShowFoundation(FindObject(L"/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Lobby_Foundation3")); // Aircraft Carrier - } - AActor* TheBlock = nullptr; if (Fortnite_Version > 10) // todo only checked on 10.40 @@ -888,6 +889,10 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game WorldNamesToStreamAllFoundationsIn.push_back("/Temp/Game/Athena/Maps/POI/Athena_POI_CommunityPark_003_M_5c711338"); } + static auto PawnClass = FindObject(L"/Game/Athena/PlayerPawn_Athena.PlayerPawn_Athena_C"); + static auto DefaultPawnClassOffset = GameMode->GetOffset("DefaultPawnClass"); + GameMode->Get(DefaultPawnClassOffset) = PawnClass; // I think it would be better if we didn't talk about this. + if (WorldNamesToStreamAllFoundationsIn.size() > 0) { auto ObjectNum = ChunkedObjects ? ChunkedObjects->Num() : UnchunkedObjects ? UnchunkedObjects->Num() : 0; @@ -1095,7 +1100,7 @@ int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint } } - LOG_INFO(LogTeams, "Spreading Teams {} [{}] Player is going on team {} with {} members.", bShouldSpreadTeams, TeamsNum, NextTeamIndex, CurrentTeamMembers); + LOG_INFO(LogTeams, "Spreading Teams {} Player is going on team {}/{} with {} members.", bShouldSpreadTeams, NextTeamIndex, TeamsNum, CurrentTeamMembers); CurrentTeamMembers++; diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 2b133c0..63a0c3d 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -834,8 +834,8 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra { auto PlayerController = (AFortPlayerController*)Context; - if (!PlayerController) // ?? - return ServerCreateBuildingActorOriginal(Context, Stack, Ret); + // if (!PlayerController) // ?? + // return ServerCreateBuildingActorOriginal(Context, Stack, Ret); auto WorldInventory = PlayerController->GetWorldInventory(); @@ -862,7 +862,7 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra bMirrored = CreateBuildingData->bMirrored; static auto BroadcastRemoteClientInfoOffset = PlayerController->GetOffset("BroadcastRemoteClientInfo"); - auto BroadcastRemoteClientInfo = PlayerController->Get(BroadcastRemoteClientInfoOffset); + UObject* BroadcastRemoteClientInfo = PlayerController->Get(BroadcastRemoteClientInfoOffset); static auto RemoteBuildableClassOffset = BroadcastRemoteClientInfo->GetOffset("RemoteBuildableClass"); BuildingClass = BroadcastRemoteClientInfo->Get(RemoteBuildableClassOffset); @@ -885,7 +885,7 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra if (!BuildingClass) return ServerCreateBuildingActorOriginal(Context, Stack, Ret); - auto GameState = Cast(((AFortGameMode*)GetWorld()->GetGameMode())->GetGameState()); + auto GameState = Cast(Cast(GetWorld()->GetGameMode(), false)->GetGameState(), false); auto StructuralSupportSystem = GameState->GetStructuralSupportSystem(); @@ -1766,13 +1766,18 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl AFortWeap_EditingTool* EditTool = nullptr; -#if 0 +#if 1 auto EditToolInstance = WorldInventory->FindItemInstance(EditToolDef); if (!EditToolInstance) return; +#if 1 EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); // ERM +#else + Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); // ERM + EditTool = Cast(Pawn->GetCurrentWeapon()); +#endif #else EditTool = Cast(Pawn->GetCurrentWeapon()); #endif diff --git a/Project Reboot 3.0/GameModeBase.cpp b/Project Reboot 3.0/GameModeBase.cpp index 19a1217..7f462c8 100644 --- a/Project Reboot 3.0/GameModeBase.cpp +++ b/Project Reboot 3.0/GameModeBase.cpp @@ -86,6 +86,22 @@ AActor* AGameModeBase::K2_FindPlayerStart(AController* Player, FString IncomingN return AGameModeBase_K2_FindPlayerStart_Params.ReturnValue; } +bool AGameModeBase::PlayerCanRestartHook(UObject* Context, FFrame& Stack, bool* Ret) +{ + auto ret = PlayerCanRestartOriginal(Context, Stack, Ret); + + LOG_INFO(LogDev, "PlayerCanRestartHook ret: {}", ret); + + if (Globals::bGoingToPlayEvent && Fortnite_Version == 14.60) + { + // 1:1 + ret = true; + *Ret = true; + } + + return ret; +} + APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AController* NewPlayer, AActor* StartSpot) { LOG_INFO(LogDev, "SpawnDefaultPawnForHook!"); diff --git a/Project Reboot 3.0/GameModeBase.h b/Project Reboot 3.0/GameModeBase.h index 86ebe3d..c1a646a 100644 --- a/Project Reboot 3.0/GameModeBase.h +++ b/Project Reboot 3.0/GameModeBase.h @@ -5,10 +5,13 @@ #include "Controller.h" #include "Pawn.h" #include "UnrealString.h" +#include "Stack.h" class AGameModeBase : public AActor // AInfo { public: + static inline bool (*PlayerCanRestartOriginal)(UObject* Context, FFrame& Stack, bool* Ret); + UClass* GetDefaultPawnClassForController(AController* InController); void ChangeName(AController* Controller, const FString& NewName, bool bNameChange); AActor* K2_FindPlayerStart(AController* Player, FString IncomingName); @@ -16,5 +19,6 @@ public: void RestartPlayerAtPlayerStart(AController* NewPlayer, AActor* StartSpot); void RestartPlayer(AController* NewPlayer); + static bool PlayerCanRestartHook(UObject* Context, FFrame& Stack, bool* Ret); static APawn* SpawnDefaultPawnForHook(AGameModeBase* GameMode, AController* NewPlayer, AActor* StartSpot); }; \ No newline at end of file diff --git a/Project Reboot 3.0/World.h b/Project Reboot 3.0/World.h index e101801..44ca210 100644 --- a/Project Reboot 3.0/World.h +++ b/Project Reboot 3.0/World.h @@ -65,10 +65,13 @@ struct FActorSpawnParametersUE500 TFunction CustomPreSpawnInitalization; // my favorite }; +// #define USE_VIRTUALALLOC_SPAWNPARAMS + static inline void* CreateSpawnParameters(ESpawnActorCollisionHandlingMethod SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::Undefined, bool bDeferConstruction = false, UObject* Owner = nullptr) { if (Engine_Version >= 500) { +#ifdef USE_VIRTUALALLOC_SPAWNPARAMS auto addr = (FActorSpawnParametersUE500*)VirtualAlloc(0, sizeof(FActorSpawnParametersUE500), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); if (!addr) @@ -78,9 +81,18 @@ static inline void* CreateSpawnParameters(ESpawnActorCollisionHandlingMethod Spa addr->bDeferConstruction = bDeferConstruction; addr->SpawnCollisionHandlingOverride = SpawnCollisionHandlingOverride; return addr; +#else + FActorSpawnParametersUE500 addr{}; + + addr.Owner = Owner; + addr.bDeferConstruction = bDeferConstruction; + addr.SpawnCollisionHandlingOverride = SpawnCollisionHandlingOverride; + return &addr; +#endif } else { +#ifdef USE_VIRTUALALLOC_SPAWNPARAMS auto addr = (FActorSpawnParameters*)VirtualAlloc(0, sizeof(FActorSpawnParameters), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); if (!addr) @@ -90,6 +102,14 @@ static inline void* CreateSpawnParameters(ESpawnActorCollisionHandlingMethod Spa addr->bDeferConstruction = bDeferConstruction; addr->SpawnCollisionHandlingOverride = SpawnCollisionHandlingOverride; return addr; +#else + FActorSpawnParameters addr{}; + + addr.Owner = Owner; + addr.bDeferConstruction = bDeferConstruction; + addr.SpawnCollisionHandlingOverride = SpawnCollisionHandlingOverride; + return &addr; +#endif } return nullptr; @@ -134,12 +154,21 @@ public: template ActorType* SpawnActor(UClass* Class, FTransform UserTransformPtr = FTransform(), void* SpawnParameters = nullptr) { - if (!SpawnParameters) + const bool bCreatedSpawnParameters = !SpawnParameters; + + if (bCreatedSpawnParameters) + { SpawnParameters = CreateSpawnParameters(); + } auto actor = (ActorType*)SpawnActorOriginal(this, Class, &UserTransformPtr, SpawnParameters); - VirtualFree(SpawnParameters, 0, MEM_RELEASE); + // if (bCreatedSpawnParameters) + { +#ifdef USE_VIRTUALALLOC_SPAWNPARAMS + VirtualFree(SpawnParameters, 0, MEM_RELEASE); +#endif + } return actor; } diff --git a/Project Reboot 3.0/die.h b/Project Reboot 3.0/die.h index 755af24..277be65 100644 --- a/Project Reboot 3.0/die.h +++ b/Project Reboot 3.0/die.h @@ -156,7 +156,8 @@ static inline void ProcessEventHook(UObject* Object, UFunction* Function, void* !strstr(FunctionName.c_str(), "ServerTriggerCombatEvent") && !strstr(FunctionName.c_str(), "SpinCubeTimeline__UpdateFunc") && !strstr(ObjectName.c_str(), "FortPhysicsObjectComponent") && - !strstr(FunctionName.c_str(), "GetTextValue")) + !strstr(FunctionName.c_str(), "GetTextValue") && + !strstr(FunctionName.c_str(), "ExecuteUbergraph_BGA_Petrol_Pickup")) { LOG_INFO(LogDev, "Function called: {} with {}", FunctionFullName, ObjectName); } diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index c29b576..71c0ad7 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -978,6 +978,8 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"), AGameModeBase::SpawnDefaultPawnForHook, nullptr, false); + // Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameModeBase.PlayerCanRestart"), + // AGameModeBase::PlayerCanRestartHook, (PVOID*)&AGameModeBase::PlayerCanRestartOriginal, false, true); Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameModeBase.HandleStartingNewPlayer"), AFortGameModeAthena::Athena_HandleStartingNewPlayerHook, (PVOID*)&AFortGameModeAthena::Athena_HandleStartingNewPlayerOriginal, false); @@ -1405,9 +1407,11 @@ DWORD WINAPI Main(LPVOID) LOG_INFO(LogDev, "ClientOnPawnDiedCallAddr: 0x{:x}", ClientOnPawnDiedCallAddr - __int64(GetModuleHandleW(0))); Hooking::MinHook::Hook((PVOID)ClientOnPawnDiedCallAddr, AFortPlayerController::ClientOnPawnDiedHook, (PVOID*)&AFortPlayerController::ClientOnPawnDiedOriginal); +#if 0 auto OnSafeZoneStateChangeAddr = FindFunctionCall(L"OnSafeZoneStateChange", Engine_Version == 416 ? std::vector{ 0x48, 0x89, 0x54 } : std::vector{ 0x48, 0x89, 0x5C }); LOG_INFO(LogDev, "OnSafeZoneStateChangeAddr: 0x{:x}", OnSafeZoneStateChangeAddr - __int64(GetModuleHandleW(0))); Hooking::MinHook::Hook((PVOID)OnSafeZoneStateChangeAddr, AFortSafeZoneIndicator::OnSafeZoneStateChangeHook, (PVOID*)&AFortSafeZoneIndicator::OnSafeZoneStateChangeOriginal); +#endif LOG_INFO(LogDev, "PredictionKeySize: 0x{:x} {}", PredictionKeySize, PredictionKeySize); diff --git a/Project Reboot 3.0/events.h b/Project Reboot 3.0/events.h index 143c663..2e68b0b 100644 --- a/Project Reboot 3.0/events.h +++ b/Project Reboot 3.0/events.h @@ -297,7 +297,7 @@ static inline std::vector Events = }, "/Junior/Blueprints/BP_Junior_Scripting.BP_Junior_Scripting_C", - "/Game/Athena/Playlists/Music/Playlist_Junior_32.Playlist_Junior_32", + "/Game/Athena/Playlists/Music/Playlist_Junior_32.Playlist_Junior_32", // ? 14.60 ), Event( diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index a9d8465..1e411f2 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -532,7 +532,7 @@ static inline uint64 FindStepExplicitProperty() static inline uint64 FindIsNetRelevantForOffset() { - if (Engine_Version == 416) // checked on 1.7.2 & 1.8 + if (Engine_Version == 416 || Fortnite_Version == 3.3) // checked on 1.7.2 & 1.8 & 3.3 return 0x420 / 8; 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; @@ -1476,7 +1476,7 @@ static inline uint64 FindDispatchRequest() static inline uint64 FindMcpIsDedicatedServerOffset() { - if (Engine_Version == 421 || Engine_Version == 422) // checked on 5.41 & 6.21 & 7.30 + if (Fortnite_Version >= 4.5 && Engine_Version <= 422) // checked on 4.5 & 5.41 & 6.21 & 7.30 return 0x28; return 0x60; // 1.7.2 & 1.11 3.3 & & 4.1 From c19f67c6754e2e5cc566aef87766c102b5ec462f Mon Sep 17 00:00:00 2001 From: Gray <84999745+Milxnor@users.noreply.github.com> Date: Thu, 14 Mar 2024 19:29:58 -0400 Subject: [PATCH 13/14] Rift tour --- Project Reboot 3.0/AbilitySystemComponent.h | 5 - Project Reboot 3.0/FortPlayerController.cpp | 35 +- .../FortPlayerControllerAthena.cpp | 21 ++ .../FortPlayerControllerAthena.h | 1 + Project Reboot 3.0/World.h | 92 ++++- Project Reboot 3.0/dllmain.cpp | 320 ++++++++++++------ Project Reboot 3.0/inc.h | 7 +- 7 files changed, 367 insertions(+), 114 deletions(-) diff --git a/Project Reboot 3.0/AbilitySystemComponent.h b/Project Reboot 3.0/AbilitySystemComponent.h index f313acd..9ce9b5f 100644 --- a/Project Reboot 3.0/AbilitySystemComponent.h +++ b/Project Reboot 3.0/AbilitySystemComponent.h @@ -4,11 +4,6 @@ #include "GameplayAbilitySpec.h" #include "AttributeSet.h" -struct PadHex10 { char Pad[0x10]; }; -struct PadHex18 { char Pad[0x18]; }; -struct PadHexA8 { char Pad[0xA8]; }; -struct PadHexB0 { char Pad[0xB0]; }; - // using FPredictionKey = PadHex18; // using FGameplayEventData = PadHexA8; diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 63a0c3d..df2df49 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -1265,7 +1265,7 @@ DWORD WINAPI SpectateThread(LPVOID PC) Sleep(3000); - LOG_INFO(LogDev, "bugha!"); + LOG_INFO(LogDev, "Spectate!"); SpectatingPC->SpectateOnDeath(); @@ -1617,7 +1617,7 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo if (IsRestartingSupported() && Globals::bAutoRestart && !bIsInAutoRestart) { - // wtf + // wht if (GameState->GetGamePhase() > EAthenaGamePhase::Warmup) { @@ -1657,6 +1657,22 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo return ClientOnPawnDiedOriginal(PlayerController, DeathReport); } +bool Idk(ABuildingSMActor* BuildingActor) +{ + return true; // bIsPlayerBuildable && EditModeSupport && EditModePatternData && GameState->StructuralSupportSystem && ?? && ?? +} + +bool IsOkForEditing(ABuildingSMActor* BuildingActor, AFortPlayerController* Controller) +{ + if (BuildingActor->GetEditingPlayer() && + BuildingActor->GetEditingPlayer() != Controller->GetPlayerState()) + return false; + + return !BuildingActor->IsDestroyed() && + // BuildingActor->GetWorld() && + Idk(BuildingActor); +} + void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit) { if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) // We need more checks. @@ -1667,6 +1683,9 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr if (!Pawn) return; + if (!IsOkForEditing(BuildingActorToEdit, PlayerController)) + return; + auto PlayerState = PlayerController->GetPlayerState(); if (!PlayerState) @@ -1691,7 +1710,7 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr #if 1 EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); #else - auto EditTool = Cast(Pawn->GetCurrentWeapon()); + EditTool = Cast(Pawn->GetCurrentWeapon()); #endif if (!EditTool) @@ -1772,10 +1791,12 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl if (!EditToolInstance) return; + FGuid EditToolGuid = EditToolInstance->GetItemEntry()->GetItemGuid(); // Should we ref? + #if 1 - EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); // ERM + EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolGuid)); // ERM #else - Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); // ERM + Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolGuid)); // ERM EditTool = Cast(Pawn->GetCurrentWeapon()); #endif #else @@ -1786,8 +1807,8 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl { static auto bEditConfirmedOffset = EditTool->GetOffset("bEditConfirmed"); - if (bEditConfirmedOffset == -1) - EditTool->Get(bEditConfirmedOffset) = true; + if (bEditConfirmedOffset != -1) + EditTool->Get(bEditConfirmedOffset) = true; // this probably does nothing on server EditTool->SetEditActor(nullptr); } diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.cpp b/Project Reboot 3.0/FortPlayerControllerAthena.cpp index bac31f0..acd2d31 100644 --- a/Project Reboot 3.0/FortPlayerControllerAthena.cpp +++ b/Project Reboot 3.0/FortPlayerControllerAthena.cpp @@ -132,6 +132,27 @@ void AFortPlayerControllerAthena::EndGhostModeHook(AFortPlayerControllerAthena* return EndGhostModeOriginal(PlayerController); } +void AFortPlayerControllerAthena::ServerCreativeSetFlightSpeedIndexHook(UObject* Context, FFrame* Stack) +{ + int Index; + Stack->StepCompiledIn(&Index); + + // LOG_INFO(LogDev, "Player {} wanting to change creative flight speed at index {}", Context->GetName(), Index); + + static auto WantedFlightSpeedChangedFn = FindObject("/Script/FortniteGame.FortPlayerControllerGameplay:OnRep_FlyingModifierIndex"); + + if (!WantedFlightSpeedChangedFn) + { + return; + } + + static auto FlyingModifierIndexOffset = Context->GetOffset("FlyingModifierIndex"); + Context->Get(FlyingModifierIndexOffset) = Index; + + return Context->ProcessEvent(WantedFlightSpeedChangedFn); +} + + void AFortPlayerControllerAthena::EnterAircraftHook(UObject* PC, AActor* Aircraft) { auto PlayerController = Cast(Engine_Version < 424 ? PC : ((UActorComponent*)PC)->GetOwner()); diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.h b/Project Reboot 3.0/FortPlayerControllerAthena.h index 50dedc1..1731069 100644 --- a/Project Reboot 3.0/FortPlayerControllerAthena.h +++ b/Project Reboot 3.0/FortPlayerControllerAthena.h @@ -253,6 +253,7 @@ public: static void StartGhostModeHook(UObject* Context, FFrame* Stack, void* Ret); // we could native hook this but eh static void EndGhostModeHook(AFortPlayerControllerAthena* PlayerController); + static void ServerCreativeSetFlightSpeedIndexHook(UObject* Context, FFrame* Stack); static void EnterAircraftHook(UObject* PC, AActor* Aircraft); static void ServerRequestSeatChangeHook(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex); // actually in zone static void ServerRestartPlayerHook(AFortPlayerControllerAthena* Controller); diff --git a/Project Reboot 3.0/World.h b/Project Reboot 3.0/World.h index 44ca210..10fe581 100644 --- a/Project Reboot 3.0/World.h +++ b/Project Reboot 3.0/World.h @@ -65,6 +65,95 @@ struct FActorSpawnParametersUE500 TFunction CustomPreSpawnInitalization; // my favorite }; +#if 0 + +static inline PadHexB0 CreateSpawnParameters(ESpawnActorCollisionHandlingMethod SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::Undefined, bool bDeferConstruction = false, UObject* Owner = nullptr) +{ + if (Engine_Version >= 500) + { + FActorSpawnParametersUE500 addr{}; + + addr.Owner = Owner; + addr.bDeferConstruction = bDeferConstruction; + addr.SpawnCollisionHandlingOverride = SpawnCollisionHandlingOverride; + return *(PadHexB0*)&addr; + } + else + { + FActorSpawnParameters addr{}; + + addr.Owner = Owner; + addr.bDeferConstruction = bDeferConstruction; + addr.SpawnCollisionHandlingOverride = SpawnCollisionHandlingOverride; + return *(PadHexB0*)&addr; + } + + return PadHexB0(); +} + +class UWorld : public UObject, public FNetworkNotify +{ +public: + static inline UObject* (*SpawnActorOriginal)(UWorld* World, UClass* Class, FTransform const* UserTransformPtr, void* SpawnParameters); + + template + T*& GetGameMode() + { + static auto AuthorityGameModeOffset = GetOffset("AuthorityGameMode"); + return this->Get(AuthorityGameModeOffset); + } + + class AGameState*& GetGameState() + { + static auto GameStateOffset = GetOffset("GameState"); + return this->Get(GameStateOffset); + } + + class UNetDriver*& GetNetDriver() + { + static auto NetDriverOffset = GetOffset("NetDriver"); + return this->Get(NetDriverOffset); + } + + UGameInstance* GetOwningGameInstance() + { + static auto OwningGameInstanceOffset = GetOffset("OwningGameInstance"); + return this->Get(OwningGameInstanceOffset); + } + + inline FTimerManager& GetTimerManager() + { + return GetOwningGameInstance()->GetTimerManager(); + // return (GetOwningGameInstance() ? GetOwningGameInstance()->GetTimerManager() : *TimerManager); + } + + template + ActorType* SpawnActor(UClass* Class, FTransform UserTransformPtr = FTransform(), PadHexB0 SpawnParameters = CreateSpawnParameters()) + { + auto actor = (ActorType*)SpawnActorOriginal(this, Class, &UserTransformPtr, &SpawnParameters); + + return actor; + } + + template + ActorType* SpawnActor(UClass* Class, FVector Location, FQuat Rotation = FQuat(), FVector Scale3D = FVector(1, 1, 1), PadHexB0 SpawnParameters = CreateSpawnParameters()) + { + FTransform UserTransformPtr{}; + UserTransformPtr.Translation = Location; + UserTransformPtr.Rotation = Rotation; + UserTransformPtr.Scale3D = Scale3D; + + auto actor = SpawnActor(Class, UserTransformPtr, SpawnParameters); + + return actor; + } + + AWorldSettings* GetWorldSettings(bool bCheckStreamingPersistent = false, bool bChecked = true) const; + AWorldSettings* K2_GetWorldSettings(); // DONT USE WHEN POSSIBLE + + void Listen(); +}; +#else // #define USE_VIRTUALALLOC_SPAWNPARAMS static inline void* CreateSpawnParameters(ESpawnActorCollisionHandlingMethod SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::Undefined, bool bDeferConstruction = false, UObject* Owner = nullptr) @@ -195,4 +284,5 @@ public: AWorldSettings* K2_GetWorldSettings(); // DONT USE WHEN POSSIBLE void Listen(); -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 71c0ad7..d094f71 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -224,8 +224,6 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index) { if (Index == 0) // Start of Event { - auto MasterScripting = FindObject("/Buffet/Levels/Buffet_P.Buffet_P:PersistentLevel.BP_Event_Master_Scripting_2"); - auto AllSatelliteDishes = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Game/Athena/Apollo/Environments/BuildingActors/Complex/Props/Apollo_Complex_Satellite_Dish_Top_01.Apollo_Complex_Satellite_Dish_Top_01_C")); for (int i = 0; i < AllSatelliteDishes.Num(); i++) @@ -233,60 +231,117 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index) AllSatelliteDishes.At(i)->K2_DestroyActor(); } - MasterScripting->ProcessEvent(MasterScripting->FindFunction("EnableTheMutator")); + auto AllSpecialEventMutators = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Script/SpecialEventGameplayRuntime.FortAthenaMutator_SpecialEvent")); - for (int i = 0; i < ClientConnections.Num(); i++) + for (int i = 0; i < AllSpecialEventMutators.Num(); i++) { - auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); - auto CurrentController = ClientConnections.At(i)->GetPlayerController(); + auto CurrentSpecialEventMutator = AllSpecialEventMutators.At(i); - CurrentController->AddComponentByClass(FindObject("/Script/SpecialEventGameplayRuntime.FortControllerComponent_SpecialEvent")); - CurrentPawn->AddComponentByClass(FindObject("/Script/BuffetRuntime.FortSpecialRelevancyPawnAttachComponent")); - } - } - if (Index == 1) // Memories, BP_Buffet_PhaseScripting_Phase1_C - { - //EventPawn->TeleportTo(FVector(-963.630f, 25453.090f, 359392.125f), EventPawn->GetActorRotation()); + auto ScriptActor = CurrentSpecialEventMutator->Get(CurrentSpecialEventMutator->GetOffset("ScriptActor")); - auto Phase1Scripting = FindObject("/Buffet/Levels/Buffet_Part_3.Buffet_Part_3:PersistentLevel.BP_Buffet_PhaseScripting_Phase1_2"); - - auto TeleportRef = Phase1Scripting->Get(Phase1Scripting->GetOffset("TeleportRef")); - - //EventPawn->TeleportTo(TeleportRef->GetActorLocation(), EventPawn->GetActorRotation()); - - for (int i = 0; i < ClientConnections.Num(); i++) - { - auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); - - //CurrentPawn->TeleportTo(TeleportRef->GetActorLocation(), CurrentPawn->GetActorRotation()); - - //Globals::PawnTeleportRotDefault = CurrentPawn->GetActorRotation(); - - CurrentPawn->ForceNetUpdate(); + if (!ScriptActor) + { + ScriptActor = Cast(GetEventScripting()); + LOG_INFO(LogEvent, "ScriptActor set for mutator: {}", CurrentSpecialEventMutator->GetName()); + } } } if (Index == 2) // Slide { auto Script = FindObject("/Buffet/Levels/Buffet_Part_4.Buffet_Part_4.PersistentLevel.BP_Buffet_PhaseScripting_Paint_4"); + auto SplineActor = Script->Get(Script->GetOffset("SplineActor")); + auto PawnLocation = Script->Get(Script->GetOffset("PawnLocation")) = SplineActor; - Script->Get(Script->GetOffset("bRaceStarted")) = true; - Script->ProcessEvent(Script->FindFunction("OnRep_bRaceStarted")); + auto AllWrapsSpawners = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Script/SpecialEventGameplayRuntime.FortSpecialRelevancyActorSpawner")); - Script->ProcessEvent(Script->FindFunction("OnReady_4E0ADA484A9A29A99CA6DD97BE645F09"), &OnReadyParams); + for (int i = 0; i < AllWrapsSpawners.Num(); i++) + { + auto CurrentWrapSpawner = AllWrapsSpawners.At(i); + + if (CurrentWrapSpawner) + { + auto WrapSpawnerLocation = CurrentWrapSpawner->GetActorLocation(); + auto WrapSpawnerRotation = CurrentWrapSpawner->GetActorRotation(); + UClass* ClassToSpawn = nullptr; + + if (CurrentWrapSpawner->GetName().contains("WrapChangePickup")) + { + ClassToSpawn = FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_WrapChangePickup.BP_Buffet_Paint_WrapChangePickup_C"); + } + else if (CurrentWrapSpawner->GetName().contains("Paint_Pickup")) + { + ClassToSpawn = FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_Pickup.BP_Buffet_Paint_Pickup_C"); + } + auto SpawnedWrap = GetWorld()->SpawnActor(ClassToSpawn, WrapSpawnerLocation, WrapSpawnerRotation.Quaternion(), FVector(1, 1, 1), + CreateSpawnParameters(ESpawnActorCollisionHandlingMethod::AlwaysSpawn, true, nullptr)); + + if (SpawnedWrap) + { + LOG_INFO(LogDev, "Spawner Spawned a Wrap: {}", SpawnedWrap->GetName()); + } + else + { + LOG_INFO(LogDev, "Spawner Failed to spawn a Wrap {}!", CurrentWrapSpawner->GetName()); + } + } + else + { + LOG_INFO(LogDev, "Spawner Invalid!"); + } + } for (int i = 0; i < ClientConnections.Num(); i++) { auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); auto CurrentController = ClientConnections.At(i)->GetPlayerController(); - auto PlayerComponent = CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_PlayerComponent.BP_Buffet_Paint_PlayerComponent_C")); - CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_IntroTrackFinder.BP_Buffet_Paint_IntroTrackFinder_C")); + if (!CurrentPawn) + continue; + + auto PlayerComponent = CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_PlayerComponent.BP_Buffet_Paint_PlayerComponent_C")); // WHY DOESnT IT WORK AUTO auto MovementComponent = CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_MovementComponent.BP_Buffet_Paint_MovementComponent_C")); + PlayerComponent->Get(PlayerComponent->GetOffset("OwningPlayerController")) = CurrentController; + + struct + { + AActor* Pawn; + AActor* ReturnValue; + }wrapmanagerparams{}; + wrapmanagerparams.Pawn = CurrentPawn; + + Script->ProcessEvent(Script->FindFunction("GetWrapManagerForPlayer"), &wrapmanagerparams); + + MovementComponent->Get(MovementComponent->GetOffset("bIsMovingAlongSpline")) = true; + MovementComponent->Get(MovementComponent->GetOffset("ReplicatedTotalSplineTime")) = 59.793846f; // TotalSplineTime + MovementComponent->Get(MovementComponent->GetOffset("TargetSplineActor")) = SplineActor; + MovementComponent->ProcessEvent(MovementComponent->FindFunction("SetSplineActor"), &SplineActor); + bool IsMoving = true; + MovementComponent->ProcessEvent(MovementComponent->FindFunction("SetIsMovingAlongSpline"), &IsMoving); + MovementComponent->Get(MovementComponent->GetOffset("ReplicatedSplineInterpStrength")) = 1.3f; // SplineInterpStrength + auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); + auto GameState = Cast(GameMode->GetGameState()); + MovementComponent->Get(MovementComponent->GetOffset("StartServerWorldTime")) = GameState->GetServerWorldTimeSeconds(); + + MovementComponent->ProcessEvent(MovementComponent->FindFunction("OnRep_TargetSplineActor")); + + PlayerComponent->Get(PlayerComponent->GetOffset("WrapManager")) = wrapmanagerparams.ReturnValue; + PlayerComponent->Get(PlayerComponent->GetOffset("MovementComponent")) = MovementComponent; - PlayerComponent->ProcessEvent(PlayerComponent->FindFunction("InitializePaintComponent")); - PlayerComponent->ProcessEvent(PlayerComponent->FindFunction("InitializeMovementComponent")); + int StasisMode = 3; + CurrentPawn->ProcessEvent(CurrentPawn->FindFunction("SetStasisMode"), &StasisMode); // ?? + } + } + if (Index == 3) + { + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + auto CurrentController = ClientConnections.At(i)->GetPlayerController(); + int StasisMode = 0; + + CurrentPawn->ProcessEvent(CurrentPawn->FindFunction("SetStasisMode"), &StasisMode); } } if (Index == 4) // Storm King @@ -295,95 +350,82 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index) auto DefaultPlane = FindObject("/Buffet/Gameplay/Blueprints/WolfMother/BP_PlanePrototype.Default__BP_PlanePrototype_C"); - { - auto WID = Cast(FindObject("WID_Buffet_BeatMatchingBoomBox", nullptr, ANY_PACKAGE)); // Storm King weapon thing - - for (int i = 0; i < ClientConnections.Num(); i++) - { - auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); - auto CurrentController = (AFortPlayerControllerAthena*)ClientConnections.At(i)->GetPlayerController(); - - auto WorldInventory = CurrentController->GetWorldInventory(); - - bool bShouldUpdate = false; - WorldInventory->AddItem(WID, &bShouldUpdate, 1, 9999); - - if (bShouldUpdate) - WorldInventory->Update(); - - SendMessageToConsole(CurrentController, L"Gave WID_Buffet_BeatMatchingBoomBox!"); - } - - auto AllWeps = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Buffet/Gameplay/Blueprints/WolfMother/BeatmatchingWeapon/B_Buffet_BeatMatchingWeaponPrototype.B_Buffet_BeatMatchingWeaponPrototype_C")); - - for (int i = 0; i < AllWeps.Num(); i++) - { - auto CurrentWep = AllWeps.At(i); - - if (CurrentWep != nullptr) - { - CurrentWep->Get(CurrentWep->GetOffset("Phase4ScriptingRef")) = StormScript; - } - } - } - } - if (Index == 5) // Ariana Knocked - { - auto ReviveScripting = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Revive_2"); - - auto ManualTeleportLocation = ReviveScripting->Get(ReviveScripting->GetOffset("ManualTeleportLocation")); - - auto ManualTeleportRotation = ReviveScripting->Get(ReviveScripting->GetOffset("Manual_Teleport_Rotation")); + auto WID = Cast(FindObject("WID_Buffet_BeatMatchingBoomBox", nullptr, ANY_PACKAGE)); // Storm King weapon thing for (int i = 0; i < ClientConnections.Num(); i++) { auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + auto CurrentController = (AFortPlayerControllerAthena*)ClientConnections.At(i)->GetPlayerController(); + + auto WorldInventory = CurrentController->GetWorldInventory(); + + bool bShouldUpdate = false; + WorldInventory->AddItem(WID, &bShouldUpdate, 1); + + if (bShouldUpdate) + WorldInventory->Update(); + + SendMessageToConsole(CurrentController, L"Gave WID_Buffet_BeatMatchingBoomBox!"); + } + + auto AllWeps = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Buffet/Gameplay/Blueprints/WolfMother/BeatmatchingWeapon/B_Buffet_BeatMatchingWeaponPrototype.B_Buffet_BeatMatchingWeaponPrototype_C")); + + for (int i = 0; i < AllWeps.Num(); i++) + { + auto CurrentWep = AllWeps.At(i); + + if (CurrentWep != nullptr) + { + CurrentWep->Get(CurrentWep->GetOffset("Phase4ScriptingRef")) = StormScript; + } } } if (Index == 6) // Ariana { + auto ReflectScript = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Stars_2"); + for (int i = 0; i < ClientConnections.Num(); i++) { auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Stars/BP_Buffet_Stars_PlayerComponent.BP_Buffet_Stars_PlayerComponent_C")); - } - } - if (Index == 7) // Ariana Dance - { - auto ReviveScripting = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Revive_2"); - - auto ReflectScripting = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Reflect_2"); - - auto ManualTeleportRotation = ReviveScripting->Get(ReviveScripting->GetOffset("Manual_Teleport_Rotation")); - - for (int i = 0; i < ClientConnections.Num(); i++) - { - auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); - CurrentPawn->AddComponentByClass(FindObject("/BuffetPlaylist/Playlist/BuffetCharacterMovementMutatorComponent.BuffetCharacterMovementMutatorComponent_C")); } } if (Index == 8) // Bubbles { - auto BubblesScripting = FindObject("/Buffet/Levels/Buffet_Bubbles.Buffet_Bubbles:PersistentLevel.BP_Buffet_PhaseScripting_Bubble_4"); + //auto BubbleScript = FindObject("/Buffet/Levels/Buffet_Bubbles.Buffet_Bubbles:PersistentLevel.BP_Buffet_PhaseScripting_Bubble_4"); + //auto BubbleSpline = FindObject("/Buffet/Levels/Buffet_Bubbles.Buffet_Bubbles:PersistentLevel.BP_Buffet_SmallBubblePath_2.Spline"); - BubblesScripting->Get(BubblesScripting->GetOffset("bUsePlayerMovementMode")) = false; - - BubblesScripting->Get(BubblesScripting->GetOffset("FollowActor")) = FindObject("/Buffet/Levels/Buffet_Bubbles.Buffet_Bubbles:PersistentLevel.BP_Buffet_BubbleFollowActor_2"); - } - if (Index == 9) // Clouds - { for (int i = 0; i < ClientConnections.Num(); i++) { auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + auto ComptoRemove = CurrentPawn->GetComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Stars/BP_Buffet_Stars_PlayerComponent.BP_Buffet_Stars_PlayerComponent_C")); - auto RemoveComponent = CurrentPawn->GetComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Stars/BP_Buffet_Stars_PlayerComponent.BP_Buffet_Stars_PlayerComponent_C")); + auto BubbleMovementComponent = CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Bubble/BP_BubblePlayerMovementComponent.BP_BubblePlayerMovementComponent_C")); - CurrentPawn->ProcessEvent(CurrentPawn->FindFunction("K2_DestroyComponent"), RemoveComponent); + /* + struct + { + UObject* InSplineComponent; + float StartDistance; - CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Llama/BP_Buffet_Llama_PlayerComponent.BP_Buffet_Llama_PlayerComponent_C")); - CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/PostEvent/LlamaSpeedControlComponent.LlamaSpeedControlComponent_C")); + }SetSplineComponent; + SetSplineComponent.StartDistance = 0; + SetSplineComponent.InSplineComponent = BubbleSpline; + + // Works but too fast and player not in correct place on the spline. + BubbleMovementComponent->ProcessEvent(BubbleMovementComponent->FindFunction("SetSplineComponent"), &SetSplineComponent); + BubbleMovementComponent->Get(BubbleMovementComponent->GetOffset("SplineComponent")) = BubbleSpline; + BubbleMovementComponent->Get(BubbleMovementComponent->GetOffset("bIsMovingAlongSpline")) = true; + auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); + auto GameState = Cast(GameMode->GetGameState()); + BubbleMovementComponent->Get(BubbleMovementComponent->GetOffset("StartServerWorldTime")) = GameState->GetServerWorldTimeSeconds(); + bool IsMoving = true; + BubbleMovementComponent->ProcessEvent(BubbleMovementComponent->FindFunction("SetIsMovingAlongSpline"), &IsMoving); + */ + + CurrentPawn->ProcessEvent(CurrentPawn->FindFunction("K2_DestroyComponent"), &ComptoRemove); } } if (Index == 10) // Escher @@ -454,7 +496,7 @@ void AttemptFinishPhaseHook(AActor* SpecialEventScript, FGameplayTag PhaseTag) static auto OnRep_ReplicatedActivePhaseIndexFn = FindObject("/Script/SpecialEventGameplayRuntime.SpecialEventScript.OnRep_ReplicatedActivePhaseIndex"); - auto Connections = GetWorld()->GetNetDriver()->GetClientConnections(); + auto& Connections = GetWorld()->GetNetDriver()->GetClientConnections(); if (LastTag == "Kiwi.Phase.Islands") // PrisonBlocks (Event Start) { @@ -511,6 +553,72 @@ void TeleportPlayerPawnHook(UObject* Context, FFrame& Stack, void* Ret) return TeleportPlayerPawnOriginal(Context, Stack, Ret); } +/* + +// Storm King Spawning, I might put this in its own class soon. +bool bStormKingSpawned = false; +static inline void (*DADBroOnGamephaseStepChangedOriginal)(UObject* Context, FFrame& Stack, void* Ret); +void DADBroOnGamephaseStepChangedHook(UObject* Context, FFrame& Stack, void* Ret) +{ + auto GameState = Cast(GetWorld()->GetGameState()); + + if (!GameState) + return DADBroOnGamephaseStepChangedOriginal(Context, Stack, Ret); + + FRotator Rotation; + Context->ProcessEvent(Context->FindFunction("GetDesiredDadBroRotation"), &Rotation); + + if (GameState->GetGamePhaseStep() == EAthenaGamePhaseStep::StormShrinking && bStormKingSpawned == false) + { + auto StormKing = GetWorld()->SpawnActor(FindObject("/Game/Athena/DADBRO/DADBRO_Pawn.DADBRO_Pawn_C"), FVector{ 5150.0f, 4900.0f, -100.0f }, Rotation.Quaternion(), FVector{ 1,1,1 }, CreateSpawnParameters(ESpawnActorCollisionHandlingMethod::AlwaysSpawn)); + + if (StormKing) + { + bStormKingSpawned = true; + Context->Get(Context->GetOffset("DadBroPawn")) = StormKing; + Context->ProcessEvent(Context->FindFunction("OnRep_DadBroPawn")); + } + else + { + LOG_INFO(LogDev, "Failed to spawn StormKing!"); + } + } + + return DADBroOnGamephaseStepChangedOriginal(Context, Stack, Ret); +} +*/ + +static void (*StartEventAtIndexOriginal)(UObject* Context, FFrame& Stack, void* Ret); +void StartEventAtIndexHook(UObject* Context, FFrame& Stack, void* Ret) +{ + int32 InStartingIndex; + Stack.StepCompiledIn(&InStartingIndex); + + if (Fortnite_Version == 17.50) + { + auto Scripting = FindObject("/Kiwi/Levels/Kiwi_P.Kiwi_P:PersistentLevel.BP_Kiwi_Master_Scripting_2"); + auto EventPlaylist = GetEventPlaylist(); + + struct { UObject* GameState; UObject* Playlist; FGameplayTagContainer PlaylistContextTags; } OnReadyParams{ Cast(GetWorld()->GetGameState()), EventPlaylist }; + if (EventPlaylist) + { + static auto GameplayTagContainerOffset = EventPlaylist->GetOffset("GameplayTagContainer"); + OnReadyParams.PlaylistContextTags = EventPlaylist->Get(GameplayTagContainerOffset); + } + else + { + OnReadyParams.PlaylistContextTags = FGameplayTagContainer(); + } + + Scripting->ProcessEvent(Scripting->FindFunction("OnReady_F1A32853487CB7603278E6847A5F2625"), &OnReadyParams); + Context->ProcessEvent(Context->FindFunction("LoadKiwiAssets"), &OnReadyParams); + Context->ProcessEvent(Context->FindFunction("BP_OnScriptReady"), &OnReadyParams); + Scripting->ProcessEvent(Scripting->FindFunction("startevent"), &InStartingIndex); + } + + return StartEventAtIndexOriginal(Context, Stack, Ret); +} + static __int64 (*FlowStep_SetPhaseToActiveOriginal)(AActor* SpecialEventPhase); __int64 FlowStep_SetPhaseToActiveHook(AActor* SpecialEventPhase) @@ -844,6 +952,12 @@ DWORD WINAPI Main(LPVOID) { Hooking::MinHook::Hook(FindObject("/Script/FortniteGame.Default__FortMissionLibrary"), FindObject(L"/Script/FortniteGame.FortMissionLibrary:TeleportPlayerPawn"), TeleportPlayerPawnHook, (PVOID*)&TeleportPlayerPawnOriginal, false, true); + // Todo hook UBuffetRacePlayerMovementComponent::ServerTeleportPlayer? + } + if (Fortnite_Version == 17.50) + { + Hooking::MinHook::Hook(FindObject("/Script/SpecialEventGameplayRuntime.Default__SpecialEventScript"), FindObject(L"/Script/SpecialEventGameplayRuntime.SpecialEventScript:StartEventAtIndex"), StartEventAtIndexHook, + (PVOID*)&StartEventAtIndexOriginal, false, true); } } @@ -1130,6 +1244,12 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerGiveCreativeItem"), AFortPlayerControllerAthena::ServerGiveCreativeItemHook, nullptr, true); + static auto ServerCreativeSetFlightSpeedIndexFn = FindObject(L"/Script/FortniteGame.FortPlayerControllerGameplay.ServerCreativeSetFlightSpeedIndex"); + + if (ServerCreativeSetFlightSpeedIndexFn) + Hooking::MinHook::Hook(FindObject("/Script/FortniteGame.Default__FortPlayerControllerGameplay"), ServerCreativeSetFlightSpeedIndexFn, + AFortPlayerControllerAthena::ServerCreativeSetFlightSpeedIndexHook, nullptr, false, true); + if (Fortnite_Version < 19) // its all screwed up idk { Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerPlaySquadQuickChatMessage"), diff --git a/Project Reboot 3.0/inc.h b/Project Reboot 3.0/inc.h index 75d0c38..d586f27 100644 --- a/Project Reboot 3.0/inc.h +++ b/Project Reboot 3.0/inc.h @@ -82,4 +82,9 @@ public: } }; -*/ \ No newline at end of file +*/ + +struct PadHex10 { char Pad[0x10]; }; +struct PadHex18 { char Pad[0x18]; }; +struct PadHexA8 { char Pad[0xA8]; }; +struct PadHexB0 { char Pad[0xB0]; }; \ No newline at end of file From 4b144b4fa8944a64447cf6d90fcaa0a1c966c5f3 Mon Sep 17 00:00:00 2001 From: Gray <84999745+Milxnor@users.noreply.github.com> Date: Fri, 15 Mar 2024 07:56:54 -0400 Subject: [PATCH 14/14] abcd --- Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters | 2 ++ 1 file changed, 2 insertions(+) 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 5311c96..2b45796 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters @@ -959,6 +959,8 @@ FortniteGame\Source\FortniteGame\Public + + Engine\Source\Runtime\Engine\Classes\Engine Reboot\Public