tassetptr impl, harvesting stuff, relevancy?

This commit is contained in:
Milxnor
2023-03-26 21:37:47 -04:00
parent f42c420486
commit 9c8b327cd7
23 changed files with 267 additions and 37 deletions

View File

@@ -127,6 +127,20 @@ bool AActor::IsAlwaysRelevant()
return ReadBitfieldValue(bAlwaysRelevantOffset, bAlwaysRelevantFieldMask);
}
bool AActor::UsesOwnerRelevancy()
{
static auto bNetUseOwnerRelevancyOffset = GetOffset("bNetUseOwnerRelevancy");
static auto bNetUseOwnerRelevancyFieldMask = GetFieldMask(GetProperty("bNetUseOwnerRelevancy"));
return ReadBitfieldValue(bNetUseOwnerRelevancyOffset, bNetUseOwnerRelevancyFieldMask);
}
bool AActor::IsOnlyRelevantToOwner()
{
static auto bOnlyRelevantToOwnerOffset = GetOffset("bOnlyRelevantToOwner");
static auto bOnlyRelevantToOwnerFieldMask = GetFieldMask(GetProperty("bOnlyRelevantToOwner"));
return ReadBitfieldValue(bOnlyRelevantToOwnerOffset, bOnlyRelevantToOwnerFieldMask);
}
UClass* AActor::StaticClass()
{
static auto Class = FindObject<UClass>(L"/Script/Engine.Actor");

View File

@@ -19,6 +19,8 @@ public:
bool IsActorBeingDestroyed();
bool IsNetStartup();
bool IsAlwaysRelevant();
bool UsesOwnerRelevancy();
bool IsOnlyRelevantToOwner();
void SetOwner(AActor* Owner);
static class UClass* StaticClass();

View File

@@ -0,0 +1,26 @@
#pragma once
#include "PersistentObjectPtr.h"
#include "StringAssetReference.h"
#include "reboot.h"
class FAssetPtr : public TPersistentObjectPtr<FStringAssetReference>
{
public:
};
template<class T = UObject>
class TAssetPtr
{
public:
FAssetPtr AssetPtr;
T* Get()
{
if (!AssetPtr.ObjectID.AssetLongPathname.IsValid())
return nullptr;
return FindObject<T>(AssetPtr.ObjectID.AssetLongPathname.ToString());
}
};

View File

@@ -39,7 +39,7 @@ void ABuildingActor::OnDamageServerHook(ABuildingActor* BuildingActor, float Dam
if (BuildingResourceAmountOverride.RowName.IsValid())
{
// auto AssetManager = Cast<UFortAssetManager>(GEngine->AssetManager);
// auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGGetGameStateAthena);
// auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameStateAthena);
UCurveTable* CurveTable = nullptr; // GameState->CurrentPlaylistInfo.BasePlaylist ? GameState->CurrentPlaylistInfo.BasePlaylist->ResourceRates.Get() : nullptr;
// LOG_INFO(LogDev, "Before1");

View File

@@ -14,6 +14,12 @@ public:
return *(TMap<FName, RowDataType*>*)(__int64(this) + (RowStructOffset + sizeof(UObject*))); // because after rowstruct is rowmap
}
static UClass* StaticClass()
{
static auto Class = FindObject<UClass>("/Script/Engine.DataTable");
return Class;
}
};
struct FDataTableRowHandle

View File

@@ -643,6 +643,8 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
for (auto& LootDrop : LootDrops)
AFortPickup::SpawnPickup(LootDrop.ItemDefinition, Location, LootDrop.Count, SpawnFlag, EFortPickupSpawnSource::Unset, LootDrop.LoadedAmmo);
}
CurrentActor->K2_DestroyActor();
}
bool bPrint = false;
@@ -670,6 +672,8 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
for (auto& LootDrop : LootDrops)
AFortPickup::SpawnPickup(LootDrop.ItemDefinition, Location, LootDrop.Count, SpawnFlag, EFortPickupSpawnSource::Unset, LootDrop.LoadedAmmo);
}
CurrentActor->K2_DestroyActor();
}
}
@@ -717,9 +721,11 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
static auto PartsOffset = FindOffsetStruct("/Script/FortniteGame.CustomCharacterParts", "Parts", false);
auto Parts = (UObject**)(__int64(CharacterParts) + PartsOffset); // UCustomCharacterPart* Parts[0x6]
static auto headPart = LoadObject("/Game/Characters/CharacterParts/Female/Medium/Heads/F_Med_Head1.F_Med_Head1");
static auto bodyPart = LoadObject("/Game/Characters/CharacterParts/Female/Medium/Bodies/F_Med_Soldier_01.F_Med_Soldier_01");
static auto backpackPart = LoadObject("/Game/Characters/CharacterParts/Backpacks/NoBackpack.NoBackpack");
static auto CustomCharacterPartClass = FindObject<UClass>("/Script/FortniteGame.CustomCharacterPart");
static auto headPart = LoadObject("/Game/Characters/CharacterParts/Female/Medium/Heads/F_Med_Head1.F_Med_Head1", CustomCharacterPartClass);
static auto bodyPart = LoadObject("/Game/Characters/CharacterParts/Female/Medium/Bodies/F_Med_Soldier_01.F_Med_Soldier_01", CustomCharacterPartClass);
static auto backpackPart = LoadObject("/Game/Characters/CharacterParts/Backpacks/NoBackpack.NoBackpack", CustomCharacterPartClass);
Parts[(int)EFortCustomPartType::Head] = headPart;
Parts[(int)EFortCustomPartType::Body] = bodyPart;
@@ -762,9 +768,11 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
if (Globals::bAbilitiesEnabled)
{
static auto FortAbilitySetClass = FindObject<UClass>("/Script/FortniteGame.FortAbilitySet");
static auto GameplayAbilitySet = Fortnite_Version >= 8.30 ? // LoadObject<UObject>(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer") ?
LoadObject<UObject>(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer") :
LoadObject<UObject>(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_DefaultPlayer.GAS_DefaultPlayer");
LoadObject(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer", FortAbilitySetClass) :
LoadObject(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_DefaultPlayer.GAS_DefaultPlayer", FortAbilitySetClass);
LOG_INFO(LogDev, "GameplayAbilitySet {}", __int64(GameplayAbilitySet));
@@ -984,6 +992,12 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
}
}
if (Engine_Version <= 420) // not sure if needed on s3-s4
{
static auto OverriddenBackpackSizeOffset = NewPlayer->GetOffset("OverriddenBackpackSize");
NewPlayer->Get<int>(OverriddenBackpackSizeOffset) = 5;
}
return Athena_HandleStartingNewPlayerOriginal(GameMode, NewPlayerActor);
}

View File

@@ -6,6 +6,26 @@
UFortResourceItemDefinition* UFortKismetLibrary::K2_GetResourceItemDefinition(EFortResourceType ResourceType)
{
if (ResourceType == EFortResourceType::Wood)
{
static auto WoodItemData = FindObject<UFortResourceItemDefinition>("/Game/Items/ResourcePickups/WoodItemData.WoodItemData");
return WoodItemData;
}
else if (ResourceType == EFortResourceType::Stone)
{
static auto StoneItemData = FindObject<UFortResourceItemDefinition>("/Game/Items/ResourcePickups/StoneItemData.StoneItemData");
return StoneItemData;
}
else if (ResourceType == EFortResourceType::Metal)
{
static auto MetalItemData = FindObject<UFortResourceItemDefinition>("/Game/Items/ResourcePickups/MetalItemData.MetalItemData");
return MetalItemData;
}
return nullptr;
// The function below doesn't exist on some very old builds.
static auto fn = FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_GetResourceItemDefinition");
struct { EFortResourceType type; UFortResourceItemDefinition* ret; } params{ResourceType};

View File

@@ -156,10 +156,10 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
if (recursive > 10)
return LootDrops;
static std::vector<UDataTable*> LTDTables;
static std::vector<UDataTable*> LPTables;
/* static */ std::vector<UDataTable*> LTDTables;
/* static */ std::vector<UDataTable*> LPTables;
static bool bHasFoundTables = false;
/* static */ bool bHasFoundTables = false;
if (!bHasFoundTables)
{
@@ -168,7 +168,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
LTDTables.push_back(LoadObject<UDataTable>(L"/Game/Items/Datatables/AthenaLootTierData_Client.AthenaLootTierData_Client"));
LPTables.push_back(LoadObject<UDataTable>(L"/Game/Items/Datatables/AthenaLootPackages_Client.AthenaLootPackages_Client"));
for (int i = 0; i < LTDTables.size(); i++)
/* for (int i = 0; i < LTDTables.size(); i++)
{
LOG_INFO(LogDev, "[{}] LTD {}", i, LTDTables.at(i)->GetFullName());
}
@@ -176,7 +176,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
for (int i = 0; i < LPTables.size(); i++)
{
LOG_INFO(LogDev, "[{}] LP {}", i, LPTables.at(i)->GetFullName());
}
} */
}
std::vector<FFortLootTierData*> TierGroupLTDs;
@@ -193,14 +193,15 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
// auto TierGroupNameStr = TierGroupName.ToString();
// LOG_INFO(LogLoot, "LTDRowMapNum: {}", LTDRowMapNum);
// if (bPrint)
// LOG_INFO(LogLoot, "LTDRowMapNum: {} LTD: {}", LTDRowMapNum, IsBadReadPtr(LTD, 8) ? "BadRead" : LTD->GetFullName());
for (int i = 0; i < LTDRowMapNum; i++)
{
auto& CurrentLTD = LTDRowMap.Pairs.Elements[i].ElementData.Value;
auto TierData = (FFortLootTierData*)CurrentLTD.Value();
if (IsBadReadPtr(TierData, 8))
if (IsBadReadPtr(TierData, 8)) // this shouldn't be needed
continue;
if (TierGroupName == TierData->GetTierGroup() && TierData->GetWeight() != 0)

View File

@@ -61,6 +61,8 @@ AFortPickup* AFortPickup::SpawnPickup(UFortItemDefinition* ItemDef, FVector Loca
char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup)
{
// LOG_INFO(LogDev, "Woah!");
auto Pawn = Cast<AFortPlayerPawn>(Pickup->GetPickupLocationData()->GetPickupTarget());
if (!Pawn)

View File

@@ -768,7 +768,7 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr
if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced())
return;
auto Pawn = Cast<AFortPawn>(PlayerController->GetPawn(), false);
auto Pawn = PlayerController->GetMyFortPawn();
if (!Pawn)
return;

View File

@@ -75,4 +75,10 @@ public:
static void ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn);
static void ServerPlaySquadQuickChatMessage(AFortPlayerControllerAthena* PlayerController, __int64 ChatEntry, __int64 SenderID);
static void GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation);
static UClass* StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPlayerControllerAthena");
return Class;
}
};

