i probably broke the whole projecvt

This commit is contained in:
Milxnor
2023-03-07 11:09:26 -05:00
parent ae259f97eb
commit eb3685c070
20 changed files with 543 additions and 182 deletions

View File

@@ -0,0 +1,7 @@
#include "FortDecoItemDefinition.h"
static UClass* StaticClass()
{
static auto ptr = FindObject<UClass>("/Script/FortniteGame.FortDecoItemDefinition");
return ptr;
}

View File

@@ -0,0 +1,10 @@
#pragma once
#include "FortWeaponItemDefinition.h"
class UFortDecoItemDefinition : public UFortWeaponItemDefinition
{
public:
static UClass* StaticClass();
};

View File

@@ -73,6 +73,12 @@ static void StreamLevel(std::string LevelName, FVector Location = {})
Transform.Translation = Location; Transform.Translation = Location;
auto BuildingFoundation = GetWorld()->SpawnActor<ABuildingSMActor>(BuildingFoundation3x3Class, Transform); auto BuildingFoundation = GetWorld()->SpawnActor<ABuildingSMActor>(BuildingFoundation3x3Class, Transform);
if (!BuildingFoundation)
{
LOG_ERROR(LogGame, "Failed to spawn BuildingFoundation for streaming!");
return;
}
BuildingFoundation->InitializeBuildingActor(BuildingFoundation, nullptr, false); BuildingFoundation->InitializeBuildingActor(BuildingFoundation, nullptr, false);
static auto FoundationNameOffset = FindOffsetStruct("/Script/FortniteGame.BuildingFoundationStreamingData", "FoundationName"); static auto FoundationNameOffset = FindOffsetStruct("/Script/FortniteGame.BuildingFoundationStreamingData", "FoundationName");
@@ -150,10 +156,17 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
{ {
LastNum2 = AmountOfRestarts; LastNum2 = AmountOfRestarts;
LOG_INFO(LogDev, "Presetup!");
GameMode->Get<int>("WarmupRequiredPlayerCount") = 1; GameMode->Get<int>("WarmupRequiredPlayerCount") = 1;
{
SetPlaylist(GetPlaylistToUse()); SetPlaylist(GetPlaylistToUse());
LOG_INFO(LogDev, "Set playlist!");
}
// if (false)
{
auto Fortnite_Season = std::floor(Fortnite_Version); auto Fortnite_Season = std::floor(Fortnite_Version);
if (Fortnite_Season == 6) if (Fortnite_Season == 6)
@@ -289,6 +302,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
static auto AdditionalLevelsOffset = PlaylistToUse->GetOffset("AdditionalLevels"); static auto AdditionalLevelsOffset = PlaylistToUse->GetOffset("AdditionalLevels");
auto& AdditionalLevels = PlaylistToUse->Get<TArray<TSoftObjectPtr<UClass>>>(AdditionalLevelsOffset); auto& AdditionalLevels = PlaylistToUse->Get<TArray<TSoftObjectPtr<UClass>>>(AdditionalLevelsOffset);
LOG_INFO(LogPlaylist, "Loading {} playlist levels.", AdditionalLevels.Num());
for (int i = 0; i < AdditionalLevels.Num(); i++) for (int i = 0; i < AdditionalLevels.Num(); i++)
{ {
// auto World = Cast<UWorld>(Playlist->AdditionalLevels[i].Get()); // auto World = Cast<UWorld>(Playlist->AdditionalLevels[i].Get());
@@ -297,6 +312,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
} }
} }
} }
}
static int LastNum6 = 1; static int LastNum6 = 1;
@@ -320,14 +336,18 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
{ {
LastNum5 = AmountOfRestarts; LastNum5 = AmountOfRestarts;
if (Globals::bGoingToPlayEvent)
{
bool bb; bool bb;
CallOnReadys(&bb); CallOnReadys(&bb);
if (!bb) if (!bb)
LastNum5 = -1; LastNum5 = -1;
} }
}
/* static auto FortPlayerStartWarmupClass = FindObject<UClass>("/Script/FortniteGame.FortPlayerStartWarmup"); /*
static auto FortPlayerStartWarmupClass = FindObject<UClass>("/Script/FortniteGame.FortPlayerStartWarmup");
TArray<AActor*> Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartWarmupClass); TArray<AActor*> Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartWarmupClass);
int ActorsNum = Actors.Num(); int ActorsNum = Actors.Num();
@@ -335,7 +355,15 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
Actors.Free(); Actors.Free();
if (ActorsNum == 0) if (ActorsNum == 0)
return false; */ return false;
*/
static int LastNum9 = 1;
if (AmountOfRestarts != LastNum9)
{
LastNum9 = AmountOfRestarts;
}
static auto MapInfoOffset = GameState->GetOffset("MapInfo"); static auto MapInfoOffset = GameState->GetOffset("MapInfo");
auto MapInfo = GameState->Get(MapInfoOffset); auto MapInfo = GameState->Get(MapInfoOffset);
@@ -351,6 +379,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
{ {
LastNum3 = AmountOfRestarts; LastNum3 = AmountOfRestarts;
LOG_INFO(LogNet, "Attempting to listen!");
GetWorld()->Listen(); GetWorld()->Listen();
SetBitfield(GameMode->GetPtr<PlaceholderBitfield>("bWorldIsReady"), 1, true); SetBitfield(GameMode->GetPtr<PlaceholderBitfield>("bWorldIsReady"), 1, true);
@@ -374,11 +404,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
float TimeSeconds = 35.f; // UGameplayStatics::GetTimeSeconds(GetWorld()); float TimeSeconds = 35.f; // UGameplayStatics::GetTimeSeconds(GetWorld());
if (Engine_Version >= 424) LOG_INFO(LogDev, "Initializing!");
{
GameState->GetGamePhase() = EAthenaGamePhase::Warmup;
GameState->OnRep_GamePhase();
}
GameState->Get<float>("WarmupCountdownEndTime") = TimeSeconds + Duration; GameState->Get<float>("WarmupCountdownEndTime") = TimeSeconds + Duration;
GameMode->Get<float>("WarmupCountdownDuration") = Duration; GameMode->Get<float>("WarmupCountdownDuration") = Duration;
@@ -386,7 +412,9 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
GameState->Get<float>("WarmupCountdownStartTime") = TimeSeconds; GameState->Get<float>("WarmupCountdownStartTime") = TimeSeconds;
GameMode->Get<float>("WarmupEarlyCountdownDuration") = EarlyDuration; GameMode->Get<float>("WarmupEarlyCountdownDuration") = EarlyDuration;
GameState->OnRep_CurrentPlaylistInfo(); // GameState->Get<bool>("bGameModeWillSkipAircraft") = Globals::bGoingToPlayEvent && Fortnite_Version == 17.30;
// GameState->OnRep_CurrentPlaylistInfo();
LOG_INFO(LogDev, "Initialized!"); LOG_INFO(LogDev, "Initialized!");
} }
@@ -426,6 +454,18 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
if (!NewPlayerActor) if (!NewPlayerActor)
return; return;
static bool bFirst = Engine_Version >= 424;
auto GameState = GameMode->GetGameStateAthena();
if (bFirst)
{
bFirst = false;
GameState->GetGamePhase() = EAthenaGamePhase::Warmup;
GameState->OnRep_GamePhase();
}
auto SpawnIsland_FloorLoot = FindObject<UClass>("/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_Warmup.Tiered_Athena_FloorLoot_Warmup_C"); auto SpawnIsland_FloorLoot = FindObject<UClass>("/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_Warmup.Tiered_Athena_FloorLoot_Warmup_C");
auto BRIsland_FloorLoot = FindObject<UClass>("/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_01.Tiered_Athena_FloorLoot_01_C"); auto BRIsland_FloorLoot = FindObject<UClass>("/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_01.Tiered_Athena_FloorLoot_01_C");
@@ -493,8 +533,6 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
} }
} }
auto GameState = GameMode->GetGameStateAthena();
auto NewPlayer = (AFortPlayerControllerAthena*)NewPlayerActor; auto NewPlayer = (AFortPlayerControllerAthena*)NewPlayerActor;
auto WorldInventory = NewPlayer->GetWorldInventory(); auto WorldInventory = NewPlayer->GetWorldInventory();
@@ -557,7 +595,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
PlayerStateAthena->ProcessEvent(OnRep_bHasStartedPlayingFn); PlayerStateAthena->ProcessEvent(OnRep_bHasStartedPlayingFn);
} }
// if (false) if (false)
{ {
static auto GameplayAbilitySet = LoadObject<UObject>(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer") ? static auto GameplayAbilitySet = 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_AthenaPlayer.GAS_AthenaPlayer") :

View File

@@ -12,6 +12,15 @@ AFortWeapon* AFortPawn::EquipWeaponDefinition(UFortWeaponItemDefinition* WeaponD
return params.Wep; return params.Wep;
} }
bool AFortPawn::PickUpActor(AActor* PickupTarget, UFortDecoItemDefinition* PlacementDecoItemDefinition)
{
static auto fn = FindObject<UFunction>("/Script/FortniteGame.FortPawn.PickUpActor");
struct { AActor* PickupTarget; UFortDecoItemDefinition* PlacementDecoItemDefinition; bool ReturnValue; } AFortPawn_PickUpActor_Params{ PickupTarget, PlacementDecoItemDefinition };
this->ProcessEvent(fn, &AFortPawn_PickUpActor_Params);
return AFortPawn_PickUpActor_Params.ReturnValue;
}
UClass* AFortPawn::StaticClass() UClass* AFortPawn::StaticClass()
{ {
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPawn"); static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPawn");

View File

@@ -2,12 +2,13 @@
#include "Pawn.h" #include "Pawn.h"
#include "FortWeapon.h" #include "FortWeapon.h"
#include "FortWeaponItemDefinition.h" #include "FortDecoItemDefinition.h"
class AFortPawn : public APawn class AFortPawn : public APawn
{ {
public: public:
AFortWeapon* EquipWeaponDefinition(UFortWeaponItemDefinition* WeaponData, const FGuid& ItemEntryGuid); AFortWeapon* EquipWeaponDefinition(UFortWeaponItemDefinition* WeaponData, const FGuid& ItemEntryGuid);
bool PickUpActor(AActor* PickupTarget, UFortDecoItemDefinition* PlacementDecoItemDefinition);
AFortWeapon*& GetCurrentWeapon() AFortWeapon*& GetCurrentWeapon()
{ {

View File

@@ -20,8 +20,46 @@ void AFortPlayerController::ClientReportDamagedResourceBuilding(ABuildingSMActor
this->ProcessEvent(fn, &AFortPlayerController_ClientReportDamagedResourceBuilding_Params); this->ProcessEvent(fn, &AFortPlayerController_ClientReportDamagedResourceBuilding_Params);
} }
void AFortPlayerController::ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid)
{
auto ItemInstance = PlayerController->GetWorldInventory()->FindItemInstance(ItemGuid);
auto Pawn = Cast<AFortPawn>(PlayerController->GetPawn());
if (!ItemInstance || !Pawn)
return;
auto ItemDefinition = ItemInstance->GetItemEntry()->GetItemDefinition();
if (auto DecoItemDefinition = Cast<UFortDecoItemDefinition>(ItemDefinition))
{
Pawn->PickUpActor(nullptr, DecoItemDefinition); // todo check ret value?
Pawn->GetCurrentWeapon()->GetItemEntryGuid() = ItemGuid;
static auto FortDecoTool_ContextTrapStaticClass = FindObject<UClass>("/Script/FortniteGame.FortDecoTool_ContextTrap");
if (Pawn->GetCurrentWeapon()->IsA(FortDecoTool_ContextTrapStaticClass))
{
static auto ContextTrapItemDefinitionOffset = Pawn->GetCurrentWeapon()->GetOffset("ContextTrapItemDefinition");
Pawn->GetCurrentWeapon()->Get<UObject*>(ContextTrapItemDefinitionOffset) = DecoItemDefinition;
}
return;
}
if (!ItemDefinition)
return;
if (auto Weapon = Pawn->EquipWeaponDefinition((UFortWeaponItemDefinition*)ItemDefinition, ItemInstance->GetItemEntry()->GetItemGuid()))
{
}
void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation) void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation)
{ {
if (Fortnite_Version == 17.30 && Globals::bGoingToPlayEvent)
return; // We want to be teleported back to the UFO but we dont use chooseplayerstart
auto PlayerController = Cast<APlayerController>(Engine_Version < 424 ? PC : ((UActorComponent*)PC)->GetOwner()); auto PlayerController = Cast<APlayerController>(Engine_Version < 424 ? PC : ((UActorComponent*)PC)->GetOwner());
LOG_INFO(LogDev, "PlayerController: {}", __int64(PlayerController)); LOG_INFO(LogDev, "PlayerController: {}", __int64(PlayerController));

View File

@@ -32,19 +32,7 @@ public:
return Class; return Class;
} }
static void ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid) static void ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid);
{
auto ItemInstance = PlayerController->GetWorldInventory()->FindItemInstance(ItemGuid);
auto Pawn = Cast<AFortPawn>(PlayerController->GetPawn());
if (!ItemInstance || !Pawn)
return;
if (auto Weapon = Pawn->EquipWeaponDefinition((UFortWeaponItemDefinition*)ItemInstance->GetItemEntry()->GetItemDefinition(), ItemInstance->GetItemEntry()->GetItemGuid()))
{
}
}
static void ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation); static void ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation);
static void ServerCreateBuildingActorHook(AFortPlayerController* PlayerController, FCreateBuildingActorData CreateBuildingData); static void ServerCreateBuildingActorHook(AFortPlayerController* PlayerController, FCreateBuildingActorData CreateBuildingData);

