Skip to content

Commit

Permalink
Merge branch 'master' into lua-api
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Jun 17, 2024
2 parents a88cab3 + 0c14e9c commit 5b07a66
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
4 changes: 3 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 22
#define UEVR_PLUGIN_VERSION_MINOR 23
#define UEVR_PLUGIN_VERSION_PATCH 0

#define UEVR_RENDERER_D3D11 0
Expand Down Expand Up @@ -296,6 +296,8 @@ typedef struct {
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);
int (*get_properties_size)(UEVR_UStructHandle klass); /* size in bytes */
int (*get_min_alignment)(UEVR_UStructHandle klass);
} UEVR_UStructFunctions;

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

int32_t get_properties_size() const {
static const auto fn = initialize()->get_properties_size;
return fn(to_handle());
}

int32_t get_min_alignment() const {
static const auto fn = initialize()->get_min_alignment;
return fn(to_handle());
}

private:
static inline const UEVR_UStructFunctions* s_functions{nullptr};
inline static const UEVR_UStructFunctions* initialize() {
Expand Down
18 changes: 10 additions & 8 deletions src/mods/PluginLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,22 +427,24 @@ UEVR_FPropertyFunctions g_fproperty_functions {
#define USTRUCT(x) ((sdk::UStruct*)x)

UEVR_UStructFunctions g_ustruct_functions {
// get_super_struct
[](UEVR_UStructHandle strct) {
.get_super_struct = [](UEVR_UStructHandle strct) {
return (UEVR_UStructHandle)USTRUCT(strct)->get_super_struct();
},
// get_child_properties
[](UEVR_UStructHandle strct) {
.get_child_properties = [](UEVR_UStructHandle strct) {
return (UEVR_FFieldHandle)USTRUCT(strct)->get_child_properties();
},
// find_function
[](UEVR_UStructHandle strct, const wchar_t* name) {
.find_function = [](UEVR_UStructHandle strct, const wchar_t* name) {
return (UEVR_UFunctionHandle)USTRUCT(strct)->find_function(name);
},
// find_property
[](UEVR_UStructHandle strct, const wchar_t* name) {
.find_property = [](UEVR_UStructHandle strct, const wchar_t* name) {
return (UEVR_FPropertyHandle)USTRUCT(strct)->find_property(name);
},
.get_properties_size = [](UEVR_UStructHandle strct) {
return USTRUCT(strct)->get_properties_size();
},
.get_min_alignment = [](UEVR_UStructHandle strct) {
return USTRUCT(strct)->get_min_alignment();
}
};

#define UCLASS(x) ((sdk::UClass*)x)
Expand Down

0 comments on commit 5b07a66

Please sign in to comment.