a lottt of stuff

This commit is contained in:
Milxnor
2023-03-05 01:03:51 -05:00
parent 039731eb68
commit 3e2da1eedf
44 changed files with 2086 additions and 1165 deletions

View File

@@ -114,6 +114,8 @@ public:
bool Remove(const int Index)
{
// return false;
if (Index < ArrayNum)
{
if (Index != ArrayNum - 1)

View File

@@ -0,0 +1,17 @@
#pragma once
#include "ContainerAllocationPolicies.h"
class TBitArray
{
private:
template <typename ArrayType>
friend class TSparseArray;
template <typename SetType>
friend class TSet;
private:
TInlineAllocator<4>::ForElementType<unsigned int> Data;
int NumBits;
int MaxBits;
};

View File

@@ -0,0 +1,94 @@
#include "BuildingActor.h"
#include "FortWeapon.h"
#include "BuildingSMActor.h"
#include "FortPlayerControllerAthena.h"
#include "FortPawn.h"
#include "FortWeaponMeleeItemDefinition.h"
#include "CurveTable.h"
#include "DataTable.h"
#include "FortResourceItemDefinition.h"
#include "FortKismetLibrary.h"
#include "DataTableFunctionLibrary.h"
void ABuildingActor::OnDamageServerHook(ABuildingActor* BuildingActor, float Damage, FGameplayTagContainer DamageTags,
FVector Momentum, /* FHitResult */ __int64 HitInfo, APlayerController* InstigatedBy, AActor* DamageCauser,
/* FGameplayEffectContextHandle */ __int64 EffectContext)
{
LOG_INFO(LogDev, "Befor3e");
auto BuildingSMActor = Cast<ABuildingSMActor>(BuildingActor);
auto PlayerController = Cast<AFortPlayerControllerAthena>(InstigatedBy);
auto Pawn = PlayerController ? PlayerController->GetMyFortPawn() : nullptr;
auto Weapon = Cast<AFortWeapon>(DamageCauser);
if (!BuildingSMActor || !PlayerController || !Pawn || !Weapon)
return OnDamageServerOriginal(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext);
auto WeaponData = Cast<UFortWeaponMeleeItemDefinition>(Weapon->GetWeaponData());
if (!WeaponData)
return OnDamageServerOriginal(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext);
auto ResourceCount = 0;
UFortResourceItemDefinition* ItemDef = UFortKismetLibrary::K2_GetResourceItemDefinition(BuildingSMActor->GetResourceType());
static auto BuildingResourceAmountOverrideOffset = BuildingSMActor->GetOffset("BuildingResourceAmountOverride");
auto& BuildingResourceAmountOverride = BuildingSMActor->Get<FCurveTableRowHandle>(BuildingResourceAmountOverrideOffset);
if (BuildingResourceAmountOverride.RowName.IsValid())
{
// auto AssetManager = Cast<UFortAssetManager>(GEngine->AssetManager);
// auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGGetGameStateAthena);
UCurveTable* CurveTable = nullptr; // GameState->CurrentPlaylistInfo.BasePlaylist ? GameState->CurrentPlaylistInfo.BasePlaylist->ResourceRates.Get() : nullptr;
LOG_INFO(LogDev, "Before1");
if (!CurveTable)
CurveTable = FindObject<UCurveTable>("/Game/Athena/Balance/DataTables/AthenaResourceRates.AthenaResourceRates");
{
// auto curveMap = ((UDataTable*)CurveTable)->GetRowMap();
LOG_INFO(LogDev, "Before {}", __int64(CurveTable));
float Out;
FString ContextString;
UDataTableFunctionLibrary::EvaluateCurveTableRow(CurveTable, BuildingResourceAmountOverride.RowName, 0, ContextString, nullptr, &Out);
LOG_INFO(LogDev, "Out: {}", Out);
auto DamageThatWillAffect = Damage;
auto skid = Out / (BuildingSMActor->GetMaxHealth() / DamageThatWillAffect);
ResourceCount = round(skid); // almost right
}
}
if (!ItemDef || ResourceCount <= 0)
{
return OnDamageServerOriginal(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext);
// return OnDamageServer(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext);
}
bool bIsWeakspot = Damage == 100.0f;
PlayerController->ClientReportDamagedResourceBuilding(BuildingSMActor, BuildingSMActor->GetResourceType(), ResourceCount, false, bIsWeakspot);
if (ResourceCount > 0)
{
bool bShouldUpdate = false;
PlayerController->GetWorldInventory()->AddItem(ItemDef, &bShouldUpdate, ResourceCount);
if (bShouldUpdate)
PlayerController->GetWorldInventory()->Update();
}
return OnDamageServerOriginal(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext);
}
UClass* ABuildingActor::StaticClass()
{
static auto Class = FindObject<UClass>(L"/Script/FortniteGame.BuildingActor");
return Class;
}

View File

@@ -2,6 +2,9 @@
#include "Actor.h"
#include "reboot.h" // we want to prevent this but im to lazy to make cpp file
#include "PlayerController.h"
#include "GameplayTagContainer.h"
class ABuildingActor : public AActor
{
@@ -18,4 +21,22 @@ public:
static auto fn = FindObject<UFunction>("/Script/FortniteGame.BuildingActor.InitializeKismetSpawnedBuildingActor");
this->ProcessEvent(fn, &IBAParams);
}
float GetMaxHealth()
{
float MaxHealth = 0;
static auto fn = FindObject<UFunction>("/Script/FortniteGame.BuildingActor.GetMaxHealth");
this->ProcessEvent(fn, &MaxHealth);
return MaxHealth;
}
static inline void (*OnDamageServerOriginal)(ABuildingActor* BuildingActor, float Damage, FGameplayTagContainer DamageTags,
FVector Momentum, /* FHitResult */ __int64 HitInfo, APlayerController* InstigatedBy, AActor* DamageCauser,
/* FGameplayEffectContextHandle */ __int64 EffectContext);
static void OnDamageServerHook(ABuildingActor* BuildingActor, float Damage, FGameplayTagContainer DamageTags,
FVector Momentum, /* FHitResult */ __int64 HitInfo, APlayerController* InstigatedBy, AActor* DamageCauser,
/* FGameplayEffectContextHandle */ __int64 EffectContext);
static UClass* StaticClass();
};

View File

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

View File

@@ -3,6 +3,16 @@
#include "BuildingActor.h"
#include "PlayerState.h"
enum class EFortResourceType : uint8_t
{
Wood = 0,
Stone = 1,
Metal = 2,
Permanite = 3,
None = 4,
EFortResourceType_MAX = 5
};
class ABuildingSMActor : public ABuildingActor
{
public:
@@ -32,4 +42,12 @@ public:
static auto CurrentBuildingLevelOffset = GetOffset("CurrentBuildingLevel");
return Get<int>(CurrentBuildingLevelOffset);
}
EFortResourceType& GetResourceType()
{
static auto ResourceTypeOffset = GetOffset("ResourceType");
return Get<EFortResourceType>(ResourceTypeOffset);
}
static UClass* StaticClass();
};

