diff --git a/Project Reboot 3.0/Array.h b/Project Reboot 3.0/Array.h index 104d5b0..241dbec 100644 --- a/Project Reboot 3.0/Array.h +++ b/Project Reboot 3.0/Array.h @@ -125,7 +125,8 @@ public: if (Data && ArrayNum > 0 && sizeof(InElementType) > 0) { // VirtualFree(Data, _msize(Data), MEM_RELEASE); - VirtualFree(Data, sizeof(InElementType) * ArrayNum, MEM_RELEASE); + VirtualFree(Data, sizeof(InElementType) * ArrayNum, MEM_RELEASE); // ik this does nothing + // VirtualFree(Data, 0, MEM_RELEASE); } ArrayNum = 0; diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index 6dee9bd..9aa259d 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -260,6 +260,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game LocalPlayers.Remove(0); } + // LOG_INFO(LogDev, "ReadyToStartMatch!"); + static int LastNum2 = 1; if (AmountOfRestarts != LastNum2) @@ -649,105 +651,91 @@ int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena* GameMode, AActor* NewPlayerActor) { - if (!NewPlayerActor) + if (NewPlayerActor == GetLocalPlayerController()) // we dont really need this but it also functions as a nullptr check usually return; - LOG_INFO(LogPlayer, "HandleStartingNewPlayer!"); - - static bool bFirst = Engine_Version >= 424; - auto GameState = GameMode->GetGameStateAthena(); - if (bFirst) + LOG_INFO(LogPlayer, "HandleStartingNewPlayer!"); + + if (Engine_Version < 427) { - bFirst = false; - - auto CurrentPlaylist = GameState->GetCurrentPlaylist(); + static int LastNum69 = 19451; - // if (!CurrentPlaylist || !CurrentPlaylist->Get("bSkipWarmup")) + if (LastNum69 != AmountOfRestarts) { - /* GameState->GetGamePhase() = EAthenaGamePhase::Warmup; - GameState->OnRep_GamePhase(); */ - } + LastNum69 = AmountOfRestarts; - // GameState->OnRep_CurrentPlaylistInfo(); - } + 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"); - static bool bSpawnedFloorLoot = Engine_Version >= 427; + TArray SpawnIsland_FloorLoot_Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), SpawnIsland_FloorLoot); - if (!bSpawnedFloorLoot) - { - bSpawnedFloorLoot = true; + TArray BRIsland_FloorLoot_Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), BRIsland_FloorLoot); - 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"); + auto SpawnIslandTierGroup = UKismetStringLibrary::Conv_StringToName(L"Loot_AthenaFloorLoot_Warmup"); + auto BRIslandTierGroup = UKismetStringLibrary::Conv_StringToName(L"Loot_AthenaFloorLoot"); - TArray SpawnIsland_FloorLoot_Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), SpawnIsland_FloorLoot); + float UpZ = 50; - TArray BRIsland_FloorLoot_Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), BRIsland_FloorLoot); + EFortPickupSourceTypeFlag SpawnFlag = EFortPickupSourceTypeFlag::Container; - auto SpawnIslandTierGroup = UKismetStringLibrary::Conv_StringToName(L"Loot_AthenaFloorLoot_Warmup"); - auto BRIslandTierGroup = UKismetStringLibrary::Conv_StringToName(L"Loot_AthenaFloorLoot"); + bool bPrintWarmup = false; - float UpZ = 50; - - EFortPickupSourceTypeFlag SpawnFlag = EFortPickupSourceTypeFlag::Container; - - bool bPrintWarmup = false; - - for (int i = 0; i < SpawnIsland_FloorLoot_Actors.Num(); i++) - { - ABuildingContainer* CurrentActor = (ABuildingContainer*)SpawnIsland_FloorLoot_Actors.at(i); - - // CurrentActor->K2_DestroyActor(); - // continue; - - auto Location = CurrentActor->GetActorLocation(); - Location.Z += UpZ; - - std::vector LootDrops = PickLootDrops(SpawnIslandTierGroup, bPrintWarmup); - - if (bPrintWarmup) + for (int i = 0; i < SpawnIsland_FloorLoot_Actors.Num(); i++) { - std::cout << "\n\n"; + ABuildingContainer* CurrentActor = (ABuildingContainer*)SpawnIsland_FloorLoot_Actors.at(i); + + // CurrentActor->K2_DestroyActor(); + // continue; + + auto Location = CurrentActor->GetActorLocation(); + Location.Z += UpZ; + + std::vector LootDrops = PickLootDrops(SpawnIslandTierGroup, bPrintWarmup); + + if (bPrintWarmup) + { + std::cout << "\n\n"; + } + + if (LootDrops.size()) + { + for (auto& LootDrop : LootDrops) + AFortPickup::SpawnPickup(LootDrop.ItemDefinition, Location, LootDrop.Count, SpawnFlag, EFortPickupSpawnSource::Unset, LootDrop.LoadedAmmo); + } + + CurrentActor->K2_DestroyActor(); } - if (LootDrops.size()) + bool bPrint = false; + + int spawned = 0; + + for (int i = 0; i < BRIsland_FloorLoot_Actors.Num(); i++) { - for (auto& LootDrop : LootDrops) - AFortPickup::SpawnPickup(LootDrop.ItemDefinition, Location, LootDrop.Count, SpawnFlag, EFortPickupSpawnSource::Unset, LootDrop.LoadedAmmo); + ABuildingContainer* CurrentActor = (ABuildingContainer*)BRIsland_FloorLoot_Actors.at(i); + + // CurrentActor->K2_DestroyActor(); + spawned++; + // continue; + + auto Location = CurrentActor->GetActorLocation(); + Location.Z += UpZ; + + std::vector LootDrops = PickLootDrops(BRIslandTierGroup, bPrint); + + if (bPrint) + std::cout << "\n"; + + if (LootDrops.size()) + { + for (auto& LootDrop : LootDrops) + AFortPickup::SpawnPickup(LootDrop.ItemDefinition, Location, LootDrop.Count, SpawnFlag, EFortPickupSpawnSource::Unset, LootDrop.LoadedAmmo); + } + + CurrentActor->K2_DestroyActor(); } - - CurrentActor->K2_DestroyActor(); - } - - bool bPrint = false; - - int spawned = 0; - - for (int i = 0; i < BRIsland_FloorLoot_Actors.Num(); i++) - { - ABuildingContainer* CurrentActor = (ABuildingContainer*)BRIsland_FloorLoot_Actors.at(i); - - // CurrentActor->K2_DestroyActor(); - spawned++; - // continue; - - auto Location = CurrentActor->GetActorLocation(); - Location.Z += UpZ; - - std::vector LootDrops = PickLootDrops(BRIslandTierGroup, bPrint); - - if (bPrint) - std::cout << "\n"; - - if (LootDrops.size()) - { - for (auto& LootDrop : LootDrops) - AFortPickup::SpawnPickup(LootDrop.ItemDefinition, Location, LootDrop.Count, SpawnFlag, EFortPickupSpawnSource::Unset, LootDrop.LoadedAmmo); - } - - CurrentActor->K2_DestroyActor(); } } diff --git a/Project Reboot 3.0/GameMode.cpp b/Project Reboot 3.0/GameMode.cpp new file mode 100644 index 0000000..f2c10b9 --- /dev/null +++ b/Project Reboot 3.0/GameMode.cpp @@ -0,0 +1,9 @@ +#include "GameMode.h" + +#include "reboot.h" + +void AGameMode::RestartGame() +{ + static auto fn = FindObject("/Script/Engine.GameMode.RestartGame"); + this->ProcessEvent(fn); +} \ No newline at end of file diff --git a/Project Reboot 3.0/GameMode.h b/Project Reboot 3.0/GameMode.h index c44d960..00534e3 100644 --- a/Project Reboot 3.0/GameMode.h +++ b/Project Reboot 3.0/GameMode.h @@ -6,6 +6,8 @@ class AGameMode : public AGameModeBase { public: + void RestartGame(); + class AGameState*& GetGameState() { static auto GameStateOffset = this->GetOffset("GameState"); diff --git a/Project Reboot 3.0/GameplayStatics.cpp b/Project Reboot 3.0/GameplayStatics.cpp index 3702989..b56bddd 100644 --- a/Project Reboot 3.0/GameplayStatics.cpp +++ b/Project Reboot 3.0/GameplayStatics.cpp @@ -44,6 +44,36 @@ UObject* UGameplayStatics::SpawnObject(UClass* ObjectClass, UObject* Outer) return UGameplayStatics_SpawnObject_Params.ReturnValue; } +/* void UGameplayStatics::OpenLevel(UObject* WorldContextObject, FName LevelName, bool bAbsolute, const FString& Options) +{ + static auto fn = FindObject("/Script/Engine.GameplayStatics.OpenLevel"); + + struct + { + UObject* WorldContextObject; // (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + FName LevelName; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + bool bAbsolute; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) + FString Options; // (Parm, ZeroConstructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) + } UGameplayStatics_OpenLevel_Params{WorldContextObject, LevelName, bAbsolute, Options}; + + static auto defaultObj = StaticClass(); + defaultObj->ProcessEvent(fn, &UGameplayStatics_OpenLevel_Params); +} */ + +void UGameplayStatics::RemovePlayer(APlayerController* Player, bool bDestroyPawn) +{ + static auto fn = FindObject("/Script/Engine.GameplayStatics.RemovePlayer"); + + struct + { + APlayerController* Player; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + bool bDestroyPawn; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) + } UGameplayStatics_RemovePlayer_Params{Player, bDestroyPawn}; + + static auto defaultObj = StaticClass(); + defaultObj->ProcessEvent(fn, &UGameplayStatics_RemovePlayer_Params); +} + UClass* UGameplayStatics::StaticClass() { static auto Class = FindObject(L"/Script/Engine.GameplayStatics"); diff --git a/Project Reboot 3.0/GameplayStatics.h b/Project Reboot 3.0/GameplayStatics.h index b82bb39..bbd4fa3 100644 --- a/Project Reboot 3.0/GameplayStatics.h +++ b/Project Reboot 3.0/GameplayStatics.h @@ -10,6 +10,8 @@ public: static TArray GetAllActorsOfClass(const UObject* WorldContextObject, UClass* ActorClass); static float GetTimeSeconds(UObject* WorldContextObject); static UObject* SpawnObject(UClass* ObjectClass, UObject* Outer); + // static void OpenLevel(UObject* WorldContextObject, FName LevelName, bool bAbsolute, const FString& Options); + static void RemovePlayer(class APlayerController* Player, bool bDestroyPawn); static UClass* StaticClass(); }; \ No newline at end of file diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj b/Project Reboot 3.0/Project Reboot 3.0.vcxproj index d3f70ac..96996ce 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj @@ -201,6 +201,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 f00dc49..5243676 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters @@ -161,6 +161,9 @@ FortniteGame\Source\FortniteGame\Private + + Engine\Source\Runtime\Engine\Private + diff --git a/Project Reboot 3.0/UnrealString.h b/Project Reboot 3.0/UnrealString.h index a72681d..fc36d82 100644 --- a/Project Reboot 3.0/UnrealString.h +++ b/Project Reboot 3.0/UnrealString.h @@ -3,6 +3,7 @@ #include #include "Array.h" +#include "log.h" class FString { @@ -44,4 +45,14 @@ public: { Set(str); } + + ~FString() + { + if (Data.Data) + { + // LOG_INFO(LogDev, "Deconstructing FString!"); + } + + // Free(); + } }; \ No newline at end of file diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 463b980..5d37c11 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -132,7 +132,7 @@ DWORD WINAPI Main(LPVOID) GetLocalPlayerController()->ProcessEvent(SwitchLevel, &Level); LOG_INFO(LogPlayer, "Switched level."); - + Hooking::MinHook::Hook((PVOID)Addresses::ActorGetNetMode, (PVOID)GetNetModeHook2, nullptr); LOG_INFO(LogDev, "FindGIsServer: 0x{:x}", FindGIsServer() - __int64(GetModuleHandleW(0))); @@ -154,11 +154,18 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3DED158), (PVOID)ReturnTrueHook, nullptr); } - auto& LocalPlayers = GetLocalPlayers(); - - if (LocalPlayers.Num() && LocalPlayers.Data) + if (true) { - LocalPlayers.Remove(0); + auto& LocalPlayers = GetLocalPlayers(); + + if (LocalPlayers.Num() && LocalPlayers.Data) + { + LocalPlayers.Remove(0); + } + } + else if (false) + { + UGameplayStatics::RemovePlayer((APlayerController*)GetLocalPlayerController(), true); } for (auto func : Addresses::GetFunctionsToNull()) @@ -377,7 +384,7 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook((PVOID)Addresses::TickFlush, (PVOID)UNetDriver::TickFlushHook, (PVOID*)&UNetDriver::TickFlushOriginal); // Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x1A001D0), GetServerDeltaTimeFromObjectHook); - // if (/* Engine_Version >= 420 && */ Engine_Version < 427) + // if (Engine_Version < 427) { Hooking::MinHook::Hook((PVOID)Addresses::OnDamageServer, (PVOID)ABuildingActor::OnDamageServerHook, (PVOID*)&ABuildingActor::OnDamageServerOriginal); } @@ -387,7 +394,7 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook((PVOID)Addresses::PickTeam, (PVOID)AFortGameModeAthena::Athena_PickTeamHook); // Hooking::MinHook::Hook((PVOID)Addresses::SetZoneToIndex, (PVOID)AFortGameModeAthena::SetZoneToIndexHook, (PVOID*)&AFortGameModeAthena::SetZoneToIndexOriginal); Hooking::MinHook::Hook((PVOID)Addresses::CompletePickupAnimation, (PVOID)AFortPickup::CompletePickupAnimationHook, (PVOID*)&AFortPickup::CompletePickupAnimationOriginal); - Hooking::MinHook::Hook((PVOID)Addresses::CanActivateAbility, ReturnTrueHook); // ahhh wtf + // Hooking::MinHook::Hook((PVOID)Addresses::CanActivateAbility, ReturnTrueHook); // ahhh wtf // Hooking::MinHook::Hook((PVOID)FindFunctionCall(L"ServerRemoveInventoryItem"), UFortInventoryInterface::RemoveInventoryItemHook); if (Fortnite_Version >= 13) @@ -437,7 +444,7 @@ DWORD WINAPI Main(LPVOID) MemberOffsets::DeathReport::KillerPlayerState = FindOffsetStruct("/Script/FortniteGame.FortPlayerDeathReport", "KillerPlayerState"); MemberOffsets::DeathReport::DamageCauser = FindOffsetStruct("/Script/FortniteGame.FortPlayerDeathReport", "DamageCauser"); } - + srand(time(0)); LOG_INFO(LogHook, "Finished!"); @@ -473,6 +480,34 @@ DWORD WINAPI Main(LPVOID) { Globals::bLogProcessEvent = !Globals::bLogProcessEvent; } + + /* else if (GetAsyncKeyState(VK_F10) & 1) + { + 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(LogDev, "Restarting!"); + AmountOfRestarts++; + } */ Sleep(1000 / 30); } diff --git a/Project Reboot 3.0/log.h b/Project Reboot 3.0/log.h index 08afa37..063c4c3 100644 --- a/Project Reboot 3.0/log.h +++ b/Project Reboot 3.0/log.h @@ -43,9 +43,12 @@ inline void InitLogger() FILE* stream = nullptr; - freopen_s(&stream, "in.txt", "r", stdin); - freopen_s(&stream, "out.txt", "w+", stdout); - freopen_s(&stream, "err.txt", "w", stderr); + // if (false) + { + freopen_s(&stream, "in.txt", "r", stdin); + freopen_s(&stream, "out.txt", "w+", stdout); + freopen_s(&stream, "err.txt", "w", stderr); + } SetConsoleTitleA("Project Reboot 3.0");