fix zmode info

This commit is contained in:
Jasper St. Pierre
2024-01-14 15:49:59 -08:00
parent 17c22d79a2
commit 28e263ac3c
6 changed files with 24 additions and 33 deletions
+6 -6
View File
@@ -560,15 +560,15 @@ inline u16 calcZModeID(u8 param_0, u8 param_1, u8 param_2) {
return (param_1 * 2) + (param_0 * 0x10) + param_2;
}
extern J3DZModeInfo j3dZModeTable[0x20];
extern u8 j3dZModeTable[96];
struct J3DZMode {
J3DZMode() { mZModeID = j3dDefaultZModeID; }
explicit J3DZMode(const J3DZModeInfo& info) { setZModeInfo(info); }
u8 getCompareEnaable() const { return j3dZModeTable[mZModeID].mCompareEnable; }
u8 getFunc() const { return j3dZModeTable[mZModeID].mFunc; }
u8 getUpdateEnable() const { return j3dZModeTable[mZModeID].mUpdateEnable; }
u8 getCompareEnaable() const { return j3dZModeTable[mZModeID * 3 + 0]; }
u8 getFunc() const { return j3dZModeTable[mZModeID * 3 + 1]; }
u8 getUpdateEnable() const { return j3dZModeTable[mZModeID * 3 + 2]; }
void setZModeInfo(const J3DZModeInfo& info) {
u8 compareEn = info.mCompareEnable;
@@ -580,11 +580,11 @@ struct J3DZMode {
}
void setCompareEnable(u8 i_compare) {
mZModeID = calcZModeID(i_compare, j3dZModeTable[mZModeID].mFunc, j3dZModeTable[mZModeID].mUpdateEnable);
mZModeID = calcZModeID(i_compare, j3dZModeTable[mZModeID * 3 + 1], j3dZModeTable[mZModeID * 3 + 2]);
}
void setUpdateEnable(u8 i_enable) {
mZModeID = calcZModeID(j3dZModeTable[mZModeID].mCompareEnable, j3dZModeTable[mZModeID].mFunc, i_enable);
mZModeID = calcZModeID(j3dZModeTable[mZModeID * 3], j3dZModeTable[mZModeID * 3 + 1], i_enable);
}
/* 0x0 */ u16 mZModeID;
+4 -14
View File
@@ -234,20 +234,10 @@ struct J3DColorChanInfo {
};
struct J3DZModeInfo {
/* 0x0 */ u8 mCompareEnable;
/* 0x1 */ u8 mFunc;
/* 0x2 */ u8 mUpdateEnable;
/* 0x00 */ u8 mCompareEnable;
/* 0x01 */ u8 mFunc;
/* 0x02 */ u8 mUpdateEnable;
/* 0x03 */ u8 pad;
};
// TODO: This struct is a fakematch.
// J3DZModeInfo is only 3 bytes in arrays, but 4 bytes when it's a standalone symbol (with 1 byte alignment).
// Until we figure out the correct way to match this, use J3DZModeInfo in arrays and J3DZModeInfo_4bytes otherwise.
// ninja diff notices that the size of a standalone J3DZModeInfo is wrong and reports it as an error without this.
struct J3DZModeInfo_4bytes {
J3DZModeInfo parent;
u8 padding;
};
STATIC_ASSERT(sizeof(J3DTevStageInfo) == 0x14);
#endif /* J3DSTRUCT_H */