summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2024-01-08 21:22:18 -0500
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2024-01-08 21:22:18 -0500
commita41ec2974ea2bbfafbfc491864aeafb021f0878f (patch)
tree43716292dffc7c08a23934d45b569fd27497e486
parent0eb1b383e9eaa0eb82b82dc82b7a44b7c60d9e58 (diff)
Fakematch J3DZModeInfo to fix ninja diff error
-rw-r--r--include/JSystem/J3DGraphBase/J3DStruct.h9
-rw-r--r--include/d/actor/d_a_agb.h2
-rw-r--r--src/d/actor/d_a_vrbox2.cpp12
-rw-r--r--src/d/d_shop.cpp5
4 files changed, 18 insertions, 10 deletions
diff --git a/include/JSystem/J3DGraphBase/J3DStruct.h b/include/JSystem/J3DGraphBase/J3DStruct.h
index 2066a4ee..da08ebdc 100644
--- a/include/JSystem/J3DGraphBase/J3DStruct.h
+++ b/include/JSystem/J3DGraphBase/J3DStruct.h
@@ -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 */
diff --git a/include/d/actor/d_a_agb.h b/include/d/actor/d_a_agb.h
index 4f428811..7ed6df21 100644
--- a/include/d/actor/d_a_agb.h
+++ b/include/d/actor/d_a_agb.h
@@ -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);
diff --git a/src/d/actor/d_a_vrbox2.cpp b/src/d/actor/d_a_vrbox2.cpp
index 36a478af..e5125434 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 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;
diff --git a/src/d/d_shop.cpp b/src/d/d_shop.cpp
index 2b65906b..bf9a7ce0 100644
--- a/src/d/d_shop.cpp
+++ b/src/d/d_shop.cpp
@@ -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++) {