This commit is contained in:
Gray
2025-07-18 21:19:00 -04:00
parent 62ffdccd42
commit 658012ead8
13 changed files with 56 additions and 24 deletions

View File

@@ -308,6 +308,12 @@ AActor* AActor::GetClosestActor(UClass* ActorClass, float DistMax, std::function
return TargetActor; return TargetActor;
} }
FName& AActor::GetNetDriverName()
{
static auto NetDriverNameOffset = GetOffset("NetDriverName");
return Get<FName>(NetDriverNameOffset);
}
bool AActor::IsAlwaysRelevant() bool AActor::IsAlwaysRelevant()
{ {
static auto bAlwaysRelevantOffset = GetOffset("bAlwaysRelevant"); static auto bAlwaysRelevantOffset = GetOffset("bAlwaysRelevant");

View File

@@ -55,6 +55,7 @@ public:
const AActor* GetNetOwner() const; const AActor* GetNetOwner() const;
void GetActorEyesViewPoint(FVector* OutLocation, FRotator* OutRotation) const; void GetActorEyesViewPoint(FVector* OutLocation, FRotator* OutRotation) const;
AActor* GetClosestActor(UClass* ActorClass, float DistMax, std::function<bool(AActor*)> AdditionalCheck = [](AActor*) { return true; }); AActor* GetClosestActor(UClass* ActorClass, float DistMax, std::function<bool(AActor*)> AdditionalCheck = [](AActor*) { return true; });
FName& GetNetDriverName();
bool IsRelevancyOwnerFor(const AActor* ReplicatedActor, const AActor* ActorOwner, const AActor* ConnectionActor) const bool IsRelevancyOwnerFor(const AActor* ReplicatedActor, const AActor* ActorOwner, const AActor* ConnectionActor) const
{ {

View File

@@ -181,7 +181,9 @@ void AFortGameModeAthena::HandleSpawnRateForActorClass(UClass* ActorClass, float
void AFortGameModeAthena::StartAircraftPhase() void AFortGameModeAthena::StartAircraftPhase()
{ {
if (Addresses::StartAircraftPhase) if (Addresses::StartAircraftPhase
&& Fortnite_Version < 24 // ig they load or sometrhing gg
)
{ {
static void (*StartAircraftPhaseOriginal)(AFortGameModeAthena*, bool bDoNotSpawnAircraft) = decltype(StartAircraftPhaseOriginal)(Addresses::StartAircraftPhase); static void (*StartAircraftPhaseOriginal)(AFortGameModeAthena*, bool bDoNotSpawnAircraft) = decltype(StartAircraftPhaseOriginal)(Addresses::StartAircraftPhase);
StartAircraftPhaseOriginal(this, false); // love the double negative Fortnite StartAircraftPhaseOriginal(this, false); // love the double negative Fortnite

View File

@@ -39,6 +39,8 @@ void AFortPickup::SpawnMovementComponent()
AFortPickup* AFortPickup::SpawnPickup(PickupCreateData& PickupData) AFortPickup* AFortPickup::SpawnPickup(PickupCreateData& PickupData)
{ {
if (Fortnite_Version >= 24) return nullptr; // location is scrweed
if (PickupData.Source == -1) if (PickupData.Source == -1)
PickupData.Source = 0; PickupData.Source = 0;
if (PickupData.SourceType == -1) if (PickupData.SourceType == -1)

View File

@@ -31,9 +31,11 @@ public:
return ReadBitfieldValue(bCanBeDroppedOffset, bCanBeDroppedFieldMask); return ReadBitfieldValue(bCanBeDroppedOffset, bCanBeDroppedFieldMask);
} }
int& GetDropCount() int/*&*/ GetDropCount()
{ {
static auto DropCountOffset = GetOffset("DropCount"); static auto DropCountOffset = GetOffset("DropCount", false);
if (DropCountOffset == -1)
return 1;
return Get<int>(DropCountOffset); return Get<int>(DropCountOffset);
} }

View File

@@ -46,14 +46,14 @@ struct FName
FORCEINLINE bool operator==(const FName& Other) const // HMM?? FORCEINLINE bool operator==(const FName& Other) const // HMM??
{ {
#if WITH_CASE_PRESERVING_NAME #if WITH_CASE_PRESERVING_NAME
return GetComparisonIndexFast() == Other.GetComparisonIndexFast() && GetNumber() == Other.GetNumber(); return GetComparisonIndexFast() == Other.GetComparisonIndexFast(); // && GetNumber() == Other.GetNumber();
#else #else
// static_assert(sizeof(CompositeComparisonValue) == sizeof(*this), "ComparisonValue does not cover the entire FName state"); // static_assert(sizeof(CompositeComparisonValue) == sizeof(*this), "ComparisonValue does not cover the entire FName state");
// return CompositeComparisonValue == Other.CompositeComparisonValue; // return CompositeComparisonValue == Other.CompositeComparisonValue;
#endif #endif
} }
int32 Compare(const FName& Other) const; // int32 Compare(const FName& Other) const;
/* FORCEINLINE bool operator<(const FName& Other) const /* FORCEINLINE bool operator<(const FName& Other) const
{ {

View File

@@ -305,7 +305,7 @@ void UNetDriver::ServerReplicateActors_BuildConsiderList(std::vector<FNetworkObj
if (Actor->IsPendingKillPending()) if (Actor->IsPendingKillPending())
// if (Actor->IsPendingKill()) // if (Actor->IsPendingKill())
{ {
ActorsToRemove.push_back(Actor); // ActorsToRemove.push_back(Actor);
continue; continue;
} }
@@ -313,11 +313,16 @@ void UNetDriver::ServerReplicateActors_BuildConsiderList(std::vector<FNetworkObj
if (Actor->Get<ENetRole>(RemoteRoleOffset) == ENetRole::ROLE_None) if (Actor->Get<ENetRole>(RemoteRoleOffset) == ENetRole::ROLE_None)
{ {
ActorsToRemove.push_back(Actor); // ActorsToRemove.push_back(Actor);
continue; continue;
} }
// We should add a NetDriverName check but I don't believe it is needed. // We should add a NetDriverName check but I don't believe it is needed.
if (Actor->GetNetDriverName() != this->GetNetDriverName())
{
// ActorsToRemove.push_back(Actor);
continue;
}
// We should check if the actor is initialized here. // We should check if the actor is initialized here.
@@ -627,11 +632,11 @@ int32 UNetDriver::ServerReplicateActors()
ServerReplicateActors_BuildConsiderList(ConsiderList, ServerTickTime); ServerReplicateActors_BuildConsiderList(ConsiderList, ServerTickTime);
LOG_INFO(LogReplication, "Considering {} actors.", ConsiderList.size()); // LOG_INFO(LogReplication, "Considering {} actors.", ConsiderList.size());
static UChannel* (*CreateChannel)(UNetConnection*, int, bool, int32_t) = decltype(CreateChannel)(Addresses::CreateChannel); static UChannel* (*CreateChannel)(UNetConnection*, int, bool, int32_t) = decltype(CreateChannel)(Addresses::CreateChannel);
static __int64 (*ReplicateActor)(UActorChannel*) = decltype(ReplicateActor)(Addresses::ReplicateActor); static __int64 (*ReplicateActor)(UActorChannel*) = decltype(ReplicateActor)(Addresses::ReplicateActor);
static UObject* (*CreateChannelByName)(UNetConnection* Connection, FName* ChName, EChannelCreateFlags CreateFlags, int32_t ChannelIndex) = decltype(CreateChannelByName)(Addresses::CreateChannel); static UObject* (*CreateChannelByName)(UNetConnection* Connection, const FName& ChName, EChannelCreateFlags CreateFlags, int32_t ChannelIndex) = decltype(CreateChannelByName)(Addresses::CreateChannel);
static __int64 (*SetChannelActor)(UActorChannel*, AActor*) = decltype(SetChannelActor)(Addresses::SetChannelActor); static __int64 (*SetChannelActor)(UActorChannel*, AActor*) = decltype(SetChannelActor)(Addresses::SetChannelActor);
static __int64 (*SetChannelActor2)(UActorChannel*, AActor*, ESetChannelActorFlags) = decltype(SetChannelActor2)(Addresses::SetChannelActor); static __int64 (*SetChannelActor2)(UActorChannel*, AActor*, ESetChannelActorFlags) = decltype(SetChannelActor2)(Addresses::SetChannelActor);
static FName ActorName = UKismetStringLibrary::Conv_StringToName(L"Actor"); static FName ActorName = UKismetStringLibrary::Conv_StringToName(L"Actor");
@@ -733,7 +738,7 @@ int32 UNetDriver::ServerReplicateActors()
if (Engine_Version >= 422) if (Engine_Version >= 422)
{ {
int ChannelIndex = -1; // 4294967295 int ChannelIndex = -1; // 4294967295
Channel = (UActorChannel*)CreateChannelByName(Connection, &ActorName, EChannelCreateFlags::OpenedLocally, ChannelIndex); Channel = (UActorChannel*)CreateChannelByName(Connection, ActorName, EChannelCreateFlags::OpenedLocally, ChannelIndex);
} }
else else
{ {
@@ -841,7 +846,7 @@ int32 UNetDriver::ServerReplicateActors()
if (Engine_Version >= 422) if (Engine_Version >= 422)
{ {
int ChannelIndex = -1; // 4294967295 int ChannelIndex = -1; // 4294967295
Channel = (UActorChannel*)CreateChannelByName(Connection, &ActorName, EChannelCreateFlags::OpenedLocally, ChannelIndex); Channel = (UActorChannel*)CreateChannelByName(Connection, ActorName, EChannelCreateFlags::OpenedLocally, ChannelIndex);
} }
else else
{ {
@@ -850,10 +855,10 @@ int32 UNetDriver::ServerReplicateActors()
if (Channel) if (Channel)
{ {
if (Engine_Version >= 500) if (Engine_Version >= 424)
SetChannelActor(Channel, Actor);
else
SetChannelActor2(Channel, Actor, ESetChannelActorFlags::None); SetChannelActor2(Channel, Actor, ESetChannelActorFlags::None);
else
SetChannelActor(Channel, Actor);
} }
} }

View File

@@ -136,6 +136,12 @@ public:
return Get<int>(MaxInternetClientRateOffset); return Get<int>(MaxInternetClientRateOffset);
} }
FName& GetNetDriverName()
{
static auto NetDriverNameOffset = GetOffset("NetDriverName");
return Get<FName>(NetDriverNameOffset);
}
int& GetMaxClientRate() int& GetMaxClientRate()
{ {
static auto MaxClientRateOffset = GetOffset("MaxClientRate"); static auto MaxClientRateOffset = GetOffset("MaxClientRate");

View File

@@ -22,6 +22,7 @@ std::string FName::ToString() const
return Str; return Str;
} }
#if 0
int32 FName::Compare(const FName& Other) const int32 FName::Compare(const FName& Other) const
{ {
if (GetComparisonIndexFast() == Other.GetComparisonIndexFast()) if (GetComparisonIndexFast() == Other.GetComparisonIndexFast())
@@ -65,6 +66,7 @@ int32 FName::Compare(const FName& Other) const
return GetComparisonIndexFast() < Other.GetComparisonIndexFast(); return GetComparisonIndexFast() < Other.GetComparisonIndexFast();
} }
#endif
std::string FName::ToString() std::string FName::ToString()
{ {

View File

@@ -57,8 +57,7 @@ void UWorld::Listen()
return; return;
} }
static auto NetDriverNameOffset = NewNetDriver->GetOffset("NetDriverName"); NewNetDriver->GetNetDriverName() = GameNetDriverName;
NewNetDriver->Get<FName>(NetDriverNameOffset) = GameNetDriverName;
static auto World_NetDriverOffset = GetWorld()->GetOffset("NetDriver"); static auto World_NetDriverOffset = GetWorld()->GetOffset("NetDriver");
GetWorld()->Get(World_NetDriverOffset) = NewNetDriver; GetWorld()->Get(World_NetDriverOffset) = NewNetDriver;

View File

@@ -1047,7 +1047,7 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook((PVOID)Addresses::GetNetMode, (PVOID)GetNetModeHook, nullptr); Hooking::MinHook::Hook((PVOID)Addresses::GetNetMode, (PVOID)GetNetModeHook, nullptr);
Hooking::MinHook::Hook((PVOID)Addresses::DispatchRequest, (PVOID)DispatchRequestHook, (PVOID*)&DispatchRequestOriginal); Hooking::MinHook::Hook((PVOID)Addresses::DispatchRequest, (PVOID)DispatchRequestHook, (PVOID*)&DispatchRequestOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::ReplicateActor, (PVOID)ReplicateActorHook, (PVOID*)&ReplicateActorOriginal); // Hooking::MinHook::Hook((PVOID)Addresses::ReplicateActor, (PVOID)ReplicateActorHook, (PVOID*)&ReplicateActorOriginal);
GSRandSeed = FGenericPlatformTime::Cycles(); GSRandSeed = FGenericPlatformTime::Cycles();
ReplicationRandStream = FRandomStream(FGenericPlatformTime::Cycles()); ReplicationRandStream = FRandomStream(FGenericPlatformTime::Cycles());

View File

@@ -1904,15 +1904,22 @@ static inline uint64 FindReplicateActor()
return Memcury::Scanner::FindPattern("48 8B C4 48 89 58 10 48 89 70 18 48 89 78 20 55 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8D 69 68").Get(); return Memcury::Scanner::FindPattern("48 8B C4 48 89 58 10 48 89 70 18 48 89 78 20 55 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8D 69 68").Get();
if (Fortnite_Version >= 21) if (Fortnite_Version >= 21)
{ {
auto strRef = Memcury::Scanner::FindStringRef(L"STAT_NetReplicateActorTime"); auto Addrr = Memcury::Scanner::FindStringRef(L"STAT_NetReplicateActorTime").Get();
return strRef.ScanFor({ 0x48, 0x8B, 0xC4 }, false).Get();
auto addr = Memcury::Scanner::FindPattern("48 8B C4 48 89 58 ? 48 89 70 ? 48 89 78 ? 55 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 45 33 FF 4C 8D ? ? 44 38 3D", false).Get(); // 22.3 for (int i = 0; i < 1000; i++)
{
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x55) // 24.40
{
return Addrr - i;
}
if (!addr) if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x8B && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0xC4)
addr = Memcury::Scanner::FindPattern("40 55 41 54 41 55 41 56 41 57 48 81 EC ? ? ? ? 48 8D 6C 24 ? 48 89 9D ? ? ? ? 48 89 B5 ? ? ? ? 48 89 BD ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C5 48 89 85 ? ? ? ? 45 33 E4 4C 8D 69 68 44 38 25 ? ? ? ? 48 8D 05 ? ? ? ? 48 8B F9 49 8B 4D").Get(); // 23.40 {
return Addrr - i;
}
}
return addr; return 0;
} }
return 0; return 0;

View File

@@ -23,7 +23,7 @@ extern inline int Fortnite_CL = 0;
// #define PROD // this doesnt do anything besides remove processeventhook and some assert stuff // #define PROD // this doesnt do anything besides remove processeventhook and some assert stuff
// DEPRECATED ^^^ (see Globals::bDeveloperMode) // DEPRECATED ^^^ (see Globals::bDeveloperMode)
// #define ABOVE_S20 #define ABOVE_S20
struct PlaceholderBitfield struct PlaceholderBitfield
{ {