summaryrefslogtreecommitdiff
path: root/src/JSystem/J2DGraph
diff options
context:
space:
mode:
authorCarco_21 <144170194+carter-ktb21@users.noreply.github.com>2025-11-25 11:34:19 -0500
committerGitHub <noreply@github.com>2025-11-25 18:34:19 +0200
commit9e232b61fbac3d4a7564237426b4f0f696bc231f (patch)
tree912b6fc24f87977d4e8ae1a7c26b8d9a1afc725b /src/JSystem/J2DGraph
parent2f2f37a7345d889aa1072b10e3a5022ad1bd15f1 (diff)
Small matches/improvements (#2844)
* j2dmatblock debug work * J2DMaterialFactory matching * J2DPictureEx matching * tiny work * fixed regressions * PR cleanup * build error fix
Diffstat (limited to 'src/JSystem/J2DGraph')
-rw-r--r--src/JSystem/J2DGraph/J2DMatBlock.cpp104
-rw-r--r--src/JSystem/J2DGraph/J2DMaterialFactory.cpp24
-rw-r--r--src/JSystem/J2DGraph/J2DPictureEx.cpp21
-rw-r--r--src/JSystem/J2DGraph/J2DWindowEx.cpp6
4 files changed, 88 insertions, 67 deletions
diff --git a/src/JSystem/J2DGraph/J2DMatBlock.cpp b/src/JSystem/J2DGraph/J2DMatBlock.cpp
index 7bde04491d..723e5b9dd7 100644
--- a/src/JSystem/J2DGraph/J2DMatBlock.cpp
+++ b/src/JSystem/J2DGraph/J2DMatBlock.cpp
@@ -33,7 +33,8 @@ void J2DColorBlock::setGX() {
GXSetNumChans(mColorChanNum);
const GXChannelID mapping[4] = {GX_COLOR0, GX_ALPHA0, GX_COLOR1, GX_ALPHA1};
for (int i = 0; i < mColorChanNum << 1; i++) {
- GXSetChanCtrl(mapping[i], GX_DISABLE, GX_SRC_REG, (GXColorSrc)mColorChan[i].getMatSrc(), GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
+ GXColorSrc mat_src = (GXColorSrc)mColorChan[i].getMatSrc();
+ GXSetChanCtrl(mapping[i], GX_DISABLE, GX_SRC_REG, mat_src, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
}
GXSetCullMode((GXCullMode)mCullMode);
}
@@ -55,6 +56,7 @@ void J2DTexGenBlock::setGX() {
for (int i = 0; i < mTexGenNum; i++) {
GXSetTexCoordGen((GXTexCoordID)i, (GXTexGenType)mTexGenCoord[i].getTexGenType(), (GXTexGenSrc)mTexGenCoord[i].getTexGenSrc(), mTexGenCoord[i].getTexGenMtx());
}
+
for (u8 i = 0; i < 8; i++) {
if (mTexMtx[i]) {
mTexMtx[i]->load(i);
@@ -65,14 +67,14 @@ void J2DTexGenBlock::setGX() {
/* 802EB620-802EB6A4 2E5F60 0084+00 1/0 1/1 0/0 .text __dt__14J2DTexGenBlockFv */
J2DTexGenBlock::~J2DTexGenBlock() {
for (int i = 0; i < 8; i++) {
- if (mTexMtx[i] != NULL) {
- delete mTexMtx[i];
- }
+ delete mTexMtx[i];
}
}
/* 802EB6A4-802EB7E0 2E5FE4 013C+00 0/0 3/3 0/0 .text setTexMtx__14J2DTexGenBlockFUlR9J2DTexMtx */
void J2DTexGenBlock::setTexMtx(u32 param_0, J2DTexMtx& param_1) {
+ J3D_PANIC(103, param_0 < 8, "Error : range over.");
+
if (!mTexMtx[param_0]) {
mTexMtx[param_0] = new J2DTexMtx(param_1.getTexMtxInfo());
if (!mTexMtx[param_0]) {
@@ -86,8 +88,11 @@ void J2DTexGenBlock::setTexMtx(u32 param_0, J2DTexMtx& param_1) {
/* 802EB7E0-802EB87C 2E6120 009C+00 0/0 1/1 0/0 .text getTexMtx__14J2DTexGenBlockFUlR9J2DTexMtx */
void J2DTexGenBlock::getTexMtx(u32 param_0, J2DTexMtx& param_1) {
+ J3D_PANIC(123, param_0 < 8, "Error : range over.");
+
if (mTexMtx[param_0]) {
- param_1.setTexMtxInfo(mTexMtx[param_0]->getTexMtxInfo());
+ J2DTexMtxInfo& texMtxInfo = mTexMtx[param_0]->getTexMtxInfo();
+ param_1.setTexMtxInfo(texMtxInfo);
}
}
@@ -143,9 +148,9 @@ void J2DTevBlock1::initialize() {
mFont = NULL;
}
-/* 802EBC0C-802EBCC0 2E654C 00B4+00 1/0 0/0 0/0 .text prepareTexture__12J2DTevBlock1FUc
- */
+/* 802EBC0C-802EBCC0 2E654C 00B4+00 1/0 0/0 0/0 .text prepareTexture__12J2DTevBlock1FUc */
bool J2DTevBlock1::prepareTexture(u8 param_0) {
+ bool rv;
if (param_0 == 0) {
return true;
}
@@ -159,11 +164,16 @@ bool J2DTevBlock1::prepareTexture(u8 param_0) {
mUndeleteFlag = (mUndeleteFlag & 0x80) | 1;
}
- return param_0 <= 1;
+ if (param_0 > 1) {
+ rv = false;
+ } else {
+ rv = true;
+ }
+
+ return rv;
}
-/* 802EBCC0-802EBDE4 2E6600 0124+00 1/0 0/0 0/0 .text
- * insertTexture__12J2DTevBlock1FUlPC7ResTIMGP10JUTPalette */
+/* 802EBCC0-802EBDE4 2E6600 0124+00 1/0 0/0 0/0 .text insertTexture__12J2DTevBlock1FUlPC7ResTIMGP10JUTPalette */
bool J2DTevBlock1::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette* p_tlut) {
if (param_0 != 0 || p_timg == NULL) {
return false;
@@ -195,8 +205,7 @@ bool J2DTevBlock1::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
return true;
}
-/* 802EBDE4-802EBE8C 2E6724 00A8+00 1/0 0/0 0/0 .text
- * insertTexture__12J2DTevBlock1FUlP10JUTTexture */
+/* 802EBDE4-802EBE8C 2E6724 00A8+00 1/0 0/0 0/0 .text insertTexture__12J2DTevBlock1FUlP10JUTTexture */
bool J2DTevBlock1::insertTexture(u32 param_0, JUTTexture* p_tex) {
if (mTexture[0] != NULL && mTexture[0]->getTexInfo() != NULL) {
return false;
@@ -217,7 +226,7 @@ bool J2DTevBlock1::insertTexture(u32 param_0, JUTTexture* p_tex) {
return true;
}
-/* 802EBE8C-802EC01C 2E67CC 0190+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock1FUlPC7ResTIMG */
+/* 802EBE8C-802EC01C 2E67CC 0190+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock1FUlPC7ResTIMG */
bool J2DTevBlock1::setTexture(u32 param_0, ResTIMG const* p_timg) {
if (param_0 != 0) {
return false;
@@ -263,8 +272,7 @@ bool J2DTevBlock1::setTexture(u32 param_0, ResTIMG const* p_timg) {
return true;
}
-/* 802EC01C-802EC0A8 2E695C 008C+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock1FUlP10JUTTexture
- */
+/* 802EC01C-802EC0A8 2E695C 008C+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock1FUlP10JUTTexture */
bool J2DTevBlock1::setTexture(u32 param_0, JUTTexture* p_tex) {
if (param_0 != 0) {
return false;
@@ -299,8 +307,7 @@ bool J2DTevBlock1::removeTexture(u32 param_0) {
return true;
}
-/* 802EC124-802EC1D8 2E6A64 00B4+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock1FP7ResFONT
- */
+/* 802EC124-802EC1D8 2E6A64 00B4+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock1FP7ResFONT */
bool J2DTevBlock1::setFont(ResFONT* p_font) {
if (p_font == NULL) {
return false;
@@ -320,8 +327,7 @@ bool J2DTevBlock1::setFont(ResFONT* p_font) {
return true;
}
-/* 802EC1D8-802EC258 2E6B18 0080+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock1FP7JUTFont
- */
+/* 802EC1D8-802EC258 2E6B18 0080+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock1FP7JUTFont */
bool J2DTevBlock1::setFont(JUTFont* p_font) {
if (p_font == NULL) {
return false;
@@ -336,7 +342,7 @@ bool J2DTevBlock1::setFont(JUTFont* p_font) {
return true;
}
-/* 802EC258-802EC318 2E6B98 00C0+00 1/0 0/0 0/0 .text setPalette__12J2DTevBlock1FUlPC7ResTLUT */
+/* 802EC258-802EC318 2E6B98 00C0+00 1/0 0/0 0/0 .text setPalette__12J2DTevBlock1FUlPC7ResTLUT */
bool J2DTevBlock1::setPalette(u32 param_0, ResTLUT const* p_tlut) {
if (param_0 != 0) {
return false;
@@ -364,8 +370,7 @@ bool J2DTevBlock1::setPalette(u32 param_0, ResTLUT const* p_tlut) {
return true;
}
-/* 802EC318-802EC328 2E6C58 0010+00 1/0 0/0 0/0 .text shiftDeleteFlag__12J2DTevBlock1FUcb
- */
+/* 802EC318-802EC328 2E6C58 0010+00 1/0 0/0 0/0 .text shiftDeleteFlag__12J2DTevBlock1FUcb */
void J2DTevBlock1::shiftDeleteFlag(u8, bool) {
mUndeleteFlag &= 0x80;
}
@@ -373,7 +378,7 @@ void J2DTevBlock1::shiftDeleteFlag(u8, bool) {
/* 802EC328-802EC570 2E6C68 0248+00 1/0 0/0 0/0 .text setGX__12J2DTevBlock1Fv */
void J2DTevBlock1::setGX() {
loadTexture(GX_TEXMAP0, 0);
- GXSetTevOrder(GX_TEVSTAGE0, mTevOrder[0].getTexCoord(), mTevOrder[0].getTexMap(), mTevOrder[0].getColor());
+ GXSetTevOrder(GX_TEVSTAGE0, (GXTexCoordID)mTevOrder[0].getTexCoord(), (GXTexMapID)mTevOrder[0].getTexMap(), (GXChannelID)mTevOrder[0].getColor());
for (int i = 0; i < 4; i++) {
GXSetTevColorS10(i != 3 ? GXTevRegID(i + 1) : GX_TEVPREV, mTevColor[i]);
@@ -409,8 +414,7 @@ void J2DTevBlock1::setGX() {
mIndTevStage->load(0);
}
-/* 802EC570-802EC5B8 2E6EB0 0048+00 1/0 0/0 0/0 .text loadTexture__12J2DTevBlock1F11_GXTexMapIDUl
- */
+/* 802EC570-802EC5B8 2E6EB0 0048+00 1/0 0/0 0/0 .text loadTexture__12J2DTevBlock1F11_GXTexMapIDUl */
void J2DTevBlock1::loadTexture(GXTexMapID texmapID, u32 texIndex) {
if (texIndex == 0 && mTexture[texIndex] != NULL && mTexture[texIndex]->getTexInfo() != NULL) {
mTexture[texIndex]->load(texmapID);
@@ -494,8 +498,7 @@ bool J2DTevBlock2::prepareTexture(u8 param_0) {
return true;
}
-/* 802ECAE8-802ECDE8 2E7428 0300+00 1/0 0/0 0/0 .text
- * insertTexture__12J2DTevBlock2FUlPC7ResTIMGP10JUTPalette */
+/* 802ECAE8-802ECDE8 2E7428 0300+00 1/0 0/0 0/0 .text insertTexture__12J2DTevBlock2FUlPC7ResTIMGP10JUTPalette */
bool J2DTevBlock2::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette* p_tlut) {
if (param_0 >= 2 || p_timg == NULL) {
return false;
@@ -583,8 +586,7 @@ bool J2DTevBlock2::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
return true;
}
-/* 802ECDE8-802ECF48 2E7728 0160+00 1/0 0/0 0/0 .text
- * insertTexture__12J2DTevBlock2FUlP10JUTTexture */
+/* 802ECDE8-802ECF48 2E7728 0160+00 1/0 0/0 0/0 .text insertTexture__12J2DTevBlock2FUlP10JUTTexture */
bool J2DTevBlock2::insertTexture(u32 param_0, JUTTexture* p_tex) {
if (param_0 >= 2 || p_tex == NULL) {
return false;
@@ -627,7 +629,7 @@ bool J2DTevBlock2::insertTexture(u32 param_0, JUTTexture* p_tex) {
return true;
}
-/* 802ECF48-802ED16C 2E7888 0224+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock2FUlPC7ResTIMG */
+/* 802ECF48-802ED16C 2E7888 0224+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock2FUlPC7ResTIMG */
bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) {
if (param_0 >= 2) {
return false;
@@ -635,10 +637,11 @@ bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) {
u8 tlutid = 0;
if (p_timg != NULL && p_timg->indexTexture) {
- if (mTexture[param_0 == 0] != NULL) {
- const ResTIMG* timg = mTexture[param_0 == 0]->getTexInfo();
+ u8 idx = param_0 == 0 ? 1 : 0;
+ if (mTexture[idx] != NULL) {
+ const ResTIMG* timg = mTexture[idx]->getTexInfo();
if (timg != NULL && timg->indexTexture) {
- int tlutname = mTexture[param_0 == 0]->getTlutName();
+ int tlutname = mTexture[idx]->getTlutName();
u8 tlut_no = tlutname - (tlutname >= GX_BIGTLUT0 ? GX_BIGTLUT0 : GX_TLUT0);
if (tlut_no == 0) {
@@ -688,8 +691,7 @@ bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) {
return true;
}
-/* 802ED16C-802ED21C 2E7AAC 00B0+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock2FUlP10JUTTexture
- */
+/* 802ED16C-802ED21C 2E7AAC 00B0+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock2FUlP10JUTTexture */
bool J2DTevBlock2::setTexture(u32 param_0, JUTTexture* p_tex) {
if (param_0 >= 2) {
return false;
@@ -731,8 +733,7 @@ bool J2DTevBlock2::removeTexture(u32 param_0) {
return true;
}
-/* 802ED2F0-802ED3A4 2E7C30 00B4+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock2FP7ResFONT
- */
+/* 802ED2F0-802ED3A4 2E7C30 00B4+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock2FP7ResFONT */
bool J2DTevBlock2::setFont(ResFONT* p_font) {
if (p_font == NULL) {
return false;
@@ -752,8 +753,7 @@ bool J2DTevBlock2::setFont(ResFONT* p_font) {
return true;
}
-/* 802ED3A4-802ED424 2E7CE4 0080+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock2FP7JUTFont
- */
+/* 802ED3A4-802ED424 2E7CE4 0080+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock2FP7JUTFont */
bool J2DTevBlock2::setFont(JUTFont* p_font) {
if (p_font == NULL) {
return false;
@@ -768,7 +768,7 @@ bool J2DTevBlock2::setFont(JUTFont* p_font) {
return true;
}
-/* 802ED424-802ED4FC 2E7D64 00D8+00 1/0 0/0 0/0 .text setPalette__12J2DTevBlock2FUlPC7ResTLUT */
+/* 802ED424-802ED4FC 2E7D64 00D8+00 1/0 0/0 0/0 .text setPalette__12J2DTevBlock2FUlPC7ResTLUT */
bool J2DTevBlock2::setPalette(u32 param_0, ResTLUT const* p_tlut) {
if (param_0 >= 2) {
return false;
@@ -796,8 +796,7 @@ bool J2DTevBlock2::setPalette(u32 param_0, ResTLUT const* p_tlut) {
return true;
}
-/* 802ED4FC-802ED584 2E7E3C 0088+00 1/0 0/0 0/0 .text shiftDeleteFlag__12J2DTevBlock2FUcb
- */
+/* 802ED4FC-802ED584 2E7E3C 0088+00 1/0 0/0 0/0 .text shiftDeleteFlag__12J2DTevBlock2FUcb */
void J2DTevBlock2::shiftDeleteFlag(u8 param_0, bool param_1) {
u8 tmpFlags = mUndeleteFlag & 0x80;
mUndeleteFlag = mUndeleteFlag & 0x7F;
@@ -808,7 +807,7 @@ void J2DTevBlock2::shiftDeleteFlag(u8 param_0, bool param_1) {
mUndeleteFlag = (mUndeleteFlag & ((1 << param_0) - 1)) | ((mUndeleteFlag & ~((1 << (param_0 + 1)) - 1)) >> 1);
}
- mUndeleteFlag |= tmpFlags;
+ mUndeleteFlag = (mUndeleteFlag | tmpFlags) & 0xFF;
}
/* 802ED584-802ED874 2E7EC4 02F0+00 1/0 0/0 0/0 .text setGX__12J2DTevBlock2Fv */
@@ -816,12 +815,15 @@ void J2DTevBlock2::setGX() {
for (int i = 0; i < 2; i++) {
loadTexture(GXTexMapID(i), i);
}
+
for (int i = 0; i < mTevStageNum; i++) {
- GXSetTevOrder(GXTevStageID(i), mTevOrder[i].getTexCoord(), mTevOrder[i].getTexMap(), mTevOrder[i].getColor());
+ GXSetTevOrder(GXTevStageID(i), (GXTexCoordID)mTevOrder[i].getTexCoord(), (GXTexMapID)mTevOrder[i].getTexMap(), (GXChannelID)mTevOrder[i].getColor());
}
+
for (int i = 0; i < 4; i++) {
GXSetTevColorS10(i != 3 ? GXTevRegID(i + 1) : GX_TEVPREV, mTevColor[i]);
}
+
GXSetNumTevStages(mTevStageNum);
for (int i = 0; i < mTevStageNum; i++) {
GXSetTevColorIn(GXTevStageID(i), GXTevColorArg(mTevStage[i].getColorA()),
@@ -841,25 +843,28 @@ void J2DTevBlock2::setGX() {
GXSetTevKColorSel(GXTevStageID(i), mTevKColorSel[i] != 0xff ? GXTevKColorSel(mTevKColorSel[i]) : GX_TEV_KCSEL_1);
GXSetTevKAlphaSel(GXTevStageID(i), mTevKAlphaSel[i] != 0xff ? GXTevKAlphaSel(mTevKAlphaSel[i]) : GX_TEV_KASEL_1);
}
+
for (int i = 0; i < 4; i++) {
GXSetTevKColor(GXTevKColorID(i), mTevKColor[i]);
}
+
for (int i = 0; i < mTevStageNum; i++) {
GXSetTevSwapMode(GXTevStageID(i), GXTevSwapSel(mTevStage[i].getRasSel()), GXTevSwapSel(mTevStage[i].getTexSel()));
}
+
for (int i = 0; i < 4; i++) {
GXSetTevSwapModeTable(GXTevSwapSel(i), GXTevColorChan(mTevSwapModeTable[i].getR()),
GXTevColorChan(mTevSwapModeTable[i].getG()),
GXTevColorChan(mTevSwapModeTable[i].getB()),
GXTevColorChan(mTevSwapModeTable[i].getA()));
}
+
for (u8 i = 0; i < mTevStageNum; i++) {
mIndTevStage[i].load(i);
}
}
-/* 802ED874-802ED8BC 2E81B4 0048+00 1/0 0/0 0/0 .text loadTexture__12J2DTevBlock2F11_GXTexMapIDUl
- */
+/* 802ED874-802ED8BC 2E81B4 0048+00 1/0 0/0 0/0 .text loadTexture__12J2DTevBlock2F11_GXTexMapIDUl */
void J2DTevBlock2::loadTexture(GXTexMapID texmapID, u32 texIndex) {
if (texIndex < 2 && mTexture[texIndex] != NULL && mTexture[texIndex]->getTexInfo() != NULL) {
mTexture[texIndex]->load(texmapID);
@@ -1284,7 +1289,7 @@ void J2DTevBlock4::setGX() {
loadTexture(GXTexMapID(i), i);
}
for (int i = 0; i < mTevStageNum; i++) {
- GXSetTevOrder(GXTevStageID(i), mTevOrder[i].getTexCoord(), mTevOrder[i].getTexMap(), mTevOrder[i].getColor());
+ GXSetTevOrder(GXTevStageID(i), (GXTexCoordID)mTevOrder[i].getTexCoord(), (GXTexMapID)mTevOrder[i].getTexMap(), (GXChannelID)mTevOrder[i].getColor());
}
for (int i = 0; i < 4; i++) {
GXSetTevColorS10(i != 3 ? GXTevRegID(i + 1) : GX_TEVPREV, mTevColor[i]);
@@ -1747,7 +1752,7 @@ void J2DTevBlock8::setGX() {
loadTexture(GXTexMapID(i), i);
}
for (int i = 0; i < mTevStageNum; i++) {
- GXSetTevOrder(GXTevStageID(i), mTevOrder[i].getTexCoord(), mTevOrder[i].getTexMap(), mTevOrder[i].getColor());
+ GXSetTevOrder(GXTevStageID(i), (GXTexCoordID)mTevOrder[i].getTexCoord(), (GXTexMapID)mTevOrder[i].getTexMap(), (GXChannelID)mTevOrder[i].getColor());
}
for (int i = 0; i < 4; i++) {
GXSetTevColorS10(i != 3 ? GXTevRegID(i + 1) : GX_TEVPREV, mTevColor[i]);
@@ -1823,7 +1828,6 @@ J2DTevBlock16::~J2DTevBlock16() {
/* 802F03EC-802F0660 2EAD2C 0274+00 1/0 0/0 0/0 .text initialize__13J2DTevBlock16Fv */
// NONMATCHING - inlines
void J2DTevBlock16::initialize() {
-
for (int i = 0; i < 8; i++) {
mTexNo[i] = 0xffff;
}
@@ -2211,7 +2215,7 @@ void J2DTevBlock16::setGX() {
loadTexture(GXTexMapID(i), i);
}
for (int i = 0; i < mTevStageNum; i++) {
- GXSetTevOrder(GXTevStageID(i), mTevOrder[i].getTexCoord(), mTevOrder[i].getTexMap(), mTevOrder[i].getColor());
+ GXSetTevOrder(GXTevStageID(i), (GXTexCoordID)mTevOrder[i].getTexCoord(), (GXTexMapID)mTevOrder[i].getTexMap(), (GXChannelID)mTevOrder[i].getColor());
}
for (int i = 0; i < 4; i++) {
GXSetTevColorS10(i != 3 ? GXTevRegID(i + 1) : GX_TEVPREV, mTevColor[i]);
diff --git a/src/JSystem/J2DGraph/J2DMaterialFactory.cpp b/src/JSystem/J2DGraph/J2DMaterialFactory.cpp
index c10f431247..2e2e836041 100644
--- a/src/JSystem/J2DGraph/J2DMaterialFactory.cpp
+++ b/src/JSystem/J2DGraph/J2DMaterialFactory.cpp
@@ -290,24 +290,32 @@ J2DTevOrder J2DMaterialFactory::newTevOrder(int param_0, int param_1) const {
return J2DTevOrder();
}
-/* 802F3A1C-802F3AB4 2EE35C 0098+00 1/1 0/0 0/0 .text newTevColor__18J2DMaterialFactoryCFii */
-// NONMATCHING - J2DGXColorS10 init issues
+/* 802F3A1C-802F3AB4 2EE35C 0098+00 1/1 0/0 0/0 .text newTevColor__18J2DMaterialFactoryCFii */
J2DGXColorS10 J2DMaterialFactory::newTevColor(int param_0, int param_1) const {
+ // FAKEMATCH
+ #if DEBUG || VERSION == VERSION_WII_USA_R0 || VERSION == VERSION_WII_USA_R2
GXColorS10 color = {0, 0, 0, 0};
- J2DGXColorS10 rv = J2DGXColorS10(color);
+ J2DGXColorS10 rv = color;
+ #else
+ GXColorS10 color = {0, 0, 0, 0};
+ J2DGXColorS10 rv;
+ rv.r = color.r;
+ rv.g = color.g;
+ rv.b = color.b;
+ rv.a = color.a;
+ #endif
J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]];
+
if (iVar2->field_0x92[param_1] != 0xffff) {
return field_0x38[iVar2->field_0x92[param_1]];
}
+
return rv;
}
-/* ############################################################################################## */
-
-/* 802F3AB4-802F3B54 2EE3F4 00A0+00 1/1 0/0 0/0 .text newTevKColor__18J2DMaterialFactoryCFii */
+/* 802F3AB4-802F3B54 2EE3F4 00A0+00 1/1 0/0 0/0 .text newTevKColor__18J2DMaterialFactoryCFii */
JUtility::TColor J2DMaterialFactory::newTevKColor(int param_0, int param_1) const {
- GXColor x = {0xFF, 0xFF, 0xFF, 0xFF};
- JUtility::TColor local_20 = GXColor(x);
+ JUtility::TColor local_20 = (GXColor){0xFF, 0xFF, 0xFF, 0xFF};
J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]];
if (iVar2->field_0x4a[param_1] != 0xffff) {
return field_0x3c[iVar2->field_0x4a[param_1]];
diff --git a/src/JSystem/J2DGraph/J2DPictureEx.cpp b/src/JSystem/J2DGraph/J2DPictureEx.cpp
index 23c3edb37d..9d2d52a9fb 100644
--- a/src/JSystem/J2DGraph/J2DPictureEx.cpp
+++ b/src/JSystem/J2DGraph/J2DPictureEx.cpp
@@ -1054,8 +1054,8 @@ bool J2DPictureEx::setBlackWhite(JUtility::TColor param_0, JUtility::TColor para
/* 80306664-80306824 300FA4 01C0+00 4/4 0/0 0/0 .text
* getBlackWhite__12J2DPictureExCFPQ28JUtility6TColorPQ28JUtility6TColor */
-// NONMATCHING regswap
bool J2DPictureEx::getBlackWhite(JUtility::TColor* black, JUtility::TColor* white) const {
+ // FAKEMATCH
if (mMaterial == NULL) {
return false;
}
@@ -1077,8 +1077,14 @@ bool J2DPictureEx::getBlackWhite(JUtility::TColor* black, JUtility::TColor* whit
*white = 0xffffffff;
if (bVar1) {
+ #if DEBUG || VERSION == VERSION_WII_USA_R0 || VERSION == VERSION_WII_USA_R2
J2DGXColorS10 tevColor0 = *mMaterial->getTevBlock()->getTevColor(0);
J2DGXColorS10 tevColor1 = *mMaterial->getTevBlock()->getTevColor(1);
+ #else
+ J2DGXColorS10 tevColor0, tevColor1;
+ tevColor0 = *mMaterial->getTevBlock()->getTevColor(0);
+ tevColor1 = *mMaterial->getTevBlock()->getTevColor(1);
+ #endif
*black = (u8)tevColor0.r << 24 | (u8)tevColor0.g << 16 | (u8)tevColor0.b << 8 | (u8)tevColor0.a;
*white = (u8)tevColor1.r << 24 | (u8)tevColor1.g << 16 | (u8)tevColor1.b << 8 | (u8)tevColor1.a;
}
@@ -1207,7 +1213,6 @@ void J2DPictureEx::setAnimation(J2DAnmVisibilityFull* anm) {
/* 80306B7C-80306C70 3014BC 00F4+00 1/0 0/0 0/0 .text
* setAnimation__12J2DPictureExFP14J2DAnmVtxColor */
-// NONMATCHING regswap
void J2DPictureEx::setAnimation(J2DAnmVtxColor* anm) {
field_0x198 = anm;
field_0x19c = 0;
@@ -1215,12 +1220,18 @@ void J2DPictureEx::setAnimation(J2DAnmVtxColor* anm) {
if (anm != NULL) {
u16 anm_table_num = anm->getAnmTableNum(0);
for (u8 i = 0; i < 4; i++) {
- if (field_0x158[i] != 0xffff) {
+ if (field_0x158[i] != 0xFFFF) {
for (u16 j = 0; j < anm_table_num; j++) {
+ #if DEBUG
J3DAnmVtxColorIndexData* data = anm->getAnmVtxColorIndexData(0, j);
- u16* index = anm->getVtxColorIndexPointer(0) + (uintptr_t)data->mpData;
+ u16* index2 = anm->getVtxColorIndexPointer(0) + (uintptr_t)data->mpData;
+ #else
+ J3DAnmVtxColorIndexData* data = anm->getAnmVtxColorIndexData(0, j);
+ u16* index = anm->getVtxColorIndexPointer(0);
+ u16* index2 = index + (uintptr_t)data->mpData;
+ #endif
for (u16 k = 0; k < data->mNum; k++) {
- if (index[k] == field_0x158[i]) {
+ if (index2[k] == field_0x158[i]) {
field_0x198 = anm;
field_0x19c |= 1 << i;
goto next;
diff --git a/src/JSystem/J2DGraph/J2DWindowEx.cpp b/src/JSystem/J2DGraph/J2DWindowEx.cpp
index d052b84ba5..42b103047e 100644
--- a/src/JSystem/J2DGraph/J2DWindowEx.cpp
+++ b/src/JSystem/J2DGraph/J2DWindowEx.cpp
@@ -666,8 +666,7 @@ bool J2DWindowEx::setBlackWhite(JUtility::TColor black, JUtility::TColor white)
setTevOrder(bVar1);
setTevStage(bVar1);
if (bVar1) {
- J2DGXColorS10 color0;
- J2DGXColorS10 color1;
+ J2DGXColorS10 color0, color1;
color0.r = black.r;
color0.g = black.g;
color0.b = black.b;
@@ -685,8 +684,7 @@ bool J2DWindowEx::setBlackWhite(JUtility::TColor black, JUtility::TColor white)
return true;
}
-/* 80302A4C-80302BE8 2FD38C 019C+00 4/4 0/0 0/0 .text
- * getBlackWhite__11J2DWindowExCFPQ28JUtility6TColorPQ28JUtility6TColor */
+/* 80302A4C-80302BE8 2FD38C 019C+00 4/4 0/0 0/0 .text getBlackWhite__11J2DWindowExCFPQ28JUtility6TColorPQ28JUtility6TColor */
bool J2DWindowEx::getBlackWhite(JUtility::TColor* param_0, JUtility::TColor* param_1) const {
if (mFrameMaterial[0] == NULL) {
return false;