View File

@@ -3,6 +3,7 @@
#include "reboot.h"
#include "Actor.h"
#include "NetConnection.h"
#include "FortPlayerControllerAthena.h"
#include "GameplayStatics.h"
void UNetDriver::TickFlushHook(UNetDriver* NetDriver)
@@ -178,6 +179,62 @@ static UActorChannel* FindChannel(AActor* Actor, UNetConnection* Connection)
return NULL;
}
struct FNetViewer
{
UNetConnection* Connection; // 0x0000(0x0008) (ZeroConstructor, IsPlainOldData)
AActor* InViewer; // 0x0008(0x0008) (ZeroConstructor, IsPlainOldData)
AActor* ViewTarget; // 0x0010(0x0008) (ZeroConstructor, IsPlainOldData)
FVector ViewLocation; // 0x0018(0x000C) (IsPlainOldData)
FVector ViewDir;
};
static bool IsActorRelevantToConnection(AActor* Actor, std::vector<FNetViewer>& ConnectionViewers)
{
for (int32 viewerIdx = 0; viewerIdx < ConnectionViewers.size(); viewerIdx++)
{
if (!ConnectionViewers[viewerIdx].ViewTarget)
continue;
// static bool (*IsNetRelevantFor)(AActor*, AActor*, AActor*, FVector&) = decltype(IsNetRelevantFor)(__int64(GetModuleHandleW(0)) + 0x1ECC700);
static auto index = Offsets::IsNetRelevantFor;
// if (Actor->IsNetRelevantFor(ConnectionViewers[viewerIdx].InViewer, ConnectionViewers[viewerIdx].ViewTarget, ConnectionViewers[viewerIdx].ViewLocation))
// if (IsNetRelevantFor(Actor, ConnectionViewers[viewerIdx].InViewer, ConnectionViewers[viewerIdx].ViewTarget, ConnectionViewers[viewerIdx].ViewLocation))
if (reinterpret_cast<bool(*)(AActor*, AActor*, AActor*, FVector&)>(Actor->VFTable[index])(
Actor, ConnectionViewers[viewerIdx].InViewer, ConnectionViewers[viewerIdx].ViewTarget, ConnectionViewers[viewerIdx].ViewLocation))
{
return true;
}
}
return false;
}
static FNetViewer ConstructNetViewer(UNetConnection* NetConnection)
{
FNetViewer newViewer{};
newViewer.Connection = NetConnection;
newViewer.InViewer = NetConnection->GetPlayerController() ? NetConnection->GetPlayerController() : NetConnection->GetOwningActor();
newViewer.ViewTarget = NetConnection->GetViewTarget();
if (!NetConnection->GetOwningActor() || !(!NetConnection->GetPlayerController() || (NetConnection->GetPlayerController() == NetConnection->GetOwningActor())))
return newViewer;
APlayerController* ViewingController = NetConnection->GetPlayerController();
newViewer.ViewLocation = newViewer.ViewTarget->GetActorLocation();
if (ViewingController)
{
FRotator ViewRotation = ViewingController->GetControlRotation();
AFortPlayerControllerAthena::GetPlayerViewPointHook(Cast<AFortPlayerControllerAthena>(ViewingController, false), newViewer.ViewLocation, ViewRotation);
newViewer.ViewDir = ViewRotation.Vector();
}
return newViewer;
}
int32 UNetDriver::ServerReplicateActors()
{
int32 Updated = 0;
@@ -202,7 +259,7 @@ int32 UNetDriver::ServerReplicateActors()
}
else */
{
ServerTickTime = 1.f / ServerTickTime;
ServerTickTime = 1.f / ServerTickTime; // 0
// bCPUSaturated = DeltaSeconds > 1.2f * ServerTickTime;
}
@@ -241,25 +298,27 @@ int32 UNetDriver::ServerReplicateActors()
auto Channel = FindChannel(Actor, Connection);
/* std::vector<FNetViewer> ConnectionViewers;
static void (*ActorChannelClose)(UActorChannel*) = decltype(ActorChannelClose)(Addresses::ActorChannelClose);
std::vector<FNetViewer> ConnectionViewers;
ConnectionViewers.push_back(ConstructNetViewer(Connection));
if (!Actor->bAlwaysRelevant && !Actor->bNetUseOwnerRelevancy && !Actor->bOnlyRelevantToOwner)
if (!Actor->IsAlwaysRelevant() && !Actor->UsesOwnerRelevancy() && !Actor->IsOnlyRelevantToOwner())
{
if (Connection && Connection->ViewTarget)
if (Connection && Connection->GetViewTarget())
{
auto Viewer = Connection->ViewTarget;
auto Loc = Viewer->K2_GetActorLocation();
auto Viewer = Connection->GetViewTarget();
auto Loc = Viewer->GetActorLocation();
if (!IsActorRelevantToConnection(Actor, ConnectionViewers))
{
if (Channel)
CloseChannel(Channel);
ActorChannelClose(Channel);
continue;
}
}
} */
}
static UChannel* (*CreateChannel)(UNetConnection*, int, bool, int32_t) = decltype(CreateChannel)(Addresses::CreateChannel);
static __int64 (*ReplicateActor)(UActorChannel*) = decltype(ReplicateActor)(Addresses::ReplicateActor);

