Skip to content

Commit

Permalink
Decode entity related types
Browse files Browse the repository at this point in the history
  • Loading branch information
psiberx committed May 2, 2024
1 parent f74a6b9 commit e7733c4
Show file tree
Hide file tree
Showing 8 changed files with 239 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

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

#include <RED4ext/Scripting/Natives/appearanceAppearanceDefinition.hpp>

namespace RED4ext
{
RED4EXT_ASSERT_SIZE(appearance::AppearanceDefinition, 0x1D8);
using appearanceAppearanceDefinition = appearance::AppearanceDefinition;
} // namespace RED4ext

/*
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/CName.hpp>
Expand Down Expand Up @@ -52,5 +61,6 @@ RED4EXT_ASSERT_SIZE(AppearanceDefinition, 0x1D8);
} // namespace appearance
using appearanceAppearanceDefinition = appearance::AppearanceDefinition;
} // namespace RED4ext
*/

// clang-format on
11 changes: 11 additions & 0 deletions include/RED4ext/Scripting/Natives/Generated/ent/Entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

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

#include <RED4ext/Scripting/Natives/entEntity.hpp>

namespace RED4ext
{
RED4EXT_ASSERT_SIZE(ent::Entity, 0x160);
using entEntity = ent::Entity;
using Entity = ent::Entity;
} // namespace RED4ext

/*
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/Scripting/IScriptable.hpp>
Expand All @@ -30,5 +40,6 @@ RED4EXT_ASSERT_SIZE(Entity, 0x160);
using entEntity = ent::Entity;
using Entity = ent::Entity;
} // namespace RED4ext
*/

// clang-format on
10 changes: 10 additions & 0 deletions include/RED4ext/Scripting/Natives/Generated/ent/EntityTemplate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

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

#include <RED4ext/Scripting/Natives/entEntityTemplate.hpp>

namespace RED4ext
{
RED4EXT_ASSERT_SIZE( ent::EntityTemplate, 0x2B0);
using entEntityTemplate = ent::EntityTemplate;
} // namespace RED4ext

/*
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/CName.hpp>
Expand Down Expand Up @@ -52,5 +61,6 @@ RED4EXT_ASSERT_SIZE(EntityTemplate, 0x2B0);
} // namespace ent
using entEntityTemplate = ent::EntityTemplate;
} // namespace RED4ext
*/

// clang-format on
11 changes: 11 additions & 0 deletions include/RED4ext/Scripting/Natives/Generated/ent/IComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

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

#include <RED4ext/Scripting/Natives/entIComponent.hpp>

namespace RED4ext
{
RED4EXT_ASSERT_SIZE(ent::IComponent, 0x90);
using entIComponent = ent::IComponent;
using IComponent = ent::IComponent;
} // namespace RED4ext

/*
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/CName.hpp>
Expand Down Expand Up @@ -32,5 +42,6 @@ RED4EXT_ASSERT_SIZE(IComponent, 0x90);
using entIComponent = ent::IComponent;
using IComponent = ent::IComponent;
} // namespace RED4ext
*/

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

#include <RED4ext/CName.hpp>
#include <RED4ext/Common.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/ISerializable.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <RED4ext/Package.hpp>
#include <RED4ext/Scripting/Natives/Generated/appearance/AppearancePart.hpp>
#include <RED4ext/Scripting/Natives/Generated/appearance/AppearancePartOverrides.hpp>
#include <RED4ext/Scripting/Natives/Generated/ent/EntityParametersBuffer.hpp>
#include <RED4ext/Scripting/Natives/Generated/game/HitRepresentationOverride.hpp>
#include <RED4ext/Scripting/Natives/Generated/red/TagList.hpp>

namespace RED4ext
{
struct CMesh;
struct CResource;

namespace appearance
{
struct AppearanceDefinition : ISerializable
{
static constexpr const char* NAME = "appearanceAppearanceDefinition";
static constexpr const char* ALIAS = NAME;

CName name; // 30
CName parentAppearance; // 38
DynArray<DynArray<CName>> partsMasks; // 40
DynArray<appearance::AppearancePart> partsValues; // 50
RaRef<CMesh> proxyMesh; // 60
CName proxyMeshAppearance; // 68
RaRef<CResource> cookedDataPathOverride; // 70
DynArray<appearance::AppearancePartOverrides> partsOverrides; // 78
red::TagList visualTags; // 88
red::TagList inheritedVisualTags; // 98
DynArray<game::HitRepresentationOverride> hitRepresentationOverrides; // A8
ent::EntityParametersBuffer parametersBuffer; // B8
uint32_t censorFlags; // E0
uint8_t forcedLodDistance; // E4
uint8_t unkE5[0xF0 - 0xE5]; // E5
DeferredDataBuffer compiledData; // F0
ObjectPackageHeader compiledDataHeader; // 148
DynArray<RaRef<CResource>> resolvedDependencies; // 1B8
DynArray<RaRef<CResource>> looseDependencies; // 1C8
};
RED4EXT_ASSERT_SIZE(AppearanceDefinition, 0x1D8);
} // namespace appearance
} // namespace RED4ext
63 changes: 63 additions & 0 deletions include/RED4ext/Scripting/Natives/entEntity.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#pragma once

#include <RED4ext/Common.hpp>
#include <RED4ext/Scripting/IScriptable.hpp>
#include <RED4ext/Scripting/Natives/Generated/ECustomCameraTarget.hpp>
#include <RED4ext/Scripting/Natives/Generated/RenderSceneLayerMask.hpp>
#include <RED4ext/Scripting/Natives/Generated/ent/EntityID.hpp>
#include <RED4ext/Scripting/Natives/Generated/ent/IComponent.hpp>
#include <RED4ext/Scripting/Natives/Generated/red/TagList.hpp>
#include <RED4ext/Scripting/Natives/ScriptGameInstance.hpp>

