Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dumper namespace exceptionality #174

Merged
merged 30 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
14bb8be
Decoded Several Rendering Structs & Small Adjustments
Mozz3d Jan 16, 2025
5ce34fc
Fix formatting
Mozz3d Jan 16, 2025
6c3ee2b
Fix mistakes
Mozz3d Jan 16, 2025
f8b5653
Formatting
Mozz3d Jan 16, 2025
5292632
Update struct names
Mozz3d Jan 16, 2025
bc66a67
Semantical improvements
Mozz3d Jan 17, 2025
374cbb7
Fix mistake
Mozz3d Jan 17, 2025
198830c
Fix other mistake
Mozz3d Jan 17, 2025
70cb6cc
Several updates
Mozz3d Jan 19, 2025
73e01e0
Fix formatting
Mozz3d Jan 19, 2025
c018e33
Remove whitespace
Mozz3d Jan 19, 2025
a009e45
Minor formatting
Mozz3d Jan 19, 2025
c569af3
Add Reloc constness
Mozz3d Jan 19, 2025
a6e38c1
Keep manual alignment & update `CONTRIBUTING.md`
Mozz3d Jan 19, 2025
75fc696
Improve semantics
Mozz3d Jan 21, 2025
830fbca
Add Dumper namespace exceptionality
Mozz3d Jan 22, 2025
3af18a6
Merge branch 'wopss:master' into master
Mozz3d Jan 22, 2025
2323513
Update generated dump
Mozz3d Jan 22, 2025
57dddbc
Fix formatting
Mozz3d Jan 22, 2025
cf40486
Fixes & Dump update
Mozz3d Jan 22, 2025
ca712fb
Update Natives.cpp
Mozz3d Jan 22, 2025
bf27227
Merge branch 'wopss:master' into master
Mozz3d Jan 23, 2025
61e68d1
Improve prefix handling
Mozz3d Jan 23, 2025
6f12a31
Formatting
Mozz3d Jan 23, 2025
277fe2c
Remove whitespace
Mozz3d Jan 23, 2025
bf101ce
Cleanup
Mozz3d Jan 24, 2025
9262417
Remove accidental file & manual `eBufferUsageType` implement
Mozz3d Jan 24, 2025
cd026b3
Add `GpuApi` to `uniqueNamespaces`
Mozz3d Jan 24, 2025
e4dbf79
Rerun dump
Mozz3d Jan 27, 2025
76df691
Adjust input size check (I forgot)
Mozz3d Jan 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions include/RED4ext/Dump/Reflection-inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,30 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a
{
size_t i = 0;

// Special case for AI
if (aInput.size() >= 2 && aInput[0] == 'A' && aInput[1] == 'I')
{
i = 2;
}
static constexpr std::pair<std::string_view, bool> uniqueNamespaces[] = {
{"AI", false}, {"inGame", true}, {"GpuWrapApi", true}, {"GpuWrapApiVertexPacking", true}};

// Special case of "in", this will break directory layout for "ink", "interop", etc..
if (aInput.starts_with("inGame"))
for (const auto& [name, isSpecialCase] : uniqueNamespaces)
{
return "";
if (aInput.size() > name.size() && aInput.starts_with(name))
Mozz3d marked this conversation as resolved.
Show resolved Hide resolved
{
i = name.size();

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')
wopss marked this conversation as resolved.
Show resolved Hide resolved
{
return aInput.substr(0, i);
}
wopss marked this conversation as resolved.
Show resolved Hide resolved
}
}
}

