dispatch request

This commit is contained in:
Milxnor
2023-03-08 01:39:09 -05:00
parent eb3685c070
commit 1fd8f0f93f
43 changed files with 1048 additions and 224 deletions

View File

@@ -7,14 +7,14 @@ struct PadHex18 { char Pad[0x18]; };
struct PadHexA8 { char Pad[0xA8]; }; struct PadHexA8 { char Pad[0xA8]; };
struct PadHexB0 { char Pad[0xB0]; }; struct PadHexB0 { char Pad[0xB0]; };
using FPredictionKey = PadHex18; using FPredictionKey = __int64; // PadHex18;
using FGameplayEventData = PadHexB0; using FGameplayEventData = __int64; // PadHexB0;
class UAbilitySystemComponent : public UObject class UAbilitySystemComponent : public UObject
{ {
public: public:
static inline FGameplayAbilitySpecHandle* (*GiveAbilityOriginal)(UAbilitySystemComponent*, FGameplayAbilitySpecHandle*, __int64 inSpec); static inline FGameplayAbilitySpecHandle* (*GiveAbilityOriginal)(UAbilitySystemComponent*, FGameplayAbilitySpecHandle*, __int64 inSpec);
static inline bool (*InternalTryActivateAbilityOriginal)(UAbilitySystemComponent*, FGameplayAbilitySpecHandle Handle, PadHex18 InPredictionKey, UObject** OutInstancedAbility, void* OnGameplayAbilityEndedDelegate, const FGameplayEventData* TriggerEventData); static inline bool (*InternalTryActivateAbilityOriginal)(UAbilitySystemComponent*, FGameplayAbilitySpecHandle Handle, __int64 InPredictionKey, UObject** OutInstancedAbility, void* OnGameplayAbilityEndedDelegate, const FGameplayEventData* TriggerEventData);
void ClientActivateAbilityFailed(FGameplayAbilitySpecHandle AbilityToActivate, int16_t PredictionKey) void ClientActivateAbilityFailed(FGameplayAbilitySpecHandle AbilityToActivate, int16_t PredictionKey)
{ {

View File

@@ -46,7 +46,7 @@ void InternalServerTryActivateAbility(UAbilitySystemComponent* AbilitySystemComp
UGameplayAbility* InstancedAbility = nullptr; UGameplayAbility* InstancedAbility = nullptr;
SetBitfield(Spec, 1, true); // InputPressed = true SetBitfield(Spec, 1, true); // InputPressed = true
if (!AbilitySystemComponent->InternalTryActivateAbilityOriginal(AbilitySystemComponent, Handle, *(PadHex18*)PredictionKey, &InstancedAbility, nullptr, TriggerEventData)) if (!AbilitySystemComponent->InternalTryActivateAbilityOriginal(AbilitySystemComponent, Handle, __int64(PredictionKey), &InstancedAbility, nullptr, TriggerEventData))
{ {
AbilitySystemComponent->ClientActivateAbilityFailed(Handle, *(int16_t*)(__int64(PredictionKey) + CurrentOffset)); AbilitySystemComponent->ClientActivateAbilityFailed(Handle, *(int16_t*)(__int64(PredictionKey) + CurrentOffset));
SetBitfield(Spec, 1, false); // InputPressed = false SetBitfield(Spec, 1, false); // InputPressed = false

View File

@@ -29,6 +29,20 @@ void AActor::K2_DestroyActor()
this->ProcessEvent(DestroyActorFn); this->ProcessEvent(DestroyActorFn);
} }
UActorComponent* AActor::GetComponentByClass(class UClass* ComponentClass)
{
static auto fn = FindObject<UFunction>("/Script/Engine.Actor.GetComponentByClass");
struct
{
class UClass* ComponentClass; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic)
UActorComponent* ReturnValue; // (ExportObject, Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
} AActor_GetComponentByClass_Params{ComponentClass};
this->ProcessEvent(fn, &AActor_GetComponentByClass_Params);
return AActor_GetComponentByClass_Params.ReturnValue;
}
FVector AActor::GetActorLocation() FVector AActor::GetActorLocation()
{ {
static auto K2_GetActorLocationFn = FindObject<UFunction>("/Script/Engine.Actor.K2_GetActorLocation"); static auto K2_GetActorLocationFn = FindObject<UFunction>("/Script/Engine.Actor.K2_GetActorLocation");

View File

@@ -10,4 +10,5 @@ public:
AActor* GetOwner(); AActor* GetOwner();
struct FVector GetActorLocation(); struct FVector GetActorLocation();
void K2_DestroyActor(); void K2_DestroyActor();
class UActorComponent* GetComponentByClass(class UClass* ComponentClass);
}; };

View File

@@ -105,6 +105,7 @@ public:
{ {
if (Data && ArrayNum > 0 && sizeof(InElementType) > 0) if (Data && ArrayNum > 0 && sizeof(InElementType) > 0)
{ {
// VirtualFree(Data, _msize(Data), MEM_RELEASE);
VirtualFree(Data, sizeof(InElementType) * ArrayNum, MEM_RELEASE); VirtualFree(Data, sizeof(InElementType) * ArrayNum, MEM_RELEASE);
} }

View File

@@ -30,6 +30,12 @@ public:
return MaxHealth; return MaxHealth;
} }
void SetTeam(unsigned char InTeam)
{
static auto fn = FindObject<UFunction>("/Script/FortniteGame.BuildingActor.SetTeam");
this->ProcessEvent(fn, &InTeam);
}
static inline void (*OnDamageServerOriginal)(ABuildingActor* BuildingActor, float Damage, FGameplayTagContainer DamageTags, static inline void (*OnDamageServerOriginal)(ABuildingActor* BuildingActor, float Damage, FGameplayTagContainer DamageTags,
FVector Momentum, /* FHitResult */ __int64 HitInfo, APlayerController* InstigatedBy, AActor* DamageCauser, FVector Momentum, /* FHitResult */ __int64 HitInfo, APlayerController* InstigatedBy, AActor* DamageCauser,
/* FGameplayEffectContextHandle */ __int64 EffectContext); /* FGameplayEffectContextHandle */ __int64 EffectContext);

View File

@@ -25,5 +25,5 @@ public:
class UFunction : public UStruct class UFunction : public UStruct
{ {
public: public:
void* GetFunc() { return *(void**)(__int64(this) + Offsets::Func); } void*& GetFunc() { return *(void**)(__int64(this) + Offsets::Func); }
}; };

View File

@@ -0,0 +1,66 @@
#pragma once
#include "BuildingActor.h"
struct FCreativeLoadedLinkData
{
};
class AFortAthenaCreativePortal : public ABuildingActor // ABuildingGameplayActor
{
public:
FCreativeLoadedLinkData* GetIslandInfo()
{
static auto CreativeLoadedLinkDataStruct = FindObject<UStruct>("/Script/FortniteGame.CreativeLoadedLinkData");
if (!CreativeLoadedLinkDataStruct)
return nullptr;
static auto IslandInfoOffset = GetOffset("IslandInfo");
return GetPtr<FCreativeLoadedLinkData>(IslandInfoOffset);
}
void* GetOwningPlayer()
{
static auto OwningPlayerOffset = GetOffset("OwningPlayer");
return GetPtr<void>(OwningPlayerOffset);
}
bool& GetPortalOpen()
{
static auto bPortalOpenOffset = GetOffset("bPortalOpen");
return Get<bool>(bPortalOpenOffset);
}
bool& GetUserInitiatedLoad()
{
static auto bUserInitiatedLoadOffset = GetOffset("bUserInitiatedLoad");
return Get<bool>(bUserInitiatedLoadOffset);
}
bool& GetInErrorState()
{
static auto bInErrorStateOffset = GetOffset("bInErrorState");
return Get<bool>(bInErrorStateOffset);
}
AFortVolume*& GetLinkedVolume()
{
static auto LinkedVolumeOffset = GetOffset("LinkedVolume");
return Get<AFortVolume*>(LinkedVolumeOffset);
}
FString& GetCreatorName()
{
auto IslandInfo = GetIslandInfo();
if (!IslandInfo)
{
return *(FString*)0;
}
static auto CreatorNameOffset = FindOffsetStruct("/Script/FortniteGame.CreativeLoadedLinkData", "CreatorName");
return *(FString*)(__int64(IslandInfo) + CreatorNameOffset);
}
};

View File

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

View File

@@ -1,15 +1,23 @@
#include "FortGameModeAthena.h" #include "FortGameModeAthena.h"
#include "reboot.h"
#include "NetSerialization.h"
#include "FortPlayerControllerAthena.h" #include "FortPlayerControllerAthena.h"
#include "FortPlaysetItemDefinition.h"
#include "FortAthenaCreativePortal.h"
#include "BuildingContainer.h"
#include "MegaStormManager.h"
#include "FortLootPackage.h"
#include "FortPlayerPawn.h"
#include "FortPickup.h"
#include "NetSerialization.h"
#include "GameplayStatics.h" #include "GameplayStatics.h"
#include "KismetStringLibrary.h" #include "KismetStringLibrary.h"
#include "SoftObjectPtr.h" #include "SoftObjectPtr.h"
#include "FortPickup.h"
#include "FortLootPackage.h" #include "globals.h"
#include "BuildingContainer.h"
#include "events.h" #include "events.h"
#include "reboot.h"
#include "ai.h"
static bool bFirstPlayerJoined = false; static bool bFirstPlayerJoined = false;
@@ -189,6 +197,21 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_FloatingIsland")); FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_FloatingIsland"));
ShowFoundation(FloatingIsland); ShowFoundation(FloatingIsland);
UObject* Scripting = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.BP_IslandScripting3"); // bruh
if (Scripting)
{
static auto UpdateMapOffset = Scripting->GetOffset("UpdateMap", false);
if (UpdateMapOffset != 0)
{
Scripting->Get<bool>(UpdateMapOffset) = true;
static auto OnRep_UpdateMap = FindObject<UFunction>("/Game/Athena/Prototype/Blueprints/Island/BP_IslandScripting.BP_IslandScripting_C.OnRep_UpdateMap");
Scripting->ProcessEvent(OnRep_UpdateMap);
}
}
} }
if (Fortnite_Season >= 7 && Fortnite_Season <= 10) if (Fortnite_Season >= 7 && Fortnite_Season <= 10)
@@ -308,10 +331,14 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
{ {
// auto World = Cast<UWorld>(Playlist->AdditionalLevels[i].Get()); // auto World = Cast<UWorld>(Playlist->AdditionalLevels[i].Get());
// StreamLevel(UKismetSystemLibrary::GetPathName(World->PersistentLevel).ToString()); // StreamLevel(UKismetSystemLibrary::GetPathName(World->PersistentLevel).ToString());
StreamLevel(AdditionalLevels.at(i).SoftObjectPtr.ObjectID.AssetPathName.ToString()); auto LevelName = AdditionalLevels.at(i).SoftObjectPtr.ObjectID.AssetPathName.ToString();
LOG_INFO(LogPlaylist, "Loading level {}.", LevelName);
StreamLevel(LevelName);
} }
} }
} }
SetBitfield(GameMode->GetPtr<PlaceholderBitfield>("bWorldIsReady"), 1, true);
} }
static int LastNum6 = 1; static int LastNum6 = 1;
@@ -373,22 +400,6 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
static auto FlightInfosOffset = MapInfo->GetOffset("FlightInfos"); static auto FlightInfosOffset = MapInfo->GetOffset("FlightInfos");
static int LastNum3 = 1;
if (AmountOfRestarts != LastNum3)
{
LastNum3 = AmountOfRestarts;
LOG_INFO(LogNet, "Attempting to listen!");
GetWorld()->Listen();
SetBitfield(GameMode->GetPtr<PlaceholderBitfield>("bWorldIsReady"), 1, true);
// GameState->OnRep_CurrentPlaylistInfo();
// return false;
}
// if (GameState->GetPlayersLeft() < GameMode->Get<int>("WarmupRequiredPlayerCount")) // if (GameState->GetPlayersLeft() < GameMode->Get<int>("WarmupRequiredPlayerCount"))
// if (!bFirstPlayerJoined) // if (!bFirstPlayerJoined)
// return false; // return false;
@@ -399,7 +410,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
{ {
LastNum = AmountOfRestarts; LastNum = AmountOfRestarts;
float Duration = 40.f; float Duration = 1000.f;
float EarlyDuration = Duration; float EarlyDuration = Duration;
float TimeSeconds = 35.f; // UGameplayStatics::GetTimeSeconds(GetWorld()); float TimeSeconds = 35.f; // UGameplayStatics::GetTimeSeconds(GetWorld());
@@ -412,9 +423,28 @@ 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;
auto AllMegaStormManagers = UGameplayStatics::GetAllActorsOfClass(GetWorld(), GameMode->Get<UClass*>("MegaStormManagerClass"));
LOG_INFO(LogDev, "AllMegaStormManagers.Num() {}", AllMegaStormManagers.Num());
if (AllMegaStormManagers.Num())
{
auto MegaStormManager = (AMegaStormManager*)AllMegaStormManagers.at(0); // GameMode->Get<AMegaStormManager*>(MegaStormManagerOffset);
LOG_INFO(LogDev, "MegaStormManager {}", __int64(MegaStormManager));
if (MegaStormManager)
{
LOG_INFO(LogDev, "MegaStormManager->GetMegaStormCircles().Num() {}", MegaStormManager->GetMegaStormCircles().Num());
}
}
// GameState->Get<bool>("bGameModeWillSkipAircraft") = Globals::bGoingToPlayEvent && Fortnite_Version == 17.30; // GameState->Get<bool>("bGameModeWillSkipAircraft") = Globals::bGoingToPlayEvent && Fortnite_Version == 17.30;
// GameState->OnRep_CurrentPlaylistInfo(); if (Engine_Version < 424)
GameState->OnRep_CurrentPlaylistInfo(); // ?
// SetupNavConfig();
LOG_INFO(LogDev, "Initialized!"); LOG_INFO(LogDev, "Initialized!");
} }
@@ -428,6 +458,27 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
} }
} }
/* static auto TeamsOffset = GameState->GetOffset("Teams");
auto& Teams = GameState->Get<TArray<UObject*>>(TeamsOffset);
if (Teams.Num() <= 0)
return false; */
static int LastNum3 = 1;
if (AmountOfRestarts != LastNum3)
{
LastNum3 = AmountOfRestarts;
LOG_INFO(LogNet, "Attempting to listen!");
GetWorld()->Listen();
// GameState->OnRep_CurrentPlaylistInfo();
// return false;
}
return Athena_ReadyToStartMatchOriginal(GameMode); return Athena_ReadyToStartMatchOriginal(GameMode);
} }
@@ -437,23 +488,13 @@ int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint
return ++NextTeamIndex; return ++NextTeamIndex;
} }
enum class EFortCustomPartType : uint8_t // todo move
{
Head = 0,
Body = 1,
Hat = 2,
Backpack = 3,
Charm = 4,
Face = 5,
NumTypes = 6,
EFortCustomPartType_MAX = 7
};
void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena* GameMode, AActor* NewPlayerActor) void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena* GameMode, AActor* NewPlayerActor)
{ {
if (!NewPlayerActor) if (!NewPlayerActor)
return; return;
LOG_INFO(LogPlayer, "HandleStartingNewPlayer!");
static bool bFirst = Engine_Version >= 424; static bool bFirst = Engine_Version >= 424;
auto GameState = GameMode->GetGameStateAthena(); auto GameState = GameMode->GetGameStateAthena();
@@ -466,6 +507,8 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
GameState->OnRep_GamePhase(); GameState->OnRep_GamePhase();
} }
if (false)
{
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");
@@ -532,31 +575,14 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
AFortPickup::SpawnPickup(LootDrop.first, Location, LootDrop.second, SpawnFlag); AFortPickup::SpawnPickup(LootDrop.first, Location, LootDrop.second, SpawnFlag);
} }
} }
}
auto NewPlayer = (AFortPlayerControllerAthena*)NewPlayerActor; auto NewPlayer = (AFortPlayerControllerAthena*)NewPlayerActor;
auto WorldInventory = NewPlayer->GetWorldInventory();
static UFortItemDefinition* EditToolItemDefinition = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/EditTool.EditTool");
static UFortItemDefinition* PickaxeDefinition = FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Weapons/WID_Harvest_Pickaxe_Athena_C_T01.WID_Harvest_Pickaxe_Athena_C_T01");
static UFortItemDefinition* BuildingItemData_Wall = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Wall.BuildingItemData_Wall");
static UFortItemDefinition* BuildingItemData_Floor = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Floor.BuildingItemData_Floor");
static UFortItemDefinition* BuildingItemData_Stair_W = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Stair_W.BuildingItemData_Stair_W");
static UFortItemDefinition* BuildingItemData_RoofS = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_RoofS.BuildingItemData_RoofS");
static UFortItemDefinition* WoodItemData = FindObject<UFortItemDefinition>(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData");
WorldInventory->AddItem(EditToolItemDefinition, nullptr);
WorldInventory->AddItem(BuildingItemData_Wall, nullptr);
WorldInventory->AddItem(BuildingItemData_Floor, nullptr);
WorldInventory->AddItem(BuildingItemData_Stair_W, nullptr);
WorldInventory->AddItem(BuildingItemData_RoofS, nullptr);
WorldInventory->AddItem(PickaxeDefinition, nullptr);
WorldInventory->AddItem(WoodItemData, nullptr, 100);
WorldInventory->Update(true);
auto PlayerStateAthena = NewPlayer->GetPlayerStateAthena(); auto PlayerStateAthena = NewPlayer->GetPlayerStateAthena();
if (Globals::bNoMCP)
{
static auto CharacterPartsOffset = PlayerStateAthena->GetOffset("CharacterParts", false); static auto CharacterPartsOffset = PlayerStateAthena->GetOffset("CharacterParts", false);
if (CharacterPartsOffset != 0) if (CharacterPartsOffset != 0)
@@ -575,6 +601,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
static auto OnRep_CharacterPartsFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerState.OnRep_CharacterParts"); static auto OnRep_CharacterPartsFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerState.OnRep_CharacterParts");
PlayerStateAthena->ProcessEvent(OnRep_CharacterPartsFn); PlayerStateAthena->ProcessEvent(OnRep_CharacterPartsFn);
} }
}
PlayerStateAthena->GetSquadId() = PlayerStateAthena->GetTeamIndex() - 2; PlayerStateAthena->GetSquadId() = PlayerStateAthena->GetTeamIndex() - 2;
@@ -629,21 +656,23 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
static auto GameMemberInfoArrayOffset = GameState->GetOffset("GameMemberInfoArray", false); static auto GameMemberInfoArrayOffset = GameState->GetOffset("GameMemberInfoArray", false);
// if (false) struct FUniqueNetIdReplExperimental
// if (GameMemberInfoArrayOffset != 0)
if (Engine_Version >= 423)
{
struct FUniqueNetIdRepl
{ {
unsigned char ahh[0x0028]; unsigned char ahh[0x0028];
}; };
auto& PlayerStateUniqueId = PlayerStateAthena->Get<FUniqueNetIdReplExperimental>("UniqueId");
// if (false)
// if (GameMemberInfoArrayOffset != 0)
if (Engine_Version >= 423)
{
struct FGameMemberInfo : public FFastArraySerializerItem struct FGameMemberInfo : public FFastArraySerializerItem
{ {
unsigned char SquadId; // 0x000C(0x0001) (ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) unsigned char SquadId; // 0x000C(0x0001) (ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
unsigned char TeamIndex; // 0x000D(0x0001) (ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) unsigned char TeamIndex; // 0x000D(0x0001) (ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
unsigned char UnknownData00[0x2]; // 0x000E(0x0002) MISSED OFFSET unsigned char UnknownData00[0x2]; // 0x000E(0x0002) MISSED OFFSET
FUniqueNetIdRepl MemberUniqueId; // 0x0010(0x0028) (HasGetValueTypeHash, NativeAccessSpecifierPublic) FUniqueNetIdReplExperimental MemberUniqueId; // 0x0010(0x0028) (HasGetValueTypeHash, NativeAccessSpecifierPublic)
}; };
static auto GameMemberInfoStructSize = 0x38; static auto GameMemberInfoStructSize = 0x38;
@@ -671,7 +700,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
{ {
GameMemberInfo->SquadId = PlayerStateAthena->GetSquadId(); GameMemberInfo->SquadId = PlayerStateAthena->GetSquadId();
GameMemberInfo->TeamIndex = PlayerStateAthena->GetTeamIndex(); GameMemberInfo->TeamIndex = PlayerStateAthena->GetTeamIndex();
GameMemberInfo->MemberUniqueId = PlayerStateAthena->Get<FUniqueNetIdRepl>("UniqueId"); GameMemberInfo->MemberUniqueId = PlayerStateUniqueId;
} }
static auto GameMemberInfoArray_MembersOffset = FindOffsetStruct("/Script/FortniteGame.GameMemberInfoArray", "Members"); static auto GameMemberInfoArray_MembersOffset = FindOffsetStruct("/Script/FortniteGame.GameMemberInfoArray", "Members");
@@ -682,5 +711,44 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
GameMemberInfoArray->MarkArrayDirty(); GameMemberInfoArray->MarkArrayDirty();
} }
if (Globals::bCreative)
{
static auto CreativePortalManagerOffset = GameState->GetOffset("CreativePortalManager");
auto CreativePortalManager = GameState->Get(CreativePortalManagerOffset);
static auto AvailablePortalsOffset = CreativePortalManager->GetOffset("AvailablePortals");
auto& AvailablePortals = CreativePortalManager->Get<TArray<AActor*>>(AvailablePortalsOffset);
auto Portal = (AFortAthenaCreativePortal*)AvailablePortals.at(0);
AvailablePortals.Remove(0);
static auto UsedPortalsOffset = CreativePortalManager->GetOffset("UsedPortals");
auto& UsedPortals = CreativePortalManager->Get<TArray<AActor*>>(UsedPortalsOffset);
UsedPortals.Add(Portal);
// Portal->GetCreatorName() = PlayerStateAthena->GetPlayerName();
*(FUniqueNetIdReplExperimental*)Portal->GetOwningPlayer() = PlayerStateUniqueId;
Portal->GetPortalOpen() = true;
static auto PlayersReadyOffset = Portal->GetOffset("PlayersReady");
auto& PlayersReady = Portal->Get<TArray<FUniqueNetIdReplExperimental>>(PlayersReadyOffset);
PlayersReady.Add(PlayerStateUniqueId);
Portal->GetUserInitiatedLoad() = true;
Portal->GetInErrorState() = false;
static auto OwnedPortalOffset = NewPlayer->GetOffset("OwnedPortal");
NewPlayer->Get<AFortAthenaCreativePortal*>(OwnedPortalOffset) = Portal;
static auto CreativePlotLinkedVolumeOffset = NewPlayer->GetOffset("CreativePlotLinkedVolume");
NewPlayer->Get<AFortVolume*>(CreativePlotLinkedVolumeOffset) = Portal->GetLinkedVolume();
Portal->GetLinkedVolume()->GetVolumeState() = EVolumeState::Ready;
static auto IslandPlayset = FindObject<UFortPlaysetItemDefinition>("/Game/Playsets/PID_Playset_60x60_Composed.PID_Playset_60x60_Composed");
UFortPlaysetItemDefinition::ShowPlayset(IslandPlayset, Portal->GetLinkedVolume());
}
return Athena_HandleStartingNewPlayerOriginal(GameMode, NewPlayerActor); return Athena_HandleStartingNewPlayerOriginal(GameMode, NewPlayerActor);
} }

