lyt_animation *ALMOST*

This commit is contained in:
elijah-thomas774
2024-06-09 21:04:42 -04:00
parent f7e702e159
commit 53aa4e2efa
11 changed files with 544 additions and 136 deletions
+2
View File
@@ -383,6 +383,8 @@ nw4r/lyt/lyt_drawInfo.cpp:
nw4r/lyt/lyt_animation.cpp:
.text start:0x80490A40 end:0x80491FF4
.data start:0x8056E7B8 end:0x8056E7DC
.sdata2 start:0x8057F2C0 end:0x8057F2E0
nw4r/lyt/lyt_resourceAccessor.cpp:
.text start:0x80492000 end:0x80492058
+1 -1
View File
@@ -37084,7 +37084,7 @@ __vt__Q34nw4r3lyt8Bounding = .data:0x8056E6C0; // type:object size:0x74
@LOCAL@SetupGX__Q34nw4r3lyt8MaterialFbUc@kAlpSels = .data:0x8056E758; // type:object size:0x20 data:4byte
__vt__Q34nw4r3lyt8Material = .data:0x8056E778; // type:object size:0x30
__vt__Q34nw4r3lyt8DrawInfo = .data:0x8056E7A8; // type:object size:0xC
lbl_8056E7B8 = .data:0x8056E7B8; // type:object size:0x28
__vt__Q34nw4r3lyt18AnimTransformBasic = .data:0x8056E7B8; // type:object size:0x24
__vt__Q34nw4r3lyt16ResourceAccessor = .data:0x8056E7E0; // type:object size:0x14
__vt__Q34nw4r3lyt24MultiArcResourceAccessor = .data:0x8056E7F8; // type:object size:0x14
__vt__Q34nw4r3lyt19ArcResourceAccessor = .data:0x8056E80C; // type:object size:0x14
+1 -1
View File
@@ -252,7 +252,7 @@ def EGGLib(lib_name, objects):
def nw4rLib(lib_name, objects, extra_cflags=[]):
return {
"lib": lib_name,
"mw_version": "Wii/1.1", # most seem to be around 1.2, snd is 1.6
"mw_version": "Wii/1.3", # most seem to be around 1.2, snd is 1.6
"cflags": cflags_nw4r + extra_cflags,
"host": False,
"objects": objects,
+26 -9
View File
@@ -25,14 +25,24 @@ public:
virtual void Animate(u32 idx, Pane *pPane) = 0; // at 0x1C
virtual void Animate(u32 idx, Material *pMaterial) = 0; // at 0x20
res::AnimationBlock *GetAnimResource() const {
f32 GetFrameMax() const {
return mFrame; // TOOD
}
const res::AnimationBlock *GetAnimResource() const {
return mpRes;
}
f32 GetFrame() const {
return mFrame;
}
void SetFrame(f32 frame) {
mFrame = frame;
}
ut::LinkListNode mLink; // at 0x4
protected:
res::AnimationBlock *mpRes; // at 0xC
f32 mFrame; // at 0x10
const res::AnimationBlock *mpRes; // at 0xC
f32 mFrame; // at 0x10
};
class AnimResource {
@@ -44,10 +54,10 @@ public:
void Set(const void *anmResBuf);
void Init();
u16 GetGroupNum() const;
AnimationGroupRef *GetGroupArray() const;
const AnimationGroupRef *GetGroupArray() const;
bool IsDescendingBind() const;
u16 GetAnimationShareInfoNum() const;
AnimationShareInfo *GetAnimationShareInfoArray() const;
const AnimationShareInfo *GetAnimationShareInfoArray() const;
u16 CalcAnimationNum(Pane *pPane, bool bRecursive) const;
u16 CalcAnimationNum(Group *pGroup, bool bRecursive) const;
@@ -71,7 +81,7 @@ private:
class AnimTransformBasic : public AnimTransform {
public:
AnimTransformBasic();
AnimationLink *FindUnbindLink(AnimationLink *pLink);
AnimationLink *FindUnbindLink(AnimationLink *pLink) const;
virtual ~AnimTransformBasic(); // at 0x08
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor); // at 0x0C
@@ -84,8 +94,12 @@ public:
template <typename T>
AnimationLink *Bind(T *pTarget, AnimationLink *pAnimLink, u16 idx, bool bDisable);
private:
void *mpFileResAry; // at 0x14
AnimationLink *GetAnimLinkAry() const {
return mAnimLinkAry;
}
protected:
void **mpFileResAry; // at 0x14
AnimationLink *mAnimLinkAry; // at 0x18
u16 mAnimLinkNum; // at 0x1C
};
@@ -97,7 +111,10 @@ public:
Init();
Set(pTargetPane, animRes);
}
bool IsEnabled() const;
bool IsEnabled() const {
// TODO
return false;
}
static u16 FindAnimContent(const res::AnimationBlock *pAnimBlock, const char *animContName, u8 animContType);
void Init();
void Set(Pane *pTargetPane, const AnimResource &animRes);
+5
View File
@@ -41,6 +41,11 @@ inline void SetVerticalPosition(u8 *pVar, u8 newVal) {
*pVar = newVal * 3 + GetHorizontalPosition(*pVar);
}
inline const char *GetStrTableStr(const void *pStrTable, int index) {
const u32 *offsets = (u32 *)pStrTable;
const char *stringPool = (char *)pStrTable;
return &stringPool[offsets[index]];
}
typedef math::VEC2 TexCoordData[TEXCOORD_VTX_COUNT];
class TexCoordAry {
+12
View File
@@ -78,8 +78,15 @@ public:
}
// SetTexSRTElement__Q34nw4r3lyt8MaterialFUlUlf
void SetTexSRTElement(u32 texSRTIdx, u32 eleIdx, f32 value) {
f32 *srtAry = (f32 *)&(GetTexSRTAry()[texSRTIdx]);
srtAry[eleIdx] = value;
}
// GetTexturePtr__Q34nw4r3lyt8MaterialFUc
TexMap *GetTexturePtr(u8 idx) {
return &GetTexMapAry()[idx];
}
// GetTexSRTCap__Q34nw4r3lyt8MaterialCFv
u8 GetTexSRTCap() const {
@@ -90,7 +97,12 @@ public:
u8 GetIndTexSRTCap() const {
return mGXMemCap.indSRT;
}
// SetIndTexSRTElement__Q34nw4r3lyt8MaterialFUlUlf
void SetIndTexSRTElement(u32 texSRTIdx, u32 eleIdx, f32 value) {
f32 *srtAry = (f32 *)&(GetIndTexSRTAry()[texSRTIdx]);
srtAry[eleIdx] = value;
}
ut::LinkList<AnimationLink, 0> *GetAnimationList() {
return &mAnimList;
+8
View File
@@ -78,6 +78,10 @@ public:
mSize = value;
}
void SetSRTElement(u32 idx, f32 f) {
((f32 *)&mTranslate)[idx] = f;
}
const res::ExtUserDataList *GetExtUserDataList() const {
return mpExtUserDataList;
}
@@ -85,6 +89,10 @@ public:
mpExtUserDataList = pBlock;
}
const char *GetName() const {
return mName;
}
Pane();
Pane(const res::Pane *pBlock);
void Init();
+4 -4
View File
@@ -30,8 +30,8 @@ struct BinaryFileHeader {
};
struct DataBlockHeader {
u32 kind; // at 0x0
u32 size; // at 0x4
char kind[4]; // at 0x0
u32 size; // at 0x4
};
struct TexSRT {
@@ -250,7 +250,7 @@ struct WindowContent {
struct AnimationBlock {
DataBlockHeader blockHeader; // at 0x00
u16 frameSize; // at 0x08
bool loop; // at 0x0A
u8 loop; // at 0x0A
u8 padding1; // at 0x0B
u16 fileNum; // at 0x0C
u16 animContNum; // at 0x0E
@@ -308,7 +308,7 @@ struct AnimationContent {
char name[20]; // at 0x00
u8 num; // at 0x14
u8 type; // at 0x15
u8 padding[2]; // at 0x17
u8 padding[2]; // at 0x67
};
} // namespace res
+16
View File
@@ -57,11 +57,27 @@ static inline u16 __OSf32tou16(register f32 arg) {
r = *(u16 *)ptr;
return r;
}
static inline u8 __OSf32tou8(register f32 arg) {
f32 a;
register f32 *ptr = &a;
register u8 r;
// clang-format off
asm {
psq_st arg, 0(ptr), 1, 2
lbz r, 0(ptr)
}
// clang-format on
return r;
}
static inline void OSf32tou16(const f32 *in, u16 *out) {
*out = __OSf32tou16(*in);
}
static inline void OSf32tou8(const f32 *in, u8 *out) {
*out = __OSf32tou8(*in);
}
static inline f32 __OSs16tof32(register const s16 *arg) {
register f32 ret;
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -93,7 +93,7 @@ bool Layout::Build(const void *lytResBuf, ResourceAccessor *pResAcsr) {
const void *dataPtr = ((u8 *)lytResBuf + pFileHead->headerSize);
for (int i = 0; i < pFileHead->dataBlocks; i++) {
const res::DataBlockHeader *pDataBlockHead = (const res::DataBlockHeader *)dataPtr;
switch (pDataBlockHead->kind) {
switch (detail::GetSignatureInt(pDataBlockHead->kind)) {
case 'lyt1': // Main Layout
{
const res::Layout *pResLyt = ((const res::Layout *)dataPtr);
@@ -114,7 +114,7 @@ bool Layout::Build(const void *lytResBuf, ResourceAccessor *pResAcsr) {
case 'txt1': // Text Box
case 'bnd1': // Boundary Pane
{
Pane *pPane = BuildPaneObj(pDataBlockHead->kind, dataPtr, resBlockSet);
Pane *pPane = BuildPaneObj(detail::GetSignatureInt(pDataBlockHead->kind), dataPtr, resBlockSet);
if (pPane) {
if (mpRootPane == nullptr) {
mpRootPane = pPane;
@@ -164,7 +164,7 @@ bool Layout::Build(const void *lytResBuf, ResourceAccessor *pResAcsr) {
// CreateAnimTransform__Q34nw4r3lyt6LayoutFv
AnimTransform *Layout::CreateAnimTransform() {
AnimTransform *pAnimTrans = NewObj<AnimTransformBasic>();
AnimTransformBasic *pAnimTrans = NewObj<AnimTransformBasic>();
if (pAnimTrans) {
mAnimTransList.PushBack(pAnimTrans);
}