Fakematch J3DZModeInfo to fix ninja diff error

This commit is contained in:
LagoLunatic
2024-01-08 21:22:18 -05:00
parent 0eb1b383e9
commit a41ec2974e
4 changed files with 18 additions and 10 deletions
+9
View File
@@ -239,6 +239,15 @@ struct J3DZModeInfo {
/* 0x2 */ u8 mUpdateEnable;
};
// 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 */
+1 -1
View File
@@ -8,6 +8,7 @@
#include "global.h"
#include "m_Do/m_Do_ext.h"
#include "m_Do/m_Do_hostIO.h"
#include "f_op/f_op_msg.h"
class daAgb_HIO_c : public mDoHIO_entry_c {
public:
@@ -25,7 +26,6 @@ public:
/* 0x30 */ f32 field_0x30;
};
class msg_class;
class dMsgCtrl_c {
public:
int init(u16);
+6 -6
View File
@@ -84,7 +84,7 @@ static BOOL daVrbox2_Draw(vrbox2_class* i_this) {
return TRUE;
}
J3DZModeInfo l_zmodeInfo = { GX_FALSE, GX_LEQUAL, GX_FALSE };
J3DZModeInfo_4bytes 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);
mat->getZMode()->setZModeInfo(l_zmodeInfo.parent);
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);
mat->getZMode()->setZModeInfo(l_zmodeInfo.parent);
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);
mat->getZMode()->setZModeInfo(l_zmodeInfo.parent);
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);
mat->getZMode()->setZModeInfo(l_zmodeInfo.parent);
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);
mat->getZMode()->setZModeInfo(l_zmodeInfo.parent);
mat->change();
k0.r = g_env_light.mVrUsoUmiColor.r;
+2 -3
View File
@@ -1399,11 +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) {
// TODO: this should be a J3DZModeInfo, but that's 3 bytes when inside arrays, while this is supposed to be 4 bytes, with 1-byte alignment.
static u8 ZModeInfo[4] = {GX_TRUE, GX_ALWAYS, GX_TRUE};
static J3DZModeInfo_4bytes ZModeInfo = {GX_TRUE, GX_ALWAYS, GX_TRUE};
for (u16 i = 0; i < modelData->getMaterialNum(); i++) {
J3DMaterial* mat = modelData->getMaterialNodePointer(i);
mat->getZMode()->setZModeInfo(*(J3DZModeInfo*)&ZModeInfo);
mat->getZMode()->setZModeInfo(ZModeInfo.parent);
}
for (int i = 0; i < (int)ARRAY_SIZE(mpModels); i++) {