View File

@@ -226,6 +226,7 @@
<ClInclude Include="addresses.h" />
<ClInclude Include="ai.h" />
<ClInclude Include="Array.h" />
<ClInclude Include="AssetPtr.h" />
<ClInclude Include="AthenaMarkerComponent.h" />
<ClInclude Include="BitArray.h" />
<ClInclude Include="BuildingActor.h" />
@@ -313,6 +314,7 @@
<ClInclude Include="SoftObjectPtr.h" />
<ClInclude Include="SparseArray.h" />
<ClInclude Include="Stack.h" />
<ClInclude Include="StringAssetReference.h" />
<ClInclude Include="Transform.h" />
<ClInclude Include="Tuple.h" />
<ClInclude Include="UnrealString.h" />

View File

@@ -461,6 +461,12 @@
<ClInclude Include="OnlineReplStructs.h">
<Filter>Engine\Source\Runtime\Engine\Classes\GameFramework</Filter>
</ClInclude>
<ClInclude Include="AssetPtr.h">
<Filter>Engine\Source\Runtime\CoreUObject\Public\UObject</Filter>
</ClInclude>
<ClInclude Include="StringAssetReference.h">
<Filter>Engine\Source\Runtime\CoreUObject\Public\Misc</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Engine">
@@ -643,6 +649,9 @@
<Filter Include="FortniteGame\Source\FortniteGame\Private\Creative\Minigame">
<UniqueIdentifier>{7905895d-5ebf-4313-a9de-06f507c35113}</UniqueIdentifier>
</Filter>
<Filter Include="Engine\Source\Runtime\CoreUObject\Public\Misc">
<UniqueIdentifier>{915f7622-6003-445e-a43f-04d5c7e13b49}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="UnrealEngine.cpp">

