Skip to content

Commit

Permalink
Decoded Several Rendering Structs & Small Adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mozz3d committed Jan 16, 2025
1 parent 02f82f8 commit 14bb8be
Show file tree
Hide file tree
Showing 12 changed files with 393 additions and 42 deletions.
15 changes: 15 additions & 0 deletions include/RED4ext/Detail/AddressHashes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion include/RED4ext/Dump/Reflection-inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion include/RED4ext/GpuApi/Buffer.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <RED4ext/Common.hpp>

#include <cstdint>
#include <d3d12.h>
#include <wrl/client.h>

Expand Down
6 changes: 3 additions & 3 deletions include/RED4ext/GpuApi/CommandListContext-inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
163 changes: 163 additions & 0 deletions include/RED4ext/RenderProxy-inl.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
#pragma once

#ifdef RED4EXT_STATIC_LIB
#include <RED4ext/RenderProxy.hpp>
#endif

#include <RED4ext/Relocation.hpp>
#include <RED4ext/Detail/AddressHashes.hpp>

RED4EXT_INLINE void RED4ext::IRenderProxy::sub_00()
{
static UniversalRelocFunc<void (*)(void)> func(Detail::AddressHashes::IRenderProxy_sub_00);
func();
}

RED4EXT_INLINE void RED4ext::IRenderProxy::sub_08()
{
static UniversalRelocFunc<void (*)(IRenderProxy*)> func(Detail::AddressHashes::IRenderProxy_sub_08);
func(this);
}

RED4EXT_INLINE uint8_t RED4ext::IRenderProxy::sub_18()
{
static UniversalRelocFunc<uint8_t (*)(IRenderProxy*)> 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<uint32_t (*)(IRenderProxy*)> func(Detail::AddressHashes::IRenderProxy_sub_58);
return func(this);
}

RED4EXT_INLINE float RED4ext::IRenderProxy::sub_60()
{
static UniversalRelocFunc<float (*)(IRenderProxy*)> 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<void (*)(IRenderProxy*, void*)> func(Detail::AddressHashes::IRenderProxy_sub_78);
func(this, a1);
}

RED4EXT_INLINE void RED4ext::IRenderProxy::sub_80(void* a1, void* a2)
{
static UniversalRelocFunc<void (*)(IRenderProxy*, void*, void*)> func(Detail::AddressHashes::IRenderProxy_sub_80);
func(this, a1, a2);
}

RED4EXT_INLINE bool RED4ext::IRenderProxy::sub_88(void* a1, void* a2)
{
static UniversalRelocFunc<bool (*)(IRenderProxy*, void*, void*)> func(Detail::AddressHashes::IRenderProxy_sub_88);
return func(this, a1, a2);
}

RED4EXT_INLINE void RED4ext::IRenderProxy::sub_90(void* a1)
{
static UniversalRelocFunc<bool (*)(IRenderProxy*, void*)> func(Detail::AddressHashes::IRenderProxy_sub_90);
func(this, a1);
}

RED4EXT_INLINE void RED4ext::IRenderProxy::sub_98(void* a1)
{
static UniversalRelocFunc<void (*)(IRenderProxy*, void*)> 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<uint8_t (*)(IRenderProxy*, void*)> func(Detail::AddressHashes::IRenderProxy_sub_A8);
return func(this, a1);
}

RED4EXT_INLINE void RED4ext::IRenderProxy::sub_B0(void* a1)
{
static UniversalRelocFunc<void (*)(IRenderProxy*, void*)> 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()
{
}
81 changes: 81 additions & 0 deletions include/RED4ext/RenderProxy.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#pragma once

#include <cstdint>

#include <RED4ext/Common.hpp>
#include <RED4ext/RenderTypes.hpp>
#include <RED4ext/Scripting/Natives/Generated/IRenderProxyCustomData.hpp>

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
30 changes: 30 additions & 0 deletions include/RED4ext/RenderTypes.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include <cstdint>

#include <RED4ext/Common.hpp>
#include <RED4ext/Scripting/Natives/Vector4.hpp>
#include <RED4ext/Scripting/Natives/Generated/IRenderProxyCustomData.hpp>
#include <RED4ext/Scripting/Natives/Generated/rend/Chunk.hpp>

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<rend::Chunk> 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
Loading

0 comments on commit 14bb8be

Please sign in to comment.