Skip to content

Commit 66bde67

Browse files
committed
Removed invalid GiveItem overload and added way to iterate Global objects array
1 parent 44d5764 commit 66bde67

4 files changed

Lines changed: 75 additions & 11 deletions

File tree

version/Core/Public/API/ARK/Actor.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2760,8 +2760,7 @@ struct AShooterPlayerController : ABasePlayerController
27602760
void ClientShowCharacterCreationUI_Implementation(bool bShowDownloadCharacter) { NativeCall<void, bool>(this, "AShooterPlayerController.ClientShowCharacterCreationUI_Implementation", bShowDownloadCharacter); }
27612761
AActor* SpawnActor(FString* blueprintPath, float spawnDistance, float spawnYOffset, float ZOffset, bool bDoDeferBeginPlay) { return NativeCall<AActor*, FString*, float, float, float, bool>(this, "AShooterPlayerController.SpawnActor", blueprintPath, spawnDistance, spawnYOffset, ZOffset, bDoDeferBeginPlay); }
27622762
bool GiveItem(TArray<UPrimalItem*>* outItems, FString* blueprintPath, int quantityOverride, float qualityOverride, bool bForceBlueprint, bool bAutoEquip, float MinRandomQuality) { return NativeCall<bool, TArray<UPrimalItem*>*, FString*, int, float, bool, bool, float>(this, "AShooterPlayerController.GiveItem", outItems, blueprintPath, quantityOverride, qualityOverride, bForceBlueprint, bAutoEquip, MinRandomQuality); }
2763-
bool GiveItem(FString* blueprintPath, int quantityOverride, float qualityOverride, bool bForceBlueprint, bool bAutoEquip, float MinRandomQuality) { return NativeCall<bool, FString*, int, float, bool, bool, float>(this, "AShooterPlayerController.GiveItem", blueprintPath, quantityOverride, qualityOverride, bForceBlueprint, bAutoEquip, MinRandomQuality); }
2764-
bool GiveFast(FName* blueprintPath, int quantityOverride, float qualityOverride, bool bForceBlueprint, float MinRandomQuality) { return NativeCall<bool, FName*, int, float, bool, float>(this, "AShooterPlayerController.GiveFast", blueprintPath, quantityOverride, qualityOverride, bForceBlueprint, MinRandomQuality); }
2763+
bool GiveFast(FName* blueprintPath, int quantityOverride, float qualityOverride, bool bForceBlueprint, float MinRandomQuality) { return NativeCall<bool, FName*, int, float, bool, float>(this, "AShooterPlayerController.GiveFast", blueprintPath, quantityOverride, qualityOverride, bForceBlueprint, MinRandomQuality); }
27652764
bool GiveSlotItem(FString* blueprintPath, int slotNum, int quantityOverride) { return NativeCall<bool, FString*, int, int>(this, "AShooterPlayerController.GiveSlotItem", blueprintPath, slotNum, quantityOverride); }
27662765
bool GiveSlotItemNum(int masterIndexNum, int slotNum, int quantityOverride) { return NativeCall<bool, int, int, int>(this, "AShooterPlayerController.GiveSlotItemNum", masterIndexNum, slotNum, quantityOverride); }
27672766
bool GiveItemNum(int masterIndexNum, int quantityOverride, float qualityOverride, bool bForceBlueprint) { return NativeCall<bool, int, int, float, bool>(this, "AShooterPlayerController.GiveItemNum", masterIndexNum, quantityOverride, qualityOverride, bForceBlueprint); }
@@ -3551,6 +3550,7 @@ struct APrimalCharacter : ACharacter
35513550
float& ReplicatedCurrentTorporField() { return *GetNativePointerField<float*>(this, "APrimalCharacter.ReplicatedCurrentTorpor"); }
35523551
float& ReplicatedMaxTorporField() { return *GetNativePointerField<float*>(this, "APrimalCharacter.ReplicatedMaxTorpor"); }
35533552
AShooterCharacter * LastGrapHookPullingOwnerField() { return *GetNativePointerField<AShooterCharacter**>(this, "APrimalCharacter.LastGrapHookPullingOwner"); }
3553+
AActor*& LastGrapHookPullingMeField() { return *GetNativePointerField<AActor**>(this, "APrimalCharacter.LastGrapHookPullingMe"); }
35543554
FVector & DragOffsetField() { return *GetNativePointerField<FVector*>(this, "APrimalCharacter.DragOffset"); }
35553555
long double& LastIkUpdateTimeField() { return *GetNativePointerField<long double*>(this, "APrimalCharacter.LastIkUpdateTime"); }
35563556
long double& LastUpdatedAimOffsetsTimeField() { return *GetNativePointerField<long double*>(this, "APrimalCharacter.LastUpdatedAimOffsetsTime"); }
@@ -8048,7 +8048,12 @@ struct AMatineeActor : AActor
80488048
static UClass* GetPrivateStaticClass(const wchar_t* Package) { return NativeCall<UClass*, const wchar_t*>(nullptr, "AMatineeActor.GetPrivateStaticClass", Package); }
80498049
};
80508050