View File

@@ -2,6 +2,11 @@
#include "reboot.h" #include "reboot.h"
/* void AFortGameStateAthena::AddPlayerStateToGameMemberInfo(class AFortPlayerStateAthena* PlayerState)
{
} */
void AFortGameStateAthena::OnRep_GamePhase() void AFortGameStateAthena::OnRep_GamePhase()
{ {
EAthenaGamePhase OldGamePhase = GetGamePhase(); EAthenaGamePhase OldGamePhase = GetGamePhase();

View File

@@ -29,6 +29,7 @@ public:
return Get<EAthenaGamePhase>(GamePhaseOffset); return Get<EAthenaGamePhase>(GamePhaseOffset);
} }
// void AddPlayerStateToGameMemberInfo(class AFortPlayerStateAthena* PlayerState);
void OnRep_GamePhase(); void OnRep_GamePhase();
void OnRep_CurrentPlaylistInfo(); void OnRep_CurrentPlaylistInfo();

View File

@@ -11,6 +11,25 @@ UFortResourceItemDefinition* UFortKismetLibrary::K2_GetResourceItemDefinition(EF
return params.ret; return params.ret;
} }
void UFortKismetLibrary::ApplyCharacterCosmetics(UObject* WorldContextObject, const TArray<UObject*>& CharacterParts, UObject* PlayerState, bool* bSuccess)
{
static auto fn = FindObject<UFunction>("/Script/FortniteGame.FortKismetLibrary.ApplyCharacterCosmetics");
struct
{
UObject* WorldContextObject; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
TArray<UObject*> CharacterParts; // (Parm, ZeroConstructor, NativeAccessSpecifierPublic)
UObject* PlayerState; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
bool bSuccess; // (Parm, OutParm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
} UFortKismetLibrary_ApplyCharacterCosmetics_Params{WorldContextObject, CharacterParts, PlayerState };
static auto DefaultClass = StaticClass();
DefaultClass->ProcessEvent(fn, &UFortKismetLibrary_ApplyCharacterCosmetics_Params);
if (bSuccess)
*bSuccess = UFortKismetLibrary_ApplyCharacterCosmetics_Params.bSuccess;
}
UClass* UFortKismetLibrary::StaticClass() UClass* UFortKismetLibrary::StaticClass()
{ {
static auto ptr = FindObject<UClass>(L"/Script/FortniteGame.FortKismetLibrary"); static auto ptr = FindObject<UClass>(L"/Script/FortniteGame.FortKismetLibrary");

View File

@@ -9,6 +9,7 @@ class UFortKismetLibrary : public UObject
{ {
public: public:
static UFortResourceItemDefinition* K2_GetResourceItemDefinition(EFortResourceType ResourceType); static UFortResourceItemDefinition* K2_GetResourceItemDefinition(EFortResourceType ResourceType);
static void ApplyCharacterCosmetics(UObject* WorldContextObject, const TArray<UObject*>& CharacterParts, UObject* PlayerState, bool* bSuccess);
static UClass* StaticClass(); static UClass* StaticClass();
}; };

View File

@@ -95,8 +95,11 @@ std::vector<std::pair<UFortItemDefinition*, int>> PickLootDrops(FName TierGroupN
for (int p = 0; p < LTDTables.size(); p++) for (int p = 0; p < LTDTables.size(); p++)
{ {
auto LTD = LTDTables[p]; auto LTD = LTDTables[p];
auto& LTDRowMap = LTD->GetRowMap();
if (!LTD)
continue;
auto& LTDRowMap = LTD->GetRowMap();
auto LTDRowMapNum = LTDRowMap.Pairs.Elements.Num(); auto LTDRowMapNum = LTDRowMap.Pairs.Elements.Num();
// auto TierGroupNameStr = TierGroupName.ToString(); // auto TierGroupNameStr = TierGroupName.ToString();

View File

@@ -9,6 +9,7 @@
#include "ActorComponent.h" #include "ActorComponent.h"
#include "FortPlayerStateAthena.h" #include "FortPlayerStateAthena.h"
#include "globals.h"
void AFortPlayerController::ClientReportDamagedResourceBuilding(ABuildingSMActor* BuildingSMActor, EFortResourceType PotentialResourceType, int PotentialResourceCount, bool bDestroyed, bool bJustHitWeakspot) void AFortPlayerController::ClientReportDamagedResourceBuilding(ABuildingSMActor* BuildingSMActor, EFortResourceType PotentialResourceType, int PotentialResourceCount, bool bDestroyed, bool bJustHitWeakspot)
{ {
@@ -53,7 +54,7 @@ void AFortPlayerController::ServerExecuteInventoryItemHook(AFortPlayerController
{ {
} }
}
void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation) void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation)
{ {
@@ -87,6 +88,11 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController*
void AFortPlayerController::ServerCreateBuildingActorHook(AFortPlayerController* PlayerController, FCreateBuildingActorData CreateBuildingData) void AFortPlayerController::ServerCreateBuildingActorHook(AFortPlayerController* PlayerController, FCreateBuildingActorData CreateBuildingData)
{ {
auto PlayerStateAthena = Cast<AFortPlayerStateAthena>(PlayerController->GetPlayerState());
if (!PlayerStateAthena)
return;
UClass* BuildingClass = nullptr; UClass* BuildingClass = nullptr;
FVector BuildLocation; FVector BuildLocation;
FRotator BuildRotator; FRotator BuildRotator;
@@ -132,6 +138,8 @@ void AFortPlayerController::ServerCreateBuildingActorHook(AFortPlayerController*
ExistingBuilding->K2_DestroyActor(); ExistingBuilding->K2_DestroyActor();
} }
ExistingBuildings.Free();
FTransform Transform{}; FTransform Transform{};
Transform.Translation = BuildLocation; Transform.Translation = BuildLocation;
Transform.Rotation = BuildRotator.Quaternion(); Transform.Rotation = BuildRotator.Quaternion();
@@ -142,6 +150,8 @@ void AFortPlayerController::ServerCreateBuildingActorHook(AFortPlayerController*
if (!BuildingActor) if (!BuildingActor)
return; return;
BuildingActor->SetPlayerPlaced(true);
BuildingActor->SetTeam(PlayerStateAthena->GetTeamIndex());
BuildingActor->InitializeBuildingActor(PlayerController, BuildingActor, true); BuildingActor->InitializeBuildingActor(PlayerController, BuildingActor, true);
} }
@@ -164,7 +174,6 @@ void AFortPlayerController::ServerPlayEmoteItemHook(AFortPlayerController* Playe
if (!AbilityToUse) if (!AbilityToUse)
return; return;
int outHandle = 0; int outHandle = 0;
FGameplayAbilitySpecHandle Handle{}; FGameplayAbilitySpecHandle Handle{};
@@ -220,8 +229,8 @@ void AFortPlayerController::ServerEditBuildingActorHook(AFortPlayerController* P
{ {
BuildingActor->SetPlayerPlaced(true); BuildingActor->SetPlayerPlaced(true);
// if (auto PlayerState = Cast<AFortPlayerStateAthena>(PlayerController->PlayerState)) if (auto PlayerState = Cast<AFortPlayerStateAthena>(PlayerController->GetPlayerState()))
// BuildingActor->SetTeam(PlayerState->TeamIndex); BuildingActor->SetTeam(PlayerState->GetTeamIndex());
// BuildingActor->OnRep_Team(); // BuildingActor->OnRep_Team();
} }
@@ -232,7 +241,7 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl
auto Pawn = PlayerController->GetMyFortPawn(); auto Pawn = PlayerController->GetMyFortPawn();
if (!BuildingActorToStopEditing || !Pawn if (!BuildingActorToStopEditing || !Pawn
// || BuildingActorToStopEditing->EditingPlayer != PlayerController->PlayerState || BuildingActorToStopEditing->GetEditingPlayer() != PlayerController->GetPlayerState()
|| BuildingActorToStopEditing->IsDestroyed()) || BuildingActorToStopEditing->IsDestroyed())
return; return;
@@ -243,7 +252,6 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl
if (EditTool) if (EditTool)
{ {
// EditTool->bEditConfirmed = true;
EditTool->GetEditActor() = nullptr; EditTool->GetEditActor() = nullptr;
// EditTool->OnRep_EditActor(); // EditTool->OnRep_EditActor();
} }

View File

@@ -9,6 +9,21 @@
struct FCreateBuildingActorData { uint32_t BuildingClassHandle; FVector BuildLoc; FRotator BuildRot; bool bMirrored; }; struct FCreateBuildingActorData { uint32_t BuildingClassHandle; FVector BuildLoc; FRotator BuildRot; bool bMirrored; };
struct FFortAthenaLoadout
{
UObject*& GetCharacter()
{
static auto CharacterOffset = FindOffsetStruct("/Script/FortniteGame.FortAthenaLoadout", "Character");
return *(UObject**)(__int64(this) + CharacterOffset);
}
UObject*& GetPickaxe()
{
static auto PickaxeOffset = FindOffsetStruct("/Script/FortniteGame.FortAthenaLoadout", "Pickaxe");
return *(UObject**)(__int64(this) + PickaxeOffset);
}
};
class AFortPlayerController : public APlayerController class AFortPlayerController : public APlayerController
{ {
public: public:
@@ -32,6 +47,18 @@ public:
return Class; return Class;
} }
FFortAthenaLoadout* GetCosmeticLoadout()
{
static auto CosmeticLoadoutPCOffset = this->GetOffset("CosmeticLoadoutPC", false);
if (CosmeticLoadoutPCOffset == 0)
CosmeticLoadoutPCOffset = this->GetOffset("CustomizationLoadout");
auto CosmeticLoadout = this->GetPtr<FFortAthenaLoadout>(CosmeticLoadoutPCOffset);
return CosmeticLoadout;
}
static void ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid); static void ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid);
static void ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation); static void ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation);

View File

@@ -1,4 +1,84 @@
#include "FortPlayerControllerAthena.h" #include "FortPlayerControllerAthena.h"
#include "FortPlayerPawn.h"
#include "FortKismetLibrary.h"
#include "SoftObjectPtr.h"
void ApplyCID(AFortPlayerPawn* Pawn, UObject* CID)
{
if (!CID)
return;
static auto HeroDefinitionOffset = CID->GetOffset("HeroDefinition");
auto HeroDefinition = CID->Get(HeroDefinitionOffset);
using UFortHeroSpecialization = UObject;
static auto SpecializationsOffset = HeroDefinition->GetOffset("Specializations");
auto& Specializations = HeroDefinition->Get<TArray<TSoftObjectPtr<UFortHeroSpecialization>>>(SpecializationsOffset);
auto PlayerState = Pawn->GetPlayerState();
for (int i = 0; i < Specializations.Num(); i++)
{
auto& SpecializationSoft = Specializations.at(i);
auto Specialization = SpecializationSoft.Get();
if (Specialization)
{
static auto Specialization_CharacterPartsOffset = Specialization->GetOffset("CharacterParts");
auto& CharacterParts = Specialization->Get<TArray<TSoftObjectPtr<UObject>>>(Specialization_CharacterPartsOffset);
bool aa;
TArray<UObject*> CharacterPartsaa;
for (int z = 0; z < CharacterParts.Num(); z++)
{
auto& CharacterPartSoft = CharacterParts.at(z);
auto CharacterPart = CharacterPartSoft.Get();
CharacterPartsaa.Add(CharacterPart);
continue;
}
UFortKismetLibrary::ApplyCharacterCosmetics(GetWorld(), CharacterPartsaa, PlayerState, &aa);
CharacterPartsaa.Free();
}
}
}
void AFortPlayerControllerAthena::ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn)
{
static auto AcknowledgedPawnOffset = Controller->GetOffset("AcknowledgedPawn");
Controller->Get<APawn*>(AcknowledgedPawnOffset) = Pawn;
auto ControllerAsFort = Cast<AFortPlayerController>(Controller);
auto PawnAsFort = Cast<AFortPlayerPawn>(Pawn);
auto PlayerStateAsFort = Cast<AFortPlayerState>(Pawn->GetPlayerState());
if (!PawnAsFort)
return;
static auto UpdatePlayerCustomCharacterPartsVisualizationFn = FindObject<UFunction>("/Script/FortniteGame.FortKismetLibrary.UpdatePlayerCustomCharacterPartsVisualization");
if (!UpdatePlayerCustomCharacterPartsVisualizationFn)
{
static auto CosmeticLoadoutPCOffset = Controller->GetOffset("CosmeticLoadoutPC");
auto CosmeticLoadout = ControllerAsFort->GetCosmeticLoadout();
ApplyCID(PawnAsFort, CosmeticLoadout->GetCharacter());
return;
}
if (!PlayerStateAsFort)
return;
UFortKismetLibrary::StaticClass()->ProcessEvent(UpdatePlayerCustomCharacterPartsVisualizationFn, &PlayerStateAsFort);
}
void AFortPlayerControllerAthena::GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation) void AFortPlayerControllerAthena::GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation)
{ {

View File

@@ -13,11 +13,6 @@ public:
return (AFortPlayerStateAthena*)GetPlayerState(); return (AFortPlayerStateAthena*)GetPlayerState();
} }
static void ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn) static void ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn);
{
static auto AcknowledgedPawnOffset = Controller->GetOffset("AcknowledgedPawn");
Controller->Get<APawn*>(AcknowledgedPawnOffset) = Pawn;
}
static void GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation); static void GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation);
}; };

