From 14bb8be470ae996aca838ffc13a99b828955c3ca Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Thu, 16 Jan 2025 13:30:21 -0500 Subject: [PATCH 01/28] Decoded Several Rendering Structs & Small Adjustments --- include/RED4ext/Detail/AddressHashes.hpp | 15 ++ include/RED4ext/Dump/Reflection-inl.hpp | 3 +- include/RED4ext/GpuApi/Buffer.hpp | 2 +- .../RED4ext/GpuApi/CommandListContext-inl.hpp | 6 +- include/RED4ext/RenderProxy-inl.hpp | 163 ++++++++++++++++++ include/RED4ext/RenderProxy.hpp | 81 +++++++++ include/RED4ext/RenderTypes.hpp | 30 ++++ .../Scripting/Natives/Generated/CMesh.hpp | 67 ++++--- .../Generated/ent/SkinnedMeshComponent.hpp | 10 ++ include/RED4ext/Scripting/Natives/Vector4.hpp | 3 +- .../Natives/entSkinnedMeshComponent.hpp | 50 ++++++ src/RenderProxy.cpp | 5 + 12 files changed, 393 insertions(+), 42 deletions(-) create mode 100644 include/RED4ext/RenderProxy-inl.hpp create mode 100644 include/RED4ext/RenderProxy.hpp create mode 100644 include/RED4ext/RenderTypes.hpp create mode 100644 include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp create mode 100644 src/RenderProxy.cpp diff --git a/include/RED4ext/Detail/AddressHashes.hpp b/include/RED4ext/Detail/AddressHashes.hpp index ada30ed88..b4dc9de3e 100644 --- a/include/RED4ext/Detail/AddressHashes.hpp +++ b/include/RED4ext/Detail/AddressHashes.hpp @@ -125,6 +125,21 @@ constexpr std::uint32_t Handle_ctor = 0xBA0C115D; constexpr std::uint32_t Handle_DecWeakRef = 0x333B1404; #pragma endregion +#pragma region IRenderProxy +constexpr std::uint32_t IRenderProxy_sub_00 = 302583262UL; +constexpr std::uint32_t IRenderProxy_sub_08 = 3505328647UL; +constexpr std::uint32_t IRenderProxy_sub_18 = 2756580845UL; +constexpr std::uint32_t IRenderProxy_sub_58 = 2462126272UL; +constexpr std::uint32_t IRenderProxy_sub_60 = 3491501770UL; +constexpr std::uint32_t IRenderProxy_sub_78 = 2542474580UL; +constexpr std::uint32_t IRenderProxy_sub_80 = 510274732UL; +constexpr std::uint32_t IRenderProxy_sub_88 = 3724941976UL; +constexpr std::uint32_t IRenderProxy_sub_90 = 1894391003UL; +constexpr std::uint32_t IRenderProxy_sub_98 = 3516862860UL; +constexpr std::uint32_t IRenderProxy_sub_A8 = 4096926792UL; +constexpr std::uint32_t IRenderProxy_sub_B0 = 1468405902UL; +#pragma endregion + #pragma region IScriptable constexpr std::uint32_t IScriptable_sub_D8 = 0xF8E41DDF; constexpr std::uint32_t IScriptable_DestructValueHolder = 0x3521331; diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index c1ae386b7..9ccb82dd8 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -308,7 +308,8 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a {"BaseGameEngine", "GameEngine"}, {"CGameEngine", "GameEngine"}, {"UpdateBucketEnum", "SystemUpdate"}, - {"worldGlobalNodeRef", "NativeTypes"}}; + {"worldGlobalNodeRef", "NativeTypes"}, + {"CMesh", "Scripting/Natives/CMesh"}}; std::regex invalidChars(INVALID_CHARACTERS); std::regex invalidKeywords(INVALID_KEYWORDS); diff --git a/include/RED4ext/GpuApi/Buffer.hpp b/include/RED4ext/GpuApi/Buffer.hpp index 8904c2479..4fe41107c 100644 --- a/include/RED4ext/GpuApi/Buffer.hpp +++ b/include/RED4ext/GpuApi/Buffer.hpp @@ -1,7 +1,7 @@ #pragma once #include - +#include #include #include diff --git a/include/RED4ext/GpuApi/CommandListContext-inl.hpp b/include/RED4ext/GpuApi/CommandListContext-inl.hpp index e985e0bc1..a4e128d9e 100644 --- a/include/RED4ext/GpuApi/CommandListContext-inl.hpp +++ b/include/RED4ext/GpuApi/CommandListContext-inl.hpp @@ -27,9 +27,9 @@ RED4EXT_INLINE void RED4ext::GpuApi::CommandListContext::FlushPendingBarriers() func(this); } -RED4EXT_INLINE RED4ext::GpuApi::CommandListContext* AcquireFreeCommandList(RED4ext::GpuApi::CommandListType aType, - RED4ext::StringView& aDebugName, - uint64_t aHash) +RED4EXT_INLINE RED4ext::GpuApi::CommandListContext* RED4ext::GpuApi::AcquireFreeCommandList(RED4ext::GpuApi::CommandListType aType, + const RED4ext::StringView& aDebugName, + uint64_t aHash) { // NOTE: This function has parameters for debug name and hash which seem to be optional. // Expects unique ptr as an out param and returns it by reference. diff --git a/include/RED4ext/RenderProxy-inl.hpp b/include/RED4ext/RenderProxy-inl.hpp new file mode 100644 index 000000000..96a4f4493 --- /dev/null +++ b/include/RED4ext/RenderProxy-inl.hpp @@ -0,0 +1,163 @@ +#pragma once + +#ifdef RED4EXT_STATIC_LIB +#include +#endif + +#include +#include + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_00() +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_00); + func(); +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_08() +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_08); + func(this); +} + +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_18() +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_18); + return func(this); +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_20() +{ +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_28() +{ +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_30() +{ +} + +RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_38() +{ + return false; +} + +RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_40() +{ + return true; +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_48() +{ +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_50() +{ +} + +RED4EXT_INLINE uint32_t RED4ext::IRenderProxy::sub_58() +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_58); + return func(this); +} + +RED4EXT_INLINE float RED4ext::IRenderProxy::sub_60() +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_60); + return func(this); +} + +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_68() +{ + return 0; +} + +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_70() +{ + return 0; +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_78(void* a1) +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_78); + func(this, a1); +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_80(void* a1, void* a2) +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_80); + func(this, a1, a2); +} + +RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_88(void* a1, void* a2) +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_88); + return func(this, a1, a2); +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_90(void* a1) +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_90); + func(this, a1); +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_98(void* a1) +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_98); + func(this, a1); +} + + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_A0() +{ +} + +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_A8(void* a1) +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_A8); + return func(this, a1); +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_B0(void* a1) +{ + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_B0); + func(this, a1); +} + +RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_B8() +{ + return false; +} + +RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_C0() +{ + return false; +} + +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_C8() +{ + return 0; +} + +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_D0() +{ + return 0; +} + +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_D8() +{ + return 0; +} + +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_E0() +{ + return 0; +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_E8() +{ +} + +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_F0() +{ +} diff --git a/include/RED4ext/RenderProxy.hpp b/include/RED4ext/RenderProxy.hpp new file mode 100644 index 000000000..85b9d65d5 --- /dev/null +++ b/include/RED4ext/RenderProxy.hpp @@ -0,0 +1,81 @@ +#pragma once + +#include + +#include +#include +#include + +namespace RED4ext +{ +struct IRenderProxyBase +{ + virtual void sub_00(); // 00 + virtual void sub_08(); // 08 + virtual ~IRenderProxy() = default; // 10 + virtual uint8_t sub_18(); // 18 + virtual void sub_20(); // 20 + virtual void sub_28(); // 28 + virtual void sub_30(); // 30 + virtual bool sub_38(); // 38 + virtual bool sub_40(); // 40 + virtual void sub_48(); // 48 + virtual void sub_50(); // 50 + virtual uint32_t sub_58(); // 58 + virtual float sub_60(); // 60 + virtual uint8_t sub_68(); // 68 + virtual uint8_t sub_70(); // 70 + virtual void sub_78(void* a1); // 78 + virtual void sub_80(void* a1, void* a2); // 80 + virtual bool sub_88(void* a1, void* a2); // 88 + virtual void sub_90(void* a1); // 90 + virtual void sub_98(void* a1); // 98 + virtual void sub_A0(); // A0 + virtual uint8_t sub_A8(void* a1); // A8 + virtual void sub_B0(void* a1); // B0 + virtual bool sub_B8(); // B8 + virtual bool sub_C0(); // C0 + virtual uint8_t sub_C8(); // C8 + virtual uint8_t sub_D0(); // D0 + virtual uint8_t sub_D8(); // D8 + virtual uint8_t sub_E0(); // E0 + virtual void sub_E8(); // E8 + virtual void sub_F0(); // F0 + + uint8_t unk08[0x48 - 0x08]; // 08 + IRenderProxyCustomData* customData; // 48 + uint8_t unk50[0x98 - 0x50]; // 50 +}; +RED4EXT_ASSERT_SIZE(IRenderProxy, 0x98); + +struct IRenderProxy : IRenderProxyBase +{ + virtual void sub_F8() = 0; // F8 +}; +RED4EXT_ASSERT_SIZE(IRenderProxyImpl, 0x98); + +struct CRenderProxy : IRenderProxy +{ + uint8_t unk98[0xb8 - 0x98]; // 98 +}; +RED4EXT_ASSERT_SIZE(CRenderProxy, 0xb8); + +struct CRenderProxy_Mesh : CRenderProxy +{ + uint8_t unkB8[0xd8 - 0xb8]; // B8 + CRenderMesh* renderMesh; // D8 + uint8_t unkE0[0x1c0 - 0xe0]; // E0 +}; +RED4EXT_ASSERT_SIZE(CRenderProxy_Mesh, 0x1c0); + +struct RenderProxy_Handle +{ + virtual ~RenderProxy_Handle() = 0; + + void* unk08; + IRenderProxy* renderProxy; + void* unk18; + uint8_t unk20[0x28 - 0x20]; +}; +RED4EXT_ASSERT_SIZE(RenderProxy_Handle, 0x28); +} // namespace RED4ext diff --git a/include/RED4ext/RenderTypes.hpp b/include/RED4ext/RenderTypes.hpp new file mode 100644 index 000000000..c843df83a --- /dev/null +++ b/include/RED4ext/RenderTypes.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include + +#include +#include +#include +#include + +namespace RED4ext +{ +struct CRenderMesh +{ + uint8_t unk00[0x10 - 0x00]; // 00 + Vector4 quantizationScale; // 10 + Vector4 quantizationBias; // 20 + uint32_t vertexBufferID; // 30 - GpuApi buffer ID + uint32_t indexBufferID; // 34 + uint8_t unk38[0xa0 - 0x38]; // 38 + DynArray chunks; // A0 + uint8_t unkB0[0x158 - 0xb0]; // B0 +}; +RED4EXT_ASSERT_SIZE(CRenderMesh, 0x158); + +struct CRenderMorphTargetMesh : CRenderMesh +{ + uint8_t unk158[0x168 - 0x158]; // 158 +}; +RED4EXT_ASSERT_SIZE(CRenderMorphTargetMesh, 0x168); +} // namespace RED4ext diff --git a/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp b/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp index 897212140..0ada51eec 100644 --- a/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp @@ -1,15 +1,12 @@ #pragma once -// clang-format off - -// This file is generated from the Game's Reflection data - #include #include #include #include #include #include +#include #include #include #include @@ -27,43 +24,41 @@ struct IRenderResourceBlob; namespace mesh { struct MeshAppearance; } namespace mesh { struct MeshParameter; } -struct __declspec(align(0x10)) CMesh : res::StreamedResource +struct CMesh : res::StreamedResource { static constexpr const char* NAME = "CMesh"; static constexpr const char* ALIAS = NAME; - Box boundingBox; // 40 - Vector3 surfaceAreaPerAxis; // 60 - bool constrainAutoHideDistanceToTerrainHeightMap; // 6C - bool forceLoadAllAppearances; // 6D - bool castGlobalShadowsCachedInCook; // 6E - bool castLocalShadowsCachedInCook; // 6F - DynArray> parameters; // 70 - DynArray boneNames; // 80 - DynArray boneRigMatrices; // 90 - DynArray boneVertexEpsilons; // A0 - DynArray lodBoneMask; // B0 - DynArray floatTrackNames; // C0 - DynArray lodLevelInfo; // D0 - DynArray materialEntries; // E0 - DynArray> externalMaterials; // F0 + Box boundingBox; // 40 + Vector3 surfaceAreaPerAxis; // 60 + bool constrainAutoHideDistanceToTerrainHeightMap; // 6C + bool forceLoadAllAppearances; // 6D + bool castGlobalShadowsCachedInCook; // 6E + bool castLocalShadowsCachedInCook; // 6F + DynArray> parameters; // 70 + DynArray boneNames; // 80 + DynArray boneRigMatrices; // 90 + DynArray boneVertexEpsilons; // A0 + DynArray lodBoneMask; // B0 + DynArray floatTrackNames; // C0 + DynArray lodLevelInfo; // D0 + DynArray materialEntries; // E0 + DynArray> externalMaterials; // F0 DynArray> localMaterialInstances; // 100 - mesh::MeshMaterialBuffer localMaterialBuffer; // 110 - DynArray> preloadExternalMaterials; // 1B0 - DynArray> preloadLocalMaterialInstances; // 1C0 - DynArray> inplaceResources; // 1D0 - DynArray> appearances; // 1E0 - uint8_t unk1F0[0x1F8 - 0x1F0]; // 1F0 - Handle renderResourceBlob; // 1F8 - bool useRayTracingShadowLODBias; // 208 - bool castsRayTracedShadowsFromOriginalGeometry; // 209 - bool isShadowMesh; // 20A - bool isPlayerShadowMesh; // 20B - uint8_t unk20C[0x219 - 0x20C]; // 20C - ERenderObjectType objectType; // 219 - uint8_t unk21A[0x230 - 0x21A]; // 21A + mesh::MeshMaterialBuffer localMaterialBuffer; // 110 + DynArray> preloadExternalMaterials; // 1B0 + DynArray> preloadLocalMaterialInstances; // 1C0 + DynArray> inplaceResources; // 1D0 + DynArray> appearances; // 1E0 + CRenderMesh* runtimeRenderResource; // 1F0 + Handle renderResourceBlob; // 1F8 + bool useRayTracingShadowLODBias; // 208 + bool castsRayTracedShadowsFromOriginalGeometry; // 209 + bool isShadowMesh; // 20A + bool isPlayerShadowMesh; // 20B + uint8_t unk20C[0x219 - 0x20C]; // 20C + ERenderObjectType objectType; // 219 + uint8_t unk21A[0x230 - 0x21A]; // 21A }; RED4EXT_ASSERT_SIZE(CMesh, 0x230); } // namespace RED4ext - -// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/ent/SkinnedMeshComponent.hpp b/include/RED4ext/Scripting/Natives/Generated/ent/SkinnedMeshComponent.hpp index edec111c6..5b740f4c6 100644 --- a/include/RED4ext/Scripting/Natives/Generated/ent/SkinnedMeshComponent.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/ent/SkinnedMeshComponent.hpp @@ -4,6 +4,15 @@ // This file is generated from the Game's Reflection data +#include + +namespace RED4ext +{ +RED4EXT_ASSERT_SIZE(ent::SkinnedMeshComponent, 0x270); +using entSkinnedMeshComponent = ent::SkinnedMeshComponent; +} // namespace RED4ext + +/* #include #include #include @@ -50,5 +59,6 @@ RED4EXT_ASSERT_SIZE(SkinnedMeshComponent, 0x270); } // namespace ent using entSkinnedMeshComponent = ent::SkinnedMeshComponent; } // namespace RED4ext +*/ // clang-format on diff --git a/include/RED4ext/Scripting/Natives/Vector4.hpp b/include/RED4ext/Scripting/Natives/Vector4.hpp index 2672a1bbe..c89ac901f 100644 --- a/include/RED4ext/Scripting/Natives/Vector4.hpp +++ b/include/RED4ext/Scripting/Natives/Vector4.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include namespace RED4ext @@ -28,7 +29,7 @@ struct Vector4 inline Vector4& operator=(const Vector4& aOther) { - if (this != std::addressof(aOther)) + if (this != &aOther) { X = aOther.X; Y = aOther.Y; diff --git a/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp b/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp new file mode 100644 index 000000000..d53b06867 --- /dev/null +++ b/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace RED4ext +{ +namespace ent +{ +struct SkinnedMeshComponent : ent::ISkinTargetComponent +{ + static constexpr const char* NAME = "entSkinnedMeshComponent"; + static constexpr const char* ALIAS = NAME; + + SharedPtr renderProxy; // 1E0 + Handle appearanceHandle; // 1F0 + Handle meshHandle; // 200 + uint8_t unk1F0[0x228 - 0x210]; // 210 + RaRef mesh; // 228 + CName meshAppearance; // 230 + CName renderingPlaneAnimationParam; // 238 + CName visibilityAnimationParam; // 240 + uint64_t chunkMask; // 248 + NavGenNavigationSetting navigationImpact; // 250 + ent::MeshComponentLODMode LODMode; // 252 + uint8_t unk253[0x255 - 0x253]; // 253 + uint8_t order; // 255 + shadows::ShadowCastingMode castShadows; // 256 + shadows::ShadowCastingMode castLocalShadows; // 257 + bool useProxyMeshAsShadowMesh; // 258 + bool acceptDismemberment; // 259 + bool overrideMeshNavigationImpact; // 25A + uint8_t unk25B[0x25D - 0x25B]; // 25B + ent::ForcedLodDistance forcedLodDistance; // 25D + uint8_t unk25E[0x268 - 0x25E]; // 25E + uint8_t version; // 268 + uint8_t unk269[0x270 - 0x269]; // 269 +}; +RED4EXT_ASSERT_SIZE(SkinnedMeshComponent, 0x270); +} // namespace ent +} // namespace RED4ext diff --git a/src/RenderProxy.cpp b/src/RenderProxy.cpp new file mode 100644 index 000000000..39ed20746 --- /dev/null +++ b/src/RenderProxy.cpp @@ -0,0 +1,5 @@ +#ifndef RED4EXT_STATIC_LIB +#error Please define 'RED4EXT_STATIC_LIB' to compile this file. +#endif + +#include From 5ce34fc529ced6b0253c88bb13e3207d25620dfe Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Thu, 16 Jan 2025 13:36:28 -0500 Subject: [PATCH 02/28] Fix formatting --- include/RED4ext/GpuApi/CommandListContext-inl.hpp | 5 ++--- include/RED4ext/RenderProxy-inl.hpp | 3 +-- include/RED4ext/RenderTypes.hpp | 2 +- include/RED4ext/Scripting/Natives/Generated/CMesh.hpp | 4 ++-- .../RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp | 4 ++-- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/RED4ext/GpuApi/CommandListContext-inl.hpp b/include/RED4ext/GpuApi/CommandListContext-inl.hpp index a4e128d9e..84e4d846e 100644 --- a/include/RED4ext/GpuApi/CommandListContext-inl.hpp +++ b/include/RED4ext/GpuApi/CommandListContext-inl.hpp @@ -27,9 +27,8 @@ RED4EXT_INLINE void RED4ext::GpuApi::CommandListContext::FlushPendingBarriers() func(this); } -RED4EXT_INLINE RED4ext::GpuApi::CommandListContext* RED4ext::GpuApi::AcquireFreeCommandList(RED4ext::GpuApi::CommandListType aType, - const RED4ext::StringView& aDebugName, - uint64_t aHash) +RED4EXT_INLINE RED4ext::GpuApi::CommandListContext* RED4ext::GpuApi::AcquireFreeCommandList( + RED4ext::GpuApi::CommandListType aType, const RED4ext::StringView& aDebugName, uint64_t aHash) { // NOTE: This function has parameters for debug name and hash which seem to be optional. // Expects unique ptr as an out param and returns it by reference. diff --git a/include/RED4ext/RenderProxy-inl.hpp b/include/RED4ext/RenderProxy-inl.hpp index 96a4f4493..313a99e64 100644 --- a/include/RED4ext/RenderProxy-inl.hpp +++ b/include/RED4ext/RenderProxy-inl.hpp @@ -4,8 +4,8 @@ #include #endif -#include #include +#include RED4EXT_INLINE void RED4ext::IRenderProxy::sub_00() { @@ -107,7 +107,6 @@ RED4EXT_INLINE void RED4ext::IRenderProxy::sub_98(void* a1) func(this, a1); } - RED4EXT_INLINE void RED4ext::IRenderProxy::sub_A0() { } diff --git a/include/RED4ext/RenderTypes.hpp b/include/RED4ext/RenderTypes.hpp index c843df83a..4daa02d2c 100644 --- a/include/RED4ext/RenderTypes.hpp +++ b/include/RED4ext/RenderTypes.hpp @@ -3,9 +3,9 @@ #include #include -#include #include #include +#include namespace RED4ext { diff --git a/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp b/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp index 0ada51eec..791ec8670 100644 --- a/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp @@ -1,8 +1,7 @@ #pragma once -#include -#include #include +#include #include #include #include @@ -14,6 +13,7 @@ #include #include #include +#include namespace RED4ext { diff --git a/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp b/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp index d53b06867..46822ac7e 100644 --- a/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp +++ b/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp @@ -1,8 +1,7 @@ #pragma once -#include -#include #include +#include #include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include namespace RED4ext { From 6c3ee2bcaf2659f7f8a99d4d503a4f8398db7c94 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Thu, 16 Jan 2025 13:44:58 -0500 Subject: [PATCH 03/28] Fix mistakes --- include/RED4ext/RenderProxy-inl.hpp | 82 ++++++++++++++--------------- include/RED4ext/RenderProxy.hpp | 2 +- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/include/RED4ext/RenderProxy-inl.hpp b/include/RED4ext/RenderProxy-inl.hpp index 313a99e64..2ec2145be 100644 --- a/include/RED4ext/RenderProxy-inl.hpp +++ b/include/RED4ext/RenderProxy-inl.hpp @@ -7,156 +7,156 @@ #include #include -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_00() +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_00() { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_00); func(); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_08() +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_08() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_08); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_08); func(this); } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_18() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_18() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_18); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_18); return func(this); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_20() +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_20() { } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_28() +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_28() { } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_30() +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_30() { } -RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_38() +RED4EXT_INLINE bool RED4ext::IRenderProxyBase::sub_38() { return false; } -RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_40() +RED4EXT_INLINE bool RED4ext::IRenderProxyBase::sub_40() { return true; } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_48() +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_48() { } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_50() +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_50() { } -RED4EXT_INLINE uint32_t RED4ext::IRenderProxy::sub_58() +RED4EXT_INLINE uint32_t RED4ext::IRenderProxyBase::sub_58() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_58); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_58); return func(this); } -RED4EXT_INLINE float RED4ext::IRenderProxy::sub_60() +RED4EXT_INLINE float RED4ext::IRenderProxyBase::sub_60() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_60); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_60); return func(this); } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_68() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_68() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_70() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_70() { return 0; } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_78(void* a1) +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_78(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_78); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_78); func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_80(void* a1, void* a2) +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_80(void* a1, void* a2) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_80); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_80); func(this, a1, a2); } -RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_88(void* a1, void* a2) +RED4EXT_INLINE bool RED4ext::IRenderProxyBase::sub_88(void* a1, void* a2) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_88); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_88); return func(this, a1, a2); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_90(void* a1) +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_90(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_90); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_90); func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_98(void* a1) +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_98(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_98); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_98); func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_A0() +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_A0() { } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_A8(void* a1) +RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_A8(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_A8); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_A8); return func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_B0(void* a1) +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_B0(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_B0); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_B0); func(this, a1); } -RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_B8() +RED4EXT_INLINE bool RED4ext::IRenderProxyBase::sub_B8() { return false; } -RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_C0() +RED4EXT_INLINE bool RED4ext::IRenderProxyBase::sub_C0() { return false; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_C8() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_C8() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_D0() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_D0() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_D8() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_D8() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_E0() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_E0() { return 0; } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_E8() +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_E8() { } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_F0() +RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_F0() { } diff --git a/include/RED4ext/RenderProxy.hpp b/include/RED4ext/RenderProxy.hpp index 85b9d65d5..fce5c2b5a 100644 --- a/include/RED4ext/RenderProxy.hpp +++ b/include/RED4ext/RenderProxy.hpp @@ -12,7 +12,7 @@ struct IRenderProxyBase { virtual void sub_00(); // 00 virtual void sub_08(); // 08 - virtual ~IRenderProxy() = default; // 10 + virtual ~IRenderProxyBase() = default; // 10 virtual uint8_t sub_18(); // 18 virtual void sub_20(); // 20 virtual void sub_28(); // 28 From f8b5653e8ec5aceb170020e7b9efc7c23b9fa961 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Thu, 16 Jan 2025 13:47:32 -0500 Subject: [PATCH 04/28] Formatting --- include/RED4ext/RenderProxy-inl.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/RED4ext/RenderProxy-inl.hpp b/include/RED4ext/RenderProxy-inl.hpp index 2ec2145be..261659ecb 100644 --- a/include/RED4ext/RenderProxy-inl.hpp +++ b/include/RED4ext/RenderProxy-inl.hpp @@ -85,13 +85,15 @@ RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_78(void* a1) RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_80(void* a1, void* a2) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_80); + using func_t = void (*)(IRenderProxyBase*, void*, void*); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_80); func(this, a1, a2); } RED4EXT_INLINE bool RED4ext::IRenderProxyBase::sub_88(void* a1, void* a2) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_88); + using func_t = bool (*)(IRenderProxyBase*, void*, void*); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_88); return func(this, a1, a2); } From 5292632a2341516434534f4532bab11d8e5d7a58 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Thu, 16 Jan 2025 13:51:32 -0500 Subject: [PATCH 05/28] Update struct names --- include/RED4ext/RenderProxy.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/RED4ext/RenderProxy.hpp b/include/RED4ext/RenderProxy.hpp index fce5c2b5a..bbc4c3900 100644 --- a/include/RED4ext/RenderProxy.hpp +++ b/include/RED4ext/RenderProxy.hpp @@ -46,13 +46,13 @@ struct IRenderProxyBase IRenderProxyCustomData* customData; // 48 uint8_t unk50[0x98 - 0x50]; // 50 }; -RED4EXT_ASSERT_SIZE(IRenderProxy, 0x98); +RED4EXT_ASSERT_SIZE(IRenderProxyBase, 0x98); struct IRenderProxy : IRenderProxyBase { virtual void sub_F8() = 0; // F8 }; -RED4EXT_ASSERT_SIZE(IRenderProxyImpl, 0x98); +RED4EXT_ASSERT_SIZE(IRenderProxy, 0x98); struct CRenderProxy : IRenderProxy { From bc66a67cefd693928e1ba7130450118c28933f01 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Fri, 17 Jan 2025 09:38:40 -0500 Subject: [PATCH 06/28] Semantical improvements --- include/RED4ext/Dump/Reflection-inl.hpp | 3 +- include/RED4ext/RenderProxy-inl.hpp | 82 ++++++++++++------------- include/RED4ext/RenderProxy.hpp | 14 ++--- 3 files changed, 49 insertions(+), 50 deletions(-) diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index 9ccb82dd8..c1ae386b7 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -308,8 +308,7 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a {"BaseGameEngine", "GameEngine"}, {"CGameEngine", "GameEngine"}, {"UpdateBucketEnum", "SystemUpdate"}, - {"worldGlobalNodeRef", "NativeTypes"}, - {"CMesh", "Scripting/Natives/CMesh"}}; + {"worldGlobalNodeRef", "NativeTypes"}}; std::regex invalidChars(INVALID_CHARACTERS); std::regex invalidKeywords(INVALID_KEYWORDS); diff --git a/include/RED4ext/RenderProxy-inl.hpp b/include/RED4ext/RenderProxy-inl.hpp index 261659ecb..d971732e2 100644 --- a/include/RED4ext/RenderProxy-inl.hpp +++ b/include/RED4ext/RenderProxy-inl.hpp @@ -7,158 +7,158 @@ #include #include -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_00() +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_00() { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_00); func(); } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_08() +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_08() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_08); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_08); func(this); } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_18() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_18() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_18); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_18); return func(this); } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_20() +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_20() { } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_28() +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_28() { } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_30() +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_30() { } -RED4EXT_INLINE bool RED4ext::IRenderProxyBase::sub_38() +RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_38() { return false; } -RED4EXT_INLINE bool RED4ext::IRenderProxyBase::sub_40() +RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_40() { return true; } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_48() +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_48() { } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_50() +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_50() { } -RED4EXT_INLINE uint32_t RED4ext::IRenderProxyBase::sub_58() +RED4EXT_INLINE uint32_t RED4ext::IRenderProxy::sub_58() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_58); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_58); return func(this); } -RED4EXT_INLINE float RED4ext::IRenderProxyBase::sub_60() +RED4EXT_INLINE float RED4ext::IRenderProxy::sub_60() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_60); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_60); return func(this); } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_68() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_68() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_70() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_70() { return 0; } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_78(void* a1) +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_78(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_78); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_78); func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_80(void* a1, void* a2) +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_80(void* a1, void* a2) { - using func_t = void (*)(IRenderProxyBase*, void*, void*); + using func_t = void (*)(IRenderProxy*, void*, void*); static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_80); func(this, a1, a2); } -RED4EXT_INLINE bool RED4ext::IRenderProxyBase::sub_88(void* a1, void* a2) +RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_88(void* a1, void* a2) { - using func_t = bool (*)(IRenderProxyBase*, void*, void*); + using func_t = bool (*)(IRenderProxy*, void*, void*); static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_88); return func(this, a1, a2); } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_90(void* a1) +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_90(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_90); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_90); func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_98(void* a1) +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_98(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_98); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_98); func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_A0() +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_A0() { } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_A8(void* a1) +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_A8(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_A8); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_A8); return func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_B0(void* a1) +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_B0(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_B0); + static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_B0); func(this, a1); } -RED4EXT_INLINE bool RED4ext::IRenderProxyBase::sub_B8() +RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_B8() { return false; } -RED4EXT_INLINE bool RED4ext::IRenderProxyBase::sub_C0() +RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_C0() { return false; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_C8() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_C8() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_D0() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_D0() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_D8() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_D8() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxyBase::sub_E0() +RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_E0() { return 0; } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_E8() +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_E8() { } -RED4EXT_INLINE void RED4ext::IRenderProxyBase::sub_F0() +RED4EXT_INLINE void RED4ext::IRenderProxy::sub_F0() { } diff --git a/include/RED4ext/RenderProxy.hpp b/include/RED4ext/RenderProxy.hpp index bbc4c3900..377c29c90 100644 --- a/include/RED4ext/RenderProxy.hpp +++ b/include/RED4ext/RenderProxy.hpp @@ -8,7 +8,7 @@ namespace RED4ext { -struct IRenderProxyBase +struct IRenderProxy { virtual void sub_00(); // 00 virtual void sub_08(); // 08 @@ -46,27 +46,27 @@ struct IRenderProxyBase IRenderProxyCustomData* customData; // 48 uint8_t unk50[0x98 - 0x50]; // 50 }; -RED4EXT_ASSERT_SIZE(IRenderProxyBase, 0x98); +RED4EXT_ASSERT_SIZE(RenderProxyBase, 0x98); -struct IRenderProxy : IRenderProxyBase +struct RenderProxyBase : IRenderProxy { virtual void sub_F8() = 0; // F8 }; -RED4EXT_ASSERT_SIZE(IRenderProxy, 0x98); +RED4EXT_ASSERT_SIZE(RegistarableRenderProxy, 0x98); -struct CRenderProxy : IRenderProxy +struct CRenderProxy : RenderProxyBase { uint8_t unk98[0xb8 - 0x98]; // 98 }; RED4EXT_ASSERT_SIZE(CRenderProxy, 0xb8); -struct CRenderProxy_Mesh : CRenderProxy +struct MeshRenderProxy : CRenderProxy { uint8_t unkB8[0xd8 - 0xb8]; // B8 CRenderMesh* renderMesh; // D8 uint8_t unkE0[0x1c0 - 0xe0]; // E0 }; -RED4EXT_ASSERT_SIZE(CRenderProxy_Mesh, 0x1c0); +RED4EXT_ASSERT_SIZE(MeshRenderProxy, 0x1c0); struct RenderProxy_Handle { From 374cbb7b2f93504eb31b4d0f460ab145c6b407ff Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Fri, 17 Jan 2025 09:43:42 -0500 Subject: [PATCH 07/28] Fix mistake --- include/RED4ext/RenderProxy.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/RED4ext/RenderProxy.hpp b/include/RED4ext/RenderProxy.hpp index 377c29c90..a7a2822bf 100644 --- a/include/RED4ext/RenderProxy.hpp +++ b/include/RED4ext/RenderProxy.hpp @@ -46,13 +46,13 @@ struct IRenderProxy IRenderProxyCustomData* customData; // 48 uint8_t unk50[0x98 - 0x50]; // 50 }; -RED4EXT_ASSERT_SIZE(RenderProxyBase, 0x98); +RED4EXT_ASSERT_SIZE(IRenderProxy, 0x98); struct RenderProxyBase : IRenderProxy { virtual void sub_F8() = 0; // F8 }; -RED4EXT_ASSERT_SIZE(RegistarableRenderProxy, 0x98); +RED4EXT_ASSERT_SIZE(RenderProxyBase, 0x98); struct CRenderProxy : RenderProxyBase { From 198830c6696cdba3981eca211f2599abffa0a78a Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Fri, 17 Jan 2025 09:50:09 -0500 Subject: [PATCH 08/28] Fix other mistake --- include/RED4ext/RenderProxy.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RED4ext/RenderProxy.hpp b/include/RED4ext/RenderProxy.hpp index a7a2822bf..44101a117 100644 --- a/include/RED4ext/RenderProxy.hpp +++ b/include/RED4ext/RenderProxy.hpp @@ -12,7 +12,7 @@ struct IRenderProxy { virtual void sub_00(); // 00 virtual void sub_08(); // 08 - virtual ~IRenderProxyBase() = default; // 10 + virtual ~IRenderProxy() = default; // 10 virtual uint8_t sub_18(); // 18 virtual void sub_20(); // 20 virtual void sub_28(); // 28 From 70cb6cc031d4ad2973bad9a2e7e512e60c59c1f2 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Sun, 19 Jan 2025 12:39:11 -0500 Subject: [PATCH 09/28] Several updates - Included changes from #167 - Improved semantics - Decoded fields for `MorphTargetSkinnedMeshComponent` and `MorphTargetMesh` - Stubbed relevant generated files --- .../RED4ext/GpuApi/CommandListContext-inl.hpp | 21 ++--- include/RED4ext/GpuApi/DeviceData-inl.hpp | 49 +----------- include/RED4ext/GpuApi/DeviceData.hpp | 50 +++++++++++- include/RED4ext/RenderProxy-inl.hpp | 63 ++++++++------- include/RED4ext/RenderProxy.hpp | 23 +++--- .../{RenderTypes.hpp => RenderResource.hpp} | 15 +++- include/RED4ext/Scripting/Natives/CMesh.hpp | 65 +++++++++++++++ .../Scripting/Natives/Generated/CMesh.hpp | 80 +++++++++++-------- .../Natives/Generated/MorphTargetMesh.hpp | 9 +++ .../ent/MorphTargetSkinnedMeshComponent.hpp | 10 +++ .../Scripting/Natives/MorphTargetMesh.hpp | 38 +++++++++ .../entMorphTargetSkinnedMeshComponent.hpp | 47 +++++++++++ .../Natives/entSkinnedMeshComponent.hpp | 1 + 13 files changed, 336 insertions(+), 135 deletions(-) rename include/RED4ext/{RenderTypes.hpp => RenderResource.hpp} (59%) create mode 100644 include/RED4ext/Scripting/Natives/CMesh.hpp create mode 100644 include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp create mode 100644 include/RED4ext/Scripting/Natives/entMorphTargetSkinnedMeshComponent.hpp diff --git a/include/RED4ext/GpuApi/CommandListContext-inl.hpp b/include/RED4ext/GpuApi/CommandListContext-inl.hpp index 84e4d846e..5f9378e45 100644 --- a/include/RED4ext/GpuApi/CommandListContext-inl.hpp +++ b/include/RED4ext/GpuApi/CommandListContext-inl.hpp @@ -6,38 +6,39 @@ #include -RED4EXT_INLINE void RED4ext::GpuApi::CommandListContext::AddPendingBarrier(const D3D12_RESOURCE_BARRIER& aBarrier) +namespace RED4ext::GpuApi +{ +RED4EXT_INLINE void CommandListContext::AddPendingBarrier(const D3D12_RESOURCE_BARRIER& aBarrier) { using func_t = void (*)(CommandListContext*, const D3D12_RESOURCE_BARRIER&); static UniversalRelocFunc func(Detail::AddressHashes::CommandListContext_AddPendingBarrier); func(this, aBarrier); } -RED4EXT_INLINE void RED4ext::GpuApi::CommandListContext::Close() +RED4EXT_INLINE void CommandListContext::Close() { using func_t = void (*)(CommandListContext*); static UniversalRelocFunc func(Detail::AddressHashes::CommandListContext_Close); func(this); } -RED4EXT_INLINE void RED4ext::GpuApi::CommandListContext::FlushPendingBarriers() +RED4EXT_INLINE void CommandListContext::FlushPendingBarriers() { using func_t = void (*)(CommandListContext*); static UniversalRelocFunc func(Detail::AddressHashes::CommandListContext_FlushPendingBarriers); func(this); } -RED4EXT_INLINE RED4ext::GpuApi::CommandListContext* RED4ext::GpuApi::AcquireFreeCommandList( - RED4ext::GpuApi::CommandListType aType, const RED4ext::StringView& aDebugName, uint64_t aHash) +RED4EXT_INLINE CommandListContext* AcquireFreeCommandList(CommandListType aType, const StringView& aDebugName, + uint64_t aHash) { // NOTE: This function has parameters for debug name and hash which seem to be optional. // Expects unique ptr as an out param and returns it by reference. - using func_t = RED4ext::GpuApi::CommandListContext*& (*)(RED4ext::GpuApi::CommandListContext*&, - RED4ext::GpuApi::CommandListType, - const RED4ext::StringView&, uint64_t); - static RED4ext::UniversalRelocFunc func(RED4ext::Detail::AddressHashes::GetFreeCommandList); + using func_t = CommandListContext*& (*)(CommandListContext*&, CommandListType, const StringView&, uint64_t); + static UniversalRelocFunc func(Detail::AddressHashes::GetFreeCommandList); // TODO: This should be unique_ptr which function fills in and returns. - RED4ext::GpuApi::CommandListContext* outContext = nullptr; + CommandListContext* outContext = nullptr; return func(outContext, aType, aDebugName, aHash); } +} // namespace RED4ext::GpuApi diff --git a/include/RED4ext/GpuApi/DeviceData-inl.hpp b/include/RED4ext/GpuApi/DeviceData-inl.hpp index f7af5df0c..6b77222ad 100644 --- a/include/RED4ext/GpuApi/DeviceData-inl.hpp +++ b/include/RED4ext/GpuApi/DeviceData-inl.hpp @@ -4,54 +4,11 @@ #include #endif -template -bool RED4ext::GpuApi::ResourceContainer::Resource::IsUsed() const +namespace RED4ext::GpuApi { - return refCount >= 0; -} - -template -bool RED4ext::GpuApi::ResourceContainer::IsUsedID(const uint32_t id) const -{ - return IsValidID(id) && resources[IDToIndex(id)].IsUsed(); -} - -template -bool RED4ext::GpuApi::ResourceContainer::IsUnusedID(const uint32_t id) const -{ - return IsValidID(id) && !resources[IDToIndex(id)].IsUsed(); -} - -template -bool RED4ext::GpuApi::ResourceContainer::IsEmpty() const -{ - assert(numUnused <= MAX_SIZE); - return numUnused == MAX_SIZE; -} - -template -bool RED4ext::GpuApi::ResourceContainer::IsFull() const -{ - assert(numUnused <= MAX_SIZE); - return numUnused == 0; -} - -template -T& RED4ext::GpuApi::ResourceContainer::GetData(uint32_t id) -{ - assert(IsUsedID(id)); - return resources[IDToIndex(id)].instance; -} - -template -const T& RED4ext::GpuApi::ResourceContainer::GetData(uint32_t id) const -{ - assert(IsUsedID(id)); - return resources[IDToIndex(id)].instance; -} - -RED4EXT_INLINE RED4ext::GpuApi::SDeviceData* RED4ext::GpuApi::GetDeviceData() +RED4EXT_INLINE SDeviceData* GetDeviceData() { static UniversalRelocPtr dd(Detail::AddressHashes::g_DeviceData); return dd; } +} // namespace RED4ext::GpuApi diff --git a/include/RED4ext/GpuApi/DeviceData.hpp b/include/RED4ext/GpuApi/DeviceData.hpp index f4260b3f5..5259eb07d 100644 --- a/include/RED4ext/GpuApi/DeviceData.hpp +++ b/include/RED4ext/GpuApi/DeviceData.hpp @@ -14,7 +14,7 @@ namespace GpuApi template struct ResourceContainer { - struct Resource + struct ResourceHandle { bool IsUsed() const; @@ -56,7 +56,7 @@ struct ResourceContainer SpinLock& spinLockRef; // 00 - Always points to SDeviceDataBase::resourcesSpinLock. std::atomic_int32_t numUnused; // 08 - Defaults to MaxSize. - Resource resources[MAX_SIZE]; + ResourceHandle resources[MAX_SIZE]; uint16_t unusedIndices[MAX_SIZE]; // These are indices, not IDs! }; @@ -94,6 +94,52 @@ RED4EXT_ASSERT_OFFSET(SDeviceData, directCommandQueue, 0x13bc4d0); RED4EXT_ASSERT_OFFSET(SDeviceData, memoryAllocator, 0x13bc540); SDeviceData* GetDeviceData(); + +template +bool ResourceContainer::ResourceHandle::IsUsed() const +{ + return refCount >= 0; +} + +template +bool ResourceContainer::IsUsedID(const uint32_t id) const +{ + return IsValidID(id) && resources[IDToIndex(id)].IsUsed(); +} + +template +bool ResourceContainer::IsUnusedID(const uint32_t id) const +{ + return IsValidID(id) && !resources[IDToIndex(id)].IsUsed(); +} + +template +bool ResourceContainer::IsEmpty() const +{ + assert(numUnused <= MAX_SIZE); + return numUnused == MAX_SIZE; +} + +template +bool ResourceContainer::IsFull() const +{ + assert(numUnused <= MAX_SIZE); + return numUnused == 0; +} + +template +T& ResourceContainer::GetData(uint32_t id) +{ + assert(IsUsedID(id)); + return resources[IDToIndex(id)].instance; +} + +template +const T& ResourceContainer::GetData(uint32_t id) const +{ + assert(IsUsedID(id)); + return resources[IDToIndex(id)].instance; +} } // namespace GpuApi } // namespace RED4ext diff --git a/include/RED4ext/RenderProxy-inl.hpp b/include/RED4ext/RenderProxy-inl.hpp index d971732e2..b28d7c7f1 100644 --- a/include/RED4ext/RenderProxy-inl.hpp +++ b/include/RED4ext/RenderProxy-inl.hpp @@ -7,158 +7,161 @@ #include #include -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_00() +namespace RED4ext +{ +RED4EXT_INLINE void IRenderProxy::sub_00() { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_00); func(); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_08() +RED4EXT_INLINE void IRenderProxy::sub_08() { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_08); func(this); } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_18() +RED4EXT_INLINE uint8_t IRenderProxy::sub_18() { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_18); return func(this); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_20() +RED4EXT_INLINE void IRenderProxy::sub_20() { } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_28() +RED4EXT_INLINE void IRenderProxy::sub_28() { } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_30() +RED4EXT_INLINE void IRenderProxy::sub_30() { } -RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_38() +RED4EXT_INLINE bool IRenderProxy::sub_38() { return false; } -RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_40() +RED4EXT_INLINE bool IRenderProxy::sub_40() { return true; } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_48() +RED4EXT_INLINE void IRenderProxy::sub_48() { } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_50() +RED4EXT_INLINE void IRenderProxy::sub_50() { } -RED4EXT_INLINE uint32_t RED4ext::IRenderProxy::sub_58() +RED4EXT_INLINE uint32_t IRenderProxy::sub_58() { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_58); return func(this); } -RED4EXT_INLINE float RED4ext::IRenderProxy::sub_60() +RED4EXT_INLINE float IRenderProxy::sub_60() { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_60); return func(this); } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_68() +RED4EXT_INLINE uint8_t IRenderProxy::sub_68() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_70() +RED4EXT_INLINE uint8_t IRenderProxy::sub_70() { return 0; } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_78(void* a1) +RED4EXT_INLINE void IRenderProxy::sub_78(void* a1) { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_78); func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_80(void* a1, void* a2) +RED4EXT_INLINE void IRenderProxy::sub_80(void* a1, void* a2) { using func_t = void (*)(IRenderProxy*, void*, void*); static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_80); func(this, a1, a2); } -RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_88(void* a1, void* a2) +RED4EXT_INLINE bool IRenderProxy::sub_88(void* a1, void* a2) { using func_t = bool (*)(IRenderProxy*, void*, void*); static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_88); return func(this, a1, a2); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_90(void* a1) +RED4EXT_INLINE void IRenderProxy::sub_90(void* a1) { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_90); func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_98(void* a1) +RED4EXT_INLINE void IRenderProxy::sub_98(void* a1) { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_98); func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_A0() +RED4EXT_INLINE void IRenderProxy::sub_A0() { } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_A8(void* a1) +RED4EXT_INLINE uint8_t IRenderProxy::sub_A8(void* a1) { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_A8); return func(this, a1); } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_B0(void* a1) +RED4EXT_INLINE void IRenderProxy::sub_B0(void* a1) { static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_B0); func(this, a1); } -RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_B8() +RED4EXT_INLINE bool IRenderProxy::sub_B8() { return false; } -RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_C0() +RED4EXT_INLINE bool IRenderProxy::sub_C0() { return false; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_C8() +RED4EXT_INLINE uint8_t IRenderProxy::sub_C8() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_D0() +RED4EXT_INLINE uint8_t IRenderProxy::sub_D0() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_D8() +RED4EXT_INLINE uint8_t IRenderProxy::sub_D8() { return 0; } -RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_E0() +RED4EXT_INLINE uint8_t IRenderProxy::sub_E0() { return 0; } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_E8() +RED4EXT_INLINE void IRenderProxy::sub_E8() { } -RED4EXT_INLINE void RED4ext::IRenderProxy::sub_F0() +RED4EXT_INLINE void IRenderProxy::sub_F0() { } +} // namespace RED4ext diff --git a/include/RED4ext/RenderProxy.hpp b/include/RED4ext/RenderProxy.hpp index 44101a117..7c2f141d3 100644 --- a/include/RED4ext/RenderProxy.hpp +++ b/include/RED4ext/RenderProxy.hpp @@ -1,11 +1,12 @@ #pragma once -#include - #include -#include +#include #include +#include + + namespace RED4ext { struct IRenderProxy @@ -47,6 +48,7 @@ struct IRenderProxy uint8_t unk50[0x98 - 0x50]; // 50 }; RED4EXT_ASSERT_SIZE(IRenderProxy, 0x98); +RED4EXT_ASSERT_OFFSET(IRenderProxy, customData, 0x48); struct RenderProxyBase : IRenderProxy { @@ -67,15 +69,16 @@ struct MeshRenderProxy : CRenderProxy uint8_t unkE0[0x1c0 - 0xe0]; // E0 }; RED4EXT_ASSERT_SIZE(MeshRenderProxy, 0x1c0); +RED4EXT_ASSERT_OFFSET(MeshRenderProxy, renderMesh, 0xD8); -struct RenderProxy_Handle +struct CRenderProxy_Handle { - virtual ~RenderProxy_Handle() = 0; + virtual ~CRenderProxy_Handle() = default; // 00 - void* unk08; - IRenderProxy* renderProxy; - void* unk18; - uint8_t unk20[0x28 - 0x20]; + uint8_t unk08[0x10 - 0x08]; // 08 + IRenderProxy* renderProxy; // 10 + uint8_t unk18[0x28 - 0x18]; // 18 }; -RED4EXT_ASSERT_SIZE(RenderProxy_Handle, 0x28); +RED4EXT_ASSERT_SIZE(CRenderProxy_Handle, 0x28); +RED4EXT_ASSERT_OFFSET(CRenderProxy_Handle, renderProxy, 0x10); } // namespace RED4ext diff --git a/include/RED4ext/RenderTypes.hpp b/include/RED4ext/RenderResource.hpp similarity index 59% rename from include/RED4ext/RenderTypes.hpp rename to include/RED4ext/RenderResource.hpp index 4daa02d2c..f37ba8f00 100644 --- a/include/RED4ext/RenderTypes.hpp +++ b/include/RED4ext/RenderResource.hpp @@ -1,12 +1,11 @@ #pragma once -#include - #include -#include #include #include +#include + namespace RED4ext { struct CRenderMesh @@ -21,10 +20,18 @@ struct CRenderMesh uint8_t unkB0[0x158 - 0xb0]; // B0 }; RED4EXT_ASSERT_SIZE(CRenderMesh, 0x158); +RED4EXT_ASSERT_OFFSET(CRenderMesh, quantizationScale, 0x10); +RED4EXT_ASSERT_OFFSET(CRenderMesh, quantizationBias, 0x20); +RED4EXT_ASSERT_OFFSET(CRenderMesh, vertexBufferID, 0x30); +RED4EXT_ASSERT_OFFSET(CRenderMesh, indexBufferID, 0x34); +RED4EXT_ASSERT_OFFSET(CRenderMesh, chunks, 0xA0); struct CRenderMorphTargetMesh : CRenderMesh { - uint8_t unk158[0x168 - 0x158]; // 158 + uint8_t unk158[0x160 - 0x158]; // 158 + uint32_t baseVertexBufferID; // 160 + uint8_t unk164[0x168 - 0x164]; // 164 }; RED4EXT_ASSERT_SIZE(CRenderMorphTargetMesh, 0x168); +RED4EXT_ASSERT_OFFSET(CRenderMorphTargetMesh, baseVertexBufferID, 0x160); } // namespace RED4ext diff --git a/include/RED4ext/Scripting/Natives/CMesh.hpp b/include/RED4ext/Scripting/Natives/CMesh.hpp new file mode 100644 index 000000000..a1c96c613 --- /dev/null +++ b/include/RED4ext/Scripting/Natives/CMesh.hpp @@ -0,0 +1,65 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace RED4ext +{ +struct CMaterialInstance; +struct CResource; +struct IMaterial; +struct IRenderResourceBlob; +namespace mesh { struct MeshAppearance; } +namespace mesh { struct MeshParameter; } + +struct CMesh : res::StreamedResource +{ + static constexpr const char* NAME = "CMesh"; + static constexpr const char* ALIAS = NAME; + + Box boundingBox; // 40 + Vector3 surfaceAreaPerAxis; // 60 + bool constrainAutoHideDistanceToTerrainHeightMap; // 6C + bool forceLoadAllAppearances; // 6D + bool castGlobalShadowsCachedInCook; // 6E + bool castLocalShadowsCachedInCook; // 6F + DynArray> parameters; // 70 + DynArray boneNames; // 80 + DynArray boneRigMatrices; // 90 + DynArray boneVertexEpsilons; // A0 + DynArray lodBoneMask; // B0 + DynArray floatTrackNames; // C0 + DynArray lodLevelInfo; // D0 + DynArray materialEntries; // E0 + DynArray> externalMaterials; // F0 + DynArray> localMaterialInstances; // 100 + mesh::MeshMaterialBuffer localMaterialBuffer; // 110 + DynArray> preloadExternalMaterials; // 1B0 + DynArray> preloadLocalMaterialInstances; // 1C0 + DynArray> inplaceResources; // 1D0 + DynArray> appearances; // 1E0 + CRenderMesh* runtimeRenderResource; // 1F0 + Handle renderResourceBlob; // 1F8 + bool useRayTracingShadowLODBias; // 208 + bool castsRayTracedShadowsFromOriginalGeometry; // 209 + bool isShadowMesh; // 20A + bool isPlayerShadowMesh; // 20B + uint8_t unk20C[0x219 - 0x20C]; // 20C + ERenderObjectType objectType; // 219 + uint8_t unk21A[0x230 - 0x21A]; // 21A +}; +RED4EXT_ASSERT_SIZE(CMesh, 0x230); +} // namespace RED4ext diff --git a/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp b/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp index 791ec8670..165086c63 100644 --- a/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/CMesh.hpp @@ -1,11 +1,23 @@ #pragma once -#include +// clang-format off + +// This file is generated from the Game's Reflection data + +#include + +namespace RED4ext +{ +RED4EXT_ASSERT_SIZE(CMesh, 0x230); +} // namespace RED4ext + +/* +#include #include +#include #include #include #include -#include #include #include #include @@ -13,7 +25,6 @@ #include #include #include -#include namespace RED4ext { @@ -24,41 +35,44 @@ struct IRenderResourceBlob; namespace mesh { struct MeshAppearance; } namespace mesh { struct MeshParameter; } -struct CMesh : res::StreamedResource +struct __declspec(align(0x10)) CMesh : res::StreamedResource { static constexpr const char* NAME = "CMesh"; static constexpr const char* ALIAS = NAME; - Box boundingBox; // 40 - Vector3 surfaceAreaPerAxis; // 60 - bool constrainAutoHideDistanceToTerrainHeightMap; // 6C - bool forceLoadAllAppearances; // 6D - bool castGlobalShadowsCachedInCook; // 6E - bool castLocalShadowsCachedInCook; // 6F - DynArray> parameters; // 70 - DynArray boneNames; // 80 - DynArray boneRigMatrices; // 90 - DynArray boneVertexEpsilons; // A0 - DynArray lodBoneMask; // B0 - DynArray floatTrackNames; // C0 - DynArray lodLevelInfo; // D0 - DynArray materialEntries; // E0 - DynArray> externalMaterials; // F0 + Box boundingBox; // 40 + Vector3 surfaceAreaPerAxis; // 60 + bool constrainAutoHideDistanceToTerrainHeightMap; // 6C + bool forceLoadAllAppearances; // 6D + bool castGlobalShadowsCachedInCook; // 6E + bool castLocalShadowsCachedInCook; // 6F + DynArray> parameters; // 70 + DynArray boneNames; // 80 + DynArray boneRigMatrices; // 90 + DynArray boneVertexEpsilons; // A0 + DynArray lodBoneMask; // B0 + DynArray floatTrackNames; // C0 + DynArray lodLevelInfo; // D0 + DynArray materialEntries; // E0 + DynArray> externalMaterials; // F0 DynArray> localMaterialInstances; // 100 - mesh::MeshMaterialBuffer localMaterialBuffer; // 110 - DynArray> preloadExternalMaterials; // 1B0 - DynArray> preloadLocalMaterialInstances; // 1C0 - DynArray> inplaceResources; // 1D0 - DynArray> appearances; // 1E0 - CRenderMesh* runtimeRenderResource; // 1F0 - Handle renderResourceBlob; // 1F8 - bool useRayTracingShadowLODBias; // 208 - bool castsRayTracedShadowsFromOriginalGeometry; // 209 - bool isShadowMesh; // 20A - bool isPlayerShadowMesh; // 20B - uint8_t unk20C[0x219 - 0x20C]; // 20C - ERenderObjectType objectType; // 219 - uint8_t unk21A[0x230 - 0x21A]; // 21A + mesh::MeshMaterialBuffer localMaterialBuffer; // 110 + DynArray> preloadExternalMaterials; // 1B0 + DynArray> preloadLocalMaterialInstances; // 1C0 + DynArray> inplaceResources; // 1D0 + DynArray> appearances; // 1E0 + uint8_t unk1F0[0x1F8 - 0x1F0]; // 1F0 + Handle renderResourceBlob; // 1F8 + bool useRayTracingShadowLODBias; // 208 + bool castsRayTracedShadowsFromOriginalGeometry; // 209 + bool isShadowMesh; // 20A + bool isPlayerShadowMesh; // 20B + uint8_t unk20C[0x219 - 0x20C]; // 20C + ERenderObjectType objectType; // 219 + uint8_t unk21A[0x230 - 0x21A]; // 21A }; RED4EXT_ASSERT_SIZE(CMesh, 0x230); } // namespace RED4ext +*/ + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/MorphTargetMesh.hpp b/include/RED4ext/Scripting/Natives/Generated/MorphTargetMesh.hpp index d6ed7f0f5..8ddf23ac9 100644 --- a/include/RED4ext/Scripting/Natives/Generated/MorphTargetMesh.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/MorphTargetMesh.hpp @@ -4,6 +4,14 @@ // This file is generated from the Game's Reflection data +#include + +namespace RED4ext +{ +RED4EXT_ASSERT_SIZE(MorphTargetMesh, 0xD0); +} // namespace RED4ext + +/* #include #include #include @@ -36,5 +44,6 @@ struct __declspec(align(0x10)) MorphTargetMesh : res::StreamedResource }; RED4EXT_ASSERT_SIZE(MorphTargetMesh, 0xD0); } // namespace RED4ext +*/ // clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/ent/MorphTargetSkinnedMeshComponent.hpp b/include/RED4ext/Scripting/Natives/Generated/ent/MorphTargetSkinnedMeshComponent.hpp index 995ee27a0..fd8ed4971 100644 --- a/include/RED4ext/Scripting/Natives/Generated/ent/MorphTargetSkinnedMeshComponent.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/ent/MorphTargetSkinnedMeshComponent.hpp @@ -4,6 +4,15 @@ // This file is generated from the Game's Reflection data +#include + +namespace RED4ext +{ +RED4EXT_ASSERT_SIZE(ent::MorphTargetSkinnedMeshComponent, 0x370); +using entMorphTargetSkinnedMeshComponent = ent::MorphTargetSkinnedMeshComponent; +} // namespace RED4ext + +/* #include #include #include @@ -45,5 +54,6 @@ RED4EXT_ASSERT_SIZE(MorphTargetSkinnedMeshComponent, 0x370); } // namespace ent using entMorphTargetSkinnedMeshComponent = ent::MorphTargetSkinnedMeshComponent; } // namespace RED4ext +*/ // clang-format on diff --git a/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp b/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp new file mode 100644 index 000000000..e764da0db --- /dev/null +++ b/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace RED4ext +{ +struct CMesh; +struct IRenderResourceBlob; +struct ITexture; + +struct MorphTargetMesh : res::StreamedResource +{ + static constexpr const char* NAME = "MorphTargetMesh"; + static constexpr const char* ALIAS = NAME; + + Box boundingBox; // 40 + Ref baseMesh; // 60 + CName baseTextureParamName; // 78 + Ref baseTexture; // 80 + CName baseMeshAppearance; // 98 + Handle blob; // A0 + DynArray targets; // B0 + CRenderMorphTargetMesh* runtimeRenderResource; // C0 + uint8_t unkC8[0xD0 - 0xC8]; // C8 +}; +RED4EXT_ASSERT_SIZE(MorphTargetMesh, 0xD0); +} // namespace RED4ext + diff --git a/include/RED4ext/Scripting/Natives/entMorphTargetSkinnedMeshComponent.hpp b/include/RED4ext/Scripting/Natives/entMorphTargetSkinnedMeshComponent.hpp new file mode 100644 index 000000000..0aedc1334 --- /dev/null +++ b/include/RED4ext/Scripting/Natives/entMorphTargetSkinnedMeshComponent.hpp @@ -0,0 +1,47 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace RED4ext +{ +struct MorphTargetMesh; + +namespace ent +{ +struct MorphTargetSkinnedMeshComponent : ent::ISkinTargetComponent +{ + static constexpr const char* NAME = "entMorphTargetSkinnedMeshComponent"; + static constexpr const char* ALIAS = NAME; + + uint8_t unk1E0[0x1E8 - 0x1E0]; // 1E0 + SharedPtr renderProxy; // 1E8 + uint8_t unk1F0[0x200 - 0x1F8]; // 1F8 + RaRef morphResource; // 200 + Handle meshHandle; // 208 + uint8_t unk208[0x238 - 0x218]; // 218 + CName meshAppearance; // 238 + uint64_t chunkMask; // 240 + uint8_t unk248[0x2E8 - 0x248]; // 248 + CName renderingPlaneAnimationParam; // 2E8 + CName visibilityAnimationParam; // 2F0 + uint8_t unk2F8[0x308 - 0x2F8]; // 2F8 + red::TagList tags; // 308 + uint8_t unk318[0x35C - 0x318]; // 318 + shadows::ShadowCastingMode castShadows; // 35C + shadows::ShadowCastingMode castLocalShadows; // 35D + bool acceptDismemberment; // 35E + uint8_t unk35F[0x361 - 0x35F]; // 35F + uint8_t version; // 361 + uint8_t unk362[0x370 - 0x362]; // 362 +}; +RED4EXT_ASSERT_SIZE(MorphTargetSkinnedMeshComponent, 0x370); +} // namespace ent +} // namespace RED4ext diff --git a/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp b/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp index 46822ac7e..a038e5ab0 100644 --- a/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp +++ b/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp @@ -10,6 +10,7 @@ #include #include #include + #include namespace RED4ext From 73e01e071f142d051e6515d55fac34a864c77154 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Sun, 19 Jan 2025 12:51:33 -0500 Subject: [PATCH 10/28] Fix formatting --- include/RED4ext/GpuApi/Buffer.hpp | 4 +++- include/RED4ext/GpuApi/CommandListContext-inl.hpp | 2 +- include/RED4ext/RenderProxy.hpp | 1 - include/RED4ext/Scripting/Natives/CMesh.hpp | 7 +++++-- include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp | 1 - 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/RED4ext/GpuApi/Buffer.hpp b/include/RED4ext/GpuApi/Buffer.hpp index 4fe41107c..ce23274fa 100644 --- a/include/RED4ext/GpuApi/Buffer.hpp +++ b/include/RED4ext/GpuApi/Buffer.hpp @@ -1,10 +1,12 @@ #pragma once #include -#include + #include #include +#include + namespace RED4ext { namespace GpuApi diff --git a/include/RED4ext/GpuApi/CommandListContext-inl.hpp b/include/RED4ext/GpuApi/CommandListContext-inl.hpp index 5f9378e45..a8000628b 100644 --- a/include/RED4ext/GpuApi/CommandListContext-inl.hpp +++ b/include/RED4ext/GpuApi/CommandListContext-inl.hpp @@ -29,7 +29,7 @@ RED4EXT_INLINE void CommandListContext::FlushPendingBarriers() func(this); } -RED4EXT_INLINE CommandListContext* AcquireFreeCommandList(CommandListType aType, const StringView& aDebugName, +RED4EXT_INLINE CommandListContext* AcquireFreeCommandList(CommandListType aType, const StringView& aDebugName, uint64_t aHash) { // NOTE: This function has parameters for debug name and hash which seem to be optional. diff --git a/include/RED4ext/RenderProxy.hpp b/include/RED4ext/RenderProxy.hpp index 7c2f141d3..e2fcabe24 100644 --- a/include/RED4ext/RenderProxy.hpp +++ b/include/RED4ext/RenderProxy.hpp @@ -6,7 +6,6 @@ #include - namespace RED4ext { struct IRenderProxy diff --git a/include/RED4ext/Scripting/Natives/CMesh.hpp b/include/RED4ext/Scripting/Natives/CMesh.hpp index a1c96c613..1603c5b01 100644 --- a/include/RED4ext/Scripting/Natives/CMesh.hpp +++ b/include/RED4ext/Scripting/Natives/CMesh.hpp @@ -22,8 +22,11 @@ struct CMaterialInstance; struct CResource; struct IMaterial; struct IRenderResourceBlob; -namespace mesh { struct MeshAppearance; } -namespace mesh { struct MeshParameter; } +namespace mesh +{ +struct MeshAppearance; +struct MeshParameter; +} struct CMesh : res::StreamedResource { diff --git a/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp b/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp index e764da0db..18adb70ce 100644 --- a/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp +++ b/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp @@ -35,4 +35,3 @@ struct MorphTargetMesh : res::StreamedResource }; RED4EXT_ASSERT_SIZE(MorphTargetMesh, 0xD0); } // namespace RED4ext - From c018e336df94960baffeda6f9528f5d54fbe68cb Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Sun, 19 Jan 2025 12:54:03 -0500 Subject: [PATCH 11/28] Remove whitespace --- include/RED4ext/Scripting/Natives/CMesh.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/RED4ext/Scripting/Natives/CMesh.hpp b/include/RED4ext/Scripting/Natives/CMesh.hpp index 1603c5b01..fc246283e 100644 --- a/include/RED4ext/Scripting/Natives/CMesh.hpp +++ b/include/RED4ext/Scripting/Natives/CMesh.hpp @@ -22,11 +22,11 @@ struct CMaterialInstance; struct CResource; struct IMaterial; struct IRenderResourceBlob; -namespace mesh -{ +namespace mesh +{ struct MeshAppearance; -struct MeshParameter; -} +struct MeshParameter; +} // namespace mesh struct CMesh : res::StreamedResource { From a009e4549170093d7f52a078d1f9d2e6682c9073 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Sun, 19 Jan 2025 12:56:22 -0500 Subject: [PATCH 12/28] Minor formatting --- include/RED4ext/Scripting/Natives/Vector2.hpp | 1 + include/RED4ext/Scripting/Natives/Vector3.hpp | 1 + include/RED4ext/Scripting/Natives/Vector4.hpp | 1 + 3 files changed, 3 insertions(+) diff --git a/include/RED4ext/Scripting/Natives/Vector2.hpp b/include/RED4ext/Scripting/Natives/Vector2.hpp index 0b9f414d5..18fa95fbc 100644 --- a/include/RED4ext/Scripting/Natives/Vector2.hpp +++ b/include/RED4ext/Scripting/Natives/Vector2.hpp @@ -1,6 +1,7 @@ #pragma once #include + #include namespace RED4ext diff --git a/include/RED4ext/Scripting/Natives/Vector3.hpp b/include/RED4ext/Scripting/Natives/Vector3.hpp index 891cc0be0..a3c9580c5 100644 --- a/include/RED4ext/Scripting/Natives/Vector3.hpp +++ b/include/RED4ext/Scripting/Natives/Vector3.hpp @@ -1,6 +1,7 @@ #pragma once #include + #include namespace RED4ext diff --git a/include/RED4ext/Scripting/Natives/Vector4.hpp b/include/RED4ext/Scripting/Natives/Vector4.hpp index c89ac901f..53af6ab45 100644 --- a/include/RED4ext/Scripting/Natives/Vector4.hpp +++ b/include/RED4ext/Scripting/Natives/Vector4.hpp @@ -1,6 +1,7 @@ #pragma once #include + #include #include From c569af37b87862e9f5a0b28d6edc9429a5fc7ede Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Sun, 19 Jan 2025 13:33:58 -0500 Subject: [PATCH 13/28] Add Reloc constness --- .../RED4ext/GpuApi/CommandListContext-inl.hpp | 6 ++--- include/RED4ext/GpuApi/D3D12MemAlloc-inl.hpp | 2 +- include/RED4ext/GpuApi/DeviceData-inl.hpp | 2 +- include/RED4ext/RenderProxy-inl.hpp | 22 +++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/RED4ext/GpuApi/CommandListContext-inl.hpp b/include/RED4ext/GpuApi/CommandListContext-inl.hpp index a8000628b..86789c185 100644 --- a/include/RED4ext/GpuApi/CommandListContext-inl.hpp +++ b/include/RED4ext/GpuApi/CommandListContext-inl.hpp @@ -11,14 +11,14 @@ namespace RED4ext::GpuApi RED4EXT_INLINE void CommandListContext::AddPendingBarrier(const D3D12_RESOURCE_BARRIER& aBarrier) { using func_t = void (*)(CommandListContext*, const D3D12_RESOURCE_BARRIER&); - static UniversalRelocFunc func(Detail::AddressHashes::CommandListContext_AddPendingBarrier); + static const UniversalRelocFunc func(Detail::AddressHashes::CommandListContext_AddPendingBarrier); func(this, aBarrier); } RED4EXT_INLINE void CommandListContext::Close() { using func_t = void (*)(CommandListContext*); - static UniversalRelocFunc func(Detail::AddressHashes::CommandListContext_Close); + static const UniversalRelocFunc func(Detail::AddressHashes::CommandListContext_Close); func(this); } @@ -35,7 +35,7 @@ RED4EXT_INLINE CommandListContext* AcquireFreeCommandList(CommandListType aType, // NOTE: This function has parameters for debug name and hash which seem to be optional. // Expects unique ptr as an out param and returns it by reference. using func_t = CommandListContext*& (*)(CommandListContext*&, CommandListType, const StringView&, uint64_t); - static UniversalRelocFunc func(Detail::AddressHashes::GetFreeCommandList); + static const UniversalRelocFunc func(Detail::AddressHashes::GetFreeCommandList); // TODO: This should be unique_ptr which function fills in and returns. CommandListContext* outContext = nullptr; diff --git a/include/RED4ext/GpuApi/D3D12MemAlloc-inl.hpp b/include/RED4ext/GpuApi/D3D12MemAlloc-inl.hpp index 72ddf462c..e4d9c28e1 100644 --- a/include/RED4ext/GpuApi/D3D12MemAlloc-inl.hpp +++ b/include/RED4ext/GpuApi/D3D12MemAlloc-inl.hpp @@ -16,7 +16,7 @@ RED4EXT_INLINE HRESULT D3D12MA::Allocator::CreateResource(const ALLOCATION_DESC* { using func_t = HRESULT (*)(Allocator*, const ALLOCATION_DESC*, const D3D12_RESOURCE_DESC*, D3D12_RESOURCE_STATES, const D3D12_CLEAR_VALUE*, Allocation**, REFIID, void**); - static RED4ext::UniversalRelocFunc func(RED4ext::Detail::AddressHashes::Allocator_CreateResource); + static const RED4ext::UniversalRelocFunc func(RED4ext::Detail::AddressHashes::Allocator_CreateResource); return func(this, pAllocDesc, pResourceDesc, InitialResourceState, pOptimizedClearValue, ppAllocation, riidResource, ppvResource); } \ No newline at end of file diff --git a/include/RED4ext/GpuApi/DeviceData-inl.hpp b/include/RED4ext/GpuApi/DeviceData-inl.hpp index 6b77222ad..577d7314e 100644 --- a/include/RED4ext/GpuApi/DeviceData-inl.hpp +++ b/include/RED4ext/GpuApi/DeviceData-inl.hpp @@ -8,7 +8,7 @@ namespace RED4ext::GpuApi { RED4EXT_INLINE SDeviceData* GetDeviceData() { - static UniversalRelocPtr dd(Detail::AddressHashes::g_DeviceData); + static const UniversalRelocPtr dd(Detail::AddressHashes::g_DeviceData); return dd; } } // namespace RED4ext::GpuApi diff --git a/include/RED4ext/RenderProxy-inl.hpp b/include/RED4ext/RenderProxy-inl.hpp index b28d7c7f1..cb765bdb0 100644 --- a/include/RED4ext/RenderProxy-inl.hpp +++ b/include/RED4ext/RenderProxy-inl.hpp @@ -11,19 +11,19 @@ namespace RED4ext { RED4EXT_INLINE void IRenderProxy::sub_00() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_00); + static const UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_00); func(); } RED4EXT_INLINE void IRenderProxy::sub_08() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_08); + static const UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_08); func(this); } RED4EXT_INLINE uint8_t IRenderProxy::sub_18() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_18); + static const UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_18); return func(this); } @@ -59,13 +59,13 @@ RED4EXT_INLINE void IRenderProxy::sub_50() RED4EXT_INLINE uint32_t IRenderProxy::sub_58() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_58); + static const UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_58); return func(this); } RED4EXT_INLINE float IRenderProxy::sub_60() { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_60); + static const UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_60); return func(this); } @@ -81,14 +81,14 @@ RED4EXT_INLINE uint8_t IRenderProxy::sub_70() RED4EXT_INLINE void IRenderProxy::sub_78(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_78); + static const UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_78); func(this, a1); } RED4EXT_INLINE void IRenderProxy::sub_80(void* a1, void* a2) { using func_t = void (*)(IRenderProxy*, void*, void*); - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_80); + static const UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_80); func(this, a1, a2); } @@ -101,13 +101,13 @@ RED4EXT_INLINE bool IRenderProxy::sub_88(void* a1, void* a2) RED4EXT_INLINE void IRenderProxy::sub_90(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_90); + static const UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_90); func(this, a1); } RED4EXT_INLINE void IRenderProxy::sub_98(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_98); + static const UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_98); func(this, a1); } @@ -117,13 +117,13 @@ RED4EXT_INLINE void IRenderProxy::sub_A0() RED4EXT_INLINE uint8_t IRenderProxy::sub_A8(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_A8); + static const UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_A8); return func(this, a1); } RED4EXT_INLINE void IRenderProxy::sub_B0(void* a1) { - static UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_B0); + static const UniversalRelocFunc func(Detail::AddressHashes::IRenderProxy_sub_B0); func(this, a1); } From a6e38c113ceb35efc571804da1ba82df9c4beea5 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Sun, 19 Jan 2025 14:20:41 -0500 Subject: [PATCH 14/28] Keep manual alignment & update `CONTRIBUTING.md` --- CONTRIBUTING.md | 13 +++---------- include/RED4ext/Scripting/Natives/CMesh.hpp | 2 +- .../RED4ext/Scripting/Natives/MorphTargetMesh.hpp | 2 +- .../Natives/entMorphTargetSkinnedMeshComponent.hpp | 2 +- .../Scripting/Natives/entSkinnedMeshComponent.hpp | 2 +- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1ffc0e2db..17b5efef2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -106,14 +106,7 @@ one: static constexpr const char* NAME = "vehicleBaseObject"; ``` -3. Remove `__declspec()` declaration: - -```diff -- struct __declspec(align(0x10)) BaseObject : game::Object -+ struct BaseObject : game::Object -``` - -4. Declare the new member based on its offset and type: +3. Declare the new member based on its offset and type: ```diff { @@ -131,7 +124,7 @@ one: }; ``` -5. Assert the offset of known members: +4. Assert the offset of known members: ```diff }; @@ -145,7 +138,7 @@ using VehicleObject = vehicle::BaseObject; } // namespace RED4ext ``` -6. Remove these comments: +5. Remove these comments: ```diff -// clang-format off diff --git a/include/RED4ext/Scripting/Natives/CMesh.hpp b/include/RED4ext/Scripting/Natives/CMesh.hpp index fc246283e..8905fa079 100644 --- a/include/RED4ext/Scripting/Natives/CMesh.hpp +++ b/include/RED4ext/Scripting/Natives/CMesh.hpp @@ -28,7 +28,7 @@ struct MeshAppearance; struct MeshParameter; } // namespace mesh -struct CMesh : res::StreamedResource +struct __declspec(align(0x10)) CMesh : res::StreamedResource { static constexpr const char* NAME = "CMesh"; static constexpr const char* ALIAS = NAME; diff --git a/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp b/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp index 18adb70ce..d4881079c 100644 --- a/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp +++ b/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp @@ -18,7 +18,7 @@ struct CMesh; struct IRenderResourceBlob; struct ITexture; -struct MorphTargetMesh : res::StreamedResource +struct __declspec(align(0x10)) MorphTargetMesh : res::StreamedResource { static constexpr const char* NAME = "MorphTargetMesh"; static constexpr const char* ALIAS = NAME; diff --git a/include/RED4ext/Scripting/Natives/entMorphTargetSkinnedMeshComponent.hpp b/include/RED4ext/Scripting/Natives/entMorphTargetSkinnedMeshComponent.hpp index 0aedc1334..7a5adeb5d 100644 --- a/include/RED4ext/Scripting/Natives/entMorphTargetSkinnedMeshComponent.hpp +++ b/include/RED4ext/Scripting/Natives/entMorphTargetSkinnedMeshComponent.hpp @@ -16,7 +16,7 @@ struct MorphTargetMesh; namespace ent { -struct MorphTargetSkinnedMeshComponent : ent::ISkinTargetComponent +struct __declspec(align(0x10)) MorphTargetSkinnedMeshComponent : ent::ISkinTargetComponent { static constexpr const char* NAME = "entMorphTargetSkinnedMeshComponent"; static constexpr const char* ALIAS = NAME; diff --git a/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp b/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp index a038e5ab0..50030530f 100644 --- a/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp +++ b/include/RED4ext/Scripting/Natives/entSkinnedMeshComponent.hpp @@ -17,7 +17,7 @@ namespace RED4ext { namespace ent { -struct SkinnedMeshComponent : ent::ISkinTargetComponent +struct __declspec(align(0x10)) SkinnedMeshComponent : ent::ISkinTargetComponent { static constexpr const char* NAME = "entSkinnedMeshComponent"; static constexpr const char* ALIAS = NAME; From 75fc696ac462b275cce8552bc87cc9a5917be71e Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Tue, 21 Jan 2025 08:56:24 -0500 Subject: [PATCH 15/28] Improve semantics --- include/RED4ext/RenderProxy.hpp | 14 +++++++------- include/RED4ext/Scripting/Natives/CMesh.hpp | 2 +- .../Scripting/Natives/MorphTargetMesh.hpp | 18 +++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/RED4ext/RenderProxy.hpp b/include/RED4ext/RenderProxy.hpp index e2fcabe24..16fe0f72a 100644 --- a/include/RED4ext/RenderProxy.hpp +++ b/include/RED4ext/RenderProxy.hpp @@ -61,23 +61,23 @@ struct CRenderProxy : RenderProxyBase }; RED4EXT_ASSERT_SIZE(CRenderProxy, 0xb8); -struct MeshRenderProxy : CRenderProxy +struct CRenderProxy_Mesh : CRenderProxy { uint8_t unkB8[0xd8 - 0xb8]; // B8 CRenderMesh* renderMesh; // D8 uint8_t unkE0[0x1c0 - 0xe0]; // E0 }; -RED4EXT_ASSERT_SIZE(MeshRenderProxy, 0x1c0); -RED4EXT_ASSERT_OFFSET(MeshRenderProxy, renderMesh, 0xD8); +RED4EXT_ASSERT_SIZE(CRenderProxy_Mesh, 0x1c0); +RED4EXT_ASSERT_OFFSET(CRenderProxy_Mesh, renderMesh, 0xD8); -struct CRenderProxy_Handle +struct CRenderProxyHandle { - virtual ~CRenderProxy_Handle() = default; // 00 + virtual ~CRenderProxyHandle() = default; // 00 uint8_t unk08[0x10 - 0x08]; // 08 IRenderProxy* renderProxy; // 10 uint8_t unk18[0x28 - 0x18]; // 18 }; -RED4EXT_ASSERT_SIZE(CRenderProxy_Handle, 0x28); -RED4EXT_ASSERT_OFFSET(CRenderProxy_Handle, renderProxy, 0x10); +RED4EXT_ASSERT_SIZE(CRenderProxyHandle, 0x28); +RED4EXT_ASSERT_OFFSET(CRenderProxyHandle, renderProxy, 0x10); } // namespace RED4ext diff --git a/include/RED4ext/Scripting/Natives/CMesh.hpp b/include/RED4ext/Scripting/Natives/CMesh.hpp index 8905fa079..d8fec7ba0 100644 --- a/include/RED4ext/Scripting/Natives/CMesh.hpp +++ b/include/RED4ext/Scripting/Natives/CMesh.hpp @@ -54,7 +54,7 @@ struct __declspec(align(0x10)) CMesh : res::StreamedResource DynArray> preloadLocalMaterialInstances; // 1C0 DynArray> inplaceResources; // 1D0 DynArray> appearances; // 1E0 - CRenderMesh* runtimeRenderResource; // 1F0 + CRenderMesh* renderResource; // 1F0 Handle renderResourceBlob; // 1F8 bool useRayTracingShadowLODBias; // 208 bool castsRayTracedShadowsFromOriginalGeometry; // 209 diff --git a/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp b/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp index d4881079c..89153a8b6 100644 --- a/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp +++ b/include/RED4ext/Scripting/Natives/MorphTargetMesh.hpp @@ -23,15 +23,15 @@ struct __declspec(align(0x10)) MorphTargetMesh : res::StreamedResource static constexpr const char* NAME = "MorphTargetMesh"; static constexpr const char* ALIAS = NAME; - Box boundingBox; // 40 - Ref baseMesh; // 60 - CName baseTextureParamName; // 78 - Ref baseTexture; // 80 - CName baseMeshAppearance; // 98 - Handle blob; // A0 - DynArray targets; // B0 - CRenderMorphTargetMesh* runtimeRenderResource; // C0 - uint8_t unkC8[0xD0 - 0xC8]; // C8 + Box boundingBox; // 40 + Ref baseMesh; // 60 + CName baseTextureParamName; // 78 + Ref baseTexture; // 80 + CName baseMeshAppearance; // 98 + Handle blob; // A0 + DynArray targets; // B0 + CRenderMorphTargetMesh* renderResource; // C0 + uint8_t unkC8[0xD0 - 0xC8]; // C8 }; RED4EXT_ASSERT_SIZE(MorphTargetMesh, 0xD0); } // namespace RED4ext From 830fbca3290fc256dd5d137329929179df0e6db4 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Wed, 22 Jan 2025 14:05:10 -0500 Subject: [PATCH 16/28] Add Dumper namespace exceptionality --- include/RED4ext/Dump/Reflection-inl.hpp | 10 +++++++--- include/RED4ext/GpuApi/Buffer.hpp | 11 +++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index c1ae386b7..0df3438d8 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -40,10 +40,14 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a auto GetPrefix = [](const std::string& aInput) -> std::string { size_t i = 0; - // Special case for AI - if (aInput.size() >= 2 && aInput[0] == 'A' && aInput[1] == 'I') + constexpr std::string_view exceptions[] = {"AI", "GpuWrapApi"}; + + for (const auto& exception : exceptions) { - i = 2; + if (aInput.size() > exception.size() && aInput.starts_with(exception)) + { + i = exception.size(); + } } // Special case of "in", this will break directory layout for "ink", "interop", etc.. diff --git a/include/RED4ext/GpuApi/Buffer.hpp b/include/RED4ext/GpuApi/Buffer.hpp index ce23274fa..410286ed3 100644 --- a/include/RED4ext/GpuApi/Buffer.hpp +++ b/include/RED4ext/GpuApi/Buffer.hpp @@ -11,6 +11,17 @@ namespace RED4ext { namespace GpuApi { +enum eBufferUsageType : uint8_t +{ + BUT_Default, + BUT_Immutable, + BUT_Readback, + BUT_Dynamic_Legacy, + BUT_Transient, + BUT_Mapped, + BUT_MAX +}; + struct SBufferData { uint32_t bufferSize; // 00 From 232351395876fe65b6b71860cd87818e0c5cd283 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Wed, 22 Jan 2025 15:40:03 -0500 Subject: [PATCH 17/28] Update generated dump --- include/RED4ext/Dump/Reflection-inl.hpp | 4 + .../Generated/GpuWrapApi/VertexLayoutDesc.hpp | 31 +++++++ .../GpuWrapApi/VertexPackingEStreamType.hpp | 22 +++++ .../VertexPackingPackingElement.hpp | 33 +++++++ .../GpuWrapApi/VertexPackingePackingType.hpp | 51 +++++++++++ .../GpuWrapApi/VertexPackingePackingUsage.hpp | 44 ++++++++++ .../GpuWrapApi/eIndexBufferChunkType.hpp | 21 +++++ .../Generated/GpuWrapApi/eTextureFormat.hpp | 85 +++++++++++++++++++ .../Generated/GpuWrapApi/eTextureGroup.hpp | 30 +++++++ .../Generated/GpuWrapApi/eTextureType.hpp | 22 +++++ .../Generated/PSODescRenderTargetSetup.hpp | 6 +- .../Natives/Generated/STextureGroupSetup.hpp | 4 +- .../Natives/Generated/ex/EntitySpawner.hpp | 26 ++++++ .../quest/ICharacterConditionType.hpp | 2 +- .../Generated/rend/IndexBufferChunk.hpp | 4 +- .../rend/RenderTextureBlobTextureInfo.hpp | 4 +- .../Generated/rend/VertexBufferChunk.hpp | 4 +- 17 files changed, 381 insertions(+), 12 deletions(-) create mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexLayoutDesc.hpp create mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingEStreamType.hpp create mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingPackingElement.hpp create mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingType.hpp create mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingUsage.hpp create mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eIndexBufferChunkType.hpp create mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureFormat.hpp create mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureGroup.hpp create mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureType.hpp create mode 100644 include/RED4ext/Scripting/Natives/Generated/ex/EntitySpawner.hpp diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index 15926cbec..0f352cbfc 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -47,6 +47,10 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a { if (aInput.size() > exception.size() && aInput.starts_with(exception)) { + if(exception == "GpuWrapApi") + { + return aInput.substr(0, exception.size()); + } i = exception.size(); } } diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexLayoutDesc.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexLayoutDesc.hpp new file mode 100644 index 000000000..5a765e257 --- /dev/null +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexLayoutDesc.hpp @@ -0,0 +1,31 @@ +#pragma once + +// clang-format off + +// This file is generated from the Game's Reflection data + +#include +#include +#include +#include + +namespace RED4ext +{ +namespace GpuWrapApi +{ +struct VertexLayoutDesc +{ + static constexpr const char* NAME = "GpuWrapApiVertexLayoutDesc"; + static constexpr const char* ALIAS = NAME; + + StaticArray elements; // 00 + StaticArray slotStrides; // A4 + uint32_t slotMask; // B0 + uint32_t hash; // B4 +}; +RED4EXT_ASSERT_SIZE(VertexLayoutDesc, 0xB8); +} // namespace GpuWrapApi +using GpuWrapApiVertexLayoutDesc = GpuWrapApi::VertexLayoutDesc; +} // namespace RED4ext + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingEStreamType.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingEStreamType.hpp new file mode 100644 index 000000000..70c82d0de --- /dev/null +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingEStreamType.hpp @@ -0,0 +1,22 @@ +#pragma once + +// clang-format off + +// This file is generated from the Game's Reflection data + +#include +namespace RED4ext +{ +namespace GpuWrapApi { +enum class VertexPackingEStreamType : uint8_t +{ + ST_PerVertex = 0, + ST_PerInstance = 1, + ST_Max = 2, + ST_Invalid = 255, +}; +} // namespace GpuWrapApi +using GpuWrapApiVertexPackingEStreamType = GpuWrapApi::VertexPackingEStreamType; +} // namespace RED4ext + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingPackingElement.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingPackingElement.hpp new file mode 100644 index 000000000..d6f0805b0 --- /dev/null +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingPackingElement.hpp @@ -0,0 +1,33 @@ +#pragma once + +// clang-format off + +// This file is generated from the Game's Reflection data + +#include +#include +#include +#include +#include + +namespace RED4ext +{ +namespace GpuWrapApi +{ +struct VertexPackingPackingElement +{ + static constexpr const char* NAME = "GpuWrapApiVertexPackingPackingElement"; + static constexpr const char* ALIAS = NAME; + + GpuWrapApi::VertexPackingePackingType type; // 00 + GpuWrapApi::VertexPackingePackingUsage usage; // 01 + uint8_t usageIndex; // 02 + uint8_t streamIndex; // 03 + GpuWrapApi::VertexPackingEStreamType streamType; // 04 +}; +RED4EXT_ASSERT_SIZE(VertexPackingPackingElement, 0x5); +} // namespace GpuWrapApi +using GpuWrapApiVertexPackingPackingElement = GpuWrapApi::VertexPackingPackingElement; +} // namespace RED4ext + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingType.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingType.hpp new file mode 100644 index 000000000..8053098f0 --- /dev/null +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingType.hpp @@ -0,0 +1,51 @@ +#pragma once + +// clang-format off + +// This file is generated from the Game's Reflection data + +#include +namespace RED4ext +{ +namespace GpuWrapApi { +enum class VertexPackingePackingType : uint8_t +{ + PT_Float1 = 0, + PT_Float2 = 1, + PT_Float3 = 2, + PT_Float4 = 3, + PT_Float16_2 = 4, + PT_Float16_4 = 5, + PT_UShort1 = 6, + PT_UShort2 = 7, + PT_UShort4 = 8, + PT_UShort4N = 9, + PT_Short1 = 10, + PT_Short2 = 11, + PT_Short4 = 12, + PT_Short4N = 13, + PT_UInt1 = 14, + PT_UInt2 = 15, + PT_UInt3 = 16, + PT_UInt4 = 17, + PT_Int1 = 18, + PT_Int2 = 19, + PT_Int3 = 20, + PT_Int4 = 21, + PT_Color = 22, + PT_UByte1 = 23, + PT_UByte1F = 24, + PT_UByte4 = 25, + PT_UByte4N = 26, + PT_Byte4N = 27, + PT_Dec4 = 28, + PT_Index16 = 29, + PT_Index32 = 30, + PT_Max = 31, + PT_Invalid = 255, +}; +} // namespace GpuWrapApi +using GpuWrapApiVertexPackingePackingType = GpuWrapApi::VertexPackingePackingType; +} // namespace RED4ext + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingUsage.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingUsage.hpp new file mode 100644 index 000000000..2408ddcb2 --- /dev/null +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingUsage.hpp @@ -0,0 +1,44 @@ +#pragma once + +// clang-format off + +// This file is generated from the Game's Reflection data + +#include +namespace RED4ext +{ +namespace GpuWrapApi { +enum class VertexPackingePackingUsage : uint8_t +{ + PS_SysPosition = 0, + PS_Position = 1, + PS_Normal = 2, + PS_Tangent = 3, + PS_Binormal = 4, + PS_TexCoord = 5, + PS_Color = 6, + PS_SkinIndices = 7, + PS_SkinWeights = 8, + PS_DestructionIndices = 9, + PS_MultilayerPaint = 10, + PS_InstanceTransform = 11, + PS_InstanceLODParams = 12, + PS_InstanceSkinningData = 13, + PS_PatchSize = 14, + PS_PatchBias = 15, + PS_ExtraData = 16, + PS_VehicleDmgNormal = 17, + PS_VehicleDmgPosition = 18, + PS_PositionDelta = 19, + PS_LightBlockerIntensity = 20, + PS_BoneIndex = 21, + PS_Padding = 22, + PS_PatchOffset = 23, + PS_Max = 24, + PS_Invalid = 255, +}; +} // namespace GpuWrapApi +using GpuWrapApiVertexPackingePackingUsage = GpuWrapApi::VertexPackingePackingUsage; +} // namespace RED4ext + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eIndexBufferChunkType.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eIndexBufferChunkType.hpp new file mode 100644 index 000000000..a74b98b3d --- /dev/null +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eIndexBufferChunkType.hpp @@ -0,0 +1,21 @@ +#pragma once + +// clang-format off + +// This file is generated from the Game's Reflection data + +#include +namespace RED4ext +{ +namespace GpuWrapApi { +enum class eIndexBufferChunkType : uint8_t +{ + IBCT_IndexUInt = 0, + IBCT_IndexUShort = 1, + IBCT_Max = 2, +}; +} // namespace GpuWrapApi +using GpuWrapApieIndexBufferChunkType = GpuWrapApi::eIndexBufferChunkType; +} // namespace RED4ext + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureFormat.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureFormat.hpp new file mode 100644 index 000000000..a442ac3ee --- /dev/null +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureFormat.hpp @@ -0,0 +1,85 @@ +#pragma once + +// clang-format off + +// This file is generated from the Game's Reflection data + +#include +namespace RED4ext +{ +namespace GpuWrapApi { +enum class eTextureFormat : uint8_t +{ + TEXFMT_A8_Unorm = 0, + TEXFMT_R8_Unorm = 1, + TEXFMT_L8_Unorm = 2, + TEXFMT_R8G8_Unorm = 3, + TEXFMT_R8G8B8X8_Unorm = 4, + TEXFMT_R8G8B8A8_Unorm = 5, + TEXFMT_R8G8B8A8_Snorm = 6, + TEXFMT_R16_Unorm = 7, + TEXFMT_R16_Uint = 8, + TEXFMT_R32_Uint = 9, + TEXFMT_R32G32B32A32_Uint = 10, + TEXFMT_R32G32_Uint = 11, + TEXFMT_R16G16B16A16_Unorm = 12, + TEXFMT_R16G16B16A16_Uint = 14, + TEXFMT_R16G16_Uint = 15, + TEXFMT_R10G10B10A2_Unorm = 16, + TEXFMT_R16G16B16A16_Float = 17, + TEXFMT_R11G11B10_Float = 18, + TEXFMT_R16G16_Float = 19, + TEXFMT_R32G32_Float = 20, + TEXFMT_R32G32B32A32_Float = 21, + TEXFMT_R32_Float = 22, + TEXFMT_R16_Float = 23, + TEXFMT_D24S8 = 24, + TEXFMT_D32FS8 = 25, + TEXFMT_D32F = 27, + TEXFMT_D16U = 28, + TEXFMT_BC1 = 29, + TEXFMT_BC2 = 30, + TEXFMT_BC3 = 31, + TEXFMT_BC4 = 32, + TEXFMT_BC5 = 33, + TEXFMT_BC6H_UNSIGNED = 34, + TEXFMT_BC6H_SIGNED = 35, + TEXFMT_BC7 = 36, + TEXFMT_BC7_SRGB = 37, + TEXFMT_R8_Uint = 38, + TEXFMT_R8G8B8A8_Unorm_SRGB = 40, + TEXFMT_BC1_SRGB = 41, + TEXFMT_BC2_SRGB = 42, + TEXFMT_BC3_SRGB = 43, + TEXFMT_R16G16_Unorm = 44, + TEXFMT_R16G16_Sint = 45, + TEXFMT_R16G16_Snorm = 46, + TEXFMT_B5G6R5_Unorm = 47, + TEXFMT_R16_Snorm = 49, + TEXFMT_B8G8R8A8 = 50, + TEXFMT_B8G8R8A8_SRGB = 51, + TEXFMT_A8 = TEXFMT_A8_Unorm, + TEXFMT_BC6H = TEXFMT_BC6H_UNSIGNED, + TEXFMT_Float_R11G11B10 = TEXFMT_R11G11B10_Float, + TEXFMT_Float_R16 = TEXFMT_R16_Float, + TEXFMT_Float_R16G16 = TEXFMT_R16G16_Float, + TEXFMT_Float_R16G16B16A16 = TEXFMT_R16G16B16A16_Float, + TEXFMT_Float_R32 = TEXFMT_R32_Float, + TEXFMT_Float_R32G32 = TEXFMT_R32G32_Float, + TEXFMT_Float_R32G32B32A32 = TEXFMT_R32G32B32A32_Float, + TEXFMT_L8 = TEXFMT_L8_Unorm, + TEXFMT_R10G10B10A2 = TEXFMT_R10G10B10A2_Unorm, + TEXFMT_R8 = TEXFMT_R8_Unorm, + TEXFMT_R8G8 = TEXFMT_R8G8_Unorm, + TEXFMT_R8G8B8A8 = TEXFMT_R8G8B8A8_Unorm_SRGB, + TEXFMT_R8G8B8X8 = TEXFMT_R8G8B8X8_Unorm, + TEXFMT_Uint_16 = TEXFMT_R16_Uint, + TEXFMT_Uint_16_norm = TEXFMT_R16_Unorm, + TEXFMT_Uint_32 = TEXFMT_R32_Uint, + TEXFMT_Uint_R32G32B32A32 = TEXFMT_R16G16B16A16_Uint, +}; +} // namespace GpuWrapApi +using GpuWrapApieTextureFormat = GpuWrapApi::eTextureFormat; +} // namespace RED4ext + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureGroup.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureGroup.hpp new file mode 100644 index 000000000..2fc234d7a --- /dev/null +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureGroup.hpp @@ -0,0 +1,30 @@ +#pragma once + +// clang-format off + +// This file is generated from the Game's Reflection data + +#include +namespace RED4ext +{ +namespace GpuWrapApi { +enum class eTextureGroup : uint8_t +{ + TEXG_Generic_Color = 1, + TEXG_Generic_Grayscale = 2, + TEXG_Generic_Normal = 3, + TEXG_Generic_Data = 4, + TEXG_Generic_UI = 5, + TEXG_Generic_Font = 6, + TEXG_Generic_LUT = 7, + TEXG_Generic_MorphBlend = 8, + TEXG_Multilayer_Color = 9, + TEXG_Multilayer_Normal = 10, + TEXG_Multilayer_Grayscale = 11, + TEXG_Multilayer_Microblend = 12, +}; +} // namespace GpuWrapApi +using GpuWrapApieTextureGroup = GpuWrapApi::eTextureGroup; +} // namespace RED4ext + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureType.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureType.hpp new file mode 100644 index 000000000..61cf44a6b --- /dev/null +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureType.hpp @@ -0,0 +1,22 @@ +#pragma once + +// clang-format off + +// This file is generated from the Game's Reflection data + +#include +namespace RED4ext +{ +namespace GpuWrapApi { +enum class eTextureType : uint8_t +{ + TEXTYPE_2D = 0, + TEXTYPE_CUBE = 1, + TEXTYPE_ARRAY = 2, + TEXTYPE_3D = 3, +}; +} // namespace GpuWrapApi +using GpuWrapApieTextureType = GpuWrapApi::eTextureType; +} // namespace RED4ext + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/PSODescRenderTargetSetup.hpp b/include/RED4ext/Scripting/Natives/Generated/PSODescRenderTargetSetup.hpp index d0e31b70d..12badf384 100644 --- a/include/RED4ext/Scripting/Natives/Generated/PSODescRenderTargetSetup.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/PSODescRenderTargetSetup.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include namespace RED4ext { @@ -16,8 +16,8 @@ struct PSODescRenderTargetSetup static constexpr const char* NAME = "PSODescRenderTargetSetup"; static constexpr const char* ALIAS = NAME; - StaticArray rtFormats; // 00 - GpuWrapApieTextureFormat dsFormat; // 0C + StaticArray rtFormats; // 00 + GpuWrapApi::eTextureFormat dsFormat; // 0C uint8_t unk0D[0x10 - 0xD]; // D }; RED4EXT_ASSERT_SIZE(PSODescRenderTargetSetup, 0x10); diff --git a/include/RED4ext/Scripting/Natives/Generated/STextureGroupSetup.hpp b/include/RED4ext/Scripting/Natives/Generated/STextureGroupSetup.hpp index 9edfbf341..f6dfc0810 100644 --- a/include/RED4ext/Scripting/Natives/Generated/STextureGroupSetup.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/STextureGroupSetup.hpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include namespace RED4ext { @@ -19,7 +19,7 @@ struct STextureGroupSetup ETextureCompression compression; // 00 ETextureRawFormat rawFormat; // 04 - GpuWrapApieTextureGroup group; // 08 + GpuWrapApi::eTextureGroup group; // 08 uint8_t platformMipBiasPC; // 09 uint8_t platformMipBiasConsole; // 0A bool isStreamable; // 0B diff --git a/include/RED4ext/Scripting/Natives/Generated/ex/EntitySpawner.hpp b/include/RED4ext/Scripting/Natives/Generated/ex/EntitySpawner.hpp new file mode 100644 index 000000000..c48336606 --- /dev/null +++ b/include/RED4ext/Scripting/Natives/Generated/ex/EntitySpawner.hpp @@ -0,0 +1,26 @@ +#pragma once + +// clang-format off + +// This file is generated from the Game's Reflection data + +#include +#include +#include + +namespace RED4ext +{ +namespace ex +{ +struct EntitySpawner : game::IGameSystem +{ + static constexpr const char* NAME = "exEntitySpawner"; + static constexpr const char* ALIAS = NAME; + +}; +RED4EXT_ASSERT_SIZE(EntitySpawner, 0x48); +} // namespace ex +using exEntitySpawner = ex::EntitySpawner; +} // namespace RED4ext + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/quest/ICharacterConditionType.hpp b/include/RED4ext/Scripting/Natives/Generated/quest/ICharacterConditionType.hpp index 54e2b6a82..39603550c 100644 --- a/include/RED4ext/Scripting/Natives/Generated/quest/ICharacterConditionType.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/quest/ICharacterConditionType.hpp @@ -27,7 +27,7 @@ struct ICharacterConditionType : quest::IConditionType static constexpr const char* NAME = "questICharacterConditionType"; static constexpr const char* ALIAS = NAME; - game::EntityReference puppetRef; // 38 + game::EntityReference attackerRef; // 38 bool isPlayer; // 70 uint8_t unk71[0x78 - 0x71]; // 71 }; diff --git a/include/RED4ext/Scripting/Natives/Generated/rend/IndexBufferChunk.hpp b/include/RED4ext/Scripting/Natives/Generated/rend/IndexBufferChunk.hpp index 02d0be349..7eb01f6be 100644 --- a/include/RED4ext/Scripting/Natives/Generated/rend/IndexBufferChunk.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/rend/IndexBufferChunk.hpp @@ -6,7 +6,7 @@ #include #include -#include +#include namespace RED4ext { @@ -17,7 +17,7 @@ struct IndexBufferChunk static constexpr const char* NAME = "rendIndexBufferChunk"; static constexpr const char* ALIAS = NAME; - GpuWrapApieIndexBufferChunkType pe; // 00 + GpuWrapApi::eIndexBufferChunkType pe; // 00 uint8_t unk01[0x4 - 0x1]; // 1 uint32_t teOffset; // 04 }; diff --git a/include/RED4ext/Scripting/Natives/Generated/rend/RenderTextureBlobTextureInfo.hpp b/include/RED4ext/Scripting/Natives/Generated/rend/RenderTextureBlobTextureInfo.hpp index 2ee924742..a7b1b0441 100644 --- a/include/RED4ext/Scripting/Natives/Generated/rend/RenderTextureBlobTextureInfo.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/rend/RenderTextureBlobTextureInfo.hpp @@ -6,7 +6,7 @@ #include #include -#include +#include namespace RED4ext { @@ -17,7 +17,7 @@ struct RenderTextureBlobTextureInfo static constexpr const char* NAME = "rendRenderTextureBlobTextureInfo"; static constexpr const char* ALIAS = NAME; - GpuWrapApieTextureType type; // 00 + GpuWrapApi::eTextureType type; // 00 uint8_t unk01[0x4 - 0x1]; // 1 uint32_t textureDataSize; // 04 uint32_t sliceSize; // 08 diff --git a/include/RED4ext/Scripting/Natives/Generated/rend/VertexBufferChunk.hpp b/include/RED4ext/Scripting/Natives/Generated/rend/VertexBufferChunk.hpp index 7acfa13f3..a707f5099 100644 --- a/include/RED4ext/Scripting/Natives/Generated/rend/VertexBufferChunk.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/rend/VertexBufferChunk.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include namespace RED4ext { @@ -18,7 +18,7 @@ struct VertexBufferChunk static constexpr const char* NAME = "rendVertexBufferChunk"; static constexpr const char* ALIAS = NAME; - GpuWrapApiVertexLayoutDesc vertexLayout; // 00 + GpuWrapApi::VertexLayoutDesc vertexLayout; // 00 StaticArray byteOffsets; // B8 }; RED4EXT_ASSERT_SIZE(VertexBufferChunk, 0xD0); From 57dddbc523640af841f612cb083fd4579f08680e Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Wed, 22 Jan 2025 15:42:07 -0500 Subject: [PATCH 18/28] Fix formatting --- include/RED4ext/Dump/Reflection-inl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index 0f352cbfc..1337f9671 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -47,7 +47,7 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a { if (aInput.size() > exception.size() && aInput.starts_with(exception)) { - if(exception == "GpuWrapApi") + if (exception == "GpuWrapApi") { return aInput.substr(0, exception.size()); } From cf404869179a9e2b276a3ec508c817077f6a70ec Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Wed, 22 Jan 2025 17:09:31 -0500 Subject: [PATCH 19/28] Fixes & Dump update --- include/RED4ext/Dump/Reflection-inl.hpp | 12 +-- .../Generated/GpuWrapApi/VertexLayoutDesc.hpp | 4 +- .../EStreamType.hpp} | 8 +- .../PackingElement.hpp} | 22 ++--- .../ePackingType.hpp} | 8 +- .../ePackingUsage.hpp} | 8 +- .../Generated/GpuWrapApiVertexLayoutDesc.hpp | 27 ------ .../GpuWrapApiVertexPackingEStreamType.hpp | 19 ----- .../GpuWrapApiVertexPackingPackingElement.hpp | 29 ------- .../GpuWrapApiVertexPackingePackingType.hpp | 48 ----------- .../GpuWrapApiVertexPackingePackingUsage.hpp | 41 ---------- .../GpuWrapApieIndexBufferChunkType.hpp | 18 ---- .../Generated/GpuWrapApieTextureFormat.hpp | 82 ------------------- .../Generated/GpuWrapApieTextureGroup.hpp | 27 ------ .../Generated/GpuWrapApieTextureType.hpp | 19 ----- 15 files changed, 32 insertions(+), 340 deletions(-) rename include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/{VertexPackingEStreamType.hpp => VertexPacking/EStreamType.hpp} (71%) rename include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/{VertexPackingPackingElement.hpp => VertexPacking/PackingElement.hpp} (61%) rename include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/{VertexPackingePackingType.hpp => VertexPacking/ePackingType.hpp} (86%) rename include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/{VertexPackingePackingUsage.hpp => VertexPacking/ePackingUsage.hpp} (86%) delete mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexLayoutDesc.hpp delete mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingEStreamType.hpp delete mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingPackingElement.hpp delete mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingePackingType.hpp delete mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingePackingUsage.hpp delete mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApieIndexBufferChunkType.hpp delete mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureFormat.hpp delete mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureGroup.hpp delete mode 100644 include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureType.hpp diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index 1337f9671..0faf5733a 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -41,20 +41,22 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a { size_t i = 0; - constexpr std::string_view exceptions[] = {"AI", "GpuWrapApi"}; + constexpr std::string_view exceptions[] = {"AI", "GpuWrapApi", "GpuWrapApiVertexPacking"}; for (const auto& exception : exceptions) { if (aInput.size() > exception.size() && aInput.starts_with(exception)) { - if (exception == "GpuWrapApi") - { - return aInput.substr(0, exception.size()); - } i = exception.size(); } } + // Special case for enums under `GpuWrapApi` i.e. `eTextureType` + if ((aInput.starts_with("GpuWrapApi") || aInput.starts_with("GpuWrapApiVertexPacking")) && aInput[i] == 'e') + { + return aInput.substr(0, i); + } + // Special case of "in", this will break directory layout for "ink", "interop", etc.. if (aInput.starts_with("inGame")) { diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexLayoutDesc.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexLayoutDesc.hpp index 5a765e257..45565d6f3 100644 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexLayoutDesc.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexLayoutDesc.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include namespace RED4ext { @@ -18,7 +18,7 @@ struct VertexLayoutDesc static constexpr const char* NAME = "GpuWrapApiVertexLayoutDesc"; static constexpr const char* ALIAS = NAME; - StaticArray elements; // 00 + StaticArray elements; // 00 StaticArray slotStrides; // A4 uint32_t slotMask; // B0 uint32_t hash; // B4 diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingEStreamType.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/EStreamType.hpp similarity index 71% rename from include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingEStreamType.hpp rename to include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/EStreamType.hpp index 70c82d0de..580800a11 100644 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingEStreamType.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/EStreamType.hpp @@ -7,16 +7,16 @@ #include namespace RED4ext { -namespace GpuWrapApi { -enum class VertexPackingEStreamType : uint8_t +namespace GpuWrapApi::VertexPacking { +enum class EStreamType : uint8_t { ST_PerVertex = 0, ST_PerInstance = 1, ST_Max = 2, ST_Invalid = 255, }; -} // namespace GpuWrapApi -using GpuWrapApiVertexPackingEStreamType = GpuWrapApi::VertexPackingEStreamType; +} // namespace GpuWrapApi::VertexPacking +using GpuWrapApiVertexPackingEStreamType = GpuWrapApi::VertexPacking::EStreamType; } // namespace RED4ext // clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingPackingElement.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/PackingElement.hpp similarity index 61% rename from include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingPackingElement.hpp rename to include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/PackingElement.hpp index d6f0805b0..7eb64f5c2 100644 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingPackingElement.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/PackingElement.hpp @@ -6,28 +6,28 @@ #include #include -#include -#include -#include +#include +#include +#include namespace RED4ext { -namespace GpuWrapApi +namespace GpuWrapApi::VertexPacking { -struct VertexPackingPackingElement +struct PackingElement { static constexpr const char* NAME = "GpuWrapApiVertexPackingPackingElement"; static constexpr const char* ALIAS = NAME; - GpuWrapApi::VertexPackingePackingType type; // 00 - GpuWrapApi::VertexPackingePackingUsage usage; // 01 + GpuWrapApi::VertexPacking::ePackingType type; // 00 + GpuWrapApi::VertexPacking::ePackingUsage usage; // 01 uint8_t usageIndex; // 02 uint8_t streamIndex; // 03 - GpuWrapApi::VertexPackingEStreamType streamType; // 04 + GpuWrapApi::VertexPacking::EStreamType streamType; // 04 }; -RED4EXT_ASSERT_SIZE(VertexPackingPackingElement, 0x5); -} // namespace GpuWrapApi -using GpuWrapApiVertexPackingPackingElement = GpuWrapApi::VertexPackingPackingElement; +RED4EXT_ASSERT_SIZE(PackingElement, 0x5); +} // namespace GpuWrapApi::VertexPacking +using GpuWrapApiVertexPackingPackingElement = GpuWrapApi::VertexPacking::PackingElement; } // namespace RED4ext // clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingType.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/ePackingType.hpp similarity index 86% rename from include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingType.hpp rename to include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/ePackingType.hpp index 8053098f0..b920f5763 100644 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingType.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/ePackingType.hpp @@ -7,8 +7,8 @@ #include namespace RED4ext { -namespace GpuWrapApi { -enum class VertexPackingePackingType : uint8_t +namespace GpuWrapApi::VertexPacking { +enum class ePackingType : uint8_t { PT_Float1 = 0, PT_Float2 = 1, @@ -44,8 +44,8 @@ enum class VertexPackingePackingType : uint8_t PT_Max = 31, PT_Invalid = 255, }; -} // namespace GpuWrapApi -using GpuWrapApiVertexPackingePackingType = GpuWrapApi::VertexPackingePackingType; +} // namespace GpuWrapApi::VertexPacking +using GpuWrapApiVertexPackingePackingType = GpuWrapApi::VertexPacking::ePackingType; } // namespace RED4ext // clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingUsage.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/ePackingUsage.hpp similarity index 86% rename from include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingUsage.hpp rename to include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/ePackingUsage.hpp index 2408ddcb2..4d2a3132b 100644 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPackingePackingUsage.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/ePackingUsage.hpp @@ -7,8 +7,8 @@ #include namespace RED4ext { -namespace GpuWrapApi { -enum class VertexPackingePackingUsage : uint8_t +namespace GpuWrapApi::VertexPacking { +enum class ePackingUsage : uint8_t { PS_SysPosition = 0, PS_Position = 1, @@ -37,8 +37,8 @@ enum class VertexPackingePackingUsage : uint8_t PS_Max = 24, PS_Invalid = 255, }; -} // namespace GpuWrapApi -using GpuWrapApiVertexPackingePackingUsage = GpuWrapApi::VertexPackingePackingUsage; +} // namespace GpuWrapApi::VertexPacking +using GpuWrapApiVertexPackingePackingUsage = GpuWrapApi::VertexPacking::ePackingUsage; } // namespace RED4ext // clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexLayoutDesc.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexLayoutDesc.hpp deleted file mode 100644 index e10b48e21..000000000 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexLayoutDesc.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -// clang-format off - -// This file is generated from the Game's Reflection data - -#include -#include -#include -#include - -namespace RED4ext -{ -struct GpuWrapApiVertexLayoutDesc -{ - static constexpr const char* NAME = "GpuWrapApiVertexLayoutDesc"; - static constexpr const char* ALIAS = NAME; - - StaticArray elements; // 00 - StaticArray slotStrides; // A4 - uint32_t slotMask; // B0 - uint32_t hash; // B4 -}; -RED4EXT_ASSERT_SIZE(GpuWrapApiVertexLayoutDesc, 0xB8); -} // namespace RED4ext - -// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingEStreamType.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingEStreamType.hpp deleted file mode 100644 index 2c4e3c486..000000000 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingEStreamType.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -// clang-format off - -// This file is generated from the Game's Reflection data - -#include -namespace RED4ext -{ -enum class GpuWrapApiVertexPackingEStreamType : uint8_t -{ - ST_PerVertex = 0, - ST_PerInstance = 1, - ST_Max = 2, - ST_Invalid = 255, -}; -} // namespace RED4ext - -// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingPackingElement.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingPackingElement.hpp deleted file mode 100644 index 284da48b1..000000000 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingPackingElement.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -// clang-format off - -// This file is generated from the Game's Reflection data - -#include -#include -#include -#include -#include - -namespace RED4ext -{ -struct GpuWrapApiVertexPackingPackingElement -{ - static constexpr const char* NAME = "GpuWrapApiVertexPackingPackingElement"; - static constexpr const char* ALIAS = NAME; - - GpuWrapApiVertexPackingePackingType type; // 00 - GpuWrapApiVertexPackingePackingUsage usage; // 01 - uint8_t usageIndex; // 02 - uint8_t streamIndex; // 03 - GpuWrapApiVertexPackingEStreamType streamType; // 04 -}; -RED4EXT_ASSERT_SIZE(GpuWrapApiVertexPackingPackingElement, 0x5); -} // namespace RED4ext - -// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingePackingType.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingePackingType.hpp deleted file mode 100644 index c907c655a..000000000 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingePackingType.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -// clang-format off - -// This file is generated from the Game's Reflection data - -#include -namespace RED4ext -{ -enum class GpuWrapApiVertexPackingePackingType : uint8_t -{ - PT_Float1 = 0, - PT_Float2 = 1, - PT_Float3 = 2, - PT_Float4 = 3, - PT_Float16_2 = 4, - PT_Float16_4 = 5, - PT_UShort1 = 6, - PT_UShort2 = 7, - PT_UShort4 = 8, - PT_UShort4N = 9, - PT_Short1 = 10, - PT_Short2 = 11, - PT_Short4 = 12, - PT_Short4N = 13, - PT_UInt1 = 14, - PT_UInt2 = 15, - PT_UInt3 = 16, - PT_UInt4 = 17, - PT_Int1 = 18, - PT_Int2 = 19, - PT_Int3 = 20, - PT_Int4 = 21, - PT_Color = 22, - PT_UByte1 = 23, - PT_UByte1F = 24, - PT_UByte4 = 25, - PT_UByte4N = 26, - PT_Byte4N = 27, - PT_Dec4 = 28, - PT_Index16 = 29, - PT_Index32 = 30, - PT_Max = 31, - PT_Invalid = 255, -}; -} // namespace RED4ext - -// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingePackingUsage.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingePackingUsage.hpp deleted file mode 100644 index ecfc6c3dc..000000000 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingePackingUsage.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -// clang-format off - -// This file is generated from the Game's Reflection data - -#include -namespace RED4ext -{ -enum class GpuWrapApiVertexPackingePackingUsage : uint8_t -{ - PS_SysPosition = 0, - PS_Position = 1, - PS_Normal = 2, - PS_Tangent = 3, - PS_Binormal = 4, - PS_TexCoord = 5, - PS_Color = 6, - PS_SkinIndices = 7, - PS_SkinWeights = 8, - PS_DestructionIndices = 9, - PS_MultilayerPaint = 10, - PS_InstanceTransform = 11, - PS_InstanceLODParams = 12, - PS_InstanceSkinningData = 13, - PS_PatchSize = 14, - PS_PatchBias = 15, - PS_ExtraData = 16, - PS_VehicleDmgNormal = 17, - PS_VehicleDmgPosition = 18, - PS_PositionDelta = 19, - PS_LightBlockerIntensity = 20, - PS_BoneIndex = 21, - PS_Padding = 22, - PS_PatchOffset = 23, - PS_Max = 24, - PS_Invalid = 255, -}; -} // namespace RED4ext - -// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieIndexBufferChunkType.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieIndexBufferChunkType.hpp deleted file mode 100644 index 8d0df00a8..000000000 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieIndexBufferChunkType.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -// clang-format off - -// This file is generated from the Game's Reflection data - -#include -namespace RED4ext -{ -enum class GpuWrapApieIndexBufferChunkType : uint8_t -{ - IBCT_IndexUInt = 0, - IBCT_IndexUShort = 1, - IBCT_Max = 2, -}; -} // namespace RED4ext - -// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureFormat.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureFormat.hpp deleted file mode 100644 index 73cf9f604..000000000 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureFormat.hpp +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -// clang-format off - -// This file is generated from the Game's Reflection data - -#include -namespace RED4ext -{ -enum class GpuWrapApieTextureFormat : uint8_t -{ - TEXFMT_A8_Unorm = 0, - TEXFMT_R8_Unorm = 1, - TEXFMT_L8_Unorm = 2, - TEXFMT_R8G8_Unorm = 3, - TEXFMT_R8G8B8X8_Unorm = 4, - TEXFMT_R8G8B8A8_Unorm = 5, - TEXFMT_R8G8B8A8_Snorm = 6, - TEXFMT_R16_Unorm = 7, - TEXFMT_R16_Uint = 8, - TEXFMT_R32_Uint = 9, - TEXFMT_R32G32B32A32_Uint = 10, - TEXFMT_R32G32_Uint = 11, - TEXFMT_R16G16B16A16_Unorm = 12, - TEXFMT_R16G16B16A16_Uint = 14, - TEXFMT_R16G16_Uint = 15, - TEXFMT_R10G10B10A2_Unorm = 16, - TEXFMT_R16G16B16A16_Float = 17, - TEXFMT_R11G11B10_Float = 18, - TEXFMT_R16G16_Float = 19, - TEXFMT_R32G32_Float = 20, - TEXFMT_R32G32B32A32_Float = 21, - TEXFMT_R32_Float = 22, - TEXFMT_R16_Float = 23, - TEXFMT_D24S8 = 24, - TEXFMT_D32FS8 = 25, - TEXFMT_D32F = 27, - TEXFMT_D16U = 28, - TEXFMT_BC1 = 29, - TEXFMT_BC2 = 30, - TEXFMT_BC3 = 31, - TEXFMT_BC4 = 32, - TEXFMT_BC5 = 33, - TEXFMT_BC6H_UNSIGNED = 34, - TEXFMT_BC6H_SIGNED = 35, - TEXFMT_BC7 = 36, - TEXFMT_BC7_SRGB = 37, - TEXFMT_R8_Uint = 38, - TEXFMT_R8G8B8A8_Unorm_SRGB = 40, - TEXFMT_BC1_SRGB = 41, - TEXFMT_BC2_SRGB = 42, - TEXFMT_BC3_SRGB = 43, - TEXFMT_R16G16_Unorm = 44, - TEXFMT_R16G16_Sint = 45, - TEXFMT_R16G16_Snorm = 46, - TEXFMT_B5G6R5_Unorm = 47, - TEXFMT_R16_Snorm = 49, - TEXFMT_B8G8R8A8 = 50, - TEXFMT_B8G8R8A8_SRGB = 51, - TEXFMT_A8 = TEXFMT_A8_Unorm, - TEXFMT_BC6H = TEXFMT_BC6H_UNSIGNED, - TEXFMT_Float_R11G11B10 = TEXFMT_R11G11B10_Float, - TEXFMT_Float_R16 = TEXFMT_R16_Float, - TEXFMT_Float_R16G16 = TEXFMT_R16G16_Float, - TEXFMT_Float_R16G16B16A16 = TEXFMT_R16G16B16A16_Float, - TEXFMT_Float_R32 = TEXFMT_R32_Float, - TEXFMT_Float_R32G32 = TEXFMT_R32G32_Float, - TEXFMT_Float_R32G32B32A32 = TEXFMT_R32G32B32A32_Float, - TEXFMT_L8 = TEXFMT_L8_Unorm, - TEXFMT_R10G10B10A2 = TEXFMT_R10G10B10A2_Unorm, - TEXFMT_R8 = TEXFMT_R8_Unorm, - TEXFMT_R8G8 = TEXFMT_R8G8_Unorm, - TEXFMT_R8G8B8A8 = TEXFMT_R8G8B8A8_Unorm_SRGB, - TEXFMT_R8G8B8X8 = TEXFMT_R8G8B8X8_Unorm, - TEXFMT_Uint_16 = TEXFMT_R16_Uint, - TEXFMT_Uint_16_norm = TEXFMT_R16_Unorm, - TEXFMT_Uint_32 = TEXFMT_R32_Uint, - TEXFMT_Uint_R32G32B32A32 = TEXFMT_R16G16B16A16_Uint, -}; -} // namespace RED4ext - -// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureGroup.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureGroup.hpp deleted file mode 100644 index 36c2ec6e1..000000000 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureGroup.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -// clang-format off - -// This file is generated from the Game's Reflection data - -#include -namespace RED4ext -{ -enum class GpuWrapApieTextureGroup : uint8_t -{ - TEXG_Generic_Color = 1, - TEXG_Generic_Grayscale = 2, - TEXG_Generic_Normal = 3, - TEXG_Generic_Data = 4, - TEXG_Generic_UI = 5, - TEXG_Generic_Font = 6, - TEXG_Generic_LUT = 7, - TEXG_Generic_MorphBlend = 8, - TEXG_Multilayer_Color = 9, - TEXG_Multilayer_Normal = 10, - TEXG_Multilayer_Grayscale = 11, - TEXG_Multilayer_Microblend = 12, -}; -} // namespace RED4ext - -// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureType.hpp b/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureType.hpp deleted file mode 100644 index 348e843de..000000000 --- a/include/RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureType.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -// clang-format off - -// This file is generated from the Game's Reflection data - -#include -namespace RED4ext -{ -enum class GpuWrapApieTextureType : uint8_t -{ - TEXTYPE_2D = 0, - TEXTYPE_CUBE = 1, - TEXTYPE_ARRAY = 2, - TEXTYPE_3D = 3, -}; -} // namespace RED4ext - -// clang-format on From ca712fb6c396cddeebc202fb3c993a142b333ec5 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Wed, 22 Jan 2025 17:14:24 -0500 Subject: [PATCH 20/28] Update Natives.cpp --- src/Scripting/Natives.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Scripting/Natives.cpp b/src/Scripting/Natives.cpp index 4472f4e19..c512308b3 100644 --- a/src/Scripting/Natives.cpp +++ b/src/Scripting/Natives.cpp @@ -251,15 +251,15 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include From 61e68d18ed12676240f7d5d1a3cd45e08f1928ac Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Thu, 23 Jan 2025 11:50:23 -0500 Subject: [PATCH 21/28] Improve prefix handling --- include/RED4ext/Dump/Reflection-inl.hpp | 40 +++++++++++++++---------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index 0faf5733a..b85f0830d 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -41,26 +41,34 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a { size_t i = 0; - constexpr std::string_view exceptions[] = {"AI", "GpuWrapApi", "GpuWrapApiVertexPacking"}; - - for (const auto& exception : exceptions) + static constexpr std::pair uniqueNamespaces[] = { + {"AI", false}, + {"inGame", true}, + {"GpuWrapApi", true}, + {"GpuWrapApiVertexPacking", true} + }; + + for (const auto& [name, isSpecialCase] : uniqueNamespaces) { - if (aInput.size() > exception.size() && aInput.starts_with(exception)) + if (aInput.size() > name.size() && aInput.starts_with(name)) { - i = exception.size(); - } - } + i = name.size(); - // Special case for enums under `GpuWrapApi` i.e. `eTextureType` - if ((aInput.starts_with("GpuWrapApi") || aInput.starts_with("GpuWrapApiVertexPacking")) && aInput[i] == 'e') - { - return aInput.substr(0, i); - } + if (isSpecialCase) + { + // Special case of "in", this will break directory layout for "ink", "interop", etc.. + if (aInput.starts_with("inGame")) + { + return ""; + } - // Special case of "in", this will break directory layout for "ink", "interop", etc.. - if (aInput.starts_with("inGame")) - { - return ""; + // Special case for enums under `GpuWrapApi` i.e. `eTextureType` + if (name.starts_with("GpuWrapApi") && aInput[i] == 'e') + { + return aInput.substr(0, i); + } + } + } } for (; i < aInput.size(); ++i) From 6f12a311502de609cdf66034c2f618232a52c316 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Thu, 23 Jan 2025 11:53:02 -0500 Subject: [PATCH 22/28] Formatting --- include/RED4ext/Dump/Reflection-inl.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index b85f0830d..0078f52e4 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -42,12 +42,8 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a size_t i = 0; static constexpr std::pair uniqueNamespaces[] = { - {"AI", false}, - {"inGame", true}, - {"GpuWrapApi", true}, - {"GpuWrapApiVertexPacking", true} - }; - + {"AI", false}, {"inGame", true}, {"GpuWrapApi", true}, {"GpuWrapApiVertexPacking", true}}; + for (const auto& [name, isSpecialCase] : uniqueNamespaces) { if (aInput.size() > name.size() && aInput.starts_with(name)) From 277fe2c61918bac7c349d1f3b5c9337c462b2b00 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Thu, 23 Jan 2025 11:54:52 -0500 Subject: [PATCH 23/28] Remove whitespace --- include/RED4ext/Dump/Reflection-inl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index 0078f52e4..ef1f9d179 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -43,7 +43,7 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a static constexpr std::pair uniqueNamespaces[] = { {"AI", false}, {"inGame", true}, {"GpuWrapApi", true}, {"GpuWrapApiVertexPacking", true}}; - + for (const auto& [name, isSpecialCase] : uniqueNamespaces) { if (aInput.size() > name.size() && aInput.starts_with(name)) From bf101ce59f17a5a3a54f32dd37a0b14f33a4fb39 Mon Sep 17 00:00:00 2001 From: Mozz3d Date: Thu, 23 Jan 2025 19:31:08 -0500 Subject: [PATCH 24/28] Cleanup --- include/RED4ext/Dump/Reflection-inl.hpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index ef1f9d179..c3bfece93 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -42,7 +42,7 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a size_t i = 0; static constexpr std::pair uniqueNamespaces[] = { - {"AI", false}, {"inGame", true}, {"GpuWrapApi", true}, {"GpuWrapApiVertexPacking", true}}; + {"AI", false}, {"GpuWrapApi", true}, {"GpuWrapApiVertexPacking", true}}; for (const auto& [name, isSpecialCase] : uniqueNamespaces) { @@ -52,21 +52,17 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a if (isSpecialCase) { - // Special case of "in", this will break directory layout for "ink", "interop", etc.. - if (aInput.starts_with("inGame")) - { - return ""; - } - - // Special case for enums under `GpuWrapApi` i.e. `eTextureType` - if (name.starts_with("GpuWrapApi") && aInput[i] == 'e') - { - return aInput.substr(0, i); - } + return aInput.substr(0, i); } } } + // Special case of "in", this will break directory layout for "ink", "interop", etc.. + if (aInput.starts_with("inGame")) + { + return ""; + } + for (; i < aInput.size(); ++i) { if (isupper(aInput[i])) From 926241763f3cb54b28458e6b9c689b3af33efc43 Mon Sep 17 00:00:00 2001 From: Mozz Date: Fri, 24 Jan 2025 15:10:39 -0500 Subject: [PATCH 25/28] Remove accidental file & manual `eBufferUsageType` implement --- include/RED4ext/GpuApi/Buffer.hpp | 11 -------- .../Natives/Generated/ex/EntitySpawner.hpp | 26 ------------------- 2 files changed, 37 deletions(-) delete mode 100644 include/RED4ext/Scripting/Natives/Generated/ex/EntitySpawner.hpp diff --git a/include/RED4ext/GpuApi/Buffer.hpp b/include/RED4ext/GpuApi/Buffer.hpp index 410286ed3..ce23274fa 100644 --- a/include/RED4ext/GpuApi/Buffer.hpp +++ b/include/RED4ext/GpuApi/Buffer.hpp @@ -11,17 +11,6 @@ namespace RED4ext { namespace GpuApi { -enum eBufferUsageType : uint8_t -{ - BUT_Default, - BUT_Immutable, - BUT_Readback, - BUT_Dynamic_Legacy, - BUT_Transient, - BUT_Mapped, - BUT_MAX -}; - struct SBufferData { uint32_t bufferSize; // 00 diff --git a/include/RED4ext/Scripting/Natives/Generated/ex/EntitySpawner.hpp b/include/RED4ext/Scripting/Natives/Generated/ex/EntitySpawner.hpp deleted file mode 100644 index c48336606..000000000 --- a/include/RED4ext/Scripting/Natives/Generated/ex/EntitySpawner.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -// clang-format off - -// This file is generated from the Game's Reflection data - -#include -#include -#include - -namespace RED4ext -{ -namespace ex -{ -struct EntitySpawner : game::IGameSystem -{ - static constexpr const char* NAME = "exEntitySpawner"; - static constexpr const char* ALIAS = NAME; - -}; -RED4EXT_ASSERT_SIZE(EntitySpawner, 0x48); -} // namespace ex -using exEntitySpawner = ex::EntitySpawner; -} // namespace RED4ext - -// clang-format on From cd026b370b216265d3a87ec9162692a639f474f4 Mon Sep 17 00:00:00 2001 From: Mozz Date: Fri, 24 Jan 2025 16:09:13 -0500 Subject: [PATCH 26/28] Add `GpuApi` to `uniqueNamespaces` --- include/RED4ext/Dump/Reflection-inl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index c3bfece93..ef5c5f52a 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -42,7 +42,7 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a size_t i = 0; static constexpr std::pair uniqueNamespaces[] = { - {"AI", false}, {"GpuWrapApi", true}, {"GpuWrapApiVertexPacking", true}}; + {"AI", false}, {"GpuApi", true}, {"GpuWrapApi", true}, {"GpuWrapApiVertexPacking", true}}; for (const auto& [name, isSpecialCase] : uniqueNamespaces) { From e4dbf7929090b3bbf2e5d083b3c68068b59bb6a6 Mon Sep 17 00:00:00 2001 From: Mozz Date: Mon, 27 Jan 2025 11:43:20 -0500 Subject: [PATCH 27/28] Rerun dump --- include/RED4ext/Dump/Reflection-inl.hpp | 2 +- .../Generated/game/PhotoModeSystem.hpp | 4 +- .../Generated/game/data/Vehicle_Record.hpp | 4 +- ...ChangeCameraControlHintVisibilityEvent.hpp | 5 +- .../Generated/ink/GameScreenshotCallback.hpp | 27 ++++++++ .../quest/ICharacterConditionType.hpp | 2 +- .../vehicle/VehicleCustomization.hpp | 4 +- .../Generated/world/BenchmarkSummary.hpp | 61 ++++++++++--------- 8 files changed, 70 insertions(+), 39 deletions(-) create mode 100644 include/RED4ext/Scripting/Natives/Generated/ink/GameScreenshotCallback.hpp diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index ef5c5f52a..55d0582e8 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -42,7 +42,7 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a size_t i = 0; static constexpr std::pair uniqueNamespaces[] = { - {"AI", false}, {"GpuApi", true}, {"GpuWrapApi", true}, {"GpuWrapApiVertexPacking", true}}; + {"AI", false}, {"GpuApi", true}, {"GpuWrapApiVertexPacking", true}, {"GpuWrapApi", true}}; for (const auto& [name, isSpecialCase] : uniqueNamespaces) { diff --git a/include/RED4ext/Scripting/Natives/Generated/game/PhotoModeSystem.hpp b/include/RED4ext/Scripting/Natives/Generated/game/PhotoModeSystem.hpp index bc442d123..e76faf81b 100644 --- a/include/RED4ext/Scripting/Natives/Generated/game/PhotoModeSystem.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/game/PhotoModeSystem.hpp @@ -17,9 +17,9 @@ struct __declspec(align(0x10)) PhotoModeSystem : game::IPhotoModeSystem static constexpr const char* NAME = "gamePhotoModeSystem"; static constexpr const char* ALIAS = "PhotoModeSystem"; - uint8_t unk48[0xA40 - 0x48]; // 48 + uint8_t unk48[0xA60 - 0x48]; // 48 }; -RED4EXT_ASSERT_SIZE(PhotoModeSystem, 0xA40); +RED4EXT_ASSERT_SIZE(PhotoModeSystem, 0xA60); } // namespace game using gamePhotoModeSystem = game::PhotoModeSystem; using PhotoModeSystem = game::PhotoModeSystem; diff --git a/include/RED4ext/Scripting/Natives/Generated/game/data/Vehicle_Record.hpp b/include/RED4ext/Scripting/Natives/Generated/game/data/Vehicle_Record.hpp index c66c8b193..bbde20d82 100644 --- a/include/RED4ext/Scripting/Natives/Generated/game/data/Vehicle_Record.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/game/data/Vehicle_Record.hpp @@ -17,9 +17,9 @@ struct Vehicle_Record : game::data::SpawnableObject_Record static constexpr const char* NAME = "gamedataVehicle_Record"; static constexpr const char* ALIAS = "Vehicle_Record"; - uint8_t unkF8[0x590 - 0xF8]; // F8 + uint8_t unkF8[0x5A0 - 0xF8]; // F8 }; -RED4EXT_ASSERT_SIZE(Vehicle_Record, 0x590); +RED4EXT_ASSERT_SIZE(Vehicle_Record, 0x5A0); } // namespace game::data using gamedataVehicle_Record = game::data::Vehicle_Record; using Vehicle_Record = game::data::Vehicle_Record; diff --git a/include/RED4ext/Scripting/Natives/Generated/game/ui/ChangeCameraControlHintVisibilityEvent.hpp b/include/RED4ext/Scripting/Natives/Generated/game/ui/ChangeCameraControlHintVisibilityEvent.hpp index 9185d0dd4..1e22ef14f 100644 --- a/include/RED4ext/Scripting/Natives/Generated/game/ui/ChangeCameraControlHintVisibilityEvent.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/game/ui/ChangeCameraControlHintVisibilityEvent.hpp @@ -17,8 +17,9 @@ struct ChangeCameraControlHintVisibilityEvent : red::Event static constexpr const char* NAME = "gameuiChangeCameraControlHintVisibilityEvent"; static constexpr const char* ALIAS = "ChangeCameraControlHintVisibilityEvent"; - bool visible; // 40 - uint8_t unk41[0x48 - 0x41]; // 41 + bool movementVisible; // 40 + bool rotationVisible; // 41 + uint8_t unk42[0x48 - 0x42]; // 42 }; RED4EXT_ASSERT_SIZE(ChangeCameraControlHintVisibilityEvent, 0x48); } // namespace game::ui diff --git a/include/RED4ext/Scripting/Natives/Generated/ink/GameScreenshotCallback.hpp b/include/RED4ext/Scripting/Natives/Generated/ink/GameScreenshotCallback.hpp new file mode 100644 index 000000000..a8adec7b6 --- /dev/null +++ b/include/RED4ext/Scripting/Natives/Generated/ink/GameScreenshotCallback.hpp @@ -0,0 +1,27 @@ +#pragma once + +// clang-format off + +// This file is generated from the Game's Reflection data + +#include +#include +#include + +namespace RED4ext +{ +namespace ink +{ +struct GameScreenshotCallback : ink::CallbackBase +{ + static constexpr const char* NAME = "inkGameScreenshotCallback"; + static constexpr const char* ALIAS = NAME; + + uint8_t unk28[0x38 - 0x28]; // 28 +}; +RED4EXT_ASSERT_SIZE(GameScreenshotCallback, 0x38); +} // namespace ink +using inkGameScreenshotCallback = ink::GameScreenshotCallback; +} // namespace RED4ext + +// clang-format on diff --git a/include/RED4ext/Scripting/Natives/Generated/quest/ICharacterConditionType.hpp b/include/RED4ext/Scripting/Natives/Generated/quest/ICharacterConditionType.hpp index 39603550c..54e2b6a82 100644 --- a/include/RED4ext/Scripting/Natives/Generated/quest/ICharacterConditionType.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/quest/ICharacterConditionType.hpp @@ -27,7 +27,7 @@ struct ICharacterConditionType : quest::IConditionType static constexpr const char* NAME = "questICharacterConditionType"; static constexpr const char* ALIAS = NAME; - game::EntityReference attackerRef; // 38 + game::EntityReference puppetRef; // 38 bool isPlayer; // 70 uint8_t unk71[0x78 - 0x71]; // 71 }; diff --git a/include/RED4ext/Scripting/Natives/Generated/vehicle/VehicleCustomization.hpp b/include/RED4ext/Scripting/Natives/Generated/vehicle/VehicleCustomization.hpp index cfc59716f..78b7ffd65 100644 --- a/include/RED4ext/Scripting/Natives/Generated/vehicle/VehicleCustomization.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/vehicle/VehicleCustomization.hpp @@ -20,9 +20,9 @@ struct VehicleCustomization : ent::IComponent static constexpr const char* ALIAS = "VehicleCustomizationComponent"; DynArray defaultDecalsPerAppearance; // 90 - uint8_t unkA0[0x148 - 0xA0]; // A0 + uint8_t unkA0[0x158 - 0xA0]; // A0 }; -RED4EXT_ASSERT_SIZE(VehicleCustomization, 0x148); +RED4EXT_ASSERT_SIZE(VehicleCustomization, 0x158); } // namespace vehicle using vehicleVehicleCustomization = vehicle::VehicleCustomization; using VehicleCustomizationComponent = vehicle::VehicleCustomization; diff --git a/include/RED4ext/Scripting/Natives/Generated/world/BenchmarkSummary.hpp b/include/RED4ext/Scripting/Natives/Generated/world/BenchmarkSummary.hpp index ede18aa03..10d1c34e3 100644 --- a/include/RED4ext/Scripting/Natives/Generated/world/BenchmarkSummary.hpp +++ b/include/RED4ext/Scripting/Natives/Generated/world/BenchmarkSummary.hpp @@ -53,37 +53,40 @@ struct BenchmarkSummary : IScriptable int32_t DLSSQuality; // 190 float DLSSSharpness; // 194 bool DLSSFrameGenEnabled; // 198 - bool FSR2Enabled; // 199 + bool DLSSMultiFrameGenEnabled; // 199 uint8_t unk19A[0x19C - 0x19A]; // 19A - int32_t FSR2Quality; // 19C - float FSR2Sharpness; // 1A0 - bool FSR3Enabled; // 1A4 - uint8_t unk1A5[0x1A8 - 0x1A5]; // 1A5 - int32_t FSR3Quality; // 1A8 - float FSR3Sharpness; // 1AC - bool FSR3FrameGenEnabled; // 1B0 - bool XeSSEnabled; // 1B1 - uint8_t unk1B2[0x1B4 - 0x1B2]; // 1B2 - int32_t XeSSQuality; // 1B4 - float XeSSSharpness; // 1B8 - bool DRSEnabled; // 1BC - uint8_t unk1BD[0x1C0 - 0x1BD]; // 1BD - uint32_t DRSTargetFPS; // 1C0 - uint32_t DRSMinimalResolutionPercentage; // 1C4 - uint32_t DRSMaximalResolutionPercentage; // 1C8 - bool CASSharpeningEnabled; // 1CC - bool FSREnabled; // 1CD - uint8_t unk1CE[0x1D0 - 0x1CE]; // 1CE - int32_t FSRQuality; // 1D0 - bool rayTracingEnabled; // 1D4 - bool rayTracedReflections; // 1D5 - bool rayTracedSunShadows; // 1D6 - bool rayTracedLocalShadows; // 1D7 - int32_t rayTracedLightingQuality; // 1D8 - bool rayTracedPathTracingEnabled; // 1DC - uint8_t unk1DD[0x1E0 - 0x1DD]; // 1DD + int32_t DLSSMultiFrameGenFrameToGenerate; // 19C + bool FSR2Enabled; // 1A0 + uint8_t unk1A1[0x1A4 - 0x1A1]; // 1A1 + int32_t FSR2Quality; // 1A4 + float FSR2Sharpness; // 1A8 + bool FSR3Enabled; // 1AC + uint8_t unk1AD[0x1B0 - 0x1AD]; // 1AD + int32_t FSR3Quality; // 1B0 + float FSR3Sharpness; // 1B4 + bool FSR3FrameGenEnabled; // 1B8 + bool XeSSEnabled; // 1B9 + uint8_t unk1BA[0x1BC - 0x1BA]; // 1BA + int32_t XeSSQuality; // 1BC + float XeSSSharpness; // 1C0 + bool DRSEnabled; // 1C4 + uint8_t unk1C5[0x1C8 - 0x1C5]; // 1C5 + uint32_t DRSTargetFPS; // 1C8 + uint32_t DRSMinimalResolutionPercentage; // 1CC + uint32_t DRSMaximalResolutionPercentage; // 1D0 + bool CASSharpeningEnabled; // 1D4 + bool FSREnabled; // 1D5 + uint8_t unk1D6[0x1D8 - 0x1D6]; // 1D6 + int32_t FSRQuality; // 1D8 + bool rayTracingEnabled; // 1DC + bool rayTracedReflections; // 1DD + bool rayTracedSunShadows; // 1DE + bool rayTracedLocalShadows; // 1DF + int32_t rayTracedLightingQuality; // 1E0 + bool rayTracedPathTracingEnabled; // 1E4 + uint8_t unk1E5[0x1E8 - 0x1E5]; // 1E5 }; -RED4EXT_ASSERT_SIZE(BenchmarkSummary, 0x1E0); +RED4EXT_ASSERT_SIZE(BenchmarkSummary, 0x1E8); } // namespace world using worldBenchmarkSummary = world::BenchmarkSummary; } // namespace RED4ext From 76df6915bc4024e4255971c88ba223114f3b1071 Mon Sep 17 00:00:00 2001 From: Mozz Date: Mon, 27 Jan 2025 11:47:40 -0500 Subject: [PATCH 28/28] Adjust input size check (I forgot) --- include/RED4ext/Dump/Reflection-inl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RED4ext/Dump/Reflection-inl.hpp b/include/RED4ext/Dump/Reflection-inl.hpp index 55d0582e8..bd5034f7d 100644 --- a/include/RED4ext/Dump/Reflection-inl.hpp +++ b/include/RED4ext/Dump/Reflection-inl.hpp @@ -46,7 +46,7 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a for (const auto& [name, isSpecialCase] : uniqueNamespaces) { - if (aInput.size() > name.size() && aInput.starts_with(name)) + if (aInput.size() >= name.size() && aInput.starts_with(name)) { i = name.size();