Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AsaApi/Core/Private/UE/UE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ ARK_API FProperty* UObject::FindProperty(FName name)
return Property;
}
return nullptr;
}
}
7 changes: 7 additions & 0 deletions AsaApi/Core/Public/API/ARK/GameMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,13 @@ struct UPrimalGlobals : UObject

struct FMapData
{
UE4_SizeOf(128);

FMapData()
{
UE4_CheckSize(FMapData);
NativeCall<void>(this, "FMapData.FMapData()");
}
// Fields

FString& MapNameField() { return *GetNativePointerField<FString*>(this, "FMapData.MapName"); }
Expand Down
29 changes: 28 additions & 1 deletion AsaApi/Core/Public/API/ARK/Other.h
Original file line number Diff line number Diff line change
Expand Up @@ -1900,10 +1900,35 @@ struct FItemMultiplier
static UScriptStruct* StaticStruct() { return NativeCall<UScriptStruct*>(nullptr, "FItemMultiplier.StaticStruct()"); }
};

#define UE4_SizeOf(size) \
constexpr static std::size_t size_of = size; \
char storage[size_of] = { 0 };

#define UE4_CheckSize(Name) \
{ \
const std::ptrdiff_t size_diff = size_of - GetStructSize<Name>(); \
if(size_diff < 0) \
{ \
Log::GetLog()->critical(#Name" will overrun ({} bytes smaller), please report this.", std::abs(size_diff)); \
throw std::overflow_error(#Name" is not sufficiently sized."); \
} \
if (size_diff > 0) \
{ \
Log::GetLog()->warn(#Name" exceeds real size ({} bytes larger), please report this.", std::abs(size_diff)); \
throw std::underflow_error(#Name" is not sufficiently sized."); \
} \
}


struct FItemNetInfo
{
UE4_SizeOf(528);
FItemNetInfo()
{
UE4_CheckSize(FItemNetInfo);
NativeCall<void>(this, "FItemNetInfo.FItemNetInfo()");
}
// Fields

TSubclassOf<UPrimalItem>& ItemArchetypeField() { return *GetNativePointerField<TSubclassOf<UPrimalItem>*>(this, "FItemNetInfo.ItemArchetype"); }
FItemNetID& ItemIDField() { return *GetNativePointerField<FItemNetID*>(this, "FItemNetInfo.ItemID"); }
unsigned int& ItemQuantityField() { return *GetNativePointerField<unsigned int*>(this, "FItemNetInfo.ItemQuantity"); }
Expand Down Expand Up @@ -1976,6 +2001,8 @@ struct FItemNetInfo
bool NetSerialize(FArchive* Ar, UPackageMap* Map, bool* bOutSuccess) { return NativeCall<bool, FArchive*, UPackageMap*, bool*>(this, "FItemNetInfo.NetSerialize(FArchive&,UPackageMap*,bool&)", Ar, Map, bOutSuccess); }
};



struct FItemSetup
{
// Fields
Expand Down
6 changes: 6 additions & 0 deletions AsaApi/Core/Public/API/ARK/UE.h
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,12 @@ int GetStructSize()
// Credits to Substitute#0001 for the idea
int size = 0;
UScriptStruct* staticStruct = T::StaticStruct();

size = staticStruct ? staticStruct->PropertiesSizeField() : 0;

printf("The size of this struct is %d bytes.", size);
return size;

if (staticStruct)
{
return staticStruct->PropertiesSizeField();
Expand Down
5 changes: 5 additions & 0 deletions AsaApi/Core/Public/API/UE/Math/Rotator.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,11 @@ struct TRotator
explicit TRotator(const TRotator<FArg>& From) : TRotator<T>((T)From.Pitch, (T)From.Yaw, (T)From.Roll) {}
};


template<typename T>
inline const TRotator<T> TRotator<T>::ZeroRotator = { 0,0,0 };


#if !defined(_MSC_VER) || defined(__clang__) // MSVC can't forward declare explicit specializations
template<> const FRotator3f FRotator3f::ZeroRotator;
template<> const FRotator3d FRotator3d::ZeroRotator;
Expand Down
36 changes: 35 additions & 1 deletion AsaApi/Core/Public/API/UE/Math/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct TVector
};

/** A zero vector (0,0,0) */
static const TVector<T> ZeroVector;
static const TVector<T> ZeroVector;

/** One vector (1,1,1) */
static const TVector<T> OneVector;
Expand Down Expand Up @@ -1184,6 +1184,40 @@ struct TVector
explicit TVector(const TVector<FArg>& From) : TVector<T>((T)From.X, (T)From.Y, (T)From.Z) {}
};


template<typename T>
inline const TVector<T> TVector<T>::ZeroVector = { 0,0,0 };

template<typename T>
inline const TVector<T> TVector<T>::OneVector = { 1,1,1 };

template<typename T>
inline const TVector<T> TVector<T>::UpVector = { 0,0,1 };

template<typename T>
inline const TVector<T> TVector<T>::DownVector = { 0,0,-1 };

template<typename T>
inline const TVector<T> TVector<T>::ForwardVector = { 1,0,0 };

template<typename T>
inline const TVector<T> TVector<T>::BackwardVector = { -1,0,0 };

template<typename T>
inline const TVector<T> TVector<T>::RightVector = { 0,1,0 };

template<typename T>
inline const TVector<T> TVector<T>::LeftVector = { 0,-1,0 };

template<typename T>
inline const TVector<T> TVector<T>::XAxisVector = { 1,0,0 };

template<typename T>
inline const TVector<T> TVector<T>::YAxisVector = { 0,1,0 };

template<typename T>
inline const TVector<T> TVector<T>::ZAxisVector = { 0,0,1 };

/**
* Structured archive slot serializer for FVector3f.
*
Expand Down
Loading