124 files changed.

This commit is contained in:
Milxnor
2023-04-15 19:53:58 -04:00
parent 63473de425
commit bbf28ed9e9
124 changed files with 60988 additions and 577 deletions

View File

@@ -2,6 +2,7 @@
#include "Object.h" #include "Object.h"
#include "GameplayAbilitySpec.h" #include "GameplayAbilitySpec.h"
#include "AttributeSet.h"
struct PadHex10 { char Pad[0x10]; }; struct PadHex10 { char Pad[0x10]; };
struct PadHex18 { char Pad[0x18]; }; struct PadHex18 { char Pad[0x18]; };
@@ -65,6 +66,12 @@ public:
return GetPtr<FGameplayAbilitySpecContainer>(ActivatableAbilitiesOffset); return GetPtr<FGameplayAbilitySpecContainer>(ActivatableAbilitiesOffset);
} }
UAttributeSet* AddDefaultSubobjectSet(UAttributeSet* Subobject)
{
GetSpawnedAttributes().Add(Subobject);
return Subobject;
}
bool HasAbility(UObject* DefaultAbility); bool HasAbility(UObject* DefaultAbility);
FActiveGameplayEffectHandle ApplyGameplayEffectToSelf(UClass* GameplayEffectClass, float Level, const FGameplayEffectContextHandle& EffectContext = FGameplayEffectContextHandle()); FActiveGameplayEffectHandle ApplyGameplayEffectToSelf(UClass* GameplayEffectClass, float Level, const FGameplayEffectContextHandle& EffectContext = FGameplayEffectContextHandle());
// FGameplayEffectContextHandle MakeEffectContext(); // FGameplayEffectContextHandle MakeEffectContext();
@@ -72,6 +79,8 @@ public:
void ConsumeAllReplicatedData(FGameplayAbilitySpecHandle AbilityHandle, FPredictionKey* AbilityOriginalPredictionKey); void ConsumeAllReplicatedData(FGameplayAbilitySpecHandle AbilityHandle, FPredictionKey* AbilityOriginalPredictionKey);
FGameplayAbilitySpecHandle GiveAbilityEasy(UClass* AbilityClass, UObject* SourceObject = nullptr, bool bDoNotRegive = true); FGameplayAbilitySpecHandle GiveAbilityEasy(UClass* AbilityClass, UObject* SourceObject = nullptr, bool bDoNotRegive = true);
FGameplayAbilitySpec* FindAbilitySpecFromHandle(FGameplayAbilitySpecHandle Handle); FGameplayAbilitySpec* FindAbilitySpecFromHandle(FGameplayAbilitySpecHandle Handle);
void RemoveActiveGameplayEffectBySourceEffect(UClass* GameplayEffect, UAbilitySystemComponent* InstigatorAbilitySystemComponent, int StacksToRemove);
void ClearAbility(const FGameplayAbilitySpecHandle& Handle);
static void InternalServerTryActivateAbilityHook(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, const FPredictionKey* PredictionKey, const FGameplayEventData* TriggerEventData); static void InternalServerTryActivateAbilityHook(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAbilitySpecHandle Handle, bool InputPressed, const FPredictionKey* PredictionKey, const FGameplayEventData* TriggerEventData);
}; };

View File

@@ -180,3 +180,29 @@ FGameplayAbilitySpec* UAbilitySystemComponent::FindAbilitySpecFromHandle(FGamepl
return SpecToReturn; return SpecToReturn;
} }
void UAbilitySystemComponent::RemoveActiveGameplayEffectBySourceEffect(UClass* GameplayEffect, UAbilitySystemComponent* InstigatorAbilitySystemComponent, int StacksToRemove)
{
static auto RemoveActiveGameplayEffectBySourceEffectFn = FindObject<UFunction>("/Script/GameplayAbilities.AbilitySystemComponent.RemoveActiveGameplayEffectBySourceEffect");
struct
{
UClass* GameplayEffect; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic)
UAbilitySystemComponent* InstigatorAbilitySystemComponent; // (Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
int StacksToRemove; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
} UAbilitySystemComponent_RemoveActiveGameplayEffectBySourceEffect_Params{GameplayEffect, InstigatorAbilitySystemComponent, StacksToRemove};
this->ProcessEvent(RemoveActiveGameplayEffectBySourceEffectFn, &UAbilitySystemComponent_RemoveActiveGameplayEffectBySourceEffect_Params);
}
void UAbilitySystemComponent::ClearAbility(const FGameplayAbilitySpecHandle& Handle)
{
if (!Addresses::ClearAbility)
{
LOG_INFO(LogDev, "Invalid clear ability!");
return;
}
static void (*ClearAbilityOriginal)(UAbilitySystemComponent * AbilitySystemComponent, const FGameplayAbilitySpecHandle& Handle) = decltype(ClearAbilityOriginal)(Addresses::ClearAbility);
ClearAbilityOriginal(this, Handle);
}

View File

@@ -4,6 +4,12 @@
#include "reboot.h" #include "reboot.h"
bool AActor::HasAuthority()
{
static auto RoleOffset = GetOffset("Role");
return Get<uint8_t>(RoleOffset) == 3;
}
bool AActor::IsTearOff() bool AActor::IsTearOff()
{ {
static auto bTearOffOffset = GetOffset("bTearOff"); static auto bTearOffOffset = GetOffset("bTearOff");

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include "Object.h" #include "Object.h"
#include "anticheat.h"
enum class ENetDormancy : uint8_t enum class ENetDormancy : uint8_t
{ {
@@ -18,6 +19,7 @@ class AActor : public UObject
public: public:
struct FTransform GetTransform(); struct FTransform GetTransform();
bool HasAuthority();
bool IsTearOff(); bool IsTearOff();
/* FORCEINLINE */ ENetDormancy& GetNetDormancy(); /* FORCEINLINE */ ENetDormancy& GetNetDormancy();
int32& GetNetTag(); int32& GetNetTag();

View File

@@ -0,0 +1,73 @@
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "inc.h"
/**
* Does a boolean AND of the ::Value static members of each type, but short-circuits if any Type::Value == false.
*/
template <typename... Types>
struct TAnd;
template <bool LHSValue, typename... RHS>
struct TAndValue
{
enum { Value = TAnd<RHS...>::Value };
};
template <typename... RHS>
struct TAndValue<false, RHS...>
{
enum { Value = false };
};
template <typename LHS, typename... RHS>
struct TAnd<LHS, RHS...> : TAndValue<LHS::Value, RHS...>
{
};
template <>
struct TAnd<>
{
enum { Value = true };
};
/**
* Does a boolean OR of the ::Value static members of each type, but short-circuits if any Type::Value == true.
*/
template <typename... Types>
struct TOr;
template <bool LHSValue, typename... RHS>
struct TOrValue
{
enum { Value = TOr<RHS...>::Value };
};
template <typename... RHS>
struct TOrValue<true, RHS...>
{
enum { Value = true };
};
template <typename LHS, typename... RHS>
struct TOr<LHS, RHS...> : TOrValue<LHS::Value, RHS...>
{
};
template <>
struct TOr<>
{
enum { Value = false };
};
/**
* Does a boolean NOT of the ::Value static members of the type.
*/
template <typename Type>
struct TNot
{
enum { Value = !Type::Value };
};

View File

@@ -1,23 +1,33 @@
#pragma once #pragma once
#include "inc.h" #include "inc.h"
#include "addresses.h"
#include "MemoryOps.h"
#include "ContainerAllocationPolicies.h"
struct FMemory struct FMemory
{ {
static inline void* (*Realloc)(void* Original, SIZE_T Count, uint32_t Alignment /* = DEFAULT_ALIGNMENT */); static inline void* (*Realloc)(void* Original, SIZE_T Count, uint32_t Alignment /* = DEFAULT_ALIGNMENT */);
}; };
template <typename T = __int64>
static T* AllocUnreal(size_t Size)
{
return (T*)FMemory::Realloc(0, Size, 0);
}
template<typename InElementType> //, typename InAllocatorType> template<typename InElementType> //, typename InAllocatorType>
class TArray class TArray
{ {
// protected: // protected:
public: public:
friend class FString; friend class FString;
using ElementAllocatorType = InElementType*; using ElementAllocatorType = InElementType*;
using SizeType = int32; using SizeType = int32;
ElementAllocatorType Data = nullptr;// AllocatorInstance; ElementAllocatorType Data = nullptr; // AllocatorInstance;
SizeType ArrayNum; SizeType ArrayNum;
SizeType ArrayMax; SizeType ArrayMax;
@@ -27,6 +37,66 @@ public:
inline InElementType& at(int i, size_t Size = sizeof(InElementType)) const { return *(InElementType*)(__int64(Data) + (static_cast<long long>(Size) * i)); } inline InElementType& at(int i, size_t Size = sizeof(InElementType)) const { return *(InElementType*)(__int64(Data) + (static_cast<long long>(Size) * i)); }
inline InElementType* AtPtr(int i, size_t Size = sizeof(InElementType)) const { return (InElementType*)(__int64(Data) + (static_cast<long long>(Size) * i)); } inline InElementType* AtPtr(int i, size_t Size = sizeof(InElementType)) const { return (InElementType*)(__int64(Data) + (static_cast<long long>(Size) * i)); }
ElementAllocatorType& GetData() const { return Data; }
ElementAllocatorType& GetData() { return Data; }
void Reserve(int Number, size_t Size = sizeof(InElementType))
{
// LOG_INFO(LogDev, "ArrayNum {}", ArrayNum);
// Data = (InElementType*)FMemory::Realloc(Data, (ArrayMax = ArrayNum + Number) * Size, 0);
Data = /* (ArrayMax - ArrayNum) >= ArrayNum ? Data : */ (InElementType*)FMemory::Realloc(Data, (ArrayMax = Number + ArrayNum) * Size, 0);
}
int CalculateSlackReserve(SizeType NumElements, SIZE_T NumBytesPerElement) const
{
return DefaultCalculateSlackReserve(NumElements, NumBytesPerElement, false);
}
/*
FORCENOINLINE void ResizeForCopy(SizeType NewMax, SizeType PrevMax, int ElementSize = sizeof(InElementType))
{
if (NewMax)
{
NewMax = CalculateSlackReserve(NewMax, ElementSize);
}
if (NewMax != PrevMax)
{
int ReserveCount = NewMax - PrevMax; // IDK TODO Milxnor
Reserve(ReserveCount, ElementSize);
// AllocatorInstance.ResizeAllocation(0, NewMax, ElementSize);
}
ArrayMax = NewMax;
}
template <typename OtherElementType, typename OtherSizeType>
void CopyToEmpty(const OtherElementType* OtherData, OtherSizeType OtherNum, SizeType PrevMax, SizeType ExtraSlack, int ElementSize = sizeof(InElementType))
{
SizeType NewNum = (SizeType)OtherNum;
// checkf((OtherSizeType)NewNum == OtherNum, TEXT("Invalid number of elements to add to this array type: %llu"), (unsigned long long)NewNum);
// checkSlow(ExtraSlack >= 0);
ArrayNum = NewNum;
if (OtherNum || ExtraSlack || PrevMax)
{
ResizeForCopy(NewNum + ExtraSlack, PrevMax);
ConstructItems<InElementType>(GetData(), OtherData, OtherNum);
}
else
{
ArrayMax = 0; // AllocatorInstance.GetInitialCapacity();
}
}
FORCEINLINE TArray(const TArray& Other)
{
CopyToEmpty(Other.Data, Other.Num(), 0, 0);
}
*/
TArray() : Data(nullptr), ArrayNum(0), ArrayMax(0) {}
inline int Num() const { return ArrayNum; } inline int Num() const { return ArrayNum; }
inline int size() const { return ArrayNum; } inline int size() const { return ArrayNum; }
@@ -113,13 +183,6 @@ public:
RemoveAtImpl(Index, Count, bAllowShrinking); RemoveAtImpl(Index, Count, bAllowShrinking);
} }
void Reserve(int Number, size_t Size = sizeof(InElementType))
{
// LOG_INFO(LogDev, "ArrayNum {}", ArrayNum);
// Data = (InElementType*)FMemory::Realloc(Data, (ArrayMax = ArrayNum + Number) * Size, 0);
Data = /* (ArrayMax - ArrayNum) >= ArrayNum ? Data : */ (InElementType*)FMemory::Realloc(Data, (ArrayMax = Number + ArrayNum) * Size, 0);
}
FORCENOINLINE void ResizeGrow(int32 OldNum, size_t Size = sizeof(InElementType)) FORCENOINLINE void ResizeGrow(int32 OldNum, size_t Size = sizeof(InElementType))
{ {
// LOG_INFO(LogMemory, "FMemory::Realloc: {}", __int64(FMemory::Realloc)); // LOG_INFO(LogMemory, "FMemory::Realloc: {}", __int64(FMemory::Realloc));
@@ -177,7 +240,7 @@ public:
} }
return -1; return -1;
}; }
int Add(const InElementType& New, size_t Size = sizeof(InElementType)) int Add(const InElementType& New, size_t Size = sizeof(InElementType))
{ {
@@ -196,7 +259,7 @@ public:
} }
return -1; return -1;
}; }
void FreeReal() void FreeReal()
{ {
@@ -204,7 +267,9 @@ public:
{ {
// VirtualFree(Data, _msize(Data), MEM_RELEASE); // VirtualFree(Data, _msize(Data), MEM_RELEASE);
// VirtualFree(Data, sizeof(InElementType) * ArrayNum, MEM_RELEASE); // ik this does nothing // VirtualFree(Data, sizeof(InElementType) * ArrayNum, MEM_RELEASE); // ik this does nothing
VirtualFree(Data, 0, MEM_RELEASE); // VirtualFree(Data, 0, MEM_RELEASE);
static void (*FreeOriginal)(void*) = decltype(FreeOriginal)(Addresses::Free);
// FreeOriginal(Data);
} }
ArrayNum = 0; ArrayNum = 0;
@@ -242,5 +307,5 @@ public:
} }
return false; return false;
}; }
}; };

View File

@@ -0,0 +1,61 @@
#pragma once
#include "log.h"
#include "inc.h"
/*
#ifdef PROD
#define UE_DEBUG_BREAK() ((void)0)
#else
#define UE_DEBUG_BREAK() ((void)(FWindowsPlatformMisc::IsDebuggerPresent() && (__debugbreak(), 1)))
#endif
#ifndef PROD
#define _DebugBreakAndPromptForRemote() \
if (!FPlatformMisc::IsDebuggerPresent()) { FPlatformMisc::PromptForRemoteDebugging(false); } UE_DEBUG_BREAK();
#else
#define _DebugBreakAndPromptForRemote()
#endif
#define CA_ASSUME( Expr ) // Todo move to Misc/CoreMiscDefines.h
namespace FDebug
{
template <typename FmtType, typename... Types>
static void LogAssertFailedMessage(const char* Expr, const char* File, int32 Line, const FmtType& Fmt, Types... Args)
{
// static_assert(TIsArrayOrRefOfType<FmtType, TCHAR>::Value, "Formatting string must be a TCHAR array.");
// tatic_assert(TAnd<TIsValidVariadicFunctionArg<Types>...>::Value, "Invalid argument(s) passed to FDebug::LogAssertFailedMessage");
LOG_ERROR(LogDev, "Assert failed message {} {}", File, Line);
// LogAssertFailedMessageImpl(Expr, File, Line, Fmt, Args...);
}
void __cdecl AssertFailed(const char* Expr, const char* File, int32 Line, const wchar_t* Format = TEXT(""), ...)
{
LOG_ERROR(LogDev, "Assert failed {} {}", File, Line);
/*
if (GIsCriticalError)
{
return;
}
// This is not perfect because another thread might crash and be handled before this assert
// but this static varible will report the crash as an assert. Given complexity of a thread
// aware solution, this should be good enough. If crash reports are obviously wrong we can
// look into fixing this.
bHasAsserted = true;
TCHAR DescriptionString[4096];
GET_VARARGS(DescriptionString, ARRAY_COUNT(DescriptionString), ARRAY_COUNT(DescriptionString) - 1, Format, Format);
TCHAR ErrorString[MAX_SPRINTF];
FCString::Sprintf(ErrorString, TEXT("%s"), ANSI_TO_TCHAR(Expr));
GError->Logf(TEXT("Assertion failed: %s") FILE_LINE_DESC TEXT("\n%s\n"), ErrorString, ANSI_TO_TCHAR(File), Line, DescriptionString);
*/
}
}
#define check(expr) { if(UNLIKELY(!(expr))) { FDebug::LogAssertFailedMessage( #expr, __FILE__, __LINE__, TEXT("") ); _DebugBreakAndPromptForRemote(); FDebug::AssertFailed( #expr, __FILE__, __LINE__ ); CA_ASSUME(false); } }
*/

View File

@@ -13,7 +13,9 @@ struct FFortClientMarkerRequest
int& GetInstanceID() int& GetInstanceID()
{ {
static auto InstanceIDOffset = FindOffsetStruct("/Script/FortniteGame.FortClientMarkerRequest", "InstanceID"); static auto InstanceIDOffset = FindOffsetStruct("/Script/FortniteGame.FortClientMarkerRequest", "InstanceID", false) == -1 ?
FindOffsetStruct("/Script/FortniteGame.FortClientMarkerRequest", "InstanceId") : FindOffsetStruct("/Script/FortniteGame.FortClientMarkerRequest", "InstanceID");
return *(int*)(__int64(this) + InstanceIDOffset); return *(int*)(__int64(this) + InstanceIDOffset);
} }

View File

@@ -0,0 +1,6 @@
#pragma once
class UAttributeSet : public UObject
{
public:
};

View File

@@ -0,0 +1,143 @@
#pragma once
#include "inc.h"
#include "ReversePredicate.h"
namespace AlgoImpl
{
/**
* Gets the index of the left child of node at Index.
*
* @param Index Node for which the left child index is to be returned.
* @returns Index of the left child.
*/
FORCEINLINE int32 HeapGetLeftChildIndex(int32 Index)
{
return Index * 2 + 1;
}
/**
* Checks if node located at Index is a leaf or not.
*
* @param Index Node index.
* @returns true if node is a leaf, false otherwise.
*/
FORCEINLINE bool HeapIsLeaf(int32 Index, int32 Count)
{
return HeapGetLeftChildIndex(Index) >= Count;
}
/**
* Gets the parent index for node at Index.
*
* @param Index node index.
* @returns Parent index.
*/
FORCEINLINE int32 HeapGetParentIndex(int32 Index)
{
return (Index - 1) / 2;
}
/**
* Fixes a possible violation of order property between node at Index and a child.
*
* @param Heap Pointer to the first element of a binary heap.
* @param Index Node index.
* @param Count Size of the heap.
* @param Projection The projection to apply to the elements.
* @param Predicate A binary predicate object used to specify if one element should precede another.
*/
template <typename RangeValueType, typename ProjectionType, typename PredicateType>
FORCEINLINE void HeapSiftDown(RangeValueType* Heap, int32 Index, const int32 Count, const ProjectionType& Projection, const PredicateType& Predicate)
{
while (!HeapIsLeaf(Index, Count))
{
const int32 LeftChildIndex = HeapGetLeftChildIndex(Index);
const int32 RightChildIndex = LeftChildIndex + 1;
int32 MinChildIndex = LeftChildIndex;
if (RightChildIndex < Count)
{
MinChildIndex = Predicate(Invoke(Projection, Heap[LeftChildIndex]), Invoke(Projection, Heap[RightChildIndex])) ? LeftChildIndex : RightChildIndex;
}
if (!Predicate(Invoke(Projection, Heap[MinChildIndex]), Invoke(Projection, Heap[Index])))
{
break;
}
Swap(Heap[Index], Heap[MinChildIndex]);
Index = MinChildIndex;
}
}
/**
* Fixes a possible violation of order property between node at NodeIndex and a parent.
*
* @param Heap Pointer to the first element of a binary heap.
* @param RootIndex How far to go up?
* @param NodeIndex Node index.
* @param Projection The projection to apply to the elements.
* @param Predicate A binary predicate object used to specify if one element should precede another.
*
* @return The new index of the node that was at NodeIndex
*/
template <class RangeValueType, typename ProjectionType, class PredicateType>
FORCEINLINE int32 HeapSiftUp(RangeValueType* Heap, int32 RootIndex, int32 NodeIndex, const ProjectionType& Projection, const PredicateType& Predicate)
{
while (NodeIndex > RootIndex)
{
int32 ParentIndex = HeapGetParentIndex(NodeIndex);
if (!Predicate(Invoke(Projection, Heap[NodeIndex]), Invoke(Projection, Heap[ParentIndex])))
{
break;
}
Swap(Heap[NodeIndex], Heap[ParentIndex]);
NodeIndex = ParentIndex;
}
return NodeIndex;
}
/**
* Builds an implicit min-heap from a range of elements.
* This is the internal function used by Heapify overrides.
*
* @param First pointer to the first element to heapify
* @param Num the number of items to heapify
* @param Projection The projection to apply to the elements.
* @param Predicate A binary predicate object used to specify if one element should precede another.
*/
template <typename RangeValueType, typename ProjectionType, typename PredicateType>
FORCEINLINE void HeapifyInternal(RangeValueType* First, SIZE_T Num, ProjectionType Projection, PredicateType Predicate)
{
for (int32 Index = HeapGetParentIndex(Num - 1); Index >= 0; Index--)
{
HeapSiftDown(First, Index, Num, Projection, Predicate);
}
}
/**
* Performs heap sort on the elements.
* This is the internal sorting function used by HeapSort overrides.
*
* @param First pointer to the first element to sort
* @param Num the number of elements to sort
* @param Predicate predicate class
*/
template <typename RangeValueType, typename ProjectionType, class PredicateType>
void HeapSortInternal(RangeValueType* First, SIZE_T Num, ProjectionType Projection, PredicateType Predicate)
{
TReversePredicate< PredicateType > ReversePredicateWrapper(Predicate); // Reverse the predicate to build a max-heap instead of a min-heap
HeapifyInternal(First, Num, Projection, ReversePredicateWrapper);
for (int32 Index = Num - 1; Index > 0; Index--)
{
Swap(First[0], First[Index]);
HeapSiftDown(First, 0, Index, Projection, ReversePredicateWrapper);
}
}
}

View File

