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 16, 2024
2 parents 2ba4fe9 + 11fa136 commit f06754d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
8 changes: 7 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 21
#define UEVR_PLUGIN_VERSION_MINOR 22
#define UEVR_PLUGIN_VERSION_PATCH 0

#define UEVR_RENDERER_D3D11 0
Expand Down Expand Up @@ -76,6 +76,7 @@ DECLARE_UEVR_HANDLE(UEVR_TArrayHandle);
DECLARE_UEVR_HANDLE(UEVR_FMallocHandle);
DECLARE_UEVR_HANDLE(UEVR_FRHITexture2DHandle);
DECLARE_UEVR_HANDLE(UEVR_UScriptStructHandle);
DECLARE_UEVR_HANDLE(UEVR_FArrayPropertyHandle);

/* OpenXR stuff */
DECLARE_UEVR_HANDLE(UEVR_XrInstance);
Expand Down Expand Up @@ -392,6 +393,10 @@ typedef struct {
int (*get_struct_size)(UEVR_UScriptStructHandle script_struct);
} UEVR_UScriptStructFunctions;

typedef struct {
UEVR_FPropertyHandle (*get_inner)(UEVR_FArrayPropertyHandle prop);
} UEVR_FArrayPropertyFunctions;

typedef struct {
const UEVR_SDKFunctions* functions;
const UEVR_SDKCallbacks* callbacks;
Expand All @@ -411,6 +416,7 @@ typedef struct {
const UEVR_FFakeStereoRenderingHookFunctions* stereo_hook;
const UEVR_FRHITexture2DFunctions* frhitexture2d;
const UEVR_UScriptStructFunctions* uscriptstruct;
const UEVR_FArrayPropertyFunctions* farrayproperty;
} UEVR_SDKData;

DECLARE_UEVR_HANDLE(UEVR_IVRSystem);
Expand Down
20 changes: 20 additions & 0 deletions include/uevr/API.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,26 @@ class API {
}
};

struct FArrayProperty : public FProperty {
inline UEVR_FArrayPropertyHandle to_handle() { return (UEVR_FArrayPropertyHandle)this; }
inline UEVR_FArrayPropertyHandle to_handle() const { return (UEVR_FArrayPropertyHandle)this; }

FProperty* get_inner() const {
static const auto fn = initialize()->get_inner;
return (FProperty*)fn(to_handle());
}

private:
static inline const UEVR_FArrayPropertyFunctions* s_functions{nullptr};
static inline const UEVR_FArrayPropertyFunctions* initialize() {
if (s_functions == nullptr) {
s_functions = API::get()->sdk()->farrayproperty;
}

return s_functions;
}
};

struct FFieldClass {
inline UEVR_FFieldClassHandle to_handle() { return (UEVR_FFieldClassHandle)this; }
inline UEVR_FFieldClassHandle to_handle() const { return (UEVR_FFieldClassHandle)this; }
Expand Down
9 changes: 8 additions & 1 deletion src/mods/PluginLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,12 @@ UEVR_FMallocFunctions g_malloc_functions {
uevr::malloc::free
};

UEVR_FArrayPropertyFunctions g_farray_property_functions {
.get_inner = [](UEVR_FArrayPropertyHandle prop) -> UEVR_FPropertyHandle {
return (UEVR_FPropertyHandle)((sdk::FArrayProperty*)prop)->get_inner();
}
};

UEVR_SDKData g_sdk_data {
&g_sdk_functions,
&g_sdk_callbacks,
Expand All @@ -819,7 +825,8 @@ UEVR_SDKData g_sdk_data {
&uevr::render_target_pool_hook::functions,
&uevr::stereo_hook::functions,
&uevr::frhitexture2d::functions,
&uevr::uscriptstruct::functions
&uevr::uscriptstruct::functions,
&g_farray_property_functions
};

namespace uevr {
Expand Down

0 comments on commit f06754d

Please sign in to comment.