namespace RED4ext
{
namespace world { struct RuntimeScene; }

enum class EntityStatus : uint8_t
{
Undefined = 0,
Initializing = 1,
Detached = 2,
Attaching = 3,
Attached = 4,
Detaching = 5,
Uninitializing = 6,
Uninitialized = 7,
};

namespace ent
{
struct IPlacedComponent;

struct Entity : IScriptable
{
static constexpr const char* NAME = "entEntity";
static constexpr const char* ALIAS = "Entity";

uint32_t unk40; // 40
uint32_t unk44; // 44
EntityID entityID; // 48
CName appearanceName; // 50
uint64_t unk58; // 58
ResourcePath templatePath; // 60
uint64_t unk68; // 68
uint8_t componentsStorage[0x30]; // 70 - ComponentsStorage but without Handle?
DynArray<Handle<IComponent>> components; // A0 - Part of ComponentsStorage
IPlacedComponent* transformComponent; // B0
world::RuntimeScene* runtimeScene; // B8
ScriptGameInstance* gameInstance; // C0
void* unkC8; // C8
void* unkD0; // D0
uint8_t eventManager[0x138 - 0xD8]; // D8
red::TagList visualTags; // 138
uint8_t unk148[0x154 - 0x148]; // 148
ECustomCameraTarget customCameraTarget; // 154
uint8_t unk155; // 155
EntityStatus status; // 156
uint8_t unk157[0x15B - 0x157]; // 157
RenderSceneLayerMask renderSceneLayerMask; // 15B
uint8_t unk15C[0x160 - 0x15C]; // 15C
};
RED4EXT_ASSERT_SIZE(Entity, 0x160);
} // namespace ent
} // namespace RED4ext
49 changes: 49 additions & 0 deletions include/RED4ext/Scripting/Natives/entEntityTemplate.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#pragma once

#include <RED4ext/Common.hpp>
#include <RED4ext/CName.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/Handle.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <RED4ext/Package.hpp>
#include <RED4ext/Scripting/Natives/Generated/ent/TemplateAppearance.hpp>
#include <RED4ext/Scripting/Natives/Generated/ent/TemplateBindingOverride.hpp>
#include <RED4ext/Scripting/Natives/Generated/ent/TemplateComponentBackendDataOverrideInfo.hpp>
#include <RED4ext/Scripting/Natives/Generated/ent/TemplateComponentResolveSettings.hpp>
#include <RED4ext/Scripting/Natives/Generated/ent/TemplateInclude.hpp>
#include <RED4ext/Scripting/Natives/Generated/res/StreamedResource.hpp>

namespace RED4ext
{
struct CResource;
namespace ent { struct VisualTagsSchema; }

namespace ent
{
struct EntityTemplate : res::StreamedResource
{
static constexpr const char* NAME = "entEntityTemplate";
static constexpr const char* ALIAS = NAME;

DynArray<ent::TemplateInclude> includes; // 40
DynArray<ent::TemplateAppearance> appearances; // 50
CName defaultAppearance; // 60
DynArray<ent::TemplateComponentResolveSettings> componentResolveSettings; // 68
DynArray<ent::TemplateBindingOverride> bindingOverrides; // 78
DynArray<ent::TemplateComponentBackendDataOverrideInfo> backendDataOverrides; // 88
Handle<ent::VisualTagsSchema> visualTagsSchema; // 98
ObjectPackageHeader localDataHeader; // A8
DataBuffer localData; // 118
ObjectPackageHeader includeInstanceBufferHeader; // 140
DataBuffer includeInstanceBuffer; // 1B0
ObjectPackageHeader compiledDataHeader; // 1D8
DataBuffer compiledData; // 248
DynArray<RaRef<CResource>> resolvedDependencies; // 270
DynArray<Ref<CResource>> inplaceResources; // 280
uint8_t unk290[0x2A0 - 0x290]; // 290
uint16_t compiledEntityLODFlags; // 2A0
uint8_t unk2A2[0x2B0 - 0x2A2]; // 2A2
};
RED4EXT_ASSERT_SIZE(EntityTemplate, 0x2B0);
} // namespace ent
} // namespace RED4ext
36 changes: 36 additions & 0 deletions include/RED4ext/Scripting/Natives/entIComponent.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#include <RED4ext/Common.hpp>
#include <RED4ext/CName.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <RED4ext/Scripting/IScriptable.hpp>
#include <RED4ext/Scripting/Natives/Generated/ent/IAttachment.hpp>

namespace RED4ext
{
namespace ent
{
struct Entity;

struct IComponent : IScriptable
{
static constexpr const char* NAME = "entIComponent";
static constexpr const char* ALIAS = "IComponent";

CName name; // 40
CName appearanceName; // 48
Entity* owner; // 50
void* unk58; // 58
CRUID id; // 60
ResourcePath appearancePath; // 68
DynArray<Handle<IAttachment>> attachments; // 70
uint16_t unk80; // 80
uint8_t unk82[0x8B - 0x82]; // 82
bool isEnabled; // 8B
bool isReplicable; // 8C
uint8_t unk8D[0x90 - 0x8D]; // 8D
};
RED4EXT_ASSERT_SIZE(IComponent, 0x90);
RED4EXT_ASSERT_OFFSET(IComponent, isEnabled, 0x8B);
} // namespace ent
} // namespace RED4ext

0 comments on commit e7733c4

Please sign in to comment.