More J3DMatBlock progress with terrible alignment hacks (and some real fixes too)

This commit is contained in:
Luke Street
2023-09-23 19:53:32 -04:00
parent 5e43515ca7
commit 45eef35f72
4 changed files with 14 additions and 17 deletions
+2 -3
View File
@@ -760,9 +760,8 @@ struct J3DIndTexCoordScale {
~J3DIndTexCoordScale();
J3DIndTexCoordScale();
/* 0x0 */ u8 mScaleS;
/* 0x0 */ u8 mScaleS __attribute__((aligned(4)));
/* 0x1 */ u8 mScaleT;
u8 pad[2];
};
struct J3DIndTexMtx {
@@ -800,7 +799,7 @@ public:
virtual void setIndTexCoordScale(u32, J3DIndTexCoordScale);
virtual void setIndTexCoordScale(u32, J3DIndTexCoordScale const*);
virtual J3DIndTexCoordScale * getIndTexCoordScale(u32);
virtual ~J3DIndBlock();
virtual ~J3DIndBlock() {}
};
class J3DIndBlockFull : public J3DIndBlock {
+1 -5
View File
@@ -39,17 +39,13 @@ struct J3DIndTevStage {
};
struct J3DTevOrderInfo {
/* 0x0 */ u8 mTexCoord;
/* 0x0 */ u8 mTexCoord __attribute__((aligned(2)));
/* 0x1 */ u8 mTexMap;
/* 0x2 */ u8 mColorChan;
/* 0x3 */ u8 field_0x3; // Maybe padding
};
struct J3DTevOrder : public J3DTevOrderInfo {
J3DTevOrder();
J3DTevOrder(const J3DTevOrderInfo& info) {
*(J3DTevOrderInfo*)this = info;
}
u8 getTexMap() { return mTexMap; }
};
+3
View File
@@ -24,6 +24,9 @@
#define _SDA2_BASE_(dummy) 0
#ifndef IN_VSCODE_EDITOR
#ifndef offsetof
#define offsetof(type, member) ((size_t) & (((type*)0)->member))
#endif
#define GLUE(a, b) a##b
#define GLUE2(a, b) GLUE(a, b)
#define STATIC_ASSERT(cond) typedef char GLUE2(static_assertion_failed, __LINE__)[(cond) ? 1 : -1]
+8 -9
View File
@@ -1008,7 +1008,7 @@ void J3DTevBlock16::setTevKColorSel(u32 i, const u8* pNum) {
/* 802EA3C0-802EA3CC .text getTevKColorSel__13J3DTevBlock16FUl */
u8 J3DTevBlock16::getTevKColorSel(u32 i) {
return mTevKAlphaSel[i];
return mTevKColorSel[i];
}
/* 802EA3CC-802EA3D8 .text setTevKAlphaSel__13J3DTevBlock16FUlUc */
@@ -1038,7 +1038,7 @@ void J3DTevBlock16::setTevStageNum(const u8* pNum) {
/* 802EA408-802EA410 .text getTevStageNum__13J3DTevBlock16CFv */
u8 J3DTevBlock16::getTevStageNum() const {
/* Nonmatching */
return mTevStageNum;
}
/* 802EA410-802EA44C .text setTevStage__13J3DTevBlock16FUl11J3DTevStage */
@@ -1098,7 +1098,7 @@ J3DIndTevStage * J3DTevBlock16::getIndTevStage(u32 i) {
/* 802EA578-802EA580 .text getTexNoOffset__13J3DTevBlock16CFv */
u32 J3DTevBlock16::getTexNoOffset() const {
/* Nonmatching */
return mTexNoOffset;
}
/* 802EA580-802EA588 .text getTevRegOffset__13J3DTevBlock16CFv */
@@ -1118,7 +1118,7 @@ J3DTevBlock16::~J3DTevBlock16() {
/* 802EA5EC-802EA5F4 .text setTexNoOffset__11J3DTevBlockFUl */
void J3DTevBlock::setTexNoOffset(u32 i) {
/* Nonmatching */
mTexNoOffset = i;
}
/* 802EA5F4-802EA5F8 .text ptrToIndex__12J3DTevBlock4Fv */
@@ -1208,7 +1208,7 @@ void J3DTevBlock4::setTevKColorSel(u32 i, const u8* pNum) {
/* 802EA7AC-802EA7B8 .text getTevKColorSel__12J3DTevBlock4FUl */
u8 J3DTevBlock4::getTevKColorSel(u32 i) {
return mTevKAlphaSel[i];
return mTevKColorSel[i];
}
/* 802EA7B8-802EA7C4 .text setTevKAlphaSel__12J3DTevBlock4FUlUc */
@@ -1238,7 +1238,7 @@ void J3DTevBlock4::setTevStageNum(const u8* pNum) {
/* 802EA7F4-802EA7FC .text getTevStageNum__12J3DTevBlock4CFv */
u8 J3DTevBlock4::getTevStageNum() const {
/* Nonmatching */
return mTevStageNum;
}
/* 802EA7FC-802EA838 .text setTevStage__12J3DTevBlock4FUl11J3DTevStage */
@@ -1298,7 +1298,7 @@ J3DIndTevStage * J3DTevBlock4::getIndTevStage(u32 i) {
/* 802EA964-802EA96C .text getTexNoOffset__12J3DTevBlock4CFv */
u32 J3DTevBlock4::getTexNoOffset() const {
/* Nonmatching */
return mTexNoOffset;
}
/* 802EA96C-802EA974 .text getTevRegOffset__12J3DTevBlock4CFv */
@@ -1403,7 +1403,7 @@ void J3DTevBlock2::setTevKColorSel(u32 i, const u8* pNum) {
/* 802EAB90-802EAB9C .text getTevKColorSel__12J3DTevBlock2FUl */
u8 J3DTevBlock2::getTevKColorSel(u32 i) {
return mTevKAlphaSel[i];
return mTevKColorSel[i];
}
/* 802EAB9C-802EABA8 .text setTevKAlphaSel__12J3DTevBlock2FUlUc */
@@ -2208,7 +2208,6 @@ J3DIndTexCoordScale * J3DIndBlockFull::getIndTexCoordScale(u32 i) {
/* 802EBBA4-802EBC40 .text __dt__15J3DIndBlockFullFv */
J3DIndBlockFull::~J3DIndBlockFull() {
/* Nonmatching */
}
/* 802EBC40-802EBC44 .text patchTexNo__11J3DTevBlockFv */