diff --git a/Project Reboot 3.0/Array.h b/Project Reboot 3.0/Array.h index 9c225ed..aa8f4e0 100644 --- a/Project Reboot 3.0/Array.h +++ b/Project Reboot 3.0/Array.h @@ -267,11 +267,13 @@ public: { // VirtualFree(Data, _msize(Data), MEM_RELEASE); // VirtualFree(Data, sizeof(InElementType) * ArrayNum, MEM_RELEASE); // ik this does nothing - // VirtualFree(Data, 0, MEM_RELEASE); + // auto res = VirtualFree(Data, 0, MEM_RELEASE); + // LOG_INFO(LogDev, "Free: {} aa: 0x{:x}", res, res ? 0 : GetLastError()); static void (*FreeOriginal)(void*) = decltype(FreeOriginal)(Addresses::Free); // FreeOriginal(Data); } + Data = nullptr; ArrayNum = 0; ArrayMax = 0; } diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index bb1e924..78f71de 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -725,7 +725,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena } else { - static auto VendingMachineClass = FindObject("/Game/Athena/Items/Gameplay/VendingMachine/B_Athena_VendingMachine.B_Athena_VendingMachine_C"); + auto VendingMachineClass = FindObject("/Game/Athena/Items/Gameplay/VendingMachine/B_Athena_VendingMachine.B_Athena_VendingMachine_C"); auto AllVendingMachines = UGameplayStatics::GetAllActorsOfClass(GetWorld(), VendingMachineClass); for (int i = 0; i < AllVendingMachines.Num(); i++) diff --git a/Project Reboot 3.0/FortInventory.cpp b/Project Reboot 3.0/FortInventory.cpp index 3758793..c9eac7e 100644 --- a/Project Reboot 3.0/FortInventory.cpp +++ b/Project Reboot 3.0/FortInventory.cpp @@ -146,10 +146,16 @@ std::pair, std::vector> AFortInventory::AddI static auto FortItemEntryStruct = FindObject(L"/Script/FortniteGame.FortItemEntry"); static auto FortItemEntrySize = *(int*)(__int64(FortItemEntryStruct) + Offsets::PropertiesSize); - FFortItemEntryStateValue* StateValue = Alloc(FFortItemEntryStateValue::GetStructSize()); - StateValue->GetIntValue() = bShowItemToast; - StateValue->GetStateType() = EFortItemEntryState::ShouldShowItemToast; - NewItemInstance->GetItemEntry()->GetStateValues().AddPtr(StateValue, FFortItemEntryStateValue::GetStructSize()); + bool bEnableStateValues = false; + + if (bEnableStateValues) + { + FFortItemEntryStateValue* StateValue = (FFortItemEntryStateValue*)FMemory::Realloc(0, FFortItemEntryStateValue::GetStructSize(), 0); + // Alloc(FFortItemEntryStateValue::GetStructSize()); + StateValue->GetIntValue() = bShowItemToast; + StateValue->GetStateType() = EFortItemEntryState::ShouldShowItemToast; + NewItemInstance->GetItemEntry()->GetStateValues().AddPtr(StateValue, FFortItemEntryStateValue::GetStructSize()); + } ItemInstances.Add(NewItemInstance); GetItemList().GetReplicatedEntries().Add(*NewItemInstance->GetItemEntry(), FortItemEntrySize); @@ -167,9 +173,14 @@ std::pair, std::vector> AFortInventory::AddI { if (auto GadgetItemDefinition = Cast(WorldItemDefinition)) { - char (*ApplyGadgetData)(UFortGadgetItemDefinition * a1, __int64 a2, UFortItem* a3, unsigned __int8 a4) = decltype(ApplyGadgetData)(Addresses::ApplyGadgetData); + if (GadgetItemDefinition->ShouldDropAllItemsOnEquip()) // idk shouldnt this be auto? + { + FortPlayerController->DropAllItems({ GadgetItemDefinition }); + } + + bool (*ApplyGadgetData)(UFortGadgetItemDefinition * a1, __int64 a2, UFortItem* a3, unsigned __int8 a4) = decltype(ApplyGadgetData)(Addresses::ApplyGadgetData); static auto FortInventoryOwnerInterfaceClass = FindObject("/Script/FortniteGame.FortInventoryOwnerInterface"); - ApplyGadgetData((UFortGadgetItemDefinition*)ItemDefinition, __int64(PlayerController->GetInterfaceAddress(FortInventoryOwnerInterfaceClass)), NewItemInstance, true); + LOG_INFO(LogDev, "Res: {}", ApplyGadgetData(GadgetItemDefinition, __int64(PlayerController->GetInterfaceAddress(FortInventoryOwnerInterfaceClass)), NewItemInstance, true)); } } } diff --git a/Project Reboot 3.0/FortPickup.cpp b/Project Reboot 3.0/FortPickup.cpp index ed89aa2..ecf758f 100644 --- a/Project Reboot 3.0/FortPickup.cpp +++ b/Project Reboot 3.0/FortPickup.cpp @@ -182,7 +182,12 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) auto SwappedPickup = SpawnPickup(ItemEntryToSwap, PawnLoc, EFortPickupSourceTypeFlag::Player, EFortPickupSpawnSource::Unset, Pawn); - bWasHoldingSameItemWhenSwap = CurrentItemGuid == ItemInstanceToSwap->GetItemEntry()->GetItemGuid(); + auto CurrentWeapon = Pawn->GetCurrentWeapon(); + + if (CurrentWeapon) + { + bWasHoldingSameItemWhenSwap = CurrentWeapon->GetItemEntryGuid() == ItemInstanceToSwap->GetItemEntry()->GetItemGuid(); + } WorldInventory->RemoveItem(CurrentItemGuid, nullptr, ItemEntryToSwap->GetCount(), true); @@ -292,13 +297,16 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) { static auto ClientEquipItemFn = FindObject("/Script/FortniteGame.FortPlayerControllerAthena.ClientEquipItem") ? FindObject("/Script/FortniteGame.FortPlayerControllerAthena.ClientEquipItem") : FindObject("/Script/FortniteGame.FortPlayerController.ClientEquipItem"); - struct + if (ClientEquipItemFn) { - FGuid ItemGuid; // (ConstParm, Parm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) - bool bForceExecution; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) - } AFortPlayerController_ClientEquipItem_Params{ NewSwappedItem, true }; + struct + { + FGuid ItemGuid; // (ConstParm, Parm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + bool bForceExecution; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + } AFortPlayerController_ClientEquipItem_Params{ NewSwappedItem, true }; - PlayerController->ProcessEvent(ClientEquipItemFn, &AFortPlayerController_ClientEquipItem_Params); + PlayerController->ProcessEvent(ClientEquipItemFn, &AFortPlayerController_ClientEquipItem_Params); + } } return CompletePickupAnimationOriginal(Pickup); diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 9d0a2ec..5dab71f 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -107,12 +107,17 @@ void AFortPlayerController::ApplyCosmeticLoadout() if (!UpdatePlayerCustomCharacterPartsVisualizationFn) { - /* if (Addresses::ApplyCharacterCustomization) + if (Addresses::ApplyCharacterCustomization) { static void* (*ApplyCharacterCustomizationOriginal)(AFortPlayerState* a1, AFortPawn* a3) = decltype(ApplyCharacterCustomizationOriginal)(Addresses::ApplyCharacterCustomization); ApplyCharacterCustomizationOriginal(PlayerStateAsFort, PawnAsFort); + + PlayerStateAsFort->ForceNetUpdate(); + PawnAsFort->ForceNetUpdate(); + this->ForceNetUpdate(); + return; - } */ + } auto CosmeticLoadout = this->GetCosmeticLoadout(); @@ -160,12 +165,25 @@ void AFortPlayerController::ApplyCosmeticLoadout() } } + PlayerStateAsFort->ForceNetUpdate(); + PawnAsFort->ForceNetUpdate(); + this->ForceNetUpdate(); + return; } UFortKismetLibrary::StaticClass()->ProcessEvent(UpdatePlayerCustomCharacterPartsVisualizationFn, &PlayerStateAsFort); } +void AFortPlayerController::ServerLoadingScreenDroppedHook(UObject* Context, FFrame* Stack, void* Ret) +{ + auto PlayerController = (AFortPlayerController*)Context; + + PlayerController->ApplyCosmeticLoadout(); + + return ServerLoadingScreenDroppedOriginal(Context, Stack, Ret); +} + void AFortPlayerController::ServerRepairBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToRepair) { if (!BuildingActorToRepair) @@ -422,7 +440,7 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame* if (!VehicleWeaponDefinition) { - LOG_INFO(LogDev, "Invlaid VehicleWeaponDefinition!"); + LOG_INFO(LogDev, "Invalid VehicleWeaponDefinition!"); return; } diff --git a/Project Reboot 3.0/FortPlayerController.h b/Project Reboot 3.0/FortPlayerController.h index f3963a1..f4d4f87 100644 --- a/Project Reboot 3.0/FortPlayerController.h +++ b/Project Reboot 3.0/FortPlayerController.h @@ -49,6 +49,7 @@ public: static inline void (*ServerEditBuildingActorOriginal)(UObject* Context, FFrame& Stack, void* Ret); static inline void (*DropSpecificItemOriginal)(UObject* Context, FFrame& Stack, void* Ret); static inline AActor* (*SpawnToyInstanceOriginal)(UObject* Context, FFrame* Stack, AActor** Ret); + static inline void (*ServerLoadingScreenDroppedOriginal)(UObject* Context, FFrame* Stack, void* Ret); void ClientReportDamagedResourceBuilding(ABuildingSMActor* BuildingSMActor, EFortResourceType PotentialResourceType, int PotentialResourceCount, bool bDestroyed, bool bJustHitWeakspot); @@ -83,6 +84,7 @@ public: void DropAllItems(const std::vector& IgnoreItemDefs, bool bIgnoreSecondaryQuickbar = false, bool bRemoveIfNotDroppable = false); void ApplyCosmeticLoadout(); + static void ServerLoadingScreenDroppedHook(UObject* Context, FFrame* Stack, void* Ret); static void ServerRepairBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToRepair); static void ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid); static void ServerAttemptInteractHook(UObject* Context, FFrame* Stack, void* Ret); diff --git a/Project Reboot 3.0/FortPlayerPawnAthena.cpp b/Project Reboot 3.0/FortPlayerPawnAthena.cpp index 8ebf098..250e1b3 100644 --- a/Project Reboot 3.0/FortPlayerPawnAthena.cpp +++ b/Project Reboot 3.0/FortPlayerPawnAthena.cpp @@ -12,7 +12,7 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame* UPrimitiveComponent* OtherComp; int OtherBodyIndex; bool bFromSweep; - FHitResult SweepResult = *Alloc(FHitResult::GetStructSize()); + auto SweepResultPtr = (FHitResult*)std::realloc(0, FHitResult::GetStructSize()); LOG_INFO(LogDev, "OnCapsuleBeginOverlapHook!"); @@ -21,7 +21,9 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame* Stack->StepCompiledIn(&OtherComp); Stack->StepCompiledIn(&OtherBodyIndex); Stack->StepCompiledIn(&bFromSweep); - Stack->StepCompiledIn(&SweepResult); + Stack->StepCompiledIn(SweepResultPtr); + + std::free(SweepResultPtr); // LOG_INFO(LogDev, "OtherActor: {}", __int64(OtherActor)); // LOG_INFO(LogDev, "OtherActorName: {}", OtherActor->IsValidLowLevel() ? OtherActor->GetName() : "BadRead") diff --git a/Project Reboot 3.0/GameplayAbilitySpec.h b/Project Reboot 3.0/GameplayAbilitySpec.h index 90003b0..3b814c3 100644 --- a/Project Reboot 3.0/GameplayAbilitySpec.h +++ b/Project Reboot 3.0/GameplayAbilitySpec.h @@ -49,7 +49,7 @@ struct FGameplayAbilitySpec : FFastArraySerializerItem static FGameplayAbilitySpec* MakeNewSpec(UClass* GameplayAbilityClass, UObject* SourceObject = nullptr, bool bAlreadyIsDefault = false) { - auto NewSpec = Alloc(FGameplayAbilitySpec::GetStructSize()); + auto NewSpec = Alloc(FGameplayAbilitySpec::GetStructSize(), true); if (!NewSpec) return nullptr; diff --git a/Project Reboot 3.0/NetDriver.cpp b/Project Reboot 3.0/NetDriver.cpp index 63dfa3c..24dd4bd 100644 --- a/Project Reboot 3.0/NetDriver.cpp +++ b/Project Reboot 3.0/NetDriver.cpp @@ -691,7 +691,7 @@ int32 UNetDriver::ServerReplicateActors_PrioritizeActors(UNetConnection* Connect // Add in deleted actors - for (auto& CurrentGuid : Connection_DestroyedStartupOrDormantActors) + /* for (auto& CurrentGuid : Connection_DestroyedStartupOrDormantActors) { bool bFound = false; @@ -704,7 +704,7 @@ int32 UNetDriver::ServerReplicateActors_PrioritizeActors(UNetConnection* Connect OutPriorityActors[FinalSortedCount] = OutPriorityList + FinalSortedCount; FinalSortedCount++; DeletedCount++; - } + } */ Sort(OutPriorityActors, FinalSortedCount, FCompareFActorPriority()); } diff --git a/Project Reboot 3.0/addresses.cpp b/Project Reboot 3.0/addresses.cpp index 11da1ae..eed8c60 100644 --- a/Project Reboot 3.0/addresses.cpp +++ b/Project Reboot 3.0/addresses.cpp @@ -448,6 +448,11 @@ 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) + { + 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 + } + 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 diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index b94e68d..45f8218 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -135,6 +135,13 @@ DWORD WINAPI Main(LPVOID) CreateThread(0, 0, GuiThread, 0, 0, 0); + while (SecondsUntilTravel > 0) + { + SecondsUntilTravel -= 1; + + Sleep(1000); + } + static auto GameModeDefault = FindObject(L"/Script/FortniteGame.Default__FortGameModeAthena"); static auto FortPlayerControllerZoneDefault = FindObject(L"/Script/FortniteGame.Default__FortPlayerControllerZone"); static auto FortPlayerControllerAthenaDefault = FindObject(L"/Script/FortniteGame.Default__FortPlayerControllerAthena"); // FindObject(L"/Game/Athena/Athena_PlayerController.Default__Athena_PlayerController_C"); @@ -430,6 +437,8 @@ DWORD WINAPI Main(LPVOID) AFortPlayerController::ServerEditBuildingActorHook, (PVOID*)&AFortPlayerController::ServerEditBuildingActorOriginal, false, true); Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerEndEditingBuildingActor"), AFortPlayerController::ServerEndEditingBuildingActorHook, nullptr, false); + Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerLoadingScreenDropped"), + 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"), @@ -720,137 +729,7 @@ DWORD WINAPI Main(LPVOID) while (true) { - if (GetAsyncKeyState(VK_F7) & 1) - { - LOG_INFO(LogEvent, "Starting {} event!", GetEventName()); - StartEvent(); - } - - else if (GetAsyncKeyState(VK_F8) & 1) - { - auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); - auto GameState = GameMode->GetGameState(); - - if (Fortnite_Version == 1.11) - { - static auto OverrideBattleBusSkin = FindObject("/Game/Athena/Items/Cosmetics/BattleBuses/BBID_WinterBus.BBID_WinterBus"); - LOG_INFO(LogDev, "OverrideBattleBusSkin: {}", __int64(OverrideBattleBusSkin)); - - if (OverrideBattleBusSkin) - { - static auto AssetManagerOffset = GetEngine()->GetOffset("AssetManager"); - auto AssetManager = GetEngine()->Get(AssetManagerOffset); - - if (AssetManager) - { - static auto AthenaGameDataOffset = AssetManager->GetOffset("AthenaGameData"); - auto AthenaGameData = AssetManager->Get(AthenaGameDataOffset); - - if (AthenaGameData) - { - static auto DefaultBattleBusSkinOffset = AthenaGameData->GetOffset("DefaultBattleBusSkin"); - AthenaGameData->Get(DefaultBattleBusSkinOffset) = OverrideBattleBusSkin; - } - } - - static auto DefaultBattleBusOffset = GameState->GetOffset("DefaultBattleBus"); - GameState->Get(DefaultBattleBusOffset) = OverrideBattleBusSkin; - - static auto FortAthenaAircraftClass = FindObject("/Script/FortniteGame.FortAthenaAircraft"); - auto AllAircrafts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortAthenaAircraftClass); - - for (int i = 0; i < AllAircrafts.Num(); i++) - { - auto Aircraft = AllAircrafts.at(i); - - static auto DefaultBusSkinOffset = Aircraft->GetOffset("DefaultBusSkin"); - Aircraft->Get(DefaultBusSkinOffset) = OverrideBattleBusSkin; - - static auto SpawnedCosmeticActorOffset = Aircraft->GetOffset("SpawnedCosmeticActor"); - auto SpawnedCosmeticActor = Aircraft->Get(SpawnedCosmeticActorOffset); - - if (SpawnedCosmeticActor) - { - static auto ActiveSkinOffset = SpawnedCosmeticActor->GetOffset("ActiveSkin"); - SpawnedCosmeticActor->Get(ActiveSkinOffset) = OverrideBattleBusSkin; - } - } - } - } - - float Duration = 0; - float EarlyDuration = Duration; - - float TimeSeconds = 0; // UGameplayStatics::GetTimeSeconds(GetWorld()); - - LOG_INFO(LogDev, "Starting bus!"); - - GameState->Get("WarmupCountdownEndTime") = 0; - GameMode->Get("WarmupCountdownDuration") = 0; - - GameState->Get("WarmupCountdownStartTime") = 0; - GameMode->Get("WarmupEarlyCountdownDuration") = 0; - - // FString cmd = L"startaircraft"; - // UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), cmd, nullptr); - } - - else if (GetAsyncKeyState(VK_F9) & 1) - { - Globals::bLogProcessEvent = !Globals::bLogProcessEvent; - } - - else if (GetAsyncKeyState(VK_F10) & 1) - { - if (Engine_Version < 424) - { - FString LevelA = Engine_Version < 424 - ? L"open Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501 - ? L"open Asteria_Terrain" - : Globals::bCreative ? L"open Creative_NoApollo_Terrain" - : L"open Artemis_Terrain" - : Globals::bCreative ? L"open Creative_NoApollo_Terrain" - : L"open Apollo_Terrain"; - - static auto BeaconClass = FindObject(L"/Script/FortniteGame.FortOnlineBeaconHost"); - auto AllFortBeacons = UGameplayStatics::GetAllActorsOfClass(GetWorld(), BeaconClass); - - for (int i = 0; i < AllFortBeacons.Num(); i++) - { - AllFortBeacons.at(i)->K2_DestroyActor(); - } - - AllFortBeacons.Free(); - - LOG_INFO(LogDev, "Switching!"); - ((AGameMode*)GetWorld()->GetGameMode())->RestartGame(); - // UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), LevelA, nullptr); - // UGameplayStatics::OpenLevel(GetWorld(), UKismetStringLibrary::Conv_StringToName(LevelA), true, FString()); - LOG_INFO(LogGame, "Restarting!"); - AmountOfRestarts++; - } - else - { - LOG_ERROR(LogGame, "Restarting is not supported on chapter 2 and above!"); - } - } - - else if (GetAsyncKeyState(VK_F11) & 1) - { - std::ofstream stream("Test.log"); - - for (auto& Current : ReplicatedActors) - { - stream << Current << '\n'; - } - } - - /* else if (GetAsyncKeyState(VK_F12) & 1) - { - FillVendingMachines(); - } */ - - Sleep(1000 / 30); + Sleep(10000); } return 0; diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index e209b94..0ebb4e7 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -669,12 +669,35 @@ static inline uint64 FindRemoveGadgetData() { if (Engine_Version <= 423) { - auto StringRef = Memcury::Scanner::FindStringRef(L"UFortGadgetItemDefinition::RemoveGadgetData - Removing Gadget Data for Gadget Item [%s]!", false); + auto Addr = Memcury::Scanner::FindStringRef(L"UFortGadgetItemDefinition::RemoveGadgetData - Removing Gadget Data for Gadget Item [%s]!", false).Get(); - if (!StringRef.Get()) - StringRef = Memcury::Scanner::FindStringRef(L"UFortGadgetItemDefinition::RemoveGadgetData - Removing Gadget Data for Gadet Item [%s]!"); + if (!Addr) + Addr = Memcury::Scanner::FindStringRef(L"UFortGadgetItemDefinition::RemoveGadgetData - Removing Gadget Data for Gadet Item [%s]!").Get(); - return FindBytes(StringRef, { 0x40, 0x55 }, 1000, 0, true); + if (!Addr) + return 0; + + for (int i = 0; i < 1000; i++) + { + if (/* (*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x53) + || */ (*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x55)) + { + return Addr - i; + } + + if (*(uint8_t*)(uint8_t*)(Addr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addr - i + 2) == 0x5C) + { + return Addr - i; + } + + /* if (*(uint8_t*)(uint8_t*)(Addr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x8B && *(uint8_t*)(uint8_t*)(Addr - i + 2) == 0xC4) + { + return Addr - i; + } */ + } + + return 0; + // return FindBytes(StringRef, { 0x40, 0x55 }, 1000, 0, true); } if (Engine_Version == 426) return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 56 41 56 41 57 48 83 EC 30 48 8B 02 48").Get(); // 14.60 @@ -1164,7 +1187,7 @@ static inline uint64 FindApplyCharacterCustomization() { auto Addrr = Memcury::Scanner::FindStringRef(L"AFortPlayerState::ApplyCharacterCustomization - Failed initialization, using default parts. Player Controller: %s PlayerState: %s, HeroId: %s").Get(); - for (int i = 0; i < 1000; i++) + for (int i = 0; i < 7000; i++) { if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x53) { @@ -1182,7 +1205,9 @@ static inline uint64 FindApplyCharacterCustomization() } } - return 0; + uint64 Addr = Memcury::Scanner::FindPattern("48 8B C4 48 89 50 10 55 57 48 8D 68 A1 48 81 EC ? ? ? ? 80 B9").Get(); + + return Addr; } static inline uint64 FindRealloc() diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index 0fb4b18..bf19e8d 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -53,6 +53,8 @@ #define LOADOUT_PLAYERTAB 4 #define FUN_PLAYERTAB 5 +static inline int SecondsUntilTravel = 5; + // THE BASE CODE IS FROM IMGUI GITHUB static LPDIRECT3D9 g_pD3D = NULL; @@ -211,6 +213,16 @@ static bool bIsEditingInventory = false; static bool bInformationTab = false; static int playerTabTab = MAIN_PLAYERTAB; +void StaticUI() +{ + ImGui::Checkbox("No MCP (Don't change unless you know what this is)", &Globals::bNoMCP); + + if (Addresses::ApplyGadgetData && Addresses::RemoveGadgetData) + { + ImGui::Checkbox("Enable AGIDs (Don't change unless you know what this is)", &Globals::bEnableAGIDs); + } +} + void MainTabs() { // std::ofstream bannedStream(Moderation::Banning::GetFilePath()); @@ -346,10 +358,10 @@ void MainUI() { if (bLoaded) { + StaticUI(); #ifndef PROD ImGui::Checkbox("Log ProcessEvent", &Globals::bLogProcessEvent); #endif - ImGui::Checkbox("Enable AGIDs", &Globals::bEnableAGIDs); ImGui::Text(std::format("Listening {}", Globals::bStartedListening).c_str()); static std::string ConsoleCommand; @@ -406,7 +418,55 @@ void MainUI() if (ImGui::Button("Start Bus Countdown")) { - auto GameState = ((AGameMode*)GetWorld()->GetGameMode())->GetGameState(); + auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); + auto GameState = GameMode->GetGameState(); + + if (Fortnite_Version == 1.11) + { + static auto OverrideBattleBusSkin = FindObject("/Game/Athena/Items/Cosmetics/BattleBuses/BBID_WinterBus.BBID_WinterBus"); + LOG_INFO(LogDev, "OverrideBattleBusSkin: {}", __int64(OverrideBattleBusSkin)); + + if (OverrideBattleBusSkin) + { + static auto AssetManagerOffset = GetEngine()->GetOffset("AssetManager"); + auto AssetManager = GetEngine()->Get(AssetManagerOffset); + + if (AssetManager) + { + static auto AthenaGameDataOffset = AssetManager->GetOffset("AthenaGameData"); + auto AthenaGameData = AssetManager->Get(AthenaGameDataOffset); + + if (AthenaGameData) + { + static auto DefaultBattleBusSkinOffset = AthenaGameData->GetOffset("DefaultBattleBusSkin"); + AthenaGameData->Get(DefaultBattleBusSkinOffset) = OverrideBattleBusSkin; + } + } + + static auto DefaultBattleBusOffset = GameState->GetOffset("DefaultBattleBus"); + GameState->Get(DefaultBattleBusOffset) = OverrideBattleBusSkin; + + static auto FortAthenaAircraftClass = FindObject("/Script/FortniteGame.FortAthenaAircraft"); + auto AllAircrafts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortAthenaAircraftClass); + + for (int i = 0; i < AllAircrafts.Num(); i++) + { + auto Aircraft = AllAircrafts.at(i); + + static auto DefaultBusSkinOffset = Aircraft->GetOffset("DefaultBusSkin"); + Aircraft->Get(DefaultBusSkinOffset) = OverrideBattleBusSkin; + + static auto SpawnedCosmeticActorOffset = Aircraft->GetOffset("SpawnedCosmeticActor"); + auto SpawnedCosmeticActor = Aircraft->Get(SpawnedCosmeticActorOffset); + + if (SpawnedCosmeticActor) + { + static auto ActiveSkinOffset = SpawnedCosmeticActor->GetOffset("ActiveSkin"); + SpawnedCosmeticActor->Get(ActiveSkinOffset) = OverrideBattleBusSkin; + } + } + } + } GameState->Get("WarmupCountdownEndTime") = UGameplayStatics::GetTimeSeconds(GetWorld()) + 10; } @@ -560,31 +620,22 @@ void MainUI() void PregameUI() { - // ImGui::NewLine(); + StaticUI(); - ImGui::Checkbox("No MCP (Don't change unless you know what this is)", &Globals::bNoMCP); - - if (Addresses::ClearAbility) + if (Engine_Version >= 422 && Engine_Version < 424) { - ImGui::Checkbox("Enable AGIDs (Don't change unless you know what this is)", &Globals::bEnableAGIDs); + ImGui::Checkbox("Creative", &Globals::bCreative); } - if (!Globals::bInitializedPlaylist) + ImGui::Checkbox("Lategame", &Globals::bLateGame); + + if (HasEvent()) { - if (Engine_Version >= 422 && Engine_Version < 424) - { - ImGui::Checkbox("Creative", &Globals::bCreative); - } - - ImGui::Checkbox("Lategame", &Globals::bLateGame); - - if (HasEvent()) - { - ImGui::Checkbox("Play Event", &Globals::bGoingToPlayEvent); - } - - ImGui::InputText("Playlist", &PlaylistName); + ImGui::Checkbox("Play Event", &Globals::bGoingToPlayEvent); } + + ImGui::SliderInt("Seconds until load into map", &SecondsUntilTravel, 1, 100); + ImGui::InputText("Playlist", &PlaylistName); } DWORD WINAPI GuiThread(LPVOID) diff --git a/Project Reboot 3.0/reboot.h b/Project Reboot 3.0/reboot.h index fddcd24..be7514d 100644 --- a/Project Reboot 3.0/reboot.h +++ b/Project Reboot 3.0/reboot.h @@ -377,9 +377,9 @@ static void CopyStruct(void* Dest, void* Src, size_t Size, UStruct* Struct = nul } template -static T* Alloc(size_t Size) +static T* Alloc(size_t Size, bool bUseRealloc = false) { - return (T*)VirtualAlloc(0, Size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); + return bUseRealloc ? (T*)FMemory::Realloc(0, Size, 0) : (T*)VirtualAlloc(0, Size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); } namespace MemberOffsets diff --git a/Project Reboot 3.0/vendingmachine.h b/Project Reboot 3.0/vendingmachine.h index 7000ed5..1efce80 100644 --- a/Project Reboot 3.0/vendingmachine.h +++ b/Project Reboot 3.0/vendingmachine.h @@ -187,8 +187,8 @@ static inline void FillItemCollector(ABuildingItemCollectorActor* ItemCollector, } // The reason I set the curve to 0 is because it will force it to return value, probably not how we are supposed to do it but whatever. - ItemCollection->GetInputCount()->GetCurve().CurveTable = nullptr; // FortGameData; // scuffed idc - ItemCollection->GetInputCount()->GetCurve().RowName = FName(0); // WoodName; // Scuffed idc + ItemCollection->GetInputCount()->GetCurve().CurveTable = Fortnite_Version < 5 ? nullptr : FortGameData; // scuffed idc + ItemCollection->GetInputCount()->GetCurve().RowName = Fortnite_Version < 5 ? FName(0) : WoodName; // Scuffed idc ItemCollection->GetInputCount()->GetValue() = RarityToUse == 0 ? CommonPrice : RarityToUse == 1 ? UncommonPrice : RarityToUse == 2 ? RarePrice @@ -234,7 +234,7 @@ static inline void FillItemCollector(ABuildingItemCollectorActor* ItemCollector, static inline void FillVendingMachines() { - static auto VendingMachineClass = FindObject("/Game/Athena/Items/Gameplay/VendingMachine/B_Athena_VendingMachine.B_Athena_VendingMachine_C"); + auto VendingMachineClass = FindObject("/Game/Athena/Items/Gameplay/VendingMachine/B_Athena_VendingMachine.B_Athena_VendingMachine_C"); auto AllVendingMachines = UGameplayStatics::GetAllActorsOfClass(GetWorld(), VendingMachineClass); auto OverrideLootTierGroup = UKismetStringLibrary::Conv_StringToName(L"Loot_AthenaVending"); // ItemCollector->GetLootTierGroupOverride();