@@ -18,12 +18,6 @@ static FORCEINLINE uint32 CountLeadingZeros(uint32 Value)
class TBitArray class TBitArray
{ {
private:
template <typename ArrayType>
friend class TSparseArray;
template <typename SetType>
friend class TSet;
public: public:
TInlineAllocator<4>::ForElementType<unsigned int> Data; TInlineAllocator<4>::ForElementType<unsigned int> Data;
int NumBits; int NumBits;
@@ -34,7 +28,7 @@ public:
public: public:
FORCEINLINE explicit FRelativeBitReference(int32 BitIndex) FORCEINLINE explicit FRelativeBitReference(int32 BitIndex)
: DWORDIndex(BitIndex >> NumBitsPerDWORDLogTwo) : DWORDIndex(BitIndex >> NumBitsPerDWORDLogTwo)
, Mask(1 << (BitIndex & ((NumBitsPerDWORD)-1))) , Mask(1 << (BitIndex & (NumBitsPerDWORD -1)))
{ {
} }
@@ -223,10 +217,14 @@ public:
//InlineData is the first 16-bytes of TBitArray //InlineData is the first 16-bytes of TBitArray
const uint32* ArrayData = (IteratedArray.Data.SecondaryData ? IteratedArray.Data.SecondaryData : (uint32*)&IteratedArray.Data.InlineData); const uint32* ArrayData = (IteratedArray.Data.SecondaryData ? IteratedArray.Data.SecondaryData : (uint32*)&IteratedArray.Data.InlineData);
if (!ArrayData)
return;
const int32 ArrayNum = IteratedArray.NumBits; const int32 ArrayNum = IteratedArray.NumBits;
const int32 LastDWORDIndex = (ArrayNum - 1) / NumBitsPerDWORD; const int32 LastDWORDIndex = (ArrayNum - 1) / NumBitsPerDWORD;
uint32 RemainingBitMask = ArrayData[this->DWORDIndex] & UnvisitedBitMask; uint32 RemainingBitMask = ArrayData[this->DWORDIndex] & UnvisitedBitMask;
while (!RemainingBitMask) while (!RemainingBitMask)
{ {
++this->DWORDIndex; ++this->DWORDIndex;

View File

@@ -30,6 +30,9 @@ void ABuildingActor::OnDamageServerHook(ABuildingActor* BuildingActor, float Dam
if (!WeaponData) if (!WeaponData)
return OnDamageServerOriginal(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext); return OnDamageServerOriginal(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext);
if (BuildingSMActor->IsDestroyed())
return OnDamageServerOriginal(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext);
auto ResourceCount = 0; auto ResourceCount = 0;
UFortResourceItemDefinition* ItemDef = UFortKismetLibrary::K2_GetResourceItemDefinition(BuildingSMActor->GetResourceType()); UFortResourceItemDefinition* ItemDef = UFortKismetLibrary::K2_GetResourceItemDefinition(BuildingSMActor->GetResourceType());

View File

@@ -22,6 +22,13 @@ public:
this->ProcessEvent(fn, &IBAParams); this->ProcessEvent(fn, &IBAParams);
} }
bool IsDestroyed()
{
static auto bDestroyedOffset = GetOffset("bDestroyed");
static auto bDestroyedFieldMask = GetFieldMask(GetProperty("bDestroyed"));
return ReadBitfieldValue(bDestroyedOffset, bDestroyedFieldMask);
}
void SilentDie() void SilentDie()
{ {
static auto SilentDieFn = FindObject<UFunction>("/Script/FortniteGame.BuildingActor.SilentDie"); static auto SilentDieFn = FindObject<UFunction>("/Script/FortniteGame.BuildingActor.SilentDie");
@@ -36,6 +43,14 @@ public:
return MaxHealth; return MaxHealth;
} }
float GetHealthPercent() // aka GetHealth() / GetMaxHealth()
{
float HealthPercent = 0;
static auto fn = FindObject<UFunction>("/Script/FortniteGame.BuildingActor.GetHealthPercent");
this->ProcessEvent(fn, &HealthPercent);
return HealthPercent;
}
void SetTeam(unsigned char InTeam) void SetTeam(unsigned char InTeam)
{ {
static auto fn = nullptr; // FindObject<UFunction>("/Script/FortniteGame.BuildingActor.SetTeam"); static auto fn = nullptr; // FindObject<UFunction>("/Script/FortniteGame.BuildingActor.SetTeam");

View File

@@ -30,11 +30,6 @@ public:
this->SetBitfieldValue(bPlayerPlacedOffset, bPlayerPlacedFieldMask, NewValue); this->SetBitfieldValue(bPlayerPlacedOffset, bPlayerPlacedFieldMask, NewValue);
} }
bool IsDestroyed()
{
return false; // FOR NOW
}
APlayerState*& GetEditingPlayer() APlayerState*& GetEditingPlayer()
{ {
static auto EditingPlayerOffset = GetOffset("EditingPlayer"); static auto EditingPlayerOffset = GetOffset("EditingPlayer");

View File

@@ -0,0 +1,17 @@
#include "BuildingStructuralSupportSystem.h"
#include "reboot.h"
bool UBuildingStructuralSupportSystem::IsWorldLocValid(const FVector& WorldLoc)
{
static auto IsWorldLocValidFn = FindObject<UFunction>("/Script/FortniteGame.BuildingStructuralSupportSystem.IsWorldLocValid");
if (!IsWorldLocValidFn)
return true;
struct { FVector WorldLoc; bool Ret; } Params{ WorldLoc };
this->ProcessEvent(IsWorldLocValidFn, &Params);
return Params.Ret;
}

View File

@@ -0,0 +1,10 @@
#pragma once
#include "Object.h"
#include "Vector.h"
class UBuildingStructuralSupportSystem : public UObject
{
public:
bool IsWorldLocValid(const FVector& WorldLoc);
};

View File

@@ -1,5 +1,7 @@
#pragma once #pragma once
#include "NumericLimits.h"
template <int NumElements> template <int NumElements>
class TInlineAllocator class TInlineAllocator
{ {
@@ -67,5 +69,49 @@ public:
{ {
return SecondaryData[Index]; return SecondaryData[Index];
} }
ElementType* GetInlineElements() const
{
return (ElementType*)InlineData;
}
FORCEINLINE ElementType* GetAllocation() const
{
return IfAThenAElseB<ElementType>(SecondaryData, GetInlineElements());
}
}; };
}; };
FORCEINLINE /*FMEMORY_INLINE_FUNCTION_DECORATOR*/ size_t /*FMemory::*/QuantizeSize(SIZE_T Count, uint32 Alignment)
{
return Count;
/*
if (!FMEMORY_INLINE_GMalloc)
{
return Count;
}
return FMEMORY_INLINE_GMalloc->QuantizeSize(Count, Alignment); */
}
enum
{
DEFAULT_ALIGNMENT = 0
};
template <typename SizeType>
FORCEINLINE SizeType DefaultCalculateSlackReserve(SizeType NumElements, SIZE_T BytesPerElement, bool bAllowQuantize, uint32 Alignment = DEFAULT_ALIGNMENT)
{
SizeType Retval = NumElements;
// checkSlow(NumElements > 0);
if (bAllowQuantize)
{
auto Count = SIZE_T(Retval) * SIZE_T(BytesPerElement);
Retval = (SizeType)(QuantizeSize(Count, Alignment) / BytesPerElement);
// NumElements and MaxElements are stored in 32 bit signed integers so we must be careful not to overflow here.
if (NumElements > Retval)
{
Retval = TNumericLimits<SizeType>::Max();
}
}
return Retval;
}

View File

@@ -0,0 +1,39 @@
#pragma once
#include "inc.h"
#include "RemoveReference.h"
#include "RemoveCV.h"
namespace UE4Decay_Private
{
template <typename T>
struct TDecayNonReference
{
typedef typename TRemoveCV<T>::Type Type;
};
template <typename T>
struct TDecayNonReference<T[]>
{
typedef T* Type;
};
template <typename T, uint32 N>
struct TDecayNonReference<T[N]>
{
typedef T* Type;
};
template <typename RetType, typename... Params>
struct TDecayNonReference<RetType(Params...)>
{
typedef RetType(*Type)(Params...);
};
}
template <typename T>
struct TDecay
{
typedef typename UE4Decay_Private::TDecayNonReference<typename TRemoveReference<T>::Type>::Type Type;
};

View File

@@ -0,0 +1,15 @@
#pragma once
template <bool Predicate, typename Result = void>
class TEnableIf;
template <typename Result>
class TEnableIf<true, Result>
{
public:
typedef Result Type;
};
template <typename Result>
class TEnableIf<false, Result>
{ };

View File

@@ -7,6 +7,17 @@
struct FGameplayEffectApplicationInfoHard struct FGameplayEffectApplicationInfoHard
{ {
public: public:
static UStruct* GetStruct()
{
static auto GameplayEffectApplicationInfoHardStruct = FindObject<UStruct>("/Script/FortniteGame.GameplayEffectApplicationInfoHard");
return GameplayEffectApplicationInfoHardStruct;
}
static int GetStructSize()
{
return GetStruct()->GetPropertiesSize();
}
UClass* GameplayEffect; // 0x0(0x8)(Edit, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) UClass* GameplayEffect; // 0x0(0x8)(Edit, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic)
float Level; float Level;
}; };
@@ -21,10 +32,25 @@ struct FGameplayEffectApplicationInfo
class UFortAbilitySet : public UObject class UFortAbilitySet : public UObject
{ {
public: public:
void GiveToAbilitySystem(UAbilitySystemComponent* AbilitySystemComponent, UObject* SourceObject = nullptr) TArray<UClass*>* GetGameplayAbilities()
{ {
static auto GameplayAbilitiesOffset = this->GetOffset("GameplayAbilities"); static auto GameplayAbilitiesOffset = this->GetOffset("GameplayAbilities");
auto GameplayAbilities = this->GetPtr<TArray<UClass*>>(GameplayAbilitiesOffset); return this->GetPtr<TArray<UClass*>>(GameplayAbilitiesOffset);
}
TArray<FGameplayEffectApplicationInfoHard>* GetGrantedGameplayEffects()
{
static auto GrantedGameplayEffectsOffset = this->GetOffset("GrantedGameplayEffects", false);
if (GrantedGameplayEffectsOffset == -1)
return nullptr;
return this->GetPtr<TArray<FGameplayEffectApplicationInfoHard>>(GrantedGameplayEffectsOffset);
}
void GiveToAbilitySystem(UAbilitySystemComponent* AbilitySystemComponent, UObject* SourceObject = nullptr)
{
auto GameplayAbilities = GetGameplayAbilities();
for (int i = 0; i < GameplayAbilities->Num(); i++) for (int i = 0; i < GameplayAbilities->Num(); i++)
{ {
@@ -38,18 +64,14 @@ public:
AbilitySystemComponent->GiveAbilityEasy(AbilityClass, SourceObject); AbilitySystemComponent->GiveAbilityEasy(AbilityClass, SourceObject);
} }
static auto GameplayEffectApplicationInfoHardStruct = FindObject<UStruct>("/Script/FortniteGame.GameplayEffectApplicationInfoHard"); if (!FGameplayEffectApplicationInfoHard::GetStruct())
if (!GameplayEffectApplicationInfoHardStruct)
return; return;
static auto GameplayEffectApplicationInfoHardSize = GameplayEffectApplicationInfoHardStruct->GetPropertiesSize(); auto GrantedGameplayEffects = GetGrantedGameplayEffects();
static auto GrantedGameplayEffectsOffset = this->GetOffset("GrantedGameplayEffects");
auto GrantedGameplayEffects = this->GetPtr<TArray<FGameplayEffectApplicationInfoHard>>(GrantedGameplayEffectsOffset);
for (int i = 0; i < GrantedGameplayEffects->Num(); i++) for (int i = 0; i < GrantedGameplayEffects->Num(); i++)
{ {
auto& EffectToGrant = GrantedGameplayEffects->at(i, GameplayEffectApplicationInfoHardSize); auto& EffectToGrant = GrantedGameplayEffects->at(i, FGameplayEffectApplicationInfoHard::GetStructSize());
if (!EffectToGrant.GameplayEffect) if (!EffectToGrant.GameplayEffect)
{ {

View File

@@ -0,0 +1,67 @@
#pragma once
#include "Actor.h"
#include "FortAthenaVehicle.h"
#include "reboot.h"
class AFortAthenaSKPushCannon : public AFortAthenaVehicle // : public AFortAthenaSKPushVehicle
{
public:
bool IsPushCannonBP()
{
static auto PushCannonBP = FindObject<UClass>("/Game/Athena/DrivableVehicles/PushCannon.PushCannon_C"); // We should loadobject it.
return this->IsA(PushCannonBP);
}
void MultiCastPushCannonLaunchedPlayer()
{
static auto MultiCastPushCannonLaunchedPlayerFn = FindObject<UFunction>("/Script/FortniteGame.FortAthenaSKPushCannon.MultiCastPushCannonLaunchedPlayer");
this->ProcessEvent(MultiCastPushCannonLaunchedPlayerFn);
}
void OnLaunchPawn(AFortPlayerPawn* Pawn, FVector LaunchDir)
{
static auto OnLaunchPawnFn = IsPushCannonBP() ? FindObject<UFunction>("/Game/Athena/DrivableVehicles/PushCannon.PushCannon_C.OnLaunchPawn") : FindObject<UFunction>("/Script/FortniteGame.FortAthenaSKPushCannon.OnLaunchPawn");
struct
{
AFortPlayerPawn* Pawn; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
struct FVector LaunchDir; // (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
} AFortAthenaSKPushCannon_OnLaunchPawn_Params{ Pawn, LaunchDir };
this->ProcessEvent(OnLaunchPawnFn, &AFortAthenaSKPushCannon_OnLaunchPawn_Params);
}
void OnPreLaunchPawn(AFortPlayerPawn* Pawn, FVector LaunchDir)
{
static auto OnPreLaunchPawnFn = IsPushCannonBP() ? FindObject<UFunction>("/Game/Athena/DrivableVehicles/PushCannon.PushCannon_C.OnPreLaunchPawn") : FindObject<UFunction>("/Script/FortniteGame.FortAthenaSKPushCannon.OnPreLaunchPawn");
struct
{
AFortPlayerPawn* Pawn; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
FVector LaunchDir; // (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
} AFortAthenaSKPushCannon_OnPreLaunchPawn_Params{ Pawn, LaunchDir };
this->ProcessEvent(OnPreLaunchPawnFn, &AFortAthenaSKPushCannon_OnPreLaunchPawn_Params);
}
void ShootPawnOut(const FVector& LaunchDir)
{
auto PawnToShoot = this->GetPawnAtSeat(1);
LOG_INFO(LogDev, "PawnToShoot: {}", __int64(PawnToShoot));
if (!PawnToShoot)
return;
this->OnPreLaunchPawn(PawnToShoot, LaunchDir);
PawnToShoot->ServerOnExitVehicle(ETryExitVehicleBehavior::ForceAlways);
this->OnLaunchPawn(PawnToShoot, LaunchDir);
this->MultiCastPushCannonLaunchedPlayer();
}
static UClass* StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortAthenaSKPushCannon");
return Class;
}
};

View File

@@ -0,0 +1,77 @@
#include "FortAthenaVehicle.h"
UFortWeaponItemDefinition* AFortAthenaVehicle::GetVehicleWeaponForSeat(int SeatIdx)
{
static auto GetSeatWeaponComponentFn = FindObject<UFunction>("/Script/FortniteGame.FortAthenaVehicle.GetSeatWeaponComponent");
UFortWeaponItemDefinition* VehicleWeaponDefinition = nullptr;
LOG_INFO(LogDev, "SeatIndex: {}", SeatIdx);
UObject* WeaponComponent = nullptr;
if (GetSeatWeaponComponentFn)
{
struct { int SeatIndex; UObject* ReturnValue; } AFortAthenaVehicle_GetSeatWeaponComponent_Params{};
this->ProcessEvent(GetSeatWeaponComponentFn, &AFortAthenaVehicle_GetSeatWeaponComponent_Params);
WeaponComponent = AFortAthenaVehicle_GetSeatWeaponComponent_Params.ReturnValue;
if (!WeaponComponent)
return VehicleWeaponDefinition;
static auto WeaponSeatDefinitionStructSize = FindObject<UClass>("/Script/FortniteGame.WeaponSeatDefinition")->GetPropertiesSize();
static auto VehicleWeaponOffset = FindOffsetStruct("/Script/FortniteGame.WeaponSeatDefinition", "VehicleWeapon");
static auto SeatIndexOffset = FindOffsetStruct("/Script/FortniteGame.WeaponSeatDefinition", "SeatIndex");
static auto WeaponSeatDefinitionsOffset = WeaponComponent->GetOffset("WeaponSeatDefinitions");
auto& WeaponSeatDefinitions = WeaponComponent->Get<TArray<__int64>>(WeaponSeatDefinitionsOffset);
for (int i = 0; i < WeaponSeatDefinitions.Num(); i++)
{
auto WeaponSeat = WeaponSeatDefinitions.AtPtr(i, WeaponSeatDefinitionStructSize);
if (*(int*)(__int64(WeaponSeat) + SeatIndexOffset) != SeatIdx)
continue;
VehicleWeaponDefinition = *(UFortWeaponItemDefinition**)(__int64(WeaponSeat) + VehicleWeaponOffset);
break;
}
}
else
{
static auto FerretWeaponItemDefinition = FindObject<UFortWeaponItemDefinition>("/Game/Athena/Items/Weapons/Ferret_Weapon.Ferret_Weapon");
static auto OctopusWeaponItemDefinition = FindObject<UFortWeaponItemDefinition>("/Game/Athena/Items/Weapons/Vehicles/WID_Octopus_Weapon.WID_Octopus_Weapon");
static auto InCannonWeaponItemDefinition = FindObject<UFortWeaponItemDefinition>("/Game/Athena/Items/Weapons/Vehicles/ShipCannon_Weapon_InCannon.ShipCannon_Weapon_InCannon");
static auto CannonWeaponItemDefinition = FindObject<UFortWeaponItemDefinition>("/Game/Athena/Items/Weapons/Vehicles/ShipCannon_Weapon.ShipCannon_Weapon");
static auto TurretWeaponItemDefinition = FindObject<UFortWeaponItemDefinition>("/Game/Athena/Items/Traps/MountedTurret/MountedTurret_Weapon.MountedTurret_Weapon");
auto ReceivingActorName = this->GetName();
if (SeatIdx == 0)
{
if (ReceivingActorName.contains("Ferret")) // plane
{
VehicleWeaponDefinition = FerretWeaponItemDefinition;
}
}
if (ReceivingActorName.contains("Octopus")) // baller
{
VehicleWeaponDefinition = OctopusWeaponItemDefinition;
}
else if (ReceivingActorName.contains("Cannon")) // cannon
{
VehicleWeaponDefinition = SeatIdx == 1 ? InCannonWeaponItemDefinition : CannonWeaponItemDefinition;
}
else if (ReceivingActorName.contains("MountedTurret"))
{
VehicleWeaponDefinition = TurretWeaponItemDefinition;
}
}
return VehicleWeaponDefinition;
}

View File

@@ -0,0 +1,27 @@
#pragma once
#include "Actor.h"
#include "reboot.h"
#include "FortWeaponItemDefinition.h"
class AFortAthenaVehicle : public AActor// : public AFortPhysicsPawn // Super changes based on version
{
public:
class AFortPlayerPawn* GetPawnAtSeat(int SeatIdx)
{
static auto GetPawnAtSeatFn = FindObject<UFunction>("/Script/FortniteGame.FortAthenaVehicle.GetPawnAtSeat");
struct { int SeatIdx; class AFortPlayerPawn* ReturnValue; } GetPawnAtSeat_Params{SeatIdx};
this->ProcessEvent(GetPawnAtSeatFn, &GetPawnAtSeat_Params);
return GetPawnAtSeat_Params.ReturnValue;
}
UFortWeaponItemDefinition* GetVehicleWeaponForSeat(int SeatIdx);
static UClass* StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortAthenaVehicle");
return Class;
}
};

View File

@@ -0,0 +1,73 @@
#include "FortGadgetItemDefinition.h"
#include "FortAbilitySet.h"
#include "SoftObjectPath.h"
#include "FortPlayerStateAthena.h"
#include "addresses.h"
void UFortGadgetItemDefinition::UnequipGadgetData(AFortPlayerController* PlayerController, UFortItem* Item)
{
static auto FortInventoryOwnerInterfaceClass = FindObject<UClass>("/Script/FortniteGame.FortInventoryOwnerInterface");
__int64 (*RemoveGadgetDataOriginal)(UFortGadgetItemDefinition* a1, __int64 a2, UFortItem* a3) = decltype(RemoveGadgetDataOriginal)(Addresses::RemoveGadgetData);
RemoveGadgetDataOriginal(this, __int64(PlayerController->GetInterfaceAddress(FortInventoryOwnerInterfaceClass)), Item);
/* auto Pawn = PlayerController->GetMyFortPawn();
if (Pawn)
{
static auto OriginalFootstepBankOffset = Pawn->GetOffset("OriginalFootstepBank");
static auto FootstepBankOverrideOffset = Pawn->GetOffset("FootstepBankOverride");
Pawn->Get(FootstepBankOverrideOffset) = Pawn->Get(OriginalFootstepBankOffset);
static auto AnimBPOverrideOffset = Pawn->GetOffset("AnimBPOverride");
static auto OriginalAnimBPOffset = Pawn->GetOffset("OriginalAnimBP");
Pawn->Get(AnimBPOverrideOffset) = Pawn->Get(OriginalAnimBPOffset);
}
static auto AbilitySetOffset = this->GetOffset("AbilitySet");
auto& AbilitySetSoft = this->Get<TSoftObjectPtr<UFortAbilitySet>>(AbilitySetOffset);
auto StrongAbilitySet = AbilitySetSoft.Get(UFortAbilitySet::StaticClass(), true);
if (StrongAbilitySet)
{
auto PlayerState = (AFortPlayerStateAthena*)PlayerController->GetPlayerState();
auto ASC = PlayerState ? PlayerState->GetAbilitySystemComponent() : nullptr;
if (ASC)
{
if (FGameplayEffectApplicationInfoHard::GetStruct())
{
auto AS_GrantedGameplayEffects = StrongAbilitySet->GetGrantedGameplayEffects();
if (AS_GrantedGameplayEffects)
{
for (int i = 0; i < AS_GrantedGameplayEffects->Num(); i++)
{
ASC->RemoveActiveGameplayEffectBySourceEffect(AS_GrantedGameplayEffects->at(i, FGameplayEffectApplicationInfoHard::GetStructSize()).GameplayEffect, ASC, 1);
}
}
}
auto& ActivatableAbilitiesItems = ASC->GetActivatableAbilities()->GetItems();
auto AS_GameplayAbilities = StrongAbilitySet->GetGameplayAbilities();
for (int j = 0; j < AS_GameplayAbilities->Num(); j++)
{
auto CurrentDefaultAbility = AS_GameplayAbilities->at(j)->CreateDefaultObject();
for (int i = 0; i < ActivatableAbilitiesItems.Num(); i++)
{
auto Spec = ActivatableAbilitiesItems.AtPtr(i, FGameplayAbilitySpec::GetStructSize());
if (Spec->GetAbility() == CurrentDefaultAbility)
{
ASC->ClearAbility(Spec->GetHandle());
}
}
}
}
}
PlayerController->ApplyCosmeticLoadout();
*/
}

View File

@@ -1,11 +1,13 @@
#pragma once #pragma once
#include "FortWorldItemDefinition.h" #include "FortWorldItemDefinition.h"
#include "FortPlayerController.h"
#include "AttributeSet.h"
#include "SoftObjectPtr.h"
class UFortGadgetItemDefinition : public UFortWorldItemDefinition class UFortGadgetItemDefinition : public UFortWorldItemDefinition
{ {
public: public:
bool ShouldDropAllItemsOnEquip() bool ShouldDropAllItemsOnEquip()
{ {
static auto bDropAllOnEquipOffset = GetOffset("bDropAllOnEquip", false); static auto bDropAllOnEquipOffset = GetOffset("bDropAllOnEquip", false);
@@ -17,6 +19,21 @@ public:
return ReadBitfieldValue(bDropAllOnEquipOffset, bDropAllOnEquipFieldMask); return ReadBitfieldValue(bDropAllOnEquipOffset, bDropAllOnEquipFieldMask);
} }
UAttributeSet* GetAttributeSet()
{
static auto AttributeSetOffset = this->GetOffset("AttributeSet", false);
if (AttributeSetOffset == -1)
return nullptr;
auto& AttributeSetSoft = this->Get<TSoftObjectPtr<UAttributeSet>>(AttributeSetOffset);
static auto AttributeClass = FindObject<UClass>("/Script/GameplayAbilities.AttributeSet");
return AttributeSetSoft.Get(AttributeClass, true);
}
void UnequipGadgetData(AFortPlayerController* PlayerController, UFortItem* Item);
static UClass* StaticClass() static UClass* StaticClass()
{ {
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortGadgetItemDefinition"); static auto Class = FindObject<UClass>("/Script/FortniteGame.FortGadgetItemDefinition");

View File

@@ -42,15 +42,6 @@ enum class EDynamicFoundationType : uint8_t
EDynamicFoundationType_MAX = 4 EDynamicFoundationType_MAX = 4
}; };
std::string PlaylistName =
"/Game/Athena/Playlists/Playlist_DefaultSolo.Playlist_DefaultSolo";
// "/Game/Athena/Playlists/Playlist_DefaultDuo.Playlist_DefaultDuo";
// "/Game/Athena/Playlists/Playground/Playlist_Playground.Playlist_Playground";
// "/Game/Athena/Playlists/Carmine/Playlist_Carmine.Playlist_Carmine";
// "/Game/Athena/Playlists/Fill/Playlist_Fill_Solo.Playlist_Fill_Solo";
// "/Game/Athena/Playlists/Low/Playlist_Low_Solo.Playlist_Low_Solo";
// "/Game/Athena/Playlists/Bling/Playlist_Bling_Solo.Playlist_Bling_Solo";
static UFortPlaylist* GetPlaylistToUse() static UFortPlaylist* GetPlaylistToUse()
{ {
auto Playlist = FindObject<UFortPlaylist>(PlaylistName); auto Playlist = FindObject<UFortPlaylist>(PlaylistName);
@@ -196,10 +187,8 @@ FName AFortGameModeAthena::RedirectLootTier(const FName& LootTier)
auto& RedirectAthenaLootTierGroups = Get<TMap<FName, FName>>(RedirectAthenaLootTierGroupsOffset); auto& RedirectAthenaLootTierGroups = Get<TMap<FName, FName>>(RedirectAthenaLootTierGroupsOffset);
for (int i = 0; i < RedirectAthenaLootTierGroups.Pairs.Elements.Num(); i++) for (auto& Pair : RedirectAthenaLootTierGroups)
{ {
auto& Pair = RedirectAthenaLootTierGroups.Pairs.Elements.Data.at(i).ElementData.Value;
auto& Key = Pair.Key(); auto& Key = Pair.Key();
auto& Value = Pair.Value(); auto& Value = Pair.Value();
@@ -228,6 +217,8 @@ UClass* AFortGameModeAthena::GetVehicleClassOverride(UClass* DefaultClass)
bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* GameMode) bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* GameMode)
{ {
Globals::bHitReadyToStartMatch = true;
auto GameState = GameMode->GetGameStateAthena(); auto GameState = GameMode->GetGameStateAthena();
auto SetPlaylist = [&GameState, &GameMode](UObject* Playlist, bool bOnRep) -> void { auto SetPlaylist = [&GameState, &GameMode](UObject* Playlist, bool bOnRep) -> void {
@@ -476,6 +467,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
} }
SetBitfield(GameMode->GetPtr<PlaceholderBitfield>("bWorldIsReady"), 1, true); SetBitfield(GameMode->GetPtr<PlaceholderBitfield>("bWorldIsReady"), 1, true);
Globals::bInitializedPlaylist = true;
} }
static int LastNum6 = 1; static int LastNum6 = 1;
@@ -546,7 +538,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
{ {
LastNum = AmountOfRestarts; LastNum = AmountOfRestarts;
float Duration = 1000.f; float Duration = 10000.f;
float EarlyDuration = Duration; float EarlyDuration = Duration;
float TimeSeconds = UGameplayStatics::GetTimeSeconds(GetWorld()); float TimeSeconds = UGameplayStatics::GetTimeSeconds(GetWorld());
@@ -600,6 +592,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
// GameState->OnRep_CurrentPlaylistInfo(); // GameState->OnRep_CurrentPlaylistInfo();
// return false; // return false;
Globals::bStartedListening = true;
} }
if (Engine_Version >= 424) // returning true is stripped on c2+ if (Engine_Version >= 424) // returning true is stripped on c2+
@@ -723,7 +717,30 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
{ {
LastNum69 = AmountOfRestarts; LastNum69 = AmountOfRestarts;
// FillVendingMachines(); bool bShouldDestroyVendingMachines = Fortnite_Version < 3.4 || Engine_Version >= 424; // This is not how it works, we need to add the spawn percentage.
if (!bShouldDestroyVendingMachines) // idk how to set the mat count sooooo problem for later me
{
FillVendingMachines();
}
else
{
static auto VendingMachineClass = FindObject<UClass>("/Game/Athena/Items/Gameplay/VendingMachine/B_Athena_VendingMachine.B_Athena_VendingMachine_C");
auto AllVendingMachines = UGameplayStatics::GetAllActorsOfClass(GetWorld(), VendingMachineClass);
for (int i = 0; i < AllVendingMachines.Num(); i++)
{
auto VendingMachine = (ABuildingItemCollectorActor*)AllVendingMachines.at(i);
if (!VendingMachine)
continue;
VendingMachine->K2_DestroyActor();
}
AllVendingMachines.Free();
}
SpawnBGAs(); SpawnBGAs();
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");
@@ -919,6 +936,18 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
unsigned char ahh[0x0028]; unsigned char ahh[0x0028];
}; };
static auto PlayerCameraManagerOffset = NewPlayer->GetOffset("PlayerCameraManager");
auto PlayerCameraManager = NewPlayer->Get(PlayerCameraManagerOffset);
if (PlayerCameraManager)
{
static auto ViewRollMinOffset = PlayerCameraManager->GetOffset("ViewRollMin");
PlayerCameraManager->Get<float>(ViewRollMinOffset) = 0;
static auto ViewRollMaxOffset = PlayerCameraManager->GetOffset("ViewRollMax");
PlayerCameraManager->Get<float>(ViewRollMaxOffset) = 0;
}
/* FUniqueNetIdReplExperimental Bugha{}; */ /* FUniqueNetIdReplExperimental Bugha{}; */
static auto UniqueIdOffset = PlayerStateAthena->GetOffset("UniqueId"); static auto UniqueIdOffset = PlayerStateAthena->GetOffset("UniqueId");
auto PlayerStateUniqueId = PlayerStateAthena->GetPtr<FUniqueNetIdRepl>(UniqueIdOffset); auto PlayerStateUniqueId = PlayerStateAthena->GetPtr<FUniqueNetIdRepl>(UniqueIdOffset);
@@ -928,8 +957,8 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
static auto GameMemberInfoArrayOffset = GameState->GetOffset("GameMemberInfoArray", false); static auto GameMemberInfoArrayOffset = GameState->GetOffset("GameMemberInfoArray", false);
// if (false) // if (false)
// if (GameMemberInfoArrayOffset != -1) if (GameMemberInfoArrayOffset != -1)
if (Engine_Version >= 423) // if (Engine_Version >= 423)
{ {
struct FGameMemberInfo : public FFastArraySerializerItem struct FGameMemberInfo : public FFastArraySerializerItem
{ {

View File

@@ -53,7 +53,54 @@ int AFortGameStateAthena::GetAircraftIndex(AFortPlayerState* PlayerState)
return TeamIndex - idfkwhatthisisimguessing; return TeamIndex - idfkwhatthisisimguessing;
} }
bool AFortGameStateAthena::IsRespawningAllowed(AFortPlayerState* PlayerState) // actually in zone bool AFortGameStateAthena::IsPlayerBuildableClass(UClass* Class)
{
return true;
static auto AllPlayerBuildableClassesOffset = GetOffset("AllPlayerBuildableClasses", false);
if (AllPlayerBuildableClassesOffset == -1) // this is invalid in like s6 and stuff we need to find a better way to do this
return true;
auto& AllPlayerBuildableClasses = Get<TArray<UClass*>>(AllPlayerBuildableClassesOffset);
for (int j = 0; j < AllPlayerBuildableClasses.Num(); j++)
{
auto CurrentPlayerBuildableClass = AllPlayerBuildableClasses.at(j);
// LOG_INFO(LogDev, "CurrentPlayerBuildableClass: {}", CurrentPlayerBuildableClass->GetFullName());
if (CurrentPlayerBuildableClass == Class)
return true;
}
return false;
// I don't know why but I think these are empty
auto PlayerBuildableClasses = GetPlayerBuildableClasses();
int ArraySize = 4 - 1;
for (int i = 0; i < ArraySize; i++)
{
auto CurrentPlayerBuildableClassesArray = PlayerBuildableClasses[i].BuildingClasses;
for (int j = 0; j < CurrentPlayerBuildableClassesArray.Num(); j++)
{
auto CurrentPlayerBuildableClass = CurrentPlayerBuildableClassesArray.at(j);
LOG_INFO(LogDev, "CurrentPlayerBuildableClass: {}", CurrentPlayerBuildableClass->GetFullName());
if (CurrentPlayerBuildableClass == Class)
return true;
}
}
return false;
}
bool AFortGameStateAthena::IsRespawningAllowed(AFortPlayerState* PlayerState)
{ {
auto GameModeAthena = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode()); auto GameModeAthena = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
static auto IsRespawningAllowedFn = FindObject<UFunction>("/Script/FortniteGame.FortGameStateZone.IsRespawningAllowed"); static auto IsRespawningAllowedFn = FindObject<UFunction>("/Script/FortniteGame.FortGameStateZone.IsRespawningAllowed");

View File

@@ -3,6 +3,7 @@
#include "GameState.h" #include "GameState.h"
#include "FortPlayerState.h" #include "FortPlayerState.h"
#include "FortPlaylist.h" #include "FortPlaylist.h"
#include "BuildingStructuralSupportSystem.h"
enum class EAthenaGamePhase : uint8_t enum class EAthenaGamePhase : uint8_t
{ {
@@ -16,6 +17,11 @@ enum class EAthenaGamePhase : uint8_t
EAthenaGamePhase_MAX = 7 EAthenaGamePhase_MAX = 7
}; };
struct FPlayerBuildableClassContainer
{
TArray<UClass*> BuildingClasses; // 0x0000(0x0010) (ZeroConstructor, Transient, UObjectWrapper, NativeAccessSpecifierPublic)
};
class AFortGameStateAthena : public AGameState class AFortGameStateAthena : public AGameState
{ {
public: public:
@@ -31,12 +37,25 @@ public:
return Get<EAthenaGamePhase>(GamePhaseOffset); return Get<EAthenaGamePhase>(GamePhaseOffset);
} }
UBuildingStructuralSupportSystem* GetStructuralSupportSystem() // actually in FortGameModeZone
{
static auto StructuralSupportSystemOffset = GetOffset("StructuralSupportSystem");
return Get<UBuildingStructuralSupportSystem*>(StructuralSupportSystemOffset);
}
FPlayerBuildableClassContainer*& GetPlayerBuildableClasses()
{
static auto PlayerBuildableClassesOffset = GetOffset("PlayerBuildableClasses");
return Get<FPlayerBuildableClassContainer*>(PlayerBuildableClassesOffset);
}
UFortPlaylist*& GetCurrentPlaylist(); UFortPlaylist*& GetCurrentPlaylist();
// void AddPlayerStateToGameMemberInfo(class AFortPlayerStateAthena* PlayerState); // void AddPlayerStateToGameMemberInfo(class AFortPlayerStateAthena* PlayerState);
int GetAircraftIndex(AFortPlayerState* PlayerState); int GetAircraftIndex(AFortPlayerState* PlayerState);
bool IsRespawningAllowed(AFortPlayerState* PlayerState); // actually in zone bool IsRespawningAllowed(AFortPlayerState* PlayerState); // actually in zone
bool IsPlayerBuildableClass(UClass* Class);
void OnRep_GamePhase(); void OnRep_GamePhase();
void OnRep_CurrentPlaylistInfo(); void OnRep_CurrentPlaylistInfo();
}; };

View File

@@ -5,6 +5,8 @@
#include "FortPlayerPawnAthena.h" #include "FortPlayerPawnAthena.h"
#include "FortGameStateAthena.h" #include "FortGameStateAthena.h"
#include "FortGameModeAthena.h" #include "FortGameModeAthena.h"
#include "FortGadgetItemDefinition.h"
#include "FortPlayerStateAthena.h"
UFortItem* CreateItemInstance(AFortPlayerController* PlayerController, UFortItemDefinition* ItemDefinition, int Count) UFortItem* CreateItemInstance(AFortPlayerController* PlayerController, UFortItemDefinition* ItemDefinition, int Count)
{ {
@@ -16,25 +18,18 @@ UFortItem* CreateItemInstance(AFortPlayerController* PlayerController, UFortItem
return NewItemInstance; return NewItemInstance;
} }
std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddItem(UFortItemDefinition* ItemDefinition, bool* bShouldUpdate, int Count, int LoadedAmmo, bool bShowItemToast) std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddItem(FFortItemEntry* ItemEntry, bool* bShouldUpdate, bool bShowItemToast, int OverrideCount)
{ {
if (!ItemDefinition) if (!ItemEntry || !ItemEntry->GetItemDefinition())
return std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>>(); return std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>>();
if (bShouldUpdate) if (bShouldUpdate)
*bShouldUpdate = false; *bShouldUpdate = false;
if (LoadedAmmo == -1) auto ItemDefinition = ItemEntry->GetItemDefinition();
{
if (auto WeaponDef = Cast<UFortWeaponItemDefinition>(ItemDefinition)) // bPreventDefaultPreload ?
LoadedAmmo = WeaponDef->GetClipSize();
else
LoadedAmmo = 0;
}
// ShouldForceFocusWhenAdded
auto WorldItemDefinition = Cast<UFortWorldItemDefinition>(ItemDefinition); auto WorldItemDefinition = Cast<UFortWorldItemDefinition>(ItemDefinition);
auto& Count = ItemEntry->GetCount();
auto& ItemInstances = GetItemList().GetItemInstances(); auto& ItemInstances = GetItemList().GetItemInstances();
@@ -124,19 +119,33 @@ std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddI
if (NewItemInstance) if (NewItemInstance)
{ {
// if (LoadedAmmo != -1) auto OldItemGuid = NewItemInstance->GetItemEntry()->GetItemGuid();
NewItemInstance->GetItemEntry()->GetLoadedAmmo() = LoadedAmmo;
if (false)
{
CopyStruct(NewItemInstance->GetItemEntry(), ItemEntry, FFortItemEntry::GetStructSize(), FFortItemEntry::GetStruct());
}
else
{
NewItemInstance->GetItemEntry()->GetItemDefinition() = ItemEntry->GetItemDefinition();
NewItemInstance->GetItemEntry()->GetCount() = ItemEntry->GetCount();
NewItemInstance->GetItemEntry()->GetLoadedAmmo() = ItemEntry->GetLoadedAmmo();
}
NewItemInstance->GetItemEntry()->GetItemGuid() = OldItemGuid;
NewItemInstance->GetItemEntry()->MostRecentArrayReplicationKey = -1;
NewItemInstance->GetItemEntry()->ReplicationID = -1;
NewItemInstance->GetItemEntry()->ReplicationKey = -1;
if (OverrideCount != -1)
NewItemInstance->GetItemEntry()->GetCount() = OverrideCount;
NewItemInstances.push_back(NewItemInstance); NewItemInstances.push_back(NewItemInstance);
// NewItemInstance->GetItemEntry()->GetItemDefinition() = ItemDefinition;
static auto FortItemEntryStruct = FindObject(L"/Script/FortniteGame.FortItemEntry"); static auto FortItemEntryStruct = FindObject(L"/Script/FortniteGame.FortItemEntry");
static auto FortItemEntrySize = *(int*)(__int64(FortItemEntryStruct) + Offsets::PropertiesSize); static auto FortItemEntrySize = *(int*)(__int64(FortItemEntryStruct) + Offsets::PropertiesSize);
// LOG_INFO(LogDev, "FortItemEntryStruct {}", __int64(FortItemEntryStruct));
// LOG_INFO(LogDev, "FortItemEntrySize {}", __int64(FortItemEntrySize));
FFortItemEntryStateValue* StateValue = Alloc<FFortItemEntryStateValue>(FFortItemEntryStateValue::GetStructSize()); FFortItemEntryStateValue* StateValue = Alloc<FFortItemEntryStateValue>(FFortItemEntryStateValue::GetStructSize());
StateValue->GetIntValue() = bShowItemToast; StateValue->GetIntValue() = bShowItemToast;
StateValue->GetStateType() = EFortItemEntryState::ShouldShowItemToast; StateValue->GetStateType() = EFortItemEntryState::ShouldShowItemToast;
@@ -145,6 +154,26 @@ std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddI
ItemInstances.Add(NewItemInstance); ItemInstances.Add(NewItemInstance);
GetItemList().GetReplicatedEntries().Add(*NewItemInstance->GetItemEntry(), FortItemEntrySize); GetItemList().GetReplicatedEntries().Add(*NewItemInstance->GetItemEntry(), FortItemEntrySize);
if (WorldItemDefinition->IsValidLowLevel())
{
if (WorldItemDefinition->ShouldFocusWhenAdded()) // Should we also do this for stacking?
{
FortPlayerController->ServerExecuteInventoryItemHook(FortPlayerController, NewItemInstance->GetItemEntry()->GetItemGuid());
}
bool AreGadgetsEnabled = Addresses::ApplyGadgetData && Addresses::RemoveGadgetData && Globals::bEnableAGIDs;
if (AreGadgetsEnabled)
{
if (auto GadgetItemDefinition = Cast<UFortGadgetItemDefinition>(WorldItemDefinition))
{
char (*ApplyGadgetData)(UFortGadgetItemDefinition * a1, __int64 a2, UFortItem* a3, unsigned __int8 a4) = decltype(ApplyGadgetData)(Addresses::ApplyGadgetData);
static auto FortInventoryOwnerInterfaceClass = FindObject<UClass>("/Script/FortniteGame.FortInventoryOwnerInterface");
ApplyGadgetData((UFortGadgetItemDefinition*)ItemDefinition, __int64(PlayerController->GetInterfaceAddress(FortInventoryOwnerInterfaceClass)), NewItemInstance, true);
}
}
}
if (FortPlayerController && Engine_Version < 420) if (FortPlayerController && Engine_Version < 420)
{ {
static auto QuickBarsOffset = FortPlayerController->GetOffset("QuickBars", false); static auto QuickBarsOffset = FortPlayerController->GetOffset("QuickBars", false);
@@ -198,6 +227,22 @@ std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddI
return std::make_pair(NewItemInstances, ModifiedItemInstances); return std::make_pair(NewItemInstances, ModifiedItemInstances);
} }
std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AFortInventory::AddItem(UFortItemDefinition* ItemDefinition, bool* bShouldUpdate, int Count, int LoadedAmmo, bool bShowItemToast)
{
if (LoadedAmmo == -1)
{
if (auto WeaponDef = Cast<UFortWeaponItemDefinition>(ItemDefinition)) // bPreventDefaultPreload ?
LoadedAmmo = WeaponDef->GetClipSize();
else
LoadedAmmo = 0;
}
auto ItemEntry = FFortItemEntry::MakeItemEntry(ItemDefinition, Count, LoadedAmmo);
auto Ret = AddItem(ItemEntry, bShouldUpdate, bShowItemToast);
// VirtualFree(ItemEntry);
return Ret;
}
bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int Count, bool bForceRemoval) bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int Count, bool bForceRemoval)
{ {
if (bShouldUpdate) if (bShouldUpdate)
@@ -260,13 +305,28 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
return true; return true;
} }
if (NewCount < 0) // Hm
return false;
static auto FortItemEntryStruct = FindObject<UStruct>(L"/Script/FortniteGame.FortItemEntry"); static auto FortItemEntryStruct = FindObject<UStruct>(L"/Script/FortniteGame.FortItemEntry");
static auto FortItemEntrySize = FortItemEntryStruct->GetPropertiesSize(); static auto FortItemEntrySize = FortItemEntryStruct->GetPropertiesSize();
auto FortPlayerController = Cast<AFortPlayerController>(GetOwner());
for (int i = 0; i < ItemInstances.Num(); i++) for (int i = 0; i < ItemInstances.Num(); i++)
{ {
if (ItemInstances.at(i)->GetItemEntry()->GetItemGuid() == ItemGuid) if (ItemInstances.at(i)->GetItemEntry()->GetItemGuid() == ItemGuid)
{ {
bool AreGadgetsEnabled = Addresses::ApplyGadgetData && Addresses::RemoveGadgetData && Globals::bEnableAGIDs;
if (AreGadgetsEnabled)
{
if (auto GadgetItemDefinition = Cast<UFortGadgetItemDefinition>(ItemDefinition))
{
GadgetItemDefinition->UnequipGadgetData(FortPlayerController, ItemInstances.at(i));
}
}
ItemInstance->GetItemEntry()->GetStateValues().FreeReal(); ItemInstance->GetItemEntry()->GetStateValues().FreeReal();
ItemInstances.Remove(i); ItemInstances.Remove(i);
break; break;
@@ -283,8 +343,6 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
} }
} }
auto FortPlayerController = Cast<AFortPlayerController>(GetOwner());
if (FortPlayerController && Engine_Version < 420) if (FortPlayerController && Engine_Version < 420)
{ {
static auto QuickBarsOffset = FortPlayerController->GetOffset("QuickBars", false); static auto QuickBarsOffset = FortPlayerController->GetOffset("QuickBars", false);

View File

@@ -115,6 +115,7 @@ public:
} }
} }
std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AddItem(FFortItemEntry* ItemEntry, bool* bShouldUpdate, bool bShowItemToast = false, int OverrideCount = -1);
std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AddItem(UFortItemDefinition* ItemDefinition, bool* bShouldUpdate, int Count = 1, int LoadedAmmo = -1, bool bShowItemToast = false); std::pair<std::vector<UFortItem*>, std::vector<UFortItem*>> AddItem(UFortItemDefinition* ItemDefinition, bool* bShouldUpdate, int Count = 1, int LoadedAmmo = -1, bool bShowItemToast = false);
bool RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int Count, bool bForceRemoval = false); bool RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int Count, bool bForceRemoval = false);
void ModifyCount(UFortItem* ItemInstance, int New, bool bRemove = false, std::pair<FFortItemEntry*, FFortItemEntry*>* outEntries = nullptr, bool bUpdate = true, bool bShowItemToast = false); void ModifyCount(UFortItem* ItemInstance, int New, bool bRemove = false, std::pair<FFortItemEntry*, FFortItemEntry*>* outEntries = nullptr, bool bUpdate = true, bool bShowItemToast = false);

View File

@@ -11,10 +11,12 @@ char UFortInventoryInterface::RemoveInventoryItemHook(__int64 a1, FGuid a2, int
int SuperAdditionalOffset = Engine_Version >= 427 ? 16 : 8; int SuperAdditionalOffset = Engine_Version >= 427 ? 16 : 8;
auto ControllerObject = (UObject*)(__int64(a1) - (FortPlayerControllerSuperSize + SuperAdditionalOffset)); auto ControllerObject = (UObject*)(__int64(a1) - (FortPlayerControllerSuperSize + SuperAdditionalOffset));
LOG_INFO(LogDev, "bForceRemoval: {}", (bool)bForceRemoval); // LOG_INFO(LogDev, "bForceRemoval: {}", (bool)bForceRemoval);
// LOG_INFO(LogDev, "FortPlayerControllerSuperSize: {}", FortPlayerControllerSuperSize); // LOG_INFO(LogDev, "FortPlayerControllerSuperSize: {}", FortPlayerControllerSuperSize);
// LOG_INFO(LogDev, "ControllerObject: {}", ControllerObject->GetFullName()); // LOG_INFO(LogDev, "ControllerObject: {}", ControllerObject->GetFullName());
LOG_INFO(LogDev, __FUNCTION__);
if (!ControllerObject) if (!ControllerObject)
return false; return false;

View File

@@ -89,6 +89,24 @@ struct FFortItemEntry : FFastArraySerializerItem
return *(int*)(__int64(this) + LoadedAmmoOffset); return *(int*)(__int64(this) + LoadedAmmoOffset);
} }
void CopyFromAnotherItemEntry(FFortItemEntry* OtherItemEntry, bool bCopyGuid = false)
{
auto OldGuid = this->GetItemGuid();
if (false)
{
CopyStruct(this, OtherItemEntry, FFortItemEntry::GetStructSize(), FFortItemEntry::GetStruct());
}
else
{
this->GetItemDefinition() = OtherItemEntry->GetItemDefinition();
this->GetCount() = OtherItemEntry->GetCount();
this->GetLoadedAmmo() = OtherItemEntry->GetLoadedAmmo();
}
this->GetItemGuid() = OldGuid;
}
static UStruct* GetStruct() static UStruct* GetStruct()
{ {
static auto Struct = FindObject<UStruct>("/Script/FortniteGame.FortItemEntry"); static auto Struct = FindObject<UStruct>("/Script/FortniteGame.FortItemEntry");
@@ -103,11 +121,16 @@ struct FFortItemEntry : FFastArraySerializerItem
static FFortItemEntry* MakeItemEntry(UFortItemDefinition* ItemDefinition, int Count = 1, int LoadedAmmo = 0) static FFortItemEntry* MakeItemEntry(UFortItemDefinition* ItemDefinition, int Count = 1, int LoadedAmmo = 0)
{ {
auto Entry = Alloc<FFortItemEntry>(GetStructSize()); auto Entry = // (FFortItemEntry*)FMemory::Realloc(0, GetStructSize(), 0);
Alloc<FFortItemEntry>(GetStructSize());
if (!Entry) if (!Entry)
return nullptr; return nullptr;
Entry->MostRecentArrayReplicationKey = -1;
Entry->ReplicationID = -1;
Entry->ReplicationKey = -1;
Entry->GetItemDefinition() = ItemDefinition; Entry->GetItemDefinition() = ItemDefinition;
Entry->GetCount() = Count; Entry->GetCount() = Count;
Entry->GetLoadedAmmo() = LoadedAmmo; Entry->GetLoadedAmmo() = LoadedAmmo;
@@ -122,7 +145,7 @@ public:
FFortItemEntry* GetItemEntry() FFortItemEntry* GetItemEntry()
{ {
static auto ItemEntryOffset = this->GetOffset("ItemEntry"); static auto ItemEntryOffset = this->GetOffset("ItemEntry");
return &Get<FFortItemEntry>(ItemEntryOffset); return GetPtr<FFortItemEntry>(ItemEntryOffset);
} }
void SetOwningControllerForTemporaryItem(UObject* Controller); void SetOwningControllerForTemporaryItem(UObject* Controller);

View File

@@ -39,10 +39,8 @@ float UFortItemDefinition::GetMaxStackSize()
FSimpleCurve* Curve = nullptr; FSimpleCurve* Curve = nullptr;
for (int i = 0; i < RowMap.Pairs.Elements.Data.Num(); i++) for (auto& Pair : RowMap)
{ {
auto& Pair = RowMap.Pairs.Elements.Data.at(i).ElementData.Value;
if (Pair.Key() == ScalableFloat.Curve.RowName) if (Pair.Key() == ScalableFloat.Curve.RowName)
{ {
Curve = (FSimpleCurve*)Pair.Value(); Curve = (FSimpleCurve*)Pair.Value();

View File

@@ -144,7 +144,7 @@ bool UFortKismetLibrary::SpawnInstancedPickupInWorldHook(UObject* Context, FFram
Stack.StepCompiledIn(&bRandomRotation); Stack.StepCompiledIn(&bRandomRotation);
Stack.StepCompiledIn(&bBlockedFromAutoPickup); Stack.StepCompiledIn(&bBlockedFromAutoPickup);
auto Pickup = AFortPickup::SpawnPickup(ItemDefinition, Position, NumberToSpawn); auto Pickup = AFortPickup::SpawnPickup(ItemDefinition, Position, NumberToSpawn, EFortPickupSourceTypeFlag::Other, EFortPickupSpawnSource::Unset, -1, nullptr, nullptr, bToss);
*Ret = Pickup; *Ret = Pickup;
return *Ret; return *Ret;
@@ -157,6 +157,14 @@ void UFortKismetLibrary::K2_SpawnPickupInWorldWithLootTierHook(UObject* Context,
return K2_SpawnPickupInWorldWithLootTierOriginal(Context, Stack, Ret); return K2_SpawnPickupInWorldWithLootTierOriginal(Context, Stack, Ret);
} }
void TestFunctionHook(UObject* Context, FFrame& Stack, void* Ret)
{
auto PlayerController = (AFortPlayerController*)Context;
AFortPawn* Pawn = nullptr;
Stack.StepCompiledIn(&Pawn);
}
void UFortKismetLibrary::CreateTossAmmoPickupForWeaponItemDefinitionAtLocationHook(UObject* Context, FFrame& Stack, void* Ret) void UFortKismetLibrary::CreateTossAmmoPickupForWeaponItemDefinitionAtLocationHook(UObject* Context, FFrame& Stack, void* Ret)
{ {
UObject* WorldContextObject; UObject* WorldContextObject;
@@ -386,6 +394,27 @@ void UFortKismetLibrary::K2_GiveBuildingResourceHook(UObject* Context, FFrame& S
return K2_GiveBuildingResourceOriginal(Context, Stack, Ret); return K2_GiveBuildingResourceOriginal(Context, Stack, Ret);
} }
int UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook1(AFortPlayerController* PlayerController, UFortItem* Item, int AmountToRemove, bool bForceRemoval)
{
LOG_INFO(LogDev, "K2_RemoveFortItemFromPlayerHookNative!");
if (!PlayerController || !Item)
return 0;
auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory)
return 0;
bool bShouldUpdate = false;
WorldInventory->RemoveItem(Item->GetItemEntry()->GetItemGuid(), &bShouldUpdate, AmountToRemove, bForceRemoval);
if (bShouldUpdate)
WorldInventory->Update();
return 1; // idk probably how much we removed
}
void UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook(UObject* Context, FFrame& Stack, void* Ret) void UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook(UObject* Context, FFrame& Stack, void* Ret)
{ {
AFortPlayerController* PlayerController = nullptr; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) AFortPlayerController* PlayerController = nullptr; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
@@ -400,7 +429,7 @@ void UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook(UObject* Context, FFram
LOG_INFO(LogDev, __FUNCTION__); LOG_INFO(LogDev, __FUNCTION__);
if (!PlayerController) if (!PlayerController || !Item)
return; return;
auto WorldInventory = PlayerController->GetWorldInventory(); auto WorldInventory = PlayerController->GetWorldInventory();
@@ -459,7 +488,7 @@ AFortPickup* UFortKismetLibrary::K2_SpawnPickupInWorldWithClassHook(UObject* Con
LOG_INFO(LogDev, __FUNCTION__); LOG_INFO(LogDev, __FUNCTION__);
auto aa = AFortPickup::SpawnPickup(ItemDefinition, Position, NumberToSpawn, SourceType, Source, -1, nullptr, PickupClass); auto aa = AFortPickup::SpawnPickup(ItemDefinition, Position, NumberToSpawn, SourceType, Source, -1, nullptr, PickupClass, bToss);
K2_SpawnPickupInWorldWithClassOriginal(Context, Stack, Ret); K2_SpawnPickupInWorldWithClassOriginal(Context, Stack, Ret);
@@ -504,7 +533,7 @@ AFortPickup* UFortKismetLibrary::K2_SpawnPickupInWorldHook(UObject* Context, FFr
if (!ItemDefinition) if (!ItemDefinition)
return K2_SpawnPickupInWorldOriginal(Context, Stack, Ret); return K2_SpawnPickupInWorldOriginal(Context, Stack, Ret);
auto aa = AFortPickup::SpawnPickup(ItemDefinition, Position, NumberToSpawn, SourceType, Source); auto aa = AFortPickup::SpawnPickup(ItemDefinition, Position, NumberToSpawn, SourceType, Source, -1, nullptr, nullptr, bToss);
K2_SpawnPickupInWorldOriginal(Context, Stack, Ret); K2_SpawnPickupInWorldOriginal(Context, Stack, Ret);
@@ -542,12 +571,9 @@ bool UFortKismetLibrary::PickLootDropsHook(UObject* Context, FFrame& Stack, bool
for (int i = 0; i < LootDrops.size(); i++) for (int i = 0; i < LootDrops.size(); i++)
{ {
auto NewEntry = Alloc<FFortItemEntry>(FFortItemEntry::GetStructSize());
auto& LootDrop = LootDrops.at(i); auto& LootDrop = LootDrops.at(i);
NewEntry->GetItemDefinition() = LootDrop.ItemDefinition; auto NewEntry = FFortItemEntry::MakeItemEntry(LootDrop.ItemDefinition, LootDrop.Count, LootDrop.LoadedAmmo);
NewEntry->GetCount() = LootDrop.Count;
NewEntry->GetLoadedAmmo() = LootDrop.LoadedAmmo;
OutLootToDrop.AddPtr(NewEntry, FFortItemEntry::GetStructSize()); OutLootToDrop.AddPtr(NewEntry, FFortItemEntry::GetStructSize());
} }

View File

@@ -95,6 +95,7 @@ public:
static void K2_RemoveItemFromPlayerByGuidHook(UObject* Context, FFrame& Stack, void* Ret); static void K2_RemoveItemFromPlayerByGuidHook(UObject* Context, FFrame& Stack, void* Ret);
static void K2_GiveItemToPlayerHook(UObject* Context, FFrame& Stack, void* Ret); static void K2_GiveItemToPlayerHook(UObject* Context, FFrame& Stack, void* Ret);
static void K2_GiveBuildingResourceHook(UObject* Context, FFrame& Stack, void* Ret); static void K2_GiveBuildingResourceHook(UObject* Context, FFrame& Stack, void* Ret);
static int K2_RemoveFortItemFromPlayerHook1(AFortPlayerController* PlayerController, UFortItem* Item, int AmountToRemove, bool bForceRemoval);
static void K2_RemoveFortItemFromPlayerHook(UObject* Context, FFrame& Stack, void* Ret); static void K2_RemoveFortItemFromPlayerHook(UObject* Context, FFrame& Stack, void* Ret);
static AFortPickup* K2_SpawnPickupInWorldHook(UObject* Context, FFrame& Stack, AFortPickup** Ret); static AFortPickup* K2_SpawnPickupInWorldHook(UObject* Context, FFrame& Stack, AFortPickup** Ret);
static AFortPickup* K2_SpawnPickupInWorldWithClassHook(UObject* Context, FFrame& Stack, AFortPickup** Ret); static AFortPickup* K2_SpawnPickupInWorldWithClassHook(UObject* Context, FFrame& Stack, AFortPickup** Ret);

View File

@@ -21,71 +21,8 @@ float GetRandomFloatForLooting(float min, float max)
return UKismetMathLibrary::RandomFloatInRange(min, max); return UKismetMathLibrary::RandomFloatInRange(min, max);
} }
static FFortLootTierData* GetLootTierData2(std::vector<FFortLootTierData*>& LootTierData, bool bPrint) static FFortLootTierData* GetLootTierData(std::vector<FFortLootTierData*>& LootTierData, float TotalWeight)
{ {
float TotalWeight = 0;
FFortLootTierData* SelectedItem = nullptr;
for (auto Item : LootTierData)
{
TotalWeight += Item->GetWeight();
}
float RandomNumber = GetRandomFloatForLooting(0, 1);
float cumulative_weight = 0.0f;
for (auto Item : LootTierData)
{
cumulative_weight += Item->GetWeight() / TotalWeight;
if (RandomNumber <= Item->GetWeight())
{
SelectedItem = Item;
break;
}
}
if (!SelectedItem)
return GetLootTierData2(LootTierData, bPrint);
return SelectedItem;
}
static FFortLootPackageData* GetLootPackage2(std::vector<FFortLootPackageData*>& LootPackages)
{
float TotalWeight = 0;
FFortLootPackageData* SelectedItem = nullptr;
for (auto Item : LootPackages)
{
TotalWeight += Item->GetWeight();
}
float RandomNumber = GetRandomFloatForLooting(0, 1);
float cumulative_weight = 0.0f;
for (auto Item : LootPackages)
{
cumulative_weight += Item->GetWeight() / TotalWeight;
if (RandomNumber <= Item->GetWeight())
{
SelectedItem = Item;
break;
}
}
if (!SelectedItem)
return GetLootPackage2(LootPackages);
return SelectedItem;
}
static FFortLootTierData* GetLootTierData(std::vector<FFortLootTierData*>& LootTierData, bool bPrint)
{
// return GetLootTierData2(LootTierData, bPrint);
float TotalWeight = 0;
FFortLootTierData* SelectedItem = nullptr; FFortLootTierData* SelectedItem = nullptr;
for (auto Item : LootTierData) for (auto Item : LootTierData)
@@ -107,23 +44,15 @@ static FFortLootTierData* GetLootTierData(std::vector<FFortLootTierData*>& LootT
} }
if (!SelectedItem) if (!SelectedItem)
return GetLootTierData(LootTierData, bPrint); return GetLootTierData(LootTierData, TotalWeight);
return SelectedItem; return SelectedItem;
} }
static FFortLootPackageData* GetLootPackage(std::vector<FFortLootPackageData*>& LootPackages) static FFortLootPackageData* GetLootPackage(std::vector<FFortLootPackageData*>& LootPackages, float TotalWeight)
{ {
// return GetLootPackage2(LootPackages);
float TotalWeight = 0;
FFortLootPackageData* SelectedItem = nullptr; FFortLootPackageData* SelectedItem = nullptr;
for (auto Item : LootPackages)
{
TotalWeight += Item->GetWeight();
}
float RandomNumber = GetRandomFloatForLooting(0, TotalWeight); // is -1 needed? float RandomNumber = GetRandomFloatForLooting(0, TotalWeight); // is -1 needed?
for (auto Item : LootPackages) for (auto Item : LootPackages)
@@ -138,7 +67,7 @@ static FFortLootPackageData* GetLootPackage(std::vector<FFortLootPackageData*>&
} }
if (!SelectedItem) if (!SelectedItem)
return GetLootPackage(LootPackages); return GetLootPackage(LootPackages, TotalWeight);
return SelectedItem; return SelectedItem;
} }
@@ -250,9 +179,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
if (CurrentPlaylist) if (CurrentPlaylist)
{ {
static auto PlaylistOverrideLootTableDataOffset = GameFeatureData->GetOffset("PlaylistOverrideLootTableData"); static auto PlaylistOverrideLootTableDataOffset = GameFeatureData->GetOffset("PlaylistOverrideLootTableData");
auto PlaylistOverrideLootTableData = GameFeatureData->GetPtr<TMap<FGameplayTag, FFortGameFeatureLootTableData>>(PlaylistOverrideLootTableDataOffset); auto& PlaylistOverrideLootTableData = GameFeatureData->Get<TMap<FGameplayTag, FFortGameFeatureLootTableData>>(PlaylistOverrideLootTableDataOffset);
auto PlaylistOverrideLootTableData_Data = PlaylistOverrideLootTableData->Pairs.Elements.Data;
static auto GameplayTagContainerOffset = CurrentPlaylist->GetOffset("GameplayTagContainer"); static auto GameplayTagContainerOffset = CurrentPlaylist->GetOffset("GameplayTagContainer");
auto GameplayTagContainer = CurrentPlaylist->GetPtr<FGameplayTagContainer>(GameplayTagContainerOffset); auto GameplayTagContainer = CurrentPlaylist->GetPtr<FGameplayTagContainer>(GameplayTagContainerOffset);
@@ -261,9 +188,8 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
{ {
auto& Tag = GameplayTagContainer->GameplayTags.At(i); auto& Tag = GameplayTagContainer->GameplayTags.At(i);
for (int j = 0; j < PlaylistOverrideLootTableData_Data.Num(); j++) for (auto Value : PlaylistOverrideLootTableData)
{ {
auto Value = PlaylistOverrideLootTableData_Data.at(j).ElementData.Value;
auto CurrentOverrideTag = Value.First; auto CurrentOverrideTag = Value.First;
if (Tag.TagName == CurrentOverrideTag.TagName) if (Tag.TagName == CurrentOverrideTag.TagName)
@@ -307,9 +233,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
if (CurrentPlaylist) if (CurrentPlaylist)
{ {
static auto PlaylistOverrideLootTableDataOffset = GameFeatureData->GetOffset("PlaylistOverrideLootTableData"); static auto PlaylistOverrideLootTableDataOffset = GameFeatureData->GetOffset("PlaylistOverrideLootTableData");
auto PlaylistOverrideLootTableData = GameFeatureData->GetPtr<TMap<FGameplayTag, FFortGameFeatureLootTableData>>(PlaylistOverrideLootTableDataOffset); auto& PlaylistOverrideLootTableData = GameFeatureData->Get<TMap<FGameplayTag, FFortGameFeatureLootTableData>>(PlaylistOverrideLootTableDataOffset);
auto PlaylistOverrideLootTableData_Data = PlaylistOverrideLootTableData->Pairs.Elements.Data;
static auto GameplayTagContainerOffset = CurrentPlaylist->GetOffset("GameplayTagContainer"); static auto GameplayTagContainerOffset = CurrentPlaylist->GetOffset("GameplayTagContainer");
auto GameplayTagContainer = CurrentPlaylist->GetPtr<FGameplayTagContainer>(GameplayTagContainerOffset); auto GameplayTagContainer = CurrentPlaylist->GetPtr<FGameplayTagContainer>(GameplayTagContainerOffset);
@@ -318,9 +242,8 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
{ {
auto& Tag = GameplayTagContainer->GameplayTags.At(i); auto& Tag = GameplayTagContainer->GameplayTags.At(i);
for (int j = 0; j < PlaylistOverrideLootTableData_Data.Num(); j++) for (auto& Value : PlaylistOverrideLootTableData)
{ {
auto Value = PlaylistOverrideLootTableData_Data.at(j).ElementData.Value;
auto CurrentOverrideTag = Value.First; auto CurrentOverrideTag = Value.First;
if (Tag.TagName == CurrentOverrideTag.TagName) if (Tag.TagName == CurrentOverrideTag.TagName)
@@ -373,7 +296,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
} }
} }
if (Fortnite_Version < 6) // ahhh if (Fortnite_Version <= 6) // ahhh
{ {
LTDTables.clear(); LTDTables.clear();
LPTables.clear(); LPTables.clear();
@@ -423,6 +346,8 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
std::vector<FFortLootTierData*> TierGroupLTDs; std::vector<FFortLootTierData*> TierGroupLTDs;
float TotalTierGroupLTDsWeight = 0;
for (int p = 0; p < LTDTables.size(); p++) for (int p = 0; p < LTDTables.size(); p++)
{ {
auto LTD = LTDTables[p]; auto LTD = LTDTables[p];
@@ -449,6 +374,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
if (TierGroupName == TierData->GetTierGroup() && TierData->GetWeight() != 0) if (TierGroupName == TierData->GetTierGroup() && TierData->GetWeight() != 0)
{ {
TotalTierGroupLTDsWeight += TierData->GetWeight();
TierGroupLTDs.push_back(TierData); TierGroupLTDs.push_back(TierData);
} }
} }
@@ -460,7 +386,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
return LootDrops; return LootDrops;
} }
FFortLootTierData* ChosenRowLootTierData = GetLootTierData(TierGroupLTDs, bPrint); FFortLootTierData* ChosenRowLootTierData = GetLootTierData(TierGroupLTDs, TotalTierGroupLTDsWeight);
if (!ChosenRowLootTierData) // Should NEVER happen if (!ChosenRowLootTierData) // Should NEVER happen
return LootDrops; return LootDrops;
@@ -627,6 +553,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
} }
std::vector<FFortLootPackageData*> lootPackageCalls; std::vector<FFortLootPackageData*> lootPackageCalls;
float lootPackageCallsTotalWeight = 0;
if (bIsWorldList) if (bIsWorldList)
{ {
@@ -635,9 +562,12 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
auto& CurrentLP = TierGroupLPs.at(j); auto& CurrentLP = TierGroupLPs.at(j);
if (CurrentLP->GetWeight() != 0) if (CurrentLP->GetWeight() != 0)
{
lootPackageCallsTotalWeight += CurrentLP->GetWeight();
lootPackageCalls.push_back(CurrentLP); lootPackageCalls.push_back(CurrentLP);
} }
} }
}
else else
{ {
for (int p = 0; p < LPTables.size(); p++) for (int p = 0; p < LPTables.size(); p++)
@@ -653,6 +583,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
if (LootPackage->GetLootPackageID().ToString() == TierGroupLPStr && LootPackage->GetWeight() != 0 && LootPackage->GetCount() != 0) if (LootPackage->GetLootPackageID().ToString() == TierGroupLPStr && LootPackage->GetWeight() != 0 && LootPackage->GetCount() != 0)
{ {
lootPackageCallsTotalWeight += LootPackage->GetWeight();
lootPackageCalls.push_back(LootPackage); lootPackageCalls.push_back(LootPackage);
} }
} }
@@ -669,7 +600,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, bool bPrint, int recurs
continue; continue;
} }
FFortLootPackageData* LootPackageCall = GetLootPackage(lootPackageCalls); FFortLootPackageData* LootPackageCall = GetLootPackage(lootPackageCalls, lootPackageCallsTotalWeight);
if (!LootPackageCall) // Should NEVER happen if (!LootPackageCall) // Should NEVER happen
{ {

View File

@@ -0,0 +1,35 @@
#pragma once
#include "FortAthenaVehicle.h"
#include "reboot.h"
class AFortMountedCannon : public AFortAthenaVehicle // : public AFortMountedTurret
{
public:
void OnLaunchPawn(AFortPlayerPawn* Pawn)
{
static auto OnLaunchPawnFn = FindObject<UFunction>("/Script/FortniteGame.FortMountedCannon.OnLaunchPawn");
this->ProcessEvent(OnLaunchPawnFn, &Pawn);
}
void ShootPawnOut()
{
auto PawnToShoot = this->GetPawnAtSeat(0);
LOG_INFO(LogDev, "PawnToShoot: {}", __int64(PawnToShoot));
if (!PawnToShoot)
return;
PawnToShoot->ServerOnExitVehicle(ETryExitVehicleBehavior::ForceAlways);
this->OnLaunchPawn(PawnToShoot);
}
static UClass* StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortMountedCannon");
return Class;
}
};

View File

@@ -0,0 +1,12 @@
#include "FortOctopusVehicle.h"
#include "reboot.h"
void AFortOctopusVehicle::ServerUpdateTowhookHook(AFortOctopusVehicle* OctopusVehicle, FVector InNetTowhookAimDir)
{
static auto NetTowhookAimDirOffset = OctopusVehicle->GetOffset("NetTowhookAimDir");
OctopusVehicle->Get<FVector>(NetTowhookAimDirOffset) = InNetTowhookAimDir;
static auto OnRep_NetTowhookAimDirFn = FindObject<UFunction>("/Script/FortniteGame.FortOctopusVehicle.OnRep_NetTowhookAimDir");
OctopusVehicle->ProcessEvent(OnRep_NetTowhookAimDirFn);
}

View File

@@ -0,0 +1,10 @@
#pragma once
#include "Actor.h"
#include "Vector.h"
class AFortOctopusVehicle : public AActor // AFortAthenaSKVehicle
{
public:
static void ServerUpdateTowhookHook(AFortOctopusVehicle* OctopusVehicle, FVector InNetTowhookAimDir);
};

View File

@@ -74,6 +74,31 @@ void AFortPawn::NetMulticast_Athena_BatchedDamageCuesHook(UObject* Context, FFra
return NetMulticast_Athena_BatchedDamageCuesOriginal(Context, Stack, Ret); return NetMulticast_Athena_BatchedDamageCuesOriginal(Context, Stack, Ret);
} }
void AFortPawn::MovingEmoteStoppedHook(UObject* Context, FFrame* Stack, void* Ret)
{
// LOG_INFO(LogDev, "MovingEmoteStoppedHook!");
auto Pawn = (AFortPawn*)Context;
static auto bMovingEmoteOffset = Pawn->GetOffset("bMovingEmote", false);
if (bMovingEmoteOffset != -1)
{
static auto bMovingEmoteFieldMask = GetFieldMask(Pawn->GetProperty("bMovingEmote"));
Pawn->SetBitfieldValue(bMovingEmoteOffset, bMovingEmoteFieldMask, false);
}
static auto bMovingEmoteForwardOnlyOffset = Pawn->GetOffset("bMovingEmoteForwardOnly", false);
if (bMovingEmoteForwardOnlyOffset != -1)
{
static auto bMovingEmoteForwardOnlyFieldMask = GetFieldMask(Pawn->GetProperty("bMovingEmoteForwardOnly"));
Pawn->SetBitfieldValue(bMovingEmoteOffset, bMovingEmoteForwardOnlyFieldMask, false);
}
return MovingEmoteStoppedOriginal(Context, Stack, Ret);
}
UClass* AFortPawn::StaticClass() UClass* AFortPawn::StaticClass()
{ {
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPawn"); static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPawn");

View File

@@ -8,6 +8,8 @@ class AFortPawn : public APawn
{ {
public: public:
static inline void (*NetMulticast_Athena_BatchedDamageCuesOriginal)(UObject* Context, FFrame* Stack, void* Ret); static inline void (*NetMulticast_Athena_BatchedDamageCuesOriginal)(UObject* Context, FFrame* Stack, void* Ret);
static inline void (*MovingEmoteStoppedOriginal)(UObject* Context, FFrame* Stack, void* Ret);
AFortWeapon* EquipWeaponDefinition(UFortWeaponItemDefinition* WeaponData, const FGuid& ItemEntryGuid); AFortWeapon* EquipWeaponDefinition(UFortWeaponItemDefinition* WeaponData, const FGuid& ItemEntryGuid);
bool PickUpActor(AActor* PickupTarget, UFortDecoItemDefinition* PlacementDecoItemDefinition); bool PickUpActor(AActor* PickupTarget, UFortDecoItemDefinition* PlacementDecoItemDefinition);
@@ -28,6 +30,7 @@ public:
void SetHealth(float NewHealth); void SetHealth(float NewHealth);
void SetShield(float NewShield); void SetShield(float NewShield);
static void NetMulticast_Athena_BatchedDamageCuesHook(UObject* Context, FFrame* Stack, void* Ret); static void NetMulticast_Athena_BatchedDamageCuesHook(UObject* Context, FFrame* Stack, void* Ret);
static void MovingEmoteStoppedHook(UObject* Context, FFrame* Stack, void* Ret);
static UClass* StaticClass(); static UClass* StaticClass();
}; };

View File

@@ -5,6 +5,7 @@
#include "FortPlayerState.h" #include "FortPlayerState.h"
#include "FortPlayerPawn.h" #include "FortPlayerPawn.h"
#include "FortPlayerController.h" #include "FortPlayerController.h"
#include <memcury.h>
void AFortPickup::TossPickup(FVector FinalLocation, AFortPawn* ItemOwner, int OverrideMaxStackCount, bool bToss, EFortPickupSourceTypeFlag InPickupSourceTypeFlags, EFortPickupSpawnSource InPickupSpawnSource) void AFortPickup::TossPickup(FVector FinalLocation, AFortPawn* ItemOwner, int OverrideMaxStackCount, bool bToss, EFortPickupSourceTypeFlag InPickupSourceTypeFlags, EFortPickupSpawnSource InPickupSpawnSource)
{ {
@@ -17,15 +18,18 @@ void AFortPickup::TossPickup(FVector FinalLocation, AFortPawn* ItemOwner, int Ov
this->ProcessEvent(fn, &AFortPickup_TossPickup_Params); this->ProcessEvent(fn, &AFortPickup_TossPickup_Params);
} }
AFortPickup* AFortPickup::SpawnPickup(UFortItemDefinition* ItemDef, FVector Location, int Count, EFortPickupSourceTypeFlag PickupSource, EFortPickupSpawnSource SpawnSource, int LoadedAmmo, AFortPawn* Pawn, UClass* OverrideClass) AFortPickup* AFortPickup::SpawnPickup(FFortItemEntry* ItemEntry, FVector Location,
EFortPickupSourceTypeFlag PickupSource, EFortPickupSpawnSource SpawnSource,
class AFortPawn* Pawn, UClass* OverrideClass, bool bToss)
{ {
static auto FortPickupClass = FindObject<UClass>(L"/Script/FortniteGame.FortPickup"); // static auto FortPickupClass = FindObject<UClass>(L"/Script/FortniteGame.FortPickup");
static auto FortPickupAthenaClass = FindObject<UClass>(L"/Script/FortniteGame.FortPickupAthena");
auto PlayerState = Pawn ? Cast<AFortPlayerState>(Pawn->GetPlayerState()) : nullptr; auto PlayerState = Pawn ? Cast<AFortPlayerState>(Pawn->GetPlayerState()) : nullptr;
FActorSpawnParameters SpawnParameters{}; FActorSpawnParameters SpawnParameters{};
// SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn; // SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
if (auto Pickup = GetWorld()->SpawnActor<AFortPickup>(OverrideClass ? OverrideClass : FortPickupClass, Location, FQuat(), FVector(1, 1, 1), SpawnParameters)) if (auto Pickup = GetWorld()->SpawnActor<AFortPickup>(OverrideClass ? OverrideClass : FortPickupAthenaClass, Location, FQuat(), FVector(1, 1, 1), SpawnParameters))
{ {
static auto PawnWhoDroppedPickupOffset = Pickup->GetOffset("PawnWhoDroppedPickup"); static auto PawnWhoDroppedPickupOffset = Pickup->GetOffset("PawnWhoDroppedPickup");
Pickup->Get<AFortPawn*>(PawnWhoDroppedPickupOffset) = Pawn; Pickup->Get<AFortPawn*>(PawnWhoDroppedPickupOffset) = Pawn;
@@ -41,15 +45,26 @@ AFortPickup* AFortPickup::SpawnPickup(UFortItemDefinition* ItemDef, FVector Loca
auto PrimaryPickupItemEntry = Pickup->GetPrimaryPickupItemEntry(); auto PrimaryPickupItemEntry = Pickup->GetPrimaryPickupItemEntry();
PrimaryPickupItemEntry->GetCount() = Count; auto OldGuid = PrimaryPickupItemEntry->GetItemGuid();
PrimaryPickupItemEntry->GetItemDefinition() = ItemDef;
PrimaryPickupItemEntry->GetLoadedAmmo() = LoadedAmmo; if (false)
{
CopyStruct(PrimaryPickupItemEntry, ItemEntry, FFortItemEntry::GetStructSize(), FFortItemEntry::GetStruct());
}
else
{
PrimaryPickupItemEntry->GetItemDefinition() = ItemEntry->GetItemDefinition();
PrimaryPickupItemEntry->GetCount() = ItemEntry->GetCount();
PrimaryPickupItemEntry->GetLoadedAmmo() = ItemEntry->GetLoadedAmmo();
}
PrimaryPickupItemEntry->GetItemGuid() = OldGuid;
// Pickup->OnRep_PrimaryPickupItemEntry();
// static auto OptionalOwnerIDOffset = Pickup->GetOffset("OptionalOwnerID"); // static auto OptionalOwnerIDOffset = Pickup->GetOffset("OptionalOwnerID");
// Pickup->Get<int>(OptionalOwnerIDOffset) = PlayerState ? PlayerState->GetWorldPlayerId() : -1; // Pickup->Get<int>(OptionalOwnerIDOffset) = PlayerState ? PlayerState->GetWorldPlayerId() : -1;
bool bToss = true;
if (bToss) if (bToss)
{ {
PickupSource |= EFortPickupSourceTypeFlag::Tossed; PickupSource |= EFortPickupSourceTypeFlag::Tossed;
@@ -57,12 +72,12 @@ AFortPickup* AFortPickup::SpawnPickup(UFortItemDefinition* ItemDef, FVector Loca
Pickup->TossPickup(Location, Pawn, 0, bToss, PickupSource, SpawnSource); Pickup->TossPickup(Location, Pawn, 0, bToss, PickupSource, SpawnSource);
if (PickupSource == EFortPickupSourceTypeFlag::Container) if (PickupSource == EFortPickupSourceTypeFlag::Container) // crashes if we do this then tosspickup
{ {
static auto bTossedFromContainerOffset = Pickup->GetOffset("bTossedFromContainer"); static auto bTossedFromContainerOffset = Pickup->GetOffset("bTossedFromContainer");
Pickup->Get<bool>(bTossedFromContainerOffset) = true; Pickup->Get<bool>(bTossedFromContainerOffset) = true;
// Pickup->OnRep_TossedFromContainer(); // Pickup->OnRep_TossedFromContainer();
} // crashes if we do this then tosspickup }
return Pickup; return Pickup;
} }
@@ -70,6 +85,15 @@ AFortPickup* AFortPickup::SpawnPickup(UFortItemDefinition* ItemDef, FVector Loca
return nullptr; return nullptr;
} }
AFortPickup* AFortPickup::SpawnPickup(UFortItemDefinition* ItemDef, FVector Location, int Count, EFortPickupSourceTypeFlag PickupSource, EFortPickupSpawnSource SpawnSource,
int LoadedAmmo, AFortPawn* Pawn, UClass* OverrideClass, bool bToss)
{
auto ItemEntry = FFortItemEntry::MakeItemEntry(ItemDef, Count, LoadedAmmo);
auto Pickup = SpawnPickup(ItemEntry, Location, PickupSource, SpawnSource, Pawn, OverrideClass, bToss);
// VirtualFree(ItemEntry);
return Pickup;
}
char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup)
{ {
constexpr bool bTestPrinting = false; // we could just use our own logger but eh constexpr bool bTestPrinting = false; // we could just use our own logger but eh
@@ -123,6 +147,10 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup)
if constexpr (bTestPrinting) if constexpr (bTestPrinting)
LOG_INFO(LogDev, "Start cpyCount: {}", cpyCount); LOG_INFO(LogDev, "Start cpyCount: {}", cpyCount);
bool bWasHoldingSameItemWhenSwap = false;
FGuid NewSwappedItem = FGuid(-1, -1, -1, -1);
bool bForceOverflow = false; bool bForceOverflow = false;
while (cpyCount > 0) while (cpyCount > 0)
@@ -149,10 +177,12 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup)
if (bIsInventoryFull) // probs shouldnt do in loop but alr if (bIsInventoryFull) // probs shouldnt do in loop but alr
{ {
if (ItemInstanceToSwap && ItemDefinitionToSwap->CanBeDropped() && !bHasSwapped) if (ItemInstanceToSwap && ItemDefinitionToSwap->CanBeDropped() && !bHasSwapped) // swap
{ {
auto SwappedPickup = SpawnPickup(ItemDefinitionToSwap, PawnLoc, ItemEntryToSwap->GetCount(), auto SwappedPickup = SpawnPickup(ItemEntryToSwap, PawnLoc,
EFortPickupSourceTypeFlag::Player, EFortPickupSpawnSource::Unset, ItemEntryToSwap->GetLoadedAmmo(), Pawn); EFortPickupSourceTypeFlag::Player, EFortPickupSpawnSource::Unset, Pawn);
bWasHoldingSameItemWhenSwap = CurrentItemGuid == ItemInstanceToSwap->GetItemEntry()->GetItemGuid();
WorldInventory->RemoveItem(CurrentItemGuid, nullptr, ItemEntryToSwap->GetCount(), true); WorldInventory->RemoveItem(CurrentItemGuid, nullptr, ItemEntryToSwap->GetCount(), true);
@@ -219,14 +249,22 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup)
{ {
auto NewItemCount = cpyCount > PickupItemDefinition->GetMaxStackSize() ? PickupItemDefinition->GetMaxStackSize() : cpyCount; auto NewItemCount = cpyCount > PickupItemDefinition->GetMaxStackSize() ? PickupItemDefinition->GetMaxStackSize() : cpyCount;
auto NewItem = WorldInventory->AddItem(PickupItemDefinition, nullptr, auto NewAndModifiedInstances = WorldInventory->AddItem(PickupEntry, nullptr, true, NewItemCount);
NewItemCount, PickupEntry->GetLoadedAmmo(), true);
auto NewVehicleInstance = NewAndModifiedInstances.first[0];
if (!NewVehicleInstance)
continue;
else
cpyCount -= NewItemCount;
if constexpr (bTestPrinting) if constexpr (bTestPrinting)
LOG_INFO(LogDev, "Added item with count {} to inventory.", NewItemCount); LOG_INFO(LogDev, "Added item with count {} to inventory.", NewItemCount);
// if (NewItem) if (bHasSwapped && NewSwappedItem == FGuid(-1, -1, -1, -1))
cpyCount -= NewItemCount; {
NewSwappedItem = NewVehicleInstance->GetItemEntry()->GetItemGuid();
}
} }
else else
{ {
@@ -250,5 +288,24 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup)
WorldInventory->GetItemList().MarkItemDirty(value); WorldInventory->GetItemList().MarkItemDirty(value);
} }
if (bWasHoldingSameItemWhenSwap && NewSwappedItem != FGuid(-1, -1, -1, -1))
{
static auto ClientEquipItemFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerControllerAthena.ClientEquipItem") ? FindObject<UFunction>("/Script/FortniteGame.FortPlayerControllerAthena.ClientEquipItem") : FindObject<UFunction>("/Script/FortniteGame.FortPlayerController.ClientEquipItem");
struct
{
FGuid ItemGuid; // (ConstParm, Parm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
bool bForceExecution; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
} AFortPlayerController_ClientEquipItem_Params{ NewSwappedItem, true };
PlayerController->ProcessEvent(ClientEquipItemFn, &AFortPlayerController_ClientEquipItem_Params);
}
return CompletePickupAnimationOriginal(Pickup); return CompletePickupAnimationOriginal(Pickup);
} }
UClass* AFortPickup::StaticClass()
{
static auto Class = FindObject<UClass>("/Script/FortniteGame.FortPickup");
return Class;
}

View File

@@ -87,9 +87,15 @@ public:
return this->GetPtr<FFortItemEntry>(PrimaryPickupItemEntryOffset); return this->GetPtr<FFortItemEntry>(PrimaryPickupItemEntryOffset);
} }
static AFortPickup* SpawnPickup(FFortItemEntry* ItemEntry, FVector Location,
EFortPickupSourceTypeFlag PickupSource = EFortPickupSourceTypeFlag::Other, EFortPickupSpawnSource SpawnSource = EFortPickupSpawnSource::Unset,
class AFortPawn* Pawn = nullptr, UClass* OverrideClass = nullptr, bool bToss = true);
static AFortPickup* SpawnPickup(class UFortItemDefinition* ItemDef, FVector Location, int Count, static AFortPickup* SpawnPickup(class UFortItemDefinition* ItemDef, FVector Location, int Count,
EFortPickupSourceTypeFlag PickupSource = EFortPickupSourceTypeFlag::Other, EFortPickupSpawnSource SpawnSource = EFortPickupSpawnSource::Unset, EFortPickupSourceTypeFlag PickupSource = EFortPickupSourceTypeFlag::Other, EFortPickupSpawnSource SpawnSource = EFortPickupSpawnSource::Unset,
int LoadedAmmo = -1, class AFortPawn* Pawn = nullptr, UClass* OverrideClass = nullptr); int LoadedAmmo = -1, class AFortPawn* Pawn = nullptr, UClass* OverrideClass = nullptr, bool bToss = true);
static char CompletePickupAnimationHook(AFortPickup* Pickup); static char CompletePickupAnimationHook(AFortPickup* Pickup);
static UClass* StaticClass();
}; };

View File

@@ -19,6 +19,7 @@
#include "KismetStringLibrary.h" #include "KismetStringLibrary.h"
#include "FortGadgetItemDefinition.h" #include "FortGadgetItemDefinition.h"
#include "FortAbilitySet.h" #include "FortAbilitySet.h"
#include "vendingmachine.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)
{ {
@@ -70,14 +71,12 @@ void AFortPlayerController::DropAllItems(const std::vector<UFortItemDefinition*>
if (bIgnoreSecondaryQuickbar && !IsPrimaryQuickbar(WorldItemDefinition)) if (bIgnoreSecondaryQuickbar && !IsPrimaryQuickbar(WorldItemDefinition))
continue; continue;
auto ShouldBeDropped = !WorldItemDefinition->CanBeDropped(); if (!bRemoveIfNotDroppable && !WorldItemDefinition->CanBeDropped())
if (!bRemoveIfNotDroppable && ShouldBeDropped)
continue; continue;
GuidAndCountsToRemove.push_back({ ItemEntry->GetItemGuid(), ItemEntry->GetCount() }); GuidAndCountsToRemove.push_back({ ItemEntry->GetItemGuid(), ItemEntry->GetCount() });
if (!ShouldBeDropped) if (bRemoveIfNotDroppable && !WorldItemDefinition->CanBeDropped())
continue; continue;
AFortPickup::SpawnPickup(WorldItemDefinition, Location, ItemEntry->GetCount(), EFortPickupSourceTypeFlag::Player, EFortPickupSpawnSource::Unset, AFortPickup::SpawnPickup(WorldItemDefinition, Location, ItemEntry->GetCount(), EFortPickupSourceTypeFlag::Player, EFortPickupSpawnSource::Unset,
@@ -92,33 +91,151 @@ void AFortPlayerController::DropAllItems(const std::vector<UFortItemDefinition*>
WorldInventory->Update(); WorldInventory->Update();
} }
class Wtf void AFortPlayerController::ApplyCosmeticLoadout()
{ {
public: auto PlayerStateAsFort = Cast<AFortPlayerStateAthena>(GetPlayerState());
AFortPlayerController* Controller;
virtual AFortPlayerController* GetController() if (!PlayerStateAsFort)
return;
auto PawnAsFort = Cast<AFortPlayerPawn>(GetMyFortPawn());
if (!PawnAsFort)
return;
static auto UpdatePlayerCustomCharacterPartsVisualizationFn = FindObject<UFunction>("/Script/FortniteGame.FortKismetLibrary.UpdatePlayerCustomCharacterPartsVisualization");
if (!UpdatePlayerCustomCharacterPartsVisualizationFn)
{ {
return Controller; /* if (Addresses::ApplyCharacterCustomization)
{
static void* (*ApplyCharacterCustomizationOriginal)(AFortPlayerState* a1, AFortPawn* a3) = decltype(ApplyCharacterCustomizationOriginal)(Addresses::ApplyCharacterCustomization);
ApplyCharacterCustomizationOriginal(PlayerStateAsFort, PawnAsFort);
return;
} */
auto CosmeticLoadout = this->GetCosmeticLoadout();
if (CosmeticLoadout)
{
/* static auto Pawn_CosmeticLoadoutOffset = PawnAsFort->GetOffset("CosmeticLoadout");
if (Pawn_CosmeticLoadoutOffset != -1)
{
CopyStruct(PawnAsFort->GetPtr<__int64>(Pawn_CosmeticLoadoutOffset), CosmeticLoadout, FFortAthenaLoadout::GetStructSize());
} */
auto Character = CosmeticLoadout->GetCharacter();
// LOG_INFO(LogDev, "Character: {}", __int64(Character));
// LOG_INFO(LogDev, "Character Name: {}", Character ? Character->GetFullName() : "InvalidObject");
if (PawnAsFort)
{
ApplyCID(PawnAsFort, Character, false);
auto Backpack = CosmeticLoadout->GetBackpack();
if (Backpack)
{
static auto CharacterPartsOffset = Backpack->GetOffset("CharacterParts");
if (CharacterPartsOffset != -1)
{
auto& BackpackCharacterParts = Backpack->Get<TArray<UObject*>>(CharacterPartsOffset);
for (int i = 0; i < BackpackCharacterParts.Num(); i++)
{
auto BackpackCharacterPart = BackpackCharacterParts.at(i);
if (!BackpackCharacterPart)
continue;
PawnAsFort->ServerChoosePart(EFortCustomPartType::Backpack, BackpackCharacterPart);
} }
};
// UFortKismetLibrary::ApplyCharacterCosmetics(GetWorld(), BackpackCharacterParts, PlayerStateAsFort, &aa);
}
}
}
}
return;
}
UFortKismetLibrary::StaticClass()->ProcessEvent(UpdatePlayerCustomCharacterPartsVisualizationFn, &PlayerStateAsFort);
}
void AFortPlayerController::ServerRepairBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToRepair)
{
if (!BuildingActorToRepair)
return;
float BuildingHealthPercent = BuildingActorToRepair->GetHealthPercent();
// todo not hardcode these?
float BuildingCost = 10;
float RepairCostMultiplier = 0.75;
float BuildingHealthPercentLost = 1.0 - BuildingHealthPercent;
float RepairCostUnrounded = (BuildingCost * BuildingHealthPercentLost) * RepairCostMultiplier;
float RepairCost = std::floor(RepairCostUnrounded > 0 ? RepairCostUnrounded < 1 ? 1 : RepairCostUnrounded : 0);
if (RepairCost < 0)
return;
auto ResourceItemDefinition = UFortKismetLibrary::K2_GetResourceItemDefinition(BuildingActorToRepair->GetResourceType());
if (!ResourceItemDefinition)
return;
auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory)
return;
if (!PlayerController->DoesBuildFree())
{
auto ResourceInstance = WorldInventory->FindItemInstance(ResourceItemDefinition);
if (!ResourceInstance)
return;
bool bShouldUpdate = false;
if (!WorldInventory->RemoveItem(ResourceInstance->GetItemEntry()->GetItemGuid(), &bShouldUpdate, RepairCost))
return;
if (bShouldUpdate)
WorldInventory->Update();
}
struct
{
AFortPlayerController* RepairingController; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
int ResourcesSpent; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
}ABuildingSMActor_RepairBuilding_Params{ PlayerController, RepairCost };
static auto RepairBuildingFn = FindObject<UFunction>("/Script/FortniteGame.BuildingSMActor.RepairBuilding");
BuildingActorToRepair->ProcessEvent(RepairBuildingFn, &ABuildingSMActor_RepairBuilding_Params);
// PlayerController->FortClientPlaySoundAtLocation(PlayerController->StartRepairSound, BuildingActorToRepair->K2_GetActorLocation(), 0, 0);
}
void AFortPlayerController::ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid) void AFortPlayerController::ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid)
{ {
if (Engine_Version <= 420) auto WorldInventory = PlayerController->GetWorldInventory();
{
static auto OverriddenBackpackSizeOffset = PlayerController->GetOffset("OverriddenBackpackSize");
// LOG_INFO(LogDev, "PlayerController->Get<int>(OverriddenBackpackSizeOffset): {}", PlayerController->Get<int>(OverriddenBackpackSizeOffset));
// PlayerController->Get<int>(OverriddenBackpackSizeOffset) = 5;
// PlayerController->ForceNetUpdate();
}
auto ItemInstance = PlayerController->GetWorldInventory()->FindItemInstance(ItemGuid); if (!WorldInventory)
return;
auto ItemInstance = WorldInventory->FindItemInstance(ItemGuid);
auto Pawn = Cast<AFortPlayerPawn>(PlayerController->GetPawn()); auto Pawn = Cast<AFortPlayerPawn>(PlayerController->GetPawn());
if (!ItemInstance || !Pawn) if (!ItemInstance || !Pawn)
return; return;
FGuid OldGuid = Pawn->GetCurrentWeapon() ? Pawn->GetCurrentWeapon()->GetItemEntryGuid() : FGuid(-1, -1, -1, -1);
UFortItem* OldInstance = OldGuid == FGuid(-1, -1, -1, -1) ? nullptr : WorldInventory->FindItemInstance(OldGuid);
auto ItemDefinition = ItemInstance->GetItemEntry()->GetItemDefinition(); auto ItemDefinition = ItemInstance->GetItemEntry()->GetItemDefinition();
if (!ItemDefinition) if (!ItemDefinition)
@@ -128,9 +245,9 @@ void AFortPlayerController::ServerExecuteInventoryItemHook(AFortPlayerController
static auto FortGadgetItemDefinitionClass = FindObject<UClass>("/Script/FortniteGame.FortGadgetItemDefinition"); static auto FortGadgetItemDefinitionClass = FindObject<UClass>("/Script/FortniteGame.FortGadgetItemDefinition");
UFortGadgetItemDefinition* GadgetItemDefinition = nullptr; UFortGadgetItemDefinition* GadgetItemDefinition = Cast<UFortGadgetItemDefinition>(ItemDefinition);
if (GadgetItemDefinition = Cast<UFortGadgetItemDefinition>(ItemDefinition)) if (GadgetItemDefinition)
{ {
static auto GetWeaponItemDefinition = FindObject<UFunction>("/Script/FortniteGame.FortGadgetItemDefinition.GetWeaponItemDefinition"); static auto GetWeaponItemDefinition = FindObject<UFunction>("/Script/FortniteGame.FortGadgetItemDefinition.GetWeaponItemDefinition");
@@ -144,92 +261,9 @@ void AFortPlayerController::ServerExecuteInventoryItemHook(AFortPlayerController
ItemDefinition->ProcessEvent(GetDecoItemDefinition, &ItemDefinition); ItemDefinition->ProcessEvent(GetDecoItemDefinition, &ItemDefinition);
} }
LOG_INFO(LogDev, "Equipping Gadget: {}", ItemDefinition->GetFullName()); // LOG_INFO(LogDev, "Equipping Gadget: {}", ItemDefinition->GetFullName());
} }
#if 0
if (GadgetItemDefinition)
{
static auto AbilitySetOffset = GadgetItemDefinition->GetOffset("AbilitySet");
auto& AbilitySetSoft = GadgetItemDefinition->Get<TSoftObjectPtr<UFortAbilitySet>>(AbilitySetOffset);
auto StrongAbilitySet = AbilitySetSoft.Get(UFortAbilitySet::StaticClass(), true);
if (StrongAbilitySet)
{
auto PlayerState = (AFortPlayerStateAthena*)PlayerController->GetPlayerState();
StrongAbilitySet->GiveToAbilitySystem(PlayerState->GetAbilitySystemComponent());
}
static auto AttributeSetOffset = GadgetItemDefinition->GetOffset("AttributeSet");
auto& AttributeSetSoft = GadgetItemDefinition->Get<TSoftObjectPtr<UObject>>(AttributeSetOffset);
static auto AttributeClass = FindObject<UClass>("/Script/GameplayAbilities.AttributeSet");
auto StrongAttributeSet = AttributeSetSoft.Get(AttributeClass, true);
AttributeSetSoft.SoftObjectPtr.ObjectID.AssetPathName.ToString();
if (StrongAttributeSet)
{
}
if (GadgetItemDefinition->ShouldDropAllItemsOnEquip())
{
PlayerController->DropAllItems({ GadgetItemDefinition });
}
static auto AnimBPOverrideOffset = GadgetItemDefinition->GetOffset("AnimBPOverride");
UObject* AnimBPOverride = nullptr;
if (Fortnite_Version >= 6)
{
auto& AnimBPOverrideSoft = GadgetItemDefinition->Get<TSoftObjectPtr<UObject>>(AnimBPOverrideOffset);
static auto AnimInstanceClass = FindObject<UClass>("/Script/Engine.AnimInstance");
AnimBPOverride = AnimBPOverrideSoft.Get(AnimInstanceClass, true);
}
else
{
AnimBPOverride = GadgetItemDefinition->Get(AnimBPOverrideOffset);
}
if (AnimBPOverride)
{
static auto Pawn_AnimBPOverrideOffset = Pawn->GetOffset("AnimBPOverride");
Pawn->Get(Pawn_AnimBPOverrideOffset) = AnimBPOverride;
}
static auto FootstepBankOverrideOffset = GadgetItemDefinition->GetOffset("FootstepBankOverride");
UObject* FootstepBankOverride = nullptr;
if (Fortnite_Version >= 6)
{
auto& FootstepBankOverrideSoft = GadgetItemDefinition->Get<TSoftObjectPtr<UObject>>(FootstepBankOverrideOffset);
static auto FortFootstepAudioBankClass = FindObject<UClass>("/Script/FortniteGame.FortFootstepAudioBank");
FootstepBankOverride = FootstepBankOverrideSoft.Get(FortFootstepAudioBankClass, true);
}
else
{
FootstepBankOverride = GadgetItemDefinition->Get(FootstepBankOverrideOffset);
}
if (FootstepBankOverride)
{
static auto Pawn_FootstepBankOverrideOffset = Pawn->GetOffset("FootstepBankOverride");
Pawn->Get(Pawn_FootstepBankOverrideOffset) = FootstepBankOverride;
}
static auto CharacterPartsOffset = GadgetItemDefinition->GetOffset("CharacterParts");
auto& CharacterParts = GadgetItemDefinition->Get<TArray<UObject*>>(CharacterPartsOffset);
for (int i = 0; i < CharacterParts.Num(); i++)
{
Pawn->ServerChoosePart((EFortCustomPartType)i, CharacterParts.at(i));
}
}
#endif
if (auto DecoItemDefinition = Cast<UFortDecoItemDefinition>(ItemDefinition)) if (auto DecoItemDefinition = Cast<UFortDecoItemDefinition>(ItemDefinition))
{ {
Pawn->PickUpActor(nullptr, DecoItemDefinition); // todo check ret value? // I checked on 1.7.2 and it only returns true if the new weapon is a FortDecoTool Pawn->PickUpActor(nullptr, DecoItemDefinition); // todo check ret value? // I checked on 1.7.2 and it only returns true if the new weapon is a FortDecoTool
@@ -301,6 +335,7 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
{ {
// static auto LlamaClass = FindObject<UClass>("/Game/Athena/SupplyDrops/Llama/AthenaSupplyDrop_Llama.AthenaSupplyDrop_Llama_C"); // static auto LlamaClass = FindObject<UClass>("/Game/Athena/SupplyDrops/Llama/AthenaSupplyDrop_Llama.AthenaSupplyDrop_Llama_C");
static auto FortAthenaSupplyDropClass = FindObject<UClass>("/Script/FortniteGame.FortAthenaSupplyDrop"); static auto FortAthenaSupplyDropClass = FindObject<UClass>("/Script/FortniteGame.FortAthenaSupplyDrop");
static auto BuildingItemCollectorActorClass = FindObject<UClass>("/Script/FortniteGame.BuildingItemCollectorActor");
LOG_INFO(LogInteraction, "ServerAttemptInteract!"); LOG_INFO(LogInteraction, "ServerAttemptInteract!");
@@ -372,9 +407,10 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
} }
else if (ReceivingActor->IsA(FortAthenaVehicleClass)) else if (ReceivingActor->IsA(FortAthenaVehicleClass))
{ {
auto Vehicle = ReceivingActor; auto Vehicle = (AFortAthenaVehicle*)ReceivingActor;
ServerAttemptInteractOriginal(Context, Stack, Ret); ServerAttemptInteractOriginal(Context, Stack, Ret);
if (!AreVehicleWeaponsEnabled())
return; return;
auto Pawn = (AFortPlayerPawn*)PlayerController->GetMyFortPawn(); auto Pawn = (AFortPlayerPawn*)PlayerController->GetMyFortPawn();
@@ -382,74 +418,122 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
if (!Pawn) if (!Pawn)
return; return;
static auto FindSeatIndexFn = FindObject<UFunction>("/Script/FortniteGame.FortAthenaVehicle.FindSeatIndex"); auto VehicleWeaponDefinition = Pawn->GetVehicleWeaponDefinition(Vehicle);
static auto GetSeatWeaponComponentFn = FindObject<UFunction>("/Script/FortniteGame.FortAthenaVehicle.GetSeatWeaponComponent");
if (!GetSeatWeaponComponentFn) if (!VehicleWeaponDefinition)
return;
struct { AFortPlayerPawn* PlayerPawn; int ReturnValue; } AFortAthenaVehicle_FindSeatIndex_Params{Pawn};
Vehicle->ProcessEvent(FindSeatIndexFn, &AFortAthenaVehicle_FindSeatIndex_Params);
auto SeatIndex = AFortAthenaVehicle_FindSeatIndex_Params.ReturnValue;
struct { int SeatIndex; UObject* ReturnValue; } AFortAthenaVehicle_GetSeatWeaponComponent_Params{};
Vehicle->ProcessEvent(GetSeatWeaponComponentFn, &AFortAthenaVehicle_GetSeatWeaponComponent_Params);
auto WeaponComponent = AFortAthenaVehicle_GetSeatWeaponComponent_Params.ReturnValue;
if (!WeaponComponent)
return;
static auto WeaponSeatDefinitionStructSize = FindObject<UClass>("/Script/FortniteGame.WeaponSeatDefinition")->GetPropertiesSize();
static auto VehicleWeaponOffset = FindOffsetStruct("/Script/FortniteGame.WeaponSeatDefinition", "VehicleWeapon");
static auto SeatIndexOffset = FindOffsetStruct("/Script/FortniteGame.WeaponSeatDefinition", "SeatIndex");
static auto WeaponSeatDefinitionsOffset = WeaponComponent->GetOffset("WeaponSeatDefinitions");
auto& WeaponSeatDefinitions = WeaponComponent->Get<TArray<__int64>>(WeaponSeatDefinitionsOffset);
for (int i = 0; i < WeaponSeatDefinitions.Num(); i++)
{ {
auto WeaponSeat = WeaponSeatDefinitions.AtPtr(i, WeaponSeatDefinitionStructSize); LOG_INFO(LogDev, "Invlaid VehicleWeaponDefinition!");
return;
}
if (*(int*)(__int64(WeaponSeat) + SeatIndexOffset) != SeatIndex) LOG_INFO(LogDev, "Equipping {}", VehicleWeaponDefinition->GetFullName());
continue;
auto VehicleWeaponDef = *(UFortWeaponItemDefinition**)(__int64(WeaponSeat) + VehicleWeaponOffset);
LOG_INFO(LogDev, "Vehicle eaponb: {}", __int64(VehicleWeaponDef));
if (!VehicleWeaponDef)
continue;
LOG_INFO(LogDev, "Vehicle eaponb name: {}", VehicleWeaponDef->GetFullName());
auto WorldInventory = PlayerController->GetWorldInventory(); auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory) if (!WorldInventory)
continue; return;
{ auto NewAndModifiedInstances = WorldInventory->AddItem(VehicleWeaponDefinition, nullptr);
auto ahh = WorldInventory->AddItem(VehicleWeaponDef, nullptr); auto NewVehicleInstance = NewAndModifiedInstances.first[0];
auto newitem = ahh.first[0]; if (!NewVehicleInstance)
LOG_INFO(LogDev, "newitem: {}", __int64(newitem));
if (!newitem)
return; return;
WorldInventory->Update(); WorldInventory->Update();
Pawn->EquipWeaponDefinition(VehicleWeaponDef, newitem->GetItemEntry()->GetItemGuid()); auto VehicleWeapon = Pawn->EquipWeaponDefinition(VehicleWeaponDefinition, NewVehicleInstance->GetItemEntry()->GetItemGuid());
// PlayerController->ServerExecuteInventoryItemHook(PlayerController, newitem->GetItemEntry()->GetItemGuid()); // PlayerController->ServerExecuteInventoryItemHook(PlayerController, newitem->GetItemEntry()->GetItemGuid());
}
break; /* if (WeaponComponent)
} {
static auto bWeaponEquippedOffset = WeaponComponent->GetOffset("bWeaponEquipped");
WeaponComponent->Get<bool>(bWeaponEquippedOffset) = true;
static auto CachedWeaponOffset = WeaponComponent->GetOffset("CachedWeapon");
WeaponComponent->Get<AFortWeapon*>(CachedWeaponOffset) = VehicleWeapon;
static auto CachedWeaponDefOffset = WeaponComponent->GetOffset("CachedWeaponDef");
WeaponComponent->Get<UFortWeaponItemDefinition*>(CachedWeaponDefOffset) = VehicleWeaponDefinition;
} */
return; return;
} }
else if (ReceivingActor->IsA(BuildingItemCollectorActorClass))
{
auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory)
return ServerAttemptInteractOriginal(Context, Stack, Ret);
auto ItemCollector = ReceivingActor;
static auto ActiveInputItemOffset = ItemCollector->GetOffset("ActiveInputItem");
auto CurrentMaterial = ItemCollector->Get<UFortWorldItemDefinition*>(ActiveInputItemOffset); // InteractType->OptionalObjectData
if (!CurrentMaterial)
return ServerAttemptInteractOriginal(Context, Stack, Ret);
int Index = 0;
// this is a weird way of getting the current item collection we are on.
static auto StoneItemData = FindObject<UFortResourceItemDefinition>("/Game/Items/ResourcePickups/StoneItemData.StoneItemData");
static auto MetalItemData = FindObject<UFortResourceItemDefinition>("/Game/Items/ResourcePickups/MetalItemData.MetalItemData");
if (CurrentMaterial == StoneItemData)
Index = 1;
else if (CurrentMaterial == MetalItemData)
Index = 2;
static auto ItemCollectionsOffset = ItemCollector->GetOffset("ItemCollections");
auto& ItemCollections = ItemCollector->Get<TArray<FCollectorUnitInfo>>(ItemCollectionsOffset);
auto ItemCollection = ItemCollections.AtPtr(Index, FCollectorUnitInfo::GetPropertiesSize());
if (Fortnite_Version < 8.10)
{
auto Cost = ItemCollection->GetInputCount()->GetValue();
if (!CurrentMaterial)
return ServerAttemptInteractOriginal(Context, Stack, Ret);
auto MatInstance = WorldInventory->FindItemInstance(CurrentMaterial);
if (!MatInstance)
return ServerAttemptInteractOriginal(Context, Stack, Ret);
bool bShouldUpdate = false;
if (!WorldInventory->RemoveItem(MatInstance->GetItemEntry()->GetItemGuid(), &bShouldUpdate, Cost, true))
return ServerAttemptInteractOriginal(Context, Stack, Ret);
if (bShouldUpdate)
WorldInventory->Update();
}
for (int z = 0; z < ItemCollection->GetOutputItemEntry()->Num(); z++)
{
auto Entry = ItemCollection->GetOutputItemEntry()->AtPtr(z, FFortItemEntry::GetStructSize());
AFortPickup::SpawnPickup(Entry->GetItemDefinition(), LocationToSpawnLoot, Entry->GetCount(),
EFortPickupSourceTypeFlag::Other, EFortPickupSpawnSource::Unset, Entry->GetLoadedAmmo(), PlayerController->GetMyFortPawn());
}
static auto bCurrentInteractionSuccessOffset = ItemCollector->GetOffset("bCurrentInteractionSuccess", false);
if (bCurrentInteractionSuccessOffset != -1)
{
static auto bCurrentInteractionSuccessFieldMask = GetFieldMask(ItemCollector->GetProperty("bCurrentInteractionSuccess"));
ItemCollector->SetBitfieldValue(bCurrentInteractionSuccessOffset, bCurrentInteractionSuccessFieldMask, true); // idek if this is needed
}
static auto DoVendDeath = FindObject<UFunction>("/Game/Athena/Items/Gameplay/VendingMachine/B_Athena_VendingMachine.B_Athena_VendingMachine_C.DoVendDeath");
if (DoVendDeath)
{
ItemCollector->ProcessEvent(DoVendDeath);
ItemCollector->K2_DestroyActor();
}
}
return ServerAttemptInteractOriginal(Context, Stack, Ret); return ServerAttemptInteractOriginal(Context, Stack, Ret);
} }
@@ -491,12 +575,13 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController*
void AFortPlayerController::ServerDropAllItemsHook(AFortPlayerController* PlayerController, UFortItemDefinition* IgnoreItemDef) void AFortPlayerController::ServerDropAllItemsHook(AFortPlayerController* PlayerController, UFortItemDefinition* IgnoreItemDef)
{ {
LOG_INFO(LogDev, "DropAllItems!");
PlayerController->DropAllItems({ IgnoreItemDef }); PlayerController->DropAllItems({ IgnoreItemDef });
} }
void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFrame* Stack, void* Ret) void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFrame* Stack, void* Ret)
{ {
auto PlayerController = Cast<AFortPlayerController>(Context); auto PlayerController = (AFortPlayerController*)Context;
if (!PlayerController) // ?? if (!PlayerController) // ??
return ServerCreateBuildingActorOriginal(Context, Stack, Ret); return ServerCreateBuildingActorOriginal(Context, Stack, Ret);
@@ -544,6 +629,25 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra
if (!BuildingClass) if (!BuildingClass)
return ServerCreateBuildingActorOriginal(Context, Stack, Ret); return ServerCreateBuildingActorOriginal(Context, Stack, Ret);
auto GameState = Cast<AFortGameStateAthena>(((AFortGameMode*)GetWorld()->GetGameMode())->GetGameState());
auto StructuralSupportSystem = GameState->GetStructuralSupportSystem();
if (StructuralSupportSystem)
{
if (!StructuralSupportSystem->IsWorldLocValid(BuildLocation))
{
return ServerCreateBuildingActorOriginal(Context, Stack, Ret);
}
}
if (!GameState->IsPlayerBuildableClass(BuildingClass))
{
LOG_INFO(LogDev, "Cheater most likely.");
// PlayerController->GetAnticheatComponent().AddAndCheck(Severity::HIGH);
return ServerCreateBuildingActorOriginal(Context, Stack, Ret);
}
TArray<ABuildingSMActor*> ExistingBuildings; TArray<ABuildingSMActor*> ExistingBuildings;
char idk; char idk;
static __int64 (*CantBuild)(UObject*, UObject*, FVector, FRotator, char, TArray<ABuildingSMActor*>*, char*) = decltype(CantBuild)(Addresses::CantBuild); static __int64 (*CantBuild)(UObject*, UObject*, FVector, FRotator, char, TArray<ABuildingSMActor*>*, char*) = decltype(CantBuild)(Addresses::CantBuild);
@@ -603,14 +707,14 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra
WorldInventory->Update(); WorldInventory->Update();
} }
auto GameState = Cast<AFortGameStateAthena>(((AFortGameMode*)GetWorld()->GetGameMode())->GetGameState()); /*
GET_PLAYLIST(GameState); GET_PLAYLIST(GameState);
if (CurrentPlaylist) if (CurrentPlaylist)
{ {
// CurrentPlaylist->ApplyModifiersToActor(BuildingActor); // seems automatic // CurrentPlaylist->ApplyModifiersToActor(BuildingActor); // seems automatic
} } */
return ServerCreateBuildingActorOriginal(Context, Stack, Ret); return ServerCreateBuildingActorOriginal(Context, Stack, Ret);
} }
@@ -697,11 +801,14 @@ void AFortPlayerController::ServerAttemptInventoryDropHook(AFortPlayerController
if (!ItemDefinition || !ItemDefinition->CanBeDropped()) if (!ItemDefinition || !ItemDefinition->CanBeDropped())
return; return;
auto Pickup = AFortPickup::SpawnPickup(ItemDefinition, Pawn->GetActorLocation(), Count, if (!ItemDefinition->ShouldIgnoreRespawningOnDrop())
EFortPickupSourceTypeFlag::Player, EFortPickupSpawnSource::Unset, ReplicatedEntry->GetLoadedAmmo(), Pawn); {
auto Pickup = AFortPickup::SpawnPickup(ReplicatedEntry, Pawn->GetActorLocation(),
EFortPickupSourceTypeFlag::Player, EFortPickupSpawnSource::Unset, Pawn);
if (!Pickup) if (!Pickup)
return; return;
}
bool bShouldUpdate = false; bool bShouldUpdate = false;
@@ -755,6 +862,39 @@ void AFortPlayerController::ServerPlayEmoteItemHook(AFortPlayerController* Playe
if (!AbilityToUse) if (!AbilityToUse)
return; return;
static auto AthenaDanceItemDefinitionClass = FindObject<UClass>("/Script/FortniteGame.AthenaDanceItemDefinition");
if (EmoteAsset->IsA(AthenaDanceItemDefinitionClass))
{
static auto EmoteAsset_bMovingEmoteOffset = EmoteAsset->GetOffset("bMovingEmote", false);
static auto bMovingEmoteOffset = Pawn->GetOffset("bMovingEmote", false);
if (bMovingEmoteOffset != -1 && EmoteAsset_bMovingEmoteOffset != -1)
{
static auto bMovingEmoteFieldMask = GetFieldMask(Pawn->GetProperty("bMovingEmote"));
static auto EmoteAsset_bMovingEmoteFieldMask = GetFieldMask(EmoteAsset->GetProperty("bMovingEmote"));
Pawn->SetBitfieldValue(bMovingEmoteOffset, bMovingEmoteFieldMask, EmoteAsset->ReadBitfieldValue(EmoteAsset_bMovingEmoteOffset, EmoteAsset_bMovingEmoteFieldMask));
}
static auto bMoveForwardOnlyOffset = EmoteAsset->GetOffset("bMoveForwardOnly", false);
static auto bMovingEmoteForwardOnlyOffset = Pawn->GetOffset("bMovingEmoteForwardOnly", false);
if (bMovingEmoteForwardOnlyOffset != -1 && bMoveForwardOnlyOffset != -1)
{
static auto bMovingEmoteForwardOnlyFieldMask = GetFieldMask(Pawn->GetProperty("bMovingEmoteForwardOnly"));
static auto bMoveForwardOnlyFieldMask = GetFieldMask(EmoteAsset->GetProperty("bMoveForwardOnly"));
Pawn->SetBitfieldValue(bMovingEmoteOffset, bMovingEmoteForwardOnlyFieldMask, EmoteAsset->ReadBitfieldValue(bMoveForwardOnlyOffset, bMoveForwardOnlyFieldMask));
}
static auto WalkForwardSpeedOffset = EmoteAsset->GetOffset("WalkForwardSpeed", false);
static auto EmoteWalkSpeedOffset = Pawn->GetOffset("EmoteWalkSpeed", false);
if (EmoteWalkSpeedOffset != -1 && WalkForwardSpeedOffset != -1)
{
Pawn->Get<float>(EmoteWalkSpeedOffset) = EmoteAsset->Get<float>(WalkForwardSpeedOffset);
}
}
int outHandle = 0; int outHandle = 0;
FGameplayAbilitySpec* Spec = MakeNewSpec((UClass*)AbilityToUse, EmoteAsset, true); FGameplayAbilitySpec* Spec = MakeNewSpec((UClass*)AbilityToUse, EmoteAsset, true);
@@ -821,6 +961,29 @@ uint8 ToDeathCause(const FGameplayTagContainer& TagContainer, bool bWasDBNO = fa
return sub_7FF7AB499410(TagContainer, bWasDBNO); return sub_7FF7AB499410(TagContainer, bWasDBNO);
} }
std::vector<APlayerController*> PlayerControllersDead; // make atomic?
// std::array<std::atomic<APlayerController*>, 100> PlayerControllersDead;
std::atomic<int> numValidElements(0);
DWORD WINAPI SpectateThread(LPVOID)
{
while (1)
{
for (auto PC : PlayerControllersDead)
// for (int i = 0; i < PlayerControllersDead.size(); i++)
{
// auto PC = PlayerControllersDead.at(i).load();
static auto SpectateOnDeathFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerControllerZone.SpectateOnDeath") ? FindObject<UFunction>("/Script/FortniteGame.FortPlayerControllerZone.SpectateOnDeath") : FindObject<UFunction>("/Script/FortniteGame.FortPlayerControllerAthena.SpectateOnDeath");
PC->ProcessEvent(SpectateOnDeathFn);
}
Sleep(4000);
}
return 0;
}
void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerController, void* DeathReport) void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerController, void* DeathReport)
{ {
auto GameState = Cast<AFortGameStateAthena>(((AFortGameMode*)GetWorld()->GetGameMode())->GetGameState()); auto GameState = Cast<AFortGameStateAthena>(((AFortGameMode*)GetWorld()->GetGameMode())->GetGameState());
@@ -991,14 +1154,37 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
LOG_INFO(LogDev, "Removed!"); LOG_INFO(LogDev, "Removed!");
if (Fortnite_Version < 6) // Spectating if (Fortnite_Version < 6) // Spectating
{
static auto bAllowSpectateAfterDeathOffset = GameMode->GetOffset("bAllowSpectateAfterDeath");
bool bAllowSpectate = GameMode->Get<bool>(bAllowSpectateAfterDeathOffset);
LOG_INFO(LogDev, "bAllowSpectate: {}", bAllowSpectate);
if (bAllowSpectate)
{ {
LOG_INFO(LogDev, "Starting Spectating!"); LOG_INFO(LogDev, "Starting Spectating!");
static auto PlayerToSpectateOnDeathOffset = PlayerController->GetOffset("PlayerToSpectateOnDeath"); static auto PlayerToSpectateOnDeathOffset = PlayerController->GetOffset("PlayerToSpectateOnDeath");
PlayerController->Get<APawn*>(PlayerToSpectateOnDeathOffset) = KillerPawn; PlayerController->Get<APawn*>(PlayerToSpectateOnDeathOffset) = KillerPawn;
static auto SpectateOnDeathFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerControllerZone.SpectateOnDeath") ? FindObject<UFunction>("/Script/FortniteGame.FortPlayerControllerZone.SpectateOnDeath") : FindObject<UFunction>("/Script/FortniteGame.FortPlayerControllerAthena.SpectateOnDeath"); PlayerControllersDead.push_back(PlayerController);
PlayerController->ProcessEvent(SpectateOnDeathFn);
/* if (numValidElements < PlayerControllersDead.size())
{
PlayerControllersDead[numValidElements].store(PlayerController);
numValidElements.fetch_add(1);
} */
static bool bCreatedThread = false;
if (!bCreatedThread)
{
bCreatedThread = true;
CreateThread(0, 0, SpectateThread, 0, 0, 0);
}
}
} }
} }
} }
@@ -1069,7 +1255,7 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame
int RotationIterations = Fortnite_Version < 8.30 ? *(int*)(__int64(Params) + RotationIterationsOffset) : (int)(*(uint8*)(__int64(Params) + RotationIterationsOffset)); int RotationIterations = Fortnite_Version < 8.30 ? *(int*)(__int64(Params) + RotationIterationsOffset) : (int)(*(uint8*)(__int64(Params) + RotationIterationsOffset));
auto bMirrored = *(char*)(__int64(Params) + bMirroredOffset); auto bMirrored = *(char*)(__int64(Params) + bMirroredOffset);
LOG_INFO(LogDev, "RotationIterations: {}", RotationIterations); // LOG_INFO(LogDev, "RotationIterations: {}", RotationIterations);
if (!BuildingActorToEdit || !NewBuildingClass || BuildingActorToEdit->IsDestroyed() || BuildingActorToEdit->GetEditingPlayer() != PlayerState) if (!BuildingActorToEdit || !NewBuildingClass || BuildingActorToEdit->IsDestroyed() || BuildingActorToEdit->GetEditingPlayer() != PlayerState)
{ {

View File

@@ -81,7 +81,9 @@ public:
bool DoesBuildFree(); bool DoesBuildFree();
void DropAllItems(const std::vector<UFortItemDefinition*>& IgnoreItemDefs, bool bIgnoreSecondaryQuickbar = false, bool bRemoveIfNotDroppable = false); void DropAllItems(const std::vector<UFortItemDefinition*>& IgnoreItemDefs, bool bIgnoreSecondaryQuickbar = false, bool bRemoveIfNotDroppable = false);
void ApplyCosmeticLoadout();
static void ServerRepairBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToRepair);
static void ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid); static void ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid);
static void ServerAttemptInteractHook(UObject* Context, FFrame* Stack, void* Ret); static void ServerAttemptInteractHook(UObject* Context, FFrame* Stack, void* Ret);

View File

@@ -7,6 +7,67 @@
#include "GameplayStatics.h" #include "GameplayStatics.h"
#include "hooking.h" #include "hooking.h"
void AFortPlayerControllerAthena::ServerRequestSeatChangeHook(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex)
{
auto Pawn = Cast<AFortPlayerPawn>(PlayerController->GetPawn());
if (!Pawn)
return ServerRequestSeatChangeOriginal(PlayerController, TargetSeatIndex);
auto Vehicle = Pawn->GetVehicle();
if (!Vehicle)
return ServerRequestSeatChangeOriginal(PlayerController, TargetSeatIndex);
auto OldVehicleWeaponDefinition = Pawn->GetVehicleWeaponDefinition(Vehicle);
LOG_INFO(LogDev, "OldVehicleWeaponDefinition: {}", OldVehicleWeaponDefinition ? OldVehicleWeaponDefinition->GetFullName() : "BadRead");
if (!OldVehicleWeaponDefinition)
return ServerRequestSeatChangeOriginal(PlayerController, TargetSeatIndex);
auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory)
return ServerRequestSeatChangeOriginal(PlayerController, TargetSeatIndex);
auto OldVehicleWeaponInstance = WorldInventory->FindItemInstance(OldVehicleWeaponDefinition);
if (OldVehicleWeaponInstance)
{
bool bShouldUpdate = false;
WorldInventory->RemoveItem(OldVehicleWeaponInstance->GetItemEntry()->GetItemGuid(), &bShouldUpdate, OldVehicleWeaponInstance->GetItemEntry()->GetCount(), true);
if (bShouldUpdate)
WorldInventory->Update();
}
auto RequestingVehicleWeaponDefinition = Vehicle->GetVehicleWeaponForSeat(TargetSeatIndex);
if (!RequestingVehicleWeaponDefinition)
{
auto PickaxeInstance = WorldInventory->GetPickaxeInstance();
if (!PickaxeInstance)
return;
AFortPlayerController::ServerExecuteInventoryItemHook(PlayerController, PickaxeInstance->GetItemEntry()->GetItemGuid()); // Bad, we should equip the last weapon.
return ServerRequestSeatChangeOriginal(PlayerController, TargetSeatIndex);
}
auto NewAndModifiedInstances = WorldInventory->AddItem(RequestingVehicleWeaponDefinition, nullptr);
auto RequestedVehicleInstance = NewAndModifiedInstances.first[0];
if (!RequestedVehicleInstance)
return;
WorldInventory->Update();
auto RequestedVehicleWeapon = Pawn->EquipWeaponDefinition(RequestingVehicleWeaponDefinition, RequestedVehicleInstance->GetItemEntry()->GetItemGuid());
return ServerRequestSeatChangeOriginal(PlayerController, TargetSeatIndex);
}
void AFortPlayerControllerAthena::ServerRestartPlayerHook(AFortPlayerControllerAthena* Controller) void AFortPlayerControllerAthena::ServerRestartPlayerHook(AFortPlayerControllerAthena* Controller)
{ {
static auto FortPlayerControllerZoneDefault = FindObject<UClass>(L"/Script/FortniteGame.Default__FortPlayerControllerZone"); static auto FortPlayerControllerZoneDefault = FindObject<UClass>(L"/Script/FortniteGame.Default__FortPlayerControllerZone");
@@ -85,58 +146,10 @@ void AFortPlayerControllerAthena::ServerAcknowledgePossessionHook(APlayerControl
return; return;
} }
static auto UpdatePlayerCustomCharacterPartsVisualizationFn = FindObject<UFunction>("/Script/FortniteGame.FortKismetLibrary.UpdatePlayerCustomCharacterPartsVisualization"); ControllerAsFort->ApplyCosmeticLoadout();
if (!UpdatePlayerCustomCharacterPartsVisualizationFn)
{
auto CosmeticLoadout = ControllerAsFort->GetCosmeticLoadout();
if (CosmeticLoadout)
{
/* static auto Pawn_CosmeticLoadoutOffset = PawnAsFort->GetOffset("CosmeticLoadout");
if (Pawn_CosmeticLoadoutOffset != -1)
{
CopyStruct(PawnAsFort->GetPtr<__int64>(Pawn_CosmeticLoadoutOffset), CosmeticLoadout, FFortAthenaLoadout::GetStructSize());
} */
ApplyCID(PawnAsFort, CosmeticLoadout->GetCharacter(), false);
auto Backpack = CosmeticLoadout->GetBackpack();
if (Backpack)
{
static auto CharacterPartsOffset = Backpack->GetOffset("CharacterParts");
if (CharacterPartsOffset != -1)
{
auto& BackpackCharacterParts = Backpack->Get<TArray<UObject*>>(CharacterPartsOffset);
for (int i = 0; i < BackpackCharacterParts.Num(); i++)
{
auto BackpackCharacterPart = BackpackCharacterParts.at(i);
if (!BackpackCharacterPart)
continue;
PawnAsFort->ServerChoosePart(EFortCustomPartType::Backpack, BackpackCharacterPart);
}
// UFortKismetLibrary::ApplyCharacterCosmetics(GetWorld(), BackpackCharacterParts, PlayerStateAsFort, &aa);
}
}
}
return;
}
if (!PlayerStateAsFort)
return;
UFortKismetLibrary::StaticClass()->ProcessEvent(UpdatePlayerCustomCharacterPartsVisualizationFn, &PlayerStateAsFort);
} }
void AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessage(AFortPlayerControllerAthena* PlayerController, __int64 ChatEntry, __int64 SenderID) void AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessageHook(AFortPlayerControllerAthena* PlayerController, __int64 ChatEntry, __int64 SenderID)
{ {
using UAthenaEmojiItemDefinition = UFortItemDefinition; using UAthenaEmojiItemDefinition = UFortItemDefinition;
@@ -146,6 +159,13 @@ void AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessage(AFortPlayerCon
void AFortPlayerControllerAthena::GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation) void AFortPlayerControllerAthena::GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation)
{ {
// I don't know why but GetActorEyesViewPoint only works on some versions.
/* static auto GetActorEyesViewPointFn = FindObject<UFunction>(L"/Script/Engine.Actor.GetActorEyesViewPoint");
static auto GetActorEyesViewPointIndex = GetFunctionIdxOrPtr(GetActorEyesViewPointFn) / 8;
void (*GetActorEyesViewPointOriginal)(AActor* Actor, FVector* OutLocation, FRotator* OutRotation) = decltype(GetActorEyesViewPointOriginal)(PlayerController->VFTable[GetActorEyesViewPointIndex]);
return GetActorEyesViewPointOriginal(PlayerController, &Location, &Rotation); */
if (auto MyFortPawn = PlayerController->GetMyFortPawn()) if (auto MyFortPawn = PlayerController->GetMyFortPawn())
{ {
Location = MyFortPawn->GetActorLocation(); Location = MyFortPawn->GetActorLocation();

View File

@@ -77,6 +77,7 @@ class AFortPlayerControllerAthena : public AFortPlayerController
public: public:
static inline void (*GetPlayerViewPointOriginal)(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation); static inline void (*GetPlayerViewPointOriginal)(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation);
static inline void (*ServerReadyToStartMatchOriginal)(AFortPlayerControllerAthena* PlayerController); static inline void (*ServerReadyToStartMatchOriginal)(AFortPlayerControllerAthena* PlayerController);
static inline void (*ServerRequestSeatChangeOriginal)(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex);
AFortPlayerStateAthena* GetPlayerStateAthena() AFortPlayerStateAthena* GetPlayerStateAthena()
{ {
@@ -89,11 +90,12 @@ public:
return Get<UAthenaMarkerComponent*>(MarkerComponentOffset); return Get<UAthenaMarkerComponent*>(MarkerComponentOffset);
} }
static void ServerRequestSeatChangeHook(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex); // actually in zone
static void ServerRestartPlayerHook(AFortPlayerControllerAthena* Controller); static void ServerRestartPlayerHook(AFortPlayerControllerAthena* Controller);
static void ServerGiveCreativeItemHook(AFortPlayerControllerAthena* Controller, FFortItemEntry CreativeItem); static void ServerGiveCreativeItemHook(AFortPlayerControllerAthena* Controller, FFortItemEntry CreativeItem);
static void ServerTeleportToPlaygroundLobbyIslandHook(AFortPlayerControllerAthena* Controller); static void ServerTeleportToPlaygroundLobbyIslandHook(AFortPlayerControllerAthena* Controller);
static void ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn); static void ServerAcknowledgePossessionHook(APlayerController* Controller, APawn* Pawn);
static void ServerPlaySquadQuickChatMessage(AFortPlayerControllerAthena* PlayerController, __int64 ChatEntry, __int64 SenderID); static void ServerPlaySquadQuickChatMessageHook(AFortPlayerControllerAthena* PlayerController, __int64 ChatEntry, __int64 SenderID);
static void GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation); static void GetPlayerViewPointHook(AFortPlayerControllerAthena* PlayerController, FVector& Location, FRotator& Rotation);
static void ServerReadyToStartMatchHook(AFortPlayerControllerAthena* PlayerController); static void ServerReadyToStartMatchHook(AFortPlayerControllerAthena* PlayerController);

View File

@@ -1,5 +1,6 @@
#include "FortPlayerPawn.h" #include "FortPlayerPawn.h"
#include <memcury.h> #include <memcury.h>
#include "FortPlayerController.h"
void AFortPlayerPawn::ServerChoosePart(EFortCustomPartType Part, UObject* ChosenCharacterPart) void AFortPlayerPawn::ServerChoosePart(EFortCustomPartType Part, UObject* ChosenCharacterPart)
{ {
@@ -48,6 +49,88 @@ void AFortPlayerPawn::ForceLaunchPlayerZipline() // Thanks android
ProcessEvent(LaunchCharacterFn, &ACharacter_LaunchCharacter_Params); ProcessEvent(LaunchCharacterFn, &ACharacter_LaunchCharacter_Params);
} }
AActor* AFortPlayerPawn::ServerOnExitVehicle(ETryExitVehicleBehavior ExitForceBehavior)
{
static auto ServerOnExitVehicleFn = FindObject<UFunction>("/Script/FortniteGame.FortPlayerPawn.ServerOnExitVehicle");
struct
{
ETryExitVehicleBehavior ExitForceBehavior; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
AActor* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
} AFortPlayerPawn_ServerOnExitVehicle_Params{ExitForceBehavior};
this->ProcessEvent(ServerOnExitVehicleFn, &AFortPlayerPawn_ServerOnExitVehicle_Params);
return AFortPlayerPawn_ServerOnExitVehicle_Params.ReturnValue;
}
AFortAthenaVehicle* AFortPlayerPawn::GetVehicle() // hm should we call the reflecterd function?
{
static auto VehicleStateLocalOffset = this->GetOffset("VehicleStateLocal");
static auto VehicleOffset = FindOffsetStruct("/Script/FortniteGame.VehiclePawnState", "Vehicle");
return Cast<AFortAthenaVehicle>(*(AActor**)(__int64(this->GetPtr<__int64>(VehicleStateLocalOffset)) + VehicleOffset));
}
UFortWeaponItemDefinition* AFortPlayerPawn::GetVehicleWeaponDefinition(AFortAthenaVehicle* Vehicle)
{
if (!Vehicle)
return nullptr;
static auto FindSeatIndexFn = FindObject<UFunction>("/Script/FortniteGame.FortAthenaVehicle.FindSeatIndex");
/* auto Vehicle = GetVehicle();
if (!Vehicle)
return nullptr; */
struct { AFortPlayerPawn* PlayerPawn; int ReturnValue; } AFortAthenaVehicle_FindSeatIndex_Params{ this };
Vehicle->ProcessEvent(FindSeatIndexFn, &AFortAthenaVehicle_FindSeatIndex_Params);
auto SeatIndex = AFortAthenaVehicle_FindSeatIndex_Params.ReturnValue;
return Vehicle->GetVehicleWeaponForSeat(SeatIndex);
}
void AFortPlayerPawn::UnEquipVehicleWeaponDefinition(UFortWeaponItemDefinition* VehicleWeaponDefinition)
{
if (!VehicleWeaponDefinition)
return;
auto PlayerController = Cast<AFortPlayerController>(GetController());
if (!PlayerController)
return;
auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory)
return;
auto VehicleInstance = WorldInventory->FindItemInstance(VehicleWeaponDefinition);
if (!VehicleInstance)
return;
bool bShouldUpdate = false;
WorldInventory->RemoveItem(VehicleInstance->GetItemEntry()->GetItemGuid(), &bShouldUpdate, VehicleInstance->GetItemEntry()->GetCount(), true);
if (bShouldUpdate)
WorldInventory->Update();
auto PickaxeInstance = WorldInventory->GetPickaxeInstance();
if (!PickaxeInstance)
return;
AFortPlayerController::ServerExecuteInventoryItemHook(PlayerController, PickaxeInstance->GetItemEntry()->GetItemGuid()); // Bad, we should equip the last weapon.
}
AActor* AFortPlayerPawn::ServerOnExitVehicleHook(AFortPlayerPawn* PlayerPawn, ETryExitVehicleBehavior ExitForceBehavior)
{
auto VehicleWeaponDefinition = PlayerPawn->GetVehicleWeaponDefinition(PlayerPawn->GetVehicle());
LOG_INFO(LogDev, "VehicleWeaponDefinition: {}", VehicleWeaponDefinition ? VehicleWeaponDefinition->GetFullName() : "BadRead");
PlayerPawn->UnEquipVehicleWeaponDefinition(VehicleWeaponDefinition);
return ServerOnExitVehicleOriginal(PlayerPawn, ExitForceBehavior);
}
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");
@@ -88,6 +171,8 @@ void AFortPlayerPawn::ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup*
static auto bPickedUpOffset = Pickup->GetOffset("bPickedUp"); static auto bPickedUpOffset = Pickup->GetOffset("bPickedUp");
LOG_INFO(LogDev, "InFlyTime: {}", InFlyTime);
if (Pickup->Get<bool>(bPickedUpOffset)) if (Pickup->Get<bool>(bPickedUpOffset))
{ {
LOG_INFO(LogDev, "Trying to pickup picked up weapon?"); LOG_INFO(LogDev, "Trying to pickup picked up weapon?");
@@ -102,7 +187,7 @@ void AFortPlayerPawn::ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup*
PickupLocationData->GetPickupTarget() = Pawn; PickupLocationData->GetPickupTarget() = Pawn;
PickupLocationData->GetFlyTime() = 0.40f; PickupLocationData->GetFlyTime() = 0.40f;
PickupLocationData->GetItemOwner() = Pawn; PickupLocationData->GetItemOwner() = Pawn;
PickupLocationData->GetStartDirection() = InStartDirection; // PickupLocationData->GetStartDirection() = InStartDirection;
PickupLocationData->GetPickupGuid() = Pawn->GetCurrentWeapon() ? Pawn->GetCurrentWeapon()->GetItemEntryGuid() : FGuid(); PickupLocationData->GetPickupGuid() = Pawn->GetCurrentWeapon() ? Pawn->GetCurrentWeapon()->GetItemEntryGuid() : FGuid();
static auto OnRep_PickupLocationDataFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPickup.OnRep_PickupLocationData"); static auto OnRep_PickupLocationDataFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPickup.OnRep_PickupLocationData");

View File

@@ -2,6 +2,7 @@
#include "FortPawn.h" #include "FortPawn.h"
#include "FortPickup.h" #include "FortPickup.h"
#include "FortAthenaVehicle.h"
struct PadHex100 { char pad[0x100]; }; struct PadHex100 { char pad[0x100]; };
@@ -19,12 +20,28 @@ enum class EFortCustomPartType : uint8_t // todo move
EFortCustomPartType_MAX = 7 EFortCustomPartType_MAX = 7
}; };
enum class ETryExitVehicleBehavior : uint8_t
{
DoNotForce = 0,
ForceOnBlocking = 1,
ForceAlways = 2,
ETryExitVehicleBehavior_MAX = 3
};
class AFortPlayerPawn : public AFortPawn class AFortPlayerPawn : public AFortPawn
{ {
public: public:
static inline AActor* (*ServerOnExitVehicleOriginal)(AFortPlayerPawn* Pawn, ETryExitVehicleBehavior ExitForceBehavior); // actually returns AFortAthenaVehicle
void ServerChoosePart(EFortCustomPartType Part, class UObject* ChosenCharacterPart); void ServerChoosePart(EFortCustomPartType Part, class UObject* ChosenCharacterPart);
void ForceLaunchPlayerZipline(); // Thanks android void ForceLaunchPlayerZipline(); // Thanks android
AActor* ServerOnExitVehicle(ETryExitVehicleBehavior ExitForceBehavior); // actually returns AFortAthenaVehicle
AFortAthenaVehicle* GetVehicle();
UFortWeaponItemDefinition* GetVehicleWeaponDefinition(AFortAthenaVehicle* Vehicle);
void UnEquipVehicleWeaponDefinition(UFortWeaponItemDefinition* VehicleWeaponDefinition);
static AActor* ServerOnExitVehicleHook(AFortPlayerPawn* Pawn, ETryExitVehicleBehavior ExitForceBehavior); // actually returns AFortAthenaVehicle
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 void ServerHandlePickupInfoHook(AFortPlayerPawn* Pawn, AFortPickup* Pickup, __int64 Params); static void ServerHandlePickupInfoHook(AFortPlayerPawn* Pawn, AFortPickup* Pickup, __int64 Params);

View File

@@ -23,6 +23,9 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame*
Stack->StepCompiledIn(&bFromSweep); Stack->StepCompiledIn(&bFromSweep);
Stack->StepCompiledIn(&SweepResult); Stack->StepCompiledIn(&SweepResult);
// LOG_INFO(LogDev, "OtherActor: {}", __int64(OtherActor));
// LOG_INFO(LogDev, "OtherActorName: {}", OtherActor->IsValidLowLevel() ? OtherActor->GetName() : "BadRead")
if (auto Pickup = Cast<AFortPickup>(OtherActor)) if (auto Pickup = Cast<AFortPickup>(OtherActor))
{ {
static auto PawnWhoDroppedPickupOffset = Pickup->GetOffset("PawnWhoDroppedPickup"); static auto PawnWhoDroppedPickupOffset = Pickup->GetOffset("PawnWhoDroppedPickup");
@@ -31,8 +34,26 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame*
{ {
auto ItemDefinition = Pickup->GetPrimaryPickupItemEntry()->GetItemDefinition(); auto ItemDefinition = Pickup->GetPrimaryPickupItemEntry()->GetItemDefinition();
auto PlayerController = Cast<AFortPlayerControllerAthena>(Pawn->GetController(), false); if (!ItemDefinition)
auto& ItemInstances = PlayerController->GetWorldInventory()->GetItemList().GetItemInstances(); {
return;
}
auto PlayerController = Cast<AFortPlayerControllerAthena>(Pawn->GetController());
if (!PlayerController)
{
return;
}
auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory)
{
return;
}
auto& ItemInstances = WorldInventory->GetItemList().GetItemInstances();
bool ItemDefGoingInPrimary = IsPrimaryQuickbar(ItemDefinition); bool ItemDefGoingInPrimary = IsPrimaryQuickbar(ItemDefinition);
int PrimarySlotsFilled = 0; int PrimarySlotsFilled = 0;
@@ -42,8 +63,15 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame*
for (int i = 0; i < ItemInstances.Num(); i++) for (int i = 0; i < ItemInstances.Num(); i++)
{ {
auto ItemInstance = ItemInstances.at(i); auto ItemInstance = ItemInstances.at(i);
if (!ItemInstance)
continue;
auto CurrentItemDefinition = ItemInstance->GetItemEntry()->GetItemDefinition(); auto CurrentItemDefinition = ItemInstance->GetItemEntry()->GetItemDefinition();
if (!CurrentItemDefinition)
continue;
if (ItemDefGoingInPrimary && IsPrimaryQuickbar(CurrentItemDefinition)) if (ItemDefGoingInPrimary && IsPrimaryQuickbar(CurrentItemDefinition))
PrimarySlotsFilled++; PrimarySlotsFilled++;
@@ -61,7 +89,9 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame*
} }
if (bIsInventoryFull) if (bIsInventoryFull)
return OnCapsuleBeginOverlapOriginal(Context, Stack, Ret); {
return;
}
} }
// std::cout << "bCanStack: " << bCanStack << '\n'; // std::cout << "bCanStack: " << bCanStack << '\n';
@@ -72,5 +102,5 @@ void AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook(UObject* Context, FFrame*
} }
} }
return OnCapsuleBeginOverlapOriginal(Context, Stack, Ret); // return OnCapsuleBeginOverlapOriginal(Context, Stack, Ret);
} }

View File

@@ -8,8 +8,6 @@ void AFortWeapon::OnPlayImpactFXHook(AFortWeapon* Weapon, __int64 HitResult, uin
{ {
// grappler // grappler
LOG_INFO(LogDev, "AAA!");
auto Pawn = Cast<AFortPawn>(Weapon->GetOwner()); auto Pawn = Cast<AFortPawn>(Weapon->GetOwner());
if (!Pawn) if (!Pawn)

View File

@@ -0,0 +1,65 @@
#include "FortWeaponRangedMountedCannon.h"
#include "FortAthenaVehicle.h"
#include "FortPlayerPawnAthena.h"
#include "FortAthenaSKPushCannon.h"
#include "FortMountedCannon.h"
bool AFortWeaponRangedMountedCannon::FireActorInCannon(FVector LaunchDir, bool bIsServer)
{
static auto InstigatorOffset = GetOffset("Instigator");
auto Pawn = Cast<AFortPlayerPawn>(this->Get(InstigatorOffset));
LOG_INFO(LogDev, "Pawn: {}", __int64(Pawn));
LOG_INFO(LogDev, "LaunchDir.X: {} LaunchDir.Y: {} LaunchDir.Z: {}", LaunchDir.X, LaunchDir.Y, LaunchDir.Z);
if (!Pawn)
return false;
auto Vehicle = Pawn->GetVehicle();
LOG_INFO(LogDev, "Vehicle: {}", __int64(Vehicle));
if (!Vehicle)
return false;
auto PushCannon = Cast<AFortAthenaSKPushCannon>(Vehicle);
LOG_INFO(LogDev, "PushCannon: {}", __int64(PushCannon));
if (!PushCannon)
{
auto MountedCannon = Cast<AFortMountedCannon>(Vehicle);
LOG_INFO(LogDev, "MountedCannon: {}", __int64(MountedCannon));
if (MountedCannon)
{
if (bIsServer
&& this->HasAuthority()
// theres another Pawn check with their vehicle here, not sure what it is.
)
{
MountedCannon->ShootPawnOut();
}
}
return false;
}
if (!Vehicle->GetPawnAtSeat(1))
return false;
if (bIsServer)
{
if (this->HasAuthority())
PushCannon->ShootPawnOut(LaunchDir);
}
return true;
}
void AFortWeaponRangedMountedCannon::ServerFireActorInCannonHook(AFortWeaponRangedMountedCannon* Cannon, FVector LaunchDir)
{
Cannon->FireActorInCannon(LaunchDir, true);
return;
}

View File

@@ -0,0 +1,10 @@
#pragma once
#include "Actor.h"
class AFortWeaponRangedMountedCannon : public AActor // : public AFortWeaponRangedForVehicle
{
public:
bool FireActorInCannon(FVector LaunchDir, bool bIsServer = true);
static void ServerFireActorInCannonHook(AFortWeaponRangedMountedCannon* Cannon, FVector LaunchDir);
};

View File

@@ -19,6 +19,17 @@ public:
return ReadBitfieldValue(bDropOnDeathOffset, bDropOnDeathFieldMask); return ReadBitfieldValue(bDropOnDeathOffset, bDropOnDeathFieldMask);
} }
bool ShouldIgnoreRespawningOnDrop()
{
static auto bIgnoreRespawningForDroppingAsPickupOffset = GetOffset("bIgnoreRespawningForDroppingAsPickup", false);
if (bIgnoreRespawningForDroppingAsPickupOffset == -1)
return false;
static auto bIgnoreRespawningForDroppingAsPickupFieldMask = GetFieldMask(GetProperty("bIgnoreRespawningForDroppingAsPickup"));
return ReadBitfieldValue(bIgnoreRespawningForDroppingAsPickupOffset, bIgnoreRespawningForDroppingAsPickupFieldMask);
}
bool ShouldPersistWhenFinalStackEmpty() bool ShouldPersistWhenFinalStackEmpty()
{ {
static auto bPersistInInventoryWhenFinalStackEmptyOffset = GetOffset("bPersistInInventoryWhenFinalStackEmpty", false); static auto bPersistInInventoryWhenFinalStackEmptyOffset = GetOffset("bPersistInInventoryWhenFinalStackEmpty", false);
@@ -30,6 +41,17 @@ public:
return ReadBitfieldValue(bPersistInInventoryWhenFinalStackEmptyOffset, bPersistInInventoryWhenFinalStackEmptyFieldMask); return ReadBitfieldValue(bPersistInInventoryWhenFinalStackEmptyOffset, bPersistInInventoryWhenFinalStackEmptyFieldMask);
} }
bool ShouldFocusWhenAdded()
{
static auto bForceFocusWhenAddedOffset = GetOffset("bForceFocusWhenAdded", false);
if (bForceFocusWhenAddedOffset == -1)
return false;
static auto bForceFocusWhenAddedFieldMask = GetFieldMask(GetProperty("bForceFocusWhenAdded"));
return ReadBitfieldValue(bForceFocusWhenAddedOffset, bForceFocusWhenAddedFieldMask);
}
bool ShouldForceFocusWhenAdded() bool ShouldForceFocusWhenAdded()
{ {
static auto bForceFocusWhenAddedOffset = GetOffset("bForceFocusWhenAdded"); static auto bForceFocusWhenAddedOffset = GetOffset("bForceFocusWhenAdded");

View File

@@ -84,7 +84,10 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AControll
if (!WorldInventory->GetPickaxeInstance()) if (!WorldInventory->GetPickaxeInstance())
{ {
auto CosmeticLoadout = NewPlayerAsAthena->GetCosmeticLoadout(); auto CosmeticLoadout = NewPlayerAsAthena->GetCosmeticLoadout();
// LOG_INFO(LogDev, "CosmeticLoadout: {}", __int64(CosmeticLoadout));
auto CosmeticLoadoutPickaxe = CosmeticLoadout ? CosmeticLoadout->GetPickaxe() : nullptr; auto CosmeticLoadoutPickaxe = CosmeticLoadout ? CosmeticLoadout->GetPickaxe() : nullptr;
// LOG_INFO(LogDev, "CosmeticLoadoutPickaxe: {}", __int64(CosmeticLoadoutPickaxe));
// LOG_INFO(LogDev, "CosmeticLoadoutPickaxe Name: {}", CosmeticLoadoutPickaxe ? CosmeticLoadoutPickaxe->GetFullName() : "InvalidObject");
static auto WeaponDefinitionOffset = FindOffsetStruct("/Script/FortniteGame.AthenaPickaxeItemDefinition", "WeaponDefinition"); static auto WeaponDefinitionOffset = FindOffsetStruct("/Script/FortniteGame.AthenaPickaxeItemDefinition", "WeaponDefinition");
auto PickaxeDefinition = CosmeticLoadoutPickaxe ? CosmeticLoadoutPickaxe->Get<UFortItemDefinition*>(WeaponDefinitionOffset) auto PickaxeDefinition = CosmeticLoadoutPickaxe ? CosmeticLoadoutPickaxe->Get<UFortItemDefinition*>(WeaponDefinitionOffset)

View File

@@ -2,6 +2,7 @@
#include "Array.h" #include "Array.h"
#include "Map.h" #include "Map.h"
#include "CurveTable.h"
#include "GameplayAbilitySpec.h" #include "GameplayAbilitySpec.h"
struct FGameplayAbilitySpecHandleAndPredictionKey struct FGameplayAbilitySpecHandleAndPredictionKey
@@ -17,3 +18,18 @@ struct FGameplayAbilitySpecHandleAndPredictionKey
TArray<FKeyDataPair> InUseData; TArray<FKeyDataPair> InUseData;
TArray<TSharedRef<FAbilityReplicatedDataCache>> FreeData; TArray<TSharedRef<FAbilityReplicatedDataCache>> FreeData;
}; */ }; */
struct FScalableFloat // todo check where this actually goes
{
float& GetValue()
{
static auto FloatOffset = FindOffsetStruct("/Script/GameplayAbilities.ScalableFloat", "Value");
return *(float*)(__int64(this) + FloatOffset);
}
FCurveTableRowHandle& GetCurve()
{
static auto CurveOffset = FindOffsetStruct("/Script/GameplayAbilities.ScalableFloat", "Curve");
return *(FCurveTableRowHandle*)(__int64(this) + CurveOffset);
}
};

View File

@@ -32,6 +32,8 @@ public:
return (T)(A + Alpha * (B - A)); return (T)(A + Alpha * (B - A));
} }
static FORCEINLINE float Loge(float Value) { return logf(Value); }
template< class T > template< class T >
static constexpr FORCEINLINE T Max(const T A, const T B) static constexpr FORCEINLINE T Max(const T A, const T B)
{ {

View File

@@ -0,0 +1,15 @@
#pragma once
#include "inc.h"
/**
* A functor which returns whatever is passed to it. Mainly used for generic composition.
*/
struct FIdentityFunctor
{
template <typename T>
FORCEINLINE T&& operator()(T&& Val) const
{
return (T&&)Val;
}
};

View File

@@ -0,0 +1,132 @@
#pragma once
#include "GenericPlatformMath.h"
#include "IdentityFunctor.h"
#include "UnrealTemplate.h"
#include "Invoke.h"
#include "BinaryHeap.h"
namespace AlgoImpl
{
/**
* Implementation of an introspective sort. Starts with quick sort and switches to heap sort when the iteration depth is too big.
* The sort is unstable, meaning that the ordering of equal items is not necessarily preserved.
* This is the internal sorting function used by IntroSort overrides.
*
* @param First pointer to the first element to sort
* @param Num the number of items to sort
* @param Projection The projection to sort by when applied to the element.
* @param Predicate predicate class
*/
template <typename T, typename ProjectionType, typename PredicateType>
void IntroSortInternal(T* First, SIZE_T Num, ProjectionType Projection, PredicateType Predicate)
{
struct FStack
{
T* Min;
T* Max;
uint32 MaxDepth;
};
if (Num < 2)
{
return;
}
FStack RecursionStack[32] = { {First, First + Num - 1, (uint32)(FMath::Loge(Num) * 2.f)} }, Current, Inner;
for (FStack* StackTop = RecursionStack; StackTop >= RecursionStack; --StackTop) //-V625
{
Current = *StackTop;
Loop:
int64 Count = Current.Max - Current.Min + 1;
if (Current.MaxDepth == 0)
{
// We're too deep into quick sort, switch to heap sort
HeapSortInternal(Current.Min, Count, Projection, Predicate);
continue;
}
if (Count <= 8)
{
// Use simple bubble-sort.
while (Current.Max > Current.Min)
{
T* Max, * Item;
for (Max = Current.Min, Item = Current.Min + 1; Item <= Current.Max; Item++)
{
if (Predicate(Invoke(Projection, *Max), Invoke(Projection, *Item)))
{
Max = Item;
}
}
Swap(*Max, *Current.Max--);
}
}
else
{
// Grab middle element so sort doesn't exhibit worst-cast behavior with presorted lists.
Swap(Current.Min[Count / 2], Current.Min[0]);
// Divide list into two halves, one with items <=Current.Min, the other with items >Current.Max.
Inner.Min = Current.Min;
Inner.Max = Current.Max + 1;
for (; ; )
{
while (++Inner.Min <= Current.Max && !Predicate(Invoke(Projection, *Current.Min), Invoke(Projection, *Inner.Min)));
while (--Inner.Max > Current.Min && !Predicate(Invoke(Projection, *Inner.Max), Invoke(Projection, *Current.Min)));
if (Inner.Min > Inner.Max)
{
break;
}
Swap(*Inner.Min, *Inner.Max);
}
Swap(*Current.Min, *Inner.Max);
--Current.MaxDepth;
// Save big half and recurse with small half.
if (Inner.Max - 1 - Current.Min >= Current.Max - Inner.Min)
{
if (Current.Min + 1 < Inner.Max)
{
StackTop->Min = Current.Min;
StackTop->Max = Inner.Max - 1;
StackTop->MaxDepth = Current.MaxDepth;
StackTop++;
}
if (Current.Max > Inner.Min)
{
Current.Min = Inner.Min;
goto Loop;
}
}
else
{
if (Current.Max > Inner.Min)
{
StackTop->Min = Inner.Min;
StackTop->Max = Current.Max;
StackTop->MaxDepth = Current.MaxDepth;
StackTop++;
}
if (Current.Min + 1 < Inner.Max)
{
Current.Max = Inner.Max - 1;
goto Loop;
}
}
}
}
}
}
namespace Algo
{
template <typename RangeType, typename PredicateType>
FORCEINLINE void IntroSort(RangeType& Range, PredicateType Predicate)
{
AlgoImpl::IntroSortInternal(GetData(Range), GetNum(Range), FIdentityFunctor(), MoveTemp(Predicate));
}
}

View File

@@ -0,0 +1,52 @@
#pragma once
#include "inc.h"
#include "Decay.h"
#include "PointerIsConvertibleFromTo.h"
#include "EnableIf.h"
namespace UE4Invoke_Private
{
template <typename BaseType, typename CallableType>
FORCEINLINE auto DereferenceIfNecessary(CallableType&& Callable)
-> typename TEnableIf<TPointerIsConvertibleFromTo<typename TDecay<CallableType>::Type, typename TDecay<BaseType>::Type>::Value, decltype((CallableType&&)Callable)>::Type
{
return (CallableType&&)Callable;
}
template <typename BaseType, typename CallableType>
FORCEINLINE auto DereferenceIfNecessary(CallableType&& Callable)
-> typename TEnableIf<!TPointerIsConvertibleFromTo<typename TDecay<CallableType>::Type, typename TDecay<BaseType>::Type>::Value, decltype(*(CallableType&&)Callable)>::Type
{
return *(CallableType&&)Callable;
}
}
template <typename FuncType, typename... ArgTypes>
FORCEINLINE auto Invoke(FuncType&& Func, ArgTypes&&... Args)
-> decltype(Forward<FuncType>(Func)(Forward<ArgTypes>(Args)...))
{
return Forward<FuncType>(Func)(Forward<ArgTypes>(Args)...);
}
template <typename ReturnType, typename ObjType, typename CallableType>
FORCEINLINE auto Invoke(ReturnType ObjType::* pdm, CallableType&& Callable)
-> decltype(UE4Invoke_Private::DereferenceIfNecessary<ObjType>(Forward<CallableType>(Callable)).*pdm)
{
return UE4Invoke_Private::DereferenceIfNecessary<ObjType>(Forward<CallableType>(Callable)).*pdm;
}
template <typename ReturnType, typename ObjType, typename... PMFArgTypes, typename CallableType, typename... ArgTypes>
FORCEINLINE auto Invoke(ReturnType(ObjType::* PtrMemFun)(PMFArgTypes...), CallableType&& Callable, ArgTypes&&... Args)
-> decltype((UE4Invoke_Private::DereferenceIfNecessary<ObjType>(Forward<CallableType>(Callable)).*PtrMemFun)(Forward<ArgTypes>(Args)...))
{
return (UE4Invoke_Private::DereferenceIfNecessary<ObjType>(Forward<CallableType>(Callable)).*PtrMemFun)(Forward<ArgTypes>(Args)...);
}
template <typename ReturnType, typename ObjType, typename... PMFArgTypes, typename CallableType, typename... ArgTypes>
FORCEINLINE auto Invoke(ReturnType(ObjType::* PtrMemFun)(PMFArgTypes...) const, CallableType&& Callable, ArgTypes&&... Args)
-> decltype((UE4Invoke_Private::DereferenceIfNecessary<ObjType>(Forward<CallableType>(Callable)).*PtrMemFun)(Forward<ArgTypes>(Args)...))
{
return (UE4Invoke_Private::DereferenceIfNecessary<ObjType>(Forward<CallableType>(Callable)).*PtrMemFun)(Forward<ArgTypes>(Args)...);
}

View File

@@ -0,0 +1,27 @@
#pragma once
#include "inc.h"
template <typename T>
struct TIsArithmetic
{
enum { Value = false };
};
template <> struct TIsArithmetic<float> { enum { Value = true }; };
template <> struct TIsArithmetic<double> { enum { Value = true }; };
template <> struct TIsArithmetic<long double> { enum { Value = true }; };
template <> struct TIsArithmetic<uint8> { enum { Value = true }; };
template <> struct TIsArithmetic<uint16> { enum { Value = true }; };
template <> struct TIsArithmetic<uint32> { enum { Value = true }; };
template <> struct TIsArithmetic<uint64> { enum { Value = true }; };
template <> struct TIsArithmetic<char> { enum { Value = true }; };
template <> struct TIsArithmetic<short int> { enum { Value = true }; };
template <> struct TIsArithmetic<int32> { enum { Value = true }; };
template <> struct TIsArithmetic<int64> { enum { Value = true }; };
template <> struct TIsArithmetic<bool> { enum { Value = true }; };
template <> struct TIsArithmetic<wchar_t> { enum { Value = true }; };
template <typename T> struct TIsArithmetic<const T> { enum { Value = TIsArithmetic<T>::Value }; };
template <typename T> struct TIsArithmetic< volatile T> { enum { Value = TIsArithmetic<T>::Value }; };
template <typename T> struct TIsArithmetic<const volatile T> { enum { Value = TIsArithmetic<T>::Value }; };

View File

@@ -0,0 +1,7 @@
#pragma once
template <typename T>
struct TIsEnum
{
enum { Value = __is_enum(T) };
};

View File

@@ -0,0 +1,27 @@
#pragma once
#include "inc.h"
#include "IsPointer.h"
#include "AndOrNot.h"
#include "IsArithmetic.h"
/**
* Traits class which tests if a type is POD.
*/
#if defined(_MSC_VER) && _MSC_VER >= 1900
// __is_pod changed in VS2015, however the results are still correct for all usages I've been able to locate.
#pragma warning(push)
#pragma warning(disable:4647)
#endif // _MSC_VER == 1900
template <typename T>
struct TIsPODType
{
enum { Value = TOrValue<__is_pod(T) || __is_enum(T), TIsArithmetic<T>, TIsPointer<T>>::Value };
};
#if defined(_MSC_VER) && _MSC_VER >= 1900
#pragma warning(pop)
#endif // _MSC_VER >= 1900

View File

@@ -0,0 +1,13 @@
#pragma once
template <typename T>
struct TIsPointer
{
enum { Value = false };
};
template <typename T> struct TIsPointer<T*> { enum { Value = true }; };
template <typename T> struct TIsPointer<const T> { enum { Value = TIsPointer<T>::Value }; };
template <typename T> struct TIsPointer< volatile T> { enum { Value = TIsPointer<T>::Value }; };
template <typename T> struct TIsPointer<const volatile T> { enum { Value = TIsPointer<T>::Value }; };

View File

@@ -0,0 +1,9 @@
#pragma once
#include "inc.h"
template <typename T>
struct TIsTriviallyCopyConstructible
{
enum { Value = __has_trivial_copy(T) };
};

View File

@@ -18,6 +18,22 @@ FText UKismetTextLibrary::Conv_StringToText(const FString& inString)
return UKismetTextLibrary_Conv_StringToText_Params.ReturnValue; return UKismetTextLibrary_Conv_StringToText_Params.ReturnValue;
} }
FString UKismetTextLibrary::Conv_TextToString(FText InText)
{
static auto Conv_TextToStringFn = FindObject<UFunction>("/Script/Engine.KismetTextLibrary.Conv_TextToString");
struct
{
FText InText; // (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic)
FString ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, HasGetValueTypeHash, NativeAccessSpecifierPublic)
} UKismetTextLibrary_Conv_TextToString_Params{InText};
static auto Default__KismetTextLibrary = FindObject<UKismetTextLibrary>("/Script/Engine.Default__KismetTextLibrary");
Default__KismetTextLibrary->ProcessEvent(Conv_TextToStringFn, &UKismetTextLibrary_Conv_TextToString_Params);
return UKismetTextLibrary_Conv_TextToString_Params.ReturnValue;
}
UClass* UKismetTextLibrary::StaticClass() UClass* UKismetTextLibrary::StaticClass()
{ {
static auto Class = FindObject<UClass>("/Script/Engine.KismetTextLibrary"); static auto Class = FindObject<UClass>("/Script/Engine.KismetTextLibrary");

View File

@@ -8,6 +8,7 @@ class UKismetTextLibrary : public UObject
{ {
public: public:
static FText Conv_StringToText(const FString& inString); static FText Conv_StringToText(const FString& inString);
static FString Conv_TextToString(FText InText);
static UClass* StaticClass(); static UClass* StaticClass();
}; };

View File

@@ -124,21 +124,27 @@ public:
} }
return false; return false;
} }
FORCEINLINE ValueType& GetByKey(const KeyType& Key) FORCEINLINE ValueType& GetByKey(const KeyType& Key, bool* wasSuccessful = nullptr)
{ {
for (auto& Pair : *this) for (auto& Pair : *this)
{ {
if (Pair.Key() == Key) if (Pair.Key() == Key)
{ {
if (wasSuccessful)
*wasSuccessful = true;
return Pair.Value(); return Pair.Value();
} }
} }
LOG_INFO(LogDev, "Failed to find Key!!!"); // LOG_INFO(LogDev, "Failed to find Key!!!");
if (wasSuccessful)
*wasSuccessful = false;
} }
FORCEINLINE ValueType& Find(const KeyType& Key) FORCEINLINE ValueType& Find(const KeyType& Key, bool* wasSuccessful = nullptr)
{ {
return GetByKey(Key); return GetByKey(Key, wasSuccessful);
} }
FORCEINLINE ValueType GetByKeyNoRef(const KeyType& Key) FORCEINLINE ValueType GetByKeyNoRef(const KeyType& Key)
{ {

View File

@@ -0,0 +1,25 @@
#pragma once
#include "inc.h"
#include "EnableIf.h"
#include "UnrealTypeTraits.h"
template <typename DestinationElementType, typename SourceElementType, typename SizeType>
FORCEINLINE typename TEnableIf<!TIsBitwiseConstructible<DestinationElementType, SourceElementType>::Value>::Type ConstructItems(void* Dest, const SourceElementType* Source, SizeType Count, int ElementSize = sizeof(SourceElementType))
{
while (Count)
{
new (Dest) DestinationElementType(*Source);
++(DestinationElementType*&)Dest;
++Source;
--Count;
}
}
template <typename DestinationElementType, typename SourceElementType, typename SizeType>
FORCEINLINE typename TEnableIf<TIsBitwiseConstructible<DestinationElementType, SourceElementType>::Value>::Type ConstructItems(void* Dest, const SourceElementType* Source, SizeType Count, int ElementSize = sizeof(SourceElementType))
{
// FMemory::Memcpy(Dest, Source, ElementSize * Count);
memcpy(Dest, Source, ElementSize);
}

View File

@@ -5,6 +5,10 @@
struct FNameEntryId struct FNameEntryId
{ {
uint32 Value; uint32 Value;
FNameEntryId() : Value(0) {}
FNameEntryId(uint32 value) : Value(value) {}
}; };
struct FName struct FName
@@ -15,6 +19,10 @@ struct FName
std::string ToString() const; std::string ToString() const;
std::string ToString(); std::string ToString();
FName() : ComparisonIndex(0), Number(0) {}
FName(uint32 Value) : ComparisonIndex(Value), Number(0) {}
bool IsValid() { return ComparisonIndex.Value > 0; } bool IsValid() { return ComparisonIndex.Value > 0; }
bool operator==(FName other) bool operator==(FName other)

View File

@@ -12,6 +12,8 @@
#include "KismetSystemLibrary.h" #include "KismetSystemLibrary.h"
#include "UnrealMathUtility.h" #include "UnrealMathUtility.h"
#include "FortQuickBars.h" #include "FortQuickBars.h"
#include "Sort.h"
#include "Sorting.h"
void UNetDriver::TickFlushHook(UNetDriver* NetDriver) void UNetDriver::TickFlushHook(UNetDriver* NetDriver)
{ {
@@ -68,7 +70,7 @@ static FNetViewer ConstructNetViewer(UNetConnection* NetConnection)
static auto GetActorEyesViewPointOffset = 0x5B0; static auto GetActorEyesViewPointOffset = 0x5B0;
void (*GetActorEyesViewPointOriginal)(AController*, FVector * a2, FRotator * a3) = decltype(GetActorEyesViewPointOriginal)(ViewingController->VFTable[GetActorEyesViewPointOffset / 8]); void (*GetActorEyesViewPointOriginal)(AController*, FVector * a2, FRotator * a3) = decltype(GetActorEyesViewPointOriginal)(ViewingController->VFTable[GetActorEyesViewPointOffset / 8]);
GetActorEyesViewPointOriginal(ViewingController, &newViewer.ViewLocation, &ViewRotation); GetActorEyesViewPointOriginal(ViewingController, &newViewer.ViewLocation, &ViewRotation);
// AFortPlayerControllerAthena::GetPlayerViewPointHook((AFortPlayerControllerAthena*)ViewingController, newViewer.ViewLocation, ViewRotation);
newViewer.ViewDir = ViewRotation.Vector(); newViewer.ViewDir = ViewRotation.Vector();
} }
@@ -601,8 +603,10 @@ int32 UNetDriver::ServerReplicateActors_PrioritizeActors(UNetConnection* Connect
if (MaxSortedActors > 0) if (MaxSortedActors > 0)
{ {
OutPriorityList = (FActorPriority*)FMemory::Realloc(nullptr, MaxSortedActors * sizeof(FActorPriority), 0); // Alloc<FActorPriority>(MaxSortedActors * sizeof(FActorPriority)); OutPriorityList = Alloc<FActorPriority>(MaxSortedActors * sizeof(FActorPriority));
OutPriorityActors = (FActorPriority**)FMemory::Realloc(nullptr, MaxSortedActors * sizeof(FActorPriority*), 0);// Alloc<FActorPriority*>(MaxSortedActors * sizeof(FActorPriority*)); // (FActorPriority*)FMemory::Realloc(nullptr, MaxSortedActors * sizeof(FActorPriority), 0);
OutPriorityActors = Alloc<FActorPriority*>(MaxSortedActors * sizeof(FActorPriority*));
// (FActorPriority**)FMemory::Realloc(nullptr, MaxSortedActors * sizeof(FActorPriority*), 0);
// check( World == Connection->ViewTarget->GetWorld() ); // check( World == Connection->ViewTarget->GetWorld() );
@@ -687,16 +691,22 @@ int32 UNetDriver::ServerReplicateActors_PrioritizeActors(UNetConnection* Connect
// Add in deleted actors // Add in deleted actors
/*for (auto& CurrentGuid : Connection_DestroyedStartupOrDormantActors) for (auto& CurrentGuid : Connection_DestroyedStartupOrDormantActors)
{ {
FActorDestructionInfo& DInfo = GetDriverDestroyedStartupOrDormantActors(this).Find(CurrentGuid); bool bFound = false;
FActorDestructionInfo& DInfo = GetDriverDestroyedStartupOrDormantActors(this).Find(CurrentGuid, &bFound);
if (!bFound)
continue;
OutPriorityList[FinalSortedCount] = FActorPriority(Connection, &DInfo, ConnectionViewers); OutPriorityList[FinalSortedCount] = FActorPriority(Connection, &DInfo, ConnectionViewers);
OutPriorityActors[FinalSortedCount] = OutPriorityList + FinalSortedCount; OutPriorityActors[FinalSortedCount] = OutPriorityList + FinalSortedCount;
FinalSortedCount++; FinalSortedCount++;
DeletedCount++; DeletedCount++;
} */ }
// Sort(OutPriorityActors, FinalSortedCount, FCompareFActorPriority()); Sort(OutPriorityActors, FinalSortedCount, FCompareFActorPriority());
} }
return FinalSortedCount; return FinalSortedCount;
@@ -725,7 +735,9 @@ int32 UNetDriver::ServerReplicateActors_ProcessPrioritizedActors(UNetConnection*
if (ActorInfo == NULL && PriorityActors[j]->DestructionInfo) if (ActorInfo == NULL && PriorityActors[j]->DestructionInfo)
{ {
// Make sure client has streaming level loaded // Make sure client has streaming level loaded
if (PriorityActors[j]->DestructionInfo->StreamingLevelName.ComparisonIndex.Value != NAME_None && !Connection->GetClientVisibleLevelNames().Contains(PriorityActors[j]->DestructionInfo->StreamingLevelName)) if (PriorityActors[j]->DestructionInfo->StreamingLevelName.ComparisonIndex.Value != NAME_None
&& !Connection->GetClientVisibleLevelNames().Contains(PriorityActors[j]->DestructionInfo->StreamingLevelName)
)
{ {
// This deletion entry is for an actor in a streaming level the connection doesn't have loaded, so skip it // This deletion entry is for an actor in a streaming level the connection doesn't have loaded, so skip it
continue; continue;
@@ -733,7 +745,7 @@ int32 UNetDriver::ServerReplicateActors_ProcessPrioritizedActors(UNetConnection*
auto& Connection_DestroyedStartupOrDormantActors = GetConnectionDestroyedStartupOrDormantActors(Connection); auto& Connection_DestroyedStartupOrDormantActors = GetConnectionDestroyedStartupOrDormantActors(Connection);
bool bFound = false; /* bool bFound = false;
for (auto& aa : Connection_DestroyedStartupOrDormantActors) for (auto& aa : Connection_DestroyedStartupOrDormantActors)
{ {
@@ -747,7 +759,7 @@ int32 UNetDriver::ServerReplicateActors_ProcessPrioritizedActors(UNetConnection*
LOG_INFO(LogDev, "bFound: {}", bFound); LOG_INFO(LogDev, "bFound: {}", bFound);
if (!bFound) if (!bFound)
continue; continue; */
UActorChannel* Channel = (UActorChannel*)CreateChannel(Connection, 2, true, -1); UActorChannel* Channel = (UActorChannel*)CreateChannel(Connection, 2, true, -1);
@@ -779,30 +791,13 @@ int32 UNetDriver::ServerReplicateActors_ProcessPrioritizedActors(UNetConnection*
// bTearOff actors should never be checked // bTearOff actors should never be checked
if (bLevelInitializedForActor) if (bLevelInitializedForActor)
{ {
// if (!Actor->IsTearOff() && (!Channel || GetTime() - Channel->GetRelevantTime() > 1.f)) if (!Actor->IsTearOff() && (!Channel || GetTime() - Channel->GetRelevantTime() > 1.f))
if (!Actor->IsTearOff())
{ {
// Test3(Actor, "Passed first check");
if ((!Channel || GetTime() - Channel->GetRelevantTime() > 1.f))
{
// Test3(Actor, "Passed SECOND check");
if (IsActorRelevantToConnection(Actor, ConnectionViewers)) if (IsActorRelevantToConnection(Actor, ConnectionViewers))
{ {
// Test3(Actor, "Passed THIRD check");
bIsRelevant = true; bIsRelevant = true;
} }
} }
else
{
// Test3(Actor, "FAiled second check");
}
}
else
{
// Test3(Actor, "Failed first check");
}
} }
// if the actor is now relevant or was recently relevant // if the actor is now relevant or was recently relevant

View File

@@ -5,10 +5,100 @@
class FNetworkGUID class FNetworkGUID
{ {
public: public:
uint32 Value; uint32 Value;
public:
FNetworkGUID()
: Value(0)
{ }
FNetworkGUID(uint32 V)
: Value(V)
{ }
public:
friend bool operator==(const FNetworkGUID& X, const FNetworkGUID& Y) friend bool operator==(const FNetworkGUID& X, const FNetworkGUID& Y)
{ {
return (X.Value == Y.Value); return (X.Value == Y.Value);
} }
friend bool operator!=(const FNetworkGUID& X, const FNetworkGUID& Y)
{
return (X.Value != Y.Value);
}
/* friend FArchive& operator<<(FArchive& Ar, FNetworkGUID& G)
{
Ar.SerializeIntPacked(G.Value);
return Ar;
} */
public:
void BuildFromNetIndex(int32 StaticNetIndex)
{
Value = (StaticNetIndex << 1 | 1);
}
int32 ExtractNetIndex()
{
if (Value & 1)
{
return Value >> 1;
}
return 0;
}
friend uint32 GetTypeHash(const FNetworkGUID& Guid)
{
return Guid.Value;
}
bool IsDynamic() const
{
return Value > 0 && !(Value & 1);
}
bool IsStatic() const
{
return Value & 1;
}
bool IsValid() const
{
return Value > 0;
}
// CORE_API bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess);
/** A Valid but unassigned NetGUID */
bool IsDefault() const
{
return (Value == 1);
}
/* CORE_API*/ static FNetworkGUID GetDefault()
{
return FNetworkGUID(1);
}
void Reset()
{
Value = 0;
}
/* FString ToString() const
{
return FString::Printf(TEXT("%d"), Value);
} */
public:
/* CORE_API */ static FNetworkGUID Make(int32 seed, bool bIsStatic)
{
return FNetworkGUID(seed << 1 | (bIsStatic ? 1 : 0));
}
}; };

View File

@@ -0,0 +1,288 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "inc.h"
/* Numeric constants
*****************************************************************************/
#define MIN_uint8 ((uint8) 0x00)
#define MIN_uint16 ((uint16) 0x0000)
#define MIN_uint32 ((uint32) 0x00000000)
#define MIN_uint64 ((uint64) 0x0000000000000000)
#define MIN_int8 ((int8) -128)
#define MIN_int16 ((int16) -32768)
#define MIN_int32 ((int32) 0x80000000)
#define MIN_int64 ((int64) 0x8000000000000000)
#define MAX_uint8 ((uint8) 0xff)
#define MAX_uint16 ((uint16) 0xffff)
#define MAX_uint32 ((uint32) 0xffffffff)
#define MAX_uint64 ((uint64) 0xffffffffffffffff)
#define MAX_int8 ((int8) 0x7f)
#define MAX_int16 ((int16) 0x7fff)
#define MAX_int32 ((int32) 0x7fffffff)
#define MAX_int64 ((int64) 0x7fffffffffffffff)
#define MIN_flt (1.175494351e-38F) /* min positive value */
#define MAX_flt (3.402823466e+38F)
#define MIN_dbl (2.2250738585072014e-308) /* min positive value */
#define MAX_dbl (1.7976931348623158e+308)
/* Numeric type traits
*****************************************************************************/
/**
* Helper class to map a numeric type to its limits
*/
template <typename NumericType>
struct TNumericLimits;
/**
* Numeric limits for const types
*/
template <typename NumericType>
struct TNumericLimits<const NumericType>
: public TNumericLimits<NumericType>
{ };
/**
* Numeric limits for volatile types
*/
template <typename NumericType>
struct TNumericLimits<volatile NumericType>
: public TNumericLimits<NumericType>
{ };
/**
* Numeric limits for const volatile types
*/
template <typename NumericType>
struct TNumericLimits<const volatile NumericType>
: public TNumericLimits<NumericType>
{ };
template<>
struct TNumericLimits<uint8>
{
typedef uint8 NumericType;
static constexpr NumericType Min()
{
return MIN_uint8;
}
static constexpr NumericType Max()
{
return MAX_uint8;
}
static constexpr NumericType Lowest()
{
return Min();
}
};
template<>
struct TNumericLimits<uint16>
{
typedef uint16 NumericType;
static constexpr NumericType Min()
{
return MIN_uint16;
}
static constexpr NumericType Max()
{
return MAX_uint16;
}
static constexpr NumericType Lowest()
{
return Min();
}
};
template<>
struct TNumericLimits<uint32>
{
typedef uint32 NumericType;
static constexpr NumericType Min()
{
return MIN_uint32;
}
static constexpr NumericType Max()
{
return MAX_uint32;
}
static constexpr NumericType Lowest()
{
return Min();
}
};
template<>
struct TNumericLimits<uint64>
{
typedef uint64 NumericType;
static constexpr NumericType Min()
{
return MIN_uint64;
}
static constexpr NumericType Max()
{
return MAX_uint64;
}
static constexpr NumericType Lowest()
{
return Min();
}
};
template<>
struct TNumericLimits<int8>
{
typedef int8 NumericType;
static constexpr NumericType Min()
{
return MIN_int8;
}
static constexpr NumericType Max()
{
return MAX_int8;
}
static constexpr NumericType Lowest()
{
return Min();
}
};
template<>
struct TNumericLimits<int16>
{
typedef int16 NumericType;
static constexpr NumericType Min()
{
return MIN_int16;
}
static constexpr NumericType Max()
{
return MAX_int16;
}
static constexpr NumericType Lowest()
{
return Min();
}
};
template<>
struct TNumericLimits<int32>
{
typedef int32 NumericType;
static constexpr NumericType Min()
{
return MIN_int32;
}
static constexpr NumericType Max()
{
return MAX_int32;
}
static constexpr NumericType Lowest()
{
return Min();
}
};
template<>
struct TNumericLimits<int64>
{
typedef int64 NumericType;
static constexpr NumericType Min()
{
return MIN_int64;
}
static constexpr NumericType Max()
{
return MAX_int64;
}
static constexpr NumericType Lowest()
{
return Min();
}
};
template<>
struct TNumericLimits<float>
{
typedef float NumericType;
static constexpr NumericType Min()
{
return MIN_flt;
}
static constexpr NumericType Max()
{
return MAX_flt;
}
static constexpr NumericType Lowest()
{
return -Max();
}
};
template<>
struct TNumericLimits<double>
{
typedef double NumericType;
static constexpr NumericType Min()
{
return MIN_dbl;
}
static constexpr NumericType Max()
{
return MAX_dbl;
}
static constexpr NumericType Lowest()
{
return -Max();
}
};

View File

@@ -114,6 +114,12 @@ int UObject::GetOffset(const std::string& ChildName, bool bWarnIfNotFound) const
return *(int*)(__int64(Property) + Offsets::Offset_Internal); return *(int*)(__int64(Property) + Offsets::Offset_Internal);
} }
void* UObject::GetInterfaceAddress(UClass* InterfaceClass)
{
static void* (*GetInterfaceAddressOriginal)(UObject* a1, UClass* a2) = decltype(GetInterfaceAddressOriginal)(Addresses::GetInterfaceAddress);
return GetInterfaceAddressOriginal(this, InterfaceClass);
}
bool UObject::ReadBitfieldValue(int Offset, uint8_t FieldMask) bool UObject::ReadBitfieldValue(int Offset, uint8_t FieldMask)
{ {
return ReadBitfield(this->GetPtr<PlaceholderBitfield>(Offset), FieldMask); return ReadBitfield(this->GetPtr<PlaceholderBitfield>(Offset), FieldMask);
@@ -124,6 +130,11 @@ void UObject::SetBitfieldValue(int Offset, uint8_t FieldMask, bool NewValue)
SetBitfield(this->GetPtr<PlaceholderBitfield>(Offset), FieldMask, NewValue); SetBitfield(this->GetPtr<PlaceholderBitfield>(Offset), FieldMask, NewValue);
} }
std::string UObject::GetPathName()
{
return UKismetSystemLibrary::GetPathName(this).ToString();
}
std::string UObject::GetFullName() std::string UObject::GetFullName()
{ {
return ClassPrivate ? ClassPrivate->GetName() + " " + UKismetSystemLibrary::GetPathName(this).ToString() : "NoClassPrivate"; return ClassPrivate ? ClassPrivate->GetName() + " " + UKismetSystemLibrary::GetPathName(this).ToString() : "NoClassPrivate";

View File

@@ -19,6 +19,11 @@ struct FGuid
{ {
return A == other.A && B == other.B && C == other.C && D == other.D; return A == other.A && B == other.B && C == other.C && D == other.D;
} }
bool operator!=(const FGuid& other)
{
return !(*this == other);
}
}; };
class UObject class UObject
@@ -46,6 +51,7 @@ public:
} }
std::string GetName() { return NamePrivate.ToString(); } std::string GetName() { return NamePrivate.ToString(); }
std::string GetPathName();
std::string GetFullName(); std::string GetFullName();
bool IsA(UClass* Other); bool IsA(UClass* Other);
@@ -58,6 +64,8 @@ public:
template <typename T = UObject*> template <typename T = UObject*>
T& Get(int Offset) const { return *(T*)(__int64(this) + Offset); } T& Get(int Offset) const { return *(T*)(__int64(this) + Offset); }
void* GetInterfaceAddress(UClass* InterfaceClass);
bool ReadBitfieldValue(int Offset, uint8_t FieldMask); bool ReadBitfieldValue(int Offset, uint8_t FieldMask);
bool ReadBitfieldValue(const std::string& ChildName, uint8_t FieldMask) { return ReadBitfieldValue(GetOffset(ChildName), FieldMask); } bool ReadBitfieldValue(const std::string& ChildName, uint8_t FieldMask) { return ReadBitfieldValue(GetOffset(ChildName), FieldMask); }

View File

@@ -1,3 +1,5 @@
#pragma once
class FOutputDevice class FOutputDevice
{ {
public: public:

View File

@@ -0,0 +1,13 @@
#pragma once
template <typename From, typename To>
struct TPointerIsConvertibleFromTo
{
private:
// static uint8 Test(...);
// static uint16 Test(To*);
public:
enum { Value = sizeof(Test((From*)nullptr)) - 1 };
};

View File

@@ -133,7 +133,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>../vendor</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>../vendor</AdditionalLibraryDirectories>
<AdditionalDependencies>Onecore.lib;MinHook/minhook.x64.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>Oleaut32.lib;Onecore.lib;MinHook/minhook.x64.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -160,10 +160,18 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>../vendor</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>../vendor</AdditionalLibraryDirectories>
<AdditionalDependencies>Onecore.lib;MinHook/minhook.x64.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>Oleaut32.lib;Onecore.lib;MinHook/minhook.x64.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\vendor\ImGui\imgui.cpp" />
<ClCompile Include="..\vendor\ImGui\imgui_demo.cpp" />
<ClCompile Include="..\vendor\ImGui\imgui_draw.cpp" />
<ClCompile Include="..\vendor\ImGui\imgui_impl_dx9.cpp" />
<ClCompile Include="..\vendor\ImGui\imgui_impl_win32.cpp" />
<ClCompile Include="..\vendor\ImGui\imgui_stdlib.cpp" />
<ClCompile Include="..\vendor\ImGui\imgui_tables.cpp" />
<ClCompile Include="..\vendor\ImGui\imgui_widgets.cpp" />
<ClCompile Include="AbilitySystemComponent_Abilities.cpp" /> <ClCompile Include="AbilitySystemComponent_Abilities.cpp" />
<ClCompile Include="Actor.cpp" /> <ClCompile Include="Actor.cpp" />
<ClCompile Include="ActorComponent.cpp" /> <ClCompile Include="ActorComponent.cpp" />
@@ -171,6 +179,7 @@
<ClCompile Include="AthenaMarkerComponent.cpp" /> <ClCompile Include="AthenaMarkerComponent.cpp" />
<ClCompile Include="BuildingActor.cpp" /> <ClCompile Include="BuildingActor.cpp" />
<ClCompile Include="BuildingSMActor.cpp" /> <ClCompile Include="BuildingSMActor.cpp" />
<ClCompile Include="BuildingStructuralSupportSystem.cpp" />
<ClCompile Include="BuildingTrap.cpp" /> <ClCompile Include="BuildingTrap.cpp" />
<ClCompile Include="BuildingWeapons.cpp" /> <ClCompile Include="BuildingWeapons.cpp" />
<ClCompile Include="Class.cpp" /> <ClCompile Include="Class.cpp" />
@@ -182,7 +191,9 @@
<ClCompile Include="events.cpp" /> <ClCompile Include="events.cpp" />
<ClCompile Include="FortAthenaCreativePortal.cpp" /> <ClCompile Include="FortAthenaCreativePortal.cpp" />
<ClCompile Include="FortAthenaSupplyDrop.cpp" /> <ClCompile Include="FortAthenaSupplyDrop.cpp" />
<ClCompile Include="FortAthenaVehicle.cpp" />
<ClCompile Include="FortDecoItemDefinition.cpp" /> <ClCompile Include="FortDecoItemDefinition.cpp" />
<ClCompile Include="FortGadgetItemDefinition.cpp" />
<ClCompile Include="FortGameMode.cpp" /> <ClCompile Include="FortGameMode.cpp" />
<ClCompile Include="FortGameModeAthena.cpp" /> <ClCompile Include="FortGameModeAthena.cpp" />
<ClCompile Include="FortGameModeZone.cpp" /> <ClCompile Include="FortGameModeZone.cpp" />
@@ -196,6 +207,7 @@
<ClCompile Include="FortKismetLibrary.cpp" /> <ClCompile Include="FortKismetLibrary.cpp" />
<ClCompile Include="FortLootPackage.cpp" /> <ClCompile Include="FortLootPackage.cpp" />
<ClCompile Include="FortMinigame.cpp" /> <ClCompile Include="FortMinigame.cpp" />
<ClCompile Include="FortOctopusVehicle.cpp" />
<ClCompile Include="FortPawn.cpp" /> <ClCompile Include="FortPawn.cpp" />
<ClCompile Include="FortPickup.cpp" /> <ClCompile Include="FortPickup.cpp" />
<ClCompile Include="FortPlayerController.cpp" /> <ClCompile Include="FortPlayerController.cpp" />
@@ -206,6 +218,7 @@
<ClCompile Include="FortPlaysetItemDefinition.cpp" /> <ClCompile Include="FortPlaysetItemDefinition.cpp" />
<ClCompile Include="FortWeapon.cpp" /> <ClCompile Include="FortWeapon.cpp" />
<ClCompile Include="FortWeaponItemDefinition.cpp" /> <ClCompile Include="FortWeaponItemDefinition.cpp" />
<ClCompile Include="FortWeaponRangedMountedCannon.cpp" />
<ClCompile Include="GameMode.cpp" /> <ClCompile Include="GameMode.cpp" />
<ClCompile Include="GameModeBase.cpp" /> <ClCompile Include="GameModeBase.cpp" />
<ClCompile Include="GameplayStatics.cpp" /> <ClCompile Include="GameplayStatics.cpp" />
@@ -235,18 +248,23 @@
<ClInclude Include="ActorComponent.h" /> <ClInclude Include="ActorComponent.h" />
<ClInclude Include="addresses.h" /> <ClInclude Include="addresses.h" />
<ClInclude Include="ai.h" /> <ClInclude Include="ai.h" />
<ClInclude Include="AndOrNot.h" />
<ClInclude Include="anticheat.h" />
<ClInclude Include="Array.h" /> <ClInclude Include="Array.h" />
<ClInclude Include="AssertionMacros.h" />
<ClInclude Include="AssetPtr.h" /> <ClInclude Include="AssetPtr.h" />
<ClInclude Include="AthenaMarkerComponent.h" /> <ClInclude Include="AthenaMarkerComponent.h" />
<ClInclude Include="AttributeSet.h" />
<ClInclude Include="BGA.h" /> <ClInclude Include="BGA.h" />
<ClInclude Include="BinaryHeap.h" />
<ClInclude Include="BitArray.h" /> <ClInclude Include="BitArray.h" />
<ClInclude Include="BuildingActor.h" /> <ClInclude Include="BuildingActor.h" />
<ClInclude Include="BuildingContainer.h" /> <ClInclude Include="BuildingContainer.h" />
<ClInclude Include="BuildingGameplayActor.h" /> <ClInclude Include="BuildingGameplayActor.h" />
<ClInclude Include="BuildingGameplayActorSpawnMachine.h" /> <ClInclude Include="BuildingGameplayActorSpawnMachine.h" />
<ClInclude Include="BuildingSMActor.h" /> <ClInclude Include="BuildingSMActor.h" />
<ClInclude Include="BuildingStructuralSupportSystem.h" />
<ClInclude Include="BuildingTrap.h" /> <ClInclude Include="BuildingTrap.h" />
<ClInclude Include="calendar.h" />
<ClInclude Include="Channel.h" /> <ClInclude Include="Channel.h" />
<ClInclude Include="Class.h" /> <ClInclude Include="Class.h" />
<ClInclude Include="commands.h" /> <ClInclude Include="commands.h" />
@@ -255,16 +273,20 @@
<ClInclude Include="CurveTable.h" /> <ClInclude Include="CurveTable.h" />
<ClInclude Include="DataTable.h" /> <ClInclude Include="DataTable.h" />
<ClInclude Include="DataTableFunctionLibrary.h" /> <ClInclude Include="DataTableFunctionLibrary.h" />
<ClInclude Include="Decay.h" />
<ClInclude Include="Delegate.h" /> <ClInclude Include="Delegate.h" />
<ClInclude Include="DelegateBase.h" /> <ClInclude Include="DelegateBase.h" />
<ClInclude Include="die.h" /> <ClInclude Include="die.h" />
<ClInclude Include="EnableIf.h" />
<ClInclude Include="Engine.h" /> <ClInclude Include="Engine.h" />
<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="FortAbilitySet.h" /> <ClInclude Include="FortAbilitySet.h" />
<ClInclude Include="FortAthenaCreativePortal.h" /> <ClInclude Include="FortAthenaCreativePortal.h" />
<ClInclude Include="FortAthenaSKPushCannon.h" />
<ClInclude Include="FortAthenaSupplyDrop.h" /> <ClInclude Include="FortAthenaSupplyDrop.h" />
<ClInclude Include="FortAthenaVehicle.h" />
<ClInclude Include="FortDecoItemDefinition.h" /> <ClInclude Include="FortDecoItemDefinition.h" />
<ClInclude Include="FortGadgetItemDefinition.h" /> <ClInclude Include="FortGadgetItemDefinition.h" />
<ClInclude Include="FortGameMode.h" /> <ClInclude Include="FortGameMode.h" />
@@ -279,6 +301,8 @@
<ClInclude Include="FortKismetLibrary.h" /> <ClInclude Include="FortKismetLibrary.h" />
<ClInclude Include="FortLootPackage.h" /> <ClInclude Include="FortLootPackage.h" />
<ClInclude Include="FortMinigame.h" /> <ClInclude Include="FortMinigame.h" />
<ClInclude Include="FortMountedCannon.h" />
<ClInclude Include="FortOctopusVehicle.h" />
<ClInclude Include="FortPawn.h" /> <ClInclude Include="FortPawn.h" />
<ClInclude Include="FortPickup.h" /> <ClInclude Include="FortPickup.h" />
<ClInclude Include="FortPlayerController.h" /> <ClInclude Include="FortPlayerController.h" />
@@ -296,6 +320,7 @@
<ClInclude Include="FortWeaponItemDefinition.h" /> <ClInclude Include="FortWeaponItemDefinition.h" />
<ClInclude Include="BuildingWeapons.h" /> <ClInclude Include="BuildingWeapons.h" />
<ClInclude Include="FortWeaponMeleeItemDefinition.h" /> <ClInclude Include="FortWeaponMeleeItemDefinition.h" />
<ClInclude Include="FortWeaponRangedMountedCannon.h" />
<ClInclude Include="FortWorldItemDefinition.h" /> <ClInclude Include="FortWorldItemDefinition.h" />
<ClInclude Include="GameMode.h" /> <ClInclude Include="GameMode.h" />
<ClInclude Include="GameModeBase.h" /> <ClInclude Include="GameModeBase.h" />
@@ -308,9 +333,18 @@
<ClInclude Include="GenericPlatformMath.h" /> <ClInclude Include="GenericPlatformMath.h" />
<ClInclude Include="GenericPlatformTime.h" /> <ClInclude Include="GenericPlatformTime.h" />
<ClInclude Include="globals.h" /> <ClInclude Include="globals.h" />
<ClInclude Include="gui.h" />
<ClInclude Include="hooking.h" /> <ClInclude Include="hooking.h" />
<ClInclude Include="IdentityFunctor.h" />
<ClInclude Include="inc.h" /> <ClInclude Include="inc.h" />
<ClInclude Include="IntroSort.h" />
<ClInclude Include="InventoryManagementLibrary.h" /> <ClInclude Include="InventoryManagementLibrary.h" />
<ClInclude Include="Invoke.h" />
<ClInclude Include="IsArithmetic.h" />
<ClInclude Include="IsEnum.h" />
<ClInclude Include="IsPODType.h" />
<ClInclude Include="IsPointer.h" />
<ClInclude Include="IsTriviallyCopyConstructible.h" />
<ClInclude Include="KismetMathLibrary.h" /> <ClInclude Include="KismetMathLibrary.h" />
<ClInclude Include="KismetStringLibrary.h" /> <ClInclude Include="KismetStringLibrary.h" />
<ClInclude Include="KismetSystemLibrary.h" /> <ClInclude Include="KismetSystemLibrary.h" />
@@ -319,10 +353,12 @@
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />
<ClInclude Include="Map.h" /> <ClInclude Include="Map.h" />
<ClInclude Include="MegaStormManager.h" /> <ClInclude Include="MegaStormManager.h" />
<ClInclude Include="MemoryOps.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" />
<ClInclude Include="NetworkGuid.h" /> <ClInclude Include="NetworkGuid.h" />
<ClInclude Include="NumericLimits.h" />
<ClInclude Include="Object.h" /> <ClInclude Include="Object.h" />
<ClInclude Include="ObjectMacros.h" /> <ClInclude Include="ObjectMacros.h" />
<ClInclude Include="OnlineReplStructs.h" /> <ClInclude Include="OnlineReplStructs.h" />
@@ -332,9 +368,13 @@
<ClInclude Include="Player.h" /> <ClInclude Include="Player.h" />
<ClInclude Include="PlayerController.h" /> <ClInclude Include="PlayerController.h" />
<ClInclude Include="PlayerState.h" /> <ClInclude Include="PlayerState.h" />
<ClInclude Include="PointerIsConvertibleFromTo.h" />
<ClInclude Include="Quat.h" /> <ClInclude Include="Quat.h" />
<ClInclude Include="RandomStream.h" /> <ClInclude Include="RandomStream.h" />
<ClInclude Include="reboot.h" /> <ClInclude Include="reboot.h" />
<ClInclude Include="RemoveCV.h" />
<ClInclude Include="RemoveReference.h" />
<ClInclude Include="ReversePredicate.h" />
<ClInclude Include="Rotator.h" /> <ClInclude Include="Rotator.h" />
<ClInclude Include="ScriptInterface.h" /> <ClInclude Include="ScriptInterface.h" />
<ClInclude Include="Set.h" /> <ClInclude Include="Set.h" />
@@ -342,14 +382,19 @@
<ClInclude Include="SharedPointerInternals.h" /> <ClInclude Include="SharedPointerInternals.h" />
<ClInclude Include="SoftObjectPath.h" /> <ClInclude Include="SoftObjectPath.h" />
<ClInclude Include="SoftObjectPtr.h" /> <ClInclude Include="SoftObjectPtr.h" />
<ClInclude Include="Sort.h" />
<ClInclude Include="Sorting.h" />
<ClInclude Include="SparseArray.h" /> <ClInclude Include="SparseArray.h" />
<ClInclude Include="Stack.h" /> <ClInclude Include="Stack.h" />
<ClInclude Include="StringAssetReference.h" /> <ClInclude Include="StringAssetReference.h" />
<ClInclude Include="Text.h" /> <ClInclude Include="Text.h" />
<ClInclude Include="Transform.h" /> <ClInclude Include="Transform.h" />
<ClInclude Include="Tuple.h" /> <ClInclude Include="Tuple.h" />
<ClInclude Include="TypeCompatibleBytes.h" />
<ClInclude Include="UnrealMathUtility.h" /> <ClInclude Include="UnrealMathUtility.h" />
<ClInclude Include="UnrealString.h" /> <ClInclude Include="UnrealString.h" />
<ClInclude Include="UnrealTemplate.h" />
<ClInclude Include="UnrealTypeTraits.h" />
<ClInclude Include="UObjectArray.h" /> <ClInclude Include="UObjectArray.h" />
<ClInclude Include="UObjectGlobals.h" /> <ClInclude Include="UObjectGlobals.h" />
<ClInclude Include="Vector.h" /> <ClInclude Include="Vector.h" />

View File

@@ -188,6 +188,45 @@
<ClCompile Include="KismetTextLibrary.cpp"> <ClCompile Include="KismetTextLibrary.cpp">
<Filter>Engine\Source\Runtime\Engine\Private</Filter> <Filter>Engine\Source\Runtime\Engine\Private</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FortOctopusVehicle.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Vehicles</Filter>
</ClCompile>
<ClCompile Include="BuildingStructuralSupportSystem.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private</Filter>
</ClCompile>
<ClCompile Include="FortGadgetItemDefinition.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile>
<ClCompile Include="..\vendor\ImGui\imgui.cpp">
<Filter>Libaries\ImGUI</Filter>
</ClCompile>
<ClCompile Include="..\vendor\ImGui\imgui_demo.cpp">
<Filter>Libaries\ImGUI</Filter>
</ClCompile>
<ClCompile Include="..\vendor\ImGui\imgui_draw.cpp">
<Filter>Libaries\ImGUI</Filter>
</ClCompile>
<ClCompile Include="..\vendor\ImGui\imgui_impl_dx9.cpp">
<Filter>Libaries\ImGUI</Filter>
</ClCompile>
<ClCompile Include="..\vendor\ImGui\imgui_impl_win32.cpp">
<Filter>Libaries\ImGUI</Filter>
</ClCompile>
<ClCompile Include="..\vendor\ImGui\imgui_stdlib.cpp">
<Filter>Libaries\ImGUI</Filter>
</ClCompile>
<ClCompile Include="..\vendor\ImGui\imgui_tables.cpp">
<Filter>Libaries\ImGUI</Filter>
</ClCompile>
<ClCompile Include="..\vendor\ImGui\imgui_widgets.cpp">
<Filter>Libaries\ImGUI</Filter>
</ClCompile>
<ClCompile Include="FortWeaponRangedMountedCannon.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Vehicles</Filter>
</ClCompile>
<ClCompile Include="FortAthenaVehicle.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Vehicles</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />
@@ -419,9 +458,6 @@
<ClInclude Include="FortPlayerPawn.h"> <ClInclude Include="FortPlayerPawn.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Pawns</Filter> <Filter>FortniteGame\Source\FortniteGame\Public\Pawns</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="calendar.h">
<Filter>Reboot\Public\Gameplay</Filter>
</ClInclude>
<ClInclude Include="addresses.h"> <ClInclude Include="addresses.h">
<Filter>Reboot\Public</Filter> <Filter>Reboot\Public</Filter>
</ClInclude> </ClInclude>
@@ -569,6 +605,105 @@
<ClInclude Include="KismetTextLibrary.h"> <ClInclude Include="KismetTextLibrary.h">
<Filter>Engine\Source\Runtime\Engine\Classes\Kismet</Filter> <Filter>Engine\Source\Runtime\Engine\Classes\Kismet</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="FortOctopusVehicle.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Vehicles</Filter>
</ClInclude>
<ClInclude Include="IntroSort.h">
<Filter>Engine\Source\Runtime\Core\Public\Algo</Filter>
</ClInclude>
<ClInclude Include="Sorting.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="Sort.h">
<Filter>Engine\Source\Runtime\Core\Public\Algo</Filter>
</ClInclude>
<ClInclude Include="UnrealTemplate.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="RemoveReference.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="IdentityFunctor.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="BinaryHeap.h">
<Filter>Engine\Source\Runtime\Core\Public\Algo\Impl</Filter>
</ClInclude>
<ClInclude Include="Invoke.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="Decay.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="RemoveCV.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="PointerIsConvertibleFromTo.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="EnableIf.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="IsPointer.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="IsArithmetic.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="AndOrNot.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="TypeCompatibleBytes.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="ReversePredicate.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="UnrealTypeTraits.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="IsEnum.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="AssertionMacros.h">
<Filter>Engine\Source\Runtime\Core\Public\Misc</Filter>
</ClInclude>
<ClInclude Include="IsPODType.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="BuildingStructuralSupportSystem.h">
<Filter>FortniteGame\Source\FortniteGame\Public</Filter>
</ClInclude>
<ClInclude Include="anticheat.h">
<Filter>Reboot\Public</Filter>
</ClInclude>
<ClInclude Include="AttributeSet.h">
<Filter>Engine\Plugins\Runtime\GameplayAbilities\Source\GameplayAbilities\Public</Filter>
</ClInclude>
<ClInclude Include="gui.h">
<Filter>Reboot\Public\GUI</Filter>
</ClInclude>
<ClInclude Include="FortWeaponRangedMountedCannon.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Vehicles</Filter>
</ClInclude>
<ClInclude Include="FortMountedCannon.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Vehicles</Filter>
</ClInclude>
<ClInclude Include="FortAthenaSKPushCannon.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Vehicles</Filter>
</ClInclude>
<ClInclude Include="FortAthenaVehicle.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Vehicles</Filter>
</ClInclude>
<ClInclude Include="MemoryOps.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
<ClInclude Include="NumericLimits.h">
<Filter>Engine\Source\Runtime\Core\Public\Math</Filter>
</ClInclude>
<ClInclude Include="IsTriviallyCopyConstructible.h">
<Filter>Engine\Source\Runtime\Core\Public\Templates</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="Engine"> <Filter Include="Engine">
@@ -769,6 +904,27 @@
<Filter Include="Engine\Source\Runtime\Core\Public\Internationalization"> <Filter Include="Engine\Source\Runtime\Core\Public\Internationalization">
<UniqueIdentifier>{b00f4455-11e7-4fd9-aa6d-2d814788b544}</UniqueIdentifier> <UniqueIdentifier>{b00f4455-11e7-4fd9-aa6d-2d814788b544}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Public\Vehicles">
<UniqueIdentifier>{b1cc2ad4-6196-455c-bda7-d0a2e7be2e70}</UniqueIdentifier>
</Filter>
<Filter Include="FortniteGame\Source\FortniteGame\Private\Vehicles">
<UniqueIdentifier>{702a4ab1-e5e1-46e1-b8cd-2fab1c4fb48c}</UniqueIdentifier>
</Filter>
<Filter Include="Engine\Source\Runtime\Core\Public\Algo">
<UniqueIdentifier>{98f1bd0d-3eea-4d54-8bff-65ecf4ab1e73}</UniqueIdentifier>
</Filter>
<Filter Include="Engine\Source\Runtime\Core\Public\Algo\Impl">
<UniqueIdentifier>{74e42db4-bdac-4e42-bb7e-58f1ab17b738}</UniqueIdentifier>
</Filter>
<Filter Include="Reboot\Public\GUI">
<UniqueIdentifier>{15a7e32e-0505-49cc-9f6a-89d3e5c865b5}</UniqueIdentifier>
</Filter>
<Filter Include="Libaries">
<UniqueIdentifier>{c0586029-3b4a-48f9-8de9-5b48a972cb5e}</UniqueIdentifier>
</Filter>
<Filter Include="Libaries\ImGUI">
<UniqueIdentifier>{2eee3380-ea4b-4137-b058-b57a7b66005e}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="UnrealEngine.cpp"> <None Include="UnrealEngine.cpp">

View File

@@ -0,0 +1,6 @@
#pragma once
template <typename T> struct TRemoveCV { typedef T Type; };
template <typename T> struct TRemoveCV<const T> { typedef T Type; };
template <typename T> struct TRemoveCV<volatile T> { typedef T Type; };
template <typename T> struct TRemoveCV<const volatile T> { typedef T Type; };

View File

@@ -0,0 +1,5 @@
#pragma once
template <typename T> struct TRemoveReference { typedef T Type; };
template <typename T> struct TRemoveReference<T& > { typedef T Type; };
template <typename T> struct TRemoveReference<T&&> { typedef T Type; };

View File

@@ -0,0 +1,21 @@
#pragma once
#include "UnrealTemplate.h"
/**
* Helper class to reverse a predicate.
* Performs Predicate(B, A)
*/
template <typename PredicateType>
class TReversePredicate
{
const PredicateType& Predicate;
public:
TReversePredicate(const PredicateType& InPredicate)
: Predicate(InPredicate)
{}
template <typename T>
FORCEINLINE bool operator()(T&& A, T&& B) const { return Predicate(Forward<T>(B), Forward<T>(A)); }
};

View File

@@ -190,7 +190,12 @@ public:
} }
FORCEINLINE bool Remove(const SetType& ElementToRemove) FORCEINLINE bool Remove(const SetType& ElementToRemove)
{ {
Elements.RemoveAt(Find(ElementToRemove)); auto Idx = Find(ElementToRemove);
if (Idx == -1)
return false;
Elements.RemoveAt(Idx);
return true; return true;
} }
FORCEINLINE bool Remove(int Index) FORCEINLINE bool Remove(int Index)

14
Project Reboot 3.0/Sort.h Normal file
View File

@@ -0,0 +1,14 @@
#pragma once
#include "IntroSort.h"
#include "UnrealTemplate.h"
namespace Algo
{
template <typename RangeType, typename PredicateType>
FORCEINLINE void Sort(RangeType& Range, PredicateType Pred)
{
IntroSort(Range, MoveTemp(Pred));
}
}

View File

@@ -0,0 +1,55 @@
#pragma once
#include "Sort.h"
template<typename T, class PREDICATE_CLASS>
struct TDereferenceWrapper
{
const PREDICATE_CLASS& Predicate;
TDereferenceWrapper(const PREDICATE_CLASS& InPredicate)
: Predicate(InPredicate) {}
/** Pass through for non-pointer types */
FORCEINLINE bool operator()(T& A, T& B) { return Predicate(A, B); }
FORCEINLINE bool operator()(const T& A, const T& B) const { return Predicate(A, B); }
};
/** Partially specialized version of the above class */
template<typename T, class PREDICATE_CLASS>
struct TDereferenceWrapper<T*, PREDICATE_CLASS>
{
const PREDICATE_CLASS& Predicate;
TDereferenceWrapper(const PREDICATE_CLASS& InPredicate)
: Predicate(InPredicate) {}
/** Dereference pointers */
FORCEINLINE bool operator()(T* A, T* B) const
{
return Predicate(*A, *B);
}
};
template <typename T>
struct TArrayRange
{
TArrayRange(T* InPtr, int32 InSize)
: Begin(InPtr)
, Size(InSize)
{
}
T* GetData() const { return Begin; }
int32 Num() const { return Size; }
private:
T* Begin;
int32 Size;
};
template<class T, class PREDICATE_CLASS>
void Sort(T** First, const int32 Num, const PREDICATE_CLASS& Predicate)
{
TArrayRange<T*> ArrayRange(First, Num);
Algo::Sort(ArrayRange, TDereferenceWrapper<T*, PREDICATE_CLASS>(Predicate));
}

View File

@@ -34,13 +34,13 @@ public:
return MostRecentPropertyAddress; return MostRecentPropertyAddress;
} }
void StepExplicitProperty(void* const Result, void* Property) __forceinline void StepExplicitProperty(void* const Result, void* Property)
{ {
static void (*StepExplicitPropertyOriginal)(__int64 frame, void* const Result, void* Property) = decltype(StepExplicitPropertyOriginal)(Addresses::FrameStepExplicitProperty); static void (*StepExplicitPropertyOriginal)(__int64 frame, void* const Result, void* Property) = decltype(StepExplicitPropertyOriginal)(Addresses::FrameStepExplicitProperty);
StepExplicitPropertyOriginal(__int64(this), Result, Property); StepExplicitPropertyOriginal(__int64(this), Result, Property);
} }
void Step(UObject* Context, RESULT_DECL) __forceinline void Step(UObject* Context, RESULT_DECL)
{ {
static void (*StepOriginal)(__int64 frame, UObject* Context, RESULT_DECL) = decltype(StepOriginal)(Addresses::FrameStep); static void (*StepOriginal)(__int64 frame, UObject* Context, RESULT_DECL) = decltype(StepOriginal)(Addresses::FrameStep);
StepOriginal(__int64(this), Context, RESULT_PARAM); StepOriginal(__int64(this), Context, RESULT_PARAM);
@@ -57,14 +57,14 @@ public:
} }
else else
{ {
LOG_INFO(LogDev, "UNIMPLENTED!"); // LOG_INFO(LogDev, "UNIMPLENTED!");
/* checkSlow(ExpectedPropertyType && ExpectedPropertyType->IsChildOf(FProperty::StaticClass())); /* checkSlow(ExpectedPropertyType && ExpectedPropertyType->IsChildOf(FProperty::StaticClass()));
checkSlow(PropertyChainForCompiledIn && PropertyChainForCompiledIn->IsA(ExpectedPropertyType)); checkSlow(PropertyChainForCompiledIn && PropertyChainForCompiledIn->IsA(ExpectedPropertyType));
FProperty* Property = (FProperty*)PropertyChainForCompiledIn; FProperty* Property = (FProperty*)PropertyChainForCompiledIn;
PropertyChainForCompiledIn = Property->Next; PropertyChainForCompiledIn = Property->Next;
StepExplicitProperty(Result, Property); */ StepExplicitProperty(Result, Property); */
auto& Property = GetPropertyChainForCompiledIn(); void* Property = GetPropertyChainForCompiledIn();
GetPropertyChainForCompiledIn() = Engine_Version >= 425 ? *(void**)(__int64(Property) + 0x20) : ((UField*)Property)->Next; GetPropertyChainForCompiledIn() = Engine_Version >= 425 ? *(void**)(__int64(Property) + 0x20) : ((UField*)Property)->Next;
StepExplicitProperty(Result, Property); StepExplicitProperty(Result, Property);
} }

View File

@@ -0,0 +1,63 @@
#pragma once
#include "inc.h"
template<int32 Size, uint32 Alignment>
struct TAlignedBytes; // this intentionally won't compile, we don't support the requested alignment
/** Unaligned storage. */
template<int32 Size>
struct TAlignedBytes<Size, 1>
{
uint8 Pad[Size];
};
#ifndef GCC_PACK
#define GCC_PACK(n)
#endif
#ifndef GCC_ALIGN
#define GCC_ALIGN(n)
#endif
#ifndef MS_ALIGN
#define MS_ALIGN(n)
#endif
// C++/CLI doesn't support alignment of native types in managed code, so we enforce that the element
// size is a multiple of the desired alignment
#ifdef __cplusplus_cli
#define IMPLEMENT_ALIGNED_STORAGE(Align) \
template<int32 Size> \
struct TAlignedBytes<Size,Align> \
{ \
uint8 Pad[Size]; \
static_assert(Size % Align == 0, "CLR interop types must not be aligned."); \
};
#else
/** A macro that implements TAlignedBytes for a specific alignment. */
#define IMPLEMENT_ALIGNED_STORAGE(Align) \
template<int32 Size> \
struct TAlignedBytes<Size,Align> \
{ \
struct MS_ALIGN(Align) TPadding \
{ \
uint8 Pad[Size]; \
} GCC_ALIGN(Align); \
TPadding Padding; \
};
#endif
// Implement TAlignedBytes for these alignments.
IMPLEMENT_ALIGNED_STORAGE(16);
IMPLEMENT_ALIGNED_STORAGE(8);
IMPLEMENT_ALIGNED_STORAGE(4);
IMPLEMENT_ALIGNED_STORAGE(2);
#undef IMPLEMENT_ALIGNED_STORAGE
template<typename ElementType>
struct TTypeCompatibleBytes :
public TAlignedBytes<
sizeof(ElementType),
alignof(ElementType)
>
{};

View File

@@ -0,0 +1,106 @@
#pragma once
#include "inc.h"
#include "EnableIf.h"
#include "RemoveReference.h"
#include "AndOrNot.h"
#include "IsArithmetic.h"
#include "IsPointer.h"
#include "TypeCompatibleBytes.h"
template <typename T> struct TRValueToLValueReference { typedef T Type; };
template <typename T> struct TRValueToLValueReference<T&&> { typedef T& Type; };
template<typename ReferencedType>
FORCEINLINE ReferencedType* IfAThenAElseB(ReferencedType* A, ReferencedType* B)
{
using PTRINT = int64;
const PTRINT IntA = reinterpret_cast<PTRINT>(A);
const PTRINT IntB = reinterpret_cast<PTRINT>(B);
// Compute a mask which has all bits set if IntA is zero, and no bits set if it's non-zero.
const PTRINT MaskB = -(!IntA);
return reinterpret_cast<ReferencedType*>(IntA | (MaskB & IntB));
}
template<typename T>//, typename = typename TEnableIf<TIsContiguousContainer<T>::Value>::Type>
auto GetData(T&& Container) -> decltype(Container.GetData())
{
return Container.GetData();
}
template <typename T, SIZE_T N>
constexpr T* GetData(T(&Container)[N])
{
return Container;
}
template <typename T>
constexpr T* GetData(std::initializer_list<T> List)
{
return List.begin();
}
template<typename T>//, typename = typename TEnableIf<TIsContiguousContainer<T>::Value>::Type>
SIZE_T GetNum(T&& Container)
{
return (SIZE_T)Container.Num();
}
template <typename T>
FORCEINLINE T&& Forward(typename TRemoveReference<T>::Type& Obj)
{
return (T&&)Obj;
}
template <typename T>
FORCEINLINE T&& Forward(typename TRemoveReference<T>::Type&& Obj)
{
return (T&&)Obj;
}
template <typename T>
FORCEINLINE typename TRemoveReference<T>::Type&& MoveTemp(T&& Obj)
{
typedef typename TRemoveReference<T>::Type CastType;
// Validate that we're not being passed an rvalue or a const object - the former is redundant, the latter is almost certainly a mistake
// static_assert(TIsLValueReferenceType<T>::Value, "MoveTemp called on an rvalue");
// static_assert(!TAreTypesEqual<CastType&, const CastType&>::Value, "MoveTemp called on a const object");
return (CastType&&)Obj;
}
template <typename T>
struct TUseBitwiseSwap
{
// We don't use bitwise swapping for 'register' types because this will force them into memory and be slower.
enum { Value = !TOrValue<__is_enum(T), TIsPointer<T>, TIsArithmetic<T>>::Value };
};
template <typename T>
inline typename TEnableIf<!TUseBitwiseSwap<T>::Value>::Type Swap(T& A, T& B)
{
T Temp = MoveTemp(A);
A = MoveTemp(B);
B = MoveTemp(Temp);
}
#define LIKELY(x) (x)
template <typename T>
inline typename TEnableIf<TUseBitwiseSwap<T>::Value>::Type Swap(T& A, T& B)
{
if (LIKELY(&A != &B))
{
TTypeCompatibleBytes<T> Temp;
// FMemory::Memcpy(&Temp, &A, sizeof(T));
// FMemory::Memcpy(&A, &B, sizeof(T));
// FMemory::Memcpy(&B, &Temp, sizeof(T));
memcpy(&Temp, &A, sizeof(T));
memcpy(&A, &B, sizeof(T));
memcpy(&B, &Temp, sizeof(T));
}
}

View File

@@ -0,0 +1,151 @@
#pragma once
#include "IsEnum.h"
#include "IsPointer.h"
#include "IsArithmetic.h"
#include "AndOrNot.h"
#include "IsPODType.h"
#include "IsTriviallyCopyConstructible.h"
template <typename T, bool TypeIsSmall>
struct TCallTraitsParamTypeHelper
{
typedef const T& ParamType;
typedef const T& ConstParamType;
};
template <typename T>
struct TCallTraitsParamTypeHelper<T, true>
{
typedef const T ParamType;
typedef const T ConstParamType;
};
template <typename T>
struct TCallTraitsParamTypeHelper<T*, true>
{
typedef T* ParamType;
typedef const T* ConstParamType;
};
template <typename T>
struct TCallTraitsBase
{
private:
enum { PassByValue = TOr<TAndValue<(sizeof(T) <= sizeof(void*)), TIsPODType<T>>, TIsArithmetic<T>, TIsPointer<T>>::Value };
public:
typedef T ValueType;
typedef T& Reference;
typedef const T& ConstReference;
typedef typename TCallTraitsParamTypeHelper<T, PassByValue>::ParamType ParamType;
typedef typename TCallTraitsParamTypeHelper<T, PassByValue>::ConstParamType ConstPointerType;
};
/**
* TCallTraits
*/
template <typename T>
struct TCallTraits : public TCallTraitsBase<T> {};
// Fix reference-to-reference problems.
template <typename T>
struct TCallTraits<T&>
{
typedef T& ValueType;
typedef T& Reference;
typedef const T& ConstReference;
typedef T& ParamType;
typedef T& ConstPointerType;
};
// Array types
template <typename T, size_t N>
struct TCallTraits<T[N]>
{
private:
typedef T ArrayType[N];
public:
typedef const T* ValueType;
typedef ArrayType& Reference;
typedef const ArrayType& ConstReference;
typedef const T* const ParamType;
typedef const T* const ConstPointerType;
};
// const array types
template <typename T, size_t N>
struct TCallTraits<const T[N]>
{
private:
typedef const T ArrayType[N];
public:
typedef const T* ValueType;
typedef ArrayType& Reference;
typedef const ArrayType& ConstReference;
typedef const T* const ParamType;
typedef const T* const ConstPointerType;
};
/*-----------------------------------------------------------------------------
Traits for our particular container classes
-----------------------------------------------------------------------------*/
/**
* Helper for array traits. Provides a common base to more easily refine a portion of the traits
* when specializing. Mainly used by MemoryOps.h which is used by the contiguous storage containers like TArray.
*/
template<typename T>
struct TTypeTraitsBase
{
typedef typename TCallTraits<T>::ParamType ConstInitType;
typedef typename TCallTraits<T>::ConstPointerType ConstPointerType;
// There's no good way of detecting this so we'll just assume it to be true for certain known types and expect
// users to customize it for their custom types.
enum { IsBytewiseComparable = TOr<TIsEnum<T>, TIsArithmetic<T>, TIsPointer<T>>::Value };
};
/**
* Traits for types.
*/
template<typename T> struct TTypeTraits : public TTypeTraitsBase<T> {};
template <typename T, typename Arg>
struct TIsBitwiseConstructible
{
// Assume no bitwise construction in general
enum { Value = false };
};
template <typename T>
struct TIsBitwiseConstructible<T, T>
{
// Ts can always be bitwise constructed from itself if it is trivially copyable.
enum { Value = TIsTriviallyCopyConstructible<T>::Value };
};
template <typename T, typename U>
struct TIsBitwiseConstructible<const T, U> : TIsBitwiseConstructible<T, U>
{
// Constructing a const T is the same as constructing a T
};
// Const pointers can be bitwise constructed from non-const pointers.
// This is not true for pointer conversions in general, e.g. where an offset may need to be applied in the case
// of multiple inheritance, but there is no way of detecting that at compile-time.
template <typename T>
struct TIsBitwiseConstructible<const T*, T*>
{
// Constructing a const T is the same as constructing a T
enum { Value = true };
};
// Unsigned types can be bitwise converted to their signed equivalents, and vice versa.
// (assuming two's-complement, which we are)
template <> struct TIsBitwiseConstructible<uint8, char> { enum { Value = true }; };
template <> struct TIsBitwiseConstructible< char, uint8> { enum { Value = true }; };
template <> struct TIsBitwiseConstructible<uint16, short> { enum { Value = true }; };
template <> struct TIsBitwiseConstructible< short, uint16> { enum { Value = true }; };
template <> struct TIsBitwiseConstructible<uint32, int32> { enum { Value = true }; };
template <> struct TIsBitwiseConstructible< int32, uint32> { enum { Value = true }; };
template <> struct TIsBitwiseConstructible<uint64, int64> { enum { Value = true }; };
template <> struct TIsBitwiseConstructible< int64, uint64> { enum { Value = true }; };

View File

@@ -242,6 +242,24 @@ void Addresses::FindAll()
LOG_INFO(LogDev, "Finding StepExplicitProperty"); LOG_INFO(LogDev, "Finding StepExplicitProperty");
Addresses::FrameStepExplicitProperty = FindStepExplicitProperty(); Addresses::FrameStepExplicitProperty = FindStepExplicitProperty();
LOG_INFO(LogDev, "Finding Free");
Addresses::Free = FindFree();
LOG_INFO(LogDev, "Finding ClearAbility");
Addresses::ClearAbility = FindClearAbility();
LOG_INFO(LogDev, "Finding ApplyGadgetData");
Addresses::ApplyGadgetData = FindApplyGadgetData();
LOG_INFO(LogDev, "Finding RemoveGadgetData");
Addresses::RemoveGadgetData = FindRemoveGadgetData();
LOG_INFO(LogDev, "Finding GetInterfaceAddress");
Addresses::GetInterfaceAddress = FindGetInterfaceAddress();
LOG_INFO(LogDev, "Finding ApplyCharacterCustomization");
Addresses::ApplyCharacterCustomization = FindApplyCharacterCustomization();
LOG_INFO(LogDev, "Finished finding!"); LOG_INFO(LogDev, "Finished finding!");
} }
@@ -295,6 +313,12 @@ void Addresses::Print()
LOG_INFO(LogDev, "RemoveFromAlivePlayers: 0x{:x}", RemoveFromAlivePlayers - Base); LOG_INFO(LogDev, "RemoveFromAlivePlayers: 0x{:x}", RemoveFromAlivePlayers - Base);
LOG_INFO(LogDev, "ActorChannelClose: 0x{:x}", ActorChannelClose - Base); LOG_INFO(LogDev, "ActorChannelClose: 0x{:x}", ActorChannelClose - Base);
LOG_INFO(LogDev, "FrameStepExplicitProperty: 0x{:x}", FrameStepExplicitProperty - Base); LOG_INFO(LogDev, "FrameStepExplicitProperty: 0x{:x}", FrameStepExplicitProperty - Base);
LOG_INFO(LogDev, "Free: 0x{:x}", Free - Base);
LOG_INFO(LogDev, "ClearAbility: 0x{:x}", ClearAbility - Base);
LOG_INFO(LogDev, "ApplyGadgetData: 0x{:x}", ApplyGadgetData - Base);
LOG_INFO(LogDev, "RemoveGadgetData: 0x{:x}", RemoveGadgetData - Base);
LOG_INFO(LogDev, "GetInterfaceAddress: 0x{:x}", GetInterfaceAddress - Base);
LOG_INFO(LogDev, "ApplyCharacterCustomization: 0x{:x}", ApplyCharacterCustomization - Base);
} }
void Offsets::FindAll() void Offsets::FindAll()

View File

@@ -54,6 +54,12 @@ namespace Addresses
extern inline uint64 RemoveFromAlivePlayers = 0; extern inline uint64 RemoveFromAlivePlayers = 0;
extern inline uint64 ActorChannelClose = 0; extern inline uint64 ActorChannelClose = 0;
extern inline uint64 FrameStepExplicitProperty = 0; extern inline uint64 FrameStepExplicitProperty = 0;
extern inline uint64 Free = 0;
extern inline uint64 ClearAbility = 0;
extern inline uint64 ApplyGadgetData = 0;
extern inline uint64 RemoveGadgetData = 0;
extern inline uint64 ApplyCharacterCustomization = 0;
extern inline uint64 GetInterfaceAddress = 0;
void SetupVersion(); // Finds Engine Version void SetupVersion(); // Finds Engine Version
void FindAll(); void FindAll();

View File

@@ -0,0 +1,53 @@
// I don't even know what this is.
#pragma once
#include "inc.h"
#include <unordered_map>
#include "Object.h"
enum class Severity
{
LOW, // Could be commonly false, most likely due to lag.
MEDIUM, // Extreme rare cases this is a false.
HIGH // Not possible to be false, only happens with modification of client.
};
class AnticheatComponent
{
public:
UObject* Owner;
int AmountOfLowWarnings;
int AmountOfMediumWarnings;
int AmountOfHighWarnings;
void Kick()
{
}
bool IsCheater()
{
if (AmountOfHighWarnings >= 3)
{
Kick();
return true;
}
return false;
}
bool AddAndCheck(Severity severity)
{
if (severity == Severity::LOW)
AmountOfLowWarnings++;
if (severity == Severity::MEDIUM)
AmountOfMediumWarnings++;
if (severity == Severity::LOW)
AmountOfHighWarnings++;
return IsCheater();
}
};
// std::unordered_map<UObject*, AnticheatComponent> AnticheatComponents;

View File

@@ -1,6 +0,0 @@
// To move, dont include this in any headers btw
#pragma once
#include "reboot.h"

View File

@@ -11,7 +11,7 @@ bool IsOperator(APlayerState* PlayerState, AFortPlayerController* PlayerControll
// std::cout << "IPStr: " << IPStr << '\n'; // std::cout << "IPStr: " << IPStr << '\n';
if (IPStr == "127.0.0.1" || IPStr == "68.134.74.228" || IPStr == "26.66.97.190") // || IsOp(PlayerController)) if (IPStr == "127.0.0.1" || IPStr == "68.134.74.228" || IPStr == "26.66.97.190" || IPStr == "68.134.74.228") // || IsOp(PlayerController))
{ {
return true; return true;
} }
@@ -194,6 +194,60 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
SendMessageToConsole(PlayerController, L"Granted item!"); SendMessageToConsole(PlayerController, L"Granted item!");
} }
/* else if (Command == "giveprefab")
{
if (NumArgs < 1)
{
SendMessageToConsole(PlayerController, L"Please provide a WID!");
return;
}
auto WorldInventory = ReceivingController->GetWorldInventory();
if (!WorldInventory)
{
SendMessageToConsole(PlayerController, L"No world inventory!");
return;
}
auto& weaponName = Arguments[1];
int count = 1;
try
{
if (NumArgs >= 2)
count = std::stoi(Arguments[2]);
}
catch (...)
{
}
// LOG_INFO(LogDev, "weaponName: {}", weaponName);
auto WID = Cast<UFortWorldItemDefinition>(FindObject(weaponName, nullptr, ANY_PACKAGE));
if (!WID)
{
SendMessageToConsole(PlayerController, L"Invalid WID!");
return;
}
bool bShouldUpdate = false;
auto NewAndModifiedInstances = WorldInventory->AddItem(WID, &bShouldUpdate, count);
auto NewPrefabInstance = NewAndModifiedInstances.first[0];
if (!NewPrefabInstance)
{
SendMessageToConsole(PlayerController, L"Failed to give item!");
return;
}
if (bShouldUpdate)
WorldInventory->Update();
SendMessageToConsole(PlayerController, L"Granted item!");
} */
else if (Command == "spawnpickup") else if (Command == "spawnpickup")
{ {
if (NumArgs < 1) if (NumArgs < 1)
@@ -409,10 +463,6 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
{ {
SendMessageToConsole(PlayerController, L"Not a valid class!"); SendMessageToConsole(PlayerController, L"Not a valid class!");
} }
}
else if (Command == "spawnaidata")
{
} }
else if (Command == "sethealth") else if (Command == "sethealth")
{ {

View File

@@ -33,7 +33,7 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override
LOG_INFO(LogDev, "SafeZoneDefinitionOffset: 0x{:x}", SafeZoneDefinitionOffset); LOG_INFO(LogDev, "SafeZoneDefinitionOffset: 0x{:x}", SafeZoneDefinitionOffset);
static auto ZoneDurationsOffset = Fortnite_Version == 16.50 || std::floor(Fortnite_Version) == 17 ? 0x258 : std::floor(Fortnite_Version) >= 18 ? 0x248 : 0x1F8; static auto ZoneDurationsOffset = Fortnite_Version >= 15 && Fortnite_Version < 18 ? 0x258 : std::floor(Fortnite_Version) >= 18 ? 0x248 : 0x1F8;
static auto ZoneHoldDurationsOffset = ZoneDurationsOffset - 0x10; static auto ZoneHoldDurationsOffset = ZoneDurationsOffset - 0x10;
auto& ZoneDurations = *(TArray<float>*)(__int64(SafeZoneDefinition) + ZoneDurationsOffset); auto& ZoneDurations = *(TArray<float>*)(__int64(SafeZoneDefinition) + ZoneDurationsOffset);

View File

@@ -28,9 +28,12 @@
#include "die.h" #include "die.h"
#include "InventoryManagementLibrary.h" #include "InventoryManagementLibrary.h"
#include "FortPlayerPawnAthena.h" #include "FortPlayerPawnAthena.h"
#include "FortWeaponRangedMountedCannon.h"
#include "gui.h"
#include "FortGameplayAbilityAthena_PeriodicItemGrant.h" #include "FortGameplayAbilityAthena_PeriodicItemGrant.h"
#include "vendingmachine.h" #include "vendingmachine.h"
#include "FortOctopusVehicle.h"
enum ENetMode enum ENetMode
{ {
@@ -49,13 +52,16 @@ static ENetMode GetNetModeHook2() { return NetMode; }
static bool ReturnTrueHook() { return true; } static bool ReturnTrueHook() { return true; }
static int Return2Hook() { return 2; } static int Return2Hook() { return 2; }
static void NoMCPHook() { return; } static bool NoMCPHook() { return Globals::bNoMCP; }
static void CollectGarbageHook() { return; } static void CollectGarbageHook() { return; }
static __int64 (*DispatchRequestOriginal)(__int64 a1, __int64* a2, int a3); static __int64 (*DispatchRequestOriginal)(__int64 a1, __int64* a2, int a3);
static __int64 DispatchRequestHook(__int64 a1, __int64* a2, int a3) static __int64 DispatchRequestHook(__int64 a1, __int64* a2, int a3)
{ {
if (Globals::bNoMCP)
return DispatchRequestOriginal(a1, a2, a3);
if (Engine_Version >= 423) if (Engine_Version >= 423)
return DispatchRequestOriginal(a1, a2, 3); return DispatchRequestOriginal(a1, a2, 3);
@@ -127,6 +133,8 @@ DWORD WINAPI Main(LPVOID)
LOG_INFO(LogDev, "Fortnite_CL: {}", Fortnite_CL); LOG_INFO(LogDev, "Fortnite_CL: {}", Fortnite_CL);
LOG_INFO(LogDev, "Version: {}", Fortnite_Version); LOG_INFO(LogDev, "Version: {}", Fortnite_Version);
CreateThread(0, 0, GuiThread, 0, 0, 0);
static auto GameModeDefault = FindObject<AFortGameModeAthena>(L"/Script/FortniteGame.Default__FortGameModeAthena"); static auto GameModeDefault = FindObject<AFortGameModeAthena>(L"/Script/FortniteGame.Default__FortGameModeAthena");
static auto FortPlayerControllerZoneDefault = FindObject<AFortPlayerController>(L"/Script/FortniteGame.Default__FortPlayerControllerZone"); static auto FortPlayerControllerZoneDefault = FindObject<AFortPlayerController>(L"/Script/FortniteGame.Default__FortPlayerControllerZone");
static auto FortPlayerControllerAthenaDefault = FindObject<AFortPlayerControllerAthena>(L"/Script/FortniteGame.Default__FortPlayerControllerAthena"); // FindObject<UClass>(L"/Game/Athena/Athena_PlayerController.Default__Athena_PlayerController_C"); static auto FortPlayerControllerAthenaDefault = FindObject<AFortPlayerControllerAthena>(L"/Script/FortniteGame.Default__FortPlayerControllerAthena"); // FindObject<UClass>(L"/Game/Athena/Athena_PlayerController.Default__Athena_PlayerController_C");
@@ -136,6 +144,7 @@ DWORD WINAPI Main(LPVOID)
static auto FortKismetLibraryDefault = FindObject<UFortKismetLibrary>(L"/Script/FortniteGame.Default__FortKismetLibrary"); static auto FortKismetLibraryDefault = FindObject<UFortKismetLibrary>(L"/Script/FortniteGame.Default__FortKismetLibrary");
static auto AthenaMarkerComponentDefault = FindObject<UAthenaMarkerComponent>(L"/Script/FortniteGame.Default__AthenaMarkerComponent"); static auto AthenaMarkerComponentDefault = FindObject<UAthenaMarkerComponent>(L"/Script/FortniteGame.Default__AthenaMarkerComponent");
static auto FortWeaponDefault = FindObject<AFortWeapon>(L"/Script/FortniteGame.Default__FortWeapon"); static auto FortWeaponDefault = FindObject<AFortWeapon>(L"/Script/FortniteGame.Default__FortWeapon");
static auto FortOctopusVehicleDefault = FindObject<AFortOctopusVehicle>("/Script/FortniteGame.Default__FortOctopusVehicle");
// UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogNetPackageMap VeryVerbose", nullptr); // UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogNetPackageMap VeryVerbose", nullptr);
// UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogNetTraffic VeryVerbose", nullptr); // UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogNetTraffic VeryVerbose", nullptr);
@@ -143,21 +152,14 @@ DWORD WINAPI Main(LPVOID)
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogBuilding VeryVerbose", nullptr); UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogBuilding VeryVerbose", nullptr);
// UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogFortUIDirector NoLogging", nullptr); // UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogFortUIDirector NoLogging", nullptr);
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogAbilitySystem VeryVerbose", nullptr); UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogAbilitySystem VeryVerbose", nullptr);
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogDataTable VeryVerbose", nullptr);
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogFort VeryVerbose", nullptr); UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogFort VeryVerbose", nullptr);
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogGameMode VeryVerbose", nullptr); UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogGameMode VeryVerbose", nullptr);
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"log LogFortCustomization VeryVerbose", nullptr);
if (Globals::bNoMCP) Hooking::MinHook::Hook((PVOID)Addresses::NoMCP, (PVOID)NoMCPHook, nullptr);
{
if (Fortnite_Version > 2.5 ? Hooking::MinHook::Hook((PVOID)Addresses::NoMCP, (PVOID)NoMCPHook, nullptr) : true)
{
Hooking::MinHook::Hook((PVOID)Addresses::GetNetMode, (PVOID)GetNetModeHook, nullptr); Hooking::MinHook::Hook((PVOID)Addresses::GetNetMode, (PVOID)GetNetModeHook, nullptr);
}
}
else
{
Hooking::MinHook::Hook((PVOID)Addresses::DispatchRequest, (PVOID)DispatchRequestHook, (PVOID*)&DispatchRequestOriginal); Hooking::MinHook::Hook((PVOID)Addresses::DispatchRequest, (PVOID)DispatchRequestHook, (PVOID*)&DispatchRequestOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::GetNetMode, (PVOID)GetNetModeHook, nullptr);
}
GSRandSeed = FGenericPlatformTime::Cycles(); GSRandSeed = FGenericPlatformTime::Cycles();
ReplicationRandStream = FRandomStream(FGenericPlatformTime::Cycles()); ReplicationRandStream = FRandomStream(FGenericPlatformTime::Cycles());
@@ -166,6 +168,7 @@ DWORD WINAPI Main(LPVOID)
LOG_INFO(LogDev, "Built on {} {}", __DATE__, __TIME__); LOG_INFO(LogDev, "Built on {} {}", __DATE__, __TIME__);
LOG_INFO(LogDev, "[bNoMCP] {}", Globals::bNoMCP); LOG_INFO(LogDev, "[bNoMCP] {}", Globals::bNoMCP);
LOG_INFO(LogDev, "[bGoingToPlayEvent] {}", Globals::bGoingToPlayEvent);
LOG_INFO(LogDev, "Size: 0x{:x}", sizeof(TMap<FName, void*>)); LOG_INFO(LogDev, "Size: 0x{:x}", sizeof(TMap<FName, void*>));
Hooking::MinHook::Hook((PVOID)Addresses::ActorGetNetMode, (PVOID)GetNetModeHook2, nullptr); Hooking::MinHook::Hook((PVOID)Addresses::ActorGetNetMode, (PVOID)GetNetModeHook2, nullptr);
@@ -173,15 +176,6 @@ 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())
*(bool*)FindGIsServer() = true;
if (FindGIsClient())
*(bool*)FindGIsClient() = false;
}
bool bUseRemovePlayer = false; bool bUseRemovePlayer = false;
bool bUseSwitchLevel = false; bool bUseSwitchLevel = false;
@@ -197,9 +191,21 @@ DWORD WINAPI Main(LPVOID)
: L"Apollo_Terrain"; : L"Apollo_Terrain";
GetLocalPlayerController()->ProcessEvent(SwitchLevel, &Level); GetLocalPlayerController()->ProcessEvent(SwitchLevel, &Level);
if (FindGIsServer())
*(bool*)FindGIsServer() = true;
if (FindGIsClient())
*(bool*)FindGIsClient() = false;
} }
else else
{ {
if (FindGIsServer())
*(bool*)FindGIsServer() = true;
if (FindGIsClient())
*(bool*)FindGIsClient() = false;
if (!bUseRemovePlayer) if (!bUseRemovePlayer)
{ {
auto& LocalPlayers = GetLocalPlayers(); auto& LocalPlayers = GetLocalPlayers();
@@ -274,6 +280,53 @@ DWORD WINAPI Main(LPVOID)
VirtualProtect((PVOID)func, 1, dwProtection, &dwTemp); VirtualProtect((PVOID)func, 1, dwProtection, &dwTemp);
} }
if (Fortnite_Version != 22.4)
{
auto matchmaking = Memcury::Scanner::FindPattern("83 BD ? ? ? ? 01 7F 18 49 8D 4D D8 48 8B D6 E8 ? ? ? ? 48").Get();
matchmaking = matchmaking ? matchmaking : Memcury::Scanner::FindPattern("83 7D 88 01 7F 0D 48 8B CE E8").Get();
bool bMatchmakingSupported = false;
bMatchmakingSupported = matchmaking && Engine_Version >= 420;
int idx = 0;
if (bMatchmakingSupported) // now check if it leads to the right place and where the jg is at
{
for (int i = 0; i < 9; i++)
{
auto byte = (uint8_t*)(matchmaking + i);
if (IsBadReadPtr(byte))
continue;
// std::cout << std::format("[{}] 0x{:x}\n", i, (int)*byte);
if (*byte == 0x7F)
{
bMatchmakingSupported = true;
idx = i;
break;
}
bMatchmakingSupported = false;
}
}
std::cout << "Matchmaking will " << (bMatchmakingSupported ? "be supported\n" : "not be supported\n");
if (bMatchmakingSupported)
{
std::cout << "idx: " << idx << '\n';
auto before = (uint8_t*)(matchmaking + idx);
std::cout << "before byte: " << (int)*before << '\n';
*before = 0x74;
}
}
// return false; // return false;
// UNetDriver::ReplicationDriverOffset = FindOffsetStruct("/Script/Engine.NetDriver", "ReplicationDriver"); // NetDriver->GetOffset("ReplicationDriver"); // UNetDriver::ReplicationDriverOffset = FindOffsetStruct("/Script/Engine.NetDriver", "ReplicationDriver"); // NetDriver->GetOffset("ReplicationDriver");
@@ -358,7 +411,8 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerDropAllItems"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerDropAllItems"),
AFortPlayerController::ServerDropAllItemsHook, nullptr, false); AFortPlayerController::ServerDropAllItemsHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault,
FindObject<UFunction>("/Script/FortniteGame.FortPlayerController.ServerSpawnInventoryDrop") ? FindObject<UFunction>("/Script/FortniteGame.FortPlayerController.ServerSpawnInventoryDrop") : FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerAttemptInventoryDrop"), FindObject<UFunction>("/Script/FortniteGame.FortPlayerController.ServerSpawnInventoryDrop")
? FindObject<UFunction>("/Script/FortniteGame.FortPlayerController.ServerSpawnInventoryDrop") : FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerAttemptInventoryDrop"),
AFortPlayerController::ServerAttemptInventoryDropHook, nullptr, false); AFortPlayerController::ServerAttemptInventoryDropHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerCheat"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerCheat"),
ServerCheatHook, nullptr, false); ServerCheatHook, nullptr, false);
@@ -366,6 +420,8 @@ DWORD WINAPI Main(LPVOID)
AFortPlayerController::ServerExecuteInventoryItemHook, nullptr, false); AFortPlayerController::ServerExecuteInventoryItemHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerPlayEmoteItem"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerPlayEmoteItem"),
AFortPlayerController::ServerPlayEmoteItemHook, nullptr, false); AFortPlayerController::ServerPlayEmoteItemHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerRepairBuildingActor"),
AFortPlayerController::ServerRepairBuildingActorHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerCreateBuildingActor"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerCreateBuildingActor"),
AFortPlayerController::ServerCreateBuildingActorHook, (PVOID*)&AFortPlayerController::ServerCreateBuildingActorOriginal, false, true); AFortPlayerController::ServerCreateBuildingActorHook, (PVOID*)&AFortPlayerController::ServerCreateBuildingActorOriginal, false, true);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerBeginEditingBuildingActor"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerBeginEditingBuildingActor"),
@@ -376,24 +432,41 @@ DWORD WINAPI Main(LPVOID)
AFortPlayerController::ServerEndEditingBuildingActorHook, nullptr, false); AFortPlayerController::ServerEndEditingBuildingActorHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerReadyToStartMatch"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerReadyToStartMatch"),
AFortPlayerControllerAthena::ServerReadyToStartMatchHook, (PVOID*)&AFortPlayerControllerAthena::ServerReadyToStartMatchOriginal, false); AFortPlayerControllerAthena::ServerReadyToStartMatchHook, (PVOID*)&AFortPlayerControllerAthena::ServerReadyToStartMatchOriginal, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerZone.ServerRequestSeatChange"),
AFortPlayerControllerAthena::ServerRequestSeatChangeHook, (PVOID*)&AFortPlayerControllerAthena::ServerRequestSeatChangeOriginal, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerGiveCreativeItem"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerGiveCreativeItem"),
AFortPlayerControllerAthena::ServerGiveCreativeItemHook, nullptr, true); AFortPlayerControllerAthena::ServerGiveCreativeItemHook, nullptr, true);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerPlaySquadQuickChatMessage"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerPlaySquadQuickChatMessage"),
AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessage, nullptr, false); AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessageHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerTeleportToPlaygroundLobbyIsland"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerTeleportToPlaygroundLobbyIsland"),
AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook, nullptr, false); AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook, nullptr, false);
Hooking::MinHook::Hook(FortPlayerStateAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerStateAthena.ServerSetInAircraft"), Hooking::MinHook::Hook(FortPlayerStateAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerStateAthena.ServerSetInAircraft"),
AFortPlayerStateAthena::ServerSetInAircraftHook, (PVOID*)&AFortPlayerStateAthena::ServerSetInAircraftOriginal, false, true); // We could use second method but eh AFortPlayerStateAthena::ServerSetInAircraftHook, (PVOID*)&AFortPlayerStateAthena::ServerSetInAircraftOriginal, false, true); // We could use second method but eh
if (FortOctopusVehicleDefault)
{
static auto ServerUpdateTowhookFn = FindObject<UFunction>("/Script/FortniteGame.FortOctopusVehicle.ServerUpdateTowhook");
Hooking::MinHook::Hook(FortOctopusVehicleDefault, ServerUpdateTowhookFn, AFortOctopusVehicle::ServerUpdateTowhookHook, nullptr, false);
}
Hooking::MinHook::Hook(FindObject<AFortWeaponRangedMountedCannon>(L"/Script/FortniteGame.Default__FortWeaponRangedMountedCannon"),
FindObject<UFunction>("/Script/FortniteGame.FortWeaponRangedMountedCannon.ServerFireActorInCannon"), AFortWeaponRangedMountedCannon::ServerFireActorInCannonHook, nullptr, false);
static auto NetMulticast_Athena_BatchedDamageCuesFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPawn.NetMulticast_Athena_BatchedDamageCues") ? FindObject<UFunction>(L"/Script/FortniteGame.FortPawn.NetMulticast_Athena_BatchedDamageCues") : FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.NetMulticast_Athena_BatchedDamageCues"); static auto NetMulticast_Athena_BatchedDamageCuesFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPawn.NetMulticast_Athena_BatchedDamageCues") ? FindObject<UFunction>(L"/Script/FortniteGame.FortPawn.NetMulticast_Athena_BatchedDamageCues") : FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.NetMulticast_Athena_BatchedDamageCues");
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, NetMulticast_Athena_BatchedDamageCuesFn,
AFortPawn::NetMulticast_Athena_BatchedDamageCuesHook, (PVOID*)&AFortPawn::NetMulticast_Athena_BatchedDamageCuesOriginal, false, true);
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.ServerSendZiplineState"), Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.ServerSendZiplineState"),
AFortPlayerPawn::ServerSendZiplineStateHook, nullptr, false); AFortPlayerPawn::ServerSendZiplineStateHook, nullptr, false);
/* Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") ? FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") : FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.OnCapsuleBeginOverlap"), Hooking::MinHook::Hook((PVOID)GetFunctionIdxOrPtr(FindObject<UFunction>("/Script/FortniteGame.FortPlayerPawn.ServerOnExitVehicle"), true), AFortPlayerPawn::ServerOnExitVehicleHook, (PVOID*)&AFortPlayerPawn::ServerOnExitVehicleOriginal);
AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook, (PVOID*)&AFortPlayerPawnAthena::OnCapsuleBeginOverlapOriginal, false, true); */
bool bNativeHookRemoveFortItemFromPlayer = false;
if (bNativeHookRemoveFortItemFromPlayer)
{
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveFortItemFromPlayer"),
UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook1, nullptr, false);
}
if (Addresses::FrameStep) // put all non rpc exec hooks in this scope if (Addresses::FrameStep) // put all non rpc exec hooks in this scope
{ {
@@ -412,8 +485,20 @@ DWORD WINAPI Main(LPVOID)
UFortKismetLibrary::K2_RemoveItemFromPlayerByGuidHook, (PVOID*)&UFortKismetLibrary::K2_RemoveItemFromPlayerByGuidOriginal, false, true); UFortKismetLibrary::K2_RemoveItemFromPlayerByGuidHook, (PVOID*)&UFortKismetLibrary::K2_RemoveItemFromPlayerByGuidOriginal, false, true);
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveItemFromPlayer"), Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveItemFromPlayer"),
UFortKismetLibrary::K2_RemoveItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveItemFromPlayerOriginal, false, true); UFortKismetLibrary::K2_RemoveItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveItemFromPlayerOriginal, false, true);
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, NetMulticast_Athena_BatchedDamageCuesFn,
AFortPawn::NetMulticast_Athena_BatchedDamageCuesHook, (PVOID*)&AFortPawn::NetMulticast_Athena_BatchedDamageCuesOriginal, false, true);
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>("/Script/FortniteGame.FortPawn.MovingEmoteStopped"),
AFortPawn::MovingEmoteStoppedHook, (PVOID*)&AFortPawn::MovingEmoteStoppedOriginal, false, true);
Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") ? FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawnAthena.OnCapsuleBeginOverlap") : FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerPawn.OnCapsuleBeginOverlap"),
AFortPlayerPawnAthena::OnCapsuleBeginOverlapHook, (PVOID*)&AFortPlayerPawnAthena::OnCapsuleBeginOverlapOriginal, false, true);
if (!bNativeHookRemoveFortItemFromPlayer)
{
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveFortItemFromPlayer"), Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_RemoveFortItemFromPlayer"),
UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveFortItemFromPlayerOriginal, false, true); UFortKismetLibrary::K2_RemoveFortItemFromPlayerHook, (PVOID*)&UFortKismetLibrary::K2_RemoveFortItemFromPlayerOriginal, false, true);
}
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_SpawnPickupInWorld"), Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_SpawnPickupInWorld"),
UFortKismetLibrary::K2_SpawnPickupInWorldHook, (PVOID*)&UFortKismetLibrary::K2_SpawnPickupInWorldOriginal, false, true); UFortKismetLibrary::K2_SpawnPickupInWorldHook, (PVOID*)&UFortKismetLibrary::K2_SpawnPickupInWorldOriginal, false, true);
Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_SpawnPickupInWorldWithLootTier"), Hooking::MinHook::Hook(FortKismetLibraryDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortKismetLibrary.K2_SpawnPickupInWorldWithLootTier"),
@@ -537,13 +622,13 @@ 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::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::GetMaxTickRate, GetMaxTickRateHook); Hooking::MinHook::Hook((PVOID)Addresses::GetMaxTickRate, GetMaxTickRateHook);
// Hooking::MinHook::Hook((PVOID)Addresses::CollectGarbage, (PVOID)CollectGarbageHook, nullptr); // Hooking::MinHook::Hook((PVOID)Addresses::CollectGarbage, (PVOID)CollectGarbageHook, nullptr);
Hooking::MinHook::Hook((PVOID)Addresses::PickTeam, (PVOID)AFortGameModeAthena::Athena_PickTeamHook); Hooking::MinHook::Hook((PVOID)Addresses::PickTeam, (PVOID)AFortGameModeAthena::Athena_PickTeamHook);
// Hooking::MinHook::Hook((PVOID)Addresses::SetZoneToIndex, (PVOID)AFortGameModeAthena::SetZoneToIndexHook, (PVOID*)&AFortGameModeAthena::SetZoneToIndexOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::CompletePickupAnimation, (PVOID)AFortPickup::CompletePickupAnimationHook, (PVOID*)&AFortPickup::CompletePickupAnimationOriginal); Hooking::MinHook::Hook((PVOID)Addresses::CompletePickupAnimation, (PVOID)AFortPickup::CompletePickupAnimationHook, (PVOID*)&AFortPickup::CompletePickupAnimationOriginal);
Hooking::MinHook::Hook((PVOID)Addresses::CanActivateAbility, ReturnTrueHook); // ahhh wtf Hooking::MinHook::Hook((PVOID)Addresses::CanActivateAbility, ReturnTrueHook); // ahhh wtf
@@ -581,7 +666,9 @@ DWORD WINAPI Main(LPVOID)
if (Fortnite_Version >= 13) if (Fortnite_Version >= 13)
Hooking::MinHook::Hook((PVOID)Addresses::SetZoneToIndex, (PVOID)SetZoneToIndexHook, (PVOID*)&SetZoneToIndexOriginal); Hooking::MinHook::Hook((PVOID)Addresses::SetZoneToIndex, (PVOID)SetZoneToIndexHook, (PVOID*)&SetZoneToIndexOriginal);
#ifndef PROD
Hooking::MinHook::Hook((PVOID)Addresses::ProcessEvent, ProcessEventHook, (PVOID*)&UObject::ProcessEventOriginal); Hooking::MinHook::Hook((PVOID)Addresses::ProcessEvent, ProcessEventHook, (PVOID*)&UObject::ProcessEventOriginal);
#endif
AddVehicleHook(); AddVehicleHook();