View File

@@ -4,6 +4,6 @@
UClass* AFortWeap_EditingTool::StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortWeap_EditingTool");
static auto Class = FindObject<UClass>(L"/Script/FortniteGame.FortWeap_EditingTool");
return Class;
}

View File

@@ -0,0 +1,29 @@
#pragma once
template <int NumElements>
class TInlineAllocator
{
private:
template <int Size, int Alignment>
struct alignas(Alignment) TAlignedBytes
{
unsigned char Pad[Size];
};
template <typename ElementType>
struct TTypeCompatibleBytes : public TAlignedBytes<sizeof(ElementType), alignof(ElementType)>
{
};
public:
template <typename ElementType>
class ForElementType
{
friend class TBitArray;
private:
TTypeCompatibleBytes<ElementType> InlineData[NumElements];
ElementType* SecondaryData;
};
};

View File

@@ -0,0 +1,15 @@
#pragma once
#include "Object.h"
#include "NameTypes.h"
class UCurveTable : public UObject
{
public:
};
struct FCurveTableRowHandle
{
UCurveTable* CurveTable;
FName RowName;
};

View File

@@ -0,0 +1,17 @@
#pragma once
#include "Object.h"
#include "Map.h"
class UDataTable : public UObject
{
public:
template <typename RowDataType = uint8_t>
TMap<FName, RowDataType*> GetRowMap()
{
static auto RowStructOffset = FindOffsetStruct("/Script/Engine.DataTable", "RowStruct");
return *(TMap<FName, RowDataType*>*)(__int64(this) + (RowStructOffset + sizeof(UObject*))); // because after rowstruct is rowmap
}
};

View File

@@ -0,0 +1,30 @@
#include "DataTableFunctionLibrary.h"
#include "reboot.h"
void UDataTableFunctionLibrary::EvaluateCurveTableRow(UCurveTable* CurveTable, FName RowName, float InXY,
FString ContextString, EEvaluateCurveTableResult* OutResult, float* OutXY)
{
static auto fn = FindObject<UFunction>("/Script/Engine.DataTableFunctionLibrary.EvaluateCurveTableRow");
float wtf{};
EEvaluateCurveTableResult wtf1{};
struct { UCurveTable* CurveTable; FName RowName; float InXY; EEvaluateCurveTableResult OutResult; float OutXY; FString ContextString; }
UDataTableFunctionLibrary_EvaluateCurveTableRow_Params{CurveTable, RowName, InXY, wtf1, wtf, ContextString};
static auto DefaultClass = StaticClass();
DefaultClass->ProcessEvent(fn, &UDataTableFunctionLibrary_EvaluateCurveTableRow_Params);
if (OutResult)
*OutResult = wtf1;
if (OutXY)
*OutXY = wtf;
}
UClass* UDataTableFunctionLibrary::StaticClass()
{
static auto Class = FindObject<UClass>("/Script/Engine.DataTableFunctionLibrary");
return Class;
}

View File

@@ -0,0 +1,21 @@
#pragma once
#include "Object.h"
#include "CurveTable.h"
#include "UnrealString.h"
enum class EEvaluateCurveTableResult : uint8_t
{
RowFound = 0,
RowNotFound = 1,
EEvaluateCurveTableResult_MAX = 2
};
class UDataTableFunctionLibrary : public UObject
{
public:
static void EvaluateCurveTableRow(UCurveTable* CurveTable, FName RowName, float InXY,
FString ContextString, EEvaluateCurveTableResult* OutResult, float* OutXY);
static UClass* StaticClass();
};

View File