View File

@@ -1,6 +1,19 @@
#include "FortPlayerPawn.h" #include "FortPlayerPawn.h"
#include <memcury.h> #include <memcury.h>
void AFortPlayerPawn::ServerChoosePart(EFortCustomPartType Part, UObject* ChosenCharacterPart)
{
static auto fn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerPawn.ServerChoosePart");
struct
{
EFortCustomPartType Part; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
UObject* ChosenCharacterPart; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
} AFortPlayerPawn_ServerChoosePart_Params{Part, ChosenCharacterPart};
this->ProcessEvent(fn, &AFortPlayerPawn_ServerChoosePart_Params);
}
void AFortPlayerPawn::ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZiplinePawnState InZiplineState) void AFortPlayerPawn::ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZiplinePawnState InZiplineState)
{ {
static auto ZiplineStateOffset = Pawn->GetOffset("ZiplineState"); static auto ZiplineStateOffset = Pawn->GetOffset("ZiplineState");
@@ -51,10 +64,14 @@ void AFortPlayerPawn::ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZipline
void AFortPlayerPawn::ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup* Pickup, float InFlyTime, FVector InStartDirection, bool bPlayPickupSound) void AFortPlayerPawn::ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup* Pickup, float InFlyTime, FVector InStartDirection, bool bPlayPickupSound)
{ {
if (!Pickup)
return;
static auto bPickedUpOffset = Pickup->GetOffset("bPickedUp"); static auto bPickedUpOffset = Pickup->GetOffset("bPickedUp");
if (Pickup && !Pickup->Get<bool>(bPickedUpOffset)) if (Pickup->Get<bool>(bPickedUpOffset))
{ return;
static auto IncomingPickupsOffset = Pawn->GetOffset("IncomingPickups"); static auto IncomingPickupsOffset = Pawn->GetOffset("IncomingPickups");
static auto PickupLocationDataOffset = Pickup->GetOffset("PickupLocationData"); static auto PickupLocationDataOffset = Pickup->GetOffset("PickupLocationData");
auto PickupLocationData = Pickup->GetPtr<__int64>(PickupLocationDataOffset); auto PickupLocationData = Pickup->GetPtr<__int64>(PickupLocationDataOffset);
@@ -80,5 +97,10 @@ void AFortPlayerPawn::ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup*
static auto OnRep_bPickedUpFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPickup.OnRep_bPickedUp"); static auto OnRep_bPickedUpFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPickup.OnRep_bPickedUp");
Pickup->ProcessEvent(OnRep_bPickedUpFn); Pickup->ProcessEvent(OnRep_bPickedUpFn);
} }
UClass* AFortPlayerPawn::StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPlayerPawn");
return Class;
} }

