diff --git a/include/JSystem/J3DGraphBase/J3DMatBlock.h b/include/JSystem/J3DGraphBase/J3DMatBlock.h index 2d5889b8b..cf44e26ea 100644 --- a/include/JSystem/J3DGraphBase/J3DMatBlock.h +++ b/include/JSystem/J3DGraphBase/J3DMatBlock.h @@ -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; diff --git a/include/JSystem/J3DGraphBase/J3DStruct.h b/include/JSystem/J3DGraphBase/J3DStruct.h index da08ebdc5..25868ce96 100644 --- a/include/JSystem/J3DGraphBase/J3DStruct.h +++ b/include/JSystem/J3DGraphBase/J3DStruct.h @@ -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 */ diff --git a/include/JSystem/JAudio/JAIBankWave.h b/include/JSystem/JAudio/JAIBankWave.h index cdf112007..89929757f 100644 --- a/include/JSystem/JAudio/JAIBankWave.h +++ b/include/JSystem/JAudio/JAIBankWave.h @@ -31,6 +31,7 @@ namespace JAInter { u8 flag6 : 1; u8 flag7 : 1; u8 flag8 : 1; + u8 flag9 : 1; }; extern initOnCode_s* initOnCodeBnk; diff --git a/src/JSystem/J3DGraphBase/J3DTevs.cpp b/src/JSystem/J3DGraphBase/J3DTevs.cpp index 5a01822e0..60d76748d 100644 --- a/src/JSystem/J3DGraphBase/J3DTevs.cpp +++ b/src/JSystem/J3DGraphBase/J3DTevs.cpp @@ -262,18 +262,18 @@ void makeAlphaCmpTable() { } } -J3DZModeInfo j3dZModeTable[0x20]; +u8 j3dZModeTable[96]; /* 802EC69C-802EC708 .text makeZModeTable__Fv */ void makeZModeTable() { - J3DZModeInfo* table = j3dZModeTable; + u8* table = j3dZModeTable; for (int i = 0; i < 2; i++) { for (u32 j = 0; j < 8; j++) { for (int k = 0; k < 2; k++) { u32 idx = j * 2 + i * 16 + k; - table[idx].mCompareEnable = i; - table[idx].mFunc = j; - table[idx].mUpdateEnable = k; + table[idx * 3 + 0] = i; + table[idx * 3 + 1] = j; + table[idx * 3 + 2] = k; } } } diff --git a/src/d/actor/d_a_vrbox2.cpp b/src/d/actor/d_a_vrbox2.cpp index e51254344..36a478af6 100644 --- a/src/d/actor/d_a_vrbox2.cpp +++ b/src/d/actor/d_a_vrbox2.cpp @@ -84,7 +84,7 @@ static BOOL daVrbox2_Draw(vrbox2_class* i_this) { return TRUE; } -J3DZModeInfo_4bytes l_zmodeInfo = { GX_FALSE, GX_LEQUAL, GX_FALSE }; +J3DZModeInfo l_zmodeInfo = { GX_FALSE, GX_LEQUAL, GX_FALSE }; /* 8015EC30-8015F368 .text daVrbox2_color_set__FP12vrbox2_class */ BOOL daVrbox2_color_set(vrbox2_class* i_this) { @@ -162,7 +162,7 @@ BOOL daVrbox2_color_set(vrbox2_class* i_this) { modelData = i_this->mpBackCloud->getModelData(); mat = modelData->getMaterialNodePointer(0); mat->setCullMode(GX_CULL_NONE); - mat->getZMode()->setZModeInfo(l_zmodeInfo.parent); + mat->getZMode()->setZModeInfo(l_zmodeInfo); mat->change(); mtx = mat->getTexMtx(0); @@ -180,7 +180,7 @@ BOOL daVrbox2_color_set(vrbox2_class* i_this) { mat = modelData->getMaterialNodePointer(1); mat->setCullMode(GX_CULL_NONE); - mat->getZMode()->setZModeInfo(l_zmodeInfo.parent); + mat->getZMode()->setZModeInfo(l_zmodeInfo); mat->change(); mtx = mat->getTexMtx(0); @@ -193,7 +193,7 @@ BOOL daVrbox2_color_set(vrbox2_class* i_this) { mat = modelData->getMaterialNodePointer(2); mat->setCullMode(GX_CULL_NONE); - mat->getZMode()->setZModeInfo(l_zmodeInfo.parent); + mat->getZMode()->setZModeInfo(l_zmodeInfo); mat->change(); mtx = mat->getTexMtx(0); @@ -207,7 +207,7 @@ BOOL daVrbox2_color_set(vrbox2_class* i_this) { if (i_this->mpKasumiMae != NULL) { mat = i_this->mpKasumiMae->getModelData()->getMaterialNodePointer(0); - mat->getZMode()->setZModeInfo(l_zmodeInfo.parent); + mat->getZMode()->setZModeInfo(l_zmodeInfo); mat->change(); c0.r = g_env_light.mVrKasumiMaeColor.r; @@ -223,7 +223,7 @@ BOOL daVrbox2_color_set(vrbox2_class* i_this) { if (i_this->mpUsoUmi != NULL) { mat = i_this->mpUsoUmi->getModelData()->getMaterialNodePointer(0); - mat->getZMode()->setZModeInfo(l_zmodeInfo.parent); + mat->getZMode()->setZModeInfo(l_zmodeInfo); mat->change(); k0.r = g_env_light.mVrUsoUmiColor.r; diff --git a/src/d/d_shop.cpp b/src/d/d_shop.cpp index bf9a7ce01..6c40ab88c 100644 --- a/src/d/d_shop.cpp +++ b/src/d/d_shop.cpp @@ -1399,10 +1399,10 @@ u8 dShop_BoughtErrorStatus(ShopItems_c* shopItems, int param_2, int param_3) { /* 800606A8-80060830 .text __ct__12ShopCursor_cFP12J3DModelDataP15J3DAnmTevRegKeyf */ ShopCursor_c::ShopCursor_c(J3DModelData* modelData, J3DAnmTevRegKey* brkData, f32 param_2) { - static J3DZModeInfo_4bytes ZModeInfo = {GX_TRUE, GX_ALWAYS, GX_TRUE}; + static J3DZModeInfo ZModeInfo = {GX_TRUE, GX_ALWAYS, GX_TRUE}; for (u16 i = 0; i < modelData->getMaterialNum(); i++) { J3DMaterial* mat = modelData->getMaterialNodePointer(i); - mat->getZMode()->setZModeInfo(ZModeInfo.parent); + mat->getZMode()->setZModeInfo(ZModeInfo); } for (int i = 0; i < (int)ARRAY_SIZE(mpModels); i++) {