@@ -30,6 +30,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
else
{
GameState->Get("CurrentPlaylistData") = Playlist;
GameState->OnRep_CurrentPlaylistInfo();
}
};
@@ -121,7 +122,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
GameState->OnRep_GamePhase();
}
auto Playlist = FindObject("/Game/Athena/Playlists/Playground/Playlist_Playground.Playlist_Playground"); // FindObject("/Game/Athena/Playlists/Playlist_DefaultSolo.Playlist_DefaultSolo");
auto Playlist = FindObject("/Game/Athena/Playlists/Playlist_DefaultSolo.Playlist_DefaultSolo");
// FindObject("/Game/Athena/Playlists/Playground/Playlist_Playground.Playlist_Playground");
SetPlaylist(Playlist);
GameState->Get<float>("WarmupCountdownEndTime") = TimeSeconds + Duration;
@@ -196,34 +198,41 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
PlayerStateAthena->ProcessEvent(OnRep_bHasStartedPlayingFn);
}
// if (false)
if (false)
{
static auto GameplayAbilitySet = FindObject<UObject>("/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer");
static auto GameplayAbilitySet = FindObject<UObject>("/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer") ?
FindObject<UObject>("/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer") :
FindObject<UObject>("/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_DefaultPlayer.GAS_DefaultPlayer");
static auto GameplayAbilitiesOffset = GameplayAbilitySet->GetOffset("GameplayAbilities");
auto GameplayAbilities = GameplayAbilitySet->GetPtr<TArray<UClass*>>(GameplayAbilitiesOffset);
for (int i = 0; i < GameplayAbilities->Num(); i++)
if (GameplayAbilitySet)
{
UClass* AbilityClass = GameplayAbilities->At(i);
static auto GameplayAbilitiesOffset = GameplayAbilitySet->GetOffset("GameplayAbilities");
auto GameplayAbilities = GameplayAbilitySet->GetPtr<TArray<UClass*>>(GameplayAbilitiesOffset);
// LOG_INFO(LogDev, "AbilityClass {}", __int64(AbilityClass));
for (int i = 0; i < GameplayAbilities->Num(); i++)
{
UClass* AbilityClass = GameplayAbilities->At(i);
if (!AbilityClass)
continue;
LOG_INFO(LogDev, "AbilityClass {}", __int64(AbilityClass));
// LOG_INFO(LogDev, "AbilityClass Name {}", AbilityClass->GetFullName());
if (!AbilityClass)
continue;
auto DefaultAbility = AbilityClass->CreateDefaultObject();
// LOG_INFO(LogDev, "AbilityClass Name {}", AbilityClass->GetFullName());
// LOG_INFO(LogDev, "DefaultAbility {}", __int64(DefaultAbility));
// LOG_INFO(LogDev, "DefaultAbility Name {}", DefaultAbility->GetFullName());
// LOG_INFO(LogDev, "DefaultAbility {}", __int64(DefaultAbility));
// LOG_INFO(LogDev, "DefaultAbility Name {}", DefaultAbility->GetFullName());
PlayerStateAthena->GetAbilitySystemComponent()->GiveAbilityEasy(AbilityClass);
PlayerStateAthena->GetAbilitySystemComponent()->GiveAbilityEasy(AbilityClass);
}
}
}
static auto GameMemberInfoArrayOffset = GameState->GetOffset("GameMemberInfoArray", false);
// if (false)
// if (GameMemberInfoArrayOffset != 0)
if (Engine_Version >= 423)
{
struct FUniqueNetIdRepl
{
@@ -268,7 +277,6 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
static auto GameMemberInfoArray_MembersOffset = 0x0108;
static auto GameMemberInfoArrayOffset = GameState->GetOffset("GameMemberInfoArray");
auto GameMemberInfoArray = GameState->GetPtr<FFastArraySerializer>(GameMemberInfoArrayOffset);
((TArray<FGameMemberInfo>*)(__int64(GameMemberInfoArray) + GameMemberInfoArray_MembersOffset))->Add(*GameMemberInfo, GameMemberInfoStructSize);

View File

@@ -29,7 +29,7 @@ std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddI
// NewItemInstance->GetItemEntry()->GetItemDefinition() = ItemDefinition;
static auto FortItemEntryStruct = FindObject("/Script/FortniteGame.FortItemEntry");
static auto FortItemEntryStruct = FindObject(L"/Script/FortniteGame.FortItemEntry");
static auto FortItemEntrySize = *(int*)(__int64(FortItemEntryStruct) + Offsets::PropertiesSize);
// LOG_INFO(LogDev, "FortItemEntryStruct {}", __int64(FortItemEntryStruct));

View File

@@ -53,7 +53,7 @@ public:
ProcessEvent(HandleInventoryLocalUpdateFn);
}
FORCENOINLINE void Update(bool bMarkArrayDirty = false)
FORCENOINLINE void Update(bool bMarkArrayDirty = true)
{
HandleInventoryLocalUpdate();

View File

@@ -2,6 +2,6 @@
void UFortItem::SetOwningControllerForTemporaryItem(UObject* Controller)
{
static auto SOCFTIFn = FindObject<UFunction>("/Script/FortniteGame.FortItem.SetOwningControllerForTemporaryItem");
static auto SOCFTIFn = FindObject<UFunction>(L"/Script/FortniteGame.FortItem.SetOwningControllerForTemporaryItem");
this->ProcessEvent(SOCFTIFn, &Controller);
}

View File

@@ -2,7 +2,7 @@
UFortItem* UFortItemDefinition::CreateTemporaryItemInstanceBP(int Count, int Level)
{
static auto CreateTemporaryItemInstanceBPFunction = FindObject<UFunction>("/Script/FortniteGame.FortItemDefinition.CreateTemporaryItemInstanceBP");
static auto CreateTemporaryItemInstanceBPFunction = FindObject<UFunction>(L"/Script/FortniteGame.FortItemDefinition.CreateTemporaryItemInstanceBP");
struct { int Count; int Level; UFortItem* ReturnValue; } CreateTemporaryItemInstanceBP_Params{ Count, 1 };
ProcessEvent(CreateTemporaryItemInstanceBPFunction, &CreateTemporaryItemInstanceBP_Params);

View File

@@ -0,0 +1,18 @@
#include "FortKismetLibrary.h"
UFortResourceItemDefinition* UFortKismetLibrary::K2_GetResourceItemDefinition(EFortResourceType ResourceType)
{
static auto fn = FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_GetResourceItemDefinition");
struct { EFortResourceType type; UFortResourceItemDefinition* ret; } params{ResourceType};
static auto DefaultClass = StaticClass();
DefaultClass->ProcessEvent(fn, &params);
return params.ret;
}
UClass* UFortKismetLibrary::StaticClass()
{
static auto ptr = FindObject<UClass>(L"/Script/FortniteGame.FortKismetLibrary");
return ptr;
}

View File

@@ -0,0 +1,14 @@
#pragma once
#include "Object.h"
#include "FortResourceItemDefinition.h"
#include "BuildingSMActor.h"
class UFortKismetLibrary : public UObject
{
public:
static UFortResourceItemDefinition* K2_GetResourceItemDefinition(EFortResourceType ResourceType);
static UClass* StaticClass();
};

View File

View File

View File

@@ -8,6 +8,17 @@
#include "BuildingWeapons.h"
#include "ActorComponent.h"
#include "FortPlayerStateAthena.h"
void AFortPlayerController::ClientReportDamagedResourceBuilding(ABuildingSMActor* BuildingSMActor, EFortResourceType PotentialResourceType, int PotentialResourceCount, bool bDestroyed, bool bJustHitWeakspot)
{
static auto fn = FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ClientReportDamagedResourceBuilding");
struct { ABuildingSMActor* BuildingSMActor; EFortResourceType PotentialResourceType; int PotentialResourceCount; bool bDestroyed; bool bJustHitWeakspot; }
AFortPlayerController_ClientReportDamagedResourceBuilding_Params{BuildingSMActor, PotentialResourceType, PotentialResourceCount, bDestroyed, bJustHitWeakspot};
this->ProcessEvent(fn, &AFortPlayerController_ClientReportDamagedResourceBuilding_Params);
}
void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation)
{
@@ -96,6 +107,39 @@ void AFortPlayerController::ServerCreateBuildingActorHook(AFortPlayerController*
BuildingActor->InitializeBuildingActor(PlayerController, BuildingActor, true);
}
void AFortPlayerController::ServerPlayEmoteItemHook(AFortPlayerController* PlayerController, UObject* EmoteAsset)
{
auto PlayerState = (AFortPlayerStateAthena*)PlayerController->GetPlayerState();
auto Pawn = PlayerController->GetPawn();
if (!EmoteAsset || !PlayerState || !Pawn)
return;
UObject* AbilityToUse = nullptr;
if (!AbilityToUse)
{
static auto EmoteGameplayAbilityDefault = FindObject("/Game/Abilities/Emotes/GAB_Emote_Generic.Default__GAB_Emote_Generic_C");
AbilityToUse = EmoteGameplayAbilityDefault;
}
if (!AbilityToUse)
return;
int outHandle = 0;
FGameplayAbilitySpecHandle Handle{};
Handle.GenerateNewHandle();
FGameplayAbilitySpec* Spec = MakeNewSpec((UClass*)AbilityToUse, EmoteAsset, true);
static unsigned int* (*GiveAbilityAndActivateOnce)(UAbilitySystemComponent * ASC, int* outHandle, __int64 Spec)
= decltype(GiveAbilityAndActivateOnce)(Addresses::GiveAbilityAndActivateOnce);
GiveAbilityAndActivateOnce(PlayerState->GetAbilitySystemComponent(), &outHandle, __int64(Spec));
}
void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit)
{
if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced())

View File

@@ -12,6 +12,8 @@ struct FCreateBuildingActorData { uint32_t BuildingClassHandle; FVector BuildLoc
class AFortPlayerController : public APlayerController
{
public:
void ClientReportDamagedResourceBuilding(ABuildingSMActor* BuildingSMActor, EFortResourceType PotentialResourceType, int PotentialResourceCount, bool bDestroyed, bool bJustHitWeakspot);
AFortInventory*& GetWorldInventory()
{
static auto WorldInventoryOffset = GetOffset("WorldInventory");
@@ -24,6 +26,7 @@ public:
return Get<AFortPawn*>(MyFortPawnOffset);
}
static UClass* StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPlayerController");
@@ -47,6 +50,8 @@ public:
static void ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation);
static void ServerCreateBuildingActorHook(AFortPlayerController* PlayerController, FCreateBuildingActorData CreateBuildingData);
static void ServerPlayEmoteItemHook(AFortPlayerController* PlayerController, UObject* EmoteAsset);
static void ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit);
static void ServerEditBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit, UClass* NewBuildingClass, int RotationIterations, char bMirrored);
static void ServerEndEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToStopEditing);

