diff --git a/Project Reboot 3.0/FortAbilitySet.h b/Project Reboot 3.0/FortAbilitySet.h index 5a4a7b5..0c98210 100644 --- a/Project Reboot 3.0/FortAbilitySet.h +++ b/Project Reboot 3.0/FortAbilitySet.h @@ -9,7 +9,7 @@ struct FGameplayEffectApplicationInfoHard public: static UStruct* GetStruct() { - static auto GameplayEffectApplicationInfoHardStruct = FindObject("/Script/FortniteGame.GameplayEffectApplicationInfoHard"); + static auto GameplayEffectApplicationInfoHardStruct = FindObject(L"/Script/FortniteGame.GameplayEffectApplicationInfoHard"); return GameplayEffectApplicationInfoHardStruct; } @@ -55,7 +55,7 @@ public: auto GrantedGameplayEffects = GetGrantedGameplayEffects(); - for (int i = 0; i < GrantedGameplayEffects->Num(); i++) + for (int i = 0; i < GrantedGameplayEffects->Num(); ++i) { auto& EffectToGrant = GrantedGameplayEffects->at(i, FGameplayEffectApplicationInfoHard::GetStructSize()); @@ -76,7 +76,7 @@ public: { auto GameplayAbilities = GetGameplayAbilities(); - for (int i = 0; i < GameplayAbilities->Num(); i++) + for (int i = 0; i < GameplayAbilities->Num(); ++i) { UClass* AbilityClass = GameplayAbilities->At(i); @@ -93,7 +93,7 @@ public: static UClass* StaticClass() { - static auto Class = FindObject("/Script/FortniteGame.FortAbilitySet"); + static auto Class = FindObject(L"/Script/FortniteGame.FortAbilitySet"); return Class; } }; \ No newline at end of file diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index e9d83f3..467fbf7 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -1122,13 +1122,15 @@ void AFortPlayerController::ServerPlayEmoteItemHook(AFortPlayerController* Playe return; UObject* AbilityToUse = nullptr; + bool bShouldBeAbilityToUse = false; static auto AthenaSprayItemDefinitionClass = FindObject(L"/Script/FortniteGame.AthenaSprayItemDefinition"); static auto AthenaToyItemDefinitionClass = FindObject(L"/Script/FortniteGame.AthenaToyItemDefinition"); + static auto BGAClass = FindObject(L"/Script/Engine.BlueprintGeneratedClass"); if (EmoteAsset->IsA(AthenaSprayItemDefinitionClass)) { - static auto SprayGameplayAbilityDefault = FindObject(L"/Game/Abilities/Sprays/GAB_Spray_Generic.Default__GAB_Spray_Generic_C"); + auto SprayGameplayAbilityDefault = FindObject(L"/Game/Abilities/Sprays/GAB_Spray_Generic.Default__GAB_Spray_Generic_C"); AbilityToUse = SprayGameplayAbilityDefault; } @@ -1137,8 +1139,6 @@ void AFortPlayerController::ServerPlayEmoteItemHook(AFortPlayerController* Playe static auto ToySpawnAbilityOffset = EmoteAsset->GetOffset("ToySpawnAbility"); auto& ToySpawnAbilitySoft = EmoteAsset->Get>(ToySpawnAbilityOffset); - static auto BGAClass = FindObject(L"/Script/Engine.BlueprintGeneratedClass"); - auto ToySpawnAbility = ToySpawnAbilitySoft.Get(BGAClass, true); if (ToySpawnAbility) @@ -1204,6 +1204,11 @@ void AFortPlayerController::ServerPlayEmoteItemHook(AFortPlayerController* Playe } } +void AFortPlayerController::ServerPlaySprayItemHook(AFortPlayerController* PlayerController, UAthenaSprayItemDefinition* SprayAsset) +{ + PlayerController->ServerPlayEmoteItemHook(PlayerController, SprayAsset); +} + uint8 ToDeathCause(const FGameplayTagContainer& TagContainer, bool bWasDBNO = false, AFortPawn* Pawn = nullptr) { static auto ToDeathCauseFn = FindObject(L"/Script/FortniteGame.FortPlayerStateAthena.ToDeathCause"); @@ -1259,27 +1264,6 @@ uint8 ToDeathCause(const FGameplayTagContainer& TagContainer, bool bWasDBNO = fa return sub_7FF7AB499410(TagContainer, bWasDBNO); } -DWORD WINAPI SpectateThread(LPVOID PC) -{ - auto PlayerController = (UObject*)PC; - - if (!PlayerController->IsValidLowLevel()) - return 0; - - auto SpectatingPC = Cast(PlayerController); - - if (!SpectatingPC) - return 0; - - Sleep(3000); - - LOG_INFO(LogDev, "Spectate!"); - - SpectatingPC->SpectateOnDeath(); - - return 0; -} - DWORD WINAPI RestartThread(LPVOID) { // We should probably use unreal engine's timing system for this. @@ -1602,26 +1586,25 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo // LOG_INFO(LogDev, "KillerPlayerState->Place: {}", KillerPlayerState ? KillerPlayerState->GetPlace() : -1); } + } - if (Fortnite_Version < 6) // Spectating (is this the actual build or is it like 6.10 when they added it auto). + if (Fortnite_Version < 6) // Spectating (is this the actual build or is it like 6.10 when they added it auto). + { + if (GameState->GetGamePhase() > EAthenaGamePhase::Warmup) { - if (GameState->GetGamePhase() > EAthenaGamePhase::Warmup) + static auto bAllowSpectateAfterDeathOffset = GameMode->GetOffset("bAllowSpectateAfterDeath"); + bool bAllowSpectate = GameMode->Get(bAllowSpectateAfterDeathOffset); + + LOG_INFO(LogDev, "bAllowSpectate: {}", bAllowSpectate); + + if (bAllowSpectate) { - static auto bAllowSpectateAfterDeathOffset = GameMode->GetOffset("bAllowSpectateAfterDeath"); + LOG_INFO(LogDev, "Starting Spectating!"); - bool bAllowSpectate = GameMode->Get(bAllowSpectateAfterDeathOffset); + static auto PlayerToSpectateOnDeathOffset = PlayerController->GetOffset("PlayerToSpectateOnDeath"); + PlayerController->Get(PlayerToSpectateOnDeathOffset) = KillerPawn; - LOG_INFO(LogDev, "bAllowSpectate: {}", bAllowSpectate); - - if (bAllowSpectate) - { - LOG_INFO(LogDev, "Starting Spectating!"); - - static auto PlayerToSpectateOnDeathOffset = PlayerController->GetOffset("PlayerToSpectateOnDeath"); - PlayerController->Get(PlayerToSpectateOnDeathOffset) = KillerPawn; - - CreateThread(0, 0, SpectateThread, (LPVOID)PlayerController, 0, 0); - } + UKismetSystemLibrary::K2_SetTimer(PlayerController, L"SpectateOnDeath", 5.f, false); // Soo proper its scary } } } diff --git a/Project Reboot 3.0/FortPlayerController.h b/Project Reboot 3.0/FortPlayerController.h index bc55a0e..aeaf3ac 100644 --- a/Project Reboot 3.0/FortPlayerController.h +++ b/Project Reboot 3.0/FortPlayerController.h @@ -89,6 +89,8 @@ enum class EInteractionBeingAttempted : uint8 EInteractionBeingAttempted_MAX = 3, }; +using UAthenaSprayItemDefinition = UObject; + class AFortPlayerController : public APlayerController { public: @@ -210,6 +212,7 @@ public: static void ServerDropAllItemsHook(AFortPlayerController* PlayerController, UFortItemDefinition* IgnoreItemDef); static void ServerAttemptInventoryDropHook(AFortPlayerController* PlayerController, FGuid ItemGuid, int Count); + static void ServerPlaySprayItemHook(AFortPlayerController* PlayerController, UAthenaSprayItemDefinition* SprayAsset); static void ServerPlayEmoteItemHook(AFortPlayerController* PlayerController, UObject* EmoteAsset); static void ClientOnPawnDiedHook(AFortPlayerController* PlayerController, void* DeathReport); diff --git a/Project Reboot 3.0/KismetSystemLibrary.h b/Project Reboot 3.0/KismetSystemLibrary.h index 7c31348..cb955de 100644 --- a/Project Reboot 3.0/KismetSystemLibrary.h +++ b/Project Reboot 3.0/KismetSystemLibrary.h @@ -106,6 +106,24 @@ public: KismetSystemLibrary->ProcessEvent(fn, &UKismetSystemLibrary_ExecuteConsoleCommand_Params); } + static FTimerHandle K2_SetTimer(UObject* Object, FString FunctionName, float Time, bool bLooping) + { + struct { + UObject* Object; + FString FunctionName; + float Time; + bool bLooping; + FTimerHandle ret; + } K2_SetTimer_Params{Object, FunctionName, Time, bLooping}; + + static auto KismetSystemLibrary = FindObject("/Script/Engine.Default__KismetSystemLibrary"); + static auto K2_SetTimerFn = FindObject("/Script/Engine.KismetSystemLibrary.K2_SetTimer"); + + KismetSystemLibrary->ProcessEvent(K2_SetTimerFn, &K2_SetTimer_Params); + + return K2_SetTimer_Params.ret; + } + static bool LineTraceSingle(UObject* WorldContextObject, FVector Start, FVector End, ETraceTypeQuery TraceChannel, bool bTraceComplex, TArray ActorsToIgnore, EDrawDebugTrace DrawDebugType, bool bIgnoreSelf, FLinearColor TraceColor, FLinearColor TraceHitColor, float DrawTime, FHitResult** OutHit) diff --git a/Project Reboot 3.0/World.cpp b/Project Reboot 3.0/World.cpp index 2ff8d60..ed4defb 100644 --- a/Project Reboot 3.0/World.cpp +++ b/Project Reboot 3.0/World.cpp @@ -79,8 +79,6 @@ void UWorld::Listen() FString Error; - LOG_INFO(LogNet, "Calling InitListen!"); - AWorldSettings* WorldSettings = GetWorldSettings(); const bool bReuseAddressAndPort = false; // WorldSettings ? WorldSettings->bReuseAddressAndPort : false; @@ -90,8 +88,6 @@ void UWorld::Listen() return; } - LOG_INFO(LogNet, "Called InitListen!"); - const bool bLanSpeed = false; if (!bLanSpeed && (NewNetDriver->GetMaxInternetClientRate() < NewNetDriver->GetMaxClientRate()) && (NewNetDriver->GetMaxInternetClientRate() > 2500)) diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index ebd1c34..b57546a 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -1265,6 +1265,8 @@ DWORD WINAPI Main(LPVOID) AFortPlayerController::ServerExecuteInventoryItemHook, nullptr, false); Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerPlayEmoteItem"), AFortPlayerController::ServerPlayEmoteItemHook, nullptr, false); + Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerPlaySprayItem"), + AFortPlayerController::ServerPlaySprayItemHook, nullptr, false); // S4 explain yourself Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerRepairBuildingActor"), AFortPlayerController::ServerRepairBuildingActorHook, nullptr, false); Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerCreateBuildingActor"), diff --git a/Project Reboot 3.0/finder.cpp b/Project Reboot 3.0/finder.cpp index e42e1cb..3fd27a1 100644 --- a/Project Reboot 3.0/finder.cpp +++ b/Project Reboot 3.0/finder.cpp @@ -95,8 +95,11 @@ uint64 FindGIsClient() if (bIsScuffedByte) { - if (Bytes[2] == 0x74) // DIE 4.5 (todo check length of entire instruction) + if (*(Memcury::ASM::MNEMONIC*)(Addr.Get() - i + 2) == 0x74) // DIE 4.5 (todo check length of entire instruction) + { + LOG_INFO(LogDev, "Found broken byte, skipping!"); continue; + } } if (!PickedByte)