View File

@@ -1,6 +1,7 @@
#pragma once
#include "Quat.h"
#include "Vector.h"
struct FRotator
{
@@ -9,4 +10,6 @@ struct FRotator
float Roll;
FQuat Quaternion();
FVector Vector() const;
};

View File

@@ -4,6 +4,7 @@
#include "PersistentObjectPtr.h"
#include "SoftObjectPath.h"
#include "AssetPtr.h"
#include "reboot.h"
@@ -20,9 +21,17 @@ public:
T* Get()
{
if (SoftObjectPtr.ObjectID.AssetPathName.ComparisonIndex.Value <= 0)
return nullptr;
if (Engine_Version <= 416)
{
auto& AssetPtr = *(TAssetPtr<T>*)this;
return AssetPtr.Get();
}
else
{
if (SoftObjectPtr.ObjectID.AssetPathName.ComparisonIndex.Value <= 0)
return nullptr;
return FindObject<T>(SoftObjectPtr.ObjectID.AssetPathName.ToString());
return FindObject<T>(SoftObjectPtr.ObjectID.AssetPathName.ToString());
}
}
};

View File

@@ -0,0 +1,8 @@
#pragma once
#include "UnrealString.h"
struct FStringAssetReference
{
FString AssetLongPathname;
};

View File