View File

@@ -0,0 +1,8 @@
#pragma once
#include "FortWorldItemDefinition.h"
class UFortResourceItemDefinition : public UFortWorldItemDefinition
{
public:
};

View File

@@ -0,0 +1,9 @@
#include "FortWeapon.h"
#include "reboot.h"
UClass* AFortWeapon::StaticClass()
{
static auto Class = FindObject<UClass>(L"/Script/FortniteGame.FortWeapon");
return Class;
}

View File

@@ -4,5 +4,13 @@
class AFortWeapon : public AActor
{
public:
template <typename T = class UFortWeaponItemDefinition>
T* GetWeaponData()
{
static auto WeaponDataOffset = GetOffset("WeaponData");
return Get<T*>(WeaponDataOffset);
}
static UClass* StaticClass();
};

View File

@@ -0,0 +1,14 @@
#pragma once
#include "FortWeaponItemDefinition.h"
#include "reboot.h"
class UFortWeaponMeleeItemDefinition : public UFortWeaponItemDefinition
{
public:
static UClass* StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortWeaponMeleeItemDefinition");
return Class;
}
};

View File

@@ -37,7 +37,7 @@ struct FGameplayAbilitySpec : FFastArraySerializerItem
}
};
static FGameplayAbilitySpec* MakeNewSpec(UClass* GameplayAbilityClass, UObject* SourceObject = nullptr)
static FGameplayAbilitySpec* MakeNewSpec(UClass* GameplayAbilityClass, UObject* SourceObject = nullptr, bool bAlreadyIsDefault = false)
{
auto NewSpec = Alloc<FGameplayAbilitySpec>(FGameplayAbilitySpec::GetStructSize());
@@ -55,7 +55,7 @@ static FGameplayAbilitySpec* MakeNewSpec(UClass* GameplayAbilityClass, UObject*
((FFastArraySerializerItem*)NewSpec)->ReplicationKey = -1;
NewSpec->GetHandle().GenerateNewHandle();
NewSpec->GetAbility() = GameplayAbilityClass->CreateDefaultObject();
NewSpec->GetAbility() = bAlreadyIsDefault ? GameplayAbilityClass : GameplayAbilityClass->CreateDefaultObject();
*(int*)(__int64(NewSpec) + LevelOffset) = 0;
*(int*)(__int64(NewSpec) + InputIDOffset) = -1;
*(UObject**)(__int64(NewSpec) + SourceObjectOffset) = SourceObject;

View File

@@ -0,0 +1,67 @@
#pragma once
#include "NameTypes.h"
#include "Array.h"
struct FGameplayTag
{
static const int npos = -1; // lol?
FName TagName;
};
struct FGameplayTagContainer
{
TArray<FGameplayTag> GameplayTags;
TArray<FGameplayTag> ParentTags;
std::string ToStringSimple(bool bQuoted)
{
std::string RetString;
for (int i = 0; i < GameplayTags.Num(); ++i)
{
if (bQuoted)
{
RetString += ("\"");
}
RetString += GameplayTags.at(i).TagName.ToString();
if (bQuoted)
{
RetString += ("\"");
}
if (i < GameplayTags.Num() - 1)
{
RetString += (", ");
}
}
return RetString;
}
int Find(const std::string& Str)
{
for (int i = 0; i < GameplayTags.Num(); i++)
{
if (GameplayTags.at(i).TagName.ToString() == Str)
return i;
}
return FGameplayTag::npos;
}
int Find(FGameplayTag& Tag)
{
return Find(Tag.TagName.ToString());
}
bool Contains(const std::string& Str)
{
return Find(Str) != FGameplayTag::npos;
}
void Reset()
{
GameplayTags.Free();
ParentTags.Free();
}
};

36
Project Reboot 3.0/Map.h Normal file
View File

@@ -0,0 +1,36 @@
#pragma once
#include "Set.h"
// template <typename KeyType, typename ValueType>
// using TPair = TTuple<KeyType, ValueType>;
template <typename KeyType, typename ValueType>
class TPair
{
public:
KeyType First;
ValueType Second;
};
template <typename KeyType, typename ValueType> //, typename SetAllocator, typename KeyFuncs>
class TMapBase
{
public:
typedef TPair<KeyType, ValueType> ElementType;
typedef TSet<ElementType/*, KeyFuncs, SetAllocator */> ElementSetType;
ElementSetType Pairs;
};
template <typename KeyType, typename ValueType> //, typename SetAllocator, typename KeyFuncs>
class TSortableMapBase : public TMapBase<KeyType, ValueType> //, SetAllocator, KeyFuncs>
{
};
template<typename KeyType, typename ValueType> //,typename SetAllocator /*= FDefaultSetAllocator*/, typename KeyFuncs /*= TDefaultMapHashableKeyFuncs<KeyType,ValueType,false>*/>
class TMap : public TSortableMapBase<KeyType, ValueType> //, SetAllocator, KeyFuncs>
{
};

View File

@@ -13,4 +13,6 @@ struct FName
uint32 Number;
std::string ToString();
bool IsValid() { return ComparisonIndex.Value > 0; }
};

View File

@@ -5,7 +5,7 @@
#include "Class.h"
#include "KismetSystemLibrary.h"
int UObject::GetOffset(const std::string& ChildName)
int UObject::GetOffset(const std::string& ChildName, bool bWarnIfNotFound)
{
auto getFNameOfProp = [](void* Property) -> FName*
{
@@ -47,7 +47,8 @@ int UObject::GetOffset(const std::string& ChildName)
}
}
LOG_WARN(LogFinder, "Unable to find0{}", ChildName);
if (bWarnIfNotFound)
LOG_WARN(LogFinder, "Unable to find0{}", ChildName);
return 0;
}

View File

@@ -44,7 +44,7 @@ public:
bool IsA(UClass* Other);
int GetOffset(const std::string& ChildName);
int GetOffset(const std::string& ChildName, bool bWarnIfNotFound = true);
template <typename T = UObject*>
T& Get(int Offset) { return *(T*)(__int64(this) + Offset); }

View File

