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

Mozz3d patch 1 #123

Closed
wants to merge 16 commits into from
Closed
4 changes: 3 additions & 1 deletion include/RED4ext/Dump/Reflection-inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ RED4EXT_INLINE void Dump(std::filesystem::path aOutPath, std::filesystem::path a
{"BaseGameEngine", "GameEngine"},
{"CGameEngine", "GameEngine"},
{"UpdateBucketEnum", "SystemUpdate"},
{"worldGlobalNodeRef", "NativeTypes"}};
{"worldGlobalNodeRef", "NativeTypes"},
{"AnimSet", "Scripting/Natives/AnimSet"},
{"AnimationBufferCompressed", "Scripting/Natives/AnimationBufferCompressed"}};

std::regex invalidChars(INVALID_CHARACTERS);
std::regex invalidKeywords(INVALID_KEYWORDS);
Expand Down
30 changes: 30 additions & 0 deletions include/RED4ext/Scripting/Natives/AnimBufferState.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include <RED4ext/Buffer.hpp>
#include <RED4ext/Memory/SharedPtr.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <cstdint>

namespace RED4ext
{
namespace anim
{
struct AnimBufferState
{
enum State : uint8_t
{
Empty = 0,
Loading,
Ready,
External,
};

SharedPtr<DeferredDataBufferCopyToken> token; // 00
JobHandle job; // 10
uint32_t requestsCounter; // 18
State state; // 1C
uint8_t unk1E; // 1E
};
RED4EXT_ASSERT_SIZE(AnimBufferState, 0x20);
} // namespace anim
} // namespace RED4ext
67 changes: 67 additions & 0 deletions include/RED4ext/Scripting/Natives/AnimKeyFrames.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#pragma once

#include <cstdint>

namespace RED4ext
{
namespace anim
{
enum KeyFrameComponent
{
Translation = 0,
Rotation,
Scale,
};

struct KeyFrameHeader
{
uint16_t timeNormalized; // 00
uint16_t boneIndex : 13; // 02
uint16_t componentType : 2; // 0E
uint16_t rotationWSign : 1; // 0F
};
RED4EXT_ASSERT_SIZE(KeyFrameHeader, 0x4);

struct KeyFrameCompressed : KeyFrameHeader
{
uint16_t x; // 00
uint16_t y; // 02
uint16_t z; // 04
};
RED4EXT_ASSERT_SIZE(KeyFrameCompressed, 0xA); // total struct size is header size + struct size

struct KeyFrameRaw : KeyFrameHeader
{
float x; // 00
float y; // 04
float z; // 08
};
RED4EXT_ASSERT_SIZE(KeyFrameRaw, 0x10);

struct KeyFrameConst // 14B?
{
uint16_t bitWiseData; // 00 Most likely a bitfield

float x; // 02
float y; // 06
float z; // 0A
};
RED4EXT_ASSERT_SIZE(KeyFrameConst, 0x10);

struct TrackKey
{
uint16_t time; // 00
uint16_t index; // 02
float value; // 04
};
RED4EXT_ASSERT_SIZE(TrackKey, 0x8);

struct TrackKeyConst // 6B?
{
uint16_t index; // 00
float value; // 02
};
RED4EXT_ASSERT_SIZE(TrackKeyConst, 0x8);

} // namespace anim
} // namespace RED4ext
58 changes: 58 additions & 0 deletions include/RED4ext/Scripting/Natives/AnimRig.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#pragma once

#include <RED4ext/CName.hpp>
#include <RED4ext/Common.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/Handle.hpp>
#include <RED4ext/Scripting/Natives/Generated/CResource.hpp>
#include <RED4ext/Scripting/Natives/Generated/QsTransform.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/FloatTrackInfo.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/RigPart.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/RigRetarget.hpp>
#include <RED4ext/Scripting/Natives/Generated/physics/RagdollBodyInfo.hpp>
#include <RED4ext/Scripting/Natives/Generated/physics/RagdollBodyNames.hpp>
#include <RED4ext/Scripting/Natives/Generated/red/TagList.hpp>
#include <cstdint>