@@ -102,3 +102,13 @@ struct FQuat FRotator::Quaternion()
return RotationQuat;
}
FVector FRotator::Vector() const
{
float CP, SP, CY, SY;
SinCos(&SP, &CP, Pitch * (PI / 180.0f));
SinCos(&SY, &CY, Yaw * (PI / 180.0f));
FVector V = FVector(CP * CY, CP * SY, SP);
return V;
}

View File

@@ -246,6 +246,9 @@ void Addresses::FindAll()
LOG_INFO(LogDev, "Finding RemoveFromAlivePlayers");
Addresses::RemoveFromAlivePlayers = FindRemoveFromAlivePlayers();
LOG_INFO(LogDev, "Finding ActorChannelClose");
Addresses::ActorChannelClose = FindActorChannelClose();
LOG_INFO(LogDev, "Finished finding!");
}
@@ -297,6 +300,7 @@ void Addresses::Print()
LOG_INFO(LogDev, "OnRep_ZiplineState: 0x{:x}", OnRep_ZiplineState - Base);
LOG_INFO(LogDev, "GetMaxTickRate: 0x{:x}", GetMaxTickRate - Base);
LOG_INFO(LogDev, "RemoveFromAlivePlayers: 0x{:x}", RemoveFromAlivePlayers - Base);
LOG_INFO(LogDev, "ActorChannelClose: 0x{:x}", ActorChannelClose - Base);
}
void Offsets::FindAll()
@@ -343,6 +347,8 @@ void Offsets::FindAll()
Offsets::ReplicationFrame = 0xB2;
else if (Fortnite_Version == 2.5)
Offsets::ReplicationFrame = 0xCA;
Offsets::IsNetRelevantFor = FindIsNetRelevantForOffset();
}
void Offsets::Print()
@@ -354,6 +360,7 @@ void Offsets::Print()
LOG_INFO(LogDev, "Func: 0x{:x}", Func);
LOG_INFO(LogDev, "ServerReplicateActors: 0x{:x}", ServerReplicateActors);
LOG_INFO(LogDev, "ReplicationFrame: 0x{:x}", ReplicationFrame);
LOG_INFO(LogDev, "IsNetRelevantFor: 0x{:x}", IsNetRelevantFor);
}
void Addresses::Init()