View File

@@ -68,7 +68,7 @@ void AFortPlayerPawn::ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup*
static auto PickupGuidOffset = FindOffsetStruct("/Script/FortniteGame.FortPickupLocationData", "PickupGuid"); static auto PickupGuidOffset = FindOffsetStruct("/Script/FortniteGame.FortPickupLocationData", "PickupGuid");
*(AFortPawn**)(__int64(PickupLocationData) + PickupTargetOffset) = Pawn; *(AFortPawn**)(__int64(PickupLocationData) + PickupTargetOffset) = Pawn;
*(float*)(__int64(PickupLocationData) + FlyTimeOffset) = 0.40; *(float*)(__int64(PickupLocationData) + FlyTimeOffset) = 0.40f;
*(AFortPawn**)(__int64(PickupLocationData) + ItemOwnerOffset) = Pawn; *(AFortPawn**)(__int64(PickupLocationData) + ItemOwnerOffset) = Pawn;
*(FVector*)(__int64(PickupLocationData) + StartDirectionOffset) = InStartDirection; *(FVector*)(__int64(PickupLocationData) + StartDirectionOffset) = InStartDirection;
*(FGuid*)(__int64(PickupLocationData) + PickupGuidOffset) = Pawn->GetCurrentWeapon() ? Pawn->GetCurrentWeapon()->GetItemEntryGuid() : FGuid(); *(FGuid*)(__int64(PickupLocationData) + PickupGuidOffset) = Pawn->GetCurrentWeapon() ? Pawn->GetCurrentWeapon()->GetItemEntryGuid() : FGuid();