View File

@@ -7,9 +7,25 @@ struct PadHex100 { char pad[0x100]; };
using FZiplinePawnState = PadHex100; using FZiplinePawnState = PadHex100;
enum class EFortCustomPartType : uint8_t // todo move
{
Head = 0,
Body = 1,
Hat = 2,
Backpack = 3,
Charm = 4,
Face = 5,
NumTypes = 6,
EFortCustomPartType_MAX = 7
};
class AFortPlayerPawn : public AFortPawn class AFortPlayerPawn : public AFortPawn
{ {
public: public:
void ServerChoosePart(EFortCustomPartType Part, class UObject* ChosenCharacterPart);
static void ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZiplinePawnState InZiplineState); static void ServerSendZiplineStateHook(AFortPlayerPawn* Pawn, FZiplinePawnState InZiplineState);
static void ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup* Pickup, float InFlyTime, FVector InStartDirection, bool bPlayPickupSound); static void ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup* Pickup, float InFlyTime, FVector InStartDirection, bool bPlayPickupSound);
static UClass* StaticClass();
}; };

View File

@@ -0,0 +1,19 @@
#include "FortPlaysetItemDefinition.h"
void UFortPlaysetItemDefinition::ShowPlayset(UFortPlaysetItemDefinition* PlaysetItemDef, AFortVolume* Volume)
{
auto VolumeToUse = Volume;
static auto PlaysetLevelStreamComponentClass = FindObject<UClass>("/Script/FortniteGame.PlaysetLevelStreamComponent");
auto LevelStreamComponent = (UPlaysetLevelStreamComponent*)VolumeToUse->GetComponentByClass(PlaysetLevelStreamComponentClass);
if (!LevelStreamComponent)
{
return;
}
static auto SetPlaysetFn = FindObject<UFunction>("/Script/FortniteGame.PlaysetLevelStreamComponent.SetPlayset");
LevelStreamComponent->ProcessEvent(SetPlaysetFn, &PlaysetItemDef);
LoadPlaysetOriginal(LevelStreamComponent);
}

View File

@@ -0,0 +1,14 @@
#pragma once
#include "FortItemDefinition.h"
#include "FortVolume.h"
using UPlaysetLevelStreamComponent = UObject;
extern inline __int64 (*LoadPlaysetOriginal)(UPlaysetLevelStreamComponent* a1) = nullptr;
class UFortPlaysetItemDefinition : public UFortItemDefinition // UFortAccountItemDefinition
{
public:
static void ShowPlayset(UFortPlaysetItemDefinition* PlaysetItemDef, AFortVolume* Volume);
};

View File