View File

@@ -52,6 +52,7 @@ namespace Addresses
extern inline uint64 FrameStep = 0;
extern inline uint64 OnRep_ZiplineState = 0;
extern inline uint64 RemoveFromAlivePlayers = 0;
extern inline uint64 ActorChannelClose = 0;
void SetupVersion(); // Finds Engine Version
void FindAll();
@@ -70,6 +71,7 @@ namespace Offsets
extern inline uint64 Offset_Internal = 0;
extern inline uint64 ServerReplicateActors = 0;
extern inline uint64 ReplicationFrame = 0;
extern inline uint64 IsNetRelevantFor = 0;
void FindAll();
void Print();

View File

@@ -362,18 +362,23 @@ DWORD WINAPI Main(LPVOID)
if (false)
{
Hooking::MinHook::Hook(AthenaMarkerComponentDefault, FindObject<UFunction>(L"/Script/FortniteGame.AthenaMarkerComponent.ServerAddMapMarker"),
UAthenaMarkerComponent::ServerAddMapMarkerHook, nullptr, false);
Hooking::MinHook::Hook(AthenaMarkerComponentDefault, FindObject<UFunction>(L"/Script/FortniteGame.AthenaMarkerComponent.ServerRemoveMapMarker"),
UAthenaMarkerComponent::ServerRemoveMapMarkerHook, nullptr, false);
if (Fortnite_Version >= 8.3) // I can't remember, so ServerAddMapMarker existed on like 8.0 or 8.1 or 8.2 but it didn't have the same params.
{
Hooking::MinHook::Hook(AthenaMarkerComponentDefault, FindObject<UFunction>(L"/Script/FortniteGame.AthenaMarkerComponent.ServerAddMapMarker"),
UAthenaMarkerComponent::ServerAddMapMarkerHook, nullptr, false);
Hooking::MinHook::Hook(AthenaMarkerComponentDefault, FindObject<UFunction>(L"/Script/FortniteGame.AthenaMarkerComponent.ServerRemoveMapMarker"),
UAthenaMarkerComponent::ServerRemoveMapMarkerHook, nullptr, false);
}
}
Hooking::MinHook::Hook((PVOID)Addresses::GetPlayerViewpoint, (PVOID)AFortPlayerControllerAthena::GetPlayerViewPointHook, (PVOID*)&AFortPlayerControllerAthena::GetPlayerViewPointOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::TickFlush, (PVOID)UNetDriver::TickFlushHook, (PVOID*)&UNetDriver::TickFlushOriginal);
// Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x1A001D0), GetServerDeltaTimeFromObjectHook);
if (Engine_Version < 427)
// if (/* Engine_Version >= 420 && */ Engine_Version < 427)
{
Hooking::MinHook::Hook((PVOID)Addresses::OnDamageServer, (PVOID)ABuildingActor::OnDamageServerHook, (PVOID*)&ABuildingActor::OnDamageServerOriginal);
}
Hooking::MinHook::Hook((PVOID)Addresses::GetMaxTickRate, GetMaxTickRateHook);
// Hooking::MinHook::Hook((PVOID)Addresses::CollectGarbage, (PVOID)CollectGarbageHook, nullptr);
@@ -390,8 +395,11 @@ DWORD WINAPI Main(LPVOID)
AddVehicleHook();
LOG_INFO(LogDev, "Test: 0x{:x}", FindFunctionCall(L"ClientOnPawnDied") - __int64(GetModuleHandleW(0)));
Hooking::MinHook::Hook((PVOID)FindFunctionCall(L"ClientOnPawnDied"), AFortPlayerController::ClientOnPawnDiedHook, (PVOID*)&AFortPlayerController::ClientOnPawnDiedOriginal);
if (Fortnite_Version > 1.8)
{
LOG_INFO(LogDev, "Test: 0x{:x}", FindFunctionCall(L"ClientOnPawnDied") - __int64(GetModuleHandleW(0)));
Hooking::MinHook::Hook((PVOID)FindFunctionCall(L"ClientOnPawnDied"), AFortPlayerController::ClientOnPawnDiedHook, (PVOID*)&AFortPlayerController::ClientOnPawnDiedOriginal);
}
LOG_INFO(LogDev, "PredictionKeySize: 0x{:x} {}", PredictionKeySize, PredictionKeySize);

