Small matches/improvements (#2844)

* j2dmatblock debug work

* J2DMaterialFactory matching

* J2DPictureEx matching

* tiny work

* fixed regressions

* PR cleanup

* build error fix
This commit is contained in:
Carco_21 2025-11-25 11:34:19 -05:00 committed by GitHub
parent 2f2f37a734
commit 9e232b61fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 134 additions and 107 deletions

View File

@ -1141,7 +1141,7 @@ config.libs = [
Object(MatchingFor(ALL_GCN), "JSystem/J2DGraph/J2DTevs.cpp"),
Object(Equivalent, "JSystem/J2DGraph/J2DMaterial.cpp"), # weak func order
Object(NonMatching, "JSystem/J2DGraph/J2DMatBlock.cpp"),
Object(NonMatching, "JSystem/J2DGraph/J2DMaterialFactory.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/J2DGraph/J2DMaterialFactory.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/J2DGraph/J2DPrint.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/J2DGraph/J2DPane.cpp"),
Object(NonMatching, "JSystem/J2DGraph/J2DScreen.cpp"),
@ -1149,7 +1149,7 @@ config.libs = [
Object(MatchingFor(ALL_GCN), "JSystem/J2DGraph/J2DPicture.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/J2DGraph/J2DTextBox.cpp"),
Object(NonMatching, "JSystem/J2DGraph/J2DWindowEx.cpp"),
Object(NonMatching, "JSystem/J2DGraph/J2DPictureEx.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/J2DGraph/J2DPictureEx.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/J2DGraph/J2DTextBoxEx.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/J2DGraph/J2DAnmLoader.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/J2DGraph/J2DAnimation.cpp"),

View File

@ -53,6 +53,7 @@ extern J2DTexMtxInfo const j2dDefaultTexMtxInfo;
class J2DTexMtx {
public:
J2DTexMtx() { mInfo = j2dDefaultTexMtxInfo; }
~J2DTexMtx() {}
J2DTexMtx(const J2DTexMtxInfo& info) { mInfo = info; }
/* 802E9C90 */ void load(u32);
/* 802E9CC4 */ void calc();
@ -287,9 +288,9 @@ public:
}
void setTexCoordInfo(const J2DTexCoordInfo& info) { mTexCoordInfo = info; }
void setTexGenMtx(u8 texGenMtx) { mTexCoordInfo.mTexGenMtx = texGenMtx; }
s32 getTexGenType() { return mTexCoordInfo.mTexGenType; }
s32 getTexGenSrc() { return mTexCoordInfo.mTexGenSrc; }
s32 getTexGenMtx() { return mTexCoordInfo.mTexGenMtx; }
u8 getTexGenType() const { return mTexCoordInfo.mTexGenType; }
u8 getTexGenSrc() const { return mTexCoordInfo.mTexGenSrc; }
u8 getTexGenMtx() const { return mTexCoordInfo.mTexGenMtx; }
private:
/* 0x0 */ J2DTexCoordInfo mTexCoordInfo;
@ -330,9 +331,9 @@ public:
}
void setTevOrderInfo(const J2DTevOrderInfo& info) {mTevOrderInfo = info; }
GXChannelID getColor() const { return (GXChannelID)mTevOrderInfo.mColor; }
GXTexMapID getTexMap() const { return (GXTexMapID)mTevOrderInfo.mTexMap; }
GXTexCoordID getTexCoord() const { return (GXTexCoordID)mTevOrderInfo.mTexCoord; }
u8 getColor() const { return mTevOrderInfo.mColor; }
u8 getTexMap() const { return mTevOrderInfo.mTexMap; }
u8 getTexCoord() const { return mTevOrderInfo.mTexCoord; }
/* 0x0 */ J2DTevOrderInfo mTevOrderInfo;
};
@ -461,36 +462,36 @@ public:
field_0x5 = field_0x5 & ~0xc0 | reg << 6;
}
u8 getColorA() { return (field_0x2 & 0xf0) >> 4; }
u8 getColorB() { return field_0x2 & 0x0f; }
u8 getColorC() { return (field_0x3 & 0xf0) >> 4; }
u8 getColorD() { return field_0x3 & 0x0f; }
u8 getAlphaA() { return (field_0x6 & 0xe0) >> 5; }
u8 getAlphaB() { return (field_0x6 & 0x1c) >> 2; }
u8 getAlphaC() { return (field_0x6 & 0x03) << 1 | (field_0x7 & 0x80) >> 7; }
u8 getAlphaD() { return (field_0x7 & 0x70) >> 4; }
u8 getCOp() {
u8 getColorA() const { return (field_0x2 & 0xf0) >> 4; }
u8 getColorB() const { return field_0x2 & 0x0f; }
u8 getColorC() const { return (field_0x3 & 0xf0) >> 4; }
u8 getColorD() const { return field_0x3 & 0x0f; }
u8 getAlphaA() const { return (field_0x6 & 0xe0) >> 5; }
u8 getAlphaB() const { return (field_0x6 & 0x1c) >> 2; }
u8 getAlphaC() const { return (field_0x6 & 0x03) << 1 | (field_0x7 & 0x80) >> 7; }
u8 getAlphaD() const { return (field_0x7 & 0x70) >> 4; }
u8 getCOp() const {
if (getCBias() != 3) {
return (field_0x1 & 4) >> 2;
}
return ((field_0x1 & 4) >> 2) + 8 + ((field_0x1 & 0x30) >> 3);
}
u8 getCBias() { return field_0x1 & 0x03; }
u8 getCScale() { return (field_0x1 & 0x30) >> 4; }
u8 getCClamp() { return (field_0x1 & 0x08) >> 3; }
u8 getCReg() { return (field_0x1 & 0xc0) >> 6; }
u8 getAOp() {
u8 getCBias() const { return field_0x1 & 0x03; }
u8 getCScale() const { return (field_0x1 & 0x30) >> 4; }
u8 getCClamp() const { return (field_0x1 & 0x08) >> 3; }
u8 getCReg() const { return (field_0x1 & 0xc0) >> 6; }
u8 getAOp() const {
if (getABias() != 3) {
return (field_0x5 & 4) >> 2;
}
return ((field_0x5 & 4) >> 2) + 8 + ((field_0x5 & 0x30) >> 3);
}
u8 getABias() { return field_0x5 & 0x03; }
u8 getAScale() { return (field_0x5 & 0x30) >> 4; }
u8 getAClamp() { return (field_0x5 & 0x08) >> 3; }
u8 getAReg() { return (field_0x5 & 0xc0) >> 6; }
u8 getRasSel() { return field_0x7 & 3; }
u8 getTexSel() { return (field_0x7 & 0x0c) >> 2; }
u8 getABias() const { return field_0x5 & 0x03; }
u8 getAScale() const { return (field_0x5 & 0x30) >> 4; }
u8 getAClamp() const { return (field_0x5 & 0x08) >> 3; }
u8 getAReg() const { return (field_0x5 & 0xc0) >> 6; }
u8 getRasSel() const { return field_0x7 & 3; }
u8 getTexSel() const { return (field_0x7 & 0x0c) >> 2; }
void operator=(J2DTevStage const& other) {
field_0x1 = other.field_0x1;
@ -533,7 +534,8 @@ extern const u8 data_804561AC;
/**
* @ingroup jsystem-j2d
*
*/
*/
class J2DTevSwapModeTable {
public:
/* 802F1934 */ J2DTevSwapModeTable() { field_0x0 = data_804561AC; }
@ -544,10 +546,10 @@ public:
void setTevSwapModeTableInfo(const J2DTevSwapModeTableInfo& info) {
field_0x0 = J2DCalcTevSwapTable(info.field_0x0, info.field_0x1, info.field_0x2, info.field_0x3);
}
u8 getR() { return field_0x0 >> 6 & 3; }
u8 getG() { return field_0x0 >> 4 & 3; }
u8 getB() { return field_0x0 >> 2 & 3; }
u8 getA() { return field_0x0 & 3; }
u8 getR() const { return field_0x0 >> 6 & 3; }
u8 getG() const { return field_0x0 >> 4 & 3; }
u8 getB() const { return field_0x0 >> 2 & 3; }
u8 getA() const { return field_0x0 & 3; }
private:
/* 0x0 */ u8 field_0x0;
@ -584,7 +586,7 @@ public:
mColorChan = J2DCalcColorChanID(info.field_0x1);
}
u16 getMatSrc() const { return mColorChan & 1; }
u8 getMatSrc() const { return mColorChan & 1; }
private:
/* 0x0 */ u16 mColorChan;

View File

@ -77,7 +77,7 @@ public:
u8 getCaptureFlag() const { return mFlags & 1; }
u8 getEmbPaletteDelFlag() const { return mFlags & 2; }
void setEmbPaletteDelFlag(bool flag) { mFlags = (mFlags & 1) | (flag << 1);}
u8 getTlutName() const { return mTlutName; }
int getTlutName() const { return mTlutName; }
bool operator==(const JUTTexture& other) {
return mTexInfo == other.mTexInfo
&& field_0x2c == other.field_0x2c

View File

@ -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]);

View File

@ -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]];

