From 647d41ab27f8aa8510ae1c0057e723ccc00696c7 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sun, 5 Nov 2023 21:53:19 -0500 Subject: [PATCH] J3DTevs match --- configure.py | 2 +- include/JSystem/J3DGraphBase/J3DStruct.h | 4 ++-- src/JSystem/J3DGraphBase/J3DTevs.cpp | 11 ++++------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/configure.py b/configure.py index 2729a1af7..aab8a7ecf 100644 --- a/configure.py +++ b/configure.py @@ -865,7 +865,7 @@ config.libs = [ Object(Matching, "JSystem/J3DGraphBase/J3DShape.cpp"), Object(Matching, "JSystem/J3DGraphBase/J3DMaterial.cpp"), Object(NonMatching, "JSystem/J3DGraphBase/J3DMatBlock.cpp"), - Object(NonMatching, "JSystem/J3DGraphBase/J3DTevs.cpp"), + Object(Matching, "JSystem/J3DGraphBase/J3DTevs.cpp"), Object(Matching, "JSystem/J3DGraphBase/J3DDrawBuffer.cpp"), ], ), diff --git a/include/JSystem/J3DGraphBase/J3DStruct.h b/include/JSystem/J3DGraphBase/J3DStruct.h index 507ba4b85..179284835 100644 --- a/include/JSystem/J3DGraphBase/J3DStruct.h +++ b/include/JSystem/J3DGraphBase/J3DStruct.h @@ -127,7 +127,7 @@ struct J3DIndTexOrderInfo { }; struct J3DTevSwapModeInfo { - /* 0x0 */ u8 field_0x0; + /* 0x0 */ u8 field_0x0 __attribute__((aligned(4))); /* 0x1 */ u8 field_0x1; }; @@ -162,7 +162,7 @@ struct J3DTevStageInfo { }; struct J3DIndTevStageInfo { - /* 0x0 */ u8 mIndStage; + /* 0x0 */ u8 mIndStage __attribute__((aligned(4))); /* 0x1 */ u8 mIndFormat; /* 0x2 */ u8 mBiasSel; /* 0x3 */ u8 mMtxSel; diff --git a/src/JSystem/J3DGraphBase/J3DTevs.cpp b/src/JSystem/J3DGraphBase/J3DTevs.cpp index a73a2796a..60d76748d 100644 --- a/src/JSystem/J3DGraphBase/J3DTevs.cpp +++ b/src/JSystem/J3DGraphBase/J3DTevs.cpp @@ -10,7 +10,6 @@ /* 802EBC94-802EBD48 .text load__11J3DLightObjCFUl */ void J3DLightObj::load(u32 lightIdx) const { - /* Nonmatching */ GDOverflowCheck(0x48); J3DGDSetLightPos(GXLightID(1 << lightIdx), mInfo.mLightPosition.x, mInfo.mLightPosition.y, mInfo.mLightPosition.z); J3DGDSetLightAttn(GXLightID(1 << lightIdx), mInfo.mCosAtten.x, mInfo.mCosAtten.y, mInfo.mCosAtten.z, mInfo.mDistAtten.x, mInfo.mDistAtten.y, mInfo.mDistAtten.z); @@ -218,7 +217,6 @@ static u8 j3dTexCoordTable[7623]; /* 802EC588-802EC630 .text makeTexCoordTable__Fv */ void makeTexCoordTable() { - /* Nonmatching */ u8 texMtx[] = { GX_TEXMTX0, GX_TEXMTX1, @@ -237,7 +235,7 @@ void makeTexCoordTable() { for (u32 i = 0; i < 11; i++) { for (u32 j = 0; j < 21; j++) { for (int k = 0; k < ARRAY_SIZE(texMtx); k++) { - u32 idx = i * 0xe7 + j * 11 + k; + u32 idx = j * 11 + i * 0xe7 + k; table[idx * 3 + 0] = i; table[idx * 3 + 1] = j; table[idx * 3 + 2] = texMtx[k]; @@ -256,7 +254,7 @@ void makeAlphaCmpTable() { for (int j = 0; j < 4; j++) { for (u32 k = 0; k < 8; k++) { u32 idx = i * 32 + j * 8 + k; - table[idx * 3] = i; + table[idx * 3 + 0] = i; table[idx * 3 + 1] = j; table[idx * 3 + 2] = k; } @@ -268,13 +266,12 @@ u8 j3dZModeTable[96]; /* 802EC69C-802EC708 .text makeZModeTable__Fv */ void makeZModeTable() { - /* Nonmatching */ 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 = i * 16 + j * 2 + k; - table[idx * 3] = i; + u32 idx = j * 2 + i * 16 + k; + table[idx * 3 + 0] = i; table[idx * 3 + 1] = j; table[idx * 3 + 2] = k; }