View File

@@ -308,9 +308,23 @@ static inline uint64 FindGetPlayerViewpoint()
return 0;
}
static inline uint64 FindIsNetRelevantForOffset()
{
if (Engine_Version == 416)
return 648 / 8;
return 0;
}
static inline uint64 FindActorChannelClose()
{
auto StringRef = Memcury::Scanner::FindStringRef(L"UActorChannel::Close: ChIndex: %d, Actor: %s");
return FindBytes(StringRef, { 0x48, 0x89, 0x5C }, 1000, 0, true);
}
static inline uint64 FindSpawnActor()
{
if (Engine_Version >= 427)
{
auto stat = Memcury::Scanner::FindStringRef(L"STAT_SpawnActorTime");
@@ -366,7 +380,11 @@ static inline uint64 FindInitListen()
static inline uint64 FindOnDamageServer()
{
auto Addr = FindFunctionCall(L"OnDamageServer", { 0x40, 0x55 });
auto Addr = FindFunctionCall(L"OnDamageServer",
Engine_Version == 416 ? std::vector<uint8_t>{ 0x4C, 0x89, 0x4C} :
Engine_Version == 419 || Engine_Version >= 427 ? std::vector<uint8_t>{ 0x48, 0x8B, 0xC4 } : std::vector<uint8_t>{ 0x40, 0x55 }
);
return Addr;
}
@@ -437,6 +455,9 @@ static inline uint64 FindSpecConstructor()
static inline uint64 FindCompletePickupAnimation()
{
if (Engine_Version == 416 || Engine_Version == 419)
return Memcury::Scanner::FindPattern("4C 8B DC 53 55 56 48 83 EC 60 48 8B F1 48 8B 89 ? ? ? ? 48 85 C9").Get();
if (Engine_Version == 420)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 48 8B D9 48 8B 89 ? ? ? ? 48 85 C9 74 20 48 8D 44 24").Get();

View File

@@ -24,7 +24,7 @@ static inline T* FindObject(const TCHAR* Name, UClass* Class = nullptr, UObject*
}
template <typename T = UObject>
static inline T* LoadObject(const TCHAR* Name, UClass* Class = nullptr, UObject* Outer = nullptr)
static inline T* LoadObject(const TCHAR* Name, UClass* Class = T::StaticClass(), UObject* Outer = nullptr)
{
if (!StaticLoadObjectOriginal)
{
@@ -46,7 +46,8 @@ static inline T* LoadObject(const std::string& NameStr, UClass* Class = nullptr,
template <typename T = UObject>
static inline T* FindObject(const std::string& NameStr, UClass* Class = nullptr, UObject* Outer = nullptr)
{
auto NameCWSTR = std::wstring(NameStr.begin(), NameStr.end()).c_str();
std::string name = NameStr;
auto NameCWSTR = std::wstring(name.begin(), name.end()).c_str();
return StaticFindObject<T>(Class, Outer, NameCWSTR);
}