@@ -0,0 +1,22 @@
#pragma once
#include "BuildingActor.h"
enum class EVolumeState : uint8_t
{
Uninitialized = 0,
ReadOnly = 1,
Initializing = 2,
Ready = 3,
EVolumeState_MAX = 4
};
class AFortVolume : public ABuildingActor // ABuildingGameplayActor
{
public:
EVolumeState& GetVolumeState()
{
static auto VolumeStateOffset = GetOffset("VolumeState");
return Get<EVolumeState>(VolumeStateOffset);
}
};

View File

@@ -1,7 +1,7 @@
#include "GameModeBase.h" #include "GameModeBase.h"
#include "reboot.h" #include "reboot.h"
#include "FortPlayerController.h" #include "FortPlayerControllerAthena.h"
APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AController* NewPlayer, AActor* StartSpot) APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AController* NewPlayer, AActor* StartSpot)
{ {
@@ -17,5 +17,37 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
GameMode->ProcessEvent(fn, &AGameModeBase_SpawnDefaultPawnAtTransform_Params); GameMode->ProcessEvent(fn, &AGameModeBase_SpawnDefaultPawnAtTransform_Params);
auto NewPlayerAsAthena = Cast<AFortPlayerControllerAthena>(NewPlayer);
if (NewPlayerAsAthena)
{
auto WorldInventory = NewPlayerAsAthena->GetWorldInventory();
auto CosmeticLoadoutPickaxe = NewPlayerAsAthena->GetCosmeticLoadout()->GetPickaxe();
static auto WeaponDefinitionOffset = FindOffsetStruct("/Script/FortniteGame.AthenaPickaxeItemDefinition", "WeaponDefinition");
auto Pickaxe = CosmeticLoadoutPickaxe ? CosmeticLoadoutPickaxe->Get<UFortItemDefinition*>(WeaponDefinitionOffset)
: FindObject<UFortItemDefinition>(L"/Game/Athena/Items/Weapons/WID_Harvest_Pickaxe_Athena_C_T01.WID_Harvest_Pickaxe_Athena_C_T01");
static UFortItemDefinition* EditToolItemDefinition = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/EditTool.EditTool");
static UFortItemDefinition* PickaxeDefinition = Pickaxe;
static UFortItemDefinition* BuildingItemData_Wall = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Wall.BuildingItemData_Wall");
static UFortItemDefinition* BuildingItemData_Floor = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Floor.BuildingItemData_Floor");
static UFortItemDefinition* BuildingItemData_Stair_W = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_Stair_W.BuildingItemData_Stair_W");
static UFortItemDefinition* BuildingItemData_RoofS = FindObject<UFortItemDefinition>(L"/Game/Items/Weapons/BuildingTools/BuildingItemData_RoofS.BuildingItemData_RoofS");
static UFortItemDefinition* WoodItemData = FindObject<UFortItemDefinition>(L"/Game/Items/ResourcePickups/WoodItemData.WoodItemData");
WorldInventory->AddItem(EditToolItemDefinition, nullptr);
WorldInventory->AddItem(BuildingItemData_Wall, nullptr);
WorldInventory->AddItem(BuildingItemData_Floor, nullptr);
WorldInventory->AddItem(BuildingItemData_Stair_W, nullptr);
WorldInventory->AddItem(BuildingItemData_RoofS, nullptr);
WorldInventory->AddItem(PickaxeDefinition, nullptr);
WorldInventory->AddItem(WoodItemData, nullptr, 100);
WorldInventory->Update(true);
}
return AGameModeBase_SpawnDefaultPawnAtTransform_Params.ReturnValue; return AGameModeBase_SpawnDefaultPawnAtTransform_Params.ReturnValue;
} }

View File

@@ -27,6 +27,23 @@ float UGameplayStatics::GetTimeSeconds(const UObject* WorldContextObject)
return TimeSeconds; return TimeSeconds;
} }
UObject* UGameplayStatics::SpawnObject(UClass* ObjectClass, UObject* Outer)
{
static auto fn = FindObject<UFunction>("/Script/Engine.GameplayStatics.SpawnObject");
struct
{
UClass* ObjectClass; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic)
UObject* Outer; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
UObject* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
} UGameplayStatics_SpawnObject_Params{ObjectClass, Outer};
static auto defaultObj = StaticClass();
defaultObj->ProcessEvent(fn, &UGameplayStatics_SpawnObject_Params);
return UGameplayStatics_SpawnObject_Params.ReturnValue;
}
UClass* UGameplayStatics::StaticClass() UClass* UGameplayStatics::StaticClass()
{ {
static auto Class = FindObject<UClass>(L"/Script/Engine.GameplayStatics"); static auto Class = FindObject<UClass>(L"/Script/Engine.GameplayStatics");

View File

@@ -9,6 +9,7 @@ class UGameplayStatics : public UObject
public: public:
static TArray<AActor*> GetAllActorsOfClass(const UObject* WorldContextObject, UClass* ActorClass); static TArray<AActor*> GetAllActorsOfClass(const UObject* WorldContextObject, UClass* ActorClass);
static float GetTimeSeconds(const UObject* WorldContextObject); static float GetTimeSeconds(const UObject* WorldContextObject);
static UObject* SpawnObject(UClass* ObjectClass, UObject* Outer);
static UClass* StaticClass(); static UClass* StaticClass();
}; };

View File

@@ -0,0 +1,26 @@
#pragma once
#include "Actor.h"
#include "reboot.h"
struct FMegaStormCircle
{
int GetStructSize()
{
static auto MegaStormCircleStruct = FindObject<UStruct>("/Script/FortniteGame.MegaStormCircle");
return MegaStormCircleStruct->GetPropertiesSize();
}
};
class AMegaStormManager : public AActor
{
public:
TArray<__int64>& GetMegaStormCircles()
{
static auto MegaStormCirclesOffset = GetOffset("MegaStormCircles");
return Get<TArray<__int64>>(MegaStormCirclesOffset);
}
};

View File

@@ -5,4 +5,9 @@
class APawn : public AActor class APawn : public AActor
{ {
public: public:
UObject* GetPlayerState()
{
static auto PlayerStateOffset = GetOffset("PlayerState");
return Get(PlayerStateOffset);
}
}; };

View File

@@ -190,6 +190,7 @@
<ClCompile Include="FortPlayerController.cpp" /> <ClCompile Include="FortPlayerController.cpp" />
<ClCompile Include="FortPlayerControllerAthena.cpp" /> <ClCompile Include="FortPlayerControllerAthena.cpp" />
<ClCompile Include="FortPlayerPawn.cpp" /> <ClCompile Include="FortPlayerPawn.cpp" />
<ClCompile Include="FortPlaysetItemDefinition.cpp" />
<ClCompile Include="FortWeapon.cpp" /> <ClCompile Include="FortWeapon.cpp" />
<ClCompile Include="GameModeBase.cpp" /> <ClCompile Include="GameModeBase.cpp" />
<ClCompile Include="GameplayStatics.cpp" /> <ClCompile Include="GameplayStatics.cpp" />
@@ -210,6 +211,7 @@
<ClInclude Include="Actor.h" /> <ClInclude Include="Actor.h" />
<ClInclude Include="ActorComponent.h" /> <ClInclude Include="ActorComponent.h" />
<ClInclude Include="addresses.h" /> <ClInclude Include="addresses.h" />
<ClInclude Include="ai.h" />
<ClInclude Include="Array.h" /> <ClInclude Include="Array.h" />
<ClInclude Include="BitArray.h" /> <ClInclude Include="BitArray.h" />
<ClInclude Include="BuildingActor.h" /> <ClInclude Include="BuildingActor.h" />
@@ -226,6 +228,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="FortAthenaCreativePortal.h" />
<ClInclude Include="FortDecoItemDefinition.h" /> <ClInclude Include="FortDecoItemDefinition.h" />
<ClInclude Include="FortGameMode.h" /> <ClInclude Include="FortGameMode.h" />
<ClInclude Include="FortGameModeAthena.h" /> <ClInclude Include="FortGameModeAthena.h" />
@@ -243,7 +246,9 @@
<ClInclude Include="FortPlayerPawn.h" /> <ClInclude Include="FortPlayerPawn.h" />
<ClInclude Include="FortPlayerState.h" /> <ClInclude Include="FortPlayerState.h" />
<ClInclude Include="FortPlayerStateAthena.h" /> <ClInclude Include="FortPlayerStateAthena.h" />
<ClInclude Include="FortPlaysetItemDefinition.h" />
<ClInclude Include="FortResourceItemDefinition.h" /> <ClInclude Include="FortResourceItemDefinition.h" />
<ClInclude Include="FortVolume.h" />
<ClInclude Include="FortWeapon.h" /> <ClInclude Include="FortWeapon.h" />
<ClInclude Include="FortWeaponItemDefinition.h" /> <ClInclude Include="FortWeaponItemDefinition.h" />
<ClInclude Include="BuildingWeapons.h" /> <ClInclude Include="BuildingWeapons.h" />
@@ -256,6 +261,7 @@
<ClInclude Include="GameplayTagContainer.h" /> <ClInclude Include="GameplayTagContainer.h" />
<ClInclude Include="GameSession.h" /> <ClInclude Include="GameSession.h" />
<ClInclude Include="GameState.h" /> <ClInclude Include="GameState.h" />
<ClInclude Include="globals.h" />
<ClInclude Include="hooking.h" /> <ClInclude Include="hooking.h" />
<ClInclude Include="inc.h" /> <ClInclude Include="inc.h" />
<ClInclude Include="KismetMathLibrary.h" /> <ClInclude Include="KismetMathLibrary.h" />
@@ -263,6 +269,7 @@
<ClInclude Include="KismetSystemLibrary.h" /> <ClInclude Include="KismetSystemLibrary.h" />
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />
<ClInclude Include="Map.h" /> <ClInclude Include="Map.h" />
<ClInclude Include="MegaStormManager.h" />
<ClInclude Include="NameTypes.h" /> <ClInclude Include="NameTypes.h" />
<ClInclude Include="NetDriver.h" /> <ClInclude Include="NetDriver.h" />
<ClInclude Include="NetSerialization.h" /> <ClInclude Include="NetSerialization.h" />

View File

