Skip to content

Commit

Permalink
Plugins: Add additional FProperty functions
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Jun 16, 2024
1 parent 921163c commit 4643b85
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
9 changes: 8 additions & 1 deletion include/uevr/API.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SOFTWARE.
#define UEVR_OUT

#define UEVR_PLUGIN_VERSION_MAJOR 2
#define UEVR_PLUGIN_VERSION_MINOR 20
#define UEVR_PLUGIN_VERSION_MINOR 21
#define UEVR_PLUGIN_VERSION_PATCH 0

#define UEVR_RENDERER_D3D11 0
Expand Down Expand Up @@ -282,12 +282,19 @@ typedef struct {

typedef struct {
int (*get_offset)(UEVR_FPropertyHandle prop);
unsigned long long (*get_property_flags)(UEVR_FPropertyHandle prop);
bool (*is_param)(UEVR_FPropertyHandle prop);
bool (*is_out_param)(UEVR_FPropertyHandle prop);
bool (*is_return_param)(UEVR_FPropertyHandle prop);
bool (*is_reference_param)(UEVR_FPropertyHandle prop);
bool (*is_pod)(UEVR_FPropertyHandle prop);
} UEVR_FPropertyFunctions;

typedef struct {
UEVR_UStructHandle (*get_super_struct)(UEVR_UStructHandle klass);
UEVR_FFieldHandle (*get_child_properties)(UEVR_UStructHandle klass);
UEVR_UFunctionHandle (*find_function)(UEVR_UStructHandle klass, const wchar_t* name);
UEVR_FPropertyHandle (*find_property)(UEVR_UStructHandle klass, const wchar_t* name);
} UEVR_UStructFunctions;

typedef struct {
Expand Down
30 changes: 30 additions & 0 deletions include/uevr/API.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,36 @@ class API {
return fn(to_handle());
}

uint64_t get_property_flags() const {
static const auto fn = initialize()->get_property_flags;
return fn(to_handle());
}

bool is_param() const {
static const auto fn = initialize()->is_param;
return fn(to_handle());
}

bool is_out_param() const {
static const auto fn = initialize()->is_out_param;
return fn(to_handle());
}

bool is_return_param() const {
static const auto fn = initialize()->is_return_param;
return fn(to_handle());
}

bool is_reference_param() const {
static const auto fn = initialize()->is_reference_param;
return fn(to_handle());
}

bool is_pod() const {
static const auto fn = initialize()->is_pod;
return fn(to_handle());
}

private:
static inline const UEVR_FPropertyFunctions* s_functions{nullptr};
static inline const UEVR_FPropertyFunctions* initialize() {
Expand Down
20 changes: 19 additions & 1 deletion src/mods/PluginLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,27 @@ UEVR_FFieldFunctions g_ffield_functions {

UEVR_FPropertyFunctions g_fproperty_functions {
// get_offset
[](UEVR_FPropertyHandle prop) -> int {
.get_offset = [](UEVR_FPropertyHandle prop) -> int {
return FPROPERTY(prop)->get_offset();
},
.get_property_flags = [](UEVR_FPropertyHandle prop) -> uint64_t {
return FPROPERTY(prop)->get_property_flags();
},
.is_param = [](UEVR_FPropertyHandle prop) -> bool {
return FPROPERTY(prop)->is_param();
},
.is_out_param = [](UEVR_FPropertyHandle prop) -> bool {
return FPROPERTY(prop)->is_out_param();
},
.is_return_param = [](UEVR_FPropertyHandle prop) -> bool {
return FPROPERTY(prop)->is_return_param();
},
.is_reference_param = [](UEVR_FPropertyHandle prop) -> bool {
return FPROPERTY(prop)->is_reference_param();
},
.is_pod = [](UEVR_FPropertyHandle prop) -> bool {
return FPROPERTY(prop)->is_pod();
},
};

#define USTRUCT(x) ((sdk::UStruct*)x)
Expand Down

0 comments on commit 4643b85

Please sign in to comment.