View File

@@ -5,11 +5,11 @@
APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AController* NewPlayer, AActor* StartSpot) APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AController* NewPlayer, AActor* StartSpot)
{ {
LOG_INFO(LogDev, "SpawnDefaultPawnFor: 0x{:x}!", __int64(_ReturnAddress()) - __int64(GetModuleHandleW(0)));
static auto PawnClass = FindObject<UClass>("/Game/Athena/PlayerPawn_Athena.PlayerPawn_Athena_C"); static auto PawnClass = FindObject<UClass>("/Game/Athena/PlayerPawn_Athena.PlayerPawn_Athena_C");
GameMode->Get<UClass*>("DefaultPawnClass") = PawnClass; GameMode->Get<UClass*>("DefaultPawnClass") = PawnClass;
LOG_INFO(LogDev, "SpawnDefaultPawnFor: 0x{:x}!", __int64(_ReturnAddress()) - __int64(GetModuleHandleW(0)));
static auto fn = FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnAtTransform"); static auto fn = FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnAtTransform");
struct { AController* NewPlayer; FTransform SpawnTransform; APawn* ReturnValue; } struct { AController* NewPlayer; FTransform SpawnTransform; APawn* ReturnValue; }

View File

@@ -22,6 +22,7 @@ struct FURL // idk where this actually goes
class UNetDriver : public UObject class UNetDriver : public UObject
{ {
public: public:
// static inline int ReplicationDriverOffset = 0;
static inline bool (*InitListenOriginal)(UNetDriver* NetDriver, FNetworkNotify* InNotify, FURL& ListenURL, bool bReuseAddressAndPort, FString& Error); static inline bool (*InitListenOriginal)(UNetDriver* NetDriver, FNetworkNotify* InNotify, FURL& ListenURL, bool bReuseAddressAndPort, FString& Error);
static inline void (*SetWorldOriginal)(UNetDriver* NetDriver, UWorld* World); static inline void (*SetWorldOriginal)(UNetDriver* NetDriver, UWorld* World);
static inline void (*TickFlushOriginal)(UNetDriver* NetDriver); static inline void (*TickFlushOriginal)(UNetDriver* NetDriver);

View File

@@ -175,6 +175,7 @@
<ClCompile Include="DataTableFunctionLibrary.cpp" /> <ClCompile Include="DataTableFunctionLibrary.cpp" />
<ClCompile Include="dllmain.cpp" /> <ClCompile Include="dllmain.cpp" />
<ClCompile Include="events.cpp" /> <ClCompile Include="events.cpp" />
<ClCompile Include="FortDecoItemDefinition.cpp" />
<ClCompile Include="FortGameModeAthena.cpp" /> <ClCompile Include="FortGameModeAthena.cpp" />
<ClCompile Include="FortGameModeZone.cpp" /> <ClCompile Include="FortGameModeZone.cpp" />
<ClCompile Include="FortGameStateAthena.cpp" /> <ClCompile Include="FortGameStateAthena.cpp" />
@@ -225,6 +226,7 @@
<ClInclude Include="EngineTypes.h" /> <ClInclude Include="EngineTypes.h" />
<ClInclude Include="events.h" /> <ClInclude Include="events.h" />
<ClInclude Include="finder.h" /> <ClInclude Include="finder.h" />
<ClInclude Include="FortDecoItemDefinition.h" />
<ClInclude Include="FortGameMode.h" /> <ClInclude Include="FortGameMode.h" />
<ClInclude Include="FortGameModeAthena.h" /> <ClInclude Include="FortGameModeAthena.h" />
<ClInclude Include="FortGameModePvPBase.h" /> <ClInclude Include="FortGameModePvPBase.h" />

View File

@@ -116,6 +116,9 @@
<ClCompile Include="FortPlayerControllerAthena.cpp"> <ClCompile Include="FortPlayerControllerAthena.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Player</Filter> <Filter>FortniteGame\Source\FortniteGame\Private\Player</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FortDecoItemDefinition.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />
@@ -359,6 +362,9 @@
<ClInclude Include="events.h"> <ClInclude Include="events.h">
<Filter>Reboot\Public</Filter> <Filter>Reboot\Public</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="FortDecoItemDefinition.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Items</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="Engine"> <Filter Include="Engine">

View File

@@ -66,7 +66,7 @@ void UWorld::Listen()
// LEVEL COLLECTIONS // LEVEL COLLECTIONS
auto& LevelCollections = GetWorld()->Get<TArray<__int64>>("LevelCollections"); auto& LevelCollections = GetWorld()->Get<TArray<__int64>>("LevelCollections");
int LevelCollectionSize = 0x78; int LevelCollectionSize = FindObject<UStruct>("/Script/Engine.LevelCollection")->GetPropertiesSize();
*(UNetDriver**)(__int64(LevelCollections.AtPtr(0, LevelCollectionSize)) + 0x10) = NewNetDriver; *(UNetDriver**)(__int64(LevelCollections.AtPtr(0, LevelCollectionSize)) + 0x10) = NewNetDriver;
*(UNetDriver**)(__int64(LevelCollections.AtPtr(1, LevelCollectionSize)) + 0x10) = NewNetDriver; *(UNetDriver**)(__int64(LevelCollections.AtPtr(1, LevelCollectionSize)) + 0x10) = NewNetDriver;

View File

@@ -35,7 +35,7 @@ void Addresses::SetupVersion()
Fortnite_Version = 12.41; Fortnite_Version = 12.41;
} }
static FString(*GetEngineVersion)() = decltype(GetEngineVersion)(Memcury::Scanner::FindPattern("40 53 48 83 EC 20 48 8B D9 E8 ? ? ? ? 48 8B C8 41 B8 04 ? ? ? 48 8B D3").Get()); static FString(*GetEngineVersion)() = decltype(GetEngineVersion)(Memcury::Scanner::FindPattern("40 53 48 83 EC 20 48 8B D9 E8 ? ? ? ? 48 8B C8 41 B8 04 ? ? ? 48 8B D3", false).Get());
std::string FullVersion; std::string FullVersion;
FString toFree; FString toFree;
@@ -314,11 +314,21 @@ std::vector<uint64> Addresses::GetFunctionsToNull()
// toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 48 8D 68 A1 48 81 EC ? ? ? ? 48 89 58 08 4C 89 60 F0 4C 8B E2 4C 89").Get()); // ^ // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 48 8D 68 A1 48 81 EC ? ? ? ? 48 89 58 08 4C 89 60 F0 4C 8B E2 4C 89").Get()); // ^
} }
if (Engine_Version == 500)
{
toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 40 48 8B FA 48 8B D9 48 85 D2 0F 84 ? ? ? ? 8B").Get()); // idk lmfao
}
if (Fortnite_Version == 12.61) if (Fortnite_Version == 12.61)
{ {
// toNull.push_back(Memcury::Scanner::FindPattern("48 89 4C 24 ? 55 56 57 41 56 48 81 EC ? ? ? ? 4C 8B B1 ? ? ? ? 33 F6 4C 89 B4 24 ? ? ? ? 48 8B").Get()); // fritter crash // toNull.push_back(Memcury::Scanner::FindPattern("48 89 4C 24 ? 55 56 57 41 56 48 81 EC ? ? ? ? 4C 8B B1 ? ? ? ? 33 F6 4C 89 B4 24 ? ? ? ? 48 8B").Get()); // fritter crash
} }
if (Fortnite_Version == 17.30)
{
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 70 08 48 89 78 10 55 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 ED").Get());
}
toNull.push_back(Addresses::ChangeGameSessionId); toNull.push_back(Addresses::ChangeGameSessionId);
return toNull; return toNull;