@@ -168,8 +168,11 @@
<ClCompile Include="Actor.cpp" />
<ClCompile Include="ActorComponent.cpp" />
<ClCompile Include="addresses.cpp" />
<ClCompile Include="BuildingActor.cpp" />
<ClCompile Include="BuildingSMActor.cpp" />
<ClCompile Include="BuildingWeapons.cpp" />
<ClCompile Include="Class.cpp" />
<ClCompile Include="DataTableFunctionLibrary.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="FortGameModeAthena.cpp" />
<ClCompile Include="FortGameModeZone.cpp" />
@@ -178,8 +181,11 @@
<ClCompile Include="FortInventory.h" />
<ClCompile Include="FortItem.cpp" />
<ClCompile Include="FortItemDefinition.cpp" />
<ClCompile Include="FortKismetLibrary.cpp" />
<ClCompile Include="FortLootPackage.cpp" />
<ClCompile Include="FortPawn.cpp" />
<ClCompile Include="FortPlayerController.cpp" />
<ClCompile Include="FortWeapon.cpp" />
<ClCompile Include="GameModeBase.cpp" />
<ClCompile Include="GameplayStatics.cpp" />
<ClCompile Include="KismetStringLibrary.cpp" />
@@ -199,10 +205,15 @@
<ClInclude Include="ActorComponent.h" />
<ClInclude Include="addresses.h" />
<ClInclude Include="Array.h" />
<ClInclude Include="BitArray.h" />
<ClInclude Include="BuildingActor.h" />
<ClInclude Include="BuildingSMActor.h" />
<ClInclude Include="Class.h" />
<ClInclude Include="ContainerAllocationPolicies.h" />
<ClInclude Include="Controller.h" />
<ClInclude Include="CurveTable.h" />
<ClInclude Include="DataTable.h" />
<ClInclude Include="DataTableFunctionLibrary.h" />
<ClInclude Include="Engine.h" />
<ClInclude Include="EngineTypes.h" />
<ClInclude Include="finder.h" />
@@ -213,19 +224,24 @@
<ClInclude Include="FortGameStateAthena.h" />
<ClInclude Include="FortItem.h" />
<ClInclude Include="FortItemDefinition.h" />
<ClInclude Include="FortKismetLibrary.h" />
<ClInclude Include="FortLootPackage.h" />
<ClInclude Include="FortPawn.h" />
<ClInclude Include="FortPlayerController.h" />
<ClInclude Include="FortPlayerControllerAthena.h" />
<ClInclude Include="FortPlayerState.h" />
<ClInclude Include="FortPlayerStateAthena.h" />
<ClInclude Include="FortResourceItemDefinition.h" />
<ClInclude Include="FortWeapon.h" />
<ClInclude Include="FortWeaponItemDefinition.h" />
<ClInclude Include="BuildingWeapons.h" />
<ClInclude Include="FortWeaponMeleeItemDefinition.h" />
<ClInclude Include="FortWorldItemDefinition.h" />
<ClInclude Include="GameMode.h" />
<ClInclude Include="GameModeBase.h" />
<ClInclude Include="GameplayAbilitySpec.h" />
<ClInclude Include="GameplayStatics.h" />
<ClInclude Include="GameplayTagContainer.h" />
<ClInclude Include="GameSession.h" />
<ClInclude Include="GameState.h" />
<ClInclude Include="hooking.h" />
@@ -233,6 +249,7 @@
<ClInclude Include="KismetStringLibrary.h" />
<ClInclude Include="KismetSystemLibrary.h" />
<ClInclude Include="log.h" />
<ClInclude Include="Map.h" />
<ClInclude Include="NameTypes.h" />
<ClInclude Include="NetDriver.h" />
<ClInclude Include="NetSerialization.h" />
@@ -246,8 +263,11 @@
<ClInclude Include="reboot.h" />
<ClInclude Include="Rotator.h" />
<ClInclude Include="ScriptInterface.h" />
<ClInclude Include="Set.h" />
<ClInclude Include="SparseArray.h" />
<ClInclude Include="Stack.h" />
<ClInclude Include="Transform.h" />
<ClInclude Include="Tuple.h" />
<ClInclude Include="UnrealString.h" />
<ClInclude Include="UObjectArray.h" />
<ClInclude Include="UObjectGlobals.h" />

View File