@@ -119,6 +119,9 @@
<ClCompile Include="FortDecoItemDefinition.cpp"> <ClCompile Include="FortDecoItemDefinition.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter> <Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FortPlaysetItemDefinition.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />
@@ -365,6 +368,24 @@
<ClInclude Include="FortDecoItemDefinition.h"> <ClInclude Include="FortDecoItemDefinition.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Items</Filter> <Filter>FortniteGame\Source\FortniteGame\Public\Items</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="globals.h">
<Filter>Reboot\Public</Filter>
</ClInclude>
<ClInclude Include="MegaStormManager.h">
<Filter>FortniteGame\Source\FortniteGame\Public</Filter>
</ClInclude>
<ClInclude Include="ai.h">
<Filter>Reboot\Public</Filter>
</ClInclude>
<ClInclude Include="FortVolume.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Creative</Filter>
</ClInclude>
<ClInclude Include="FortAthenaCreativePortal.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Creative</Filter>
</ClInclude>
<ClInclude Include="FortPlaysetItemDefinition.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Items</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="Engine"> <Filter Include="Engine">
@@ -529,6 +550,9 @@
<Filter Include="Reboot\Public\Gameplay"> <Filter Include="Reboot\Public\Gameplay">
<UniqueIdentifier>{9923af6f-0a65-43f7-ad58-8a66e83814ba}</UniqueIdentifier> <UniqueIdentifier>{9923af6f-0a65-43f7-ad58-8a66e83814ba}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Public\Creative">
<UniqueIdentifier>{51b57917-fec7-41b7-bdc8-ad284a5385a4}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="UnrealEngine.cpp"> <None Include="UnrealEngine.cpp">

View File

@@ -20,6 +20,9 @@ public:
T* Get() T* Get()
{ {
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

@@ -5,6 +5,14 @@
#include "reboot.h" #include "reboot.h"
UObject* UWorld::K2_GetWorldSettings()
{
static auto fn = FindObject<UFunction>("/Script/Engine.World.K2_GetWorldSettings");
UObject* WorldSettings;
this->ProcessEvent(fn, &WorldSettings);
return WorldSettings;
}
void UWorld::Listen() void UWorld::Listen()
{ {
auto GameNetDriverName = UKismetStringLibrary::Conv_StringToName(L"GameNetDriver"); auto GameNetDriverName = UKismetStringLibrary::Conv_StringToName(L"GameNetDriver");

View File

@@ -56,5 +56,7 @@ public:
return SpawnActor<ActorType>(Class, UserTransformPtr, SpawnParameters); return SpawnActor<ActorType>(Class, UserTransformPtr, SpawnParameters);
} }
UObject* K2_GetWorldSettings();
void Listen(); void Listen();
}; };

View File

@@ -13,7 +13,9 @@
#include "finder.h" #include "finder.h"
#include <regex> #include <regex>
#include "ai.h"
#include "BuildingActor.h" #include "BuildingActor.h"
#include "FortPlaysetItemDefinition.h"
void Addresses::SetupVersion() void Addresses::SetupVersion()
{ {
@@ -110,9 +112,11 @@ void Addresses::FindAll()
{ {
LOG_INFO(LogDev, "9241"); LOG_INFO(LogDev, "9241");
Addresses::ProcessEvent = FindProcessEvent(); Addresses::ProcessEvent = FindProcessEvent();
UObject::ProcessEventOriginal = decltype(UObject::ProcessEventOriginal)(ProcessEvent);
LOG_INFO(LogDev, "151"); LOG_INFO(LogDev, "151");
Addresses::StaticFindObject = FindStaticFindObject(); Addresses::StaticFindObject = FindStaticFindObject();
StaticFindObjectOriginal = decltype(StaticFindObjectOriginal)(StaticFindObject);
LOG_INFO(LogDev, "2151"); LOG_INFO(LogDev, "2151");
Addresses::GetPlayerViewpoint = FindGetPlayerViewpoint(); Addresses::GetPlayerViewpoint = FindGetPlayerViewpoint();
@@ -149,7 +153,7 @@ void Addresses::FindAll()
LOG_INFO(LogDev, "1231"); LOG_INFO(LogDev, "1231");
Addresses::CollectGarbage = FindCollectGarbage(); Addresses::CollectGarbage = FindCollectGarbage();
LOG_INFO(LogDev, "1123"); LOG_INFO(LogDev, "112113");
Addresses::NoMCP = FindNoMCP(); Addresses::NoMCP = FindNoMCP();
LOG_INFO(LogDev, "131"); LOG_INFO(LogDev, "131");
@@ -184,6 +188,10 @@ void Addresses::FindAll()
Addresses::ChangeGameSessionId = FindChangeGameSessionId(); Addresses::ChangeGameSessionId = FindChangeGameSessionId();
LOG_INFO(LogDev, "10"); LOG_INFO(LogDev, "10");
Addresses::DispatchRequest = FindDispatchRequest();
Addresses::AddNavigationSystemToWorld = FindAddNavigationSystemToWorld();
Addresses::NavSystemCleanUp = FindNavSystemCleanUp();
Addresses::LoadPlayset = FindLoadPlayset();
} }
void Addresses::Print() void Addresses::Print()
@@ -216,6 +224,10 @@ void Addresses::Print()
LOG_INFO(LogDev, "StaticLoadObject: 0x{:x}", StaticLoadObject - Base); LOG_INFO(LogDev, "StaticLoadObject: 0x{:x}", StaticLoadObject - Base);
LOG_INFO(LogDev, "ActorGetNetMode: 0x{:x}", ActorGetNetMode - Base); LOG_INFO(LogDev, "ActorGetNetMode: 0x{:x}", ActorGetNetMode - Base);
LOG_INFO(LogDev, "ChangeGameSessionId: 0x{:x}", ChangeGameSessionId - Base); LOG_INFO(LogDev, "ChangeGameSessionId: 0x{:x}", ChangeGameSessionId - Base);
LOG_INFO(LogDev, "DispatchRequest: 0x{:x}", DispatchRequest - Base);
LOG_INFO(LogDev, "AddNavigationSystemToWorld: 0x{:x}", AddNavigationSystemToWorld - Base);
LOG_INFO(LogDev, "NavSystemCleanUp: 0x{:x}", NavSystemCleanUp - Base);
LOG_INFO(LogDev, "LoadPlayset: 0x{:x}", LoadPlayset - Base);
} }
void Offsets::FindAll() void Offsets::FindAll()
@@ -268,8 +280,8 @@ void Offsets::Print()
void Addresses::Init() void Addresses::Init()
{ {
UObject::ProcessEventOriginal = decltype(UObject::ProcessEventOriginal)(ProcessEvent); // UObject::ProcessEventOriginal = decltype(UObject::ProcessEventOriginal)(ProcessEvent); // we do this in Addresses::FindAll()
StaticFindObjectOriginal = decltype(StaticFindObjectOriginal)(StaticFindObject); // StaticFindObjectOriginal = decltype(StaticFindObjectOriginal)(StaticFindObject); // we do this in Addresses::FindAll()
UWorld::SpawnActorOriginal = decltype(UWorld::SpawnActorOriginal)(SpawnActor); UWorld::SpawnActorOriginal = decltype(UWorld::SpawnActorOriginal)(SpawnActor);
UNetDriver::InitListenOriginal = decltype(UNetDriver::InitListenOriginal)(InitListen); UNetDriver::InitListenOriginal = decltype(UNetDriver::InitListenOriginal)(InitListen);
AGameSession::KickPlayerOriginal = decltype(AGameSession::KickPlayerOriginal)(KickPlayer); AGameSession::KickPlayerOriginal = decltype(AGameSession::KickPlayerOriginal)(KickPlayer);
@@ -284,6 +296,10 @@ void Addresses::Init()
Addresses::SetWorld = Engine_Version < 426 ? Addresses::SetWorld : __int64(DefaultNetDriver->VFTable[Addresses::SetWorld]); Addresses::SetWorld = Engine_Version < 426 ? Addresses::SetWorld : __int64(DefaultNetDriver->VFTable[Addresses::SetWorld]);
UNetDriver::SetWorldOriginal = decltype(UNetDriver::SetWorldOriginal)(SetWorld); UNetDriver::SetWorldOriginal = decltype(UNetDriver::SetWorldOriginal)(SetWorld);
AddNavigationSystemToWorldOriginal = decltype(AddNavigationSystemToWorldOriginal)(AddNavigationSystemToWorld);
NavSystemCleanUpOriginal = decltype(NavSystemCleanUpOriginal)(Addresses::NavSystemCleanUp);
LoadPlaysetOriginal = decltype(LoadPlaysetOriginal)(Addresses::LoadPlayset);
// if (Engine_Version >= 421) ChunkedObjects = decltype(ChunkedObjects)(ObjectArray); // if (Engine_Version >= 421) ChunkedObjects = decltype(ChunkedObjects)(ObjectArray);
// else UnchunkedObjects = decltype(UnchunkedObjects)(ObjectArray); // else UnchunkedObjects = decltype(UnchunkedObjects)(ObjectArray);
} }
@@ -295,6 +311,7 @@ std::vector<uint64> Addresses::GetFunctionsToNull()
if (Engine_Version == 420) if (Engine_Version == 420)
{ {
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 57 48 81 EC ? ? ? ? 4C 8B 82 ? ? ? ? 48 8B F9 0F 29 70 E8 0F 29 78 D8").Get()); // Pawn Overlap toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 57 48 81 EC ? ? ? ? 4C 8B 82 ? ? ? ? 48 8B F9 0F 29 70 E8 0F 29 78 D8").Get()); // Pawn Overlap
// toNull.push_back(Memcury::Scanner::FindPattern("E8 ? ? ? ? EB 26 40 38 3D ? ? ? ?").RelativeOffset(1).Get()); // collectgarbage
} }
if (Engine_Version == 421) if (Engine_Version == 421)

View File

@@ -36,6 +36,10 @@ namespace Addresses
extern inline uint64 GIsClient = 0; extern inline uint64 GIsClient = 0;
extern inline uint64 ActorGetNetMode = 0; extern inline uint64 ActorGetNetMode = 0;
extern inline uint64 ChangeGameSessionId = 0; extern inline uint64 ChangeGameSessionId = 0;
extern inline uint64 DispatchRequest = 0;
extern inline uint64 AddNavigationSystemToWorld = 0;
extern inline uint64 NavSystemCleanUp = 0;
extern inline uint64 LoadPlayset = 0;
void SetupVersion(); // Finds Engine Version void SetupVersion(); // Finds Engine Version
void FindAll(); void FindAll();

91
Project Reboot 3.0/ai.h Normal file
View File

