Skip to content

Commit

Permalink
SDK: Property stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Jul 9, 2023
1 parent 5cb62e5 commit 9ddae4e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions shared/sdk/FProperty.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <spdlog/spdlog.h>

#include "UProperty.hpp"
#include "FProperty.hpp"

namespace sdk {
Expand All @@ -26,6 +27,11 @@ void FProperty::bruteforce_fproperty_offset(FProperty* x_prop, FProperty* y_prop
SPDLOG_INFO("[FProperty] Found offset field at offset 0x{:X}", i);
s_offset_offset = i;
found = true;

if (FField::s_uses_ufield_only) {
UProperty::s_offset_offset = i;
}

break;
}
} catch(...) {
Expand Down
3 changes: 3 additions & 0 deletions shared/sdk/FProperty.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "FField.hpp"

namespace sdk {
class UProperty;

class FProperty : public FField {
public:
int32_t get_offset() const {
Expand All @@ -19,5 +21,6 @@ class FProperty : public FField {
static inline uint32_t s_offset_offset{0x0}; // idk

friend class UStruct;
friend class UProperty;
};
}
8 changes: 8 additions & 0 deletions shared/sdk/UProperty.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@
#include "UClass.hpp"

namespace sdk {
class FProperty;

class UProperty : public UField {
public:
static UClass* static_class();
static void update_offsets();

int32_t get_offset() const {
return *(int32_t*)((uintptr_t)this + s_offset_offset);
}

private:
static inline bool s_attempted_update_offsets{false};
static inline uint32_t s_offset_offset{0x0};

friend class UStruct;
friend class FProperty;
};
}

0 comments on commit 9ddae4e

Please sign in to comment.