@@ -83,6 +83,24 @@
<Filter>Engine\Source\Runtime\Engine\Private\Components</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="FortLootPackage.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile>
<ClCompile Include="FortKismetLibrary.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private</Filter>
</ClCompile>
<ClCompile Include="BuildingActor.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Building</Filter>
</ClCompile>
<ClCompile Include="FortWeapon.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Weapons</Filter>
</ClCompile>
<ClCompile Include="BuildingSMActor.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Building</Filter>
</ClCompile>
<ClCompile Include="DataTableFunctionLibrary.cpp">
<Filter>Engine\Source\Runtime\Engine\Private</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="log.h" />
@@ -234,10 +252,10 @@
<Filter>Engine\Source\Runtime\Engine\Classes\Kismet</Filter>
</ClInclude>
<ClInclude Include="BuildingActor.h">
<Filter>FortniteGame\Source\FortniteGame\Private\Building</Filter>
<Filter>FortniteGame\Source\FortniteGame\Public\Building</Filter>
</ClInclude>
<ClInclude Include="BuildingSMActor.h">
<Filter>FortniteGame\Source\FortniteGame\Private\Building</Filter>
<Filter>FortniteGame\Source\FortniteGame\Public\Building</Filter>
</ClInclude>
<ClInclude Include="Rotator.h">
<Filter>Engine\Source\Runtime\Core\Public\Math</Filter>
@@ -254,6 +272,48 @@
<ClInclude Include="ActorComponent.h">
<Filter>Engine\Source\Runtime\Engine\Classes\Components</Filter>
</ClInclude>
<ClInclude Include="FortLootPackage.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Items</Filter>
</ClInclude>
<ClInclude Include="FortKismetLibrary.h">
<Filter>FortniteGame\Source\FortniteGame\Public</Filter>
</ClInclude>
<ClInclude Include="GameplayTagContainer.h">
<Filter>Engine\Source\Runtime\GameplayTags\Classes</Filter>
</ClInclude>
<ClInclude Include="FortWeaponMeleeItemDefinition.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Items</Filter>
</ClInclude>
<ClInclude Include="CurveTable.h">
<Filter>Engine\Source\Runtime\Engine\Classes\Engine</Filter>
</ClInclude>
<ClInclude Include="DataTable.h">
<Filter>Engine\Source\Runtime\Engine\Classes\Engine</Filter>
</ClInclude>
<ClInclude Include="FortResourceItemDefinition.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Items</Filter>
</ClInclude>
<ClInclude Include="Map.h">
<Filter>Engine\Source\Runtime\Core\Public\Containers</Filter>
</ClInclude>
<ClInclude Include="Tuple.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="Set.h">
<Filter>Engine\Source\Runtime\Core\Public\Containers</Filter>
</ClInclude>
<ClInclude Include="SparseArray.h">
<Filter>Engine\Source\Runtime\Core\Public\Containers</Filter>
</ClInclude>
<ClInclude Include="BitArray.h">
<Filter>Engine\Source\Runtime\Core\Public\Containers</Filter>
</ClInclude>
<ClInclude Include="ContainerAllocationPolicies.h">
<Filter>Engine\Source\Runtime\Core\Public\Containers</Filter>
</ClInclude>
<ClInclude Include="DataTableFunctionLibrary.h">
<Filter>Engine\Source\Runtime\Engine\Classes\Kismet</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Engine">
@@ -379,9 +439,6 @@
<Filter Include="FortniteGame\Source\FortniteGame\Private\Player">
<UniqueIdentifier>{a12cb364-3e34-454a-958f-b1fe54534353}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Private\Building">
<UniqueIdentifier>{a6fd658c-6824-4186-b45e-2edf5d20eeae}</UniqueIdentifier>
</Filter>
<Filter Include="Engine\Source\Runtime\Core\Private\Math">
<UniqueIdentifier>{6c0193a3-7b06-4298-99fe-a5a18be27d58}</UniqueIdentifier>
</Filter>
@@ -394,6 +451,21 @@
<Filter Include="Engine\Source\Runtime\Engine\Private\Components">
<UniqueIdentifier>{eab3cd46-ced6-4e56-9fda-ed35ec9f9f64}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Public\Building">
<UniqueIdentifier>{a6fd658c-6824-4186-b45e-2edf5d20eeae}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Private\Building">
<UniqueIdentifier>{1f8bc849-7da5-4917-a055-443ae102c233}</UniqueIdentifier>
</Filter>
<Filter Include="Engine\Source\Runtime\GameplayTags">
<UniqueIdentifier>{3f2848b1-9e39-4c4b-b3bb-b4b5a8bb8360}</UniqueIdentifier>
</Filter>
<Filter Include="Engine\Source\Runtime\GameplayTags\Classes">
<UniqueIdentifier>{247d4c62-23f7-4964-8879-5a0d65c44a73}</UniqueIdentifier>
</Filter>
<Filter Include="Engine\Source\Runtime\Core\Public\Templates">
<UniqueIdentifier>{31a7f342-8b7c-4594-a24d-c4dd5c9d230d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="UnrealEngine.cpp">

45
Project Reboot 3.0/Set.h Normal file
View File

@@ -0,0 +1,45 @@
#pragma once
#include "SparseArray.h"
template <typename ElementType>
class TSetElement
{
public:
ElementType Value;
mutable int32 HashNextId;
mutable int32 HashIndex;
TSetElement(ElementType InValue, int32 InHashNextId, int32 InHashIndex)
: Value(InValue)
, HashNextId(InHashNextId)
, HashIndex(InHashIndex)
{
}
FORCEINLINE TSetElement<ElementType>& operator=(const TSetElement<ElementType>& Other)
{
Value = Other.Value;
}
FORCEINLINE bool operator==(const TSetElement& Other) const
{
return Value == Other.Value;
}
FORCEINLINE bool operator!=(const TSetElement& Other) const
{
return Value != Other.Value;
}
};
template<typename InElementType> //, typename KeyFuncs, typename Allocator>
class TSet
{
typedef TSetElement<InElementType> ElementType;
typedef TSparseArrayElementOrListLink<ElementType> ArrayElementType;
TSparseArray<ElementType> Elements;
mutable TInlineAllocator<1>::ForElementType<int> Hash;
mutable int32 HashSize;
};

View File

@@ -0,0 +1,52 @@
#pragma once
#include "Array.h"
#include "BitArray.h"
template <typename ElementType>
union TSparseArrayElementOrListLink
{
TSparseArrayElementOrListLink(ElementType& InElement)
: ElementData(InElement)
{
}
TSparseArrayElementOrListLink(ElementType&& InElement)
: ElementData(InElement)
{
}
TSparseArrayElementOrListLink(int32 InPrevFree, int32 InNextFree)
: PrevFreeIndex(InPrevFree)
, NextFreeIndex(InNextFree)
{
}
TSparseArrayElementOrListLink<ElementType> operator=(const TSparseArrayElementOrListLink<ElementType>& Other)
{
return TSparseArrayElementOrListLink(Other.NextFreeIndex, Other.PrevFreeIndex);
}
/** If the element is allocated, its value is stored here. */
ElementType ElementData;
struct
{
/** If the element isn't allocated, this is a link to the previous element in the array's free list. */
int PrevFreeIndex;
/** If the element isn't allocated, this is a link to the next element in the array's free list. */
int NextFreeIndex;
};
};
template <typename ArrayType>
class TSparseArray
{
public:
typedef TSparseArrayElementOrListLink<ArrayType> FSparseArrayElement;
TArray<FSparseArrayElement> Data;
TBitArray AllocationFlags;
int32 FirstFreeIndex;
int32 NumFreeIndices;
};

View File

@@ -0,0 +1,2 @@
#pragma once

View File

@@ -11,10 +11,13 @@
#include "AbilitySystemComponent.h"
#include "finder.h"
#include <regex>
#include "BuildingActor.h"
void Addresses::SetupVersion()
{
// if (false)
if (false)
{
Engine_Version = 423;
Fortnite_Version = 10.40;
@@ -32,6 +35,74 @@ void Addresses::SetupVersion()
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());
std::string FullVersion;
FString toFree;
if (!GetEngineVersion)
{
auto VerStr = Memcury::Scanner::FindPattern("2B 2B 46 6F 72 74 6E 69 74 65 2B 52 65 6C 65 61 73 65 2D ? ? ? ?").Get();
// if (!VerStr)
FullVersion = decltype(FullVersion.c_str())(VerStr);
Engine_Version = 500;
}
else
{
toFree = GetEngineVersion();
FullVersion = toFree.ToString();
}
std::string FNVer = FullVersion;
std::string EngineVer = FullVersion;
std::string CLStr;
int CL = 0;
if (!FullVersion.contains("Live") && !FullVersion.contains(("Next")) && !FullVersion.contains(("Cert")))
{
if (GetEngineVersion)
{
FNVer.erase(0, FNVer.find_last_of(("-"), FNVer.length() - 1) + 1);
EngineVer.erase(EngineVer.find_first_of(("-"), FNVer.length() - 1), 40);
if (EngineVer.find_first_of(".") != EngineVer.find_last_of(".")) // this is for 4.21.0 and itll remove the .0
EngineVer.erase(EngineVer.find_last_of((".")), 2);
Engine_Version = std::stod(EngineVer) * 100;
}
else
{
const std::regex base_regex(("-([0-9.]*)-"));
std::cmatch base_match;
std::regex_search(FullVersion.c_str(), base_match, base_regex);
FNVer = base_match[1];
}
Fortnite_Version = std::stod(FNVer);
if (Fortnite_Version >= 16.00 && Fortnite_Version <= 18.40)
Engine_Version = 427; // 4.26.1;
}
else
{
// TODO
// Engine_Version = FullVersion.contains(("Next")) ? 419 : 416;
CLStr = FullVersion.substr(FullVersion.find_first_of('-') + 1);
CLStr = CLStr.substr(0, CLStr.find_first_of('+'));
CL = std::stoi(CLStr);
Engine_Version = CL <= 3775276 ? 416 : 419; // std::stoi(FullVersion.substr(0, FullVersion.find_first_of('-')));
Fortnite_Version = FullVersion.contains(("Next")) ? 2.4 : 1.8;
}
// Fortnite_Season = std::floor(Fortnite_Version);
FFastArraySerializer::bNewSerializer = Fortnite_Version >= 8.30;
}
@@ -57,6 +128,8 @@ void Addresses::FindAll()
Addresses::GiveAbility = FindGiveAbility();
Addresses::CantBuild = FindCantBuild();
Addresses::ReplaceBuildingActor = FindReplaceBuildingActor();
Addresses::GiveAbilityAndActivateOnce = FindGiveAbilityAndActivateOnce();
Addresses::OnDamageServer = FindOnDamageServer();
}
void Addresses::Print()
@@ -84,6 +157,8 @@ void Addresses::Print()
LOG_INFO(LogDev, "GiveAbility: 0x{:x}", GiveAbility - Base);
LOG_INFO(LogDev, "CantBuild: 0x{:x}", CantBuild - Base);
LOG_INFO(LogDev, "ReplaceBuildingActor: 0x{:x}", ReplaceBuildingActor - Base);
LOG_INFO(LogDev, "GiveAbilityAndActivateOnce: 0x{:x}", GiveAbilityAndActivateOnce - Base);
LOG_INFO(LogDev, "OnDamageServer: 0x{:x}", OnDamageServer - Base);
}
void Offsets::FindAll()
@@ -95,7 +170,7 @@ void Offsets::FindAll()
if (Engine_Version == 420 || Engine_Version == 421)
Offsets::Func = 0xB0;
else if (Engine_Version == 423 || Engine_Version == 424)
else if (Engine_Version >= 422 && Engine_Version <= 424)
Offsets::Func = 0xC0;
else if (Engine_Version == 425)
Offsets::Func = 0xF0;
@@ -146,7 +221,25 @@ void Addresses::Init()
FMemory::Realloc = decltype(FMemory::Realloc)(Realloc);
UAbilitySystemComponent::GiveAbilityOriginal = decltype(UAbilitySystemComponent::GiveAbilityOriginal)(GiveAbility);
UAbilitySystemComponent::InternalTryActivateAbilityOriginal = decltype(UAbilitySystemComponent::InternalTryActivateAbilityOriginal)(InternalTryActivateAbility);
ABuildingActor::OnDamageServerOriginal = decltype(ABuildingActor::OnDamageServerOriginal)(OnDamageServer);
// if (Engine_Version >= 421) ChunkedObjects = decltype(ChunkedObjects)(ObjectArray);
// else UnchunkedObjects = decltype(UnchunkedObjects)(ObjectArray);
}
std::vector<uint64> Addresses::GetFunctionsToNull()
{
std::vector<uint64> toNull;
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
}
if (Engine_Version == 421)
{
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 57 48 81 EC ? ? ? ? 48 8B BA ? ? ? ? 48 8B DA 0F 29").Get()); // Pawn Overlap
}
return toNull;
}