namespace RED4ext
{
namespace anim
{
struct IRigIkSetup;
}

namespace anim
{
struct Rig : CResource
{
static constexpr const char* NAME = "animRig";
static constexpr const char* ALIAS = NAME;

// parentIndeces(0x40) and referencePoseLS(0x48) share size with boneNames(0x50)
int16_t* parentIndeces; // 40
QsTransform* referencePoseLS; // 48
DynArray<CName> boneNames; // 50
DynArray<QsTransform> referencePoseMS; // 60
DynArray<int16_t> levelOfDetailStartIndices; // 70
DynArray<int16_t> distanceCategoryToLodMap; // 80
int32_t turnOffLOD; // 90
bool turningOffUpdateAndSample; // 94
uint8_t unk95[0xB8 - 0x95]; // 95
DynArray<QsTransform> aPoseLS; // B8
DynArray<QsTransform> aPoseMS; // C8
DynArray<CName> boneMetaNames; // D8
DynArray<CName> trackNames; // E8
DynArray<float> referenceTracks; // F8
DynArray<anim::FloatTrackInfo> rigExtraTracks; // 108
uint64_t hash; // 118
red::TagList tags; // 120
DynArray<anim::RigPart> parts; // 130
DynArray<anim::RigRetarget> retargets; // 140
DynArray<Handle<anim::IRigIkSetup>> ikSetups; // 150
DynArray<physics::RagdollBodyInfo> ragdollDesc; // 160
DynArray<physics::RagdollBodyNames> ragdollNames; // 170
};
RED4EXT_ASSERT_SIZE(Rig, 0x180);
} // namespace anim
using animRig = anim::Rig;
} // namespace RED4ext
53 changes: 53 additions & 0 deletions include/RED4ext/Scripting/Natives/AnimSet.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#pragma once

// clang-format off

#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/Handle.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <RED4ext/Scripting/Natives/Generated/CResource.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/AnimDataChunk.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/AnimFallbackFrameDesc.hpp>
#include <RED4ext/Scripting/Natives/Generated/red/TagList.hpp>
#include <RED4ext/Scripting/Natives/AnimBufferState.hpp>

namespace RED4ext
{
namespace anim { struct AnimSetEntry; }
namespace anim { struct Rig; }

namespace anim
{
struct AnimSet : CResource
{
static constexpr const char* NAME = "animAnimSet";
static constexpr const char* ALIAS = NAME;

DynArray<Handle<anim::AnimSetEntry>> animations; // 40
DynArray<anim::AnimDataChunk> animationDataChunks; // 50
AnimBufferState* dataState; // 60
DataBuffer fallbackAnimDataBuffer; // 68
uint8_t unk90[0xA8 - 0x90]; // 90
DynArray<anim::AnimFallbackFrameDesc> fallbackAnimFrameDescs; // A8
uint8_t unkB8[0xC8 - 0xB8]; // B8
DynArray<uint16_t> fallbackDataAddresses; // C8
DynArray<uint8_t> fallbackAnimDescIndexes; // D8
DynArray<uint8_t> fallbackDataAddressIndexes; // E8
uint16_t fallbackNumPositionData; // F8
uint16_t fallbackNumRotationData; // FA
uint16_t fallbackNumFloatTrackData; // FC
uint8_t unkFE[0x130 - 0xFE]; // FE
Ref<anim::Rig> rig; // 130
red::TagList tags; // 148
uint8_t unk158[0x1E8 - 0x158]; // 158
uint32_t version; // 1E8
uint8_t unk1EC[0x1F0 - 0x1EC]; // 1EC
};
RED4EXT_ASSERT_SIZE(AnimSet, 0x1F0);
} // namespace anim
using animAnimSet = anim::AnimSet;
} // namespace RED4ext

// clang-format on
57 changes: 57 additions & 0 deletions include/RED4ext/Scripting/Natives/AnimationBufferCompressed.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#pragma once

// clang-format off

#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/CName.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/AnimDataAddress.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/IAnimationBuffer.hpp>
#include <RED4ext/Range.hpp>
#include <RED4ext/Scripting/Natives/KeyFrames.hpp>
#include <RED4ext/Scripting/Natives/AnimBufferState.hpp>