@@ -0,0 +1,91 @@
#pragma once
#include "reboot.h"
#include "Actor.h"
#include "SoftObjectPath.h"
#include "KismetStringLibrary.h"
#include "GameplayStatics.h"
using UNavigationSystemV1 = UObject;
using UNavigationSystemConfig = UObject;
using AAthenaNavSystemConfigOverride = UObject;
using UAthenaNavSystem = UObject;
using UAthenaNavSystemConfig = UObject;
enum class EFNavigationSystemRunMode : uint8_t
{
InvalidMode = 0,
GameMode = 1,
EditorMode = 2,
SimulationMode = 3,
PIEMode = 4,
FNavigationSystemRunMode_MAX = 5
};
enum class ENavSystemOverridePolicy : uint8_t
{
Override = 0,
Append = 1,
Skip = 2,
ENavSystemOverridePolicy_MAX = 3
};
extern inline void (*NavSystemCleanUpOriginal)(UNavigationSystemV1*, uint8) = nullptr;
extern inline void (*AddNavigationSystemToWorldOriginal)(UWorld& WorldOwner, EFNavigationSystemRunMode RunMode, UNavigationSystemConfig* NavigationSystemConfig, char bInitializeForWorld,
char bOverridePreviousNavSys) = nullptr;
static void SetNavigationSystem(AAthenaNavSystemConfigOverride* NavSystemOverride)
{
auto WorldSettings = GetWorld()->K2_GetWorldSettings();
NavSystemOverride->Get<ENavSystemOverridePolicy>("OverridePolicy") = ENavSystemOverridePolicy::Append;
WorldSettings->Get("NavigationSystemConfigOverride") = NavSystemOverride->Get("NavigationSystemConfig");
WorldSettings->Get("NavigationSystemConfig")->Get<bool>("bIsOverriden") = true;
auto NavSystem = (UAthenaNavSystem*)GetWorld()->Get("NavigationSystem");
NavSystemCleanUpOriginal(NavSystem, 0);
GetWorld()->Get("NavigationSystem") = nullptr;
if (!NavSystemOverride->Get("NavigationSystemConfig"))
return;
auto& ClassPath = NavSystemOverride->Get("NavigationSystemConfig")->Get<FSoftObjectPath>("NavigationSystemClass");
auto NewNavSystemClass = FindObject<UClass>(ClassPath.AssetPathName.ToString());
if (!NewNavSystemClass)
return;
LOG_INFO(LogAI, "Setup navigation system.\n");
AddNavigationSystemToWorldOriginal(*GetWorld(), EFNavigationSystemRunMode::GameMode, NavSystemOverride->Get("NavigationSystemConfig"), true, false);
}
static void SetupNavConfig()
{
static auto AthenaNavSystemConfigOverrideClass = FindObject<UClass>("/Script/FortniteGame.AthenaNavSystemConfigOverride");
auto NavSystemOverride = GetWorld()->SpawnActor<AActor>(AthenaNavSystemConfigOverrideClass);
if (!NavSystemOverride)
return;
static auto AthenaNavSystemConfigClass = FindObject<UClass>("/Script/FortniteGame.AthenaNavSystemConfig");
auto AthenaNavConfig = (UAthenaNavSystemConfig*)UGameplayStatics::SpawnObject(AthenaNavSystemConfigClass, NavSystemOverride);
AthenaNavConfig->Get<bool>("bUseBuildingGridAsNavigableSpace") = false;
AthenaNavConfig->Get<bool>("bUsesStreamedInNavLevel") = true;
AthenaNavConfig->Get<bool>("bAllowAutoRebuild") = true;
AthenaNavConfig->Get<bool>("bCreateOnClient") = true; // BITFIELD
AthenaNavConfig->Get<bool>("bAutoSpawnMissingNavData") = true; // BITFIELD
AthenaNavConfig->Get<bool>("bSpawnNavDataInNavBoundsLevel") = true; // BITFIELD
AthenaNavConfig->Get<bool>("bUseNavigationInvokers") = false;
AthenaNavConfig->Get<FName>("DefaultAgentName") = UKismetStringLibrary::Conv_StringToName(L"MANG");
// NavSystemOverride->Get<ENavSystemOverridePolicy>("OverridePolicy") = ENavSystemOverridePolicy::Append;
NavSystemOverride->Get("NavigationSystemConfig") = AthenaNavConfig;
SetNavigationSystem(NavSystemOverride);
}

View File

@@ -9,6 +9,7 @@
#include "FortPlayerControllerAthena.h" #include "FortPlayerControllerAthena.h"
#include "AbilitySystemComponent.h" #include "AbilitySystemComponent.h"
#include "FortPlayerPawn.h" #include "FortPlayerPawn.h"
#include "globals.h"
#include "Map.h" #include "Map.h"
#include "events.h" #include "events.h"
@@ -31,6 +32,9 @@ static int Return2Hook() { return 2; }
static void NoMCPHook() { return; } static void NoMCPHook() { return; }
static void CollectGarbageHook() { return; } static void CollectGarbageHook() { return; }
static __int64 (*DispatchRequestOriginal)(__int64 a1, __int64* a2, int a3);
static __int64 DispatchRequestHook(__int64 a1, __int64* a2, int a3) { return DispatchRequestOriginal(a1, a2, 3); }
DWORD WINAPI Main(LPVOID) DWORD WINAPI Main(LPVOID)
{ {
InitLogger(); InitLogger();
@@ -72,11 +76,21 @@ DWORD WINAPI Main(LPVOID)
: Globals::bCreative ? L"Creative_NoApollo_Terrain" : Globals::bCreative ? L"Creative_NoApollo_Terrain"
: L"Apollo_Terrain"; : L"Apollo_Terrain";
if (Globals::bNoMCP)
{
if (Hooking::MinHook::Hook((PVOID)Addresses::NoMCP, (PVOID)NoMCPHook, nullptr)) if (Hooking::MinHook::Hook((PVOID)Addresses::NoMCP, (PVOID)NoMCPHook, nullptr))
{ {
LOG_INFO(LogHook, "Hooking GetNetMode!"); LOG_INFO(LogHook, "Hooking GetNetMode!");
Hooking::MinHook::Hook((PVOID)Addresses::GetNetMode, (PVOID)GetNetModeHook, nullptr); Hooking::MinHook::Hook((PVOID)Addresses::GetNetMode, (PVOID)GetNetModeHook, nullptr);
} }
}
else
{
Hooking::MinHook::Hook((PVOID)Addresses::KickPlayer, (PVOID)AGameSession::KickPlayerHook, (PVOID*)&AGameSession::KickPlayerOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::DispatchRequest, (PVOID)DispatchRequestHook, (PVOID*)&DispatchRequestOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::GetNetMode, (PVOID)GetNetModeHook, nullptr);
LOG_INFO(LogHook, "Hooking GetNetMode!");
}
LOG_INFO(LogDev, "Size: 0x{:x}", sizeof(TMap<FName, void*>)); LOG_INFO(LogDev, "Size: 0x{:x}", sizeof(TMap<FName, void*>));
@@ -89,11 +103,14 @@ DWORD WINAPI Main(LPVOID)
LOG_INFO(LogDev, "FindGIsServer: 0x{:x}", FindGIsServer() - __int64(GetModuleHandleW(0))); LOG_INFO(LogDev, "FindGIsServer: 0x{:x}", FindGIsServer() - __int64(GetModuleHandleW(0)));
LOG_INFO(LogDev, "FindGIsClient: 0x{:x}", FindGIsClient() - __int64(GetModuleHandleW(0))); LOG_INFO(LogDev, "FindGIsClient: 0x{:x}", FindGIsClient() - __int64(GetModuleHandleW(0)));
// if (false)
{
if (FindGIsServer()) if (FindGIsServer())
*(bool*)FindGIsServer() = true; *(bool*)FindGIsServer() = true;
if (FindGIsClient()) if (FindGIsClient())
*(bool*)FindGIsClient() = false; *(bool*)FindGIsClient() = false;
}
if (Fortnite_Version == 17.30) if (Fortnite_Version == 17.30)
{ {
@@ -102,30 +119,6 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3DED158), (PVOID)ReturnTrueHook, nullptr); Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3DED158), (PVOID)ReturnTrueHook, nullptr);
} }
/*
auto GIsClient = Memcury::Scanner(FindGIsServer());
*GIsClient.GetAs<bool*>() = false;
*(bool*)((uintptr_t)GIsClient.Get() + 1) = true;
*/
/* auto GIsServer = Memcury::Scanner(__int64(GetModuleHandleW(0)) + 0x804B65A); // Memcury::Scanner::FindStringRef(L"STAT_UpdateLevelStreaming").ScanFor({ 0x80, 0x3D }, false, 1).RelativeOffset(2);
LOG_INFO(LogDev, "GIsServer: 0x{:x}", GIsServer.Get() - __int64(GetModuleHandleW(0)));
LOG_INFO(LogDev, "gisserver - 1: 0x{:x}", __int64(((uintptr_t)GIsServer.Get() - 1)) - __int64(GetModuleHandleW(0)));
LOG_INFO(LogDev, "FindGIsServer: 0x{:x}", FindGIsServer() - __int64(GetModuleHandleW(0)));
LOG_INFO(LogDev, "FindGIsClient: 0x{:x}", FindGIsClient() - __int64(GetModuleHandleW(0)));
*GIsServer.GetAs<bool*>() = true;
*(bool*)((uintptr_t)GIsServer.Get() - 1) = false; */
/* struct { UObject* World; bool ret; } parms{GetWorld()};
static auto IsDedicatedServerFn = FindObject<UFunction>(L"/Script/Engine.KismetSystemLibrary.IsDedicatedServer");
UGameplayStatics::StaticClass()->ProcessEvent(IsDedicatedServerFn, &parms);
LOG_INFO(LogDev, "isded: {}", parms.ret); */
auto& LocalPlayers = GetLocalPlayers(); auto& LocalPlayers = GetLocalPlayers();
if (LocalPlayers.Num() && LocalPlayers.Data) if (LocalPlayers.Num() && LocalPlayers.Data)
@@ -153,6 +146,9 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook, Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook,
(PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false); (PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false);
// return 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,
@@ -178,12 +174,15 @@ 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"), if (false)
{
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);
}
if (Engine_Version >= 424) if (Engine_Version >= 424)
{ {
@@ -194,7 +193,6 @@ 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::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);
@@ -212,6 +210,25 @@ DWORD WINAPI Main(LPVOID)
StartEvent(); StartEvent();
} }
else if (GetAsyncKeyState(VK_F8) & 1)
{
float Duration = 0;
float EarlyDuration = Duration;
float TimeSeconds = 0; // UGameplayStatics::GetTimeSeconds(GetWorld());
LOG_INFO(LogDev, "Starting bus!");
auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode();
auto GameState = GameMode->GetGameState();
GameState->Get<float>("WarmupCountdownEndTime") = 0;
GameMode->Get<float>("WarmupCountdownDuration") = 0;
GameState->Get<float>("WarmupCountdownStartTime") = 0;
GameMode->Get<float>("WarmupEarlyCountdownDuration") = 0;
}
Sleep(1000 / 30); Sleep(1000 / 30);
} }