View File

@@ -30,11 +30,15 @@ namespace Addresses
extern inline uint64 GiveAbility = 0;
extern inline uint64 CantBuild = 0;
extern inline uint64 ReplaceBuildingActor = 0;
extern inline uint64 GiveAbilityAndActivateOnce = 0;
extern inline uint64 OnDamageServer = 0;
void SetupVersion(); // Finds Engine Version
void FindAll();
void Print();
void Init();
std::vector<uint64> GetFunctionsToNull();
}
namespace Offsets

View File

@@ -9,6 +9,8 @@
#include "FortPlayerControllerAthena.h"
#include "AbilitySystemComponent.h"
#include "Map.h"
enum ENetMode
{
NM_Standalone,
@@ -56,12 +58,14 @@ DWORD WINAPI Main(LPVOID)
static auto SwitchLevel = FindObject<UFunction>(L"/Script/Engine.PlayerController.SwitchLevel");
FString Level = Engine_Version < 424 ? L"Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501 ? L"Asteria_Terrain" : L"Artemis_Terrain" : L"Apollo_Terrain";
// 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!");
Hooking::MinHook::Hook((PVOID)Addresses::GetNetMode, (PVOID)GetNetModeHook, nullptr);
}
LOG_INFO(LogDev, "Size: 0x{:x}", sizeof(TMap<FName, void*>));
GetLocalPlayerController()->ProcessEvent(SwitchLevel, &Level);
auto& LocalPlayers = GetLocalPlayers();
@@ -71,8 +75,16 @@ DWORD WINAPI Main(LPVOID)
LocalPlayers.Remove(0);
}
for (auto func : Addresses::GetFunctionsToNull())
{
*(uint8_t*)func = 0xC3;
}
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook,
(PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false);
// return false;
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"),
AGameModeBase::SpawnDefaultPawnForHook, nullptr, false);
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.HandleStartingNewPlayer"), AFortGameModeAthena::Athena_HandleStartingNewPlayerHook,
@@ -80,13 +92,15 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerExecuteInventoryItem"),
AFortPlayerController::ServerExecuteInventoryItemHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerPlayEmoteItem"),
AFortPlayerController::ServerPlayEmoteItemHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerCreateBuildingActor"),
AFortPlayerController::ServerCreateBuildingActorHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>("/Script/FortniteGame.FortPlayerController.ServerBeginEditingBuildingActor"),
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerBeginEditingBuildingActor"),
AFortPlayerController::ServerBeginEditingBuildingActorHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>("/Script/FortniteGame.FortPlayerController.ServerEditBuildingActor"),
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerEditBuildingActor"),
AFortPlayerController::ServerEditBuildingActorHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>("/Script/FortniteGame.FortPlayerController.ServerEndEditingBuildingActor"),
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerEndEditingBuildingActor"),
AFortPlayerController::ServerEndEditingBuildingActorHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/Engine.PlayerController.ServerAcknowledgePossession"),
AFortPlayerControllerAthena::ServerAcknowledgePossessionHook, nullptr, false);
@@ -108,8 +122,8 @@ DWORD WINAPI Main(LPVOID)
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::CollectGarbage, (PVOID)CollectGarbageHook, nullptr);
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::PickTeam, (PVOID)AFortGameModeAthena::Athena_PickTeamHook, nullptr);
srand(time(0));

View File