View File

@@ -191,7 +191,8 @@ static inline std::vector<Event> Events =
{ {
{ {
false, false,
"/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C.PlayConcert" // "/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C.PlayConcert"
"/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C.ServerPlayFestivus"
}, },
0 0
@@ -268,6 +269,24 @@ static inline UFortPlaylist* GetEventPlaylist()
return nullptr; return nullptr;
} }
static inline Event GetOurEvent()
{
for (auto& CurrentEvent : Events)
{
if (CurrentEvent.Version == Fortnite_Version)
{
return CurrentEvent;
}
}
return Event();
}
static inline bool HasEvent()
{
return GetOurEvent().Version == Fortnite_Version;
}
static inline UObject* GetEventScripting() static inline UObject* GetEventScripting()
{ {
Event OurEvent; Event OurEvent;

View File

@@ -368,6 +368,13 @@ static inline uint64 FindGetPlayerViewpoint()
return 0; return 0;
} }
static inline uint64 FindFree()
{
auto addr = Memcury::Scanner::FindPattern("48 85 C9 74 2E 53 48 83 EC 20 48 8B D9").Get();
return addr;
}
static inline uint64 FindStepExplicitProperty() static inline uint64 FindStepExplicitProperty()
{ {
return Memcury::Scanner::FindPattern("41 8B 40 ? 4D 8B C8").Get(); return Memcury::Scanner::FindPattern("41 8B 40 ? 4D 8B C8").Get();
@@ -635,11 +642,20 @@ static inline uint64 FindSetZoneToIndex() // actually StartNewSafeZonePhase
for (int i = 0; i < 100000; i++) for (int i = 0; i < 100000; i++)
{ {
if ((*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x53) || (*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x55)) if ((*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x53)
|| (*(uint8_t*)(uint8_t*)(Addr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x55))
{ {
return Addr - i; return Addr - i;
} }
if (Fortnite_Version < 8)
{
if (*(uint8_t*)(uint8_t*)(Addr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addr - i + 2) == 0x5C)
{
return Addr - i;
}
}
if (*(uint8_t*)(uint8_t*)(Addr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x8B && *(uint8_t*)(uint8_t*)(Addr - i + 2) == 0xC4) if (*(uint8_t*)(uint8_t*)(Addr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x8B && *(uint8_t*)(uint8_t*)(Addr - i + 2) == 0xC4)
{ {
return Addr - i; return Addr - i;
@@ -649,6 +665,41 @@ static inline uint64 FindSetZoneToIndex() // actually StartNewSafeZonePhase
return 0; return 0;
} }
static inline uint64 FindRemoveGadgetData()
{
if (Engine_Version <= 423)
{
auto StringRef = Memcury::Scanner::FindStringRef(L"UFortGadgetItemDefinition::RemoveGadgetData - Removing Gadget Data for Gadget Item [%s]!", false);
if (!StringRef.Get())
StringRef = Memcury::Scanner::FindStringRef(L"UFortGadgetItemDefinition::RemoveGadgetData - Removing Gadget Data for Gadet Item [%s]!");
return FindBytes(StringRef, { 0x40, 0x55 }, 1000, 0, true);
}
if (Engine_Version == 426)
return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 56 41 56 41 57 48 83 EC 30 48 8B 02 48").Get(); // 14.60
return 0;
}
static inline uint64 FindApplyGadgetData()
{
if (Engine_Version >= 420 && Engine_Version <= 422)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 41 0F B6 D9 49 8B").Get(); // 4.1 & 6.21 & 7.40
if (Engine_Version >= 423 && Engine_Version <= 426)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 7C 24 ? 41 54 41 56 41 57 48 83 EC 20 41 0F").Get(); // 8.51 & 12.41
return 0;
}
static inline uint64 FindGetInterfaceAddress()
{
if (Engine_Version <= 420)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 33 FF 48 8B DA 48 8B F1 48").Get(); // 4.1
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 33 DB 48 8B FA 48 8B F1 48 85 D2 0F 84 ? ? ? ? 8B 82 ? ? ? ? C1 E8").Get();
}
static inline uint64 FindCollectGarbage() static inline uint64 FindCollectGarbage()
{ {
// return 0; // return 0;
@@ -1022,7 +1073,7 @@ static inline uint64 FindGIsClient()
bool ShouldBreak = false; bool ShouldBreak = false;
LOG_INFO(LogDev, "[{}] Byte: 0x{:x}", i, (int)CurrentByte); // LOG_INFO(LogDev, "[{}] Byte: 0x{:x}", i, (int)CurrentByte);
for (auto& Bytes : BytesArray) for (auto& Bytes : BytesArray)
{ {
@@ -1040,7 +1091,7 @@ static inline uint64 FindGIsClient()
if (Found) if (Found)
{ {
int Relative = Bytes[0] == 0x44 ? 3 : 2; int Relative = Bytes[0] == 0x44 ? 3 : 2;
LOG_INFO(LogDev, "[{}] No Rel 0x{:x} Rel: 0x{:x}", Skip, Memcury::Scanner(Addr.Get() - i).Get() - __int64(GetModuleHandleW(0)), Memcury::Scanner(Addr.Get() - i).RelativeOffset(Relative).Get() - __int64(GetModuleHandleW(0))); // LOG_INFO(LogDev, "[{}] No Rel 0x{:x} Rel: 0x{:x}", Skip, Memcury::Scanner(Addr.Get() - i).Get() - __int64(GetModuleHandleW(0)), Memcury::Scanner(Addr.Get() - i).RelativeOffset(Relative).Get() - __int64(GetModuleHandleW(0)));
if (Skip > 0) if (Skip > 0)
{ {
@@ -1061,7 +1112,7 @@ static inline uint64 FindGIsClient()
// std::cout << std::format("CurrentByte: 0x{:x}\n", (uint8_t)CurrentByte); // std::cout << std::format("CurrentByte: 0x{:x}\n", (uint8_t)CurrentByte);
} }
LOG_INFO(LogDev, "Addy: 0x{:x}", Addy - __int64(GetModuleHandleW(0))); // LOG_INFO(LogDev, "Addy: 0x{:x}", Addy - __int64(GetModuleHandleW(0)));
return Addy; // 0; // Memcury::Scanner(Addy3).RelativeOffset(2).Get(); return Addy; // 0; // Memcury::Scanner(Addy3).RelativeOffset(2).Get();
@@ -1109,6 +1160,31 @@ static inline uint64 FindGetNetMode()
// return (uintptr_t)GetModuleHandleW(0) + 0x34d2140; // return (uintptr_t)GetModuleHandleW(0) + 0x34d2140;
} }
static inline uint64 FindApplyCharacterCustomization()
{
auto Addrr = Memcury::Scanner::FindStringRef(L"AFortPlayerState::ApplyCharacterCustomization - Failed initialization, using default parts. Player Controller: %s PlayerState: %s, HeroId: %s").Get();
for (int i = 0; i < 1000; i++)
{
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x53)
{
return Addrr - i;
}
/* if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x5C)
{
return Addrr - i;
} */
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x8B && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0xC4)
{
return Addrr - i;
}
}
return 0;
}
static inline uint64 FindRealloc() static inline uint64 FindRealloc()
{ {
if (Engine_Version >= 427) if (Engine_Version >= 427)
@@ -1361,3 +1437,27 @@ static inline uint64 FindCallPreReplication()
return 0; return 0;
} }
static inline uint64 FindClearAbility()
{
auto GiveAbilityAndActivateOnce = FindGiveAbilityAndActivateOnce();
return Memcury::Scanner(GiveAbilityAndActivateOnce).ScanFor({ 0xE8 }, true, 4).RelativeOffset(1).Get();
if (Engine_Version == 416)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 7C 24 ? 41 56 48 83 EC 20 48 63 81 ? ? ? ? 33").Get();
if (Engine_Version == 419)
return Memcury::Scanner::FindPattern("").Get();
if (Engine_Version == 420)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 8B F9 C6 81 ? ? ? ? ? 8B").Get();
if (Engine_Version == 421)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 56 57 41 57 48 83 EC 20 80 89 ? ? ? ? ? 33").Get();
if (Engine_Version == 422)
return Memcury::Scanner::FindPattern("").Get();
if (Engine_Version == 423)
return Memcury::Scanner::FindPattern("40 53 57 41 56 48 83 EC 20 80 89 ? ? ? ? ? 33").Get();
if (Engine_Version == 500)
return Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 68 10 48 89 70 18 48 89 78 20 41 56 48 83 EC 20 80 89 ? ? ? ? ? 48 8B F2 44 8B 89 ? ? ? ? 33 D2 48 8B").Get();
return 0;
}

View File

@@ -1,9 +1,27 @@
#pragma once #pragma once
#include "inc.h"
namespace Globals namespace Globals
{ {
extern inline bool bCreative = false; extern inline bool bCreative = false;
extern inline bool bGoingToPlayEvent = false; extern inline bool bGoingToPlayEvent = false;
extern inline bool bEnableAGIDs = false;
extern inline bool bNoMCP = true; extern inline bool bNoMCP = true;
extern inline bool bLogProcessEvent = false; extern inline bool bLogProcessEvent = false;
extern inline bool bLateGame = false;
extern inline bool bHitReadyToStartMatch = false;
extern inline bool bInitializedPlaylist = false;
extern inline bool bStartedListening = false;
} }
extern inline std::string PlaylistName =
"/Game/Athena/Playlists/Playlist_DefaultSolo.Playlist_DefaultSolo";
// "/Game/Athena/Playlists/gg/Playlist_Gg_Reverse.Playlist_Gg_Reverse";
// "/Game/Athena/Playlists/Playlist_DefaultDuo.Playlist_DefaultDuo";
// "/Game/Athena/Playlists/Playground/Playlist_Playground.Playlist_Playground";
// "/Game/Athena/Playlists/Carmine/Playlist_Carmine.Playlist_Carmine";
// "/Game/Athena/Playlists/Fill/Playlist_Fill_Solo.Playlist_Fill_Solo";
// "/Game/Athena/Playlists/Low/Playlist_Low_Solo.Playlist_Low_Solo";
// "/Game/Athena/Playlists/Bling/Playlist_Bling_Solo.Playlist_Bling_Solo";

847
Project Reboot 3.0/gui.h Normal file
View File

@@ -0,0 +1,847 @@
#pragma once
// TODO: Update ImGUI
#pragma comment(lib, "d3d9.lib")
#include <Windows.h>
#include <dxgi.h>
#include <d3d11.h>
#include <d3d9.h>
#include <ImGui/imgui.h>
#include <ImGui/imgui_impl_dx9.h>
#include <string>
#include <imgui/imgui_impl_win32.h>
#include <imgui/imgui_stdlib.h>
#include <vector>
#include <format>
#include <imgui/imgui_internal.h>
#include <set>
#include <fstream>
#include <olectl.h>
#include "globals.h"
#include "Fonts/ruda-bold.h"
#include "Vector.h"
#include "reboot.h"
#include "FortGameModeAthena.h"
#include "UnrealString.h"
#include "KismetTextLibrary.h"
#include "KismetSystemLibrary.h"
#include "GameplayStatics.h"
#include "Text.h"
#include <Images/reboot_icon.h>
#include "FortGadgetItemDefinition.h"
#include "FortWeaponItemDefinition.h"
#include "events.h"
#define GAME_TAB 1
#define PLAYERS_TAB 2
#define GAMEMODE_TAB 3
#define THANOS_TAB 4
#define EVENT_TAB 5
#define LATEGAME_TAB 6
#define DUMP_TAB 7
#define UNBAN_TAB 8
#define SETTINGS_TAB 9
#define CREDITS_TAB 10
#define MAIN_PLAYERTAB 1
#define INVENTORY_PLAYERTAB 2
#define LOADOUT_PLAYERTAB 4
#define FUN_PLAYERTAB 5
// THE BASE CODE IS FROM IMGUI GITHUB
static LPDIRECT3D9 g_pD3D = NULL;
static LPDIRECT3DDEVICE9 g_pd3dDevice = NULL;
static D3DPRESENT_PARAMETERS g_d3dpp = {};
// Forward declarations of helper functions
bool CreateDeviceD3D(HWND hWnd);
void CleanupDeviceD3D();
void ResetDevice();
LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
std::string wstring_to_utf8(const std::wstring& str)
{
if (str.empty()) return {};
const auto size_needed = WideCharToMultiByte(CP_UTF8, 0, &str[0], static_cast<int>(str.size()), nullptr, 0, nullptr, nullptr);
std::string str_to(size_needed, 0);
WideCharToMultiByte(CP_UTF8, 0, &str[0], static_cast<int>(str.size()), &str_to[0], size_needed, nullptr, nullptr);
return str_to;
}
void InitStyle()
{
ImFontConfig FontConfig;
FontConfig.FontDataOwnedByAtlas = false;
ImGui::GetIO().Fonts->AddFontFromMemoryTTF((void*)ruda_bold_data, sizeof(ruda_bold_data), 17.f, &FontConfig);
// ImGui::GetIO().Fonts->AddFontFromFileTTF("Reboot Resources/fonts/ruda-bold.ttf", 17);
auto& mStyle = ImGui::GetStyle();
mStyle.FramePadding = ImVec2(4, 2);
mStyle.ItemSpacing = ImVec2(6, 2);
mStyle.ItemInnerSpacing = ImVec2(6, 4);
mStyle.Alpha = 0.95f;
mStyle.WindowRounding = 4.0f;
mStyle.FrameRounding = 2.0f;
mStyle.IndentSpacing = 6.0f;
mStyle.ItemInnerSpacing = ImVec2(2, 4);
mStyle.ColumnsMinSpacing = 50.0f;
mStyle.GrabMinSize = 14.0f;
mStyle.GrabRounding = 16.0f;
mStyle.ScrollbarSize = 12.0f;
mStyle.ScrollbarRounding = 16.0f;
ImGuiStyle& style = mStyle;
style.Colors[ImGuiCol_Text] = ImVec4(0.86f, 0.93f, 0.89f, 0.78f);
style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.86f, 0.93f, 0.89f, 0.28f);
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.13f, 0.14f, 0.17f, 1.00f);
style.Colors[ImGuiCol_Border] = ImVec4(0.31f, 0.31f, 1.00f, 0.00f);
style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
style.Colors[ImGuiCol_FrameBg] = ImVec4(0.20f, 0.22f, 0.27f, 1.00f);
style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.92f, 0.18f, 0.29f, 0.78f);
style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.92f, 0.18f, 0.29f, 1.00f);
style.Colors[ImGuiCol_TitleBg] = ImVec4(0.20f, 0.22f, 0.27f, 1.00f);
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.20f, 0.22f, 0.27f, 0.75f);
style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.92f, 0.18f, 0.29f, 1.00f);
style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.20f, 0.22f, 0.27f, 0.47f);
style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.20f, 0.22f, 0.27f, 1.00f);
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.09f, 0.15f, 0.16f, 1.00f);
style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.92f, 0.18f, 0.29f, 0.78f);
style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.92f, 0.18f, 0.29f, 1.00f);
style.Colors[ImGuiCol_CheckMark] = ImVec4(0.71f, 0.22f, 0.27f, 1.00f);
style.Colors[ImGuiCol_SliderGrab] = ImVec4(0.47f, 0.77f, 0.83f, 0.14f);
style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.92f, 0.18f, 0.29f, 1.00f);
style.Colors[ImGuiCol_Button] = ImVec4(0.47f, 0.77f, 0.83f, 0.14f);
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.92f, 0.18f, 0.29f, 0.86f);
style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.92f, 0.18f, 0.29f, 1.00f);
style.Colors[ImGuiCol_Header] = ImVec4(0.92f, 0.18f, 0.29f, 0.76f);
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.92f, 0.18f, 0.29f, 0.86f);
style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.92f, 0.18f, 0.29f, 1.00f);
style.Colors[ImGuiCol_Separator] = ImVec4(0.14f, 0.16f, 0.19f, 1.00f);
style.Colors[ImGuiCol_SeparatorHovered] = ImVec4(0.92f, 0.18f, 0.29f, 0.78f);
style.Colors[ImGuiCol_SeparatorActive] = ImVec4(0.92f, 0.18f, 0.29f, 1.00f);
style.Colors[ImGuiCol_ResizeGrip] = ImVec4(0.47f, 0.77f, 0.83f, 0.04f);
style.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.92f, 0.18f, 0.29f, 0.78f);
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.92f, 0.18f, 0.29f, 1.00f);
style.Colors[ImGuiCol_PlotLines] = ImVec4(0.86f, 0.93f, 0.89f, 0.63f);
style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.92f, 0.18f, 0.29f, 1.00f);
style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.86f, 0.93f, 0.89f, 0.63f);
style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.92f, 0.18f, 0.29f, 1.00f);
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.92f, 0.18f, 0.29f, 0.43f);
style.Colors[ImGuiCol_PopupBg] = ImVec4(0.20f, 0.22f, 0.27f, 0.9f);
}
class Playera
{
public:
std::string Name;
int Kills = 0;
Playera(const std::string& _Name, int _Kills) : Name(_Name), Kills(_Kills) {}
Playera() {}
};
void TextCentered(std::string text, bool bNewLine = true) {
if (bNewLine)
ImGui::NewLine();
float win_width = ImGui::GetWindowSize().x;
float text_width = ImGui::CalcTextSize(text.c_str()).x;
// calculate the indentation that centers the text on one line, relative
// to window left, regardless of the `ImGuiStyleVar_WindowPadding` value
float text_indentation = (win_width - text_width) * 0.5f;
// if text is too long to be drawn on one line, `text_indentation` can
// become too small or even negative, so we check a minimum indentation
float min_indentation = 20.0f;
if (text_indentation <= min_indentation) {
text_indentation = min_indentation;
}
ImGui::SameLine(text_indentation);
ImGui::PushTextWrapPos(win_width - text_indentation);
ImGui::TextWrapped(text.c_str());
ImGui::PopTextWrapPos();
}
bool ButtonCentered(std::string text, bool bNewLine = true) {
if (bNewLine)
ImGui::NewLine();
float win_width = ImGui::GetWindowSize().x;
float text_width = ImGui::CalcTextSize(text.c_str()).x;
// calculate the indentation that centers the text on one line, relative
// to window left, regardless of the `ImGuiStyleVar_WindowPadding` value
float text_indentation = (win_width - text_width) * 0.5f;
// if text is too long to be drawn on one line, `text_indentation` can
// become too small or even negative, so we check a minimum indentation
float min_indentation = 20.0f;
if (text_indentation <= min_indentation) {
text_indentation = min_indentation;
}
ImGui::SameLine(text_indentation);
ImGui::PushTextWrapPos(win_width - text_indentation);
auto res = ImGui::Button(text.c_str());
ImGui::PopTextWrapPos();
return res;
}
void InputVector(const std::string& baseText, FVector* vec)
{
ImGui::InputFloat((baseText + " X").c_str(), &vec->X);
ImGui::InputFloat((baseText + " Y").c_str(), &vec->Y);
ImGui::InputFloat((baseText + " Z").c_str(), &vec->Z);
}
static int Width = 640;
static int Height = 480;
static int Tab = 1;
static int PlayerTab = -1;
static bool bIsEditingInventory = false;
static bool bInformationTab = false;
static int playerTabTab = MAIN_PLAYERTAB;
void MainTabs()
{
// std::ofstream bannedStream(Moderation::Banning::GetFilePath());
if (ImGui::BeginTabBar(""))
{
if (ImGui::BeginTabItem("Game"))
{
Tab = GAME_TAB;
PlayerTab = -1;
bInformationTab = false;
ImGui::EndTabItem();
}
// if (serverStatus == EServerStatus::Up)
{
/* if (ImGui::BeginTabItem("Players"))
{
Tab = PLAYERS_TAB;
ImGui::EndTabItem();
} */
}
if (false && ImGui::BeginTabItem("Gamemode"))
{
Tab = GAMEMODE_TAB;
PlayerTab = -1;
bInformationTab = false;
ImGui::EndTabItem();
}
// if (Events::HasEvent())
if (Globals::bGoingToPlayEvent)
{
if (ImGui::BeginTabItem(("Event")))
{
Tab = EVENT_TAB;
PlayerTab = -1;
bInformationTab = false;
ImGui::EndTabItem();
}
}
if (false && Globals::bLateGame && ImGui::BeginTabItem(("Lategame")))
{
Tab = LATEGAME_TAB;
PlayerTab = -1;
bInformationTab = false;
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Dump"))
{
Tab = DUMP_TAB;
PlayerTab = -1;
bInformationTab = false;
ImGui::EndTabItem();
}
#if 0
if (bannedStream.is_open() && ImGui::BeginTabItem("Unban")) // skunked
{
Tab = UNBAN_TAB;
PlayerTab = -1;
bInformationTab = false;
ImGui::EndTabItem();
}
#endif
/* if (ImGui::BeginTabItem(("Settings")))
{
Tab = SETTINGS_TAB;
PlayerTab = -1;
bInformationTab = false;
ImGui::EndTabItem();
} */
// maybe a Replication Stats for >3.3?
if (false && ImGui::BeginTabItem(("Credits")))
{
Tab = CREDITS_TAB;
PlayerTab = -1;
bInformationTab = false;
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
}
void PlayerTabs()
{
if (ImGui::BeginTabBar(""))
{
if (ImGui::BeginTabItem("Main"))
{
playerTabTab = MAIN_PLAYERTAB;
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(("Inventory")))
{
playerTabTab = INVENTORY_PLAYERTAB;
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(("Cosmetics")))
{
playerTabTab = LOADOUT_PLAYERTAB;
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(("Fun")))
{
playerTabTab = FUN_PLAYERTAB;
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
}
void MainUI()
{
bool bLoaded = true;
if (PlayerTab == -1)
{
MainTabs();
if (Tab == GAME_TAB)
{
if (bLoaded)
{
#ifndef PROD
ImGui::Checkbox("Log ProcessEvent", &Globals::bLogProcessEvent);
#endif
ImGui::Checkbox("Enable AGIDs", &Globals::bEnableAGIDs);
ImGui::Text(std::format("Listening {}", Globals::bStartedListening).c_str());
static std::string ConsoleCommand;
ImGui::InputText("Console command", &ConsoleCommand);
if (ImGui::Button("Execute console command"))
{
auto wstr = std::wstring(ConsoleCommand.begin(), ConsoleCommand.end());
auto aa = wstr.c_str();
FString cmd = aa;
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), cmd, nullptr);
}
if (ImGui::Button("Restart"))
{
if (Engine_Version < 424)
{
FString LevelA = Engine_Version < 424
? L"open Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501
? L"open Asteria_Terrain"
: Globals::bCreative ? L"open Creative_NoApollo_Terrain"
: L"open Artemis_Terrain"
: Globals::bCreative ? L"open Creative_NoApollo_Terrain"
: L"open Apollo_Terrain";
static auto BeaconClass = FindObject<UClass>(L"/Script/FortniteGame.FortOnlineBeaconHost");
auto AllFortBeacons = UGameplayStatics::GetAllActorsOfClass(GetWorld(), BeaconClass);
for (int i = 0; i < AllFortBeacons.Num(); i++)
{
AllFortBeacons.at(i)->K2_DestroyActor();
}
AllFortBeacons.Free();
LOG_INFO(LogDev, "Switching!");
((AGameMode*)GetWorld()->GetGameMode())->RestartGame();
// UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), LevelA, nullptr);
// UGameplayStatics::OpenLevel(GetWorld(), UKismetStringLibrary::Conv_StringToName(LevelA), true, FString());
LOG_INFO(LogGame, "Restarting!");
Globals::bInitializedPlaylist = false;
Globals::bStartedListening = false;
Globals::bHitReadyToStartMatch = false;
AmountOfRestarts++;
}
else
{
LOG_ERROR(LogGame, "Restarting is not supported on chapter 2 and above!");
}
}
if (ImGui::Button("Start Bus Countdown"))
{
auto GameState = ((AGameMode*)GetWorld()->GetGameMode())->GetGameState();
GameState->Get<float>("WarmupCountdownEndTime") = UGameplayStatics::GetTimeSeconds(GetWorld()) + 10;
}
}
}
else if (Tab == PLAYERS_TAB)
{
}
else if (Tab == EVENT_TAB)
{
if (ImGui::Button(std::format("Start {}", GetEventName()).c_str()))
{
StartEvent();
}
}
else if (Tab == DUMP_TAB)
{
ImGui::Text("These will all be in your Win64 folder!");
static std::string FortniteVersionStr = std::format("Fortnite Version {}\n\n", std::to_string(Fortnite_Version));
if (ImGui::Button("Dump Objects"))
{
auto ObjectNum = ChunkedObjects ? ChunkedObjects->Num() : UnchunkedObjects ? UnchunkedObjects->Num() : 0;
std::ofstream obj("ObjectsDump.txt");
obj << FortniteVersionStr;
for (int i = 0; i < ObjectNum; i++)
{
auto CurrentObject = GetObjectByIndex(i);
if (!CurrentObject)
continue;
obj << CurrentObject->GetFullName() << '\n';
}
}
if (ImGui::Button("Dump Skins (Skins.txt)"))
{
std::ofstream SkinsFile("Skins.txt");
if (SkinsFile.is_open())
{
SkinsFile << FortniteVersionStr;
static auto CIDClass = FindObject<UClass>("/Script/FortniteGame.AthenaCharacterItemDefinition");
auto AllObjects = GetAllObjectsOfClass(CIDClass);
for (int i = 0; i < AllObjects.size(); i++)
{
auto CurrentCID = AllObjects.at(i);
static auto DisplayNameOffset = CurrentCID->GetOffset("DisplayName");
FString DisplayNameFStr = UKismetTextLibrary::Conv_TextToString(CurrentCID->Get<FText>(DisplayNameOffset));
if (!DisplayNameFStr.Data.Data)
continue;
SkinsFile << std::format("[{}] {}\n", DisplayNameFStr.ToString(), CurrentCID->GetPathName());
}
}
}
if (ImGui::Button("Dump Playlists (Playlists.txt)"))
{
std::ofstream PlaylistsFile("Playlists.txt");
if (PlaylistsFile.is_open())
{
PlaylistsFile << FortniteVersionStr;
static auto FortPlaylistClass = FindObject<UClass>("/Script/FortniteGame.FortPlaylist");
// static auto FortPlaylistClass = FindObject("Class /Script/FortniteGame.FortPlaylistAthena");
auto AllObjects = GetAllObjectsOfClass(FortPlaylistClass);
for (int i = 0; i < AllObjects.size(); i++)
{
auto Object = AllObjects.at(i);
static auto UIDisplayNameOffset = Object->GetOffset("UIDisplayName");
FString PlaylistNameFStr = UKismetTextLibrary::Conv_TextToString(Object->Get<FText>(UIDisplayNameOffset));
if (!PlaylistNameFStr.Data.Data)
continue;
std::string PlaylistName = PlaylistNameFStr.ToString();
PlaylistsFile << std::format("[{}] {}\n", PlaylistName, Object->GetPathName());
}
}
else
std::cout << "Failed to open playlist file!\n";
}
if (ImGui::Button("Dump Weapons (Weapons.txt)"))
{
std::ofstream WeaponsFile("Weapons.txt");
if (WeaponsFile.is_open())
{
WeaponsFile << FortniteVersionStr;
static auto FortWeaponItemDefinitionClass = FindObject<UClass>("/Script/FortniteGame.FortWeaponItemDefinition");
auto DumpItemDefinitionClass = [&WeaponsFile](UClass* Class) {
auto AllObjects = GetAllObjectsOfClass(Class);
for (int i = 0; i < AllObjects.size(); i++)
{
auto Object = AllObjects.at(i);
static auto DisplayNameOffset = Object->GetOffset("DisplayName");
FString ItemDefinitionFStr = UKismetTextLibrary::Conv_TextToString(Object->Get<FText>(DisplayNameOffset));
if (!ItemDefinitionFStr.Data.Data)
continue;
std::string ItemDefinitionName = ItemDefinitionFStr.ToString();
// check if it contains gallery or playset and just ignore?
WeaponsFile << std::format("[{}] {}\n", ItemDefinitionName, Object->GetPathName());
}
};
DumpItemDefinitionClass(UFortWeaponItemDefinition::StaticClass());
DumpItemDefinitionClass(UFortGadgetItemDefinition::StaticClass());
}
else
std::cout << "Failed to open playlist file!\n";
}
}
else if (Tab == UNBAN_TAB)
{
}
else if (Tab == SETTINGS_TAB)
{
// ImGui::Checkbox("Use custom lootpool (from Win64/lootpool.txt)", &Defines::bCustomLootpool);
}
}
}
void PregameUI()
{
// ImGui::NewLine();
ImGui::Checkbox("No MCP (Don't change unless you know what this is)", &Globals::bNoMCP);
if (Addresses::ClearAbility)
{
ImGui::Checkbox("Enable AGIDs (Don't change unless you know what this is)", &Globals::bEnableAGIDs);
}
if (!Globals::bInitializedPlaylist)
{
if (Engine_Version >= 422 && Engine_Version < 424)
{
ImGui::Checkbox("Creative", &Globals::bCreative);
}
ImGui::Checkbox("Lategame", &Globals::bLateGame);
if (HasEvent())
{
ImGui::Checkbox("Play Event", &Globals::bGoingToPlayEvent);
}
ImGui::InputText("Playlist", &PlaylistName);
}
}
DWORD WINAPI GuiThread(LPVOID)
{
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"RebootClass", NULL };
::RegisterClassEx(&wc);
HWND hwnd = ::CreateWindowExW(0L, wc.lpszClassName, L"Project Reboot", (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX), 100, 100, Width, Height, NULL, NULL, wc.hInstance, NULL);
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, sizeof(reboot_icon_data));
if (!hGlobal)
{
LOG_WARN(LogDev, "Failed to allocate global icon data!");
}
else
{
void* data = GlobalLock(hGlobal);
memcpy(data, reboot_icon_data, sizeof(reboot_icon_data));
GlobalUnlock(hGlobal);
IStream* stream;
HRESULT hr = CreateStreamOnHGlobal(hGlobal, FALSE, &stream);
if (hr != S_OK)
{
// Handle error
}
HBITMAP hBitmap{};
HRESULT hr1 = CoInitialize(NULL);
hr1 = OleLoadPicture(stream, sizeof(reboot_icon_data), FALSE, IID_IPicture, (void**)&hBitmap);
stream->Release();
GlobalFree(hGlobal);
CoUninitialize();
if (hr1 != S_OK)
{
// Handle error
}
// Create the icon from the bitmap
ICONINFO iconInfo{};
iconInfo.fIcon = TRUE;
iconInfo.xHotspot = 0;
iconInfo.yHotspot = 0;
iconInfo.hbmMask = NULL;
iconInfo.hbmColor = hBitmap;
HICON hIcon = CreateIconIndirect(&iconInfo);
SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
// Cleanup the resources
DeleteObject(iconInfo.hbmColor);
}
// HANDLE hIcon = LoadImageW(wc.hInstance, L"Reboot Resources/images/reboot.ico", IMAGE_ICON, 48, 48, LR_LOADFROMFILE);
// SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
// SetWindowLongPtrW(hwnd, GWL_STYLE, WS_POPUP); // Disables windows title bar at the cost of dragging and some quality
// Initialize Direct3D
if (!CreateDeviceD3D(hwnd))
{
CleanupDeviceD3D();
::UnregisterClass(wc.lpszClassName, wc.hInstance);
return 1;
}
// Show the window
::ShowWindow(hwnd, SW_SHOWDEFAULT);
::UpdateWindow(hwnd);
// Setup Dear ImGui context
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
io.IniFilename = NULL; // Disable imgui.ini generation.
io.DisplaySize = ImGui::GetMainViewport()->Size;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
// io.Fonts->AddFontFromFileTTF("../vendor/fonts/Aller_Bd.ttf", 17);
// Setup Dear ImGui style
InitStyle();
// Setup Platform/Renderer backends
ImGui_ImplWin32_Init(hwnd);
ImGui_ImplDX9_Init(g_pd3dDevice);
// Our state
bool show_demo_window = true;
bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
ImFontConfig config;
config.MergeMode = true;
config.GlyphMinAdvanceX = 13.0f; // Use if you want to make the icon monospaced
// static const ImWchar icon_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
// io.Fonts->AddFontFromFileTTF("Reboot Resources/fonts/fontawesome-webfont.ttf", 13.0f, &config, icon_ranges);
bool done = false;
while (!done)
{
MSG msg;
while (::PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
if (msg.message == WM_QUIT)
{
// done = true;
break;
}
}
ImGui_ImplDX9_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
auto WindowSize = ImGui::GetMainViewport()->Size;
// ImGui::SetNextWindowPos(ImVec2(WindowSize.x * 0.5f, WindowSize.y * 0.5f), ImGuiCond_Always, ImVec2(0.5f, 0.5f)); // Center
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
tagRECT rect;
if (GetWindowRect(hwnd, &rect))
{
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
ImGui::SetNextWindowSize(ImVec2(width, height), ImGuiCond_Always);
}
if (!ImGui::IsWindowCollapsed())
{
ImGui::Begin("Project Reboot 3.0", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar);
Globals::bInitializedPlaylist ? MainUI() : PregameUI();
ImGui::End();
}
// Rendering
ImGui::EndFrame();
g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
g_pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
D3DCOLOR clear_col_dx = D3DCOLOR_RGBA((int)(clear_color.x * clear_color.w * 255.0f), (int)(clear_color.y * clear_color.w * 255.0f), (int)(clear_color.z * clear_color.w * 255.0f), (int)(clear_color.w * 255.0f));
g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, clear_col_dx, 1.0f, 0);
if (g_pd3dDevice->BeginScene() >= 0)
{
ImGui::Render();
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
g_pd3dDevice->EndScene();
}
HRESULT result = g_pd3dDevice->Present(NULL, NULL, NULL, NULL);
// Handle loss of D3D9 device
if (result == D3DERR_DEVICELOST && g_pd3dDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET)
ResetDevice();
}
ImGui_ImplDX9_Shutdown();
ImGui_ImplWin32_Shutdown();
ImGui::DestroyContext();
CleanupDeviceD3D();
::DestroyWindow(hwnd);
::UnregisterClass(wc.lpszClassName, wc.hInstance);
return 0;
}
// Helper functions
bool CreateDeviceD3D(HWND hWnd)
{
if ((g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)
return false;
// Create the D3DDevice
ZeroMemory(&g_d3dpp, sizeof(g_d3dpp));
g_d3dpp.Windowed = TRUE;
g_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
g_d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; // Need to use an explicit format with alpha if needing per-pixel alpha composition.
g_d3dpp.EnableAutoDepthStencil = TRUE;
g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // Present with vsync
//g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Present without vsync, maximum unthrottled framerate
if (g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0)
return false;
return true;
}
void CleanupDeviceD3D()
{
if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
if (g_pD3D) { g_pD3D->Release(); g_pD3D = NULL; }
}
void ResetDevice()
{
ImGui_ImplDX9_InvalidateDeviceObjects();
HRESULT hr = g_pd3dDevice->Reset(&g_d3dpp);
if (hr == D3DERR_INVALIDCALL)
IM_ASSERT(0);
ImGui_ImplDX9_CreateDeviceObjects();
}
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// my implementation of window dragging..
/* {
static int dababy = 0;
if (dababy > 100) // wait until gui is initialized ig?
{
if (ImGui::IsMouseDragging(ImGuiMouseButton(0)))
{
// if (LOWORD(lParam) > 255 && HIWORD(lParam) > 255)
{
POINT p;
GetCursorPos(&p);
SetWindowPos(hWnd, nullptr, p.x, p.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
}
}
dababy++;
} */
if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam))
return true;
switch (msg)
{
case WM_SIZE:
if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
{
g_d3dpp.BackBufferWidth = LOWORD(lParam);
g_d3dpp.BackBufferHeight = HIWORD(lParam);
ResetDevice();
}
return 0;
case WM_SYSCOMMAND:
if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu
return 0;
break;
case WM_DESTROY:
::PostQuitMessage(0);
return 0;
}
return ::DefWindowProc(hWnd, msg, wParam, lParam);
}

Some files were not shown because too many files have changed in this diff Show More