View File

@ -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;

View File

@ -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;

View File

@ -401,7 +401,12 @@ void J3DSkinDeform::changeFastSkinDL(J3DModelData* pModelData) {
for (int local_4c = 0; local_4c < uVar9; local_4c++) {
u8* dst = &local_44[local_34 * local_4c];
memcpy(puVar10, dst + 1, local_34 - 1);
puVar10 = ((local_34 + puVar10) - 1);
// FAKEMATCH
#if DEBUG || VERSION == VERSION_WII_USA_R0 || VERSION == VERSION_WII_USA_R2
puVar10 += local_34 - 1;
#else
puVar10 = (local_34 + puVar10) - 1;
#endif
}
local_44 += local_34 * uVar9;
}

View File

@ -61,9 +61,9 @@ void JStudio_JStage::TAdaptor_light::adaptor_do_begin() {
adaptor_object_begin_();
JStage::TLight* pLightObj = get_pJSG_();
const JStudio::TObject* pObject = adaptor_getObject();
JUT_ASSERT(60, pObject != NULL);
JUT_ASSERT(60, pObject!=NULL);
const JStudio::TControl* pControl = pObject->getControl();
JUT_ASSERT(62, pControl != NULL);
JUT_ASSERT(62, pControl!=NULL);
GXColor lightColor = pLightObj->JSGGetColor();
adaptor_setVariableValue_GXColor(sauVariableValue_4_COLOR_RGBA, lightColor);
JStudio::TControl::TTransform_position_direction lightObjTransform;

View File

@ -35,8 +35,7 @@ void dNpcLib_lookat_c::init(J3DModel* i_mdl_p, int* param_1, csXyz* param_2, csX
/* 80251534-80251B60 24BE74 062C+00 0/0 0/0 2/2 .text
* action__16dNpcLib_lookat_cF4cXyz4cXyzP10fopAc_ac_cPA4_fi */
// NONMATCHING - regswap, equivalent
void dNpcLib_lookat_c::action(cXyz param_0, cXyz param_1, fopAc_ac_c* param_2, Mtx param_3,
int param_4) {
void dNpcLib_lookat_c::action(cXyz param_0, cXyz param_1, fopAc_ac_c* param_2, Mtx param_3, int param_4) {
cXyz sp90;
Mtx spA0;