@@ -74,15 +74,37 @@ static inline uint64 FindKickPlayer()
{
// return Memcury::Scanner::FindPattern("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC ? 49 8B F0 48 8B DA 48 85 D2").Get(); // 12.41
uint64 Ret = 0;
auto Addr = Memcury::Scanner::FindStringRef(L"Validation Failure: %s. kicking %s", false);
if (Addr.Get())
{
return FindBytes(Addr, { 0x40, 0x55 }, 2000, 0, true);
Ret = Addr.Get() ? FindBytes(Addr, { 0x40, 0x55 }, 1000, 0, true) : Ret;
if (!Ret)
Ret = Addr.Get() ? FindBytes(Addr, { 0x40, 0x53 }, 2000, 0, true) : Ret;
}
auto Addr2 = Memcury::Scanner::FindStringRef(L"KickPlayer %s Reason %s");
return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 2000, 0, true);
if (Ret)
return Ret;
auto Addr2 = Memcury::Scanner::FindStringRef(L"Failed to kick player"); // L"KickPlayer %s Reason %s"
Ret = Addr2.Get() ? FindBytes(Addr2, { 0x48, 0x89, 0x5C }, 2000, 0, true) : Ret; // s12??
// Ret = Addr2.Get() ? FindBytes(Addr2, { 0x48, 0x8B, 0xC4 }, 2000, 0, true) : Ret;
if (Ret)
return Ret;
/* auto Addr3 = Memcury::Scanner::FindStringRef(L"Game already ended.");
Ret = Addr3.Get() ? FindBytes(Addr3, { 0x48, 0x89, 0x5C }, 2000, 0, true) : Ret;
if (Ret)
return Ret; */
Ret = Memcury::Scanner::FindPattern("40 53 41 56 48 81 EC ? ? ? ? 48 8B 01 48 8B DA 4C 8B F1 FF 90").Get();
return Ret;
}
static inline uint64 FindInitHost()
@@ -126,15 +148,35 @@ static inline uint64 FindInitListen()
return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 2000, 0, true, 1);
}
static inline uint64 FindOnDamageServer()
{
auto Addr = FindFunctionCall(L"OnDamageServer", { 0x40, 0x55 });
return Addr;
}
static inline uint64 FindNoMCP()
{
if (Fortnite_Version == 4)
return Memcury::Scanner::FindPattern("E8 ? ? ? ? 83 A7 ? ? ? ? ? 83 E0 01").RelativeOffset(1).Get();
if (Engine_Version == 421 || Engine_Version == 422)
return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 CE").RelativeOffset(1).Get();
if (Engine_Version == 423)
return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 C0").RelativeOffset(1).Get();
if (Engine_Version == 425)
return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 C1").RelativeOffset(1).Get();
// return (uintptr_t)GetModuleHandleW(0) + 0x1791CF0; // 11.01
return 0;
return (uintptr_t)GetModuleHandleW(0) + 0x161d600;
// return (uintptr_t)GetModuleHandleW(0) + 0x161d600; // 10.40
}
static inline uint64 FindCollectGarbage()
{
return 0;
auto Addr = Memcury::Scanner::FindStringRef(L"STAT_CollectGarbageInternal");
return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 2000, 0, true, 1);
}
@@ -158,7 +200,13 @@ static inline uint64 FindGetNetMode()
static inline uint64 FindRealloc()
{
auto Addr = Memcury::Scanner::FindStringRef(L"a.Budget.BudgetMs");
auto Addr = Memcury::Scanner::FindStringRef(L"a.Budget.BudgetMs", false);
if (!Addr.Get())
{
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(); // 4.16-4.20
}
auto BeginningFunction = Memcury::Scanner(FindBytes(Addr, { 0x40, 0x53 }, 1000, 0, true));
auto CallToFunc = Memcury::Scanner(FindBytes(BeginningFunction, { 0xE8 }));
@@ -169,7 +217,11 @@ static inline uint64 FindRealloc()
static inline uint64 FindPickTeam()
{
auto Addr = Memcury::Scanner::FindStringRef(L"PickTeam for [%s] used beacon value [%d]");
auto Addr = Memcury::Scanner::FindStringRef(L"PickTeam for [%s] used beacon value [%d]", false);
if (!Addr.Get())
Addr = Memcury::Scanner::FindStringRef(L"PickTeam for [%s] used beacon value [%s]");
return FindBytes(Addr, { 0x40, 0x55 }, 1000, 0, true);
}
@@ -187,9 +239,21 @@ static inline uint64 FindGiveAbility()
return realGiveAbility;
}
static inline uint64 FindCantBuild()
static inline uint64 FindGiveAbilityAndActivateOnce()
{
return 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").Get();
auto Addr = Memcury::Scanner::FindStringRef(L"GiveAbilityAndActivateOnce called on ability %s on the client, not allowed!");
return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 1000, 0, true);
}
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();
if (!add)
add = Memcury::Scanner::FindPattern("48 89 54 24 ? 55 56 41 56 48 83 EC 50").Get(); // 4.20
return add;
auto CreateBuildingActorAddr = Memcury::Scanner(GetFunctionIdxOrPtr(FindObject<UFunction>("/Script/FortniteGame.FortAIController.CreateBuildingActor")));
auto LikeHuh = Memcury::Scanner(FindBytes(CreateBuildingActorAddr, { 0x40, 0x88 }, 3000));

View File

@@ -98,8 +98,8 @@ inline __int64 GetFunctionIdxOrPtr(UFunction* Function)
const wchar_t* ValidateWCStr = ValidateWStr.c_str();
bool bHasValidateFunc = Memcury::Scanner::FindStringRef(ValidateWCStr, false).Get();
// LOG_INFO(LogDev, "[{}] bHasValidateFunc: {}", Function->GetName(), bHasValidateFunc);
// LOG_INFO(LogDev, "NativeAddr: 0x{:x}", __int64(NativeAddr) - __int64(GetModuleHandleW(0)));
LOG_INFO(LogDev, "[{}] bHasValidateFunc: {}", Function->GetName(), bHasValidateFunc);
LOG_INFO(LogDev, "NativeAddr: 0x{:x}", __int64(NativeAddr) - __int64(GetModuleHandleW(0)));
bool bFoundValidate = !bHasValidateFunc;
@@ -139,7 +139,7 @@ inline __int64 GetFunctionIdxOrPtr(UFunction* Function)
std::transform(wtf.begin(), wtf.end(), wtf.begin(), ::toupper);
// std::cout << "wtf: " << wtf << '\n';
LOG_INFO(LogDev, "wtf: {}", wtf);
return HexToDec(wtf);
}
@@ -163,17 +163,17 @@ inline __int64 GetFunctionIdxOrPtr(UFunction* Function)
if (RetAddr)
{
// LOG_INFO(LogDev, "RetAddr 0x{:x}", RetAddr - __int64(GetModuleHandleW(0)));
LOG_INFO(LogDev, "RetAddr 0x{:x}", RetAddr - __int64(GetModuleHandleW(0)));
int i = 0;
for (__int64 CurrentAddy = RetAddr; CurrentAddy != NativeAddr && i < 2000; CurrentAddy -= 1) // Find last call
{
// LOG_INFO(LogDev, "[{}] 0x{:x}", i, *(uint8_t*)CurrentAddy);
LOG_INFO(LogDev, "[{}] 0x{:x}", i, *(uint8_t*)CurrentAddy);
if (*(uint8_t*)CurrentAddy == 0xE8)
{
// LOG_INFO(LogDev, "CurrentAddy 0x{:x}", CurrentAddy - __int64(GetModuleHandleW(0)));
LOG_INFO(LogDev, "CurrentAddy 0x{:x}", CurrentAddy - __int64(GetModuleHandleW(0)));
functionAddy = (CurrentAddy + 1 + 4) + *(int*)(CurrentAddy + 1);
break;
}

2272
vendor/memcury.h vendored

File diff suppressed because it is too large Load Diff