View File

@@ -25,6 +25,9 @@ enum ENetMode
static ENetMode GetNetModeHook() { /* std::cout << "AA!\n"; */ return ENetMode::NM_DedicatedServer; } static ENetMode GetNetModeHook() { /* std::cout << "AA!\n"; */ return ENetMode::NM_DedicatedServer; }
static ENetMode GetNetModeHook2() { /* std::cout << "AA!\n"; */ return ENetMode::NM_DedicatedServer; } static ENetMode GetNetModeHook2() { /* std::cout << "AA!\n"; */ return ENetMode::NM_DedicatedServer; }
static bool ReturnTrueHook() { return true; }
static int Return2Hook() { return 2; }
static void NoMCPHook() { return; } static void NoMCPHook() { return; }
static void CollectGarbageHook() { return; } static void CollectGarbageHook() { return; }
@@ -52,11 +55,12 @@ DWORD WINAPI Main(LPVOID)
Offsets::Print(); Offsets::Print();
Addresses::FindAll(); Addresses::FindAll();
// Addresses::Print();
Addresses::Init(); Addresses::Init();
Addresses::Print(); Addresses::Print();
static auto GameModeDefault = FindObject<UClass>(L"/Script/FortniteGame.Default__FortGameModeAthena"); static auto GameModeDefault = FindObject<UClass>(L"/Script/FortniteGame.Default__FortGameModeAthena");
static auto FortPlayerControllerAthenaDefault = FindObject<UClass>(L"/Game/Athena/Athena_PlayerController.Default__Athena_PlayerController_C"); static auto FortPlayerControllerAthenaDefault = FindObject<UClass>(L"/Script/FortniteGame.Default__FortPlayerControllerAthena"); // FindObject<UClass>(L"/Game/Athena/Athena_PlayerController.Default__Athena_PlayerController_C");
static auto FortPlayerPawnAthenaDefault = FindObject<UClass>(L"/Game/Athena/PlayerPawn_Athena.Default__PlayerPawn_Athena_C"); static auto FortPlayerPawnAthenaDefault = FindObject<UClass>(L"/Game/Athena/PlayerPawn_Athena.Default__PlayerPawn_Athena_C");
static auto FortAbilitySystemComponentAthenaDefault = FindObject<UClass>(L"/Script/FortniteGame.Default__FortAbilitySystemComponentAthena"); static auto FortAbilitySystemComponentAthenaDefault = FindObject<UClass>(L"/Script/FortniteGame.Default__FortAbilitySystemComponentAthena");
@@ -78,6 +82,26 @@ DWORD WINAPI Main(LPVOID)
GetLocalPlayerController()->ProcessEvent(SwitchLevel, &Level); 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)));
LOG_INFO(LogDev, "FindGIsClient: 0x{:x}", FindGIsClient() - __int64(GetModuleHandleW(0)));
if (FindGIsServer())
*(bool*)FindGIsServer() = true;
if (FindGIsClient())
*(bool*)FindGIsClient() = false;
if (Fortnite_Version == 17.30)
{
// Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3E07910), (PVOID)Return2Hook, nullptr);
// Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3DED12C), (PVOID)ReturnTrueHook, nullptr);
Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3DED158), (PVOID)ReturnTrueHook, nullptr);
}
/* /*
auto GIsClient = Memcury::Scanner(FindGIsServer()); auto GIsClient = Memcury::Scanner(FindGIsServer());
@@ -102,8 +126,6 @@ DWORD WINAPI Main(LPVOID)
LOG_INFO(LogDev, "isded: {}", parms.ret); */ LOG_INFO(LogDev, "isded: {}", parms.ret); */
Hooking::MinHook::Hook((PVOID)Addresses::ActorGetNetMode, (PVOID)GetNetModeHook2, nullptr);
auto& LocalPlayers = GetLocalPlayers(); auto& LocalPlayers = GetLocalPlayers();
if (LocalPlayers.Num() && LocalPlayers.Data) if (LocalPlayers.Num() && LocalPlayers.Data)
@@ -116,14 +138,21 @@ DWORD WINAPI Main(LPVOID)
if (func == 0) if (func == 0)
continue; continue;
*(uint8_t*)func = 0xC3; DWORD dwProtection;
} VirtualProtect((PVOID)func, 1, PAGE_EXECUTE_READWRITE, &dwProtection);
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook, *(uint8_t*)func = 0xC3;
(PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false);
DWORD dwTemp;
VirtualProtect((PVOID)func, 1, dwProtection, &dwTemp);
}
// return false; // return false;
// UNetDriver::ReplicationDriverOffset = FindOffsetStruct("/Script/Engine.NetDriver", "ReplicationDriver"); // NetDriver->GetOffset("ReplicationDriver");
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook,
(PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false);
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"), Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"),
AGameModeBase::SpawnDefaultPawnForHook, nullptr, false); AGameModeBase::SpawnDefaultPawnForHook, nullptr, false);
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.HandleStartingNewPlayer"), AFortGameModeAthena::Athena_HandleStartingNewPlayerHook, Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.HandleStartingNewPlayer"), AFortGameModeAthena::Athena_HandleStartingNewPlayerHook,
@@ -149,10 +178,10 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.ServerHandlePickup"), Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.ServerHandlePickup"),
AFortPlayerPawn::ServerHandlePickupHook, nullptr, false); AFortPlayerPawn::ServerHandlePickupHook, nullptr, false);
Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbility"), /* Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbility"),
UAbilitySystemComponent::ServerTryActivateAbilityHook, nullptr, false); UAbilitySystemComponent::ServerTryActivateAbilityHook, nullptr, false);
Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbilityWithEventData"), Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbilityWithEventData"),
UAbilitySystemComponent::ServerTryActivateAbilityWithEventDataHook, nullptr, false); UAbilitySystemComponent::ServerTryActivateAbilityWithEventDataHook, nullptr, false); */
// Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerAbilityRPCBatch"), // Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject<UFunction>(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerAbilityRPCBatch"),
// UAbilitySystemComponent::ServerAbilityRPCBatchHook, nullptr, false); // UAbilitySystemComponent::ServerAbilityRPCBatchHook, nullptr, false);
@@ -165,14 +194,16 @@ DWORD WINAPI Main(LPVOID)
} }
Hooking::MinHook::Hook((PVOID)Addresses::GetPlayerViewpoint, (PVOID)AFortPlayerControllerAthena::GetPlayerViewPointHook, (PVOID*)&AFortPlayerControllerAthena::GetPlayerViewPointOriginal); Hooking::MinHook::Hook((PVOID)Addresses::GetPlayerViewpoint, (PVOID)AFortPlayerControllerAthena::GetPlayerViewPointHook, (PVOID*)&AFortPlayerControllerAthena::GetPlayerViewPointOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::KickPlayer, (PVOID)AGameSession::KickPlayerHook, (PVOID*)&AGameSession::KickPlayerOriginal); // Hooking::MinHook::Hook((PVOID)Addresses::KickPlayer, (PVOID)AGameSession::KickPlayerHook, (PVOID*)&AGameSession::KickPlayerOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::TickFlush, (PVOID)UNetDriver::TickFlushHook, (PVOID*)&UNetDriver::TickFlushOriginal); Hooking::MinHook::Hook((PVOID)Addresses::TickFlush, (PVOID)UNetDriver::TickFlushHook, (PVOID*)&UNetDriver::TickFlushOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::OnDamageServer, (PVOID)ABuildingActor::OnDamageServerHook, (PVOID*)&ABuildingActor::OnDamageServerOriginal); // Hooking::MinHook::Hook((PVOID)Addresses::OnDamageServer, (PVOID)ABuildingActor::OnDamageServerHook, (PVOID*)&ABuildingActor::OnDamageServerOriginal);
// Hooking::MinHook::Hook((PVOID)Addresses::CollectGarbage, (PVOID)CollectGarbageHook, nullptr); // Hooking::MinHook::Hook((PVOID)Addresses::CollectGarbage, (PVOID)CollectGarbageHook, nullptr);
Hooking::MinHook::Hook((PVOID)Addresses::PickTeam, (PVOID)AFortGameModeAthena::Athena_PickTeamHook, nullptr); Hooking::MinHook::Hook((PVOID)Addresses::PickTeam, (PVOID)AFortGameModeAthena::Athena_PickTeamHook, nullptr);
srand(time(0)); srand(time(0));
LOG_INFO(LogHook, "Finished!");
while (true) while (true)
{ {
if (GetAsyncKeyState(VK_F7) & 1) if (GetAsyncKeyState(VK_F7) & 1)

View File

@@ -119,6 +119,32 @@ static inline std::vector<Event> Events =
"/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C", "/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C",
"/Game/Athena/Playlists/Music/Playlist_Music_High.Playlist_Music_High", "/Game/Athena/Playlists/Music/Playlist_Music_High.Playlist_Music_High",
7.30 7.30
),
Event
(
"Rift Tour",
"",
"",
0,
{
},
{
{
{
false,
// "/Buffet/Gameplay/Blueprints/BP_Buffet_Master_Scripting.BP_Buffet_Master_Scripting_C.startevent"
"/Script/SpecialEventGameplayRuntime.SpecialEventScript.StartEventAtIndex"
},
0
}
},
"/Buffet/Gameplay/Blueprints/Buffet_SpecialEventScript.Buffet_SpecialEventScript_C",
// "/Buffet/Gameplay/Blueprints/BP_Buffet_Master_Scripting.BP_Buffet_Master_Scripting_C",
"/BuffetPlaylist/Playlist/Playlist_Buffet.Playlist_Buffet",
17.30
) )
}; };
@@ -153,7 +179,7 @@ static inline UObject* GetEventScripting()
if (!ScriptingClass) if (!ScriptingClass)
{ {
// LOG_ERROR(LogEvent, "Failed to find ScriptingClass!"); LOG_ERROR(LogEvent, "Failed to find ScriptingClass!");
return nullptr; return nullptr;
} }
@@ -161,7 +187,7 @@ static inline UObject* GetEventScripting()
if (AllScripters.size() <= 0) if (AllScripters.size() <= 0)
{ {
// LOG_ERROR(LogEvent, "Failed to find any scripters!"); LOG_ERROR(LogEvent, "Failed to find any scripters!");
return nullptr; return nullptr;
} }
@@ -338,6 +364,24 @@ static inline bool CallOnReadys(bool* bWereAllSuccessful = nullptr)
} }
} }
/* if (Fortnite_Version == 17.30)
{
static auto onready = FindObject<UFunction>("/Buffet/Gameplay/Blueprints/BP_Buffet_Master_Scripting.BP_Buffet_Master_Scripting_C.OnReady_C6091CF24046D602CBB778A594DB5BA8");
auto script = FindObject("/Buffet/Levels/Buffet_P.Buffet_P.PersistentLevel.BP_Event_Master_Scripting_2");
if (!script)
{
LOG_ERROR(LogEvent, "Failed to find MasterScripting");
if (bWereAllSuccessful)
*bWereAllSuccessful = false;
return false;
}
script->ProcessEvent(onready, &OnReadyParams);
} */
return true; return true;
} }
@@ -359,13 +403,53 @@ static inline void StartEvent()
auto EventScripting = GetEventScripting(); auto EventScripting = GetEventScripting();
LOG_INFO(LogDev, "EventScripting {}", __int64(EventScripting));
LOG_INFO(LogDev, "EventScripting Name {}", EventScripting->GetFullName());
// if (!EventScripting) // if (!EventScripting)
// return; // GetEventScripting handles the printing // return; // GetEventScripting handles the printing
CallOnReadys(); CallOnReadys();
if (Fortnite_Version == 17.30)
{
static bool (*IsServerOrSomething)(UObject * SpecialEventScript) = decltype(IsServerOrSomething)(__int64(GetModuleHandleW(0)) + 0x3DECFC8);
LOG_INFO(LogDev, "IsServerOrSomething {}", IsServerOrSomething(EventScripting));
static auto OnRep_RootStartTimeFn = FindObject<UFunction>("/Script/SpecialEventGameplayRuntime.SpecialEventScriptMeshActor.OnRep_RootStartTime");
static auto MeshRootStartEventFn = FindObject<UFunction>("/Script/SpecialEventGameplayRuntime.SpecialEventScriptMeshActor.MeshRootStartEvent");
auto SpecialEventScriptMeshActorClass = FindObject<UClass>("/Script/SpecialEventGameplayRuntime.SpecialEventScriptMeshActor");
auto AllSpecialEventScriptMeshActors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), SpecialEventScriptMeshActorClass);
if (AllSpecialEventScriptMeshActors.Num() > 0)
{
auto SpecialEventScriptMeshActor = AllSpecialEventScriptMeshActors.at(0);
if (SpecialEventScriptMeshActor)
{
static bool (*sub_7FF7E556D158)(UObject * MeshScriptActor) = decltype(sub_7FF7E556D158)(__int64(GetModuleHandleW(0)) + 0x3DED158);
LOG_INFO(LogDev, "sub_7FF7E556D158 {}", sub_7FF7E556D158(SpecialEventScriptMeshActor));
SpecialEventScriptMeshActor->ProcessEvent(MeshRootStartEventFn);
SpecialEventScriptMeshActor->ProcessEvent(OnRep_RootStartTimeFn);
return;
}
else
{
LOG_ERROR(LogEvent, "Failed to find SpecialEventScriptMeshActor");
}
}
else
{
LOG_ERROR(LogEvent, "AllSpecialEventScriptMeshActors.Num() == 0");
}
}
for (auto& StartEventFunc : OurEvent.StartEventFunctions) for (auto& StartEventFunc : OurEvent.StartEventFunctions)
{ {
LOG_INFO(LogDev, "Finding {}", StartEventFunc.first.second);
auto StartEventUFunc = FindObject<UFunction>(StartEventFunc.first.second); auto StartEventUFunc = FindObject<UFunction>(StartEventFunc.first.second);
if (!StartEventUFunc) if (!StartEventUFunc)

View File

@@ -50,16 +50,35 @@ static inline uintptr_t FindBytes(Memcury::Scanner& Scanner, const std::vector<u
static inline uint64 FindStaticFindObject() static inline uint64 FindStaticFindObject()
{ {
auto Addr = Memcury::Scanner::FindStringRef(L"Illegal call to StaticFindObject() while serializing object data!"); if (Engine_Version == 500)
{
return Memcury::Scanner::FindPattern("40 55 53 56 57 41 54 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 45 33 F6 4C 8B E1 45 0F B6 E9 49 8B F8 41 8B C6").Get();
}
if (Engine_Version >= 427) // ok so like the func is split up in ida idfk what to do about it
{
if (Fortnite_Version < 18)
return Memcury::Scanner::FindPattern("40 55 53 57 41 54 41 55 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85").Get();
else
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 60 45 33 ED 45 8A F9 44 38 2D ? ? ? ? 49 8B F8 48 8B").Get();
}
auto Addr = Memcury::Scanner::FindStringRef(L"Illegal call to StaticFindObject() while serializing object data!", true, 0, Engine_Version >= 427);
return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 255, 0, true); // Addr.ScanFor(bytes, false).Get(); return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 255, 0, true); // Addr.ScanFor(bytes, false).Get();
} }
static inline uint64 FindProcessEvent() static inline uint64 FindProcessEvent()
{
if (Fortnite_Version < 14)
{ {
auto Addr = Memcury::Scanner::FindStringRef(L"AccessNoneNoContext"); auto Addr = Memcury::Scanner::FindStringRef(L"AccessNoneNoContext");
return FindBytes(Addr, { 0x40, 0x55 }, 2000); // Addr.ScanFor({ 0x40, 0x55 }).Get(); return FindBytes(Addr, { 0x40, 0x55 }, 2000); // Addr.ScanFor({ 0x40, 0x55 }).Get();
} }
auto Addr = Memcury::Scanner::FindStringRef(L"UMeshNetworkComponent::ProcessEvent: Invalid mesh network node type: %s", true, 0, Engine_Version >= 500);
return Memcury::Scanner(FindBytes(Addr, { 0xE8 }, 2000, 0, false, Engine_Version < 500 ? 1 : 3)).RelativeOffset(1).Get(); // Addr.ScanFor({ 0x40, 0x55 }).Get();
}
static inline uint64 FindObjectArray() static inline uint64 FindObjectArray()
{ {
@@ -114,12 +133,24 @@ static inline uint64 FindKickPlayer()
static inline uint64 FindInitHost() static inline uint64 FindInitHost()
{ {
if (Engine_Version == 427) // idk im dumb
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 55 57 41 56 48 8D 6C 24 ? 48 81 EC ? ? ? ? 48 8B F1 4C 8D 05").Get();
auto Addr = Memcury::Scanner::FindStringRef(L"BeaconPort="); auto Addr = Memcury::Scanner::FindStringRef(L"BeaconPort=");
return FindBytes(Addr, { 0x48, 0x8B, 0xC4 }, 1000, 0, true); return FindBytes(Addr, (Engine_Version == 427 ? std::vector<uint8_t>{ 0x48, 0x8B, 0x5C } : std::vector<uint8_t>{ 0x48, 0x8B, 0xC4 }), 1000, 0, true);
} }
static inline uint64 FindPauseBeaconRequests() static inline uint64 FindPauseBeaconRequests()
{ {
if (Engine_Version == 500)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 33 ED 48 8B F1 84 D2 74 27 80 3D").Get();
if (Engine_Version == 427)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 30 33 F6 48 8B F9 84 D2 74").Get();
if (Engine_Version == 426)
return Memcury::Scanner::FindPattern("40 57 48 83 EC 30 48 8B F9 84 D2 74 62 80 3D").Get();
auto Addr = Memcury::Scanner::FindStringRef(L"All Beacon Requests Resumed."); auto Addr = Memcury::Scanner::FindStringRef(L"All Beacon Requests Resumed.");
return FindBytes(Addr, { 0x40, 0x53 }, 1000, 0, true); return FindBytes(Addr, { 0x40, 0x53 }, 1000, 0, true);
} }
@@ -132,6 +163,12 @@ static inline uint64 FindGetPlayerViewpoint()
static inline uint64 FindSpawnActor() static inline uint64 FindSpawnActor()
{ {
if (Engine_Version >= 427)
{
auto stat = Memcury::Scanner::FindStringRef(L"STAT_SpawnActorTime");
return FindBytes(stat, { 0x48, 0x8B, 0xC4 }, 3000, 0, true);
}
auto Addr = Memcury::Scanner::FindStringRef(L"SpawnActor failed because no class was specified"); auto Addr = Memcury::Scanner::FindStringRef(L"SpawnActor failed because no class was specified");
return FindBytes(Addr, { 0x4C, 0x8B, 0xDC }, 3000, 0, true); return FindBytes(Addr, { 0x4C, 0x8B, 0xDC }, 3000, 0, true);
} }
@@ -165,8 +202,14 @@ static inline uint64 FindSetWorld()
static inline uint64 FindInitListen() static inline uint64 FindInitListen()
{ {
if (Engine_Version == 500)
return Memcury::Scanner::FindPattern("4C 8B DC 49 89 5B 10 49 89 73 18 57 48 83 EC 50 48 8B BC 24 ?? ?? ?? ?? 49 8B F0 48 8B").Get();
if (Engine_Version >= 427)
return Memcury::Scanner::FindPattern("4C 8B DC 49 89 5B 08 49 89 73 10 57 48 83 EC 50 48 8B BC 24 ? ? ? ? 49 8B F0 48 8B 01 48 8B").Get();
auto Addr = Memcury::Scanner::FindStringRef(L"%s IpNetDriver listening on port %i"); auto Addr = Memcury::Scanner::FindStringRef(L"%s IpNetDriver listening on port %i");
return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 2000, 0, true, 1); return FindBytes(Addr, Engine_Version < 427 ? std::vector<uint8_t>{ 0x48, 0x89, 0x5C } : std::vector<uint8_t>{ 0x4C, 0x8B, 0xDC }, 2000, 0, true, 1);
} }
static inline uint64 FindOnDamageServer() static inline uint64 FindOnDamageServer()
@@ -186,6 +229,13 @@ static inline uint64 FindNoMCP()
if (Fortnite_Version == 4) if (Fortnite_Version == 4)
return Memcury::Scanner::FindPattern("E8 ? ? ? ? 83 A7 ? ? ? ? ? 83 E0 01").RelativeOffset(1).Get(); return Memcury::Scanner::FindPattern("E8 ? ? ? ? 83 A7 ? ? ? ? ? 83 E0 01").RelativeOffset(1).Get();
if (Fortnite_Version >= 17)
{
// todo make this relative
// 19.10
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 54 41 55 41 56 41 57 48 83 EC 20 65 48 8B 04 25 ? ? ? ? BA ? ? ? ? 48 8B 08 8B 04 0A 39 05 ? ? ? ? 7F 23 8A 05 ? ? ? ? 48 8B 5C 24 ? 48 8B 6C 24 ? 48 8B 74 24 ? 48 83 C4 20 41 5F 41 5E 41 5D 41 5C 5F C3 48 8D 0D ? ? ? ? E8 ? ? ? ? 83 3D ? ? ? ? ? 75 C8 E8 ? ? ? ? 45 33").Get();
}
if (Engine_Version == 421 || Engine_Version == 422) if (Engine_Version == 421 || Engine_Version == 422)
return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 CE").RelativeOffset(1).Get(); return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 CE").RelativeOffset(1).Get();
@@ -198,6 +248,9 @@ static inline uint64 FindNoMCP()
if (Engine_Version == 426) if (Engine_Version == 426)
return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 10 84 DB").RelativeOffset(1).Get(); return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 10 84 DB").RelativeOffset(1).Get();
if (Engine_Version == 427)
return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 74 F0").RelativeOffset(1).Get();
// return (uintptr_t)GetModuleHandleW(0) + 0x1791CF0; // 11.01 // return (uintptr_t)GetModuleHandleW(0) + 0x1791CF0; // 11.01
return 0; return 0;
// return (uintptr_t)GetModuleHandleW(0) + 0x161d600; // 10.40 // return (uintptr_t)GetModuleHandleW(0) + 0x161d600; // 10.40
@@ -213,6 +266,12 @@ static inline uint64 FindCollectGarbage()
static inline uint64 FindActorGetNetMode() static inline uint64 FindActorGetNetMode()
{ {
if (Engine_Version == 500)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 F6 41 08 10 48 8B D9 0F 85 ? ? ? ? 48 8B 41 20 48 85 C0 0F 84 ? ? ? ? F7 40").Get();
if (Engine_Version == 427)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 48 8B D9 E8 ? ? ? ? 48 8B 93 ? ? ? ? 48 8B C8 48 8B F8 E8 ? ? ? ? 48 85 C0 75 29").Get();
auto AActorGetNetmode = Memcury::Scanner::FindStringRef(L"ClientPlayerLeft %s") auto AActorGetNetmode = Memcury::Scanner::FindStringRef(L"ClientPlayerLeft %s")
.ScanFor({ 0x48, 0x8B, 0xCF, 0xE8 }) .ScanFor({ 0x48, 0x8B, 0xCF, 0xE8 })
.RelativeOffset(4) .RelativeOffset(4)
@@ -223,12 +282,23 @@ static inline uint64 FindActorGetNetMode()
static inline uint64 FindTickFlush() static inline uint64 FindTickFlush()
{ {
if (Engine_Version == 427)
return Memcury::Scanner::FindPattern("48 8B C4 48 89 58 18 55 56 57 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 70 B8 0F 29 78 A8 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 8A").Get();
auto Addr = Memcury::Scanner::FindStringRef(L"STAT_NetTickFlush"); auto Addr = Memcury::Scanner::FindStringRef(L"STAT_NetTickFlush");
return FindBytes(Addr, { 0x4C, 0x8B }, 1000, 0, true); return FindBytes(Addr, (Fortnite_Version < 18 ? std::vector<uint8_t>{ 0x4C, 0x8B } : std::vector<uint8_t>{ 0x48, 0x8B, 0xC4 }), 1000, 0, true);
} }
static inline uint64 FindGIsServer() static inline uint64 FindGIsServer()
{ {
if (Fortnite_Version == 19.10)
return __int64(GetModuleHandleW(0)) + 0xB30CF9D;
if (Fortnite_Version == 17.30)
return __int64(GetModuleHandleW(0)) + 0x973E499;
return 0;
auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering"); auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering");
auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, 1); auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, 1);
Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, 1); Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, 1);
@@ -238,12 +308,28 @@ static inline uint64 FindGIsServer()
static inline uint64 FindChangeGameSessionId() static inline uint64 FindChangeGameSessionId()
{ {
if (Engine_Version == 500)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 50 4C 8B FA 48 8B F1 E8").Get();
if (Engine_Version >= 427)
{
if (Fortnite_Version < 18)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 70 4C 8B FA 4C").Get();
else
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 70 4C 8B FA 4C").Get();
}
auto Addr = Memcury::Scanner::FindStringRef(L"Changing GameSessionId from '%s' to '%s'"); auto Addr = Memcury::Scanner::FindStringRef(L"Changing GameSessionId from '%s' to '%s'");
return FindBytes(Addr, { 0x40, 0x55 }, 2000, 0, true); return FindBytes(Addr, { 0x40, 0x55 }, 2000, 0, true);
} }
static inline uint64 FindGIsClient() static inline uint64 FindGIsClient()
{ {
if (Fortnite_Version == 17.30)
return __int64(GetModuleHandleW(0)) + 0x973E49B;
return 0;
auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering"); auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering");
auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, 2); auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, 2);
Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, 2); Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, 2);
@@ -269,6 +355,9 @@ static inline uint64 FindGetNetMode()
static inline uint64 FindRealloc() static inline uint64 FindRealloc()
{ {
if (Engine_Version >= 427)
return Memcury::Scanner::FindPattern("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC ? 48 8B F1 41 8B D8 48 8B 0D ? ? ? ").Get();
auto Addr = Memcury::Scanner::FindStringRef(L"a.Budget.BudgetMs", false); auto Addr = Memcury::Scanner::FindStringRef(L"a.Budget.BudgetMs", false);
if (!Addr.Get()) if (!Addr.Get())
@@ -296,7 +385,7 @@ static inline uint64 FindPickTeam()
static inline uint64 FindInternalTryActivateAbility() static inline uint64 FindInternalTryActivateAbility()
{ {
auto Addr = Memcury::Scanner::FindStringRef(L"InternalTryActivateAbility called with invalid Handle! ASC: %s. AvatarActor: %s"); auto Addr = Memcury::Scanner::FindStringRef(L"InternalTryActivateAbility called with invalid Handle! ASC: %s. AvatarActor: %s", true, 0, Fortnite_Version >= 18);
return FindBytes(Addr, { 0x4C, 0x89, 0x4C }, 1000, 0, true); return FindBytes(Addr, { 0x4C, 0x89, 0x4C }, 1000, 0, true);
} }
@@ -310,9 +399,10 @@ static inline uint64 FindGiveAbility()
static inline uint64 FindGiveAbilityAndActivateOnce() static inline uint64 FindGiveAbilityAndActivateOnce()
{ {
auto Addr = Memcury::Scanner::FindStringRef(L"GiveAbilityAndActivateOnce called on ability %s on the client, not allowed!"); auto Addr = Memcury::Scanner::FindStringRef(L"GiveAbilityAndActivateOnce called on ability %s on the client, not allowed!", true, 0, Engine_Version >= 500);
auto res = FindBytes(Addr, { 0x48, 0x89, 0x5C }, 1000, 0, true);
return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 1000, 0, true); return res;
} }
static inline uint64 FindCantBuild() static inline uint64 FindCantBuild()
@@ -320,7 +410,13 @@ static inline uint64 FindCantBuild()
auto add = Memcury::Scanner::FindPattern("48 89 5C 24 10 48 89 6C 24 18 48 89 74 24 20 41 56 48 83 EC ? 49 8B E9 4D 8B F0", false).Get(); auto add = Memcury::Scanner::FindPattern("48 89 5C 24 10 48 89 6C 24 18 48 89 74 24 20 41 56 48 83 EC ? 49 8B E9 4D 8B F0", false).Get();
if (!add) if (!add)
add = Memcury::Scanner::FindPattern("48 89 54 24 ? 55 56 41 56 48 83 EC 50").Get(); // 4.20 add = Memcury::Scanner::FindPattern("48 89 54 24 ? 55 56 41 56 48 83 EC 50", false).Get(); // 4.20
if (!add)
add = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC 60 4D 8B F1 4D 8B F8", false).Get(); // 4.26.1
if (!add)
add = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC 60 49 8B E9 4D 8B F8 48 8B DA 48 8B F9 BE ? ? ? ? 48").Get(); // 5.00
return add; return add;

View File

@@ -201,6 +201,12 @@ namespace Hooking
if (!Function) if (!Function)
return false; return false;
if (!DefaultClass || !DefaultClass->VFTable)
{
LOG_WARN(LogHook, "DefaultClass or the vtable is null! ({})", __int64(DefaultClass));
return false;
}
auto Exec = Function->GetFunc(); auto Exec = Function->GetFunc();
if (bHookExec) if (bHookExec)

View File

@@ -67,6 +67,8 @@ inline void InitLogger()
MakeLogger("LogHook"); MakeLogger("LogHook");
MakeLogger("LogAbilities"); MakeLogger("LogAbilities");
MakeLogger("LogEvent"); MakeLogger("LogEvent");
MakeLogger("LogPlaylist");
MakeLogger("LogGame");
} }
#define LOG_DEBUG(loggerName, ...) \ #define LOG_DEBUG(loggerName, ...) \

