diff --git a/include/uevr/API.h b/include/uevr/API.h index 8d1f918c..48fa6e62 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 24 +#define UEVR_PLUGIN_VERSION_MINOR 25 #define UEVR_PLUGIN_VERSION_PATCH 0 #define UEVR_RENDERER_D3D11 0 @@ -78,6 +78,7 @@ DECLARE_UEVR_HANDLE(UEVR_FRHITexture2DHandle); DECLARE_UEVR_HANDLE(UEVR_UScriptStructHandle); DECLARE_UEVR_HANDLE(UEVR_FArrayPropertyHandle); DECLARE_UEVR_HANDLE(UEVR_FBoolPropertyHandle); +DECLARE_UEVR_HANDLE(UEVR_FStructPropertyHandle); /* OpenXR stuff */ DECLARE_UEVR_HANDLE(UEVR_XrInstance); @@ -411,6 +412,10 @@ typedef struct { void (*set_value_in_propbase)(UEVR_FBoolPropertyHandle prop, void* addr, bool value); } UEVR_FBoolPropertyFunctions; +typedef struct { + UEVR_UScriptStructHandle (*get_struct)(UEVR_FStructPropertyHandle prop); +} UEVR_FStructPropertyFunctions; + typedef struct { const UEVR_SDKFunctions* functions; const UEVR_SDKCallbacks* callbacks; @@ -432,6 +437,7 @@ typedef struct { const UEVR_UScriptStructFunctions* uscriptstruct; const UEVR_FArrayPropertyFunctions* farrayproperty; const UEVR_FBoolPropertyFunctions* fboolproperty; + const UEVR_FStructPropertyFunctions* fstructproperty; } UEVR_SDKData; DECLARE_UEVR_HANDLE(UEVR_IVRSystem); diff --git a/include/uevr/API.hpp b/include/uevr/API.hpp index a774c6fd..51f2750d 100644 --- a/include/uevr/API.hpp +++ b/include/uevr/API.hpp @@ -722,6 +722,26 @@ class API { } }; + struct FStructProperty : public FProperty { + inline UEVR_FStructPropertyHandle to_handle() { return (UEVR_FStructPropertyHandle)this; } + inline UEVR_FStructPropertyHandle to_handle() const { return (UEVR_FStructPropertyHandle)this; } + + UScriptStruct* get_struct() const { + static const auto fn = initialize()->get_struct; + return (UScriptStruct*)fn(to_handle()); + } + + private: + static inline const UEVR_FStructPropertyFunctions* s_functions{nullptr}; + static inline const UEVR_FStructPropertyFunctions* initialize() { + if (s_functions == nullptr) { + s_functions = API::get()->sdk()->fstructproperty; + } + + 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 35215e9e..c6b96456 100644 --- a/src/mods/PluginLoader.cpp +++ b/src/mods/PluginLoader.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "pluginloader/FFakeStereoRenderingFunctions.hpp" #include "pluginloader/FRenderTargetPoolHook.hpp" @@ -842,6 +843,12 @@ UEVR_FBoolPropertyFunctions g_fbool_property_functions { } }; +UEVR_FStructPropertyFunctions g_fstruct_property_functions { + .get_struct = [](UEVR_FStructPropertyHandle prop) -> UEVR_UScriptStructHandle { + return (UEVR_UScriptStructHandle)((sdk::FStructProperty*)prop)->get_struct(); + } +}; + UEVR_SDKData g_sdk_data { &g_sdk_functions, &g_sdk_callbacks, @@ -862,7 +869,8 @@ UEVR_SDKData g_sdk_data { &uevr::frhitexture2d::functions, &uevr::uscriptstruct::functions, &g_farray_property_functions, - &g_fbool_property_functions + &g_fbool_property_functions, + &g_fstruct_property_functions }; namespace uevr {