From ae259f97eb251045083032c7c547af43ca6c4269 Mon Sep 17 00:00:00 2001 From: Milxnor Date: Sun, 5 Mar 2023 22:30:29 -0500 Subject: [PATCH] aa --- Project Reboot 3.0/AbilitySystemComponent.h | 4 +- Project Reboot 3.0/FortGameModeAthena.cpp | 217 ++++++++-- .../FortPlayerControllerAthena.cpp | 13 + .../FortPlayerControllerAthena.h | 12 +- Project Reboot 3.0/FortPlayerPawn.cpp | 84 ++++ Project Reboot 3.0/FortPlayerPawn.h | 15 + Project Reboot 3.0/FortWeapon.h | 6 + Project Reboot 3.0/NetSerialization.h | 4 +- Project Reboot 3.0/PlayerController.cpp | 14 +- Project Reboot 3.0/PlayerController.h | 3 + Project Reboot 3.0/Project Reboot 3.0.vcxproj | 6 + .../Project Reboot 3.0.vcxproj.filters | 48 ++- Project Reboot 3.0/World.cpp | 6 +- Project Reboot 3.0/addresses.cpp | 79 +++- Project Reboot 3.0/addresses.h | 4 + Project Reboot 3.0/calendar.h | 6 + Project Reboot 3.0/dllmain.cpp | 55 ++- Project Reboot 3.0/events.cpp | 0 Project Reboot 3.0/events.h | 407 ++++++++++++++++++ Project Reboot 3.0/finder.h | 48 ++- Project Reboot 3.0/hooking.h | 3 + Project Reboot 3.0/log.h | 1 + Project Reboot 3.0/reboot.h | 1 + 23 files changed, 982 insertions(+), 54 deletions(-) create mode 100644 Project Reboot 3.0/FortPlayerControllerAthena.cpp create mode 100644 Project Reboot 3.0/FortPlayerPawn.cpp create mode 100644 Project Reboot 3.0/FortPlayerPawn.h create mode 100644 Project Reboot 3.0/calendar.h create mode 100644 Project Reboot 3.0/events.cpp create mode 100644 Project Reboot 3.0/events.h diff --git a/Project Reboot 3.0/AbilitySystemComponent.h b/Project Reboot 3.0/AbilitySystemComponent.h index 532f74f..bb829e6 100644 --- a/Project Reboot 3.0/AbilitySystemComponent.h +++ b/Project Reboot 3.0/AbilitySystemComponent.h @@ -7,8 +7,8 @@ struct PadHex18 { char Pad[0x18]; }; struct PadHexA8 { char Pad[0xA8]; }; struct PadHexB0 { char Pad[0xB0]; }; -using FPredictionKey = PadHex18; // PadHex18; -using FGameplayEventData = PadHexA8; // PadHexB0; +using FPredictionKey = PadHex18; +using FGameplayEventData = PadHexB0; class UAbilitySystemComponent : public UObject { diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index 7291cab..97f49a2 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -9,6 +9,7 @@ #include "FortPickup.h" #include "FortLootPackage.h" #include "BuildingContainer.h" +#include "events.h" static bool bFirstPlayerJoined = false; @@ -31,10 +32,16 @@ enum class EDynamicFoundationType : uint8_t EDynamicFoundationType_MAX = 4 }; -void ShowFoundation(AActor* BuildingFoundation) +void ShowFoundation(UObject* BuildingFoundation) { + if (!BuildingFoundation) + return; + SetBitfield(BuildingFoundation->GetPtr("bServerStreamedInLevel"), 2, true); + static auto DynamicFoundationTypeOffset = BuildingFoundation->GetOffset("DynamicFoundationType"); + BuildingFoundation->Get(DynamicFoundationTypeOffset) = true ? 0 : 3; + static auto OnRep_ServerStreamedInLevelFn = FindObject("/Script/FortniteGame.BuildingFoundation.OnRep_ServerStreamedInLevel"); BuildingFoundation->ProcessEvent(OnRep_ServerStreamedInLevelFn); @@ -52,8 +59,10 @@ void ShowFoundation(AActor* BuildingFoundation) BuildingFoundation->ProcessEvent(OnRep_DynamicFoundationRepDataFn); } - static auto FoundationEnabledStateOffset = BuildingFoundation->GetOffset("FoundationEnabledState"); - BuildingFoundation->Get(FoundationEnabledStateOffset) = EDynamicFoundationEnabledState::Enabled; + static auto FoundationEnabledStateOffset = BuildingFoundation->GetOffset("FoundationEnabledState", false); + + if (FoundationEnabledStateOffset != 0) + BuildingFoundation->Get(FoundationEnabledStateOffset) = EDynamicFoundationEnabledState::Enabled; } static void StreamLevel(std::string LevelName, FVector Location = {}) @@ -91,6 +100,12 @@ UObject* GetPlaylistToUse() if (Globals::bCreative) Playlist = FindObject("/Game/Athena/Playlists/Creative/Playlist_PlaygroundV2.Playlist_PlaygroundV2"); + if (Globals::bGoingToPlayEvent) + { + if (Fortnite_Version != 12.61) + Playlist = GetEventPlaylist(); + } + return Playlist; } @@ -137,6 +152,136 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game GameMode->Get("WarmupRequiredPlayerCount") = 1; + SetPlaylist(GetPlaylistToUse()); + + auto Fortnite_Season = std::floor(Fortnite_Version); + + if (Fortnite_Season == 6) + { + if (Fortnite_Version != 6.10) + { + auto Lake = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Lake1")); + auto Lake2 = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Lake2"); + + Fortnite_Version <= 6.21 ? ShowFoundation(Lake) : ShowFoundation(Lake2); + // ^ This shows the lake after or before the event i dont know if this is needed. + } + else + { + auto Lake = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_StreamingTest12")); + ShowFoundation(Lake); + } + + auto FloatingIsland = Fortnite_Version == 6.10 ? FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_StreamingTest13")) : + FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_FloatingIsland")); + + ShowFoundation(FloatingIsland); + } + + if (Fortnite_Season >= 7 && Fortnite_Season <= 10) + { + if (Fortnite_Season == 7) + { + if (Fortnite_Version == 7.30) + { + auto PleasantParkIdk = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.PleasentParkFestivus")); + ShowFoundation(PleasantParkIdk); + + auto PleasantParkGround = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.PleasentParkDefault"); + ShowFoundation(PleasantParkGround); + } + + auto PolarPeak = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_POI_25x36")); + ShowFoundation(PolarPeak); + + auto tiltedtower = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.ShopsNew"); + ShowFoundation(tiltedtower); // 7.40 specific? + } + + else if (Fortnite_Season == 8) + { + auto Volcano = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_POI_50x53_Volcano")); + ShowFoundation(Volcano); + } + + else if (Fortnite_Season == 10) + { + if (Fortnite_Version >= 10.20) + { + auto Island = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_StreamingTest16"); + ShowFoundation(Island); + } + } + + auto TheBlock = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.SLAB_2"); // SLAB_3 is blank + ShowFoundation(TheBlock); + } + + if (Fortnite_Version == 17.50f) { + auto FarmAfter = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.farmbase_2")); + ShowFoundation(FarmAfter); + + auto FarmPhase = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.Farm_Phase_03")); // Farm Phases (Farm_Phase_01, Farm_Phase_02 and Farm_Phase_03) + ShowFoundation(FarmPhase); + } + + if (Fortnite_Version == 17.40f) { + auto AbductedCoral = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.CoralPhase_02")); // Coral Castle Phases (CoralPhase_01, CoralPhase_02 and CoralPhase_03) + ShowFoundation(AbductedCoral); + + auto CoralFoundation_01 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation_0")); + ShowFoundation(CoralFoundation_01); + + auto CoralFoundation_05 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation6")); + ShowFoundation(CoralFoundation_05); + + auto CoralFoundation_07 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation3")); + ShowFoundation(CoralFoundation_07); + + auto CoralFoundation_10 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation2_1")); + ShowFoundation(CoralFoundation_10); + + auto CoralFoundation_13 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation4")); + ShowFoundation(CoralFoundation_13); + + auto CoralFoundation_17 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation5")); + ShowFoundation(CoralFoundation_17); + } + + if (Fortnite_Version == 17.30f) { + auto AbductedSlurpy = FindObject(("LF_Athena_POI_50x50_C /Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.Slurpy_Phase03")); // Slurpy Swamp Phases (Slurpy_Phase01, Slurpy_Phase02 and Slurpy_Phase03) + ShowFoundation(AbductedSlurpy); + } + + if (Fortnite_Season == 13) + { + auto SpawnIsland = FindObject("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Lobby_Foundation"); + ShowFoundation(SpawnIsland); + + // SpawnIsland->RepData->Soemthing = FoundationSetup->LobbyLocation; + } + + if (Fortnite_Version == 12.41) + { + auto JS03 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.LF_Athena_POI_19x19_2")); + ShowFoundation(JS03); + + auto JH00 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head6_18")); + ShowFoundation(JH00); + + auto JH01 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head5_14")); + ShowFoundation(JH01); + + auto JH02 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head3_8")); + ShowFoundation(JH02); + + auto JH03 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head_2")); + ShowFoundation(JH03); + + auto JH04 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head4_11")); + ShowFoundation(JH04); + } + auto PlaylistToUse = GetPlaylistToUse(); if (PlaylistToUse) @@ -153,6 +298,35 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game } } + static int LastNum6 = 1; + + if (AmountOfRestarts != LastNum6) + { + LastNum6 = AmountOfRestarts; + + if (Globals::bGoingToPlayEvent && DoesEventRequireLoading()) + { + bool bb; + LoadEvent(&bb); + + if (!bb) + LastNum6 = -1; + } + } + + static int LastNum5 = 1; + + if (AmountOfRestarts != LastNum5 && LastNum6 == AmountOfRestarts) + { + LastNum5 = AmountOfRestarts; + + bool bb; + CallOnReadys(&bb); + + if (!bb) + LastNum5 = -1; + } + /* static auto FortPlayerStartWarmupClass = FindObject("/Script/FortniteGame.FortPlayerStartWarmup"); TArray Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartWarmupClass); @@ -163,17 +337,6 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game if (ActorsNum == 0) return false; */ - /* static int LastNum4 = 1; - - if (AmountOfRestarts != LastNum4) - { - LastNum4 = AmountOfRestarts; - - auto Playlist = FindObject("/Game/Athena/Playlists/Playlist_DefaultSolo.Playlist_DefaultSolo"); - SetPlaylist(Playlist); - LOG_INFO(LogLoading, "Set playlist!"); - } */ - static auto MapInfoOffset = GameState->GetOffset("MapInfo"); auto MapInfo = GameState->Get(MapInfoOffset); @@ -182,9 +345,6 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game static auto FlightInfosOffset = MapInfo->GetOffset("FlightInfos"); - // if (MapInfo->Get>(FlightInfosOffset).ArrayNum <= 0) - // return false; - static int LastNum3 = 1; if (AmountOfRestarts != LastNum3) @@ -220,22 +380,24 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game GameState->OnRep_GamePhase(); } - SetPlaylist(GetPlaylistToUse()); - GameState->Get("WarmupCountdownEndTime") = TimeSeconds + Duration; GameMode->Get("WarmupCountdownDuration") = Duration; GameState->Get("WarmupCountdownStartTime") = TimeSeconds; GameMode->Get("WarmupEarlyCountdownDuration") = EarlyDuration; + GameState->OnRep_CurrentPlaylistInfo(); + LOG_INFO(LogDev, "Initialized!"); } if (Engine_Version >= 424) // returning true is stripped on c2+ { - // if (GameState->GetPlayersLeft() >= GameMode->Get("WarmupRequiredPlayerCount")) - if (MapInfo->Get>(FlightInfosOffset).ArrayNum <= 0) - return true; + if (GameState->GetPlayersLeft() >= GameMode->Get("WarmupRequiredPlayerCount")) + { + if (MapInfo->Get>(FlightInfosOffset).ArrayNum <= 0) + return true; + } } return Athena_ReadyToStartMatchOriginal(GameMode); @@ -261,6 +423,9 @@ enum class EFortCustomPartType : uint8_t // todo move void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena* GameMode, AActor* NewPlayerActor) { + if (!NewPlayerActor) + return; + auto SpawnIsland_FloorLoot = FindObject("/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_Warmup.Tiered_Athena_FloorLoot_Warmup_C"); auto BRIsland_FloorLoot = FindObject("/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_01.Tiered_Athena_FloorLoot_01_C"); @@ -343,11 +508,11 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena static UFortItemDefinition* WoodItemData = FindObject(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData"); WorldInventory->AddItem(EditToolItemDefinition, nullptr); - WorldInventory->AddItem(PickaxeDefinition, nullptr); WorldInventory->AddItem(BuildingItemData_Wall, nullptr); WorldInventory->AddItem(BuildingItemData_Floor, nullptr); WorldInventory->AddItem(BuildingItemData_Stair_W, nullptr); WorldInventory->AddItem(BuildingItemData_RoofS, nullptr); + WorldInventory->AddItem(PickaxeDefinition, nullptr); WorldInventory->AddItem(WoodItemData, nullptr, 100); WorldInventory->Update(true); @@ -392,7 +557,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena PlayerStateAthena->ProcessEvent(OnRep_bHasStartedPlayingFn); } - if (false) + // if (false) { static auto GameplayAbilitySet = LoadObject(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer") ? LoadObject(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer") : @@ -471,7 +636,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena GameMemberInfo->MemberUniqueId = PlayerStateAthena->Get("UniqueId"); } - static auto GameMemberInfoArray_MembersOffset = 0x0108; + static auto GameMemberInfoArray_MembersOffset = FindOffsetStruct("/Script/FortniteGame.GameMemberInfoArray", "Members"); auto GameMemberInfoArray = GameState->GetPtr(GameMemberInfoArrayOffset); @@ -479,5 +644,5 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena GameMemberInfoArray->MarkArrayDirty(); } - return Athena_HandleStartingNewPlayerOriginal(GameMode, NewPlayer); + return Athena_HandleStartingNewPlayerOriginal(GameMode, NewPlayerActor); } \ No newline at end of file diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.cpp b/Project Reboot 3.0/FortPlayerControllerAthena.cpp new file mode 100644 index 0000000..3923d36 --- /dev/null +++ b/Project Reboot 3.0/FortPlayerControllerAthena.cpp @@ -0,0 +1,13 @@ +#include "FortPlayerControllerAthena.h" + +void AFortPlayerControllerAthena::GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation) +{ + if (auto MyFortPawn = PlayerController->GetMyFortPawn()) + { + Location = MyFortPawn->GetActorLocation(); + Rotation = PlayerController->GetControlRotation(); + return; + } + + return AFortPlayerControllerAthena::GetPlayerViewPointOriginal(PlayerController, Location, Rotation); +} \ No newline at end of file diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.h b/Project Reboot 3.0/FortPlayerControllerAthena.h index 232401b..8ffd655 100644 --- a/Project Reboot 3.0/FortPlayerControllerAthena.h +++ b/Project Reboot 3.0/FortPlayerControllerAthena.h @@ -6,14 +6,18 @@ class AFortPlayerControllerAthena : public AFortPlayerController { public: + static inline void (*GetPlayerViewPointOriginal)(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation); + + AFortPlayerStateAthena* GetPlayerStateAthena() + { + return (AFortPlayerStateAthena*)GetPlayerState(); + } + static void ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn) { static auto AcknowledgedPawnOffset = Controller->GetOffset("AcknowledgedPawn"); Controller->Get(AcknowledgedPawnOffset) = Pawn; } - AFortPlayerStateAthena* GetPlayerStateAthena() - { - return (AFortPlayerStateAthena*)GetPlayerState(); - } + static void GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation); }; \ No newline at end of file diff --git a/Project Reboot 3.0/FortPlayerPawn.cpp b/Project Reboot 3.0/FortPlayerPawn.cpp new file mode 100644 index 0000000..1dd14de --- /dev/null +++ b/Project Reboot 3.0/FortPlayerPawn.cpp @@ -0,0 +1,84 @@ +#include "FortPlayerPawn.h" +#include + +void AFortPlayerPawn::ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZiplinePawnState InZiplineState) +{ + static auto ZiplineStateOffset = Pawn->GetOffset("ZiplineState"); + + auto PawnZiplineState = Pawn->GetPtr<__int64>(ZiplineStateOffset); + + static auto AuthoritativeValueOffset = FindOffsetStruct("/Script/FortniteGame.ZiplinePawnState", "AuthoritativeValue"); + + if (*(int*)(__int64(&InZiplineState) + AuthoritativeValueOffset) > *(int*)(__int64(PawnZiplineState) + AuthoritativeValueOffset)) + { + static auto ZiplinePawnStateClass = FindObject("/Script/FortniteGame.ZiplinePawnState"); + static auto ZiplinePawnStateSize = ZiplinePawnStateClass->GetPropertiesSize(); + + CopyStruct(PawnZiplineState, &InZiplineState, ZiplinePawnStateSize); + } + + static bool bFoundFunc = false; + + static void (*OnRep_ZiplineState)(AFortPlayerPawn* Pawn); + + if (!bFoundFunc) + { + bFoundFunc = true; + + static auto Addrr = Memcury::Scanner::FindStringRef(L"ZIPLINES!! Role(%s) AFortPlayerPawn::OnRep_ZiplineState ZiplineState.bIsZiplining=%d").Get(); + + std::cout << "Addrr: " << Addrr << '\n'; + + if (Addrr) + { + for (int i = 600; i >= 0; i--) + { + // LOG("[{}] 0x{:x} 0x{:x}", i, (int)*(uint8_t*)Addr - i, (int)*(uint8_t*)(Addr - i), (int)*(uint8_t*)(Addr - i + 1)); + + if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x53) + { + OnRep_ZiplineState = decltype(OnRep_ZiplineState)(Addrr - i); + } + } + } + + // LOG_INFO(LogDev, "OnRep_ZiplineState: 0x{:x}\n", (uintptr_t)OnRep_ZiplineState - __int64(GetModuleHandleW(0))); + } + + if (OnRep_ZiplineState) + OnRep_ZiplineState(Pawn); +} + +void AFortPlayerPawn::ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup* Pickup, float InFlyTime, FVector InStartDirection, bool bPlayPickupSound) +{ + static auto bPickedUpOffset = Pickup->GetOffset("bPickedUp"); + + if (Pickup && !Pickup->Get(bPickedUpOffset)) + { + static auto IncomingPickupsOffset = Pawn->GetOffset("IncomingPickups"); + static auto PickupLocationDataOffset = Pickup->GetOffset("PickupLocationData"); + auto PickupLocationData = Pickup->GetPtr<__int64>(PickupLocationDataOffset); + + Pawn->Get>(IncomingPickupsOffset).Add(Pickup); + + static auto PickupTargetOffset = FindOffsetStruct("/Script/FortniteGame.FortPickupLocationData", "PickupTarget"); + static auto FlyTimeOffset = FindOffsetStruct("/Script/FortniteGame.FortPickupLocationData", "FlyTime"); + static auto ItemOwnerOffset = FindOffsetStruct("/Script/FortniteGame.FortPickupLocationData", "ItemOwner"); + static auto StartDirectionOffset = FindOffsetStruct("/Script/FortniteGame.FortPickupLocationData", "StartDirection"); + static auto PickupGuidOffset = FindOffsetStruct("/Script/FortniteGame.FortPickupLocationData", "PickupGuid"); + + *(AFortPawn**)(__int64(PickupLocationData) + PickupTargetOffset) = Pawn; + *(float*)(__int64(PickupLocationData) + FlyTimeOffset) = 0.40; + *(AFortPawn**)(__int64(PickupLocationData) + ItemOwnerOffset) = Pawn; + *(FVector*)(__int64(PickupLocationData) + StartDirectionOffset) = InStartDirection; + *(FGuid*)(__int64(PickupLocationData) + PickupGuidOffset) = Pawn->GetCurrentWeapon() ? Pawn->GetCurrentWeapon()->GetItemEntryGuid() : FGuid(); + + static auto OnRep_PickupLocationDataFn = FindObject(L"/Script/FortniteGame.FortPickup.OnRep_PickupLocationData"); + Pickup->ProcessEvent(OnRep_PickupLocationDataFn); + + Pickup->Get(bPickedUpOffset) = true; + + static auto OnRep_bPickedUpFn = FindObject(L"/Script/FortniteGame.FortPickup.OnRep_bPickedUp"); + Pickup->ProcessEvent(OnRep_bPickedUpFn); + } +} \ No newline at end of file diff --git a/Project Reboot 3.0/FortPlayerPawn.h b/Project Reboot 3.0/FortPlayerPawn.h new file mode 100644 index 0000000..8b65a92 --- /dev/null +++ b/Project Reboot 3.0/FortPlayerPawn.h @@ -0,0 +1,15 @@ +#pragma once + +#include "FortPawn.h" +#include "FortPickup.h" + +struct PadHex100 { char pad[0x100]; }; + +using FZiplinePawnState = PadHex100; + +class AFortPlayerPawn : public AFortPawn +{ +public: + static void ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZiplinePawnState InZiplineState); + static void ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup* Pickup, float InFlyTime, FVector InStartDirection, bool bPlayPickupSound); +}; \ No newline at end of file diff --git a/Project Reboot 3.0/FortWeapon.h b/Project Reboot 3.0/FortWeapon.h index c43ca19..50e0f7d 100644 --- a/Project Reboot 3.0/FortWeapon.h +++ b/Project Reboot 3.0/FortWeapon.h @@ -12,5 +12,11 @@ public: return Get(WeaponDataOffset); } + FGuid& GetItemEntryGuid() + { + static auto ItemEntryGuidOffset = GetOffset("ItemEntryGuid"); + return Get(ItemEntryGuidOffset); + } + static UClass* StaticClass(); }; \ No newline at end of file diff --git a/Project Reboot 3.0/NetSerialization.h b/Project Reboot 3.0/NetSerialization.h index cc1fbea..6aac683 100644 --- a/Project Reboot 3.0/NetSerialization.h +++ b/Project Reboot 3.0/NetSerialization.h @@ -110,8 +110,8 @@ struct FFastArraySerializer void MarkArrayDirty() { - ((FFastArraySerializer2*)this)->MarkArrayDirty(); - return; + // ((FFastArraySerializer2*)this)->MarkArrayDirty(); + // return; // ItemMap.Reset(); // This allows to clients to add predictive elements to arrays without affecting replication. GetArrayReplicationKey()++; diff --git a/Project Reboot 3.0/PlayerController.cpp b/Project Reboot 3.0/PlayerController.cpp index 006220d..92e84c4 100644 --- a/Project Reboot 3.0/PlayerController.cpp +++ b/Project Reboot 3.0/PlayerController.cpp @@ -2,20 +2,28 @@ #include "reboot.h" +FRotator APlayerController::GetControlRotation() +{ + static auto fn = FindObject(L"/Script/Engine.Controller.GetControlRotation"); + FRotator rot; + this->ProcessEvent(fn, &rot); + return rot; +} + void APlayerController::Possess(class APawn* Pawn) { - static auto fn = FindObject("/Script/Engine.Controller.Possess"); + static auto fn = FindObject(L"/Script/Engine.Controller.Possess"); this->ProcessEvent(fn, &Pawn); } void APlayerController::ServerRestartPlayer() { - static auto fn = FindObject("/Script/Engine.PlayerController.ServerRestartPlayer"); + static auto fn = FindObject(L"/Script/Engine.PlayerController.ServerRestartPlayer"); this->ProcessEvent(fn); } UClass* APlayerController::StaticClass() { - static auto Class = FindObject("/Script/Engine.PlayerController"); + static auto Class = FindObject(L"/Script/Engine.PlayerController"); return Class; } \ No newline at end of file diff --git a/Project Reboot 3.0/PlayerController.h b/Project Reboot 3.0/PlayerController.h index 8374daf..5d98c84 100644 --- a/Project Reboot 3.0/PlayerController.h +++ b/Project Reboot 3.0/PlayerController.h @@ -3,6 +3,8 @@ #include "Class.h" #include "Actor.h" +#include "Rotator.h" + class APlayerController : public AActor { public: @@ -30,6 +32,7 @@ public: return this->Get(PawnOffset); } + FRotator GetControlRotation(); void Possess(class APawn* Pawn); void ServerRestartPlayer(); diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj b/Project Reboot 3.0/Project Reboot 3.0.vcxproj index 68572f8..3dc8fb8 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj @@ -174,6 +174,7 @@ + @@ -186,6 +187,8 @@ + + @@ -211,6 +214,7 @@ + @@ -219,6 +223,7 @@ + @@ -233,6 +238,7 @@ + diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters index 8d06048..6c6d04a 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters @@ -19,9 +19,6 @@ FortniteGame\Source\FortniteGame\Private - - Reboot - Engine\Source\Runtime\CoreUObject\Private @@ -107,6 +104,18 @@ FortniteGame\Source\FortniteGame\Private\Items + + FortniteGame\Source\FortniteGame\Private\Pawns + + + Reboot\Private\Gameplay + + + Reboot\Private\Gameplay + + + FortniteGame\Source\FortniteGame\Private\Player + @@ -121,9 +130,6 @@ Engine\Source\Runtime\Core\Public\UObject - - Reboot - Engine\Source\Runtime\CoreUObject\Public\UObject @@ -175,9 +181,6 @@ FortniteGame\Source\FortniteGame\Public - - Reboot - Engine\Source\Runtime\Core\Public\Math @@ -341,6 +344,21 @@ FortniteGame\Source\FortniteGame\Public\Building + + FortniteGame\Source\FortniteGame\Public\Pawns + + + Reboot\Public\Gameplay + + + Reboot\Public + + + Reboot\Public + + + Reboot\Public + @@ -493,6 +511,18 @@ {bcb0d983-0b85-4ca6-9fac-6567c7d79921} + + {563ca89b-be74-42a6-a995-f87ac7a532e4} + + + {ad1c6299-9a6d-4eba-a1f8-66642a8afd21} + + + {52d438db-beaf-44be-bddd-9aeb07c2459f} + + + {9923af6f-0a65-43f7-ad58-8a66e83814ba} + diff --git a/Project Reboot 3.0/World.cpp b/Project Reboot 3.0/World.cpp index cd4c8ef..a17522d 100644 --- a/Project Reboot 3.0/World.cpp +++ b/Project Reboot 3.0/World.cpp @@ -13,6 +13,8 @@ void UWorld::Listen() constexpr bool bUseBeacons = true; + int Port = 7777; + if (bUseBeacons) { static auto BeaconClass = FindObject(L"/Script/FortniteGame.FortOnlineBeaconHost"); @@ -27,6 +29,8 @@ void UWorld::Listen() static bool (*InitHost)(UObject* Beacon) = decltype(InitHost)(Addresses::InitHost); static void (*PauseBeaconRequests)(UObject* Beacon, bool bPause) = decltype(PauseBeaconRequests)(Addresses::PauseBeaconRequests); + NewBeacon->Get("ListenPort") = Engine_Version < 426 ? Port - 1 : Port; + InitHost(NewBeacon); PauseBeaconRequests(NewBeacon, false); @@ -46,8 +50,6 @@ void UWorld::Listen() NewNetDriver->Get("NetDriverName") = GameNetDriverName; GetWorld()->Get("NetDriver") = NewNetDriver; - int Port = 7777; - FURL URL = FURL(); URL.Port = Port - (Engine_Version >= 426); diff --git a/Project Reboot 3.0/addresses.cpp b/Project Reboot 3.0/addresses.cpp index 4e7099b..69cf926 100644 --- a/Project Reboot 3.0/addresses.cpp +++ b/Project Reboot 3.0/addresses.cpp @@ -108,29 +108,82 @@ void Addresses::SetupVersion() void Addresses::FindAll() { + LOG_INFO(LogDev, "9241"); Addresses::ProcessEvent = FindProcessEvent(); + LOG_INFO(LogDev, "151"); + Addresses::StaticFindObject = FindStaticFindObject(); + LOG_INFO(LogDev, "2151"); + Addresses::GetPlayerViewpoint = FindGetPlayerViewpoint(); + LOG_INFO(LogDev, "1246"); + Addresses::CreateNetDriver = FindCreateNetDriver(); + LOG_INFO(LogDev, "2561"); + Addresses::InitHost = FindInitHost(); + LOG_INFO(LogDev, "1341"); + Addresses::PauseBeaconRequests = FindPauseBeaconRequests(); + LOG_INFO(LogDev, "1351"); + Addresses::SpawnActor = FindSpawnActor(); + LOG_INFO(LogDev, "1`231"); + Addresses::InitListen = FindInitListen(); + LOG_INFO(LogDev, "52175"); + Addresses::SetWorld = FindSetWorld(); + LOG_INFO(LogDev, "5432"); + Addresses::KickPlayer = FindKickPlayer(); + LOG_INFO(LogDev, "123"); + Addresses::TickFlush = FindTickFlush(); + LOG_INFO(LogDev, "1123"); + Addresses::GetNetMode = FindGetNetMode(); + LOG_INFO(LogDev, "113"); + Addresses::Realloc = FindRealloc(); + LOG_INFO(LogDev, "1231"); + Addresses::CollectGarbage = FindCollectGarbage(); + LOG_INFO(LogDev, "1123"); + Addresses::NoMCP = FindNoMCP(); + LOG_INFO(LogDev, "131"); + Addresses::PickTeam = FindPickTeam(); + LOG_INFO(LogDev, "132"); + Addresses::InternalTryActivateAbility = FindInternalTryActivateAbility(); + LOG_INFO(LogDev, "17"); + Addresses::GiveAbility = FindGiveAbility(); + LOG_INFO(LogDev, "156"); + Addresses::CantBuild = FindCantBuild(); + LOG_INFO(LogDev, "16"); + Addresses::ReplaceBuildingActor = FindReplaceBuildingActor(); + LOG_INFO(LogDev, "15"); + Addresses::GiveAbilityAndActivateOnce = FindGiveAbilityAndActivateOnce(); + LOG_INFO(LogDev, "14"); + Addresses::OnDamageServer = FindOnDamageServer(); + LOG_INFO(LogDev, "13"); + Addresses::StaticLoadObject = FindStaticLoadObject(); + LOG_INFO(LogDev, "12"); + + Addresses::ActorGetNetMode = FindActorGetNetMode(); + LOG_INFO(LogDev, "11"); + + Addresses::ChangeGameSessionId = FindChangeGameSessionId(); + LOG_INFO(LogDev, "10"); + } void Addresses::Print() @@ -161,6 +214,8 @@ void Addresses::Print() LOG_INFO(LogDev, "GiveAbilityAndActivateOnce: 0x{:x}", GiveAbilityAndActivateOnce - Base); LOG_INFO(LogDev, "OnDamageServer: 0x{:x}", OnDamageServer - Base); LOG_INFO(LogDev, "StaticLoadObject: 0x{:x}", StaticLoadObject - Base); + LOG_INFO(LogDev, "ActorGetNetMode: 0x{:x}", ActorGetNetMode - Base); + LOG_INFO(LogDev, "ChangeGameSessionId: 0x{:x}", ChangeGameSessionId - Base); } void Offsets::FindAll() @@ -217,7 +272,6 @@ void Addresses::Init() StaticFindObjectOriginal = decltype(StaticFindObjectOriginal)(StaticFindObject); UWorld::SpawnActorOriginal = decltype(UWorld::SpawnActorOriginal)(SpawnActor); UNetDriver::InitListenOriginal = decltype(UNetDriver::InitListenOriginal)(InitListen); - UNetDriver::SetWorldOriginal = decltype(UNetDriver::SetWorldOriginal)(SetWorld); AGameSession::KickPlayerOriginal = decltype(AGameSession::KickPlayerOriginal)(KickPlayer); UNetDriver::TickFlushOriginal = decltype(UNetDriver::TickFlushOriginal)(TickFlush); FMemory::Realloc = decltype(FMemory::Realloc)(Realloc); @@ -226,6 +280,10 @@ void Addresses::Init() ABuildingActor::OnDamageServerOriginal = decltype(ABuildingActor::OnDamageServerOriginal)(OnDamageServer); StaticLoadObjectOriginal = decltype(StaticLoadObjectOriginal)(StaticLoadObject); + static auto DefaultNetDriver = FindObject("/Script/Engine.Default__NetDriver"); + Addresses::SetWorld = Engine_Version < 426 ? Addresses::SetWorld : __int64(DefaultNetDriver->VFTable[Addresses::SetWorld]); + UNetDriver::SetWorldOriginal = decltype(UNetDriver::SetWorldOriginal)(SetWorld); + // if (Engine_Version >= 421) ChunkedObjects = decltype(ChunkedObjects)(ObjectArray); // else UnchunkedObjects = decltype(UnchunkedObjects)(ObjectArray); } @@ -244,5 +302,24 @@ std::vector Addresses::GetFunctionsToNull() toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 57 48 81 EC ? ? ? ? 48 8B BA ? ? ? ? 48 8B DA 0F 29").Get()); // Pawn Overlap } + if (Engine_Version == 422) + { + // toNull.push_back(Memcury::Scanner::FindPattern("40 55 56 41 54 48 8B EC 48 81 EC ? ? ? ? 48 8B 01 4C 8B E2 48 8B F1 FF 90").Get()); // chnaging cameasesion + } + + if (Engine_Version == 425) + { + toNull.push_back(Memcury::Scanner::FindPattern("40 57 41 56 48 81 EC ? ? ? ? 80 3D ? ? ? ? ? 0F B6 FA 44 8B F1 74 3A 80 3D ? ? ? ? ? 0F 82").Get()); // collect garbage + // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 48 8D 68 A1 48 81 EC ? ? ? ? 48 89 58 08 4C 89 60 F0 45 0F B6 E0 4C").Get()); // Changing Gamesession + // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 48 8D 68 A1 48 81 EC ? ? ? ? 48 89 58 08 4C 89 60 F0 4C 8B E2 4C 89").Get()); // ^ + } + + if (Fortnite_Version == 12.61) + { + // toNull.push_back(Memcury::Scanner::FindPattern("48 89 4C 24 ? 55 56 57 41 56 48 81 EC ? ? ? ? 4C 8B B1 ? ? ? ? 33 F6 4C 89 B4 24 ? ? ? ? 48 8B").Get()); // fritter crash + } + + toNull.push_back(Addresses::ChangeGameSessionId); + return toNull; } \ No newline at end of file diff --git a/Project Reboot 3.0/addresses.h b/Project Reboot 3.0/addresses.h index 27b3063..2d3480d 100644 --- a/Project Reboot 3.0/addresses.h +++ b/Project Reboot 3.0/addresses.h @@ -32,6 +32,10 @@ namespace Addresses extern inline uint64 ReplaceBuildingActor = 0; extern inline uint64 GiveAbilityAndActivateOnce = 0; extern inline uint64 OnDamageServer = 0; + extern inline uint64 GIsServer = 0; + extern inline uint64 GIsClient = 0; + extern inline uint64 ActorGetNetMode = 0; + extern inline uint64 ChangeGameSessionId = 0; void SetupVersion(); // Finds Engine Version void FindAll(); diff --git a/Project Reboot 3.0/calendar.h b/Project Reboot 3.0/calendar.h new file mode 100644 index 0000000..caf6f99 --- /dev/null +++ b/Project Reboot 3.0/calendar.h @@ -0,0 +1,6 @@ +// To move, dont include this in any headers btw + +#pragma once + +#include "reboot.h" + diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 1816042..d8d42f0 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -8,8 +8,10 @@ #include "GameSession.h" #include "FortPlayerControllerAthena.h" #include "AbilitySystemComponent.h" +#include "FortPlayerPawn.h" #include "Map.h" +#include "events.h" enum ENetMode { @@ -21,6 +23,8 @@ enum ENetMode }; static ENetMode GetNetModeHook() { /* std::cout << "AA!\n"; */ return ENetMode::NM_DedicatedServer; } +static ENetMode GetNetModeHook2() { /* std::cout << "AA!\n"; */ return ENetMode::NM_DedicatedServer; } + static void NoMCPHook() { return; } static void CollectGarbageHook() { return; } @@ -48,11 +52,12 @@ DWORD WINAPI Main(LPVOID) Offsets::Print(); Addresses::FindAll(); - Addresses::Print(); Addresses::Init(); + Addresses::Print(); static auto GameModeDefault = FindObject(L"/Script/FortniteGame.Default__FortGameModeAthena"); - static auto FortPlayerControllerAthenaDefault = FindObject(L"/Script/FortniteGame.Default__FortPlayerControllerAthena"); + static auto FortPlayerControllerAthenaDefault = FindObject(L"/Game/Athena/Athena_PlayerController.Default__Athena_PlayerController_C"); + static auto FortPlayerPawnAthenaDefault = FindObject(L"/Game/Athena/PlayerPawn_Athena.Default__PlayerPawn_Athena_C"); static auto FortAbilitySystemComponentAthenaDefault = FindObject(L"/Script/FortniteGame.Default__FortAbilitySystemComponentAthena"); static auto SwitchLevel = FindObject(L"/Script/Engine.PlayerController.SwitchLevel"); @@ -73,6 +78,32 @@ DWORD WINAPI Main(LPVOID) GetLocalPlayerController()->ProcessEvent(SwitchLevel, &Level); + /* + auto GIsClient = Memcury::Scanner(FindGIsServer()); + + *GIsClient.GetAs() = false; + *(bool*)((uintptr_t)GIsClient.Get() + 1) = true; + */ + + /* auto GIsServer = Memcury::Scanner(__int64(GetModuleHandleW(0)) + 0x804B65A); // Memcury::Scanner::FindStringRef(L"STAT_UpdateLevelStreaming").ScanFor({ 0x80, 0x3D }, false, 1).RelativeOffset(2); + + LOG_INFO(LogDev, "GIsServer: 0x{:x}", GIsServer.Get() - __int64(GetModuleHandleW(0))); + LOG_INFO(LogDev, "gisserver - 1: 0x{:x}", __int64(((uintptr_t)GIsServer.Get() - 1)) - __int64(GetModuleHandleW(0))); + LOG_INFO(LogDev, "FindGIsServer: 0x{:x}", FindGIsServer() - __int64(GetModuleHandleW(0))); + LOG_INFO(LogDev, "FindGIsClient: 0x{:x}", FindGIsClient() - __int64(GetModuleHandleW(0))); + + *GIsServer.GetAs() = true; + *(bool*)((uintptr_t)GIsServer.Get() - 1) = false; */ + + /* struct { UObject* World; bool ret; } parms{GetWorld()}; + + static auto IsDedicatedServerFn = FindObject(L"/Script/Engine.KismetSystemLibrary.IsDedicatedServer"); + UGameplayStatics::StaticClass()->ProcessEvent(IsDedicatedServerFn, &parms); + + LOG_INFO(LogDev, "isded: {}", parms.ret); */ + + Hooking::MinHook::Hook((PVOID)Addresses::ActorGetNetMode, (PVOID)GetNetModeHook2, nullptr); + auto& LocalPlayers = GetLocalPlayers(); if (LocalPlayers.Num() && LocalPlayers.Data) @@ -82,6 +113,9 @@ DWORD WINAPI Main(LPVOID) for (auto func : Addresses::GetFunctionsToNull()) { + if (func == 0) + continue; + *(uint8_t*)func = 0xC3; } @@ -110,6 +144,11 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/Engine.PlayerController.ServerAcknowledgePossession"), AFortPlayerControllerAthena::ServerAcknowledgePossessionHook, nullptr, false); + Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerPawn.ServerSendZiplineState"), + AFortPlayerPawn::ServerSendZiplineStateHook, nullptr, false); + Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerPawn.ServerHandlePickup"), + AFortPlayerPawn::ServerHandlePickupHook, nullptr, false); + Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbility"), UAbilitySystemComponent::ServerTryActivateAbilityHook, nullptr, false); Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbilityWithEventData"), @@ -125,6 +164,7 @@ DWORD WINAPI Main(LPVOID) AFortPlayerController::ServerAttemptAircraftJumpHook, nullptr, false); } + Hooking::MinHook::Hook((PVOID)Addresses::GetPlayerViewpoint, (PVOID)AFortPlayerControllerAthena::GetPlayerViewPointHook, (PVOID*)&AFortPlayerControllerAthena::GetPlayerViewPointOriginal); Hooking::MinHook::Hook((PVOID)Addresses::KickPlayer, (PVOID)AGameSession::KickPlayerHook, (PVOID*)&AGameSession::KickPlayerOriginal); Hooking::MinHook::Hook((PVOID)Addresses::TickFlush, (PVOID)UNetDriver::TickFlushHook, (PVOID*)&UNetDriver::TickFlushOriginal); Hooking::MinHook::Hook((PVOID)Addresses::OnDamageServer, (PVOID)ABuildingActor::OnDamageServerHook, (PVOID*)&ABuildingActor::OnDamageServerOriginal); @@ -133,6 +173,17 @@ DWORD WINAPI Main(LPVOID) srand(time(0)); + while (true) + { + if (GetAsyncKeyState(VK_F7) & 1) + { + LOG_INFO(LogEvent, "Starting {} event!", GetEventName()); + StartEvent(); + } + + Sleep(1000 / 30); + } + return 0; } diff --git a/Project Reboot 3.0/events.cpp b/Project Reboot 3.0/events.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Project Reboot 3.0/events.h b/Project Reboot 3.0/events.h new file mode 100644 index 0000000..467f9d3 --- /dev/null +++ b/Project Reboot 3.0/events.h @@ -0,0 +1,407 @@ +#pragma once + +#include + +#include "Object.h" +#include "reboot.h" +#include "GameplayStatics.h" + +struct Event +{ + std::string EventDisplayName; + std::string LoaderClass; + std::string LoaderFunction; + __int64 AdditionalLoaderParams; + std::vector> OnReadyFunctions; + std::vector, __int64>> StartEventFunctions; + std::string ScriptingClass; + std::string PlaylistName; + double Version; +}; + +static inline std::vector Events = +{ + Event + ( + "Astronomical", + "/CycloneJerky/Gameplay/BP_Jerky_Loader.BP_Jerky_Loader_C", + // "/CycloneJerky/Gameplay/BP_Jerky_Loader.BP_Jerky_Loader_C.LoadJerkyLevel", + "", + 1, + { + { + false, + "/CycloneJerky/Gameplay/BP_Jerky_Scripting.BP_Jerky_Scripting_C.OnReady_093B6E664C060611B28F79B5E7052A39" + }, + { + true, + "/CycloneJerky/Gameplay/BP_Jerky_Loader.BP_Jerky_Loader_C.OnReady_7FE9744D479411040654F5886C078D08" + } + }, + { + { + /* { + false, + "/CycloneJerky/Gameplay/BP_Jerky_Scripting.BP_Jerky_Scripting_C.startevent" + }, */ + { + true, + "/CycloneJerky/Gameplay/BP_Jerky_Loader.BP_Jerky_Loader_C.startevent" + }, + + 0 + } + }, + + "/CycloneJerky/Gameplay/BP_Jerky_Scripting.BP_Jerky_Scripting_C", + "/Game/Athena/Playlists/Music/Playlist_Music_High.Playlist_Music_High", + 12.41 + ), + Event + ( + "Device", + "/Fritter/BP_Fritter_Loader.BP_Fritter_Loader_C", + // "/CycloneJerky/Gameplay/BP_Jerky_Loader.BP_Jerky_Loader_C.LoadJerkyLevel", + "", + 1, + { + { + false, + "/Fritter/BP_Fritter_Script.BP_Fritter_Script_C.OnReady_ACE66C28499BF8A59B3D88A981DDEF41" + }, + { + true, + "/Fritter/BP_Fritter_Loader.BP_Fritter_Loader_C.OnReady_1216203B4B63E3DFA03042A62380A674" + } + }, + { + { + /* { + false, + "/Fritter/BP_Fritter_Loader.BP_Fritter_Loader_C.startevent" + }, */ + { + true, + "/Fritter/BP_Fritter_Loader.BP_Fritter_Loader_C.startevent" + }, + + 0 + } + }, + + "/Fritter/BP_Fritter_Script.BP_Fritter_Script_C", + "/Game/Athena/Playlists/Fritter/Playlist_Fritter_High.Playlist_Fritter_High", + 12.61 + ), + Event + ( + "Marshmello", + "", + "", + 1, + { + { + false, + "/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C.OnReady_EE7676604ADFD92D7B2972AC0ABD4BB8" + } + }, + { + { + { + false, + "/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C.PlayConcert" + }, + + 0 + } + }, + + "/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C", + "/Game/Athena/Playlists/Music/Playlist_Music_High.Playlist_Music_High", + 7.30 + ) +}; + +static inline UObject* GetEventPlaylist() +{ + for (auto& CurrentEvent : Events) + { + if (CurrentEvent.Version == Fortnite_Version) + return FindObject(CurrentEvent.PlaylistName, nullptr, ANY_PACKAGE); + } + + return nullptr; +} + +static inline UObject* GetEventScripting() +{ + Event OurEvent; + + for (auto& CurrentEvent : Events) + { + if (CurrentEvent.Version == Fortnite_Version) + { + OurEvent = CurrentEvent; + break; + } + } + + if (!OurEvent.Version) + return nullptr; + + auto ScriptingClass = FindObject(OurEvent.ScriptingClass); + + if (!ScriptingClass) + { + // LOG_ERROR(LogEvent, "Failed to find ScriptingClass!"); + return nullptr; + } + + auto AllScripters = UGameplayStatics::GetAllActorsOfClass(GetWorld(), ScriptingClass); + + if (AllScripters.size() <= 0) + { + // LOG_ERROR(LogEvent, "Failed to find any scripters!"); + return nullptr; + } + + return AllScripters.at(0); +} + +static inline UObject* GetEventLoader() +{ + Event OurEvent; + + for (auto& CurrentEvent : Events) + { + if (CurrentEvent.Version == Fortnite_Version) + { + OurEvent = CurrentEvent; + break; + } + } + + if (!OurEvent.Version) + return nullptr; + + auto LoaderClass = FindObject(OurEvent.LoaderClass); + + if (!LoaderClass) + { + LOG_ERROR(LogEvent, "Failed to find LoaderClass!"); + return nullptr; + } + + auto AllLoaders = UGameplayStatics::GetAllActorsOfClass(GetWorld(), LoaderClass); + + if (AllLoaders.size() <= 0) + { + // LOG_ERROR(LogEvent, "Failed to find any loaders!"); + return nullptr; + } + + return AllLoaders.at(0); +} + +static inline std::string GetEventName() +{ + for (auto& CurrentEvent : Events) + { + if (CurrentEvent.Version == Fortnite_Version) + return CurrentEvent.EventDisplayName; + } + + return ""; +} + +static inline void LoadEvent(bool* bWereAllSuccessful = nullptr) +{ + if (bWereAllSuccessful) + *bWereAllSuccessful = false; + + Event OurEvent; + + for (auto& CurrentEvent : Events) + { + if (CurrentEvent.Version == Fortnite_Version) + { + OurEvent = CurrentEvent; + break; + } + } + + if (!OurEvent.Version) + return; + + if (bWereAllSuccessful) + *bWereAllSuccessful = true; + + auto LoaderFunction = FindObject(OurEvent.LoaderFunction); + + if (!LoaderFunction) + { + LOG_ERROR(LogEvent, "Failed to find any loader function!"); + + if (bWereAllSuccessful) + *bWereAllSuccessful = false; + + return; + } + + auto Loader = GetEventLoader(); + + if (!Loader) + { + if (bWereAllSuccessful) + *bWereAllSuccessful = false; + + return; // GetEventLoader handles the printing + } + + Loader->ProcessEvent(LoaderFunction, &OurEvent.AdditionalLoaderParams); +} + +static inline bool CallOnReadys(bool* bWereAllSuccessful = nullptr) +{ + if (bWereAllSuccessful) + *bWereAllSuccessful = false; + + Event OurEvent; + + for (auto& CurrentEvent : Events) + { + if (CurrentEvent.Version == Fortnite_Version) + { + OurEvent = CurrentEvent; + break; + } + } + + if (!OurEvent.Version) + return false; + + auto EventScripting = GetEventScripting(); + + if (!EventScripting) + return false; // GetEventScripting handles the printing + + if (bWereAllSuccessful) + *bWereAllSuccessful = true; + + struct { UObject* GameState; UObject* Playlist; FGameplayTagContainer PlaylistContextTags; } OnReadyParams{ + ((AFortGameModeAthena*)GetWorld()->GetGameMode())->GetGameStateAthena(), GetEventPlaylist(), + GetEventPlaylist()->Get("GameplayTagContainer")}; + + for (auto& OnReadyFunc : OurEvent.OnReadyFunctions) + { + if (OnReadyFunc.first) // func is in loader + { + auto EventLoader = GetEventLoader(); + + if (!EventLoader) + { + // if (bWereAllSuccessful) + // *bWereAllSuccessful = false; + + continue; // uhh?? + } + + auto OnReadyUFunc = FindObject(OnReadyFunc.second); + + if (!OnReadyUFunc) + { + LOG_ERROR(LogEvent, "Failed to find OnReady: {}", OnReadyFunc.second); + + if (bWereAllSuccessful) + *bWereAllSuccessful = false; + + continue; + } + + EventLoader->ProcessEvent(OnReadyUFunc, &OnReadyParams); + } + else // func is in scripting + { + auto OnReadyUFunc = FindObject(OnReadyFunc.second); + + if (!OnReadyUFunc) + { + LOG_ERROR(LogEvent, "Failed to find OnReady: {}", OnReadyFunc.second); + + if (bWereAllSuccessful) + *bWereAllSuccessful = false; + + continue; + } + + EventScripting->ProcessEvent(OnReadyUFunc, &OnReadyParams); + } + } + + return true; +} + +static inline void StartEvent() +{ + Event OurEvent; + + for (auto& CurrentEvent : Events) + { + if (CurrentEvent.Version == Fortnite_Version) + { + OurEvent = CurrentEvent; + break; + } + } + + if (!OurEvent.Version) + return; + + auto EventScripting = GetEventScripting(); + + // if (!EventScripting) + // return; // GetEventScripting handles the printing + + CallOnReadys(); + + for (auto& StartEventFunc : OurEvent.StartEventFunctions) + { + auto StartEventUFunc = FindObject(StartEventFunc.first.second); + + if (!StartEventUFunc) + { + LOG_ERROR(LogEvent, "Failed to find StartEvent: {}", StartEventFunc.first.second); + continue; + } + + if (StartEventFunc.first.first) // func is in loader + { + auto EventLoader = GetEventLoader(); + + if (!EventLoader) + continue; // uhh?? + + EventLoader->ProcessEvent(StartEventUFunc, &StartEventFunc.second); + } + else // func is in scripting + { + if (!EventScripting) + continue; + + EventScripting->ProcessEvent(StartEventUFunc, &StartEventFunc.second); + } + } +} + +static inline bool DoesEventRequireLoading() +{ + for (auto& CurrentEvent : Events) + { + if (CurrentEvent.Version == Fortnite_Version) + { + return !CurrentEvent.LoaderClass.empty() && !CurrentEvent.LoaderFunction.empty(); + } + } + + return false; +} \ No newline at end of file diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index 2a59207..da38687 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -127,7 +127,7 @@ static inline uint64 FindPauseBeaconRequests() static inline uint64 FindGetPlayerViewpoint() { auto Addr = Memcury::Scanner::FindStringRef(L"APlayerController::GetPlayerViewPoint: out_Location, ViewTarget=%s"); - return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 2000, 0, true); + return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 2000, 0, true, 1); } static inline uint64 FindSpawnActor() @@ -159,8 +159,8 @@ static inline uint64 FindSetWorld() else if (Fortnite_Season >= 19 && Fortnite_Season < 21) SetWorldIndex = 0x7A; - static auto DefaultNetDriver = FindObject("/Script/Engine.Default__NetDriver"); - return __int64(DefaultNetDriver->VFTable[SetWorldIndex]); + // static auto DefaultNetDriver = FindObject("/Script/Engine.Default__NetDriver"); + return SetWorldIndex; } static inline uint64 FindInitListen() @@ -195,6 +195,9 @@ static inline uint64 FindNoMCP() if (Engine_Version == 425) return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 C1").RelativeOffset(1).Get(); + if (Engine_Version == 426) + return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 10 84 DB").RelativeOffset(1).Get(); + // return (uintptr_t)GetModuleHandleW(0) + 0x1791CF0; // 11.01 return 0; // return (uintptr_t)GetModuleHandleW(0) + 0x161d600; // 10.40 @@ -208,14 +211,53 @@ static inline uint64 FindCollectGarbage() return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 2000, 0, true, 1); } +static inline uint64 FindActorGetNetMode() +{ + auto AActorGetNetmode = Memcury::Scanner::FindStringRef(L"ClientPlayerLeft %s") + .ScanFor({ 0x48, 0x8B, 0xCF, 0xE8 }) + .RelativeOffset(4) + .Get(); + + return AActorGetNetmode; +} + static inline uint64 FindTickFlush() { auto Addr = Memcury::Scanner::FindStringRef(L"STAT_NetTickFlush"); return FindBytes(Addr, { 0x4C, 0x8B }, 1000, 0, true); } +static inline uint64 FindGIsServer() +{ + auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering"); + auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, 1); + Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, 1); + + return Memcury::Scanner(Addy).RelativeOffset(2).Get(); +} + +static inline uint64 FindChangeGameSessionId() +{ + auto Addr = Memcury::Scanner::FindStringRef(L"Changing GameSessionId from '%s' to '%s'"); + return FindBytes(Addr, { 0x40, 0x55 }, 2000, 0, true); +} + +static inline uint64 FindGIsClient() +{ + auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering"); + auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, 2); + Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, 2); + + return Memcury::Scanner(Addy).RelativeOffset(2).Get(); +} + static inline uint64 FindGetNetMode() { + /* return Memcury::Scanner::FindStringRef(L" (client %d)") + .ScanFor({ 0x48, 0x8B, 0xC8, 0xE8 }, false) + .RelativeOffset(4) + .Get(); // credit ender */ + auto Addr = Memcury::Scanner::FindStringRef(L"PREPHYSBONES"); auto BeginningFunction = Memcury::Scanner(FindBytes(Addr, { 0x40, 0x55 }, 1000, 0, true)); auto CallToFunc = Memcury::Scanner(FindBytes(BeginningFunction, { 0xE8 })); diff --git a/Project Reboot 3.0/hooking.h b/Project Reboot 3.0/hooking.h index 4da7abf..e6a56e7 100644 --- a/Project Reboot 3.0/hooking.h +++ b/Project Reboot 3.0/hooking.h @@ -198,6 +198,9 @@ namespace Hooking static bool Hook(UObject* DefaultClass, UFunction* Function, void* Detour, void** Original = nullptr, bool bUseSecondMethod = true, bool bHookExec = false) // Native hook { + if (!Function) + return false; + auto Exec = Function->GetFunc(); if (bHookExec) diff --git a/Project Reboot 3.0/log.h b/Project Reboot 3.0/log.h index e4a1471..8816a5d 100644 --- a/Project Reboot 3.0/log.h +++ b/Project Reboot 3.0/log.h @@ -66,6 +66,7 @@ inline void InitLogger() MakeLogger("LogLoading"); MakeLogger("LogHook"); MakeLogger("LogAbilities"); + MakeLogger("LogEvent"); } #define LOG_DEBUG(loggerName, ...) \ diff --git a/Project Reboot 3.0/reboot.h b/Project Reboot 3.0/reboot.h index 5c2278e..c1e8a91 100644 --- a/Project Reboot 3.0/reboot.h +++ b/Project Reboot 3.0/reboot.h @@ -16,6 +16,7 @@ namespace Globals { extern inline bool bCreative = false; + extern inline bool bGoingToPlayEvent = false; } extern inline UObject* (*StaticLoadObjectOriginal)(UClass*, UObject*, const wchar_t* InName, const wchar_t* Filename, uint32_t LoadFlags, UObject* Sandbox, bool bAllowObjectReconciliation) = nullptr;