diff --git a/include/uevr/API.h b/include/uevr/API.h index 4ec1ce98..d5e6d22d 100644 --- a/include/uevr/API.h +++ b/include/uevr/API.h @@ -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 @@ -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); @@ -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; @@ -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); diff --git a/include/uevr/API.hpp b/include/uevr/API.hpp index 9aabf41a..667a1c82 100644 --- a/include/uevr/API.hpp +++ b/include/uevr/API.hpp @@ -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; } diff --git a/src/mods/PluginLoader.cpp b/src/mods/PluginLoader.cpp index de6f451c..6a54a35c 100644 --- a/src/mods/PluginLoader.cpp +++ b/src/mods/PluginLoader.cpp @@ -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, @@ -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 {