View File

@@ -226,6 +226,15 @@ static inline uint64 FindStaticLoadObject()
static inline uint64 FindNoMCP() static inline uint64 FindNoMCP()
{ {
auto fn = FindObject<UFunction>("/Script/FortniteGame.FortKismetLibrary.IsRunningNoMCP");
LOG_INFO(LogDev, "fn: {}", __int64(fn));
if (!fn)
return 0;
auto noMcpIthink = GetFunctionIdxOrPtr(fn);
return noMcpIthink;
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();
@@ -282,6 +291,9 @@ static inline uint64 FindActorGetNetMode()
static inline uint64 FindTickFlush() static inline uint64 FindTickFlush()
{ {
// auto add = Memcury::Scanner::FindStringRef(L"UDemoNetDriver::TickFlush: ReplayStreamer ERROR: %s");
// return Memcury::Scanner(FindBytes(add, { 0xE8 }, 500, 0, true, 1)).RelativeOffset(1).Get();
if (Engine_Version == 427) 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(); 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();
@@ -289,10 +301,38 @@ static inline uint64 FindTickFlush()
return FindBytes(Addr, (Fortnite_Version < 18 ? std::vector<uint8_t>{ 0x4C, 0x8B } : std::vector<uint8_t>{ 0x48, 0x8B, 0xC4 }), 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 FindAddNavigationSystemToWorld()
{
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 33 ED 41").Get();
}
static inline uint64 FindNavSystemCleanUp()
{
auto Addr = Memcury::Scanner::FindStringRef(L"UNavigationSystemV1::CleanUp", false);
if (!Addr.Get())
return 0;
return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 500, 0, true);
}
static inline uint64 FindLoadPlayset()
{
auto StringRef = Memcury::Scanner::FindStringRef(L"UPlaysetLevelStreamComponent::LoadPlayset Error: no owner for %s", Fortnite_Version >= 7);
if (!StringRef.Get())
return 0;
return FindBytes(StringRef, { 0x48, 0x89, 0x5C }, 1000, 0, true);
}
static inline uint64 FindGIsServer() static inline uint64 FindGIsServer()
{ {
if (Fortnite_Version == 19.10) // auto add = Memcury::Scanner::FindStringRef(L"STAT_UpdateLevelStreaming");
return __int64(GetModuleHandleW(0)) + 0xB30CF9D; // return Memcury::Scanner(FindBytes(add, { 0x80, 0x3D }, 100, 0, true, 1)).RelativeOffset(2).Get();
// if (Fortnite_Version == 19.10)
// return __int64(GetModuleHandleW(0)) + 0xB30CF9D;
if (Fortnite_Version == 17.30) if (Fortnite_Version == 17.30)
return __int64(GetModuleHandleW(0)) + 0x973E499; return __int64(GetModuleHandleW(0)) + 0x973E499;
@@ -300,8 +340,64 @@ static inline uint64 FindGIsServer()
return 0; 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);
Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, 1); std::vector<std::vector<uint8_t>> BytesArray = { { 0xC6, 0x05 }, { 0x88, 0x1D } };
int Skip = 1;
uint64 Addy;
for (int i = 0; i < 50; i++) // we should subtract from skip if goup
{
auto CurrentByte = *(Memcury::ASM::MNEMONIC*)(Addr.Get() - i);
// if (bPrint)
// std::cout << "CurrentByte: " << std::hex << (int)CurrentByte << '\n';
bool ShouldBreak = false;
for (auto& Bytes : BytesArray)
{
if (CurrentByte == Bytes[0])
{
bool Found = true;
for (int j = 1; j < Bytes.size(); j++)
{
if (*(Memcury::ASM::MNEMONIC*)(Addr.Get() - i + j) != Bytes[j])
{
Found = false;
break;
}
}
if (Found)
{
LOG_INFO(LogDev, "[{}] Skip: 0x{:x}", Skip, Memcury::Scanner(Addr.Get() - i).RelativeOffset(2).Get() - __int64(GetModuleHandleW(0)));
if (Skip > 0)
{
Skip--;
continue;
}
Addy = Addr.Get() - i;
ShouldBreak = true;
break;
}
}
}
if (ShouldBreak)
break;
// std::cout << std::format("CurrentByte: 0x{:x}\n", (uint8_t)CurrentByte);
}
/* int Skip = 2;
auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, Skip);
Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, Skip);
Addy = Addy ? Addy : FindBytes(Addr, { 0x88, 0x1D }, 50, 0, true, Skip); */
LOG_INFO(LogDev, "Addy: 0x{:x}", Addy - __int64(GetModuleHandleW(0)));
return Memcury::Scanner(Addy).RelativeOffset(2).Get(); return Memcury::Scanner(Addy).RelativeOffset(2).Get();
} }
@@ -323,6 +419,12 @@ static inline uint64 FindChangeGameSessionId()
return FindBytes(Addr, { 0x40, 0x55 }, 2000, 0, true); return FindBytes(Addr, { 0x40, 0x55 }, 2000, 0, true);
} }
static inline uint64 FindDispatchRequest()
{
auto Addr = Memcury::Scanner::FindStringRef(L"MCP-Profile: Dispatching request to %s", true, 0, Fortnite_Version >= 18); // todo check s18
return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 300, 0, true);
}
static inline uint64 FindGIsClient() static inline uint64 FindGIsClient()
{ {
if (Fortnite_Version == 17.30) if (Fortnite_Version == 17.30)
@@ -331,10 +433,76 @@ static inline uint64 FindGIsClient()
return 0; 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);
Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, 2); std::vector<std::vector<uint8_t>> BytesArray = { { 0xC6, 0x05 }, { 0x88, 0x1D } };
int Skip = 2;
uint64 Addy;
for (int i = 0; i < 50; i++) // we should subtract from skip if goup
{
auto CurrentByte = *(Memcury::ASM::MNEMONIC*)(Addr.Get() - i);
// if (bPrint)
// std::cout << "CurrentByte: " << std::hex << (int)CurrentByte << '\n';
bool ShouldBreak = false;
for (auto& Bytes : BytesArray)
{
if (CurrentByte == Bytes[0])
{
bool Found = true;
for (int j = 1; j < Bytes.size(); j++)
{
if (*(Memcury::ASM::MNEMONIC*)(Addr.Get() - i + j) != Bytes[j])
{
Found = false;
break;
}
}
if (Found)
{
LOG_INFO(LogDev, "[{}] Skip: 0x{:x}", Skip, Memcury::Scanner(Addr.Get() - i).RelativeOffset(2).Get() - __int64(GetModuleHandleW(0)));
if (Skip > 0)
{
Skip--;
continue;
}
Addy = Addr.Get() - i;
ShouldBreak = true;
break;
}
}
}
if (ShouldBreak)
break;
// std::cout << std::format("CurrentByte: 0x{:x}\n", (uint8_t)CurrentByte);
}
/* int Skip = 2;
auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, Skip);
Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, Skip);
Addy = Addy ? Addy : FindBytes(Addr, { 0x88, 0x1D }, 50, 0, true, Skip); */
LOG_INFO(LogDev, "Addy: 0x{:x}", Addy - __int64(GetModuleHandleW(0)));
return Memcury::Scanner(Addy).RelativeOffset(2).Get(); return Memcury::Scanner(Addy).RelativeOffset(2).Get();
/*
auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering");
int Skip = 1;
auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, Skip);
Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, Skip);
Addy = Addy ? Addy : FindBytes(Addr, { 0x88, 0x1D }, 50, 0, true, Skip);
return Memcury::Scanner(Addy).RelativeOffset(2).Get();
*/
} }
static inline uint64 FindGetNetMode() static inline uint64 FindGetNetMode()

View File

@@ -0,0 +1,9 @@
#pragma once
namespace Globals
{
extern inline bool bCreative = true;
extern inline bool bGoingToPlayEvent = false;
extern inline bool bNoMCP = false;
extern inline bool bLateGame = false;
}

View File

@@ -196,6 +196,13 @@ namespace Hooking
return ret1 == MH_OK && ret2 == MH_OK; return ret1 == MH_OK && ret2 == MH_OK;
} }
static bool PatchCall(void* Addr, void* Detour/*, void** Original = nullptr*/)
{
// int64_t delta = targetAddr - (instrAddr + 5);
// *(int32_t*)(instrAddr + 1) = static_cast<int32_t>(delta);
}
static bool Hook(UObject* DefaultClass, UFunction* Function, void* Detour, void** Original = nullptr, bool bUseSecondMethod = true, bool bHookExec = false) // Native hook static bool Hook(UObject* DefaultClass, UFunction* Function, void* Detour, void** Original = nullptr, bool bUseSecondMethod = true, bool bHookExec = false) // Native hook
{ {
if (!Function) if (!Function)
@@ -207,10 +214,13 @@ namespace Hooking
return false; return false;
} }
auto Exec = Function->GetFunc(); auto& Exec = Function->GetFunc();
if (bHookExec) if (bHookExec)
return Hook(Exec, Detour, Original); {
Exec = Detour;
return true;
}
auto AddrOrIdx = bUseSecondMethod ? GetFunctionIdxOrPtr2(Function) : GetFunctionIdxOrPtr(Function); auto AddrOrIdx = bUseSecondMethod ? GetFunctionIdxOrPtr2(Function) : GetFunctionIdxOrPtr(Function);

View File

@@ -69,6 +69,7 @@ inline void InitLogger()
MakeLogger("LogEvent"); MakeLogger("LogEvent");
MakeLogger("LogPlaylist"); MakeLogger("LogPlaylist");
MakeLogger("LogGame"); MakeLogger("LogGame");
MakeLogger("LogAI");
} }
#define LOG_DEBUG(loggerName, ...) \ #define LOG_DEBUG(loggerName, ...) \

View File

@@ -13,12 +13,6 @@
FAILED_LISTEN = 3 FAILED_LISTEN = 3
}; */ }; */
namespace Globals
{
extern inline bool bCreative = false;
extern inline bool bGoingToPlayEvent = false;
}
extern inline UObject* (*StaticLoadObjectOriginal)(UClass*, UObject*, const wchar_t* InName, const wchar_t* Filename, uint32_t LoadFlags, UObject* Sandbox, bool bAllowObjectReconciliation) = nullptr; extern inline UObject* (*StaticLoadObjectOriginal)(UClass*, UObject*, const wchar_t* InName, const wchar_t* Filename, uint32_t LoadFlags, UObject* Sandbox, bool bAllowObjectReconciliation) = nullptr;
template <typename T = UObject> template <typename T = UObject>