namespace RED4ext
{
namespace anim
{
struct AnimationBufferCompressed : anim::IAnimationBuffer
{
static constexpr const char* NAME = "animAnimationBufferCompressed";
static constexpr const char* ALIAS = NAME;

DynArray<uint16_t> fallbackFrameIndices; // 30
float duration; // 40
uint32_t numFrames; // 44
uint8_t numExtraJoints; // 48
uint8_t numExtraTracks; // 49
bool isScaleConstant; // 4A
bool hasRawRotations; // 4B
uint16_t numJoints; // 4C
uint16_t numTracks; // 4E
uint32_t numAnimKeysCompressed; // 50
uint32_t numAnimKeysRaw; // 54
uint32_t numConstAnimKeys; // 58
uint32_t numTrackKeys; // 5C
uint32_t numConstTrackKeys; // 60
AnimDataAddress dataAddress; // 64
DeferredDataBuffer defferedBuffer; // 70
DataBuffer inplaceCompressedBuffer; // C8
DynArray<CName> extraDataNames; // F0
uint8_t unk100[0x110 - 0x100]; // 100
Range<KeyFrameCompressed> animKeysCompressed; // 110
Range<KeyFrameRaw> animKeysRaw; // 120
Range<KeyFrameConst> constAnimKeys; // 130
Range<TrackKey> trackKeys; // 140
Range<TrackKeyConst> constTrackKeys; // 150
AnimBufferState dataState; // 160
uint64_t unk180; // 180
};
RED4EXT_ASSERT_SIZE(AnimationBufferCompressed, 0x188);
} // namespace anim
using animAnimationBufferCompressed = anim::AnimationBufferCompressed;
} // namespace RED4ext

// clang-format on
18 changes: 8 additions & 10 deletions include/RED4ext/Scripting/Natives/Generated/anim/AnimSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@

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

#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/Handle.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <RED4ext/Scripting/Natives/Generated/CResource.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/AnimDataChunk.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/AnimFallbackFrameDesc.hpp>
#include <RED4ext/Scripting/Natives/Generated/red/TagList.hpp>
#include <RED4ext/Scripting/Natives/AnimSet.hpp>

namespace RED4ext
{
RED4EXT_ASSERT_SIZE(AnimSet, 0x1F0);
using animAnimSet = anim::AnimSet;
} // namespace RED4ext

/*namespace RED4ext
{
namespace anim { struct AnimSetEntry; }
namespace anim { struct Rig; }

Expand Down Expand Up @@ -49,6 +47,6 @@ struct AnimSet : CResource
RED4EXT_ASSERT_SIZE(AnimSet, 0x1F0);
} // namespace anim
using animAnimSet = anim::AnimSet;
} // namespace RED4ext
} // namespace RED4ext*/

// clang-format on
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

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

#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/CName.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/NativeTypes.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/AnimDataAddress.hpp>
#include <RED4ext/Scripting/Natives/Generated/anim/IAnimationBuffer.hpp>
#include <RED4ext/Scripting/Natives/AnimationBufferCompressed.hpp>

namespace RED4ext
{
RED4EXT_ASSERT_SIZE(AnimationBufferCompressed, 0x188);
using animAnimationBufferCompressed = anim::AnimationBufferCompressed;
} // namespace RED4ext

/*namespace RED4ext
{
namespace anim
{
struct AnimationBufferCompressed : anim::IAnimationBuffer
Expand Down Expand Up @@ -44,6 +44,6 @@ struct AnimationBufferCompressed : anim::IAnimationBuffer
RED4EXT_ASSERT_SIZE(AnimationBufferCompressed, 0x188);
} // namespace anim
using animAnimationBufferCompressed = anim::AnimationBufferCompressed;
} // namespace RED4ext
}*/ // namespace RED4ext

// clang-format on
2 changes: 1 addition & 1 deletion include/RED4ext/Scripting/Natives/Generated/anim/Rig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

#include <RED4ext/Scripting/Natives/Rig.hpp>
#include <RED4ext/Scripting/Natives/AnimRig.hpp>

namespace RED4ext
{
Expand Down
Loading
Loading