diff --git a/Project Reboot 3.0/BuildingContainer.cpp b/Project Reboot 3.0/BuildingContainer.cpp index 541028d..2b1c47a 100644 --- a/Project Reboot 3.0/BuildingContainer.cpp +++ b/Project Reboot 3.0/BuildingContainer.cpp @@ -15,8 +15,7 @@ bool ABuildingContainer::SpawnLoot(AFortPawn* Pawn) FVector LocationToSpawnLoot = this->GetActorLocation() + this->GetActorForwardVector() * this->GetLootSpawnLocation_Athena().X + this->GetActorRightVector() * this->GetLootSpawnLocation_Athena().Y + this->GetActorUpVector() * this->GetLootSpawnLocation_Athena().Z; - static auto SearchLootTierGroupOffset = this->GetOffset("SearchLootTierGroup"); - auto RedirectedLootTier = GameMode->RedirectLootTier(this->Get(SearchLootTierGroupOffset)); + auto RedirectedLootTier = GameMode->RedirectLootTier(GetSearchLootTierGroup()); // LOG_INFO(LogInteraction, "RedirectedLootTier: {}", RedirectedLootTier.ToString()); diff --git a/Project Reboot 3.0/BuildingContainer.h b/Project Reboot 3.0/BuildingContainer.h index a116101..847251c 100644 --- a/Project Reboot 3.0/BuildingContainer.h +++ b/Project Reboot 3.0/BuildingContainer.h @@ -13,6 +13,12 @@ public: return this->ReadBitfieldValue(bDestroyContainerOnSearchOffset, bDestroyContainerOnSearchFieldMask); } + FName& GetSearchLootTierGroup() + { + static auto SearchLootTierGroupOffset = this->GetOffset("SearchLootTierGroup"); + return Get(SearchLootTierGroupOffset); + } + bool IsAlreadySearched() { static auto bAlreadySearchedOffset = this->GetOffset("bAlreadySearched"); diff --git a/Project Reboot 3.0/CurveTable.h b/Project Reboot 3.0/CurveTable.h index 85a92d3..ecba384 100644 --- a/Project Reboot 3.0/CurveTable.h +++ b/Project Reboot 3.0/CurveTable.h @@ -56,7 +56,7 @@ public: { auto CurveTableMode = GetCurveTableMode(); - LOG_INFO(LogDev, "RowName {} CurveTableMode {} Size {}", RowName.ComparisonIndex.Value ? RowName.ToString() : "InvalidComparision", (int)CurveTableMode, GetCurveTableSize()); + // LOG_INFO(LogDev, "RowName {} CurveTableMode {} Size {}", RowName.ComparisonIndex.Value ? RowName.ToString() : "InvalidComparision", (int)CurveTableMode, GetCurveTableSize()); if (CurveTableMode == ECurveTableMode::SimpleCurves) { @@ -67,7 +67,7 @@ public: } else if (CurveTableMode == ECurveTableMode::RichCurves) { - + LOG_INFO(LogDev, "RICHCURVE UNIMPLEMENTED!"); } return nullptr; diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index ef06f26..05a1bcd 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -62,7 +62,7 @@ static UFortPlaylist* GetPlaylistToUse() // SET OVERRIDE PLAYLIST DOWN HERE if (Globals::bCreative) - Playlist = FindObject("/Game/Athena/Playlists/Creative/Playlist_PlaygroundV2.Playlist_PlaygroundV2"); + Playlist = FindObject(L"/Game/Athena/Playlists/Creative/Playlist_PlaygroundV2.Playlist_PlaygroundV2"); return Playlist; } @@ -141,7 +141,7 @@ void AFortGameModeAthena::SkipAircraft() if (bGameModeWillSkipAircraftOffset != -1) // hmm? GameState->Get(bGameModeWillSkipAircraftOffset) = true; - static auto OnAircraftExitedDropZoneFn = FindObject("/Script/FortniteGame.FortGameModeAthena.OnAircraftExitedDropZone"); + static auto OnAircraftExitedDropZoneFn = FindObject(L"/Script/FortniteGame.FortGameModeAthena.OnAircraftExitedDropZone"); static auto AircraftsOffset = GameState->GetOffset("Aircrafts", false); @@ -194,6 +194,19 @@ void AFortGameModeAthena::PauseSafeZone(bool bPaused) SafeZoneIndicator->GetSafeZoneFinishShrinkTime() = GameState->GetServerWorldTimeSeconds() + this->Get(TimeRemainingWhenPhasePausedOffset); } +void AFortGameModeAthena::OnAircraftEnteredDropZoneHook(AFortGameModeAthena* GameModeAthena, AActor* Aircraft) +{ + LOG_INFO(LogDev, "OnAircraftEnteredDropZoneHook!"); + + OnAircraftEnteredDropZoneOriginal(GameModeAthena, Aircraft); + + if (Globals::bLateGame.load()) + { + auto GameState = Cast(GameModeAthena->GetGameState()); + GameState->SkipAircraft(); + } +} + bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* GameMode) { Globals::bHitReadyToStartMatch = true; @@ -600,11 +613,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game auto MapInfo = GameState->GetMapInfo(); - if (!bUseCustomMap) - { - if (!MapInfo && Engine_Version >= 421) - return false; - } + if (!MapInfo && Engine_Version >= 421) + return false; static int LastNum = 1; @@ -1229,6 +1239,8 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena ABuildingContainer* CurrentActor = (ABuildingContainer*)BRIsland_FloorLoot_Actors.at(i); spawned++; + // LOG_INFO(LogDev, "Test: {}", CurrentActor->GetSearchLootTierGroup().ToString()); + auto Location = CurrentActor->GetActorLocation() + CurrentActor->GetActorForwardVector() * CurrentActor->GetLootSpawnLocation_Athena().X + CurrentActor->GetActorRightVector() * CurrentActor->GetLootSpawnLocation_Athena().Y + CurrentActor->GetActorUpVector() * CurrentActor->GetLootSpawnLocation_Athena().Z; std::vector LootDrops = PickLootDrops(BRIslandTierGroup, GameState->GetWorldLevel(), -1, bPrintIsland); diff --git a/Project Reboot 3.0/FortGameModeAthena.h b/Project Reboot 3.0/FortGameModeAthena.h index 78bd62a..ac6360b 100644 --- a/Project Reboot 3.0/FortGameModeAthena.h +++ b/Project Reboot 3.0/FortGameModeAthena.h @@ -234,6 +234,7 @@ public: static inline bool (*Athena_ReadyToStartMatchOriginal)(AFortGameModeAthena* GameMode); static inline void (*Athena_HandleStartingNewPlayerOriginal)(AFortGameModeAthena* GameMode, AActor* NewPlayer); static inline void (*SetZoneToIndexOriginal)(AFortGameModeAthena* GameModeAthena, int OverridePhaseMaybeIDFK); + static inline void (*OnAircraftEnteredDropZoneOriginal)(AFortGameModeAthena* GameModeAthena, AActor* Aircraft); AFortSafeZoneIndicator*& GetSafeZoneIndicator() { @@ -265,6 +266,7 @@ public: static void HandleSpawnRateForActorClass(UClass* ActorClass, float SpawnPercentage); // idk where to put + static void OnAircraftEnteredDropZoneHook(AFortGameModeAthena* GameModeAthena, AActor* Aircraft); static bool Athena_ReadyToStartMatchHook(AFortGameModeAthena* GameMode); static int Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint8 preferredTeam, AActor* Controller); static void Athena_HandleStartingNewPlayerHook(AFortGameModeAthena* GameMode, AActor* NewPlayerActor); diff --git a/Project Reboot 3.0/FortGameStateAthena.cpp b/Project Reboot 3.0/FortGameStateAthena.cpp index 2095548..7fab3eb 100644 --- a/Project Reboot 3.0/FortGameStateAthena.cpp +++ b/Project Reboot 3.0/FortGameStateAthena.cpp @@ -74,6 +74,57 @@ void AFortGameStateAthena::AddPlayerStateToGameMemberInfo(AFortPlayerStateAthena GameMemberInfoArray->MarkArrayDirty(); } +void AFortGameStateAthena::SkipAircraft() +{ + // return UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipaircraft", nullptr); + + if (GetGamePhase() != EAthenaGamePhase::Aircraft) + return; + + // this->bGameModeWillSkipAircraft = true; + + auto GetAircrafts = [&]() -> std::vector + { + static auto AircraftsOffset = this->GetOffset("Aircrafts", false); + std::vector Aircrafts; + + if (AircraftsOffset == -1) + { + // GameState->Aircraft + + static auto FortAthenaAircraftClass = FindObject(L"/Script/FortniteGame.FortAthenaAircraft"); + auto AllAircrafts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortAthenaAircraftClass); + + for (int i = 0; i < AllAircrafts.Num(); i++) + { + Aircrafts.push_back(AllAircrafts.at(i)); + } + + AllAircrafts.Free(); + } + else + { + const auto& GameStateAircrafts = this->Get>(AircraftsOffset); + + for (int i = 0; i < GameStateAircrafts.Num(); i++) + { + Aircrafts.push_back(GameStateAircrafts.at(i)); + } + } + + return Aircrafts; + }; + + auto GameMode = Cast(GetWorld()->GetGameMode()); + + for (auto Aircraft : GetAircrafts()) + { + // haha skunked we should do GetAircraft!! + static auto OnAircraftExitedDropZoneFn = FindObject(L"/Script/FortniteGame.FortGameModeAthena.OnAircraftExitedDropZone"); + GameMode->ProcessEvent(OnAircraftExitedDropZoneFn, &Aircraft); + } +} + TScriptInterface AFortGameStateAthena::GetSafeZoneInterface() { int Offset = -1; diff --git a/Project Reboot 3.0/FortGameStateAthena.h b/Project Reboot 3.0/FortGameStateAthena.h index 3933c6f..d3f2e5a 100644 --- a/Project Reboot 3.0/FortGameStateAthena.h +++ b/Project Reboot 3.0/FortGameStateAthena.h @@ -153,6 +153,7 @@ public: TScriptInterface GetSafeZoneInterface(); void AddPlayerStateToGameMemberInfo(class AFortPlayerStateAthena* PlayerState); + void SkipAircraft(); int GetAircraftIndex(AFortPlayerState* PlayerState); bool IsRespawningAllowed(AFortPlayerState* PlayerState); // actually in zone diff --git a/Project Reboot 3.0/FortInventory.cpp b/Project Reboot 3.0/FortInventory.cpp index ab7da44..be3b04f 100644 --- a/Project Reboot 3.0/FortInventory.cpp +++ b/Project Reboot 3.0/FortInventory.cpp @@ -471,16 +471,20 @@ void AFortInventory::ModifyCount(UFortItem* ItemInstance, int New, bool bRemove, UFortItem* AFortInventory::GetPickaxeInstance() { - static auto FortWeaponMeleeItemDefinitionClass = FindObject("/Script/FortniteGame.FortWeaponMeleeItemDefinition"); + static auto FortWeaponMeleeItemDefinitionClass = FindObject(L"/Script/FortniteGame.FortWeaponMeleeItemDefinition"); auto& ItemInstances = GetItemList().GetItemInstances(); - for (int i = 0; i < ItemInstances.Num(); i++) + for (int i = 0; i < ItemInstances.Num(); ++i) { auto ItemInstance = ItemInstances.At(i); - if (ItemInstance->GetItemEntry()->GetItemDefinition()->IsA(FortWeaponMeleeItemDefinitionClass)) + if (ItemInstance->GetItemEntry() && ItemInstance->GetItemEntry()->GetItemDefinition() && + ItemInstance->GetItemEntry()->GetItemDefinition()->IsA(FortWeaponMeleeItemDefinitionClass) + ) + { return ItemInstance; + } } return nullptr; diff --git a/Project Reboot 3.0/FortInventoryInterface.cpp b/Project Reboot 3.0/FortInventoryInterface.cpp index e2840a9..d4e4b57 100644 --- a/Project Reboot 3.0/FortInventoryInterface.cpp +++ b/Project Reboot 3.0/FortInventoryInterface.cpp @@ -15,7 +15,7 @@ char UFortInventoryInterface::RemoveInventoryItemHook(__int64 a1, FGuid a2, int // LOG_INFO(LogDev, "FortPlayerControllerSuperSize: {}", FortPlayerControllerSuperSize); // LOG_INFO(LogDev, "ControllerObject: {}", ControllerObject->GetFullName()); - LOG_INFO(LogDev, __FUNCTION__); + // LOG_INFO(LogDev, __FUNCTION__); if (!ControllerObject) return false; diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 6529837..35f8ce2 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -226,7 +226,7 @@ void AFortPlayerController::ServerLoadingScreenDroppedHook(UObject* Context, FFr auto PlayerController = (AFortPlayerController*)Context; - // PlayerController->ApplyCosmeticLoadout(); + PlayerController->ApplyCosmeticLoadout(); return ServerLoadingScreenDroppedOriginal(Context, Stack, Ret); } diff --git a/Project Reboot 3.0/FortSafeZoneIndicator.cpp b/Project Reboot 3.0/FortSafeZoneIndicator.cpp index 70552f7..4710767 100644 --- a/Project Reboot 3.0/FortSafeZoneIndicator.cpp +++ b/Project Reboot 3.0/FortSafeZoneIndicator.cpp @@ -2,6 +2,7 @@ #include "FortGameModeAthena.h" #include "reboot.h" +#include "KismetSystemLibrary.h" void AFortSafeZoneIndicator::SkipShrinkSafeZone() { diff --git a/Project Reboot 3.0/GameModeBase.cpp b/Project Reboot 3.0/GameModeBase.cpp index 67e2b55..ec4523a 100644 --- a/Project Reboot 3.0/GameModeBase.cpp +++ b/Project Reboot 3.0/GameModeBase.cpp @@ -127,25 +127,7 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll if (!NewPawn) return nullptr; - bool bIsRespawning = false; - - /* - static auto RespawnDataOffset = PlayerStateAthena->GetOffset("RespawnData", false); - - if (RespawnDataOffset != -1) - { - auto RespawnDataPtr = PlayerStateAthena->GetRespawnData(); - - if (RespawnDataPtr->IsServerReady() && RespawnDataPtr->IsClientReady()) // && GameState->IsRespawningAllowed(PlayerState); - { - bIsRespawning = true; - } - } */ - - /* auto DeathInfo = (void*)(__int64(PlayerStateAthena) + MemberOffsets::FortPlayerStateAthena::DeathInfo); - FVector DeathLocation = MemberOffsets::DeathInfo::DeathLocation != -1 ? *(FVector*)(__int64(DeathInfo) + MemberOffsets::DeathInfo::DeathLocation) : FVector(0, 0, 0); - - bIsRespawning = !(DeathLocation.CompareVectors(FVector(0, 0, 0))); // bro kms */ + bool bIsRespawning = false; // reel auto ASC = PlayerStateAthena->GetAbilitySystemComponent(); auto GameState = ((AFortGameModeAthena*)GameMode)->GetGameStateAthena(); @@ -168,62 +150,62 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll { auto WorldInventory = NewPlayerAsAthena->GetWorldInventory(); - if (!WorldInventory) - return NewPawn; - - if (!WorldInventory->GetPickaxeInstance()) + if (WorldInventory->IsValidLowLevel()) { - // TODO Check Playlist->bRequirePickaxeInStartingInventory - - auto& StartingItems = ((AFortGameModeAthena*)GameMode)->GetStartingItems(); - - NewPlayerAsAthena->AddPickaxeToInventory(); - - for (int i = 0; i < StartingItems.Num(); ++i) + if (!WorldInventory->GetPickaxeInstance()) { - auto& StartingItem = StartingItems.at(i); + // TODO Check Playlist->bRequirePickaxeInStartingInventory - WorldInventory->AddItem(StartingItem.GetItem(), nullptr, StartingItem.GetCount()); - } + auto& StartingItems = ((AFortGameModeAthena*)GameMode)->GetStartingItems(); - /* if (Globals::bLateGame) - { - auto SpawnIslandTierGroup = UKismetStringLibrary::Conv_StringToName(L"Loot_AthenaFloorLoot_Warmup"); + NewPlayerAsAthena->AddPickaxeToInventory(); - for (int i = 0; i < 5; ++i) + for (int i = 0; i < StartingItems.Num(); ++i) { - auto LootDrops = PickLootDrops(SpawnIslandTierGroup); + auto& StartingItem = StartingItems.at(i); - for (auto& LootDrop : LootDrops) - { - WorldInventory->AddItem(LootDrop.ItemDefinition, nullptr, LootDrop.Count, LootDrop.LoadedAmmo); - } + WorldInventory->AddItem(StartingItem.GetItem(), nullptr, StartingItem.GetCount()); } - } */ - auto AddInventoryOverrideTeamLoadouts = [&](AFortAthenaMutator* Mutator) - { - if (auto InventoryOverride = Cast(Mutator)) + /* if (Globals::bLateGame) { - auto TeamIndex = PlayerStateAthena->GetTeamIndex(); - auto LoadoutTeam = InventoryOverride->GetLoadoutTeamForTeamIndex(TeamIndex); + auto SpawnIslandTierGroup = UKismetStringLibrary::Conv_StringToName(L"Loot_AthenaFloorLoot_Warmup"); - if (LoadoutTeam.UpdateOverrideType == EAthenaInventorySpawnOverride::Always) + for (int i = 0; i < 5; ++i) { - auto LoadoutContainer = InventoryOverride->GetLoadoutContainerForTeamIndex(TeamIndex); + auto LootDrops = PickLootDrops(SpawnIslandTierGroup); - for (int i = 0; i < LoadoutContainer.Loadout.Num(); ++i) + for (auto& LootDrop : LootDrops) { - auto& ItemAndCount = LoadoutContainer.Loadout.at(i); - WorldInventory->AddItem(ItemAndCount.GetItem(), nullptr, ItemAndCount.GetCount()); + WorldInventory->AddItem(LootDrop.ItemDefinition, nullptr, LootDrop.Count, LootDrop.LoadedAmmo); } } - } - }; + } */ - LoopMutators(AddInventoryOverrideTeamLoadouts); + auto AddInventoryOverrideTeamLoadouts = [&](AFortAthenaMutator* Mutator) + { + if (auto InventoryOverride = Cast(Mutator)) + { + auto TeamIndex = PlayerStateAthena->GetTeamIndex(); + auto LoadoutTeam = InventoryOverride->GetLoadoutTeamForTeamIndex(TeamIndex); - WorldInventory->Update(); + if (LoadoutTeam.UpdateOverrideType == EAthenaInventorySpawnOverride::Always) + { + auto LoadoutContainer = InventoryOverride->GetLoadoutContainerForTeamIndex(TeamIndex); + + for (int i = 0; i < LoadoutContainer.Loadout.Num(); ++i) + { + auto& ItemAndCount = LoadoutContainer.Loadout.at(i); + WorldInventory->AddItem(ItemAndCount.GetItem(), nullptr, ItemAndCount.GetCount()); + } + } + } + }; + + LoopMutators(AddInventoryOverrideTeamLoadouts); + + WorldInventory->Update(); + } } } else @@ -249,5 +231,7 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll // NewPlayerAsAthena->RespawnPlayerAfterDeath(true); } + // LOG_INFO(LogDev, "Finish SpawnDefaultPawnFor!"); + return NewPawn; } \ No newline at end of file diff --git a/Project Reboot 3.0/die.h b/Project Reboot 3.0/die.h index cf5f451..d7a3bb3 100644 --- a/Project Reboot 3.0/die.h +++ b/Project Reboot 3.0/die.h @@ -17,45 +17,41 @@ static inline void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int O : 0x1F8; // S13-S14 static auto GameMode_SafeZonePhaseOffset = GameModeAthena->GetOffset("SafeZonePhase"); - LOG_INFO(LogDev, "Old SafeZonePhase: {}", GameModeAthena->Get(GameMode_SafeZonePhaseOffset)); - auto GameState = Cast(GameModeAthena->GetGameState()); if (!GameState) return SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK); - LOG_INFO(LogDev, "GamePhaseStep: {}", (int)GameState->GetGamePhaseStep()); + auto SafeZoneIndicator = GameModeAthena->GetSafeZoneIndicator(); - if (false) - { - if (Globals::bLateGame) - { - static auto GameMode_SafeZonePhaseOffset = GameModeAthena->GetOffset("SafeZonePhase"); - static auto GameState_SafeZonePhaseOffset = GameState->GetOffset("SafeZonePhase"); + static auto GameState_SafeZonePhaseOffset = GameState->GetOffset("SafeZonePhase"); - static int ahaaSafeZonePhase = 4; - int NewSafeZonePhase = ahaaSafeZonePhase; // GameModeAthena->Get(GameMode_SafeZonePhaseOffset); + static int NewLateGameSafeZonePhase = 2; - const int OriginalOldSafeZonePhase = GameModeAthena->Get(GameMode_SafeZonePhaseOffset); - - if (NewSafeZonePhase < 4) - { - NewSafeZonePhase = 4; - } - - LOG_INFO(LogDev, "Setting zone to: {} ({})", NewSafeZonePhase, OriginalOldSafeZonePhase); - - GameModeAthena->Get(GameMode_SafeZonePhaseOffset) = NewSafeZonePhase; - GameState->Get(GameState_SafeZonePhaseOffset) = NewSafeZonePhase; - ahaaSafeZonePhase++; - } - } + LOG_INFO(LogDev, "NewLateGameSafeZonePhase: {}", NewLateGameSafeZonePhase); if (Fortnite_Version < 13) - return SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK); + { + if (Globals::bLateGame.load()) + { + GameModeAthena->Get(GameMode_SafeZonePhaseOffset) = NewLateGameSafeZonePhase; + GameState->Get(GameState_SafeZonePhaseOffset) = NewLateGameSafeZonePhase; + SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK); - static auto SafeZoneIndicatorOffset = GameModeAthena->GetOffset("SafeZoneIndicator"); - auto SafeZoneIndicator = GameModeAthena->Get(SafeZoneIndicatorOffset); + if (NewLateGameSafeZonePhase == 2 || NewLateGameSafeZonePhase == 3) + { + if (SafeZoneIndicator) + SafeZoneIndicator->SkipShrinkSafeZone(); + else + LOG_WARN(LogZone, "Invalid SafeZoneIndicator!"); + } + + NewLateGameSafeZonePhase++; + return; + } + + return SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK); + } if (!SafeZoneIndicator) { @@ -103,23 +99,8 @@ static inline void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int O if (!FortGameData) FortGameData = FindObject(L"/Game/Balance/AthenaGameData.AthenaGameData"); - // LOG_INFO(LogDev, "FortGameData: {}", FortGameData ? FortGameData->GetFullName() : "InvalidObject"); - auto ShrinkTimeFName = UKismetStringLibrary::Conv_StringToName(L"Default.SafeZone.ShrinkTime"); auto HoldTimeFName = UKismetStringLibrary::Conv_StringToName(L"Default.SafeZone.WaitTime"); - FString ContextString; - - /* for (int i = 0; i < 10; i++) - { - LOG_INFO(LogDev, "[{}] Value {}", i, FortGameData->GetValueOfKey(FortGameData->GetKey(ShrinkTimeFName, i))); - } */ - - /* for (float i = 0; i < 1.1; i += 0.1) - { - float res; - UDataTableFunctionLibrary::EvaluateCurveTableRow(FortGameData, ShrinkTimeFName, i, ContextString, nullptr, &res); - LOG_INFO(LogZone, "[{}] {}", i, res); - } */ for (int i = 0; i < ZoneDurations.Num(); i++) { @@ -129,26 +110,23 @@ static inline void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int O { ZoneHoldDurations.at(i) = FortGameData->GetValueOfKey(FortGameData->GetKey(HoldTimeFName, i)); } - - /* - for (int i = 0; i < ZoneDurations.Num(); i++) - { - LOG_INFO(LogZone, "Move [{}] {}", i, ZoneDurations.at(i)); - } - - for (int i = 0; i < ZoneHoldDurations.Num(); i++) - { - LOG_INFO(LogZone, "Hold [{}] {}", i, ZoneHoldDurations.at(i)); - } - - */ } LOG_INFO(LogZone, "SafeZonePhase: {}", GameModeAthena->Get(SafeZonePhaseOffset)); LOG_INFO(LogZone, "OverridePhaseMaybeIDFK: {}", OverridePhaseMaybeIDFK); LOG_INFO(LogZone, "TimeSeconds: {}", UGameplayStatics::GetTimeSeconds(GetWorld())); - SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK); + if (Globals::bLateGame.load()) + { + GameModeAthena->Get(GameMode_SafeZonePhaseOffset) = NewLateGameSafeZonePhase; + GameState->Get(GameState_SafeZonePhaseOffset) = NewLateGameSafeZonePhase; + SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK); + NewLateGameSafeZonePhase++; + } + else + { + SetZoneToIndexOriginal(GameModeAthena, OverridePhaseMaybeIDFK); + } LOG_INFO(LogZone, "SafeZonePhase After: {}", GameModeAthena->Get(SafeZonePhaseOffset)); @@ -168,6 +146,14 @@ static inline void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int O LOG_INFO(LogZone, "Duration: {}", SafeZoneIndicator->Get(RadiusOffset)); SafeZoneIndicator->Get(SafeZoneFinishShrinkTimeOffset) = SafeZoneIndicator->Get(SafeZoneStartShrinkTimeOffset) + ZoneDuration; + + if (NewLateGameSafeZonePhase == 3 || NewLateGameSafeZonePhase == 4) + { + if (SafeZoneIndicator) + SafeZoneIndicator->SkipShrinkSafeZone(); + else + LOG_WARN(LogZone, "Invalid SafeZoneIndicator!"); + } } static inline void ProcessEventHook(UObject* Object, UFunction* Function, void* Parameters) diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 4971f0c..6104c9f 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -645,7 +645,8 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook, (PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false, false, true); - + Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/FortniteGame.FortGameModeAthena.OnAircraftEnteredDropZone"), AFortGameModeAthena::OnAircraftEnteredDropZoneHook, + (PVOID*)&AFortGameModeAthena::OnAircraftEnteredDropZoneOriginal, false, false, true, true); Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"), AGameModeBase::SpawnDefaultPawnForHook, nullptr, false); Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameModeBase.HandleStartingNewPlayer"), AFortGameModeAthena::Athena_HandleStartingNewPlayerHook, diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index bc655df..015c09e 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -479,6 +479,190 @@ static inline void PlayerTabs() } } +static inline DWORD WINAPI LateGameThread(LPVOID) +{ + float MaxTickRate = 30; + + auto GameMode = Cast(GetWorld()->GetGameMode()); + auto GameState = Cast(GameMode->GetGameState()); + + auto GetAircrafts = [&]() -> std::vector + { + static auto AircraftsOffset = GameState->GetOffset("Aircrafts", false); + std::vector Aircrafts; + + if (AircraftsOffset == -1) + { + // GameState->Aircraft + + static auto FortAthenaAircraftClass = FindObject(L"/Script/FortniteGame.FortAthenaAircraft"); + auto AllAircrafts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortAthenaAircraftClass); + + for (int i = 0; i < AllAircrafts.Num(); i++) + { + Aircrafts.push_back(AllAircrafts.at(i)); + } + + AllAircrafts.Free(); + } + else + { + const auto& GameStateAircrafts = GameState->Get>(AircraftsOffset); + + for (int i = 0; i < GameStateAircrafts.Num(); i++) + { + Aircrafts.push_back(GameStateAircrafts.at(i)); + } + } + + return Aircrafts; + }; + + UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startaircraft", nullptr); + + while (GetAircrafts().size() <= 0) + { + Sleep(1000 / MaxTickRate); + } + + static auto SafeZoneLocationsOffset = GameMode->GetOffset("SafeZoneLocations"); + const TArray& SafeZoneLocations = GameMode->Get>(SafeZoneLocationsOffset); + + if (SafeZoneLocations.Num() < 4) + { + LOG_WARN(LogLateGame, "Unable to find SafeZoneLocation! Disabling lategame.."); + Globals::bLateGame.store(false); + return 0; + } + + const FVector ZoneCenterLocation = SafeZoneLocations.at(3); + + FVector LocationToStartAircraft = ZoneCenterLocation; + LocationToStartAircraft.Z += 10000; + + auto Aircrafts = GetAircrafts(); + + float DropStartTime = GameState->GetServerWorldTimeSeconds() + 5.f; + float FlightSpeed = 0.0f; + + for (int i = 0; i < Aircrafts.size(); ++i) + { + auto CurrentAircraft = Aircrafts.at(i); + CurrentAircraft->TeleportTo(LocationToStartAircraft, FRotator()); + + static auto FlightInfoOffset = CurrentAircraft->GetOffset("FlightInfo", false); + + if (FlightInfoOffset == -1) + { + static auto FlightStartLocationOffset = CurrentAircraft->GetOffset("FlightStartLocation"); + static auto FlightSpeedOffset = CurrentAircraft->GetOffset("FlightSpeed"); + static auto DropStartTimeOffset = CurrentAircraft->GetOffset("DropStartTime"); + + CurrentAircraft->Get(FlightStartLocationOffset) = LocationToStartAircraft; + CurrentAircraft->Get(FlightSpeedOffset) = FlightSpeed; + CurrentAircraft->Get(DropStartTimeOffset) = DropStartTime; + } + else + { + auto FlightInfo = CurrentAircraft->GetPtr(FlightInfoOffset); + + FlightInfo->GetFlightSpeed() = FlightSpeed; + FlightInfo->GetFlightStartLocation() = LocationToStartAircraft; + FlightInfo->GetTimeTillDropStart() = DropStartTime; + } + } + + while (GameState->GetGamePhase() != EAthenaGamePhase::Aircraft) + { + Sleep(1000 / MaxTickRate); + } + + /* + static auto MapInfoOffset = GameState->GetOffset("MapInfo"); + auto MapInfo = GameState->Get(MapInfoOffset); + + if (MapInfo) + { + static auto FlightInfosOffset = MapInfo->GetOffset("FlightInfos", false); + + if (FlightInfosOffset != -1) + { + auto& FlightInfos = MapInfo->Get>(FlightInfosOffset); + + for (int i = 0; i < FlightInfos.Num(); i++) + { + auto FlightInfo = FlightInfos.AtPtr(i, FAircraftFlightInfo::GetStructSize()); + + FlightInfo->GetFlightSpeed() = FlightSpeed; + FlightInfo->GetFlightStartLocation() = LocationToStartAircraft; + FlightInfo->GetTimeTillDropStart() = DropStartTime; + } + } + } + */ + + while (GameState->GetGamePhase() == EAthenaGamePhase::Aircraft) + { + Sleep(1000 / MaxTickRate); + } + + static auto World_NetDriverOffset = GetWorld()->GetOffset("NetDriver"); + auto WorldNetDriver = GetWorld()->Get(World_NetDriverOffset); + auto& ClientConnections = WorldNetDriver->GetClientConnections(); + + for (int z = 0; z < ClientConnections.Num(); z++) + { + auto ClientConnection = ClientConnections.at(z); + auto FortPC = Cast(ClientConnection->GetPlayerController()); + + if (!FortPC) + continue; + + auto WorldInventory = FortPC->GetWorldInventory(); + + if (!WorldInventory) + continue; + + static auto WoodItemData = FindObject(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData"); + static auto StoneItemData = FindObject(L"/Game/Items/ResourcePickups/StoneItemData.StoneItemData"); + static auto MetalItemData = FindObject(L"/Game/Items/ResourcePickups/MetalItemData.MetalItemData"); + + static auto Rifle = FindObject(L"/Game/Athena/Items/Weapons/WID_Assault_AutoHigh_Athena_SR_Ore_T03.WID_Assault_AutoHigh_Athena_SR_Ore_T03"); + static auto Shotgun = FindObject(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_SR_Ore_T03.WID_Shotgun_Standard_Athena_SR_Ore_T03") + ? FindObject(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_SR_Ore_T03.WID_Shotgun_Standard_Athena_SR_Ore_T03") + : FindObject(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_C_Ore_T03.WID_Shotgun_Standard_Athena_C_Ore_T03"); + static auto SMG = FindObject(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03.WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03") + ? FindObject(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03.WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03") + : FindObject(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavySuppressed_Athena_R_Ore_T03.WID_Pistol_AutoHeavySuppressed_Athena_R_Ore_T03"); + + static auto MiniShields = FindObject(L"/Game/Athena/Items/Consumables/ShieldSmall/Athena_ShieldSmall.Athena_ShieldSmall"); + + static auto Shells = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataShells.AthenaAmmoDataShells"); + static auto Medium = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsMedium.AthenaAmmoDataBulletsMedium"); + static auto Light = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsLight.AthenaAmmoDataBulletsLight"); + static auto Heavy = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsHeavy.AthenaAmmoDataBulletsHeavy"); + + WorldInventory->AddItem(WoodItemData, nullptr, 500); + WorldInventory->AddItem(StoneItemData, nullptr, 500); + WorldInventory->AddItem(MetalItemData, nullptr, 500); + WorldInventory->AddItem(Rifle, nullptr, 1); + WorldInventory->AddItem(Shotgun, nullptr, 1); + WorldInventory->AddItem(SMG, nullptr, 1); + WorldInventory->AddItem(MiniShields, nullptr, 6); + WorldInventory->AddItem(Shells, nullptr, 999); + WorldInventory->AddItem(Medium, nullptr, 999); + WorldInventory->AddItem(Light, nullptr, 999); + WorldInventory->AddItem(Heavy, nullptr, 999); + + WorldInventory->Update(); + } + + static auto SafeZonesStartTimeOffset = GameState->GetOffset("SafeZonesStartTime"); + GameState->Get(SafeZonesStartTimeOffset) = 0.001f; + + return 0; +} + static inline void MainUI() { bool bLoaded = true; @@ -520,7 +704,7 @@ static inline void MainUI() if (GameState) { - static auto DefaultGliderRedeployCanRedeployOffset = FindOffsetStruct("/Script/FortniteGame.FortGameStateAthena", "DefaultGliderRedeployCanRedeploy"); + static auto DefaultGliderRedeployCanRedeployOffset = FindOffsetStruct("/Script/FortniteGame.FortGameStateAthena", "DefaultGliderRedeployCanRedeploy", false); if (DefaultGliderRedeployCanRedeployOffset != -1) { @@ -612,226 +796,14 @@ static inline void MainUI() AmountOfPlayersWhenBusStart = GameState->GetPlayersLeft(); - UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startaircraft", nullptr); - if (Globals::bLateGame.load()) { - auto GetAircrafts = [&]() -> TArray - { - static auto AircraftsOffset = GameState->GetOffset("Aircrafts", false); - - if (AircraftsOffset == -1) - { - // GameState->Aircraft - - static auto FortAthenaAircraftClass = FindObject(L"/Script/FortniteGame.FortAthenaAircraft"); - auto AllAircrafts = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortAthenaAircraftClass); - - return AllAircrafts; - } - - return GameState->Get>(AircraftsOffset); - }; - - while (GetAircrafts().Num() <= 0) // hmm - { - Sleep(500); - } - - UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startsafezone", nullptr); - - static auto SafeZoneIndicatorOffset = GameState->GetOffset("SafeZoneIndicator"); - - static auto SafeZonesStartTimeOffset = GameState->GetOffset("SafeZonesStartTime"); - GameState->Get(SafeZonesStartTimeOffset) = 0; - - LOG_INFO(LogDev, "Waiting for SafeZoneIndicator.."); - - while (!GameState->Get(SafeZoneIndicatorOffset)) - { - Sleep(500); - } - - LOG_INFO(LogDev, "SafeZoneIndicator is valid!"); - - while (GetAircrafts().Num() <= 0) // hmm - { - Sleep(500); - } - - static auto NextNextCenterOffset = GameState->Get(SafeZoneIndicatorOffset)->GetOffset("NextNextCenter", false); - static auto NextCenterOffset = GameState->Get(SafeZoneIndicatorOffset)->GetOffset("NextCenter"); - FVector LocationToStartAircraft = GameState->Get(SafeZoneIndicatorOffset)->Get(NextNextCenterOffset == -1 ? NextCenterOffset : NextNextCenterOffset); // SafeZoneLocations.at(4); - LocationToStartAircraft.Z += 10000; - - for (int i = 0; i < GetAircrafts().Num(); i++) - { - auto CurrentAircraft = GetAircrafts().at(i); - - CurrentAircraft->TeleportTo(LocationToStartAircraft, FRotator()); - - static auto FlightInfoOffset = CurrentAircraft->GetOffset("FlightInfo", false); - - float FlightSpeed = 0.0f; - - if (FlightInfoOffset == -1) - { - static auto FlightStartLocationOffset = CurrentAircraft->GetOffset("FlightStartLocation"); - static auto FlightSpeedOffset = CurrentAircraft->GetOffset("FlightSpeed"); - static auto DropStartTimeOffset = CurrentAircraft->GetOffset("DropStartTime"); - - CurrentAircraft->Get(FlightStartLocationOffset) = LocationToStartAircraft; - CurrentAircraft->Get(FlightSpeedOffset) = FlightSpeed; - CurrentAircraft->Get(DropStartTimeOffset) = GameState->GetServerWorldTimeSeconds(); - } - else - { - auto FlightInfo = CurrentAircraft->GetPtr(FlightInfoOffset); - - FlightInfo->GetFlightSpeed() = FlightSpeed; - FlightInfo->GetFlightStartLocation() = LocationToStartAircraft; - FlightInfo->GetTimeTillDropStart() = 0.0f; - } - } - - static auto MapInfoOffset = GameState->GetOffset("MapInfo"); - auto MapInfo = GameState->Get(MapInfoOffset); - - if (MapInfo) - { - static auto FlightInfosOffset = MapInfo->GetOffset("FlightInfos", false); - - if (FlightInfosOffset != -1) - { - auto& FlightInfos = MapInfo->Get>(FlightInfosOffset); - - LOG_INFO(LogDev, "FlightInfos.Num(): {}", FlightInfos.Num()); - - for (int i = 0; i < FlightInfos.Num(); i++) - { - auto FlightInfo = FlightInfos.AtPtr(i, FAircraftFlightInfo::GetStructSize()); - - FlightInfo->GetFlightSpeed() = 0; - FlightInfo->GetFlightStartLocation() = LocationToStartAircraft; - FlightInfo->GetTimeTillDropStart() = 0.0f; - } - } - } - - static auto bAircraftIsLockedOffset = GameState->GetOffset("bAircraftIsLocked"); - static auto bAircraftIsLockedFieldMask = GetFieldMask(GameState->GetProperty("bAircraftIsLocked")); - GameState->SetBitfieldValue(bAircraftIsLockedOffset, bAircraftIsLockedFieldMask, false); - - UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startaircraft", nullptr); - UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"skipaircraft", nullptr); - - static auto World_NetDriverOffset = GetWorld()->GetOffset("NetDriver"); - auto WorldNetDriver = GetWorld()->Get(World_NetDriverOffset); - auto& ClientConnections = WorldNetDriver->GetClientConnections(); - - for (int z = 0; z < ClientConnections.Num(); z++) - { - auto ClientConnection = ClientConnections.at(z); - auto FortPC = Cast(ClientConnection->GetPlayerController()); - - if (!FortPC) - continue; - - auto WorldInventory = FortPC->GetWorldInventory(); - - if (!WorldInventory) - continue; - - static auto WoodItemData = FindObject(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData"); - static auto StoneItemData = FindObject(L"/Game/Items/ResourcePickups/StoneItemData.StoneItemData"); - static auto MetalItemData = FindObject(L"/Game/Items/ResourcePickups/MetalItemData.MetalItemData"); - - static auto Rifle = FindObject(L"/Game/Athena/Items/Weapons/WID_Assault_AutoHigh_Athena_SR_Ore_T03.WID_Assault_AutoHigh_Athena_SR_Ore_T03"); - static auto Shotgun = FindObject(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_SR_Ore_T03.WID_Shotgun_Standard_Athena_SR_Ore_T03") - ? FindObject(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_SR_Ore_T03.WID_Shotgun_Standard_Athena_SR_Ore_T03") - : FindObject(L"/Game/Athena/Items/Weapons/WID_Shotgun_Standard_Athena_C_Ore_T03.WID_Shotgun_Standard_Athena_C_Ore_T03"); - static auto SMG = FindObject(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03.WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03") - ? FindObject(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03.WID_Pistol_AutoHeavyPDW_Athena_R_Ore_T03") - : FindObject(L"/Game/Athena/Items/Weapons/WID_Pistol_AutoHeavySuppressed_Athena_R_Ore_T03.WID_Pistol_AutoHeavySuppressed_Athena_R_Ore_T03"); - - static auto MiniShields = FindObject(L"/Game/Athena/Items/Consumables/ShieldSmall/Athena_ShieldSmall.Athena_ShieldSmall"); - - static auto Shells = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataShells.AthenaAmmoDataShells"); - static auto Medium = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsMedium.AthenaAmmoDataBulletsMedium"); - static auto Light = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsLight.AthenaAmmoDataBulletsLight"); - static auto Heavy = FindObject(L"/Game/Athena/Items/Ammo/AthenaAmmoDataBulletsHeavy.AthenaAmmoDataBulletsHeavy"); - - WorldInventory->AddItem(WoodItemData, nullptr, 500); - WorldInventory->AddItem(StoneItemData, nullptr, 500); - WorldInventory->AddItem(MetalItemData, nullptr, 500); - WorldInventory->AddItem(Rifle, nullptr, 1); - WorldInventory->AddItem(Shotgun, nullptr, 1); - WorldInventory->AddItem(SMG, nullptr, 1); - WorldInventory->AddItem(MiniShields, nullptr, 6); - WorldInventory->AddItem(Shells, nullptr, 999); - WorldInventory->AddItem(Medium, nullptr, 999); - WorldInventory->AddItem(Light, nullptr, 999); - WorldInventory->AddItem(Heavy, nullptr, 999); - - WorldInventory->Update(); - } - - auto SafeZoneIndicator = GameMode->GetSafeZoneIndicator(); - - if (SafeZoneIndicator) - { - SetZoneToIndexHook(GameMode, -1); - - UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr); - SafeZoneIndicator->SkipShrinkSafeZone(); - - /* - UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr); - SafeZoneIndicator->SkipShrinkSafeZone(); - - bool bBreak = false; - int a = 0; - - while (!bBreak) - { - for (int z = 0; z < ClientConnections.Num(); z++) - { - auto ClientConnection = ClientConnections.at(z); - auto FortPC = Cast(ClientConnection->GetPlayerController()); - - if (!FortPC) - continue; - - if (FortPC->GetMyFortPawn()) - { - bBreak = true; - break; - } - } - - if (++a >= 5) - bBreak = true; - - Sleep(1000); - } - - SafeZoneIndicator->SkipShrinkSafeZone(); - - if (Engine_Version >= 424) - { - Sleep(1000); - SafeZoneIndicator->SkipShrinkSafeZone(); - } - - */ - } - else - { - LOG_WARN(LogDev, "Invalid Indicator!"); - } + CreateThread(0, 0, LateGameThread, 0, 0, 0); + } + else + { + UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startaircraft", nullptr); } - - LOG_INFO(LogDev, "Finished!"); } } else @@ -1343,7 +1315,7 @@ static inline void PregameUI() if (!bSwitchedInitialLevel) { - ImGui::Checkbox("Use Custom Map", &bUseCustomMap); + // ImGui::Checkbox("Use Custom Map", &bUseCustomMap); if (bUseCustomMap) { diff --git a/Project Reboot 3.0/hooking.h b/Project Reboot 3.0/hooking.h index 01031de..1f05cd0 100644 --- a/Project Reboot 3.0/hooking.h +++ b/Project Reboot 3.0/hooking.h @@ -193,7 +193,7 @@ inline __int64 GetFunctionIdxOrPtr(UFunction* Function, bool bBreakWhenHitRet = } } - if ((*(uint8_t*)(NativeAddr + i) == 0x48 && *(uint8_t*)(NativeAddr + i + 1) == 0xFF) && *(uint8_t*)(NativeAddr + i + 2) == 0xA0) // jmp qword ptr + if (*(uint8_t*)(NativeAddr + i) == 0x48 && *(uint8_t*)(NativeAddr + i + 1) == 0xFF && *(uint8_t*)(NativeAddr + i + 2) == 0xA0) // jmp qword ptr { if (bFoundValidate) { @@ -295,7 +295,7 @@ namespace Hooking // *(int32_t*)(instrAddr + 1) = static_cast(delta); } - static bool Hook(UObject* DefaultClass, UFunction* Function, void* Detour, void** Original = nullptr, bool bUseSecondMethod = true, bool bHookExec = false, bool bOverride = true) // Native hook + static bool Hook(UObject* DefaultClass, UFunction* Function, void* Detour, void** Original = nullptr, bool bUseSecondMethod = true, bool bHookExec = false, bool bOverride = true, bool bBreakWhenRet = false) // Native hook { if (!bOverride) return false; @@ -324,7 +324,7 @@ namespace Hooking return true; } - auto AddrOrIdx = bUseSecondMethod ? GetFunctionIdxOrPtr2(Function) : GetFunctionIdxOrPtr(Function); + auto AddrOrIdx = bUseSecondMethod ? GetFunctionIdxOrPtr2(Function) : GetFunctionIdxOrPtr(Function, bBreakWhenRet); if (AddrOrIdx == -1) { diff --git a/Project Reboot 3.0/log.h b/Project Reboot 3.0/log.h index dcb26a0..68dbd54 100644 --- a/Project Reboot 3.0/log.h +++ b/Project Reboot 3.0/log.h @@ -87,6 +87,7 @@ inline void InitLogger() MakeLogger("LogMatchmaker"); MakeLogger("LogRebooting"); MakeLogger("LogObjectViewer"); + MakeLogger("LogLateGame"); } #define LOG_DEBUG(loggerName, ...) \