for (; i < aInput.size(); ++i)
Expand Down
11 changes: 11 additions & 0 deletions include/RED4ext/GpuApi/Buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ namespace RED4ext
{
namespace GpuApi
{
enum eBufferUsageType : uint8_t
psiberx marked this conversation as resolved.
Show resolved Hide resolved
{
BUT_Default,
BUT_Immutable,
BUT_Readback,
BUT_Dynamic_Legacy,
BUT_Transient,
BUT_Mapped,
BUT_MAX
};

struct SBufferData
{
uint32_t bufferSize; // 00
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApiVertexPackingPackingElement.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/PackingElement.hpp>

namespace RED4ext
{
struct GpuWrapApiVertexLayoutDesc
namespace GpuWrapApi
{
struct VertexLayoutDesc
{
static constexpr const char* NAME = "GpuWrapApiVertexLayoutDesc";
static constexpr const char* ALIAS = NAME;

StaticArray<GpuWrapApiVertexPackingPackingElement, 32> elements; // 00
StaticArray<GpuWrapApi::VertexPacking::PackingElement, 32> elements; // 00
StaticArray<uint8_t, 8> slotStrides; // A4
uint32_t slotMask; // B0
uint32_t hash; // B4
};
RED4EXT_ASSERT_SIZE(GpuWrapApiVertexLayoutDesc, 0xB8);
RED4EXT_ASSERT_SIZE(VertexLayoutDesc, 0xB8);
} // namespace GpuWrapApi
using GpuWrapApiVertexLayoutDesc = GpuWrapApi::VertexLayoutDesc;
} // namespace RED4ext

// clang-format on
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
#include <cstdint>
namespace RED4ext
{
enum class GpuWrapApiVertexPackingEStreamType : uint8_t
namespace GpuWrapApi::VertexPacking {
enum class EStreamType : uint8_t
{
ST_PerVertex = 0,
ST_PerInstance = 1,
ST_Max = 2,
ST_Invalid = 255,
};
} // namespace GpuWrapApi::VertexPacking
using GpuWrapApiVertexPackingEStreamType = GpuWrapApi::VertexPacking::EStreamType;
} // namespace RED4ext

// clang-format on
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once

// clang-format off

// This file is generated from the Game's Reflection data

#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/EStreamType.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/ePackingType.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApi/VertexPacking/ePackingUsage.hpp>

namespace RED4ext
{
namespace GpuWrapApi::VertexPacking
{
struct PackingElement
{
static constexpr const char* NAME = "GpuWrapApiVertexPackingPackingElement";
static constexpr const char* ALIAS = NAME;

GpuWrapApi::VertexPacking::ePackingType type; // 00
GpuWrapApi::VertexPacking::ePackingUsage usage; // 01
uint8_t usageIndex; // 02
uint8_t streamIndex; // 03
GpuWrapApi::VertexPacking::EStreamType streamType; // 04
};
RED4EXT_ASSERT_SIZE(PackingElement, 0x5);
} // namespace GpuWrapApi::VertexPacking
using GpuWrapApiVertexPackingPackingElement = GpuWrapApi::VertexPacking::PackingElement;
} // namespace RED4ext

// clang-format on
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include <cstdint>
namespace RED4ext
{
enum class GpuWrapApiVertexPackingePackingType : uint8_t
namespace GpuWrapApi::VertexPacking {
enum class ePackingType : uint8_t
{
PT_Float1 = 0,
PT_Float2 = 1,
Expand Down Expand Up @@ -43,6 +44,8 @@ enum class GpuWrapApiVertexPackingePackingType : uint8_t
PT_Max = 31,
PT_Invalid = 255,
};
} // namespace GpuWrapApi::VertexPacking
using GpuWrapApiVertexPackingePackingType = GpuWrapApi::VertexPacking::ePackingType;
} // namespace RED4ext

// clang-format on
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include <cstdint>
namespace RED4ext
{
enum class GpuWrapApiVertexPackingePackingUsage : uint8_t
namespace GpuWrapApi::VertexPacking {
enum class ePackingUsage : uint8_t
{
PS_SysPosition = 0,
PS_Position = 1,
Expand Down Expand Up @@ -36,6 +37,8 @@ enum class GpuWrapApiVertexPackingePackingUsage : uint8_t
PS_Max = 24,
PS_Invalid = 255,
};
} // namespace GpuWrapApi::VertexPacking
using GpuWrapApiVertexPackingePackingUsage = GpuWrapApi::VertexPacking::ePackingUsage;
} // namespace RED4ext

// clang-format on
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
#include <cstdint>
namespace RED4ext
{
enum class GpuWrapApieIndexBufferChunkType : uint8_t
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include <cstdint>
namespace RED4ext
{
enum class GpuWrapApieTextureFormat : uint8_t
namespace GpuWrapApi {
enum class eTextureFormat : uint8_t
{
TEXFMT_A8_Unorm = 0,
TEXFMT_R8_Unorm = 1,
Expand Down Expand Up @@ -77,6 +78,8 @@ enum class GpuWrapApieTextureFormat : uint8_t
TEXFMT_Uint_32 = TEXFMT_R32_Uint,
TEXFMT_Uint_R32G32B32A32 = TEXFMT_R16G16B16A16_Uint,
};
} // namespace GpuWrapApi
using GpuWrapApieTextureFormat = GpuWrapApi::eTextureFormat;
} // namespace RED4ext

// clang-format on
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include <cstdint>
namespace RED4ext
{
enum class GpuWrapApieTextureGroup : uint8_t
namespace GpuWrapApi {
enum class eTextureGroup : uint8_t
{
TEXG_Generic_Color = 1,
TEXG_Generic_Grayscale = 2,
Expand All @@ -22,6 +23,8 @@ enum class GpuWrapApieTextureGroup : uint8_t
TEXG_Multilayer_Grayscale = 11,
TEXG_Multilayer_Microblend = 12,
};
} // namespace GpuWrapApi
using GpuWrapApieTextureGroup = GpuWrapApi::eTextureGroup;
} // namespace RED4ext

// clang-format on
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
#include <cstdint>
namespace RED4ext
{
enum class GpuWrapApieTextureType : uint8_t
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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureFormat.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureFormat.hpp>

namespace RED4ext
{
Expand All @@ -16,8 +16,8 @@ struct PSODescRenderTargetSetup
static constexpr const char* NAME = "PSODescRenderTargetSetup";
static constexpr const char* ALIAS = NAME;

StaticArray<GpuWrapApieTextureFormat, 8> rtFormats; // 00
GpuWrapApieTextureFormat dsFormat; // 0C
StaticArray<GpuWrapApi::eTextureFormat, 8> rtFormats; // 00
GpuWrapApi::eTextureFormat dsFormat; // 0C
uint8_t unk0D[0x10 - 0xD]; // D
};
RED4EXT_ASSERT_SIZE(PSODescRenderTargetSetup, 0x10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <RED4ext/Common.hpp>
#include <RED4ext/Scripting/Natives/Generated/ETextureCompression.hpp>
#include <RED4ext/Scripting/Natives/Generated/ETextureRawFormat.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureGroup.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureGroup.hpp>

namespace RED4ext
{
Expand All @@ -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
Expand Down
26 changes: 26 additions & 0 deletions include/RED4ext/Scripting/Natives/Generated/ex/EntitySpawner.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

// clang-format off

// This file is generated from the Game's Reflection data

#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/Scripting/Natives/Generated/game/IGameSystem.hpp>

namespace RED4ext
{
namespace ex
{
struct EntitySpawner : game::IGameSystem
psiberx marked this conversation as resolved.
Show resolved Hide resolved
{
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Mozz3d marked this conversation as resolved.
Show resolved Hide resolved
bool isPlayer; // 70
uint8_t unk71[0x78 - 0x71]; // 71
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApieIndexBufferChunkType.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApi/eIndexBufferChunkType.hpp>

namespace RED4ext
{
Expand All @@ -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
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApieTextureType.hpp>
#include <RED4ext/Scripting/Natives/Generated/GpuWrapApi/eTextureType.hpp>

namespace RED4ext
{
Expand All @@ -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
Expand Down
Loading