8051-
struct UCharacterMovementComponent
8051+
struct UMovementComponent : UActorComponent
8052+
{
8053+
FVector& VelocityField() { return *GetNativePointerField<FVector*>(this, "UMovementComponent.Velocity"); }
8054+
};
8055+
8056+
struct UCharacterMovementComponent : UMovementComponent
80528057
{
80538058
ACharacter * CharacterOwnerField() { return *GetNativePointerField<ACharacter**>(this, "UCharacterMovementComponent.CharacterOwner"); }
80548059
float& MaxStepHeightField() { return *GetNativePointerField<float*>(this, "UCharacterMovementComponent.MaxStepHeight"); }

version/Core/Public/API/ARK/Enums.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5910,14 +5910,6 @@ enum class EScrollDirection
59105910
Scroll_Up = 0x1,
59115911
};
59125912

5913-
namespace FUObjectArray
5914-
{
5915-
enum ESerialNumberConstants
5916-
{
5917-
START_SERIAL_NUMBER = 0x3e8,
5918-
};
5919-
}
5920-
59215913
enum class EAngularConstraintMotion
59225914
{
59235915
ACM_Free = 0x0,
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
class FUObjectItem
3+
{
4+
public:
5+
UObject* Object;
6+
int SerialNumber;
7+
};
8+
9+
class FChunkedFixedUObjectArray
10+
{
11+
public:
12+
enum
13+
{
14+
ElementsPerChunk = 64 * 1024
15+
};
16+
17+
FUObjectItem& GetByIndex(int Index)
18+
{
19+
return *GetObjectPtr(Index);
20+
}
21+
22+
FUObjectItem* GetObjectPtr(int Index)
23+
{
24+
auto ChunkIndex = Index / ElementsPerChunk;
25+
auto WithinChunkIndex = Index % ElementsPerChunk;
26+
auto Chunk = Objects[ChunkIndex];
27+
return Chunk + WithinChunkIndex;
28+
}
29+
30+
FUObjectItem** Objects;
31+
FUObjectItem* PreAllocatedObjects;
32+
int MaxElements;
33+
int NumElements;
34+
int MaxChunks;
35+
int NumChunks;
36+
};
37+
38+
class FUObjectArray
39+
{
40+
public:
41+
int ObjFirstGCIndex;
42+
int ObjLastNonGCIndex;
43+
int MaxObjectsNotConsideredByGC;
44+
bool OpenForDisregardForGC;
45+
FChunkedFixedUObjectArray ObjObjects;
46+
};

version/Core/Public/API/UE/UE.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "API/Fields.h"
1212
#include "API/Enums.h"
1313
#include "API/UE/Math/Color.h"
14+
#include "Misc/GlobalObjectsArray.h"
1415

1516
// Base types
1617

@@ -563,6 +564,26 @@ struct Globals
563564
}
564565

565566
static DataValue<UEngine*> GEngine() { return { "Global.GEngine" }; }
567+
568+
static DataValue<FUObjectArray> GUObjectArray() { return { "Global.GUObjectArray" }; }
569+
570+
static FORCEINLINE UClass* FindClass(const std::string& name)
571+
{
572+
for (auto i = 0; i < Globals::GUObjectArray()().ObjObjects.NumElements; i++)
573+
{
574+
auto obj = Globals::GUObjectArray()().ObjObjects.GetObjectPtr(i)->Object;
575+
if (obj != nullptr)
576+
{
577+
FString full_name;
578+
obj->GetFullName(&full_name, nullptr);
579+
if (name == full_name.ToString())
580+
{
581+
return (UClass*)obj;
582+
}
583+
}
584+
}
585+
return nullptr;
586+
}
566587
};
567588

568589
template <>

0 commit comments

Comments
 (0)