42
vendor/memcury.h vendored
View File

@@ -753,7 +753,7 @@
return Scanner(add); return Scanner(add);
} }
static auto FindPointerRef(void* Pointer) -> Scanner // credit ender static auto FindPointerRef(void* Pointer) -> Scanner // credit me and ender
{ {
PE::Address add{ nullptr }; PE::Address add{ nullptr };
@@ -771,19 +771,31 @@
add = PE::Address(&scanBytes[i]); add = PE::Address(&scanBytes[i]);
} }
} }
if (scanBytes[i] == ASM::CALL)
{
if (PE::Address(&scanBytes[i]).RelativeOffset(1).GetAs<void*>() == Pointer)
{
add = PE::Address(&scanBytes[i]);
}
}
} }
if (add == 0) if (add == 0)
{ {
MessageBoxA(0, "FindPointerRef return nullptr", "Memcury", MB_OK); MessageBoxA(0, "FindPointerRef return nullptr", "Memcury", MB_OK);
} }
else
{
// MessageBoxA(0, std::format("FindPointerRef return 0x{:x}", add.Get() - __int64(GetModuleHandleW(0))).c_str(), "Memcury", MB_OK);
}
return Scanner(add); return Scanner(add);
} }
// Supports wide and normal strings both std and pointers // Supports wide and normal strings both std and pointers
template <typename T = const wchar_t*> template <typename T = const wchar_t*>
static auto FindStringRef(T string, bool bWarnIfNotFound = true, int useRefNum = 0) -> Scanner static auto FindStringRef(T string, bool bWarnIfNotFound = true, int useRefNum = 0, bool bIsInFunc = false) -> Scanner
{ {
PE::Address add{ nullptr }; PE::Address add{ nullptr };
@@ -878,6 +890,26 @@
} }
} }
if (add.Get())
{
if (bIsInFunc)
{
for (int i = 0; i < 300; i++)
{
if (*(uint8_t*)(add.Get() - i) == 0x48 && *(uint8_t*)(add.Get() - i + 1) == 0x83)
{
// MessageBoxA(0, std::format("0x{:x}", (__int64(add.Get() - i) - __int64(GetModuleHandleW(0)))).c_str(), "Memcury", MB_OK);
auto beginFunc = Scanner(add.Get() - i);
auto ref = FindPointerRef(beginFunc.GetAs<void*>());
return ref;
}
}
}
}
return Scanner(add); return Scanner(add);
} }
@@ -1331,15 +1363,15 @@
return true; return true;
} }
inline void VirtualSwap(void** VTable, int Idx, void* NewFunc) static void VirtualSwap(void** VTable, int Idx, void* NewFunc)
{ {
DWORD dwProtection; DWORD dwProtection;
VirtualProtect(VTable, (Idx + 8), PAGE_EXECUTE_READWRITE, &dwProtection); VirtualProtect(&VTable[Idx], 8, PAGE_EXECUTE_READWRITE, &dwProtection);
VTable[Idx] = NewFunc; VTable[Idx] = NewFunc;
DWORD dwTemp; DWORD dwTemp;
VirtualProtect(VTable, (Idx + 8), dwProtection, &dwTemp); VirtualProtect(&VTable[Idx], 8, dwProtection, &dwTemp);
} }
// Finds a string ref, then goes searches xref of the function that it's in and returns that address. // Finds a string ref, then goes searches xref of the function that it's in and returns that address.