diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2024-10-10 07:29:58 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-10 08:29:58 -0600 |
| commit | 12eb254d769d84743b5cc6cd5424057c57eaf0ad (patch) | |
| tree | 4509be332b2ccfc6fe939f47740d68f7746eca3e /src/JSystem/J2DGraph | |
| parent | 2fd702c0ac170a789af879b8b92a82d4dcc9080c (diff) | |
switch to dtk setup (#2203)
* switch to dtk setup
* some cleanup / fixes
* cleanup d_a_alink literals
* Restore doxygen, update CI & README.md (#1)
* Fix build image ref (#2)
---------
Co-authored-by: Luke Street <luke@street.dev>
Diffstat (limited to 'src/JSystem/J2DGraph')
| -rw-r--r-- | src/JSystem/J2DGraph/J2DAnimation.cpp | 908 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DAnmLoader.cpp | 526 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DAnmLoader_nonmatching.cpp | 550 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DGrafContext.cpp | 205 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DManage.cpp | 80 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DMatBlock.cpp | 3653 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DMaterial.cpp | 541 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DMaterialFactory.cpp | 522 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DOrthoGraph.cpp | 93 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DPane.cpp | 971 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DPicture.cpp | 1484 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DPictureEx.cpp | 1094 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DPrint.cpp | 600 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DScreen.cpp | 705 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DTevs.cpp | 239 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DTextBox.cpp | 491 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DTextBoxEx.cpp | 598 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DWindow.cpp | 679 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DWindowEx.cpp | 1323 |
19 files changed, 15262 insertions, 0 deletions
diff --git a/src/JSystem/J2DGraph/J2DAnimation.cpp b/src/JSystem/J2DGraph/J2DAnimation.cpp new file mode 100644 index 0000000000..ed02df123c --- /dev/null +++ b/src/JSystem/J2DGraph/J2DAnimation.cpp @@ -0,0 +1,908 @@ +#include "JSystem/J2DGraph/J2DAnimation.h" +#include "JSystem/J2DGraph/J2DScreen.h" +#include "JSystem/J3DGraphBase/J3DTexture.h" +#include "JSystem/JUtility/JUTPalette.h" +#include "JSystem/JUtility/JUTResource.h" +#include "dolphin/os.h" + +f32 J2DGetKeyFrameInterpolationf(f32 param_0, J3DAnmKeyTableBase* param_1, f32* param_2); +f32 J2DGetKeyFrameInterpolations(f32 param_0, J3DAnmKeyTableBase* param_1, s16* param_2); + +/* 8030A590-8030AAFC 304ED0 056C+00 1/0 0/0 0/0 .text + * getTransform__19J2DAnmTransformFullCFUsP16J3DTransformInfo */ +void J2DAnmTransformFull::getTransform(u16 param_0, J3DTransformInfo* transformInfo) const { + u16 idx = (param_0 * 3); + J3DAnmTransformFullTable* xPart = &mTableInfo[idx]; + J3DAnmTransformFullTable* yPart = &mTableInfo[idx + 1]; + J3DAnmTransformFullTable* zPart = &mTableInfo[idx + 2]; + u16 xMaxFrame = xPart->mScaleMaxFrame; + if (getFrame() < 0) { + transformInfo->mScale.x = mScaleValues[xPart->mScaleOffset]; + } else if (getFrame() >= xMaxFrame) { + transformInfo->mScale.x = mScaleValues[(xPart->mScaleOffset + (xMaxFrame - 1))]; + } else { + transformInfo->mScale.x = mScaleValues[(xPart->mScaleOffset + (int)getFrame())]; + } + u16 yMaxFrame = yPart->mScaleMaxFrame; + if (getFrame() < 0) { + transformInfo->mScale.y = mScaleValues[yPart->mScaleOffset]; + } else if (getFrame() >= yMaxFrame) { + transformInfo->mScale.y = mScaleValues[(yPart->mScaleOffset + (yMaxFrame - 1))]; + } else { + transformInfo->mScale.y = mScaleValues[(yPart->mScaleOffset + (int)getFrame())]; + } + u16 zMaxFrame = zPart->mScaleMaxFrame; + if (getFrame() < 0) { + transformInfo->mScale.z = mScaleValues[zPart->mScaleOffset]; + } else if (getFrame() >= zMaxFrame) { + transformInfo->mScale.z = mScaleValues[(zPart->mScaleOffset + (zMaxFrame - 1))]; + } else { + transformInfo->mScale.z = mScaleValues[(zPart->mScaleOffset + (int)getFrame())]; + } + xMaxFrame = xPart->mRotationMaxFrame; + if (getFrame() < 0) { + transformInfo->mRotation.x = mRotationValues[xPart->mRotationOffset]; + } else if (getFrame() >= xMaxFrame) { + transformInfo->mRotation.x = mRotationValues[(xPart->mRotationOffset + (xMaxFrame - 1))]; + } else { + transformInfo->mRotation.x = mRotationValues[(xPart->mRotationOffset + (int)getFrame())]; + } + yMaxFrame = yPart->mRotationMaxFrame; + if (getFrame() < 0) { + transformInfo->mRotation.y = mRotationValues[yPart->mRotationOffset]; + } else if (getFrame() >= yMaxFrame) { + transformInfo->mRotation.y = mRotationValues[(yPart->mRotationOffset + (yMaxFrame - 1))]; + } else { + transformInfo->mRotation.y = mRotationValues[(yPart->mRotationOffset + (int)getFrame())]; + } + zMaxFrame = zPart->mRotationMaxFrame; + if (getFrame() < 0) { + transformInfo->mRotation.z = mRotationValues[zPart->mRotationOffset]; + } else if (getFrame() >= zMaxFrame) { + transformInfo->mRotation.z = mRotationValues[(zPart->mRotationOffset + (zMaxFrame - 1))]; + } else { + transformInfo->mRotation.z = mRotationValues[(zPart->mRotationOffset + (int)getFrame())]; + } + xMaxFrame = xPart->mTranslateMaxFrame; + if (getFrame() < 0) { + transformInfo->mTranslate.x = mTranslateValues[xPart->mTranslateOffset]; + } else if (getFrame() >= xMaxFrame) { + transformInfo->mTranslate.x = mTranslateValues[(xPart->mTranslateOffset + (xMaxFrame - 1))]; + } else { + transformInfo->mTranslate.x = mTranslateValues[(xPart->mTranslateOffset + (int)getFrame())]; + } + yMaxFrame = yPart->mTranslateMaxFrame; + if (getFrame() < 0) { + transformInfo->mTranslate.y = mTranslateValues[yPart->mTranslateOffset]; + } else if (getFrame() >= yMaxFrame) { + transformInfo->mTranslate.y = mTranslateValues[(yPart->mTranslateOffset + (yMaxFrame - 1))]; + } else { + transformInfo->mTranslate.y = mTranslateValues[(yPart->mTranslateOffset + (int)getFrame())]; + } + zMaxFrame = zPart->mTranslateMaxFrame; + if (getFrame() < 0) { + transformInfo->mTranslate.z = mTranslateValues[zPart->mTranslateOffset]; + } else if (getFrame() >= zMaxFrame) { + transformInfo->mTranslate.z = mTranslateValues[(zPart->mTranslateOffset + (zMaxFrame - 1))]; + } else { + transformInfo->mTranslate.z = mTranslateValues[(zPart->mTranslateOffset + (int)getFrame())]; + } +} + +/* 8030AAFC-8030AF24 30543C 0428+00 1/0 0/0 0/0 .text + * calcTransform__18J2DAnmTransformKeyCFfUsP16J3DTransformInfo */ +void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1, + J3DTransformInfo* transformInfo) const { + u16 idx = param_1 * 3; + J3DAnmTransformKeyTable* xInf = &mInfoTable[idx]; + J3DAnmTransformKeyTable* yInf = &mInfoTable[idx + 1]; + J3DAnmTransformKeyTable* zInf = &mInfoTable[idx + 2]; + switch (xInf->mScaleInfo.mMaxFrame) { + case 0: + transformInfo->mScale.x = 1; + break; + case 1: + transformInfo->mScale.x = mScaleValues[xInf->mScaleInfo.mOffset]; + break; + default: + transformInfo->mScale.x = J2DGetKeyFrameInterpolationf( + param_0, &xInf->mScaleInfo, &mScaleValues[xInf->mScaleInfo.mOffset]); + } + switch (yInf->mScaleInfo.mMaxFrame) { + case 0: + transformInfo->mScale.y = 1; + break; + case 1: + transformInfo->mScale.y = mScaleValues[yInf->mScaleInfo.mOffset]; + break; + default: + transformInfo->mScale.y = J2DGetKeyFrameInterpolationf( + param_0, &yInf->mScaleInfo, &mScaleValues[yInf->mScaleInfo.mOffset]); + } + switch (zInf->mScaleInfo.mMaxFrame) { + case 0: + transformInfo->mScale.z = 1; + break; + case 1: + transformInfo->mScale.z = mScaleValues[zInf->mScaleInfo.mOffset]; + break; + default: + transformInfo->mScale.z = J2DGetKeyFrameInterpolationf( + param_0, &zInf->mScaleInfo, &mScaleValues[zInf->mScaleInfo.mOffset]); + } + switch (xInf->mRotationInfo.mMaxFrame) { + case 0: + transformInfo->mRotation.x = 0; + break; + case 1: + transformInfo->mRotation.x = mRotationValues[xInf->mRotationInfo.mOffset] << field_0x24; + break; + default: + transformInfo->mRotation.x = + static_cast<s32>(J2DGetKeyFrameInterpolations( + param_0, &xInf->mRotationInfo, &mRotationValues[xInf->mRotationInfo.mOffset])) + << field_0x24; + } + switch (yInf->mRotationInfo.mMaxFrame) { + case 0: + transformInfo->mRotation.y = 0; + break; + case 1: + transformInfo->mRotation.y = mRotationValues[yInf->mRotationInfo.mOffset] << field_0x24; + break; + default: + transformInfo->mRotation.y = + static_cast<s32>(J2DGetKeyFrameInterpolations( + param_0, &yInf->mRotationInfo, &mRotationValues[yInf->mRotationInfo.mOffset])) + << field_0x24; + } + switch (zInf->mRotationInfo.mMaxFrame) { + case 0: + transformInfo->mRotation.z = 0; + break; + case 1: + transformInfo->mRotation.z = mRotationValues[zInf->mRotationInfo.mOffset] << field_0x24; + break; + default: + transformInfo->mRotation.z = + static_cast<s32>(J2DGetKeyFrameInterpolations( + param_0, &zInf->mRotationInfo, &mRotationValues[zInf->mRotationInfo.mOffset])) + << field_0x24; + } + switch (xInf->mTranslateInfo.mMaxFrame) { + case 0: + transformInfo->mTranslate.x = 0; + break; + case 1: + transformInfo->mTranslate.x = mTranslateValues[xInf->mTranslateInfo.mOffset]; + break; + default: + transformInfo->mTranslate.x = J2DGetKeyFrameInterpolationf( + param_0, &xInf->mTranslateInfo, &mTranslateValues[xInf->mTranslateInfo.mOffset]); + } + switch (yInf->mTranslateInfo.mMaxFrame) { + case 0: + transformInfo->mTranslate.y = 0; + break; + case 1: + transformInfo->mTranslate.y = mTranslateValues[yInf->mTranslateInfo.mOffset]; + break; + default: + transformInfo->mTranslate.y = J2DGetKeyFrameInterpolationf( + param_0, &yInf->mTranslateInfo, &mTranslateValues[yInf->mTranslateInfo.mOffset]); + } + switch (zInf->mTranslateInfo.mMaxFrame) { + case 0: + transformInfo->mTranslate.z = 0; + break; + case 1: + transformInfo->mTranslate.z = mTranslateValues[zInf->mTranslateInfo.mOffset]; + break; + default: + transformInfo->mTranslate.z = J2DGetKeyFrameInterpolationf( + param_0, &zInf->mTranslateInfo, &mTranslateValues[zInf->mTranslateInfo.mOffset]); + } +} + +/* 8030AF24-8030AFC8 305864 00A4+00 3/0 0/0 0/0 .text + * searchUpdateMaterialID__11J2DAnmColorFP9J2DScreen */ +void J2DAnmColor::searchUpdateMaterialID(J2DScreen* pScreen) { + if (pScreen != NULL && pScreen->mNameTable != NULL) { + for (u16 entry = 0; entry < this->getUpdateMaterialNum(); entry++) { + s32 idx = pScreen->mNameTable->getIndex(this->field_0x20.getName(entry)); + if (idx != -1) { + mUpdateMaterialID[entry] = idx; + } else { + mUpdateMaterialID[entry] = 0xFFFF; + } + } + } +} + +/* 8030AFC8-8030B200 305908 0238+00 1/0 0/0 0/0 .text getColor__15J2DAnmColorFullCFUsP8_GXColor */ +void J2DAnmColorFull::getColor(u16 param_0, _GXColor* pColor) const { + J3DAnmColorFullTable* info = &mInfoTable[param_0]; + u16 maxFrame = info->mRMaxFrame; + if (getFrame() < 0) { + pColor->r = mRValues[info->mROffset]; + } else if (getFrame() >= maxFrame) { + pColor->r = mRValues[info->mROffset + (maxFrame - 1)]; + } else { + pColor->r = mRValues[info->mROffset + (int)getFrame()]; + } + maxFrame = info->mGMaxFrame; + if (getFrame() < 0) { + pColor->g = mGValues[info->mGOffset]; + } else if (getFrame() >= maxFrame) { + pColor->g = mGValues[info->mGOffset + (maxFrame - 1)]; + } else { + pColor->g = mGValues[info->mGOffset + (int)getFrame()]; + } + maxFrame = info->mBMaxFrame; + if (getFrame() < 0) { + pColor->b = mBValues[info->mBOffset]; + } else if (getFrame() >= maxFrame) { + pColor->b = mBValues[info->mBOffset + (maxFrame - 1)]; + } else { + pColor->b = mBValues[info->mBOffset + (int)getFrame()]; + } + maxFrame = info->mAMaxFrame; + if (getFrame() < 0) { + pColor->a = mAValues[info->mAOffset]; + } else if (getFrame() >= maxFrame) { + pColor->a = mAValues[info->mAOffset + (maxFrame - 1)]; + } else { + pColor->a = mAValues[info->mAOffset + (int)getFrame()]; + } +} + +/* 8030B200-8030B4C4 305B40 02C4+00 1/0 0/0 0/0 .text getColor__14J2DAnmColorKeyCFUsP8_GXColor */ +void J2DAnmColorKey::getColor(u16 param_0, _GXColor* pColor) const { + J3DAnmColorKeyTable* info = &mInfoTable[param_0]; + f32 val; + switch (info->mRInfo.mMaxFrame) { + case 0: + pColor->r = 0; + break; + case 1: + pColor->r = mRValues[info->mRInfo.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mRInfo, + &mRValues[info->mRInfo.mOffset]); + if (val < 0) { + pColor->r = 0; + } else if (val > 255) { + pColor->r = 255; + } else { + OSf32tou8(&val, &pColor->r); + } + } + switch (info->mGInfo.mMaxFrame) { + case 0: + pColor->g = 0; + break; + case 1: + pColor->g = mGValues[info->mGInfo.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mGInfo, + &mGValues[info->mGInfo.mOffset]); + if (val < 0) { + pColor->g = 0; + } else if (val > 255) { + pColor->g = 255; + } else { + OSf32tou8(&val, &pColor->g); + } + } + switch (info->mBInfo.mMaxFrame) { + case 0: + pColor->b = 0; + break; + case 1: + pColor->b = mBValues[info->mBInfo.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mBInfo, + &mBValues[info->mBInfo.mOffset]); + if (val < 0) { + pColor->b = 0; + } else if (val > 255) { + pColor->b = 255; + } else { + OSf32tou8(&val, &pColor->b); + } + } + switch (info->mAInfo.mMaxFrame) { + case 0: + pColor->a = 0; + break; + case 1: + pColor->a = mAValues[info->mAInfo.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mAInfo, + &mAValues[info->mAInfo.mOffset]); + if (val < 0) { + pColor->a = 0; + } else if (val > 255) { + pColor->a = 255; + } else { + OSf32tou8(&val, &pColor->a); + } + } +} + +/* 8030B4C4-8030B704 305E04 0240+00 1/0 0/0 0/0 .text + * getColor__18J2DAnmVtxColorFullCFUcUsP8_GXColor */ +void J2DAnmVtxColorFull::getColor(u8 param_0, u16 param_1, _GXColor* pColor) const { + J3DAnmColorFullTable* info = &mInfoTable[param_0][param_1]; + u16 maxFrame = info->mRMaxFrame; + if (getFrame() < 0) { + pColor->r = mRValues[info->mROffset]; + } else if (getFrame() >= maxFrame) { + pColor->r = mRValues[info->mROffset + (maxFrame - 1)]; + } else { + pColor->r = mRValues[info->mROffset + (int)getFrame()]; + } + maxFrame = info->mGMaxFrame; + if (getFrame() < 0) { + pColor->g = mGValues[info->mGOffset]; + } else if (getFrame() >= maxFrame) { + pColor->g = mGValues[info->mGOffset + (maxFrame - 1)]; + } else { + pColor->g = mGValues[info->mGOffset + (int)getFrame()]; + } + maxFrame = info->mBMaxFrame; + if (getFrame() < 0) { + pColor->b = mBValues[info->mBOffset]; + } else if (getFrame() >= maxFrame) { + pColor->b = mBValues[info->mBOffset + (maxFrame - 1)]; + } else { + pColor->b = mBValues[info->mBOffset + (int)getFrame()]; + } + maxFrame = info->mAMaxFrame; + if (getFrame() < 0) { + pColor->a = mAValues[info->mAOffset]; + } else if (getFrame() >= maxFrame) { + pColor->a = mAValues[info->mAOffset + (maxFrame - 1)]; + } else { + pColor->a = mAValues[info->mAOffset + (int)getFrame()]; + } +} + +/* 8030B704-8030B9F0 306044 02EC+00 1/0 0/0 0/0 .text + * getColor__17J2DAnmVtxColorKeyCFUcUsP8_GXColor */ +void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, _GXColor* pColor) const { + J3DAnmColorKeyTable* info = &mInfoTable[param_0][param_1]; + f32 val; + switch (info->mRInfo.mMaxFrame) { + case 0: + pColor->r = 0; + break; + case 1: + pColor->r = mRValues[info->mRInfo.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mRInfo, + &mRValues[info->mRInfo.mOffset]); + if ((val <= 0)) { + pColor->r = 0; + } else if (val <= 255) { + OSf32tou8(&val, &pColor->r); + } else { + pColor->r = 255; + } + } + switch (info->mGInfo.mMaxFrame) { + case 0: + pColor->g = 0; + break; + case 1: + pColor->g = mGValues[info->mGInfo.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mGInfo, + &mGValues[info->mGInfo.mOffset]); + if (val <= 0) { + pColor->g = 0; + } else if (val <= 255) { + OSf32tou8(&val, &pColor->g); + } else { + pColor->g = 255; + } + } + switch (info->mBInfo.mMaxFrame) { + case 0: + pColor->b = 0; + break; + case 1: + pColor->b = mBValues[info->mBInfo.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mBInfo, + &mBValues[info->mBInfo.mOffset]); + if (val <= 0) { + pColor->b = 0; + } else if (val <= 255) { + OSf32tou8(&val, &pColor->b); + } else { + pColor->b = 255; + } + } + switch (info->mAInfo.mMaxFrame) { + case 0: + pColor->a = 0; + break; + case 1: + pColor->a = mAValues[info->mAInfo.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mAInfo, + &mAValues[info->mAInfo.mOffset]); + if (val <= 0) { + pColor->a = 0; + } else if (val <= 255) { + OSf32tou8(&val, &pColor->a); + } else { + pColor->a = 255; + } + } +} + +/* 8030B9F0-8030BC60 306330 0270+00 0/0 1/1 0/0 .text + * calcTransform__19J2DAnmTextureSRTKeyCFfUsP17J3DTextureSRTInfo */ +void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTInfo* pInfo) const { + u16 idx = param_1 * 3; + J3DAnmTransformKeyTable* xInf = &mInfoTable[idx]; + J3DAnmTransformKeyTable* yInf = &mInfoTable[idx + 1]; + J3DAnmTransformKeyTable* zInf = &mInfoTable[idx + 2]; + switch (xInf->mScaleInfo.mMaxFrame) { + case 0: + pInfo->mScaleX = 1; + break; + case 1: + pInfo->mScaleX = mScaleValues[xInf->mScaleInfo.mOffset]; + break; + default: + pInfo->mScaleX = J2DGetKeyFrameInterpolationf(param_0, &xInf->mScaleInfo, + &mScaleValues[xInf->mScaleInfo.mOffset]); + } + switch (yInf->mScaleInfo.mMaxFrame) { + case 0: + pInfo->mScaleY = 1; + break; + case 1: + pInfo->mScaleY = mScaleValues[yInf->mScaleInfo.mOffset]; + break; + default: + pInfo->mScaleY = J2DGetKeyFrameInterpolationf(param_0, &yInf->mScaleInfo, + &mScaleValues[yInf->mScaleInfo.mOffset]); + } + switch (zInf->mRotationInfo.mMaxFrame) { + case 0: + pInfo->mRotation = 0; + break; + case 1: + pInfo->mRotation = mRotationValues[zInf->mRotationInfo.mOffset] << field_0x10; + break; + default: + pInfo->mRotation = + static_cast<s32>(J2DGetKeyFrameInterpolations( + param_0, &zInf->mRotationInfo, &mRotationValues[zInf->mRotationInfo.mOffset])) + << field_0x10; + } + switch (xInf->mTranslateInfo.mMaxFrame) { + case 0: + pInfo->mTranslationX = 0; + break; + case 1: + pInfo->mTranslationX = mTranslationValues[xInf->mTranslateInfo.mOffset]; + break; + default: + pInfo->mTranslationX = J2DGetKeyFrameInterpolationf( + param_0, &xInf->mTranslateInfo, &mTranslationValues[xInf->mTranslateInfo.mOffset]); + } + switch (yInf->mTranslateInfo.mMaxFrame) { + case 0: + pInfo->mTranslationY = 0; + break; + case 1: + pInfo->mTranslationY = mTranslationValues[yInf->mTranslateInfo.mOffset]; + break; + default: + pInfo->mTranslationY = J2DGetKeyFrameInterpolationf( + param_0, &yInf->mTranslateInfo, &mTranslationValues[yInf->mTranslateInfo.mOffset]); + } +} + +/* 8030BC60-8030BD10 3065A0 00B0+00 1/0 0/0 0/0 .text + * searchUpdateMaterialID__19J2DAnmTextureSRTKeyFP9J2DScreen */ +void J2DAnmTextureSRTKey::searchUpdateMaterialID(J2DScreen* pScreen) { + if (pScreen != NULL && pScreen->mNameTable != NULL) { + for (u16 entry = 0; entry < this->getUpdateMaterialNum(); entry++) { + s32 idx = pScreen->mNameTable->getIndex(field_0x34.getName(entry)); + if (idx != -1) { + mUpdateMaterialID[entry] = idx; + } else { + mUpdateMaterialID[entry] = 0xFFFF; + } + } + } +} + +/* 8030BD10-8030BEE8 306650 01D8+00 1/0 0/0 0/0 .text + * searchUpdateMaterialID__16J2DAnmTexPatternFP9J2DScreen */ +void J2DAnmTexPattern::searchUpdateMaterialID(J2DScreen* pScreen) { + if (pScreen != NULL && pScreen->mNameTable != NULL && pScreen->mTexRes != NULL) { + for (u16 entry = 0; entry < this->getUpdateMaterialNum(); entry++) { + s32 idx = pScreen->mNameTable->getIndex(field_0x20.getName(entry)); + if (idx != -1) { + mUpdateMaterialID[entry] = idx; + } else { + mUpdateMaterialID[entry] = 0xFFFF; + } + } + delete[] mTIMGPtrArray; + mTIMGPtrArray = new J2DAnmTexPatternTIMGPointer[pScreen->mTexRes->mCount]; + if (mTIMGPtrArray != NULL) { + JUTResReference resRef; + for (u16 i = 0; i < pScreen->mTexRes->mCount; i++) { + s8* var1 = pScreen->mTexRes->getResReference(i); + ResTIMG* var2 = NULL; + if (var1 != NULL) { + var2 = (ResTIMG*)resRef.getResource(var1, 'TIMG', NULL); + if (var2 == NULL && J2DScreen::getDataManage() != NULL) { + var2 = + (ResTIMG*)J2DScreen::getDataManage()->get(pScreen->mTexRes->getName(i)); + } + } + mTIMGPtrArray[i].mRes = var2; + if (var2 != NULL && var2->indexTexture) { + JUTPalette* palette = + new JUTPalette(GX_TLUT0, (_GXTlutFmt)var2->colorFormat, + (JUTTransparency)var2->alphaEnabled, var2->numColors, + ((u8*)var2) + var2->paletteOffset); + mTIMGPtrArray[i].mPalette = palette; + } + } + } + } +} + +/* 8030BEE8-8030BF9C 306828 00B4+00 2/2 1/1 0/0 .text getTexNo__16J2DAnmTexPatternCFUsPUs + */ +void J2DAnmTexPattern::getTexNo(u16 param_0, u16* pTexNo) const { + u16 maxFrame = mAnmTable[param_0].mMaxFrame; + f32 frame = getFrame(); + if (frame < 0) { + *pTexNo = mValues[mAnmTable[param_0].mOffset]; + } else if (frame >= maxFrame) { + *pTexNo = mValues[mAnmTable[param_0].mOffset + (maxFrame - 1)]; + } else { + *pTexNo = mValues[mAnmTable[param_0].mOffset + (int)frame]; + } +} + +/* 8030BF9C-8030BFF0 3068DC 0054+00 0/0 1/1 0/0 .text getResTIMG__16J2DAnmTexPatternCFUs + */ +ResTIMG* J2DAnmTexPattern::getResTIMG(u16 param_0) const { + if (mTIMGPtrArray == NULL) { + return NULL; + } else { + u16 texNo; + this->getTexNo(param_0, &texNo); + return mTIMGPtrArray[texNo].mRes; + } +} + +/* 8030BFF0-8030C048 306930 0058+00 0/0 1/1 0/0 .text getPalette__16J2DAnmTexPatternCFUs + */ +JUTPalette* J2DAnmTexPattern::getPalette(u16 param_0) const { + if (mTIMGPtrArray == NULL) { + return NULL; + } else { + u16 texNo; + this->getTexNo(param_0, &texNo); + return mTIMGPtrArray[texNo].mPalette; + } +} + +/* 8030C048-8030C0F0 306988 00A8+00 0/0 3/3 0/0 .text getVisibility__20J2DAnmVisibilityFullCFUsPUc + */ +void J2DAnmVisibilityFull::getVisibility(u16 param_0, u8* pOut) const { + u16 maxFrame = mTable[param_0]._0; + if (getFrame() < 0) { + *pOut = mValues[mTable[param_0]._2]; + } else if (getFrame() >= maxFrame) { + *pOut = mValues[mTable[param_0]._2 + (maxFrame - 1)]; + } else { + int frame = getFrame(); + *pOut = mValues[mTable[param_0]._2 + frame]; + } +} + +/* 8030C0F0-8030C3B4 306A30 02C4+00 0/0 1/1 0/0 .text + * getTevColorReg__15J2DAnmTevRegKeyCFUsP11_GXColorS10 */ +void J2DAnmTevRegKey::getTevColorReg(u16 param_0, _GXColorS10* pColor) const { + J3DAnmCRegKeyTable* info = &mAnmCRegKeyTable[param_0]; + f32 val; + switch (info->mRTable.mMaxFrame) { + case 0: + pColor->r = 0; + break; + case 1: + pColor->r = mCRValues[info->mRTable.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mRTable, + &mCRValues[info->mRTable.mOffset]); + if (val < -0x400) { + pColor->r = -0x400; + } else if (val > 0x3FF) { + pColor->r = 0x3FF; + } else { + OSf32tos16(&val, &pColor->r); + } + } + switch (info->mGTable.mMaxFrame) { + case 0: + pColor->g = 0; + break; + case 1: + pColor->g = mCGValues[info->mGTable.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mGTable, + &mCGValues[info->mGTable.mOffset]); + if (val < -0x400) { + pColor->g = -0x400; + } else if (val > 0x3FF) { + pColor->g = 0x3FF; + } else { + OSf32tos16(&val, &pColor->g); + } + } + switch (info->mBTable.mMaxFrame) { + case 0: + pColor->b = 0; + break; + case 1: + pColor->b = mCBValues[info->mBTable.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mBTable, + &mCBValues[info->mBTable.mOffset]); + if (val < -0x400) { + pColor->b = -0x400; + } else if (val > 0x3FF) { + pColor->b = 0x3FF; + } else { + OSf32tos16(&val, &pColor->b); + } + } + switch (info->mATable.mMaxFrame) { + case 0: + pColor->a = 0; + break; + case 1: + pColor->a = mCAValues[info->mATable.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mATable, + &mCAValues[info->mATable.mOffset]); + if (val < -0x400) { + pColor->a = -0x400; + } else if (val > 0x3FF) { + pColor->a = 0x3FF; + } else { + OSf32tos16(&val, &pColor->a); + } + } +} + +/* 8030C3B4-8030C678 306CF4 02C4+00 0/0 1/1 0/0 .text + * getTevKonstReg__15J2DAnmTevRegKeyCFUsP8_GXColor */ +void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, _GXColor* pColor) const { + J3DAnmKRegKeyTable* info = &mAnmKRegKeyTable[param_0]; + f32 val; + switch (info->mRTable.mMaxFrame) { + case 0: + pColor->r = 0; + break; + case 1: + pColor->r = mKRValues[info->mRTable.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mRTable, + &mKRValues[info->mRTable.mOffset]); + if (val < 0) { + pColor->r = 0; + } else if (val > 255) { + pColor->r = 255; + } else { + OSf32tou8(&val, &pColor->r); + } + } + switch (info->mGTable.mMaxFrame) { + case 0: + pColor->g = 0; + break; + case 1: + pColor->g = mKGValues[info->mGTable.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mGTable, + &mKGValues[info->mGTable.mOffset]); + if (val < 0) { + pColor->g = 0; + } else if (val > 255) { + pColor->g = 255; + } else { + OSf32tou8(&val, &pColor->g); + } + } + switch (info->mBTable.mMaxFrame) { + case 0: + pColor->b = 0; + break; + case 1: + pColor->b = mKBValues[info->mBTable.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mBTable, + &mKBValues[info->mBTable.mOffset]); + if (val < 0) { + pColor->b = 0; + } else if (val > 255) { + pColor->b = 255; + } else { + OSf32tou8(&val, &pColor->b); + } + } + switch (info->mATable.mMaxFrame) { + case 0: + pColor->a = 0; + break; + case 1: + pColor->a = mKAValues[info->mATable.mOffset]; + break; + default: + val = J2DGetKeyFrameInterpolations(getFrame(), &info->mATable, + &mKAValues[info->mATable.mOffset]); + if (val < 0) { + pColor->a = 0; + } else if (val > 255) { + pColor->a = 255; + } else { + OSf32tou8(&val, &pColor->a); + } + } +} + +/* 8030C678-8030C77C 306FB8 0104+00 1/0 0/0 0/0 .text + * searchUpdateMaterialID__15J2DAnmTevRegKeyFP9J2DScreen */ +void J2DAnmTevRegKey::searchUpdateMaterialID(J2DScreen* pScreen) { + if (pScreen != NULL && pScreen->mNameTable != NULL) { + for (u16 i = 0; i < mCRegUpdateMaterialNum; i++) { + s32 idx = pScreen->mNameTable->getIndex(mCRegNameTab.getName(i)); + if (idx != -1) { + mCRegUpdateMaterialID[i] = idx; + } else { + mCRegUpdateMaterialID[i] = 0xFFFF; + } + } + for (u16 i = 0; i < mKRegUpdateMaterialNum; i++) { + s32 idx = pScreen->mNameTable->getIndex(mKRegNameTab.getName(i)); + if (idx != -1) { + mKRegUpdateMaterialID[i] = idx; + } else { + mKRegUpdateMaterialID[i] = 0xFFFF; + } + } + } +} + +/* 8030C77C-8030C9B0 3070BC 0234+00 6/6 0/0 0/0 .text + * J2DGetKeyFrameInterpolation<s>__FfP18J3DAnmKeyTableBasePs */ +// should be J2DGetKeyFrameInterpolation<s16> +f32 J2DGetKeyFrameInterpolations(f32 param_0, J3DAnmKeyTableBase* param_1, s16* param_2) { + if (param_0 < param_2[0]) { + return param_2[1]; + } else { + if (param_1->mType == 0) { + if (param_2[(param_1->mMaxFrame - 1) * 3] <= param_0) { + return param_2[(param_1->mMaxFrame - 1) * 3 + 1]; + } else { + u32 tmp = param_1->mMaxFrame; + while (tmp > 1) { + u32 halfTmp = tmp / 2; + u32 upIdx = halfTmp * 3; + if (param_0 >= param_2[upIdx]) { + param_2 = param_2 + upIdx; + tmp -= halfTmp; + } else { + tmp = halfTmp; + } + } + return J2DHermiteInterpolation<s16>(param_0, ¶m_2[0], ¶m_2[1], ¶m_2[2], + ¶m_2[3], ¶m_2[4], ¶m_2[5]); + } + } else { + if (param_2[(param_1->mMaxFrame - 1) * 4] <= param_0) { + return param_2[(param_1->mMaxFrame - 1) * 4 + 1]; + } else { + u32 tmp = param_1->mMaxFrame; + while (tmp > 1) { + u32 halfTmp = tmp / 2; + u32 upIdx = halfTmp * 4; + if (param_0 >= param_2[upIdx]) { + param_2 = param_2 + upIdx; + tmp -= halfTmp; + } else { + tmp = halfTmp; + } + } + return J2DHermiteInterpolation<s16>(param_0, ¶m_2[0], ¶m_2[1], ¶m_2[3], + ¶m_2[4], ¶m_2[5], ¶m_2[6]); + } + } + } +} + +/* 8030C9B0-8030CB2C 3072F0 017C+00 2/2 0/0 0/0 .text + * J2DGetKeyFrameInterpolation<f>__FfP18J3DAnmKeyTableBasePf */ +// should be J2DGetKeyFrameInterpolation<s16> +f32 J2DGetKeyFrameInterpolationf(f32 param_0, J3DAnmKeyTableBase* param_1, f32* param_2) { + if (param_0 < param_2[0]) { + return param_2[1]; + } else { + if (param_1->mType == 0) { + if (param_2[(param_1->mMaxFrame - 1) * 3] <= param_0) { + return param_2[(param_1->mMaxFrame - 1) * 3 + 1]; + } else { + u32 tmp = param_1->mMaxFrame; + while (tmp > 1) { + u32 halfTmp = tmp / 2; + u32 upIdx = halfTmp * 3; + if (param_0 >= param_2[upIdx]) { + param_2 = param_2 + upIdx; + tmp -= halfTmp; + } else { + tmp = halfTmp; + } + } + return J2DHermiteInterpolation<f32>(param_0, ¶m_2[0], ¶m_2[1], ¶m_2[2], + ¶m_2[3], ¶m_2[4], ¶m_2[5]); + } + } else { + if (param_2[(param_1->mMaxFrame - 1) * 4] <= param_0) { + return param_2[(param_1->mMaxFrame - 1) * 4 + 1]; + } else { + u32 tmp = param_1->mMaxFrame; + while (tmp > 1) { + u32 halfTmp = tmp / 2; + u32 upIdx = halfTmp * 4; + if (param_0 >= param_2[upIdx]) { + param_2 = param_2 + upIdx; + tmp -= halfTmp; + } else { + tmp = halfTmp; + } + } + return J2DHermiteInterpolation<f32>(param_0, ¶m_2[0], ¶m_2[1], ¶m_2[3], + ¶m_2[4], ¶m_2[5], ¶m_2[6]); + } + } + } +} + +J2DAnmTexPattern::J2DAnmTexPatternTIMGPointer::J2DAnmTexPatternTIMGPointer() { + mRes = NULL; + mPalette = NULL; +} + +J2DAnmTexPattern::J2DAnmTexPatternTIMGPointer::~J2DAnmTexPatternTIMGPointer() { + delete mPalette; +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DAnmLoader.cpp b/src/JSystem/J2DGraph/J2DAnmLoader.cpp new file mode 100644 index 0000000000..fe1afe806a --- /dev/null +++ b/src/JSystem/J2DGraph/J2DAnmLoader.cpp @@ -0,0 +1,526 @@ +// +// Generated By: dol2asm +// Translation Unit: J2DAnmLoader +// + +// See J2DAnmLoader_nonmatching.cpp + +// #include "JSystem/J2DGraph/J2DAnmLoader.h" +#include "dol2asm.h" +#include "dolphin/types.h" + +// +// Types: +// + +struct _GXColor {}; + +struct ResNTAB {}; + +struct JUTNameTab { + /* 802DE9A0 */ JUTNameTab(); + /* 802DEA1C */ void setResource(ResNTAB const*); +}; + +struct J3DAnmVtxColorKeyData {}; + +struct J3DAnmVtxColorFullData {}; + +struct J3DAnmVisibilityFullData {}; + +struct J3DAnmTransformKeyData {}; + +struct J3DAnmTransformFullData {}; + +struct J3DAnmTextureSRTKeyData {}; + +struct J3DAnmTexPatternFullData {}; + +struct J3DAnmTevRegKeyData {}; + +struct J3DAnmColorKeyData {}; + +struct J3DAnmColorFullData {}; + +struct J2DScreen {}; + +struct J2DAnmVtxColorKey {}; + +struct J2DAnmVtxColorFull {}; + +struct J2DAnmVtxColor { + /* 8030363C */ void getColor(u8, u16, _GXColor*) const; + /* 8030A358 */ ~J2DAnmVtxColor(); +}; + +struct J2DAnmVisibilityFull { + /* 8030A3B4 */ ~J2DAnmVisibilityFull(); +}; + +struct J2DAnmTransformKey {}; + +struct J2DAnmTransformFull {}; + +struct J2DAnmTextureSRTKey {}; + +struct J2DAnmTexPattern {}; + +struct J2DAnmTevRegKey {}; + +struct J2DAnmLoaderDataBase { + /* 80308A6C */ void load(void const*); +}; + +struct J2DAnmLoader { + /* 8030A410 */ ~J2DAnmLoader(); +}; + +struct J2DAnmBase { + /* 800569B0 */ void searchUpdateMaterialID(J2DScreen*); +}; + +struct J2DAnmColorKey {}; + +struct J2DAnmKeyLoader_v15 { + /* 80309290 */ J2DAnmKeyLoader_v15(); + /* 803092AC */ ~J2DAnmKeyLoader_v15(); + /* 80309308 */ void load(void const*); + /* 80309414 */ void setResource(J2DAnmBase*, void const*); + /* 80309570 */ void readAnmTransform(J3DAnmTransformKeyData const*); + /* 80309598 */ void setAnmTransform(J2DAnmTransformKey*, J3DAnmTransformKeyData const*); + /* 80309634 */ void readAnmTextureSRT(J3DAnmTextureSRTKeyData const*); + /* 8030965C */ void setAnmTextureSRT(J2DAnmTextureSRTKey*, J3DAnmTextureSRTKeyData const*); + /* 80309848 */ void readAnmColor(J3DAnmColorKeyData const*); + /* 80309870 */ void setAnmColor(J2DAnmColorKey*, J3DAnmColorKeyData const*); + /* 8030995C */ void readAnmVtxColor(J3DAnmVtxColorKeyData const*); + /* 80309984 */ void setAnmVtxColor(J2DAnmVtxColorKey*, J3DAnmVtxColorKeyData const*); + /* 80309FDC */ void readAnmTevReg(J3DAnmTevRegKeyData const*); + /* 8030A004 */ void setAnmTevReg(J2DAnmTevRegKey*, J3DAnmTevRegKeyData const*); +}; + +struct J2DAnmColorFull {}; + +struct J2DAnmFullLoader_v15 { + /* 80309A80 */ void load(void const*); + /* 80309B8C */ void setResource(J2DAnmBase*, void const*); + /* 80309CE8 */ J2DAnmFullLoader_v15(); + /* 80309D04 */ ~J2DAnmFullLoader_v15(); + /* 80309D60 */ void readAnmTransform(J3DAnmTransformFullData const*); + /* 80309D88 */ void setAnmTransform(J2DAnmTransformFull*, J3DAnmTransformFullData const*); + /* 80309E1C */ void readAnmColor(J3DAnmColorFullData const*); + /* 80309E44 */ void setAnmColor(J2DAnmColorFull*, J3DAnmColorFullData const*); + /* 80309F10 */ void readAnmTexPattern(J3DAnmTexPatternFullData const*); + /* 80309F38 */ void setAnmTexPattern(J2DAnmTexPattern*, J3DAnmTexPatternFullData const*); + /* 8030A190 */ void readAnmVisibility(J3DAnmVisibilityFullData const*); + /* 8030A1B8 */ void setAnmVisibility(J2DAnmVisibilityFull*, J3DAnmVisibilityFullData const*); + /* 8030A234 */ void readAnmVtxColor(J3DAnmVtxColorFullData const*); + /* 8030A25C */ void setAnmVtxColor(J2DAnmVtxColorFull*, J3DAnmVtxColorFullData const*); +}; + +// +// Forward References: +// + +extern "C" void load__20J2DAnmLoaderDataBaseFPCv(); +extern "C" void __ct__19J2DAnmKeyLoader_v15Fv(); +extern "C" void __dt__19J2DAnmKeyLoader_v15Fv(); +extern "C" void load__19J2DAnmKeyLoader_v15FPCv(); +extern "C" void setResource__19J2DAnmKeyLoader_v15FP10J2DAnmBasePCv(); +extern "C" void readAnmTransform__19J2DAnmKeyLoader_v15FPC22J3DAnmTransformKeyData(); +extern "C" void +setAnmTransform__19J2DAnmKeyLoader_v15FP18J2DAnmTransformKeyPC22J3DAnmTransformKeyData(); +extern "C" void readAnmTextureSRT__19J2DAnmKeyLoader_v15FPC23J3DAnmTextureSRTKeyData(); +extern "C" void +setAnmTextureSRT__19J2DAnmKeyLoader_v15FP19J2DAnmTextureSRTKeyPC23J3DAnmTextureSRTKeyData(); +extern "C" void readAnmColor__19J2DAnmKeyLoader_v15FPC18J3DAnmColorKeyData(); +extern "C" void setAnmColor__19J2DAnmKeyLoader_v15FP14J2DAnmColorKeyPC18J3DAnmColorKeyData(); +extern "C" void readAnmVtxColor__19J2DAnmKeyLoader_v15FPC21J3DAnmVtxColorKeyData(); +extern "C" void +setAnmVtxColor__19J2DAnmKeyLoader_v15FP17J2DAnmVtxColorKeyPC21J3DAnmVtxColorKeyData(); +extern "C" void load__20J2DAnmFullLoader_v15FPCv(); +extern "C" void setResource__20J2DAnmFullLoader_v15FP10J2DAnmBasePCv(); +extern "C" void __ct__20J2DAnmFullLoader_v15Fv(); +extern "C" void __dt__20J2DAnmFullLoader_v15Fv(); +extern "C" void readAnmTransform__20J2DAnmFullLoader_v15FPC23J3DAnmTransformFullData(); +extern "C" void +setAnmTransform__20J2DAnmFullLoader_v15FP19J2DAnmTransformFullPC23J3DAnmTransformFullData(); +extern "C" void readAnmColor__20J2DAnmFullLoader_v15FPC19J3DAnmColorFullData(); +extern "C" void setAnmColor__20J2DAnmFullLoader_v15FP15J2DAnmColorFullPC19J3DAnmColorFullData(); +extern "C" void readAnmTexPattern__20J2DAnmFullLoader_v15FPC24J3DAnmTexPatternFullData(); +extern "C" void +setAnmTexPattern__20J2DAnmFullLoader_v15FP16J2DAnmTexPatternPC24J3DAnmTexPatternFullData(); +extern "C" void readAnmTevReg__19J2DAnmKeyLoader_v15FPC19J3DAnmTevRegKeyData(); +extern "C" void setAnmTevReg__19J2DAnmKeyLoader_v15FP15J2DAnmTevRegKeyPC19J3DAnmTevRegKeyData(); +extern "C" void readAnmVisibility__20J2DAnmFullLoader_v15FPC24J3DAnmVisibilityFullData(); +extern "C" void +setAnmVisibility__20J2DAnmFullLoader_v15FP20J2DAnmVisibilityFullPC24J3DAnmVisibilityFullData(); +extern "C" void readAnmVtxColor__20J2DAnmFullLoader_v15FPC22J3DAnmVtxColorFullData(); +extern "C" void +setAnmVtxColor__20J2DAnmFullLoader_v15FP18J2DAnmVtxColorFullPC22J3DAnmVtxColorFullData(); +extern "C" void __dt__14J2DAnmVtxColorFv(); +extern "C" void __dt__20J2DAnmVisibilityFullFv(); +extern "C" void __dt__12J2DAnmLoaderFv(); +extern "C" void func_8030A458(void const*, void const*); +extern "C" void func_8030A470(void const*, void const*); +extern "C" void func_8030A488(void const*, void const*); +extern "C" void func_8030A4A0(void const*, void const*); +extern "C" void func_8030A4B8(void const*, void const*); +extern "C" void func_8030A4D0(void const*, void const*); +extern "C" void func_8030A4E8(void const*, void const*); +extern "C" void func_8030A500(void const*, void const*); +extern "C" void func_8030A518(void const*, void const*); +extern "C" void func_8030A530(void const*, void const*); +extern "C" void func_8030A548(void const*, void const*); +extern "C" void func_8030A560(void const*, void const*); +extern "C" void func_8030A578(void const*, void const*); + +// +// External References: +// + +extern "C" void searchUpdateMaterialID__10J2DAnmBaseFP9J2DScreen(); +extern "C" void* __nw__FUl(); +extern "C" void __dl__FPv(); +extern "C" void __ct__10JUTNameTabFv(); +extern "C" void setResource__10JUTNameTabFPC7ResNTAB(); +extern "C" void func_802F4260(void const*, void const*); +extern "C" void func_802F42C0(void const*, void const*); +extern "C" void getColor__14J2DAnmVtxColorCFUcUsP8_GXColor(); +extern "C" void _savegpr_26(); +extern "C" void _savegpr_27(); +extern "C" void _restgpr_26(); +extern "C" void _restgpr_27(); +extern "C" extern void* __vt__10J2DAnmBase[4]; +extern "C" extern void* __vt__15J2DAnmTransform[5 + 4 /* padding */]; +extern "C" extern void* __vt__15J2DAnmTevRegKey[4]; +extern "C" extern void* __vt__16J2DAnmTexPattern[4]; +extern "C" extern void* __vt__19J2DAnmTextureSRTKey[4]; +extern "C" extern void* __vt__17J2DAnmVtxColorKey[5]; +extern "C" extern void* __vt__18J2DAnmVtxColorFull[5]; +extern "C" extern void* __vt__14J2DAnmColorKey[5]; +extern "C" extern void* __vt__15J2DAnmColorFull[5]; +extern "C" extern void* __vt__11J2DAnmColor[5]; +extern "C" extern void* __vt__18J2DAnmTransformKey[6]; +extern "C" extern void* __vt__19J2DAnmTransformFull[5]; + +// +// Declarations: +// + +/* ############################################################################################## */ +/* 803CD6C8-803CD6DC 02A7E8 0014+00 2/2 0/0 0/0 .data __vt__20J2DAnmFullLoader_v15 */ +SECTION_DATA extern void* __vt__20J2DAnmFullLoader_v15[5] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)load__20J2DAnmFullLoader_v15FPCv, + (void*)setResource__20J2DAnmFullLoader_v15FP10J2DAnmBasePCv, + (void*)__dt__20J2DAnmFullLoader_v15Fv, +}; + +/* 803CD6DC-803CD6F0 02A7FC 0014+00 2/2 0/0 0/0 .data __vt__19J2DAnmKeyLoader_v15 */ +SECTION_DATA extern void* __vt__19J2DAnmKeyLoader_v15[5] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)load__19J2DAnmKeyLoader_v15FPCv, + (void*)setResource__19J2DAnmKeyLoader_v15FP10J2DAnmBasePCv, + (void*)__dt__19J2DAnmKeyLoader_v15Fv, +}; + +/* 803CD6F0-803CD704 02A810 0014+00 5/5 0/0 0/0 .data __vt__12J2DAnmLoader */ +SECTION_DATA extern void* __vt__12J2DAnmLoader[5] = { + (void*)NULL /* RTTI */, (void*)NULL, (void*)NULL, (void*)NULL, (void*)__dt__12J2DAnmLoaderFv, +}; + +/* 803CD704-803CD714 02A824 0010+00 2/2 0/0 0/0 .data __vt__20J2DAnmVisibilityFull */ +SECTION_DATA extern void* __vt__20J2DAnmVisibilityFull[4] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)__dt__20J2DAnmVisibilityFullFv, + (void*)searchUpdateMaterialID__10J2DAnmBaseFP9J2DScreen, +}; + +/* 803CD714-803CD728 02A834 0014+00 2/2 2/2 0/0 .data __vt__14J2DAnmVtxColor */ +SECTION_DATA extern void* __vt__14J2DAnmVtxColor[5] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)__dt__14J2DAnmVtxColorFv, + (void*)searchUpdateMaterialID__10J2DAnmBaseFP9J2DScreen, + (void*)getColor__14J2DAnmVtxColorCFUcUsP8_GXColor, +}; + +/* 804562F8-80456300 0048F8 0004+04 11/11 0/0 0/0 .sdata2 @1581 */ +SECTION_SDATA2 static f32 lit_1581[1 + 1 /* padding */] = { + 0.0f, + /* padding */ + 0.0f, +}; + +/* 80308A6C-80309290 3033AC 0824+00 0/0 26/26 2/2 .text load__20J2DAnmLoaderDataBaseFPCv + */ +void J2DAnmLoaderDataBase::load(void const* param_0) { + // NONMATCHING +} + +/* 80309290-803092AC 303BD0 001C+00 1/1 0/0 0/0 .text __ct__19J2DAnmKeyLoader_v15Fv */ +J2DAnmKeyLoader_v15::J2DAnmKeyLoader_v15() { + // NONMATCHING +} + +/* 803092AC-80309308 303BEC 005C+00 2/1 0/0 0/0 .text __dt__19J2DAnmKeyLoader_v15Fv */ +J2DAnmKeyLoader_v15::~J2DAnmKeyLoader_v15() { + // NONMATCHING +} + +/* 80309308-80309414 303C48 010C+00 2/1 0/0 0/0 .text load__19J2DAnmKeyLoader_v15FPCv */ +void J2DAnmKeyLoader_v15::load(void const* param_0) { + // NONMATCHING +} + +/* 80309414-80309570 303D54 015C+00 1/0 0/0 0/0 .text + * setResource__19J2DAnmKeyLoader_v15FP10J2DAnmBasePCv */ +void J2DAnmKeyLoader_v15::setResource(J2DAnmBase* param_0, void const* param_1) { + // NONMATCHING +} + +/* 80309570-80309598 303EB0 0028+00 1/1 0/0 0/0 .text + * readAnmTransform__19J2DAnmKeyLoader_v15FPC22J3DAnmTransformKeyData */ +void J2DAnmKeyLoader_v15::readAnmTransform(J3DAnmTransformKeyData const* param_0) { + // NONMATCHING +} + +/* 80309598-80309634 303ED8 009C+00 2/2 0/0 0/0 .text + * setAnmTransform__19J2DAnmKeyLoader_v15FP18J2DAnmTransformKeyPC22J3DAnmTransformKeyData */ +void J2DAnmKeyLoader_v15::setAnmTransform(J2DAnmTransformKey* param_0, + J3DAnmTransformKeyData const* param_1) { + // NONMATCHING +} + +/* 80309634-8030965C 303F74 0028+00 1/1 0/0 0/0 .text + * readAnmTextureSRT__19J2DAnmKeyLoader_v15FPC23J3DAnmTextureSRTKeyData */ +void J2DAnmKeyLoader_v15::readAnmTextureSRT(J3DAnmTextureSRTKeyData const* param_0) { + // NONMATCHING +} + +/* 8030965C-80309848 303F9C 01EC+00 2/2 0/0 0/0 .text + * setAnmTextureSRT__19J2DAnmKeyLoader_v15FP19J2DAnmTextureSRTKeyPC23J3DAnmTextureSRTKeyData */ +void J2DAnmKeyLoader_v15::setAnmTextureSRT(J2DAnmTextureSRTKey* param_0, + J3DAnmTextureSRTKeyData const* param_1) { + // NONMATCHING +} + +/* 80309848-80309870 304188 0028+00 1/1 0/0 0/0 .text + * readAnmColor__19J2DAnmKeyLoader_v15FPC18J3DAnmColorKeyData */ +void J2DAnmKeyLoader_v15::readAnmColor(J3DAnmColorKeyData const* param_0) { + // NONMATCHING +} + +/* 80309870-8030995C 3041B0 00EC+00 2/2 0/0 0/0 .text + * setAnmColor__19J2DAnmKeyLoader_v15FP14J2DAnmColorKeyPC18J3DAnmColorKeyData */ +void J2DAnmKeyLoader_v15::setAnmColor(J2DAnmColorKey* param_0, + J3DAnmColorKeyData const* param_1) { + // NONMATCHING +} + +/* 8030995C-80309984 30429C 0028+00 1/1 0/0 0/0 .text + * readAnmVtxColor__19J2DAnmKeyLoader_v15FPC21J3DAnmVtxColorKeyData */ +void J2DAnmKeyLoader_v15::readAnmVtxColor(J3DAnmVtxColorKeyData const* param_0) { + // NONMATCHING +} + +/* 80309984-80309A80 3042C4 00FC+00 2/2 0/0 0/0 .text + * setAnmVtxColor__19J2DAnmKeyLoader_v15FP17J2DAnmVtxColorKeyPC21J3DAnmVtxColorKeyData */ +void J2DAnmKeyLoader_v15::setAnmVtxColor(J2DAnmVtxColorKey* param_0, + J3DAnmVtxColorKeyData const* param_1) { + // NONMATCHING +} + +/* 80309A80-80309B8C 3043C0 010C+00 2/1 0/0 0/0 .text load__20J2DAnmFullLoader_v15FPCv */ +void J2DAnmFullLoader_v15::load(void const* param_0) { + // NONMATCHING +} + +/* 80309B8C-80309CE8 3044CC 015C+00 1/0 0/0 0/0 .text + * setResource__20J2DAnmFullLoader_v15FP10J2DAnmBasePCv */ +void J2DAnmFullLoader_v15::setResource(J2DAnmBase* param_0, void const* param_1) { + // NONMATCHING +} + +/* 80309CE8-80309D04 304628 001C+00 1/1 0/0 0/0 .text __ct__20J2DAnmFullLoader_v15Fv */ +J2DAnmFullLoader_v15::J2DAnmFullLoader_v15() { + // NONMATCHING +} + +/* 80309D04-80309D60 304644 005C+00 2/1 0/0 0/0 .text __dt__20J2DAnmFullLoader_v15Fv */ +J2DAnmFullLoader_v15::~J2DAnmFullLoader_v15() { + // NONMATCHING +} + +/* 80309D60-80309D88 3046A0 0028+00 1/1 0/0 0/0 .text + * readAnmTransform__20J2DAnmFullLoader_v15FPC23J3DAnmTransformFullData */ +void J2DAnmFullLoader_v15::readAnmTransform(J3DAnmTransformFullData const* param_0) { + // NONMATCHING +} + +/* 80309D88-80309E1C 3046C8 0094+00 2/2 0/0 0/0 .text + * setAnmTransform__20J2DAnmFullLoader_v15FP19J2DAnmTransformFullPC23J3DAnmTransformFullData */ +void J2DAnmFullLoader_v15::setAnmTransform(J2DAnmTransformFull* param_0, + J3DAnmTransformFullData const* param_1) { + // NONMATCHING +} + +/* 80309E1C-80309E44 30475C 0028+00 1/1 0/0 0/0 .text + * readAnmColor__20J2DAnmFullLoader_v15FPC19J3DAnmColorFullData */ +void J2DAnmFullLoader_v15::readAnmColor(J3DAnmColorFullData const* param_0) { + // NONMATCHING +} + +/* 80309E44-80309F10 304784 00CC+00 2/2 0/0 0/0 .text + * setAnmColor__20J2DAnmFullLoader_v15FP15J2DAnmColorFullPC19J3DAnmColorFullData */ +void J2DAnmFullLoader_v15::setAnmColor(J2DAnmColorFull* param_0, + J3DAnmColorFullData const* param_1) { + // NONMATCHING +} + +/* 80309F10-80309F38 304850 0028+00 1/1 0/0 0/0 .text + * readAnmTexPattern__20J2DAnmFullLoader_v15FPC24J3DAnmTexPatternFullData */ +void J2DAnmFullLoader_v15::readAnmTexPattern(J3DAnmTexPatternFullData const* param_0) { + // NONMATCHING +} + +/* 80309F38-80309FDC 304878 00A4+00 2/2 0/0 0/0 .text + * setAnmTexPattern__20J2DAnmFullLoader_v15FP16J2DAnmTexPatternPC24J3DAnmTexPatternFullData */ +void J2DAnmFullLoader_v15::setAnmTexPattern(J2DAnmTexPattern* param_0, + J3DAnmTexPatternFullData const* param_1) { + // NONMATCHING +} + +/* 80309FDC-8030A004 30491C 0028+00 1/1 0/0 0/0 .text + * readAnmTevReg__19J2DAnmKeyLoader_v15FPC19J3DAnmTevRegKeyData */ +void J2DAnmKeyLoader_v15::readAnmTevReg(J3DAnmTevRegKeyData const* param_0) { + // NONMATCHING +} + +/* 8030A004-8030A190 304944 018C+00 2/2 0/0 0/0 .text + * setAnmTevReg__19J2DAnmKeyLoader_v15FP15J2DAnmTevRegKeyPC19J3DAnmTevRegKeyData */ +void J2DAnmKeyLoader_v15::setAnmTevReg(J2DAnmTevRegKey* param_0, + J3DAnmTevRegKeyData const* param_1) { + // NONMATCHING +} + +/* 8030A190-8030A1B8 304AD0 0028+00 1/1 0/0 0/0 .text + * readAnmVisibility__20J2DAnmFullLoader_v15FPC24J3DAnmVisibilityFullData */ +void J2DAnmFullLoader_v15::readAnmVisibility(J3DAnmVisibilityFullData const* param_0) { + // NONMATCHING +} + +/* 8030A1B8-8030A234 304AF8 007C+00 2/2 0/0 0/0 .text + * setAnmVisibility__20J2DAnmFullLoader_v15FP20J2DAnmVisibilityFullPC24J3DAnmVisibilityFullData */ +void J2DAnmFullLoader_v15::setAnmVisibility(J2DAnmVisibilityFull* param_0, + J3DAnmVisibilityFullData const* param_1) { + // NONMATCHING +} + +/* 8030A234-8030A25C 304B74 0028+00 1/1 0/0 0/0 .text + * readAnmVtxColor__20J2DAnmFullLoader_v15FPC22J3DAnmVtxColorFullData */ +void J2DAnmFullLoader_v15::readAnmVtxColor(J3DAnmVtxColorFullData const* param_0) { + // NONMATCHING +} + +/* 8030A25C-8030A358 304B9C 00FC+00 2/2 0/0 0/0 .text + * setAnmVtxColor__20J2DAnmFullLoader_v15FP18J2DAnmVtxColorFullPC22J3DAnmVtxColorFullData */ +void J2DAnmFullLoader_v15::setAnmVtxColor(J2DAnmVtxColorFull* param_0, + J3DAnmVtxColorFullData const* param_1) { + // NONMATCHING +} + +/* 8030A358-8030A3B4 304C98 005C+00 1/0 0/0 0/0 .text __dt__14J2DAnmVtxColorFv */ +J2DAnmVtxColor::~J2DAnmVtxColor() { + // NONMATCHING +} + +/* 8030A3B4-8030A410 304CF4 005C+00 1/0 0/0 0/0 .text __dt__20J2DAnmVisibilityFullFv */ +J2DAnmVisibilityFull::~J2DAnmVisibilityFull() { + // NONMATCHING +} + +/* 8030A410-8030A458 304D50 0048+00 1/0 0/0 0/0 .text __dt__12J2DAnmLoaderFv */ +J2DAnmLoader::~J2DAnmLoader() { + // NONMATCHING +} + +/* 8030A458-8030A470 304D98 0018+00 1/1 1/1 0/0 .text + * JSUConvertOffsetToPtr<25J3DAnmVisibilityFullTable>__FPCvPCv */ +extern "C" void func_8030A458(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A470-8030A488 304DB0 0018+00 1/1 1/1 0/0 .text + * JSUConvertOffsetToPtr<18J3DAnmKRegKeyTable>__FPCvPCv */ +extern "C" void func_8030A470(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A488-8030A4A0 304DC8 0018+00 1/1 1/1 0/0 .text + * JSUConvertOffsetToPtr<18J3DAnmCRegKeyTable>__FPCvPCv */ +extern "C" void func_8030A488(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A4A0-8030A4B8 304DE0 0018+00 1/1 1/1 0/0 .text + * JSUConvertOffsetToPtr<25J3DAnmTexPatternFullTable>__FPCvPCv */ +extern "C" void func_8030A4A0(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A4B8-8030A4D0 304DF8 0018+00 2/2 2/2 0/0 .text + * JSUConvertOffsetToPtr<20J3DAnmColorFullTable>__FPCvPCv */ +extern "C" void func_8030A4B8(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A4D0-8030A4E8 304E10 0018+00 1/1 1/1 0/0 .text + * JSUConvertOffsetToPtr<24J3DAnmTransformFullTable>__FPCvPCv */ +extern "C" void func_8030A4D0(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A4E8-8030A500 304E28 0018+00 2/2 2/2 0/0 .text + * JSUConvertOffsetToPtr<23J3DAnmVtxColorIndexData>__FPCvPCv */ +extern "C" void func_8030A4E8(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A500-8030A518 304E40 0018+00 2/2 2/2 0/0 .text + * JSUConvertOffsetToPtr<19J3DAnmColorKeyTable>__FPCvPCv */ +extern "C" void func_8030A500(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A518-8030A530 304E58 0018+00 1/1 1/1 0/0 .text JSUConvertOffsetToPtr<3Vec>__FPCvPCv */ +extern "C" void func_8030A518(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A530-8030A548 304E70 0018+00 5/5 16/16 0/0 .text JSUConvertOffsetToPtr<7ResNTAB>__FPCvPCv + */ +extern "C" void func_8030A530(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A548-8030A560 304E88 0018+00 6/6 6/6 0/0 .text JSUConvertOffsetToPtr<s>__FPCvPCv + */ +extern "C" void func_8030A548(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A560-8030A578 304EA0 0018+00 3/3 7/7 0/0 .text JSUConvertOffsetToPtr<f>__FPCvPCv + */ +extern "C" void func_8030A560(void const* param_0, void const* param_1) { + // NONMATCHING +} + +/* 8030A578-8030A590 304EB8 0018+00 2/2 2/2 0/0 .text + * JSUConvertOffsetToPtr<23J3DAnmTransformKeyTable>__FPCvPCv */ +extern "C" void func_8030A578(void const* param_0, void const* param_1) { + // NONMATCHING +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DAnmLoader_nonmatching.cpp b/src/JSystem/J2DGraph/J2DAnmLoader_nonmatching.cpp new file mode 100644 index 0000000000..70c6e1294f --- /dev/null +++ b/src/JSystem/J2DGraph/J2DAnmLoader_nonmatching.cpp @@ -0,0 +1,550 @@ +// +// Generated By: dol2asm +// Translation Unit: J2DAnmLoader +// + +// this should match with -sym on and once J2DMaterialFactory is done +// JSUConvertOffsetToPtr<u16> needs to be emitted in J2DMaterialFactory before its used here + +#include "JSystem/J2DGraph/J2DAnmLoader.h" +#include "JSystem/JSupport/JSupport.h" + +// +// Types: +// + +/* 80308A6C-80309290 3033AC 0824+00 0/0 26/26 2/2 .text load__20J2DAnmLoaderDataBaseFPCv + */ +J2DAnmBase* J2DAnmLoaderDataBase::load(void const* p_data) { + const J3DAnmDataHeader* hdr = (const J3DAnmDataHeader*)p_data; + + if (hdr == NULL) { + return NULL; + } else if (hdr->mMagic == 'J3D1') { + switch (hdr->mType) { + case 'bck1': { + J2DAnmKeyLoader_v15 loader; + loader.mpResource = new J2DAnmTransformKey(); + return (J2DAnmBase*)loader.load(p_data); + break; + } + case 'bpk1': { + J2DAnmKeyLoader_v15 loader; + loader.mpResource = new J2DAnmColorKey(); + return (J2DAnmBase*)loader.load(p_data); + break; + } + case 'blk1': + return NULL; + case 'btk1': { + J2DAnmKeyLoader_v15 loader; + loader.mpResource = new J2DAnmTextureSRTKey(); + return (J2DAnmBase*)loader.load(p_data); + break; + } + case 'brk1': { + J2DAnmKeyLoader_v15 loader; + loader.mpResource = new J2DAnmTevRegKey(); + return (J2DAnmBase*)loader.load(p_data); + break; + } + case 'bxk1': { + J2DAnmKeyLoader_v15 loader; + loader.mpResource = new J2DAnmVtxColorKey(); + return (J2DAnmBase*)loader.load(p_data); + break; + } + case 'bca1': { + J2DAnmFullLoader_v15 loader; + loader.mpResource = new J2DAnmTransformFull(); + return (J2DAnmBase*)loader.load(p_data); + break; + } + case 'bpa1': { + J2DAnmFullLoader_v15 loader; + loader.mpResource = new J2DAnmColorFull(); + return (J2DAnmBase*)loader.load(p_data); + break; + } + case 'btp1': { + J2DAnmFullLoader_v15 loader; + loader.mpResource = new J2DAnmTexPattern(); + return (J2DAnmBase*)loader.load(p_data); + } + case 'bva1': { + J2DAnmFullLoader_v15 loader; + loader.mpResource = new J2DAnmVisibilityFull(); + return (J2DAnmBase*)loader.load(p_data); + break; + } + case 'bla1': + return NULL; + case 'bxa1': { + J2DAnmFullLoader_v15 loader; + loader.mpResource = new J2DAnmVtxColorFull(); + return (J2DAnmBase*)loader.load(p_data); + } + } + return NULL; + } else { + return NULL; + } +} + +/* 80309290-803092AC 303BD0 001C+00 1/1 0/0 0/0 .text __ct__19J2DAnmKeyLoader_v15Fv */ +J2DAnmKeyLoader_v15::J2DAnmKeyLoader_v15() {} + +/* 803092AC-80309308 303BEC 005C+00 2/1 0/0 0/0 .text __dt__19J2DAnmKeyLoader_v15Fv */ +J2DAnmKeyLoader_v15::~J2DAnmKeyLoader_v15() {} + +/* 80309308-80309414 303C48 010C+00 2/1 0/0 0/0 .text load__19J2DAnmKeyLoader_v15FPCv */ +void* J2DAnmKeyLoader_v15::load(void const* p_data) { + const J3DAnmDataHeader* hdr = (const J3DAnmDataHeader*)p_data; + const J3DAnmDataBlockHeader* dataPtr = &hdr->mFirst; + + for (s32 i = 0; i < hdr->mCount; i++) { + switch (dataPtr->mType) { + case 'ANK1': + readAnmTransform((J3DAnmTransformKeyData*)dataPtr); + break; + case 'PAK1': + readAnmColor((J3DAnmColorKeyData*)dataPtr); + break; + case 'TTK1': + readAnmTextureSRT((J3DAnmTextureSRTKeyData*)dataPtr); + break; + case 'VCK1': + readAnmVtxColor((J3DAnmVtxColorKeyData*)dataPtr); + break; + case 'TRK1': + readAnmTevReg((J3DAnmTevRegKeyData*)dataPtr); + break; + } + dataPtr = (J3DAnmDataBlockHeader*)((s32)dataPtr + dataPtr->mNextOffset); + } + + return mpResource; +} + +/* 80309414-80309570 303D54 015C+00 1/0 0/0 0/0 .text + * setResource__19J2DAnmKeyLoader_v15FP10J2DAnmBasePCv */ +void J2DAnmKeyLoader_v15::setResource(J2DAnmBase* p_anm, void const* p_data) { + const J3DAnmDataHeader* hdr = (const J3DAnmDataHeader*)p_data; + const J3DAnmDataBlockHeader* dataPtr = &hdr->mFirst; + + for (s32 i = 0; i < hdr->mCount; i++) { + switch (dataPtr->mType) { + case 'ANK1': + if (p_anm->getKind() == KIND_TRANSFORM) { + setAnmTransform((J2DAnmTransformKey*)p_anm, (J3DAnmTransformKeyData*)dataPtr); + } + break; + case 'PAK1': + if (p_anm->getKind() == KIND_COLOR) { + setAnmColor((J2DAnmColorKey*)p_anm, (J3DAnmColorKeyData*)dataPtr); + } + break; + case 'TTK1': + if (p_anm->getKind() == KIND_TEXTURE_SRT) { + setAnmTextureSRT((J2DAnmTextureSRTKey*)p_anm, + (J3DAnmTextureSRTKeyData*)dataPtr); + } + break; + case 'TRK1': + if (p_anm->getKind() == KIND_TEV_REG) { + setAnmTevReg((J2DAnmTevRegKey*)p_anm, (J3DAnmTevRegKeyData*)dataPtr); + } + break; + case 'VCK1': + if (p_anm->getKind() == KIND_VTX_COLOR) { + setAnmVtxColor((J2DAnmVtxColorKey*)p_anm, (J3DAnmVtxColorKeyData*)dataPtr); + } + break; + } + dataPtr = (J3DAnmDataBlockHeader*)((s32)dataPtr + dataPtr->mNextOffset); + } +} + +/* 80309570-80309598 303EB0 0028+00 1/1 0/0 0/0 .text + * readAnmTransform__19J2DAnmKeyLoader_v15FPC22J3DAnmTransformKeyData */ +void J2DAnmKeyLoader_v15::readAnmTransform(J3DAnmTransformKeyData const* p_data) { + setAnmTransform((J2DAnmTransformKey*)mpResource, p_data); +} + +/* 80309598-80309634 303ED8 009C+00 2/2 0/0 0/0 .text + * setAnmTransform__19J2DAnmKeyLoader_v15FP18J2DAnmTransformKeyPC22J3DAnmTransformKeyData */ +void J2DAnmKeyLoader_v15::setAnmTransform(J2DAnmTransformKey* p_anm, + J3DAnmTransformKeyData const* p_data) { + p_anm->field_0x22 = p_data->field_0xc; + p_anm->mFrameMax = p_data->mFrameMax; + p_anm->field_0x4 = p_data->field_0x8; + p_anm->field_0x24 = p_data->field_0x9; + p_anm->mFrame = 0; + p_anm->mInfoTable = + JSUConvertOffsetToPtr<J3DAnmTransformKeyTable>(p_data, (void*)p_data->mTableOffset); + p_anm->mScaleValues = JSUConvertOffsetToPtr<f32>(p_data, (void*)p_data->field_0x18); + p_anm->mRotationValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->field_0x1c); + p_anm->mTranslateValues = + JSUConvertOffsetToPtr<f32>(p_data, (void*)p_data->field_0x20); +} + +/* 80309634-8030965C 303F74 0028+00 1/1 0/0 0/0 .text + * readAnmTextureSRT__19J2DAnmKeyLoader_v15FPC23J3DAnmTextureSRTKeyData */ +void J2DAnmKeyLoader_v15::readAnmTextureSRT(J3DAnmTextureSRTKeyData const* p_data) { + setAnmTextureSRT((J2DAnmTextureSRTKey*)mpResource, p_data); +} + +/* 8030965C-80309848 303F9C 01EC+00 2/2 0/0 0/0 .text + * setAnmTextureSRT__19J2DAnmKeyLoader_v15FP19J2DAnmTextureSRTKeyPC23J3DAnmTextureSRTKeyData */ +void J2DAnmKeyLoader_v15::setAnmTextureSRT(J2DAnmTextureSRTKey* p_anm, + J3DAnmTextureSRTKeyData const* p_data) { + p_anm->mUpdateMaterialNum = p_data->field_0xc; + p_anm->mFrameMax = p_data->field_0xa; + p_anm->field_0x4 = p_data->field_0x8; + p_anm->field_0x10 = p_data->field_0x9; + p_anm->mFrame = 0; + p_anm->mUpdateMaterialNum = p_data->field_0xc; + p_anm->field_0x1a = p_data->field_0xe; + p_anm->field_0x1c = p_data->field_0x10; + p_anm->field_0x1e = p_data->field_0x12; + p_anm->mInfoTable = + JSUConvertOffsetToPtr<J3DAnmTransformKeyTable>(p_data, (void*)p_data->mTableOffset); + p_anm->mUpdateMaterialID = JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->mUpdateMatIDOffset); + p_anm->field_0x34.setResource( + JSUConvertOffsetToPtr<ResNTAB>(p_data, (void*)p_data->mNameTab1Offset)); + p_anm->mUpdateTexMtxID = JSUConvertOffsetToPtr<u8>(p_data, p_data->mUpdateTexMtxIDOffset); + p_anm->field_0x44 = JSUConvertOffsetToPtr<Vec>(p_data, (void*)p_data->unkOffset); + p_anm->mScaleValues = JSUConvertOffsetToPtr<f32>(p_data, (void*)p_data->mScaleValOffset); + p_anm->mRotationValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mRotValOffset); + p_anm->mTranslationValues = JSUConvertOffsetToPtr<f32>(p_data, (void*)p_data->mTransValOffset); + if (p_data->mNameTab2Offset != 0) { + p_anm->field_0x68.setResource( + JSUConvertOffsetToPtr<ResNTAB>(p_data, (void*)p_data->mNameTab2Offset)); + } + p_anm->field_0x4e = p_data->field_0x34; + p_anm->field_0x48 = p_data->field_0x36; + p_anm->field_0x4a = p_data->field_0x38; + p_anm->field_0x4c = p_data->field_0x3a; + p_anm->field_0x5c = + JSUConvertOffsetToPtr<J3DAnmTransformKeyTable>(p_data, (void*)p_data->mInfoTable2Offset); + p_anm->field_0x64 = JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->field_0x40); + p_anm->field_0x60 = JSUConvertOffsetToPtr<u8>(p_data, p_data->field_0x48); + p_anm->field_0x78 = JSUConvertOffsetToPtr<Vec>(p_data, (void*)p_data->field_0x4c); + p_anm->field_0x50 = JSUConvertOffsetToPtr<f32>(p_data, (void*)p_data->field_0x50); + p_anm->field_0x54 = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->field_0x54); + p_anm->field_0x58 = JSUConvertOffsetToPtr<f32>(p_data, (void*)p_data->field_0x58); + switch (p_data->field_0x5c) { + case 0: + p_anm->field_0x7c = 0; + break; + case 1: + p_anm->field_0x7c = 1; + break; + default: + p_anm->field_0x7c = 0; + break; + } +} + +/* 80309848-80309870 304188 0028+00 1/1 0/0 0/0 .text + * readAnmColor__19J2DAnmKeyLoader_v15FPC18J3DAnmColorKeyData */ +void J2DAnmKeyLoader_v15::readAnmColor(J3DAnmColorKeyData const* p_data) { + setAnmColor((J2DAnmColorKey*)mpResource, p_data); +} + +/* 80309870-8030995C 3041B0 00EC+00 2/2 0/0 0/0 .text + * setAnmColor__19J2DAnmKeyLoader_v15FP14J2DAnmColorKeyPC18J3DAnmColorKeyData */ +void J2DAnmKeyLoader_v15::setAnmColor(J2DAnmColorKey* p_anm, J3DAnmColorKeyData const* p_data) { + p_anm->mFrameMax = p_data->mFrameMax; + p_anm->field_0x4 = p_data->field_0x8; + p_anm->mFrame = 0; + p_anm->mUpdateMaterialNum = p_data->mUpdateMaterialNum; + p_anm->field_0x10 = p_data->field_0x10; + p_anm->field_0x12 = p_data->field_0x12; + p_anm->field_0x14 = p_data->field_0x14; + p_anm->field_0x16 = p_data->field_0x16; + p_anm->mInfoTable = + JSUConvertOffsetToPtr<J3DAnmColorKeyTable>(p_data, (void*)p_data->mTableOffset); + p_anm->mRValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mRValOffset); + p_anm->mGValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mGValOffset); + p_anm->mBValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mBValOffset); + p_anm->mAValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mAValOffset); + p_anm->mUpdateMaterialID = + JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->mUpdateMaterialIDOffset); + p_anm->field_0x20.setResource( + JSUConvertOffsetToPtr<ResNTAB>(p_data, (void*)p_data->mNameTabOffset)); +} + +/* 8030995C-80309984 30429C 0028+00 1/1 0/0 0/0 .text + * readAnmVtxColor__19J2DAnmKeyLoader_v15FPC21J3DAnmVtxColorKeyData */ +void J2DAnmKeyLoader_v15::readAnmVtxColor(J3DAnmVtxColorKeyData const* p_data) { + setAnmVtxColor((J2DAnmVtxColorKey*)mpResource, p_data); +} + +/* 80309984-80309A80 3042C4 00FC+00 2/2 0/0 0/0 .text + * setAnmVtxColor__19J2DAnmKeyLoader_v15FP17J2DAnmVtxColorKeyPC21J3DAnmVtxColorKeyData */ +void J2DAnmKeyLoader_v15::setAnmVtxColor(J2DAnmVtxColorKey* p_anm, + J3DAnmVtxColorKeyData const* p_data) { + p_anm->mFrameMax = p_data->mFrameMax; + p_anm->field_0x4 = p_data->field_0x8; + p_anm->mFrame = 0; + p_anm->mAnmTableNum[0] = p_data->mAnmTableNum[0]; + p_anm->mAnmTableNum[1] = p_data->mAnmTableNum[1]; + p_anm->mInfoTable[0] = + JSUConvertOffsetToPtr<J3DAnmColorKeyTable>(p_data, (void*)p_data->mTableOffsets[0]); + p_anm->mInfoTable[1] = + JSUConvertOffsetToPtr<J3DAnmColorKeyTable>(p_data, (void*)p_data->mTableOffsets[1]); + p_anm->mVtxColorIndexData[0] = JSUConvertOffsetToPtr<J3DAnmVtxColorIndexData>( + p_data, (void*)p_data->mVtxColoIndexDataOffset[0]); + p_anm->mVtxColorIndexData[1] = JSUConvertOffsetToPtr<J3DAnmVtxColorIndexData>( + p_data, (void*)p_data->mVtxColoIndexDataOffset[1]); + p_anm->mVtxColorIndexPointer[0] = + JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->mVtxColoIndexPointerOffset[0]); + p_anm->mVtxColorIndexPointer[1] = + JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->mVtxColoIndexPointerOffset[1]); + p_anm->mRValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mRValOffset); + p_anm->mGValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mGValOffset); + p_anm->mBValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mBValOffset); + p_anm->mAValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mAValOffset); +} + +/* 80309A80-80309B8C 3043C0 010C+00 2/1 0/0 0/0 .text load__20J2DAnmFullLoader_v15FPCv */ +void* J2DAnmFullLoader_v15::load(void const* p_data) { + const J3DAnmDataHeader* hdr = (const J3DAnmDataHeader*)p_data; + const J3DAnmDataBlockHeader* dataPtr = &hdr->mFirst; + + for (s32 i = 0; i < hdr->mCount; i++) { + switch (dataPtr->mType) { + case 'ANF1': + readAnmTransform((J3DAnmTransformFullData*)dataPtr); + break; + case 'PAF1': + readAnmColor((J3DAnmColorFullData*)dataPtr); + break; + case 'TPT1': + readAnmTexPattern((J3DAnmTexPatternFullData*)dataPtr); + break; + case 'VAF1': + readAnmVisibility((J3DAnmVisibilityFullData*)dataPtr); + break; + case 'VCF1': + readAnmVtxColor((J3DAnmVtxColorFullData*)dataPtr); + break; + } + dataPtr = (J3DAnmDataBlockHeader*)((s32)dataPtr + dataPtr->mNextOffset); + } + return mpResource; +} + +/* 80309B8C-80309CE8 3044CC 015C+00 1/0 0/0 0/0 .text + * setResource__20J2DAnmFullLoader_v15FP10J2DAnmBasePCv */ +void J2DAnmFullLoader_v15::setResource(J2DAnmBase* p_anm, void const* p_data) { + const J3DAnmDataHeader* hdr = (const J3DAnmDataHeader*)p_data; + const J3DAnmDataBlockHeader* dataPtr = &hdr->mFirst; + + for (s32 i = 0; i < hdr->mCount; i++) { + switch (dataPtr->mType) { + case 'ANF1': + if (p_anm->getKind() == KIND_TRANSFORM) + setAnmTransform((J2DAnmTransformFull*)p_anm, + (J3DAnmTransformFullData*)dataPtr); + break; + case 'PAF1': + if (p_anm->getKind() == KIND_COLOR) + setAnmColor((J2DAnmColorFull*)p_anm, (J3DAnmColorFullData*)dataPtr); + break; + case 'TPT1': + if (p_anm->getKind() == KIND_TEX_PATTERN) + setAnmTexPattern((J2DAnmTexPattern*)p_anm, (J3DAnmTexPatternFullData*)dataPtr); + break; + case 'VAF1': + if (p_anm->getKind() == KIND_VISIBILITY) + setAnmVisibility((J2DAnmVisibilityFull*)p_anm, + (J3DAnmVisibilityFullData*)dataPtr); + break; + case 'VCF1': + if (p_anm->getKind() == KIND_VTX_COLOR) + setAnmVtxColor((J2DAnmVtxColorFull*)p_anm, (J3DAnmVtxColorFullData*)dataPtr); + break; + } + dataPtr = (J3DAnmDataBlockHeader*)((s32)dataPtr + dataPtr->mNextOffset); + } +} + +/* 80309CE8-80309D04 304628 001C+00 1/1 0/0 0/0 .text __ct__20J2DAnmFullLoader_v15Fv */ +J2DAnmFullLoader_v15::J2DAnmFullLoader_v15() {} + +/* 80309D04-80309D60 304644 005C+00 2/1 0/0 0/0 .text __dt__20J2DAnmFullLoader_v15Fv */ +J2DAnmFullLoader_v15::~J2DAnmFullLoader_v15() {} + +/* 80309D60-80309D88 3046A0 0028+00 1/1 0/0 0/0 .text + * readAnmTransform__20J2DAnmFullLoader_v15FPC23J3DAnmTransformFullData */ +void J2DAnmFullLoader_v15::readAnmTransform(J3DAnmTransformFullData const* p_data) { + setAnmTransform((J2DAnmTransformFull*)mpResource, p_data); +} + +/* 80309D88-80309E1C 3046C8 0094+00 2/2 0/0 0/0 .text + * setAnmTransform__20J2DAnmFullLoader_v15FP19J2DAnmTransformFullPC23J3DAnmTransformFullData */ +void J2DAnmFullLoader_v15::setAnmTransform(J2DAnmTransformFull* p_anm, + J3DAnmTransformFullData const* p_data) { + p_anm->field_0x22 = p_data->field_0xc; + p_anm->mFrameMax = p_data->mFrameMax; + p_anm->field_0x4 = p_data->field_0x8; + p_anm->mFrame = 0; + p_anm->mTableInfo = + JSUConvertOffsetToPtr<J3DAnmTransformFullTable>(p_data, (void*)p_data->mTableOffset); + p_anm->mScaleValues = JSUConvertOffsetToPtr<f32>(p_data, (void*)p_data->mScaleValOffset); + p_anm->mRotationValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mRotValOffset); + p_anm->mTranslateValues = JSUConvertOffsetToPtr<f32>(p_data, (void*)p_data->mTransValOffset); +} + +/* 80309E1C-80309E44 30475C 0028+00 1/1 0/0 0/0 .text + * readAnmColor__20J2DAnmFullLoader_v15FPC19J3DAnmColorFullData */ +void J2DAnmFullLoader_v15::readAnmColor(J3DAnmColorFullData const* p_data) { + setAnmColor((J2DAnmColorFull*)mpResource, p_data); +} + +/* 80309E44-80309F10 304784 00CC+00 2/2 0/0 0/0 .text + * setAnmColor__20J2DAnmFullLoader_v15FP15J2DAnmColorFullPC19J3DAnmColorFullData */ +void J2DAnmFullLoader_v15::setAnmColor(J2DAnmColorFull* p_anm, J3DAnmColorFullData const* p_data) { + p_anm->mFrameMax = p_data->mFrameMax; + p_anm->field_0x4 = p_data->field_0x8; + p_anm->mFrame = 0; + p_anm->mUpdateMaterialNum = p_data->mUpdateMaterialNum; + p_anm->mInfoTable = + JSUConvertOffsetToPtr<J3DAnmColorFullTable>(p_data, (void*)p_data->mTableOffset); + p_anm->mRValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mRValuesOffset); + p_anm->mGValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mGValuesOffset); + p_anm->mBValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mBValuesOffset); + p_anm->mAValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mAValuesOffset); + p_anm->mUpdateMaterialID = + JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->mUpdateMaterialIDOffset); + p_anm->field_0x20.setResource( + JSUConvertOffsetToPtr<ResNTAB>(p_data, (void*)p_data->mNameTabOffset)); +} + +/* 80309F10-80309F38 304850 0028+00 1/1 0/0 0/0 .text + * readAnmTexPattern__20J2DAnmFullLoader_v15FPC24J3DAnmTexPatternFullData */ +void J2DAnmFullLoader_v15::readAnmTexPattern(J3DAnmTexPatternFullData const* p_data) { + setAnmTexPattern((J2DAnmTexPattern*)mpResource, p_data); +} + +/* 80309F38-80309FDC 304878 00A4+00 2/2 0/0 0/0 .text + * setAnmTexPattern__20J2DAnmFullLoader_v15FP16J2DAnmTexPatternPC24J3DAnmTexPatternFullData */ +void J2DAnmFullLoader_v15::setAnmTexPattern(J2DAnmTexPattern* p_anm, + J3DAnmTexPatternFullData const* p_data) { + p_anm->mFrameMax = p_data->mFrameMax; + p_anm->field_0x4 = p_data->field_0x8; + p_anm->mFrame = 0; + p_anm->mUpdateMaterialNum = p_data->field_0xc; + p_anm->field_0x18 = p_data->field_0xe; + p_anm->mAnmTable = + JSUConvertOffsetToPtr<J3DAnmTexPatternFullTable>(p_data, (void*)p_data->mTableOffset); + p_anm->mValues = JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->mValuesOffset); + p_anm->mUpdateMaterialID = + JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->mUpdateMaterialIDOffset); + p_anm->field_0x20.setResource( + JSUConvertOffsetToPtr<ResNTAB>(p_data, (void*)p_data->mNameTabOffset)); +} + +/* 80309FDC-8030A004 30491C 0028+00 1/1 0/0 0/0 .text + * readAnmTevReg__19J2DAnmKeyLoader_v15FPC19J3DAnmTevRegKeyData */ +void J2DAnmKeyLoader_v15::readAnmTevReg(J3DAnmTevRegKeyData const* p_data) { + setAnmTevReg((J2DAnmTevRegKey*)mpResource, p_data); +} + +/* 8030A004-8030A190 304944 018C+00 2/2 0/0 0/0 .text + * setAnmTevReg__19J2DAnmKeyLoader_v15FP15J2DAnmTevRegKeyPC19J3DAnmTevRegKeyData */ +void J2DAnmKeyLoader_v15::setAnmTevReg(J2DAnmTevRegKey* p_anm, J3DAnmTevRegKeyData const* p_data) { + p_anm->mFrameMax = p_data->mFrameMax; + p_anm->field_0x4 = p_data->field_0x8; + p_anm->mFrame = 0; + p_anm->mCRegUpdateMaterialNum = p_data->mCRegUpdateMaterialNum; + p_anm->mAnmCRegKeyTable = + JSUConvertOffsetToPtr<J3DAnmCRegKeyTable>(p_data, (void*)p_data->mCRegTableOffset); + p_anm->mCRegUpdateMaterialID = + JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->mCRegUpdateMaterialIDOffset); + p_anm->mCRegNameTab.setResource( + JSUConvertOffsetToPtr<ResNTAB>(p_data, (void*)p_data->mCRegNameTabOffset)); + p_anm->mKRegUpdateMaterialNum = p_data->mKRegUpdateMaterialNum; + p_anm->mAnmKRegKeyTable = + JSUConvertOffsetToPtr<J3DAnmKRegKeyTable>(p_data, (void*)p_data->mKRegTableOffset); + p_anm->mKRegUpdateMaterialID = + JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->mKRegUpdateMaterialIDOffset); + p_anm->mKRegNameTab.setResource( + JSUConvertOffsetToPtr<ResNTAB>(p_data, (void*)p_data->mKRegNameTabOffset)); + p_anm->field_0x14 = p_data->field_0x10; + p_anm->field_0x16 = p_data->field_0x12; + p_anm->field_0x18 = p_data->field_0x14; + p_anm->field_0x1a = p_data->field_0x16; + p_anm->mCRValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mCRValuesOffset); + p_anm->mCGValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mCGValuesOffset); + p_anm->mCBValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mCBValuesOffset); + p_anm->mCAValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mCAValuesOffset); + p_anm->field_0x1c = p_data->field_0x18; + p_anm->field_0x1e = p_data->field_0x1a; + p_anm->field_0x20 = p_data->field_0x1c; + p_anm->field_0x22 = p_data->field_0x1e; + p_anm->mKRValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mKRValuesOffset); + p_anm->mKGValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mKGValuesOffset); + p_anm->mKBValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mKBValuesOffset); + p_anm->mKAValues = JSUConvertOffsetToPtr<s16>(p_data, (void*)p_data->mKAValuesOffset); +} + +/* 8030A190-8030A1B8 304AD0 0028+00 1/1 0/0 0/0 .text + * readAnmVisibility__20J2DAnmFullLoader_v15FPC24J3DAnmVisibilityFullData */ +void J2DAnmFullLoader_v15::readAnmVisibility(J3DAnmVisibilityFullData const* p_data) { + setAnmVisibility((J2DAnmVisibilityFull*)mpResource, p_data); +} + +/* 8030A1B8-8030A234 304AF8 007C+00 2/2 0/0 0/0 .text + * setAnmVisibility__20J2DAnmFullLoader_v15FP20J2DAnmVisibilityFullPC24J3DAnmVisibilityFullData */ +void J2DAnmFullLoader_v15::setAnmVisibility(J2DAnmVisibilityFull* p_anm, + J3DAnmVisibilityFullData const* p_data) { + p_anm->mFrameMax = p_data->mFrameMax; + p_anm->field_0x4 = p_data->field_0x8; + p_anm->mFrame = 0; + p_anm->field_0x10 = p_data->field_0xc; + p_anm->field_0x12 = p_data->field_0xe; + p_anm->mTable = + JSUConvertOffsetToPtr<J3DAnmVisibilityFullTable>(p_data, (void*)p_data->mTableOffset); + p_anm->mValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mValuesOffset); +} + +/* 8030A234-8030A25C 304B74 0028+00 1/1 0/0 0/0 .text + * readAnmVtxColor__20J2DAnmFullLoader_v15FPC22J3DAnmVtxColorFullData */ +void J2DAnmFullLoader_v15::readAnmVtxColor(J3DAnmVtxColorFullData const* p_data) { + setAnmVtxColor((J2DAnmVtxColorFull*)mpResource, p_data); +} + +/* 8030A25C-8030A358 304B9C 00FC+00 2/2 0/0 0/0 .text + * setAnmVtxColor__20J2DAnmFullLoader_v15FP18J2DAnmVtxColorFullPC22J3DAnmVtxColorFullData */ +void J2DAnmFullLoader_v15::setAnmVtxColor(J2DAnmVtxColorFull* p_anm, + J3DAnmVtxColorFullData const* p_data) { + p_anm->mFrameMax = p_data->mFrameMax; + p_anm->field_0x4 = p_data->field_0x8; + p_anm->mFrame = 0; + p_anm->mAnmTableNum[0] = p_data->mAnmTableNum[0]; + p_anm->mAnmTableNum[1] = p_data->mAnmTableNum[1]; + p_anm->mInfoTable[0] = + JSUConvertOffsetToPtr<J3DAnmColorFullTable>(p_data, (void*)p_data->mTableOffsets[0]); + p_anm->mInfoTable[1] = + JSUConvertOffsetToPtr<J3DAnmColorFullTable>(p_data, (void*)p_data->mTableOffsets[1]); + p_anm->mVtxColorIndexData[0] = JSUConvertOffsetToPtr<J3DAnmVtxColorIndexData>( + p_data, (void*)p_data->mVtxColorIndexDataOffsets[0]); + p_anm->mVtxColorIndexData[1] = JSUConvertOffsetToPtr<J3DAnmVtxColorIndexData>( + p_data, (void*)p_data->mVtxColorIndexDataOffsets[1]); + p_anm->mVtxColorIndexPointer[0] = + JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->mVtxColorIndexPointerOffsets[0]); + p_anm->mVtxColorIndexPointer[1] = + JSUConvertOffsetToPtr<u16>(p_data, (void*)p_data->mVtxColorIndexPointerOffsets[1]); + p_anm->mRValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mRValuesOffset); + p_anm->mGValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mGValuesOffset); + p_anm->mBValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mBValuesOffset); + p_anm->mAValues = JSUConvertOffsetToPtr<u8>(p_data, p_data->mAValuesOffset); +} + +/* 8030A358-8030A3B4 304C98 005C+00 1/0 0/0 0/0 .text __dt__14J2DAnmVtxColorFv */ +// J2DAnmVtxColor::~J2DAnmVtxColor() {} +/* 8030A3B4-8030A410 304CF4 005C+00 1/0 0/0 0/0 .text __dt__20J2DAnmVisibilityFullFv */ +// J2DAnmVisibilityFull::~J2DAnmVisibilityFull() {}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DGrafContext.cpp b/src/JSystem/J2DGraph/J2DGrafContext.cpp new file mode 100644 index 0000000000..505ed21c5b --- /dev/null +++ b/src/JSystem/J2DGraph/J2DGrafContext.cpp @@ -0,0 +1,205 @@ +#include "JSystem/J2DGraph/J2DGrafContext.h" +#include "dolphin/gx.h" + +/* 802E8B08-802E8BB4 2E3448 00AC+00 0/0 2/2 0/0 .text __ct__14J2DGrafContextFffff */ +J2DGrafContext::J2DGrafContext(f32 x, f32 y, f32 width, f32 height) + : mBounds(x, y, x + width, y + height), mScissorBounds(x, y, x + width, y + height) { + JUtility::TColor color(-1); + setColor(color); + setLineWidth(6); +} + +/* 802E8BB4-802E8C44 2E34F4 0090+00 1/0 1/1 0/0 .text setPort__14J2DGrafContextFv */ +void J2DGrafContext::setPort() { + setScissor(); + setup2D(); + + JGeometry::TBox2<float> bounds(mBounds); + + if (bounds.i.x < 0.0f) { + bounds.i.x = 0.0f; + } + if (bounds.i.y < 0.0f) { + bounds.i.y = 0.0f; + } + GXSetViewport(bounds.i.x, bounds.i.y, bounds.getWidth(), bounds.getHeight(), 0.0f, 1.0f); +} + +/* 802E8C44-802E8E20 2E3584 01DC+00 1/0 1/0 0/0 .text setup2D__14J2DGrafContextFv */ +void J2DGrafContext::setup2D() { + GXSetNumIndStages(0); + for (int i = 0; i < GX_MAX_TEVSTAGE; i++) { + GXSetTevDirect((GXTevStageID)i); + } + GXSetZCompLoc(GX_FALSE); + GXSetAlphaCompare(GX_GREATER, 0, GX_AOP_OR, GX_GREATER, 0); + GXSetZMode(GX_FALSE, GX_LEQUAL, GX_FALSE); + GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); + GXSetNumChans(1); + GXSetNumTevStages(1); + GXSetNumTexGens(0); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetCullMode(GX_CULL_NONE); + GXLoadPosMtxImm(mPosMtx, 0); + Mtx mtx; + MTXIdentity(mtx); + GXLoadTexMtxImm(mtx, GX_IDENTITY, GX_MTX3x4); + GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, + GX_AF_NONE); + GXSetChanCtrl(GX_COLOR1A1, GX_FALSE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, + GX_AF_NONE); + GXSetCurrentMtx(0); + GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX1, GX_CLR_RGBA, GX_RGBX8, 0xf); + GXSetLineWidth(mLineWidth, GX_TO_ZERO); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_NONE); +} + +/* 802E8E20-802E90C0 2E3760 02A0+00 1/0 2/1 0/0 .text setScissor__14J2DGrafContextFv */ +void J2DGrafContext::setScissor() { + JGeometry::TBox2<f32> bounds(0, 0, 1024, 1024); + JGeometry::TBox2<f32> curBounds(mScissorBounds); + mScissorBounds.intersect(bounds); + curBounds.absolute(); + if (curBounds.intersect(bounds)) { + curBounds.i.x = (u32)curBounds.i.x; + curBounds.i.y = (u32)curBounds.i.y; + curBounds.f.x = ceil(curBounds.f.x); + curBounds.f.y = ceil(curBounds.f.y); + GXSetScissor(curBounds.i.x, curBounds.i.y, curBounds.getWidth(), curBounds.getHeight()); + } else { + GXSetScissor(0, 0, 0, 0); + } +} + +/* 802E90C0-802E90E4 2E3A00 0024+00 0/0 10/10 0/0 .text + * scissor__14J2DGrafContextFRCQ29JGeometry8TBox2<f> */ +void J2DGrafContext::scissor(JGeometry::TBox2<f32> const& bounds) { + mScissorBounds = bounds; +} + +/* 802E90E4-802E9118 2E3A24 0034+00 1/0 1/0 0/0 .text + * place__14J2DGrafContextFRCQ29JGeometry8TBox2<f> */ +void J2DGrafContext::place(JGeometry::TBox2<f32> const& bounds) { + mBounds = bounds; + mScissorBounds = bounds; +} + +/* 802E9118-802E9234 2E3A58 011C+00 1/1 4/4 0/0 .text + * setColor__14J2DGrafContextFQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColor + */ +void J2DGrafContext::setColor(JUtility::TColor colorTL, JUtility::TColor colorTR, + JUtility::TColor colorBR, JUtility::TColor colorBL) { + mColorTL = colorTL; + mColorTR = colorTR; + mColorBR = colorBR; + mColorBL = colorBL; + field_0xb0.mType = GX_BM_BLEND; + field_0xb0.mSrcFactor = GX_BL_SRC_ALPHA; + field_0xb0.mDstFactor = GX_BL_INV_SRC_ALPHA; + mLinePart.mType = GX_BM_BLEND; + mLinePart.mSrcFactor = GX_BL_SRC_ALPHA; + mLinePart.mDstFactor = GX_BL_INV_SRC_ALPHA; + mBoxPart.mType = GX_BM_BLEND; + mBoxPart.mSrcFactor = GX_BL_SRC_ALPHA; + mBoxPart.mDstFactor = GX_BL_INV_SRC_ALPHA; + if ((mColorTL & 0xFF) != 0xFF) { + return; + } + field_0xb0.mType = GX_BM_NONE; + field_0xb0.mSrcFactor = GX_BL_ONE; + field_0xb0.mDstFactor = GX_BL_ZERO; + if ((mColorBR & 0xFF) != 0xFF) { + return; + } + mLinePart.mType = GX_BM_NONE; + mLinePart.mSrcFactor = GX_BL_ONE; + mLinePart.mDstFactor = GX_BL_ZERO; + if ((mColorTR & 0xFF) != 0xFF) { + return; + } + if ((mColorBL & 0xFF) != 0xFF) { + return; + } + mBoxPart.mType = GX_BM_NONE; + mBoxPart.mSrcFactor = GX_BL_ONE; + mBoxPart.mDstFactor = GX_BL_ZERO; +} + +/* 802E9234-802E9260 2E3B74 002C+00 1/1 2/2 0/0 .text setLineWidth__14J2DGrafContextFUc + */ +void J2DGrafContext::setLineWidth(u8 lineWidth) { + mLineWidth = lineWidth; + GXSetLineWidth(mLineWidth, GX_TO_ZERO); +} + +/* 802E9260-802E9368 2E3BA0 0108+00 0/0 2/2 0/0 .text + * fillBox__14J2DGrafContextFRCQ29JGeometry8TBox2<f> */ +void J2DGrafContext::fillBox(JGeometry::TBox2<f32> const& box) { + GXSetBlendMode((GXBlendMode)mBoxPart.mType, (GXBlendFactor)mBoxPart.mSrcFactor, + (GXBlendFactor)mBoxPart.mDstFactor, GX_LO_SET); + GXLoadPosMtxImm(mPosMtx, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + GXPosition3f32(box.i.x, box.i.y, 0); + GXColor1u32(mColorTL); + GXPosition3f32(box.f.x, box.i.y, 0); + GXColor1u32(mColorTR); + GXPosition3f32(box.f.x, box.f.y, 0); + GXColor1u32(mColorBL); + GXPosition3f32(box.i.x, box.f.y, 0); + GXColor1u32(mColorBR); + GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); +} + +/* 802E9368-802E9488 2E3CA8 0120+00 0/0 1/1 0/0 .text + * drawFrame__14J2DGrafContextFRCQ29JGeometry8TBox2<f> */ +void J2DGrafContext::drawFrame(JGeometry::TBox2<f32> const& box) { + GXSetBlendMode((GXBlendMode)mBoxPart.mType, (GXBlendFactor)mBoxPart.mSrcFactor, + (GXBlendFactor)mBoxPart.mDstFactor, GX_LO_SET); + GXLoadPosMtxImm(mPosMtx, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXBegin(GX_LINESTRIP, GX_VTXFMT0, 5); + GXPosition3f32(box.i.x, box.i.y, 0); + GXColor1u32(mColorTL); + GXPosition3f32(box.f.x, box.i.y, 0); + GXColor1u32(mColorTR); + GXPosition3f32(box.f.x, box.f.y, 0); + GXColor1u32(mColorBL); + GXPosition3f32(box.i.x, box.f.y, 0); + GXColor1u32(mColorBR); + GXPosition3f32(box.i.x, box.i.y, 0); + GXColor1u32(mColorTL); + GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); +} + +/* 802E9488-802E9564 2E3DC8 00DC+00 1/1 0/0 0/0 .text + * line__14J2DGrafContextFQ29JGeometry8TVec2<f>Q29JGeometry8TVec2<f> */ +void J2DGrafContext::line(JGeometry::TVec2<f32> start, JGeometry::TVec2<f32> end) { + GXSetBlendMode((GXBlendMode)mLinePart.mType, (GXBlendFactor)mLinePart.mSrcFactor, + (GXBlendFactor)mLinePart.mDstFactor, GX_LO_SET); + GXLoadPosMtxImm(mPosMtx, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXBegin(GX_LINES, GX_VTXFMT0, 2); + GXPosition3f32(start.x, start.y, 0); + GXColor1u32(mColorTL); + GXPosition3f32(end.x, end.y, 0); + GXColor1u32(mColorBR); + GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); +} + +/* 802E9564-802E95D4 2E3EA4 0070+00 0/0 1/1 0/0 .text + * lineTo__14J2DGrafContextFQ29JGeometry8TVec2<f> */ +void J2DGrafContext::lineTo(JGeometry::TVec2<f32> pos) { + this->line(mPrevPos, pos); + mPrevPos = pos; +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DManage.cpp b/src/JSystem/J2DGraph/J2DManage.cpp new file mode 100644 index 0000000000..a2c6fb46b1 --- /dev/null +++ b/src/JSystem/J2DGraph/J2DManage.cpp @@ -0,0 +1,80 @@ +#include "JSystem/J2DGraph/J2DManage.h" +#include "JSystem/JSupport/JSUInputStream.h" +#include "string.h" + +/* 8030CE18-8030CE7C 307758 0064+00 1/1 3/3 0/0 .text get__13J2DDataManageFPCc */ +void* J2DDataManage::get(char const* name) { + for (J2DataManageLink* link = mList; link != NULL; link = link->mNext) { + if (strcmp(link->mName, name) == 0) { + return link->mData; + } + } + return NULL; +} + +/* 8030CE7C-8030CF10 3077BC 0094+00 0/0 1/1 0/0 .text get__13J2DDataManageFP14JSUInputStream */ +void* J2DDataManage::get(JSUInputStream* inputStream) { + inputStream->skip(1); + u8 nameLen = inputStream->readU8(); + + if (nameLen == 0) { + return NULL; + } else { + char nameBuffer[257]; + inputStream->read(&nameBuffer, nameLen); + nameBuffer[nameLen] = 0; + return this->get(nameBuffer); + } +} + +/* 8030CF10-8030CF44 307850 0034+00 1/1 2/2 0/0 .text getResReference__15J2DResReferenceCFUs */ +s8* J2DResReference::getResReference(u16 idx) const { + if (mCount <= idx || idx == 0xFFFF) { + return NULL; + } else { + return (((s8*)this) + mOffsets[idx]); + } +} + +/* 8030CF44-8030D098 307884 0154+00 0/0 2/2 0/0 .text getName__15J2DResReferenceCFUs */ +char* J2DResReference::getName(u16 idx) const { + static char p_name[257]; + + s8* resRef = this->getResReference(idx); + + if (resRef == NULL) { + p_name[0] = 0; + return p_name; + } else { + s8 first = resRef[0]; + + switch (first) { + case 2: + case 3: + for (s32 i = 0; i < resRef[1]; i++) { + p_name[i] = resRef[2 + i]; + } + p_name[resRef[1]] = 0; + break; + case 4: + s32 pos = resRef[1] + 1; + for (; pos >= 2; pos--) { + if (resRef[pos] == '\\' || resRef[pos] == '/') { + break; + } + } + + s32 i = 0; + pos++; + for (; pos < resRef[1] + 2; i++, pos++) { + p_name[i] = resRef[pos]; + } + p_name[i] = 0; + + break; + default: + p_name[0] = 0; + } + return p_name; + } +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DMatBlock.cpp b/src/JSystem/J2DGraph/J2DMatBlock.cpp new file mode 100644 index 0000000000..f006aa9e5e --- /dev/null +++ b/src/JSystem/J2DGraph/J2DMatBlock.cpp @@ -0,0 +1,3653 @@ +// +// Generated By: dol2asm +// Translation Unit: J2DMatBlock +// + +#include "JSystem/J2DGraph/J2DMatBlock.h" +#include "JSystem/JUtility/JUTPalette.h" +#include "JSystem/JUtility/JUTResFont.h" +#include "JSystem/JUtility/JUTTexture.h" +#include "dol2asm.h" +#include "dolphin/gx.h" + +// +// Forward References: +// + +extern "C" void initialize__13J2DColorBlockFv(); +extern "C" void setGX__13J2DColorBlockFv(); +extern "C" void initialize__14J2DTexGenBlockFv(); +extern "C" void setGX__14J2DTexGenBlockFv(); +extern "C" void __dt__14J2DTexGenBlockFv(); +extern "C" void setTexMtx__14J2DTexGenBlockFUlR9J2DTexMtx(); +extern "C" void getTexMtx__14J2DTexGenBlockFUlR9J2DTexMtx(); +extern "C" bool getTexture__11J2DTevBlockFUl(); +extern "C" bool getPalette__11J2DTevBlockFUl(); +extern "C" void __ct__12J2DTevBlock1Fv(); +extern "C" void __dt__12J2DTevBlock1Fv(); +extern "C" void initialize__12J2DTevBlock1Fv(); +extern "C" void prepareTexture__12J2DTevBlock1FUc(); +extern "C" void insertTexture__12J2DTevBlock1FUlPC7ResTIMGP10JUTPalette(); +extern "C" void insertTexture__12J2DTevBlock1FUlP10JUTTexture(); +extern "C" void setTexture__12J2DTevBlock1FUlPC7ResTIMG(); +extern "C" void setTexture__12J2DTevBlock1FUlP10JUTTexture(); +extern "C" void removeTexture__12J2DTevBlock1FUl(); +extern "C" void setFont__12J2DTevBlock1FP7ResFONT(); +extern "C" void setFont__12J2DTevBlock1FP7JUTFont(); +extern "C" void setPalette__12J2DTevBlock1FUlPC7ResTLUT(); +extern "C" void shiftDeleteFlag__12J2DTevBlock1FUcb(); +extern "C" void setGX__12J2DTevBlock1Fv(); +extern "C" void loadTexture__12J2DTevBlock1F11_GXTexMapIDUl(); +extern "C" void __ct__12J2DTevBlock2Fv(); +extern "C" void __dt__12J2DTevBlock2Fv(); +extern "C" void initialize__12J2DTevBlock2Fv(); +extern "C" void prepareTexture__12J2DTevBlock2FUc(); +extern "C" void insertTexture__12J2DTevBlock2FUlPC7ResTIMGP10JUTPalette(); +extern "C" void insertTexture__12J2DTevBlock2FUlP10JUTTexture(); +extern "C" void setTexture__12J2DTevBlock2FUlPC7ResTIMG(); +extern "C" void setTexture__12J2DTevBlock2FUlP10JUTTexture(); +extern "C" void removeTexture__12J2DTevBlock2FUl(); +extern "C" void setFont__12J2DTevBlock2FP7ResFONT(); +extern "C" void setFont__12J2DTevBlock2FP7JUTFont(); +extern "C" void setPalette__12J2DTevBlock2FUlPC7ResTLUT(); +extern "C" void shiftDeleteFlag__12J2DTevBlock2FUcb(); +extern "C" void setGX__12J2DTevBlock2Fv(); +extern "C" void loadTexture__12J2DTevBlock2F11_GXTexMapIDUl(); +extern "C" void __ct__12J2DTevBlock4Fv(); +extern "C" void __dt__12J2DTevBlock4Fv(); +extern "C" void initialize__12J2DTevBlock4Fv(); +extern "C" void prepareTexture__12J2DTevBlock4FUc(); +extern "C" void insertTexture__12J2DTevBlock4FUlPC7ResTIMGP10JUTPalette(); +extern "C" void insertTexture__12J2DTevBlock4FUlP10JUTTexture(); +extern "C" void setTexture__12J2DTevBlock4FUlPC7ResTIMG(); +extern "C" void setTexture__12J2DTevBlock4FUlP10JUTTexture(); +extern "C" void removeTexture__12J2DTevBlock4FUl(); +extern "C" void setFont__12J2DTevBlock4FP7ResFONT(); +extern "C" void setFont__12J2DTevBlock4FP7JUTFont(); +extern "C" void setPalette__12J2DTevBlock4FUlPC7ResTLUT(); +extern "C" void shiftDeleteFlag__12J2DTevBlock4FUcb(); +extern "C" void setGX__12J2DTevBlock4Fv(); +extern "C" void loadTexture__12J2DTevBlock4F11_GXTexMapIDUl(); +extern "C" void __ct__12J2DTevBlock8Fv(); +extern "C" void __dt__12J2DTevBlock8Fv(); +extern "C" void initialize__12J2DTevBlock8Fv(); +extern "C" void prepareTexture__12J2DTevBlock8FUc(); +extern "C" void insertTexture__12J2DTevBlock8FUlPC7ResTIMGP10JUTPalette(); +extern "C" void insertTexture__12J2DTevBlock8FUlP10JUTTexture(); +extern "C" void setTexture__12J2DTevBlock8FUlPC7ResTIMG(); +extern "C" void setTexture__12J2DTevBlock8FUlP10JUTTexture(); +extern "C" void removeTexture__12J2DTevBlock8FUl(); +extern "C" void setFont__12J2DTevBlock8FP7ResFONT(); +extern "C" void setFont__12J2DTevBlock8FP7JUTFont(); +extern "C" void setPalette__12J2DTevBlock8FUlPC7ResTLUT(); +extern "C" void shiftDeleteFlag__12J2DTevBlock8FUcb(); +extern "C" void setGX__12J2DTevBlock8Fv(); +extern "C" void loadTexture__12J2DTevBlock8F11_GXTexMapIDUl(); +extern "C" void __ct__13J2DTevBlock16Fv(); +extern "C" void __dt__13J2DTevBlock16Fv(); +extern "C" void initialize__13J2DTevBlock16Fv(); +extern "C" void prepareTexture__13J2DTevBlock16FUc(); +extern "C" void insertTexture__13J2DTevBlock16FUlPC7ResTIMGP10JUTPalette(); +extern "C" void insertTexture__13J2DTevBlock16FUlP10JUTTexture(); +extern "C" void setTexture__13J2DTevBlock16FUlPC7ResTIMG(); +extern "C" void setTexture__13J2DTevBlock16FUlP10JUTTexture(); +extern "C" void removeTexture__13J2DTevBlock16FUl(); +extern "C" void setFont__13J2DTevBlock16FP7ResFONT(); +extern "C" void setFont__13J2DTevBlock16FP7JUTFont(); +extern "C" void setPalette__13J2DTevBlock16FUlPC7ResTLUT(); +extern "C" void shiftDeleteFlag__13J2DTevBlock16FUcb(); +extern "C" void setGX__13J2DTevBlock16Fv(); +extern "C" void loadTexture__13J2DTevBlock16F11_GXTexMapIDUl(); +extern "C" void initialize__15J2DIndBlockFullFv(); +extern "C" void setGX__15J2DIndBlockFullFv(); +extern "C" void initialize__10J2DPEBlockFv(); +extern "C" void setGX__10J2DPEBlockFv(); +extern "C" void __ct__14J2DIndTevStageFv(); +extern "C" void __ct__19J2DTevSwapModeTableFv(); +extern "C" void __ct__11J2DTevStageFv(); +extern "C" void setTevStageInfo__11J2DTevStageFRC15J2DTevStageInfo(); +extern "C" void __ct__11J2DTevOrderFv(); +extern "C" void __ct__13J2DGXColorS10Fv(); +extern "C" void getType__15J2DIndBlockFullFv(); +extern "C" void setIndTexStageNum__15J2DIndBlockFullFUc(); +extern "C" void getIndTexStageNum__15J2DIndBlockFullCFv(); +extern "C" void setIndTexOrder__15J2DIndBlockFullFUl14J2DIndTexOrder(); +extern "C" void getIndTexOrder__15J2DIndBlockFullFUl(); +extern "C" void setIndTexMtx__15J2DIndBlockFullFUl12J2DIndTexMtx(); +extern "C" void getIndTexMtx__15J2DIndBlockFullFUl(); +extern "C" void setIndTexCoordScale__15J2DIndBlockFullFUl19J2DIndTexCoordScale(); +extern "C" void getIndTexCoordScale__15J2DIndBlockFullFUl(); +extern "C" void __dt__15J2DIndBlockFullFv(); +extern "C" void getType__13J2DTevBlock16Fv(); +extern "C" s32 getMaxStage__13J2DTevBlock16Fv(); +extern "C" void setTexNo__13J2DTevBlock16FUlUs(); +extern "C" void getTexNo__13J2DTevBlock16CFUl(); +extern "C" void setFontNo__13J2DTevBlock16FUs(); +extern "C" void getFontNo__13J2DTevBlock16CFv(); +extern "C" void setTevOrder__13J2DTevBlock16FUl11J2DTevOrder(); +extern "C" void getTevOrder__13J2DTevBlock16FUl(); +extern "C" void setTevColor__13J2DTevBlock16FUl13J2DGXColorS10(); +extern "C" void getTevColor__13J2DTevBlock16FUl(); +extern "C" void setTevKColor__13J2DTevBlock16FUlQ28JUtility6TColor(); +extern "C" void getTevKColor__13J2DTevBlock16FUl(); +extern "C" void setTevKColorSel__13J2DTevBlock16FUlUc(); +extern "C" void getTevKColorSel__13J2DTevBlock16FUl(); +extern "C" void setTevKAlphaSel__13J2DTevBlock16FUlUc(); +extern "C" void getTevKAlphaSel__13J2DTevBlock16FUl(); +extern "C" void setTevStageNum__13J2DTevBlock16FUc(); +extern "C" void getTevStageNum__13J2DTevBlock16CFv(); +extern "C" void setTevStage__13J2DTevBlock16FUl11J2DTevStage(); +extern "C" void getTevStage__13J2DTevBlock16FUl(); +extern "C" void setTevSwapModeInfo__13J2DTevBlock16FUl18J2DTevSwapModeInfo(); +extern "C" void setTevSwapModeTable__13J2DTevBlock16FUl19J2DTevSwapModeTable(); +extern "C" void getTevSwapModeTable__13J2DTevBlock16FUl(); +extern "C" void setIndTevStage__13J2DTevBlock16FUl14J2DIndTevStage(); +extern "C" void getIndTevStage__13J2DTevBlock16FUl(); +extern "C" void insertTexture__13J2DTevBlock16FUlPC7ResTIMG(); +extern "C" void getTexture__13J2DTevBlock16FUl(); +extern "C" void getPalette__13J2DTevBlock16FUl(); +extern "C" void getFont__13J2DTevBlock16Fv(); +extern "C" void setUndeleteFlag__13J2DTevBlock16FUc(); +extern "C" void setFontUndeleteFlag__13J2DTevBlock16Fv(); +extern "C" void getType__12J2DTevBlock8Fv(); +extern "C" s32 getMaxStage__12J2DTevBlock8Fv(); +extern "C" void setTexNo__12J2DTevBlock8FUlUs(); +extern "C" void getTexNo__12J2DTevBlock8CFUl(); +extern "C" void setFontNo__12J2DTevBlock8FUs(); +extern "C" void getFontNo__12J2DTevBlock8CFv(); +extern "C" void setTevOrder__12J2DTevBlock8FUl11J2DTevOrder(); +extern "C" void getTevOrder__12J2DTevBlock8FUl(); +extern "C" void setTevColor__12J2DTevBlock8FUl13J2DGXColorS10(); +extern "C" void getTevColor__12J2DTevBlock8FUl(); +extern "C" void setTevKColor__12J2DTevBlock8FUlQ28JUtility6TColor(); +extern "C" void getTevKColor__12J2DTevBlock8FUl(); +extern "C" void setTevKColorSel__12J2DTevBlock8FUlUc(); +extern "C" void getTevKColorSel__12J2DTevBlock8FUl(); +extern "C" void setTevKAlphaSel__12J2DTevBlock8FUlUc(); +extern "C" void getTevKAlphaSel__12J2DTevBlock8FUl(); +extern "C" void setTevStageNum__12J2DTevBlock8FUc(); +extern "C" void getTevStageNum__12J2DTevBlock8CFv(); +extern "C" void setTevStage__12J2DTevBlock8FUl11J2DTevStage(); +extern "C" void getTevStage__12J2DTevBlock8FUl(); +extern "C" void setTevSwapModeInfo__12J2DTevBlock8FUl18J2DTevSwapModeInfo(); +extern "C" void setTevSwapModeTable__12J2DTevBlock8FUl19J2DTevSwapModeTable(); +extern "C" void getTevSwapModeTable__12J2DTevBlock8FUl(); +extern "C" void setIndTevStage__12J2DTevBlock8FUl14J2DIndTevStage(); +extern "C" void getIndTevStage__12J2DTevBlock8FUl(); +extern "C" void insertTexture__12J2DTevBlock8FUlPC7ResTIMG(); +extern "C" void getTexture__12J2DTevBlock8FUl(); +extern "C" void getPalette__12J2DTevBlock8FUl(); +extern "C" void getFont__12J2DTevBlock8Fv(); +extern "C" void setUndeleteFlag__12J2DTevBlock8FUc(); +extern "C" void setFontUndeleteFlag__12J2DTevBlock8Fv(); +extern "C" void getType__12J2DTevBlock4Fv(); +extern "C" s32 getMaxStage__12J2DTevBlock4Fv(); +extern "C" void setTexNo__12J2DTevBlock4FUlUs(); +extern "C" void getTexNo__12J2DTevBlock4CFUl(); +extern "C" void setFontNo__12J2DTevBlock4FUs(); +extern "C" void getFontNo__12J2DTevBlock4CFv(); +extern "C" void setTevOrder__12J2DTevBlock4FUl11J2DTevOrder(); +extern "C" void getTevOrder__12J2DTevBlock4FUl(); +extern "C" void setTevColor__12J2DTevBlock4FUl13J2DGXColorS10(); +extern "C" void getTevColor__12J2DTevBlock4FUl(); +extern "C" void setTevKColor__12J2DTevBlock4FUlQ28JUtility6TColor(); +extern "C" void getTevKColor__12J2DTevBlock4FUl(); +extern "C" void setTevKColorSel__12J2DTevBlock4FUlUc(); +extern "C" void getTevKColorSel__12J2DTevBlock4FUl(); +extern "C" void setTevKAlphaSel__12J2DTevBlock4FUlUc(); +extern "C" void getTevKAlphaSel__12J2DTevBlock4FUl(); +extern "C" void setTevStageNum__12J2DTevBlock4FUc(); +extern "C" void getTevStageNum__12J2DTevBlock4CFv(); +extern "C" void setTevStage__12J2DTevBlock4FUl11J2DTevStage(); +extern "C" void getTevStage__12J2DTevBlock4FUl(); +extern "C" void setTevSwapModeInfo__12J2DTevBlock4FUl18J2DTevSwapModeInfo(); +extern "C" void setTevSwapModeTable__12J2DTevBlock4FUl19J2DTevSwapModeTable(); +extern "C" void getTevSwapModeTable__12J2DTevBlock4FUl(); +extern "C" void setIndTevStage__12J2DTevBlock4FUl14J2DIndTevStage(); +extern "C" void getIndTevStage__12J2DTevBlock4FUl(); +extern "C" void insertTexture__12J2DTevBlock4FUlPC7ResTIMG(); +extern "C" void getTexture__12J2DTevBlock4FUl(); +extern "C" void getPalette__12J2DTevBlock4FUl(); +extern "C" void getFont__12J2DTevBlock4Fv(); +extern "C" void setUndeleteFlag__12J2DTevBlock4FUc(); +extern "C" void setFontUndeleteFlag__12J2DTevBlock4Fv(); +extern "C" void getType__12J2DTevBlock2Fv(); +extern "C" s32 getMaxStage__12J2DTevBlock2Fv(); +extern "C" void setTexNo__12J2DTevBlock2FUlUs(); +extern "C" void getTexNo__12J2DTevBlock2CFUl(); +extern "C" void setFontNo__12J2DTevBlock2FUs(); +extern "C" void getFontNo__12J2DTevBlock2CFv(); +extern "C" void setTevOrder__12J2DTevBlock2FUl11J2DTevOrder(); +extern "C" void getTevOrder__12J2DTevBlock2FUl(); +extern "C" void setTevColor__12J2DTevBlock2FUl13J2DGXColorS10(); +extern "C" void getTevColor__12J2DTevBlock2FUl(); +extern "C" void setTevKColor__12J2DTevBlock2FUlQ28JUtility6TColor(); +extern "C" void getTevKColor__12J2DTevBlock2FUl(); +extern "C" void setTevKColorSel__12J2DTevBlock2FUlUc(); +extern "C" void getTevKColorSel__12J2DTevBlock2FUl(); +extern "C" void setTevKAlphaSel__12J2DTevBlock2FUlUc(); +extern "C" void getTevKAlphaSel__12J2DTevBlock2FUl(); +extern "C" void setTevStageNum__12J2DTevBlock2FUc(); +extern "C" void getTevStageNum__12J2DTevBlock2CFv(); +extern "C" void setTevStage__12J2DTevBlock2FUl11J2DTevStage(); +extern "C" void getTevStage__12J2DTevBlock2FUl(); +extern "C" void setTevSwapModeInfo__12J2DTevBlock2FUl18J2DTevSwapModeInfo(); +extern "C" void setTevSwapModeTable__12J2DTevBlock2FUl19J2DTevSwapModeTable(); +extern "C" void getTevSwapModeTable__12J2DTevBlock2FUl(); +extern "C" void setIndTevStage__12J2DTevBlock2FUl14J2DIndTevStage(); +extern "C" void getIndTevStage__12J2DTevBlock2FUl(); +extern "C" void insertTexture__12J2DTevBlock2FUlPC7ResTIMG(); +extern "C" void getTexture__12J2DTevBlock2FUl(); +extern "C" void getPalette__12J2DTevBlock2FUl(); +extern "C" void getFont__12J2DTevBlock2Fv(); +extern "C" void setUndeleteFlag__12J2DTevBlock2FUc(); +extern "C" void setFontUndeleteFlag__12J2DTevBlock2Fv(); +extern "C" void getType__12J2DTevBlock1Fv(); +extern "C" bool getMaxStage__12J2DTevBlock1Fv(); +extern "C" void setTexNo__12J2DTevBlock1FUlUs(); +extern "C" void getTexNo__12J2DTevBlock1CFUl(); +extern "C" void setFontNo__12J2DTevBlock1FUs(); +extern "C" void getFontNo__12J2DTevBlock1CFv(); +extern "C" void setTevOrder__12J2DTevBlock1FUl11J2DTevOrder(); +extern "C" void getTevOrder__12J2DTevBlock1FUl(); +extern "C" void setTevColor__12J2DTevBlock1FUl13J2DGXColorS10(); +extern "C" void getTevColor__12J2DTevBlock1FUl(); +extern "C" void setTevKColor__12J2DTevBlock1FUlQ28JUtility6TColor(); +extern "C" void getTevKColor__12J2DTevBlock1FUl(); +extern "C" void setTevKColorSel__12J2DTevBlock1FUlUc(); +extern "C" void getTevKColorSel__12J2DTevBlock1FUl(); +extern "C" void setTevKAlphaSel__12J2DTevBlock1FUlUc(); +extern "C" void getTevKAlphaSel__12J2DTevBlock1FUl(); +extern "C" void setTevStageNum__12J2DTevBlock1FUc(); +extern "C" bool getTevStageNum__12J2DTevBlock1CFv(); +extern "C" void setTevStage__12J2DTevBlock1FUl11J2DTevStage(); +extern "C" void getTevStage__12J2DTevBlock1FUl(); +extern "C" void setTevSwapModeInfo__12J2DTevBlock1FUl18J2DTevSwapModeInfo(); +extern "C" void setTevSwapModeTable__12J2DTevBlock1FUl19J2DTevSwapModeTable(); +extern "C" void getTevSwapModeTable__12J2DTevBlock1FUl(); +extern "C" void setIndTevStage__12J2DTevBlock1FUl14J2DIndTevStage(); +extern "C" void getIndTevStage__12J2DTevBlock1FUl(); +extern "C" void insertTexture__12J2DTevBlock1FUlPC7ResTIMG(); +extern "C" void getTexture__12J2DTevBlock1FUl(); +extern "C" void getPalette__12J2DTevBlock1FUl(); +extern "C" void getFont__12J2DTevBlock1Fv(); +extern "C" void setUndeleteFlag__12J2DTevBlock1FUc(); +extern "C" void setFontUndeleteFlag__12J2DTevBlock1Fv(); +extern "C" void initialize__11J2DTevBlockFv(); +extern "C" void loadTexture__11J2DTevBlockF11_GXTexMapIDUl(); +extern "C" void setFontNo__11J2DTevBlockFUs(); +extern "C" void setTevOrder__11J2DTevBlockFUl11J2DTevOrder(); +extern "C" void setTevKColorSel__11J2DTevBlockFUlUc(); +extern "C" void setTevKAlphaSel__11J2DTevBlockFUlUc(); +extern "C" void setTevStageNum__11J2DTevBlockFUc(); +extern "C" void setTevStage__11J2DTevBlockFUl11J2DTevStage(); +extern "C" void setTevSwapModeInfo__11J2DTevBlockFUl18J2DTevSwapModeInfo(); +extern "C" void setTevSwapModeTable__11J2DTevBlockFUl19J2DTevSwapModeTable(); +extern "C" void setIndTevStage__11J2DTevBlockFUl14J2DIndTevStage(); +extern "C" bool insertTexture__11J2DTevBlockFUlP10JUTTexture(); +extern "C" bool insertTexture__11J2DTevBlockFUlPC7ResTIMGP10JUTPalette(); +extern "C" bool insertTexture__11J2DTevBlockFUlPC7ResTIMG(); +extern "C" bool setTexture__11J2DTevBlockFUlP10JUTTexture(); +extern "C" bool setTexture__11J2DTevBlockFUlPC7ResTIMG(); +extern "C" bool removeTexture__11J2DTevBlockFUl(); +extern "C" bool setFont__11J2DTevBlockFP7JUTFont(); +extern "C" bool setFont__11J2DTevBlockFP7ResFONT(); +extern "C" bool setPalette__11J2DTevBlockFUlPC7ResTLUT(); +extern "C" bool prepareTexture__11J2DTevBlockFUc(); +extern "C" bool getFont__11J2DTevBlockFv(); +extern "C" void shiftDeleteFlag__11J2DTevBlockFUcb(); +extern "C" void setUndeleteFlag__11J2DTevBlockFUc(); +extern "C" void setFontUndeleteFlag__11J2DTevBlockFv(); + +// +// External References: +// + +extern "C" void __ct__Q28JUtility6TColorFv(); +extern "C" void* __nw__FUl(); +extern "C" void __dl__FPv(); +extern "C" void __dt__10JUTTextureFv(); +extern "C" void storeTIMG__10JUTTextureFPC7ResTIMGUc(); +extern "C" void storeTIMG__10JUTTextureFPC7ResTIMGP10JUTPalette(); +extern "C" void attachPalette__10JUTTextureFP10JUTPalette(); +extern "C" void load__10JUTTextureF11_GXTexMapID(); +extern "C" void storeTLUT__10JUTPaletteF7_GXTlutP7ResTLUT(); +extern "C" void __ct__10JUTResFontFPC7ResFONTP7JKRHeap(); +extern "C" void load__9J2DTexMtxFUl(); +extern "C" void calc__9J2DTexMtxFv(); +extern "C" void load__14J2DIndTevStageFUc(); +extern "C" void load__12J2DIndTexMtxFUc(); +extern "C" void load__19J2DIndTexCoordScaleFUc(); +extern "C" void load__14J2DIndTexOrderFUc(); +extern "C" bool getTevSwapModeTable__11J2DTevBlockFUl(); +extern "C" bool getTevStage__11J2DTevBlockFUl(); +extern "C" bool getTevColor__11J2DTevBlockFUl(); +extern "C" bool getTevOrder__11J2DTevBlockFUl(); +extern "C" bool getTevKAlphaSel__11J2DTevBlockFUl(); +extern "C" bool getTevKColorSel__11J2DTevBlockFUl(); +extern "C" bool getTevKColor__11J2DTevBlockFUl(); +extern "C" void getFontNo__11J2DTevBlockCFv(); +extern "C" void getTexNo__11J2DTevBlockCFUl(); +extern "C" bool getTevStageNum__11J2DTevBlockCFv(); +extern "C" bool getIndTevStage__11J2DTevBlockFUl(); +extern "C" void __dt__11J2DTevBlockFv(); +extern "C" void setGX__11J2DTevBlockFv(); +extern "C" void setTevKColor__11J2DTevBlockFUlQ28JUtility6TColor(); +extern "C" void setTevColor__11J2DTevBlockFUl13J2DGXColorS10(); +extern "C" void setTexNo__11J2DTevBlockFUlUs(); +extern "C" void __dt__19J2DIndTexCoordScaleFv(); +extern "C" void __dt__12J2DIndTexMtxFv(); +extern "C" void __destroy_arr(); +extern "C" void __construct_array(); +extern "C" void _savegpr_25(); +extern "C" void _savegpr_26(); +extern "C" void _savegpr_27(); +extern "C" void _savegpr_28(); +extern "C" void _savegpr_29(); +extern "C" void _restgpr_25(); +extern "C" void _restgpr_26(); +extern "C" void _restgpr_27(); +extern "C" void _restgpr_28(); +extern "C" void _restgpr_29(); +extern "C" extern J2DTexCoordInfo const j2dDefaultTexCoordInfo[8]; +extern "C" extern J2DTevStageInfo const j2dDefaultTevStageInfo; +extern "C" extern J2DIndTevStageInfo const j2dDefaultIndTevStageInfo; +extern "C" extern void* __vt__11J2DIndBlock[14]; + +// +// Declarations: +// + +/* 802EB394-802EB424 2E5CD4 0090+00 0/0 1/1 0/0 .text initialize__13J2DColorBlockFv */ +// instruction order +#ifdef NONMATCHING +void J2DColorBlock::initialize() { + for (int i = 0; i < 2; i++) { + mMatColor[i] = JUtility::TColor(j2dDefaultColInfo); + } + mColorChanNum = 2; + for (int i = 0; i < 4; i++) { + mColorChan[i].setColorChanInfo(j2dDefaultColorChanInfo); + } + mCullMode = GX_CULL_NONE; +} +#else +void J2DColorBlock::initialize() { + // NONMATCHING +} +#endif + +/* 802EB424-802EB510 2E5D64 00EC+00 0/0 1/1 0/0 .text setGX__13J2DColorBlockFv */ +void J2DColorBlock::setGX() { + for (int i = 0; i < 2; i++) { + GXSetChanMatColor(GXChannelID(GX_COLOR0A0 + i), mMatColor[i]); + } + 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); + } + GXSetCullMode((GXCullMode)mCullMode); +} + +/* 802EB510-802EB570 2E5E50 0060+00 0/0 1/1 0/0 .text initialize__14J2DTexGenBlockFv */ +void J2DTexGenBlock::initialize() { + mTexGenNum = 0; + for (int i = 0; i < 8; i++) { + mTexGenCoord[i].setTexCoordInfo(j2dDefaultTexCoordInfo[0]); + } + for (int i = 0; i < 8; i++) { + mTexMtx[i] = NULL; + } +} + +/* 802EB570-802EB620 2E5EB0 00B0+00 0/0 1/1 0/0 .text setGX__14J2DTexGenBlockFv */ +void J2DTexGenBlock::setGX() { + GXSetNumTexGens(mTexGenNum); + 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); + } + } +} + +/* ############################################################################################## */ +/* 803CCA90-803CCAC8 029BB0 0038+00 1/1 1/1 0/0 .data __vt__15J2DIndBlockFull */ +SECTION_DATA extern void* __vt__15J2DIndBlockFull[14] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)initialize__15J2DIndBlockFullFv, + (void*)setGX__15J2DIndBlockFullFv, + (void*)getType__15J2DIndBlockFullFv, + (void*)setIndTexStageNum__15J2DIndBlockFullFUc, + (void*)getIndTexStageNum__15J2DIndBlockFullCFv, + (void*)setIndTexOrder__15J2DIndBlockFullFUl14J2DIndTexOrder, + (void*)getIndTexOrder__15J2DIndBlockFullFUl, + (void*)setIndTexMtx__15J2DIndBlockFullFUl12J2DIndTexMtx, + (void*)getIndTexMtx__15J2DIndBlockFullFUl, + (void*)setIndTexCoordScale__15J2DIndBlockFullFUl19J2DIndTexCoordScale, + (void*)getIndTexCoordScale__15J2DIndBlockFullFUl, + (void*)__dt__15J2DIndBlockFullFv, +}; + +/* 803CCAC8-803CCB84 029BE8 00BC+00 2/2 0/0 0/0 .data __vt__13J2DTevBlock16 */ +SECTION_DATA extern void* __vt__13J2DTevBlock16[47] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)initialize__13J2DTevBlock16Fv, + (void*)setGX__13J2DTevBlock16Fv, + (void*)loadTexture__13J2DTevBlock16F11_GXTexMapIDUl, + (void*)getType__13J2DTevBlock16Fv, + (void*)getMaxStage__13J2DTevBlock16Fv, + (void*)setTexNo__13J2DTevBlock16FUlUs, + (void*)getTexNo__13J2DTevBlock16CFUl, + (void*)setFontNo__13J2DTevBlock16FUs, + (void*)getFontNo__13J2DTevBlock16CFv, + (void*)setTevOrder__13J2DTevBlock16FUl11J2DTevOrder, + (void*)getTevOrder__13J2DTevBlock16FUl, + (void*)setTevColor__13J2DTevBlock16FUl13J2DGXColorS10, + (void*)getTevColor__13J2DTevBlock16FUl, + (void*)setTevKColor__13J2DTevBlock16FUlQ28JUtility6TColor, + (void*)getTevKColor__13J2DTevBlock16FUl, + (void*)setTevKColorSel__13J2DTevBlock16FUlUc, + (void*)getTevKColorSel__13J2DTevBlock16FUl, + (void*)setTevKAlphaSel__13J2DTevBlock16FUlUc, + (void*)getTevKAlphaSel__13J2DTevBlock16FUl, + (void*)setTevStageNum__13J2DTevBlock16FUc, + (void*)getTevStageNum__13J2DTevBlock16CFv, + (void*)setTevStage__13J2DTevBlock16FUl11J2DTevStage, + (void*)getTevStage__13J2DTevBlock16FUl, + (void*)setTevSwapModeInfo__13J2DTevBlock16FUl18J2DTevSwapModeInfo, + (void*)setTevSwapModeTable__13J2DTevBlock16FUl19J2DTevSwapModeTable, + (void*)getTevSwapModeTable__13J2DTevBlock16FUl, + (void*)setIndTevStage__13J2DTevBlock16FUl14J2DIndTevStage, + (void*)getIndTevStage__13J2DTevBlock16FUl, + (void*)insertTexture__13J2DTevBlock16FUlPC7ResTIMG, + (void*)insertTexture__13J2DTevBlock16FUlPC7ResTIMGP10JUTPalette, + (void*)insertTexture__13J2DTevBlock16FUlP10JUTTexture, + (void*)setTexture__13J2DTevBlock16FUlPC7ResTIMG, + (void*)setTexture__13J2DTevBlock16FUlP10JUTTexture, + (void*)removeTexture__13J2DTevBlock16FUl, + (void*)setFont__13J2DTevBlock16FP7ResFONT, + (void*)setFont__13J2DTevBlock16FP7JUTFont, + (void*)setPalette__13J2DTevBlock16FUlPC7ResTLUT, + (void*)prepareTexture__13J2DTevBlock16FUc, + (void*)getTexture__13J2DTevBlock16FUl, + (void*)getPalette__13J2DTevBlock16FUl, + (void*)getFont__13J2DTevBlock16Fv, + (void*)shiftDeleteFlag__13J2DTevBlock16FUcb, + (void*)setUndeleteFlag__13J2DTevBlock16FUc, + (void*)setFontUndeleteFlag__13J2DTevBlock16Fv, + (void*)__dt__13J2DTevBlock16Fv, +}; + +/* 803CCB84-803CCC40 029CA4 00BC+00 2/2 0/0 0/0 .data __vt__12J2DTevBlock8 */ +SECTION_DATA extern void* __vt__12J2DTevBlock8[47] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)initialize__12J2DTevBlock8Fv, + (void*)setGX__12J2DTevBlock8Fv, + (void*)loadTexture__12J2DTevBlock8F11_GXTexMapIDUl, + (void*)getType__12J2DTevBlock8Fv, + (void*)getMaxStage__12J2DTevBlock8Fv, + (void*)setTexNo__12J2DTevBlock8FUlUs, + (void*)getTexNo__12J2DTevBlock8CFUl, + (void*)setFontNo__12J2DTevBlock8FUs, + (void*)getFontNo__12J2DTevBlock8CFv, + (void*)setTevOrder__12J2DTevBlock8FUl11J2DTevOrder, + (void*)getTevOrder__12J2DTevBlock8FUl, + (void*)setTevColor__12J2DTevBlock8FUl13J2DGXColorS10, + (void*)getTevColor__12J2DTevBlock8FUl, + (void*)setTevKColor__12J2DTevBlock8FUlQ28JUtility6TColor, + (void*)getTevKColor__12J2DTevBlock8FUl, + (void*)setTevKColorSel__12J2DTevBlock8FUlUc, + (void*)getTevKColorSel__12J2DTevBlock8FUl, + (void*)setTevKAlphaSel__12J2DTevBlock8FUlUc, + (void*)getTevKAlphaSel__12J2DTevBlock8FUl, + (void*)setTevStageNum__12J2DTevBlock8FUc, + (void*)getTevStageNum__12J2DTevBlock8CFv, + (void*)setTevStage__12J2DTevBlock8FUl11J2DTevStage, + (void*)getTevStage__12J2DTevBlock8FUl, + (void*)setTevSwapModeInfo__12J2DTevBlock8FUl18J2DTevSwapModeInfo, + (void*)setTevSwapModeTable__12J2DTevBlock8FUl19J2DTevSwapModeTable, + (void*)getTevSwapModeTable__12J2DTevBlock8FUl, + (void*)setIndTevStage__12J2DTevBlock8FUl14J2DIndTevStage, + (void*)getIndTevStage__12J2DTevBlock8FUl, + (void*)insertTexture__12J2DTevBlock8FUlPC7ResTIMG, + (void*)insertTexture__12J2DTevBlock8FUlPC7ResTIMGP10JUTPalette, + (void*)insertTexture__12J2DTevBlock8FUlP10JUTTexture, + (void*)setTexture__12J2DTevBlock8FUlPC7ResTIMG, + (void*)setTexture__12J2DTevBlock8FUlP10JUTTexture, + (void*)removeTexture__12J2DTevBlock8FUl, + (void*)setFont__12J2DTevBlock8FP7ResFONT, + (void*)setFont__12J2DTevBlock8FP7JUTFont, + (void*)setPalette__12J2DTevBlock8FUlPC7ResTLUT, + (void*)prepareTexture__12J2DTevBlock8FUc, + (void*)getTexture__12J2DTevBlock8FUl, + (void*)getPalette__12J2DTevBlock8FUl, + (void*)getFont__12J2DTevBlock8Fv, + (void*)shiftDeleteFlag__12J2DTevBlock8FUcb, + (void*)setUndeleteFlag__12J2DTevBlock8FUc, + (void*)setFontUndeleteFlag__12J2DTevBlock8Fv, + (void*)__dt__12J2DTevBlock8Fv, +}; + +/* 803CCC40-803CCCFC 029D60 00BC+00 2/2 0/0 0/0 .data __vt__12J2DTevBlock4 */ +SECTION_DATA extern void* __vt__12J2DTevBlock4[47] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)initialize__12J2DTevBlock4Fv, + (void*)setGX__12J2DTevBlock4Fv, + (void*)loadTexture__12J2DTevBlock4F11_GXTexMapIDUl, + (void*)getType__12J2DTevBlock4Fv, + (void*)getMaxStage__12J2DTevBlock4Fv, + (void*)setTexNo__12J2DTevBlock4FUlUs, + (void*)getTexNo__12J2DTevBlock4CFUl, + (void*)setFontNo__12J2DTevBlock4FUs, + (void*)getFontNo__12J2DTevBlock4CFv, + (void*)setTevOrder__12J2DTevBlock4FUl11J2DTevOrder, + (void*)getTevOrder__12J2DTevBlock4FUl, + (void*)setTevColor__12J2DTevBlock4FUl13J2DGXColorS10, + (void*)getTevColor__12J2DTevBlock4FUl, + (void*)setTevKColor__12J2DTevBlock4FUlQ28JUtility6TColor, + (void*)getTevKColor__12J2DTevBlock4FUl, + (void*)setTevKColorSel__12J2DTevBlock4FUlUc, + (void*)getTevKColorSel__12J2DTevBlock4FUl, + (void*)setTevKAlphaSel__12J2DTevBlock4FUlUc, + (void*)getTevKAlphaSel__12J2DTevBlock4FUl, + (void*)setTevStageNum__12J2DTevBlock4FUc, + (void*)getTevStageNum__12J2DTevBlock4CFv, + (void*)setTevStage__12J2DTevBlock4FUl11J2DTevStage, + (void*)getTevStage__12J2DTevBlock4FUl, + (void*)setTevSwapModeInfo__12J2DTevBlock4FUl18J2DTevSwapModeInfo, + (void*)setTevSwapModeTable__12J2DTevBlock4FUl19J2DTevSwapModeTable, + (void*)getTevSwapModeTable__12J2DTevBlock4FUl, + (void*)setIndTevStage__12J2DTevBlock4FUl14J2DIndTevStage, + (void*)getIndTevStage__12J2DTevBlock4FUl, + (void*)insertTexture__12J2DTevBlock4FUlPC7ResTIMG, + (void*)insertTexture__12J2DTevBlock4FUlPC7ResTIMGP10JUTPalette, + (void*)insertTexture__12J2DTevBlock4FUlP10JUTTexture, + (void*)setTexture__12J2DTevBlock4FUlPC7ResTIMG, + (void*)setTexture__12J2DTevBlock4FUlP10JUTTexture, + (void*)removeTexture__12J2DTevBlock4FUl, + (void*)setFont__12J2DTevBlock4FP7ResFONT, + (void*)setFont__12J2DTevBlock4FP7JUTFont, + (void*)setPalette__12J2DTevBlock4FUlPC7ResTLUT, + (void*)prepareTexture__12J2DTevBlock4FUc, + (void*)getTexture__12J2DTevBlock4FUl, + (void*)getPalette__12J2DTevBlock4FUl, + (void*)getFont__12J2DTevBlock4Fv, + (void*)shiftDeleteFlag__12J2DTevBlock4FUcb, + (void*)setUndeleteFlag__12J2DTevBlock4FUc, + (void*)setFontUndeleteFlag__12J2DTevBlock4Fv, + (void*)__dt__12J2DTevBlock4Fv, +}; + +/* 803CCCFC-803CCDB8 029E1C 00BC+00 2/2 0/0 0/0 .data __vt__12J2DTevBlock2 */ +SECTION_DATA extern void* __vt__12J2DTevBlock2[47] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)initialize__12J2DTevBlock2Fv, + (void*)setGX__12J2DTevBlock2Fv, + (void*)loadTexture__12J2DTevBlock2F11_GXTexMapIDUl, + (void*)getType__12J2DTevBlock2Fv, + (void*)getMaxStage__12J2DTevBlock2Fv, + (void*)setTexNo__12J2DTevBlock2FUlUs, + (void*)getTexNo__12J2DTevBlock2CFUl, + (void*)setFontNo__12J2DTevBlock2FUs, + (void*)getFontNo__12J2DTevBlock2CFv, + (void*)setTevOrder__12J2DTevBlock2FUl11J2DTevOrder, + (void*)getTevOrder__12J2DTevBlock2FUl, + (void*)setTevColor__12J2DTevBlock2FUl13J2DGXColorS10, + (void*)getTevColor__12J2DTevBlock2FUl, + (void*)setTevKColor__12J2DTevBlock2FUlQ28JUtility6TColor, + (void*)getTevKColor__12J2DTevBlock2FUl, + (void*)setTevKColorSel__12J2DTevBlock2FUlUc, + (void*)getTevKColorSel__12J2DTevBlock2FUl, + (void*)setTevKAlphaSel__12J2DTevBlock2FUlUc, + (void*)getTevKAlphaSel__12J2DTevBlock2FUl, + (void*)setTevStageNum__12J2DTevBlock2FUc, + (void*)getTevStageNum__12J2DTevBlock2CFv, + (void*)setTevStage__12J2DTevBlock2FUl11J2DTevStage, + (void*)getTevStage__12J2DTevBlock2FUl, + (void*)setTevSwapModeInfo__12J2DTevBlock2FUl18J2DTevSwapModeInfo, + (void*)setTevSwapModeTable__12J2DTevBlock2FUl19J2DTevSwapModeTable, + (void*)getTevSwapModeTable__12J2DTevBlock2FUl, + (void*)setIndTevStage__12J2DTevBlock2FUl14J2DIndTevStage, + (void*)getIndTevStage__12J2DTevBlock2FUl, + (void*)insertTexture__12J2DTevBlock2FUlPC7ResTIMG, + (void*)insertTexture__12J2DTevBlock2FUlPC7ResTIMGP10JUTPalette, + (void*)insertTexture__12J2DTevBlock2FUlP10JUTTexture, + (void*)setTexture__12J2DTevBlock2FUlPC7ResTIMG, + (void*)setTexture__12J2DTevBlock2FUlP10JUTTexture, + (void*)removeTexture__12J2DTevBlock2FUl, + (void*)setFont__12J2DTevBlock2FP7ResFONT, + (void*)setFont__12J2DTevBlock2FP7JUTFont, + (void*)setPalette__12J2DTevBlock2FUlPC7ResTLUT, + (void*)prepareTexture__12J2DTevBlock2FUc, + (void*)getTexture__12J2DTevBlock2FUl, + (void*)getPalette__12J2DTevBlock2FUl, + (void*)getFont__12J2DTevBlock2Fv, + (void*)shiftDeleteFlag__12J2DTevBlock2FUcb, + (void*)setUndeleteFlag__12J2DTevBlock2FUc, + (void*)setFontUndeleteFlag__12J2DTevBlock2Fv, + (void*)__dt__12J2DTevBlock2Fv, +}; + +/* 803CCDB8-803CCE74 029ED8 00BC+00 2/2 0/0 0/0 .data __vt__12J2DTevBlock1 */ +SECTION_DATA extern void* __vt__12J2DTevBlock1[47] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)initialize__12J2DTevBlock1Fv, + (void*)setGX__12J2DTevBlock1Fv, + (void*)loadTexture__12J2DTevBlock1F11_GXTexMapIDUl, + (void*)getType__12J2DTevBlock1Fv, + (void*)getMaxStage__12J2DTevBlock1Fv, + (void*)setTexNo__12J2DTevBlock1FUlUs, + (void*)getTexNo__12J2DTevBlock1CFUl, + (void*)setFontNo__12J2DTevBlock1FUs, + (void*)getFontNo__12J2DTevBlock1CFv, + (void*)setTevOrder__12J2DTevBlock1FUl11J2DTevOrder, + (void*)getTevOrder__12J2DTevBlock1FUl, + (void*)setTevColor__12J2DTevBlock1FUl13J2DGXColorS10, + (void*)getTevColor__12J2DTevBlock1FUl, + (void*)setTevKColor__12J2DTevBlock1FUlQ28JUtility6TColor, + (void*)getTevKColor__12J2DTevBlock1FUl, + (void*)setTevKColorSel__12J2DTevBlock1FUlUc, + (void*)getTevKColorSel__12J2DTevBlock1FUl, + (void*)setTevKAlphaSel__12J2DTevBlock1FUlUc, + (void*)getTevKAlphaSel__12J2DTevBlock1FUl, + (void*)setTevStageNum__12J2DTevBlock1FUc, + (void*)getTevStageNum__12J2DTevBlock1CFv, + (void*)setTevStage__12J2DTevBlock1FUl11J2DTevStage, + (void*)getTevStage__12J2DTevBlock1FUl, + (void*)setTevSwapModeInfo__12J2DTevBlock1FUl18J2DTevSwapModeInfo, + (void*)setTevSwapModeTable__12J2DTevBlock1FUl19J2DTevSwapModeTable, + (void*)getTevSwapModeTable__12J2DTevBlock1FUl, + (void*)setIndTevStage__12J2DTevBlock1FUl14J2DIndTevStage, + (void*)getIndTevStage__12J2DTevBlock1FUl, + (void*)insertTexture__12J2DTevBlock1FUlPC7ResTIMG, + (void*)insertTexture__12J2DTevBlock1FUlPC7ResTIMGP10JUTPalette, + (void*)insertTexture__12J2DTevBlock1FUlP10JUTTexture, + (void*)setTexture__12J2DTevBlock1FUlPC7ResTIMG, + (void*)setTexture__12J2DTevBlock1FUlP10JUTTexture, + (void*)removeTexture__12J2DTevBlock1FUl, + (void*)setFont__12J2DTevBlock1FP7ResFONT, + (void*)setFont__12J2DTevBlock1FP7JUTFont, + (void*)setPalette__12J2DTevBlock1FUlPC7ResTLUT, + (void*)prepareTexture__12J2DTevBlock1FUc, + (void*)getTexture__12J2DTevBlock1FUl, + (void*)getPalette__12J2DTevBlock1FUl, + (void*)getFont__12J2DTevBlock1Fv, + (void*)shiftDeleteFlag__12J2DTevBlock1FUcb, + (void*)setUndeleteFlag__12J2DTevBlock1FUc, + (void*)setFontUndeleteFlag__12J2DTevBlock1Fv, + (void*)__dt__12J2DTevBlock1Fv, +}; + +/* 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]; + } + } +} + +/* 802EB6A4-802EB7E0 2E5FE4 013C+00 0/0 3/3 0/0 .text setTexMtx__14J2DTexGenBlockFUlR9J2DTexMtx */ +void J2DTexGenBlock::setTexMtx(u32 param_0, J2DTexMtx& param_1) { + if (!mTexMtx[param_0]) { + mTexMtx[param_0] = new J2DTexMtx(param_1.getTexMtxInfo()); + if (!mTexMtx[param_0]) { + return; + } + } else { + mTexMtx[param_0]->setTexMtxInfo(param_1.getTexMtxInfo()); + } + mTexMtx[param_0]->calc(); +} + +/* 802EB7E0-802EB87C 2E6120 009C+00 0/0 1/1 0/0 .text getTexMtx__14J2DTexGenBlockFUlR9J2DTexMtx */ +void J2DTexGenBlock::getTexMtx(u32 param_0, J2DTexMtx& param_1) { + if (mTexMtx[param_0]) { + param_1.setTexMtxInfo(mTexMtx[param_0]->getTexMtxInfo()); + } +} + +/* 802EB87C-802EB884 2E61BC 0008+00 1/0 0/0 0/0 .text getTexture__11J2DTevBlockFUl */ +JUTTexture* J2DTevBlock::getTexture(u32) { + return NULL; +} + +/* 802EB884-802EB88C 2E61C4 0008+00 1/0 0/0 0/0 .text getPalette__11J2DTevBlockFUl */ +JUTPalette* J2DTevBlock::getPalette(u32) { + return NULL; +} + +/* 802EB88C-802EB998 2E61CC 010C+00 0/0 1/1 0/0 .text __ct__12J2DTevBlock1Fv */ +J2DTevBlock1::J2DTevBlock1() { + mTexture[0] = NULL; + mUndeleteFlag = 0; + initialize(); +} + +/* 802EB998-802EBA50 2E62D8 00B8+00 1/0 0/0 0/0 .text __dt__12J2DTevBlock1Fv */ +J2DTevBlock1::~J2DTevBlock1() { + if (mUndeleteFlag & 1) { + delete mTexture[0]; + } + + delete mPalette[0]; + + if (mUndeleteFlag & 0x80) { + delete mFont; + } +} + +/* 802EBA50-802EBC0C 2E6390 01BC+00 1/0 0/0 0/0 .text initialize__12J2DTevBlock1Fv */ +// inlines +#ifdef NONMATCHING +void J2DTevBlock1::initialize() { + mTexNo[0] = -1; + mFontNo = -1; + mTevOrder[0].setTevOrderInfo(j2dDefaultTevOrderInfoNull); + for (int i = 0; i < 4; i++) { + mTevColor[i] = j2dDefaultTevColor; + } + mTevStage[0].setStageNo(0); + for (int i = 0; i < 4; i++) { + mTevKColor[i] = j2dDefaultTevKColor; + } + mTevKColorSel[0] = -1; + mTevKAlphaSel[0] = -1; + for (int i = 0; i < 4; i++) { + mTevSwapModeTable[i].setTevSwapModeTableInfo(j2dDefaultTevSwapModeTable); + } + mIndTevStage[0].setIndTevStageInfo(j2dDefaultIndTevStageInfo); + mPalette[0] = NULL; + mFont = NULL; +} +#else +extern "C" void initialize__12J2DTevBlock1Fv() { + // asm void J2DTevBlock1::initialize() { + // NONMATCHING +} +#endif + +/* 802EBC0C-802EBCC0 2E654C 00B4+00 1/0 0/0 0/0 .text prepareTexture__12J2DTevBlock1FUc + */ +bool J2DTevBlock1::prepareTexture(u8 param_0) { + if (param_0 == 0) { + return true; + } + + if (mTexture[0] == NULL) { + mTexture[0] = new JUTTexture(); + + if (mTexture[0] == NULL) { + return false; + } + mUndeleteFlag = (mUndeleteFlag & 0x80) | 1; + } + + return param_0 <= 1; +} + +/* 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; + } + + if (mTexture[0] != NULL && mTexture[0]->getTexInfo() != NULL) { + return false; + } + + if (mTexture[0] == NULL) { + mTexture[0] = new JUTTexture(p_timg, 0); + + if (mTexture[0] == NULL) { + return false; + } + + if (p_tlut != NULL) { + mTexture[0]->storeTIMG(p_timg, p_tlut); + } + } else if (p_tlut == NULL) { + mTexture[0]->storeTIMG(p_timg, (u8)0); + } else { + mTexture[0]->storeTIMG(p_timg, p_tlut); + } + + mUndeleteFlag = (mUndeleteFlag & 0x80) | 1; + mPalette[0] = NULL; + mTexNo[0] = -1; + return true; +} + +/* 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; + } + + if (param_0 != 0 || p_tex == NULL) { + return false; + } + + if (mUndeleteFlag & 1) { + delete mTexture[0]; + } + + mTexture[0] = p_tex; + mUndeleteFlag &= 0x80; + mPalette[0] = NULL; + mTexNo[0] = -1; + return true; +} + +/* 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; + } + + if (mTexture[0] == NULL) { + if (p_timg != NULL) { + mTexture[0] = new JUTTexture(p_timg, 0); + + if (mTexture[0] == NULL) { + return false; + } + + mUndeleteFlag = (mUndeleteFlag & 0x80) | 1; + } else { + mUndeleteFlag &= 0x80; + } + } else if (mUndeleteFlag & 1) { + if (p_timg != NULL) { + mTexture[0]->storeTIMG(p_timg, (u8)0); + } else { + delete mTexture[0]; + mTexture[0] = NULL; + mUndeleteFlag &= 0x80; + } + } else { + mTexture[0] = NULL; + + if (p_timg != NULL) { + mTexture[0] = new JUTTexture(p_timg, 0); + + if (mTexture[0] == NULL) { + return false; + } + + mUndeleteFlag = (mUndeleteFlag & 0x80) | 1; + } + } + + delete mPalette[0]; + mPalette[0] = NULL; + mTexNo[0] = -1; + return true; +} + +/* 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; + } + + if (mUndeleteFlag & 1) { + delete mTexture[0]; + } + + mTexture[0] = p_tex; + mUndeleteFlag &= 0x80; + delete mPalette[0]; + mPalette[0] = NULL; + mTexNo[0] = -1; + return true; +} + +/* 802EC0A8-802EC124 2E69E8 007C+00 1/0 0/0 0/0 .text removeTexture__12J2DTevBlock1FUl */ +bool J2DTevBlock1::removeTexture(u32 param_0) { + if (param_0 >= 1) { + return false; + } + + if (mUndeleteFlag & 1) { + delete mTexture[0]; + } + + mTexture[0] = NULL; + mUndeleteFlag &= 0x80; + delete mPalette[0]; + mTexNo[0] = -1; + return true; +} + +/* 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; + } + + JUTResFont* resFont = new JUTResFont(p_font, NULL); + if (resFont == NULL) { + return false; + } + + if (mUndeleteFlag & 0x80) { + delete mFont; + } + + mFont = resFont; + mUndeleteFlag = (mUndeleteFlag & 0x7F) | 0x80; + return true; +} + +/* 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; + } + + if (mUndeleteFlag & 0x80) { + delete mFont; + } + + mFont = (JUTResFont*)p_font; + mUndeleteFlag = mUndeleteFlag & 0x7F; + return true; +} + +/* 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; + } + + if (p_tlut != NULL) { + if (mPalette[0] == NULL) { + mPalette[0] = new JUTPalette(GX_TLUT0, (ResTLUT*)p_tlut); + + if (mPalette[0] == NULL) { + return false; + } + } else { + mPalette[0]->storeTLUT(GX_TLUT0, (ResTLUT*)p_tlut); + } + + if (mTexture[0] != NULL) { + mTexture[0]->attachPalette(mPalette[0]); + } + } else { + delete mPalette[0]; + mPalette[0] = NULL; + } + + return true; +} + +/* 802EC318-802EC328 2E6C58 0010+00 1/0 0/0 0/0 .text shiftDeleteFlag__12J2DTevBlock1FUcb + */ +void J2DTevBlock1::shiftDeleteFlag(u8, bool) { + mUndeleteFlag &= 0x80; +} + +/* 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()); + + for (int i = 0; i < 4; i++) { + GXSetTevColorS10(i != 3 ? GXTevRegID(i + 1) : GX_TEVPREV, mTevColor[i]); + } + + GXSetNumTevStages(1); + GXSetTevColorIn(GX_TEVSTAGE0, GXTevColorArg(mTevStage[0].getColorA()), + GXTevColorArg(mTevStage[0].getColorB()), + GXTevColorArg(mTevStage[0].getColorC()), + GXTevColorArg(mTevStage[0].getColorD())); + GXSetTevAlphaIn(GX_TEVSTAGE0, GXTevAlphaArg(mTevStage[0].getAlphaA()), + GXTevAlphaArg(mTevStage[0].getAlphaB()), + GXTevAlphaArg(mTevStage[0].getAlphaC()), + GXTevAlphaArg(mTevStage[0].getAlphaD())); + GXSetTevColorOp(GX_TEVSTAGE0, GXTevOp(mTevStage[0].getCOp()), + GXTevBias(mTevStage[0].getCBias()), GXTevScale(mTevStage[0].getCScale()), + mTevStage[0].getCClamp(), GXTevRegID(mTevStage[0].getCReg())); + GXSetTevAlphaOp(GX_TEVSTAGE0, (GXTevOp)mTevStage[0].getAOp(), + GXTevBias(mTevStage[0].getABias()), GXTevScale(mTevStage[0].getAScale()), + mTevStage[0].getAClamp(), GXTevRegID(mTevStage[0].getAReg())); + GXSetTevKColorSel(GX_TEVSTAGE0, mTevKColorSel[0] != 0xff ? GXTevKColorSel(mTevKColorSel[0]) : GX_TEV_KCSEL_1); + GXSetTevKAlphaSel(GX_TEVSTAGE0, mTevKAlphaSel[0] != 0xff ? GXTevKAlphaSel(mTevKAlphaSel[0]) : GX_TEV_KASEL_1); + for (int i = 0; i < 4; i++) { + GXSetTevKColor(GXTevKColorID(i), mTevKColor[i]); + } + GXSetTevSwapMode(GX_TEVSTAGE0, GXTevSwapSel(mTevStage[0].getRasSel()), GXTevSwapSel(mTevStage[0].getTexSel())); + for (int i = 0; i < 4; i++) { + GXSetTevSwapModeTable(GXTevSwapSel(i), GXTevColor(mTevSwapModeTable[i].getR()), + GXTevColor(mTevSwapModeTable[i].getG()), + GXTevColor(mTevSwapModeTable[i].getB()), + GXTevColor(mTevSwapModeTable[i].getA())); + } + mIndTevStage->load(0); +} + +/* 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); + } +} + +/* 802EC5B8-802EC6C8 2E6EF8 0110+00 0/0 1/1 0/0 .text __ct__12J2DTevBlock2Fv */ +J2DTevBlock2::J2DTevBlock2() { + mTexture[0] = NULL; + mTexture[1] = NULL; + mUndeleteFlag = 0; + initialize(); +} + +/* 802EC6C8-802EC7A0 2E7008 00D8+00 1/0 0/0 0/0 .text __dt__12J2DTevBlock2Fv */ +J2DTevBlock2::~J2DTevBlock2() { + if (mUndeleteFlag & 1) { + delete mTexture[0]; + } + + if (mUndeleteFlag & 2) { + delete mTexture[1]; + } + + delete mPalette[0]; + delete mPalette[1]; + + if (mUndeleteFlag & 0x80) { + delete mFont; + } +} + +/* 802EC7A0-802ECA18 2E70E0 0278+00 1/0 0/0 0/0 .text initialize__12J2DTevBlock2Fv */ +extern "C" void initialize__12J2DTevBlock2Fv() { + // asm void J2DTevBlock2::initialize() { + // NONMATCHING +} + +/* 802ECA18-802ECAE8 2E7358 00D0+00 1/0 0/0 0/0 .text prepareTexture__12J2DTevBlock2FUc + */ +bool J2DTevBlock2::prepareTexture(u8 param_0) { + for (u8 i = 0; i < param_0; i++) { + if (i >= 2) { + return false; + } + + if (mTexture[i] == NULL) { + mTexture[i] = new JUTTexture(); + + if (mTexture[i] == NULL) { + return false; + } + mUndeleteFlag |= (1 << i); + } + } + + return true; +} + +/* 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; + } + + u8 texNo = 0; + for (; texNo < 2; texNo++) { + if (mTexture[texNo] == NULL || mTexture[texNo]->getTexInfo() == NULL) { + break; + } + } + + if (texNo < param_0) { + return false; + } + + if (texNo == 2) { + return false; + } + + JUTTexture* tex; + u8 tlutid = 0; + if (p_timg->indexTexture && p_tlut == NULL) { + tex = mTexture[0]; + if (tex != NULL && tex->getTexInfo() != NULL && tex->getTexInfo()->indexTexture) { + int tlutname = tex->getTlutName(); + if (tlutname == GX_TLUT0 || tlutname == GX_BIGTLUT0) { + tlutid = 1; + } + } + } + + tex = mTexture[texNo]; + if (tex == NULL) { + JUTTexture* newtex = new JUTTexture(p_timg, tlutid); + + if (newtex == NULL) { + return false; + } + + if (p_tlut != NULL) { + newtex->storeTIMG(p_timg, p_tlut); + } + + if (param_0 == 0) { + mTexture[1] = mTexture[0]; + mPalette[1] = mPalette[0]; + mTexNo[1] = mTexNo[0]; + } + mTexture[param_0] = newtex; + shiftDeleteFlag(param_0, true); + mUndeleteFlag |= (1 << param_0); + } else { + if (p_tlut == NULL) { + tex->storeTIMG(p_timg, tlutid); + } else { + tex->storeTIMG(p_timg, p_tlut); + } + + bool local_28[2]; + for (u8 i = 0; i < 2; i++) { + local_28[i] = mUndeleteFlag & (1 << i); + } + + if (param_0 == 0 && texNo == 1) { + mTexture[1] = mTexture[0]; + mPalette[1] = mPalette[0]; + mTexNo[1] = mTexNo[0]; + local_28[1] = local_28[0]; + } + mTexture[param_0] = tex; + mUndeleteFlag &= 0x80; + + for (u8 i = 0; i < 2; i++) { + if (local_28[i]) { + mUndeleteFlag |= (1 << i); + } + } + + mUndeleteFlag |= (1 << param_0); + } + + mPalette[param_0] = NULL; + mTexNo[param_0] = -1; + return true; +} + +/* 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; + } + + u8 texNo = 0; + for (; texNo < 2; texNo++) { + if (mTexture[texNo] == NULL || mTexture[texNo]->getTexInfo() == NULL) { + break; + } + } + + if (texNo < param_0) { + return false; + } + + if (texNo == 2) { + return false; + } + + if (mTexture[1] != NULL && mTexture[1]->getTexInfo() == NULL) { + if (mUndeleteFlag & 2) { + delete mTexture[1]; + } + + mUndeleteFlag &= ~2; + } + + if (param_0 == 0) { + mTexture[1] = mTexture[0]; + mPalette[1] = mPalette[0]; + mTexNo[1] = mTexNo[0]; + } + + mTexture[param_0] = p_tex; + mPalette[param_0] = NULL; + mTexNo[param_0] = -1; + shiftDeleteFlag(param_0, true); + mUndeleteFlag &= ~(1 << param_0); + return true; +} + +/* 802ECF48-802ED16C 2E7888 0224+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock2FUlPC7ResTIMG */ +// instruction order +#ifdef NONMATCHING +bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) { + if (param_0 >= 2) { + return false; + } + + u8 tlutid = 0; + if (p_timg != NULL && p_timg->indexTexture) { + if (mTexture[param_0 == 0] != NULL) { + const ResTIMG* timg = mTexture[param_0 == 0]->getTexInfo(); + if (timg != NULL && timg->indexTexture) { + int tlutname = mTexture[param_0 == 0]->getTlutName(); + u8 var_r0 = 0; + + if (tlutname >= 16) { + var_r0 = 16; + } + + if (tlutname - var_r0 == 0) { + tlutid = 1; + } + } + } + } + + if (mTexture[param_0] == NULL) { + if (p_timg != NULL) { + mTexture[param_0] = new JUTTexture(p_timg, tlutid); + + if (mTexture[param_0] == NULL) { + return false; + } + + mUndeleteFlag |= (1 << param_0); + } else { + mUndeleteFlag &= ~(1 << param_0); + } + } else if (mUndeleteFlag & (1 << param_0)) { + if (p_timg != NULL) { + mTexture[param_0]->storeTIMG(p_timg, tlutid); + } else { + delete mTexture[param_0]; + mTexture[param_0] = NULL; + mUndeleteFlag &= ~(1 << param_0); + } + } else { + mTexture[param_0] = NULL; + + if (p_timg != NULL) { + mTexture[param_0] = new JUTTexture(p_timg, 0); + + if (mTexture[param_0] == NULL) { + return false; + } + + mUndeleteFlag |= (1 << param_0); + } + } + + delete mPalette[param_0]; + mPalette[param_0] = NULL; + mTexNo[param_0] = -1; + return true; +} +#else +bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* param_1) { + // NONMATCHING +} +#endif + +/* 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; + } + + if (mUndeleteFlag & (1 << param_0)) { + delete mTexture[param_0]; + } + + mTexture[param_0] = p_tex; + mUndeleteFlag &= ~(1 << param_0); + delete mPalette[param_0]; + mPalette[param_0] = NULL; + mTexNo[param_0] = -1; + return true; +} + +/* 802ED21C-802ED2F0 2E7B5C 00D4+00 1/0 0/0 0/0 .text removeTexture__12J2DTevBlock2FUl */ +bool J2DTevBlock2::removeTexture(u32 param_0) { + if (param_0 >= 2) { + return false; + } + + if (mUndeleteFlag & (1 << param_0)) { + delete mTexture[param_0]; + } + delete mPalette[param_0]; + + if (param_0 == 0) { + mTexture[0] = mTexture[1]; + mPalette[0] = mPalette[1]; + mTexNo[0] = mTexNo[1]; + } + + mTexture[1] = NULL; + mPalette[1] = NULL; + mTexNo[1] = -1; + shiftDeleteFlag(param_0, false); + return true; +} + +/* 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; + } + + JUTResFont* resFont = new JUTResFont(p_font, NULL); + if (resFont == NULL) { + return false; + } + + if (mUndeleteFlag & 0x80) { + delete mFont; + } + + mFont = resFont; + mUndeleteFlag = (mUndeleteFlag & 0x7F) | 0x80; + return true; +} + +/* 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; + } + + if (mUndeleteFlag & 0x80) { + delete mFont; + } + + mFont = (JUTResFont*)p_font; + mUndeleteFlag = mUndeleteFlag & 0x7F; + return true; +} + +/* 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; + } + + if (p_tlut != NULL) { + if (mPalette[param_0] == NULL) { + mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); + + if (mPalette[param_0] == NULL) { + return false; + } + } else { + mPalette[param_0]->storeTLUT(GX_TLUT0, (ResTLUT*)p_tlut); + } + + if (mTexture[param_0] != NULL) { + mTexture[param_0]->attachPalette(mPalette[param_0]); + } + } else { + delete mPalette[param_0]; + mPalette[param_0] = NULL; + } + + return true; +} + +/* 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; + + if (param_1) { + mUndeleteFlag = (mUndeleteFlag & ((1 << param_0) - 1)) | ((mUndeleteFlag & ~((1 << param_0) - 1)) * 2); + } else { + mUndeleteFlag = (mUndeleteFlag & ((1 << param_0) - 1)) | ((mUndeleteFlag & ~((1 << (param_0 + 1)) - 1)) >> 1); + } + + mUndeleteFlag |= tmpFlags; +} + +/* 802ED584-802ED874 2E7EC4 02F0+00 1/0 0/0 0/0 .text setGX__12J2DTevBlock2Fv */ +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()); + } + 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()), + GXTevColorArg(mTevStage[i].getColorB()), + GXTevColorArg(mTevStage[i].getColorC()), + GXTevColorArg(mTevStage[i].getColorD())); + GXSetTevAlphaIn(GXTevStageID(i), GXTevAlphaArg(mTevStage[i].getAlphaA()), + GXTevAlphaArg(mTevStage[i].getAlphaB()), + GXTevAlphaArg(mTevStage[i].getAlphaC()), + GXTevAlphaArg(mTevStage[i].getAlphaD())); + GXSetTevColorOp(GXTevStageID(i), GXTevOp(mTevStage[i].getCOp()), + GXTevBias(mTevStage[i].getCBias()), GXTevScale(mTevStage[i].getCScale()), + mTevStage[i].getCClamp(), GXTevRegID(mTevStage[i].getCReg())); + GXSetTevAlphaOp(GXTevStageID(i), (GXTevOp)mTevStage[i].getAOp(), + GXTevBias(mTevStage[i].getABias()), GXTevScale(mTevStage[i].getAScale()), + mTevStage[i].getAClamp(), GXTevRegID(mTevStage[i].getAReg())); + 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), GXTevColor(mTevSwapModeTable[i].getR()), + GXTevColor(mTevSwapModeTable[i].getG()), + GXTevColor(mTevSwapModeTable[i].getB()), + GXTevColor(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 + */ +void J2DTevBlock2::loadTexture(GXTexMapID texmapID, u32 texIndex) { + if (texIndex < 2 && mTexture[texIndex] != NULL && mTexture[texIndex]->getTexInfo() != NULL) { + mTexture[texIndex]->load(texmapID); + } +} + +/* 802ED8BC-802ED9E4 2E81FC 0128+00 0/0 1/1 0/0 .text __ct__12J2DTevBlock4Fv */ +J2DTevBlock4::J2DTevBlock4() { + for (int i = 0; i < 4; i++) { + mTexture[i] = NULL; + } + + mUndeleteFlag = 0; + initialize(); +} + +/* 802ED9E4-802EDAC4 2E8324 00E0+00 1/0 0/0 0/0 .text __dt__12J2DTevBlock4Fv */ +J2DTevBlock4::~J2DTevBlock4() { + for (int i = 0; i < 4; i++) { + if (mUndeleteFlag & (1 << i)) { + delete mTexture[i]; + } + delete mPalette[i]; + } + + if (mUndeleteFlag & 0x80) { + delete mFont; + } +} + +/* 802EDAC4-802EDD34 2E8404 0270+00 1/0 0/0 0/0 .text initialize__12J2DTevBlock4Fv */ +// inlines +#ifdef NONMATCHING +void J2DTevBlock4::initialize() { + for (int i = 0; i < 4; i++) { + mTexNo[i] = -1; + } + mFontNo = -1; + for (int i = 0; i < 4; i++) { + mTevOrder[i].setTevOrderInfo(j2dDefaultTevOrderInfoNull); + } + for (int i = 0; i < 4; i++) { + mTevColor[i] = j2dDefaultTevColor; + } + mTevStageNum = 1; + for (int i = 0; i < 4; i++) { + mTevStage[i].setStageNo(i); + } + for (int i = 0; i < 4; i++) { + mTevKColor[i] = j2dDefaultTevKColor; + } + for (int i = 0; i < 4; i++) { + mTevKColorSel[i] = -1; + mTevKAlphaSel[i] = -1; + } + for (int i = 0; i < 4; i++) { + mTevSwapModeTable[i].setTevSwapModeTableInfo(j2dDefaultTevSwapModeTable); + } + for (int i = 0; i < 4; i++) { + mIndTevStage[i].setIndTevStageInfo(j2dDefaultIndTevStageInfo); + } + for (int i = 0; i < 4; i++) { + mPalette[i] = NULL; + } + mFont = NULL; +} +#else +extern "C" void initialize__12J2DTevBlock4Fv() { + // asm void J2DTevBlock4::initialize() { + // NONMATCHING +} +#endif + +/* 802EDD34-802EDE04 2E8674 00D0+00 1/0 0/0 0/0 .text prepareTexture__12J2DTevBlock4FUc + */ +bool J2DTevBlock4::prepareTexture(u8 param_0) { + for (u8 i = 0; i < param_0; i++) { + if (i >= 4) { + return 0; + } + + if (mTexture[i] == NULL) { + mTexture[i] = new JUTTexture(); + + if (mTexture[i] == NULL) { + return false; + } + mUndeleteFlag |= (1 << i); + } + } + + return true; +} + +/* 802EDE04-802EE1D4 2E8744 03D0+00 1/0 0/0 0/0 .text + * insertTexture__12J2DTevBlock4FUlPC7ResTIMGP10JUTPalette */ +// local_3c +#ifdef NONMATCHING +bool J2DTevBlock4::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette* p_tlut) { + if (param_0 >= 4 || !p_timg) { + return false; + } + u8 idx; + for (idx = 0; idx < 4; idx++) { + if (!mTexture[idx] || !mTexture[idx]->getTexInfo()) { + break; + } + } + if (idx < param_0) { + return false; + } + if (idx == 4) { + return false; + } + u8 local_43 = 0; + if (p_timg->indexTexture && !p_tlut) { + u8 local_44 = 0; + for (int i = 0; i < 3; i++) { + if (!mTexture[i]) { + continue; + } + const ResTIMG* texInfo = mTexture[i]->getTexInfo(); + if (!texInfo) { + continue; + } + if (!texInfo->indexTexture) { + continue; + } + u8 tlutName = mTexture[i]->getTlutName(); + int local_3c = tlutName >= 0x10 ? 0x10 : 0; + u8 bVar1 = tlutName - local_3c; + if (bVar1 < 4) { + local_44 |= 1 << bVar1; + } + } + for (u8 i = 0; i < 4; i++) { + if ((local_44 & 1 << i) == 0) { + local_43 = i; + break; + } + } + } + if (!mTexture[idx]) { + JUTTexture* texture = new JUTTexture(p_timg, local_43); + if (!texture) { + return false; + } + if (p_tlut) { + texture->storeTIMG(p_timg, p_tlut); + } + for (u8 i = 3; i > param_0; i--) { + mTexture[i] = mTexture[i - 1]; + mPalette[i] = mPalette[i - 1]; + mTexNo[i] = mTexNo[i - 1]; + } + mTexture[param_0] = texture; + shiftDeleteFlag(param_0, true); + mUndeleteFlag |= 1 << param_0; + } else { + JUTTexture* texture = mTexture[idx]; + if (!p_tlut) { + texture->storeTIMG(p_timg, local_43); + } else { + texture->storeTIMG(p_timg, p_tlut); + } + u8 local_38[4]; + for (u8 i = 0; i < 4; i++) { + local_38[i] = -(mUndeleteFlag & 1 << i) >> 0x1f; + } + for (; idx > param_0; idx--) { + mTexture[idx] = mTexture[idx - 1]; + mPalette[idx] = mPalette[idx - 1]; + mTexNo[idx] = mTexNo[idx - 1]; + local_38[idx] = local_38[idx - 1]; + } + mTexture[param_0] = texture; + mUndeleteFlag &= 0x80; + for (u8 i = 0; i < 4; i++) { + if (local_38[i]) { + mUndeleteFlag |= 1 << i; + } + } + mUndeleteFlag |= 1 << param_0; + } + mPalette[param_0] = NULL; + mTexNo[param_0] = -1; + return true; +} +#else +bool J2DTevBlock4::insertTexture(u32 param_0, ResTIMG const* param_1, JUTPalette* param_2) { + // NONMATCHING +} +#endif + +/* 802EE1D4-802EE364 2E8B14 0190+00 1/0 0/0 0/0 .text + * insertTexture__12J2DTevBlock4FUlP10JUTTexture */ +bool J2DTevBlock4::insertTexture(u32 param_0, JUTTexture* p_tex) { + if (param_0 >= 4 || p_tex == NULL) { + return false; + } + + u8 texNo = 0; + for (; texNo < 4; texNo++) { + if (mTexture[texNo] == NULL || mTexture[texNo]->getTexInfo() == NULL) { + break; + } + } + + if (texNo < param_0) { + return false; + } + + if (texNo == 4) { + return false; + } + + if (mTexture[3] != NULL && mTexture[3]->getTexInfo() == NULL) { + if (mUndeleteFlag & 8) { + delete mTexture[3]; + } + + mUndeleteFlag &= ~8; + } + + for (u8 i = 3; i > param_0; i--) { + mTexture[i] = mTexture[i - 1]; + mPalette[i] = mPalette[i - 1]; + mTexNo[i] = mTexNo[i - 1]; + } + + mTexture[param_0] = p_tex; + mPalette[param_0] = NULL; + mTexNo[param_0] = -1; + shiftDeleteFlag(param_0, true); + mUndeleteFlag &= ~(1 << param_0); + return true; +} + +/* 802EE364-802EE5F0 2E8CA4 028C+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock4FUlPC7ResTIMG */ +bool J2DTevBlock4::setTexture(u32 param_0, ResTIMG const* param_1) { + // NONMATCHING +} + +/* 802EE5F0-802EE6A0 2E8F30 00B0+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock4FUlP10JUTTexture + */ +bool J2DTevBlock4::setTexture(u32 param_0, JUTTexture* p_tex) { + if (param_0 >= 4) { + return false; + } + + if (mUndeleteFlag & (1 << param_0)) { + delete mTexture[param_0]; + } + + mTexture[param_0] = p_tex; + mUndeleteFlag &= ~(1 << param_0); + delete mPalette[param_0]; + mPalette[param_0] = NULL; + mTexNo[param_0] = -1; + return true; +} + +/* 802EE6A0-802EE798 2E8FE0 00F8+00 1/0 0/0 0/0 .text removeTexture__12J2DTevBlock4FUl */ +bool J2DTevBlock4::removeTexture(u32 param_0) { + if (param_0 >= 4) { + return false; + } + + if (mUndeleteFlag & (1 << param_0)) { + delete mTexture[param_0]; + } + delete mPalette[param_0]; + + for (u32 i = param_0; i < 3; i++) { + mTexture[i] = mTexture[i + 1]; + mPalette[i] = mPalette[i + 1]; + mTexNo[i] = mTexNo[i + 1]; + } + + mTexture[3] = NULL; + mPalette[3] = NULL; + mTexNo[3] = -1; + shiftDeleteFlag(param_0, false); + return true; +} + +/* 802EE798-802EE84C 2E90D8 00B4+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock4FP7ResFONT + */ +bool J2DTevBlock4::setFont(ResFONT* p_font) { + if (p_font == NULL) { + return false; + } + + JUTResFont* resFont = new JUTResFont(p_font, NULL); + if (resFont == NULL) { + return false; + } + + if (mUndeleteFlag & 0x80) { + delete mFont; + } + + mFont = resFont; + mUndeleteFlag = (mUndeleteFlag & 0x7F) | 0x80; + return true; +} + +/* 802EE84C-802EE8CC 2E918C 0080+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock4FP7JUTFont + */ +bool J2DTevBlock4::setFont(JUTFont* p_font) { + if (p_font == NULL) { + return false; + } + + if (mUndeleteFlag & 0x80) { + delete mFont; + } + + mFont = (JUTResFont*)p_font; + mUndeleteFlag = mUndeleteFlag & 0x7F; + return true; +} + +/* 802EE8CC-802EE9A4 2E920C 00D8+00 1/0 0/0 0/0 .text setPalette__12J2DTevBlock4FUlPC7ResTLUT */ +bool J2DTevBlock4::setPalette(u32 param_0, ResTLUT const* p_tlut) { + if (param_0 >= 4) { + return false; + } + + if (p_tlut != NULL) { + if (mPalette[param_0] == NULL) { + mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); + + if (mPalette[param_0] == NULL) { + return false; + } + } else { + mPalette[param_0]->storeTLUT(GX_TLUT0, (ResTLUT*)p_tlut); + } + + if (mTexture[param_0] != NULL) { + mTexture[param_0]->attachPalette(mPalette[param_0]); + } + } else { + delete mPalette[param_0]; + mPalette[param_0] = NULL; + } + + return true; +} + +/* 802EE9A4-802EEA2C 2E92E4 0088+00 1/0 0/0 0/0 .text shiftDeleteFlag__12J2DTevBlock4FUcb + */ +void J2DTevBlock4::shiftDeleteFlag(u8 param_0, bool param_1) { + u8 tmpFlags = mUndeleteFlag & 0x80; + mUndeleteFlag = mUndeleteFlag & 0x7F; + + if (param_1) { + mUndeleteFlag = (mUndeleteFlag & ((1 << param_0) - 1)) | ((mUndeleteFlag & ~((1 << param_0) - 1)) * 2); + } else { + mUndeleteFlag = (mUndeleteFlag & ((1 << param_0) - 1)) | ((mUndeleteFlag & ~((1 << (param_0 + 1)) - 1)) >> 1); + } + + mUndeleteFlag |= tmpFlags; +} + +/* 802EEA2C-802EED1C 2E936C 02F0+00 1/0 0/0 0/0 .text setGX__12J2DTevBlock4Fv */ +void J2DTevBlock4::setGX() { + for (int i = 0; i < 4; i++) { + loadTexture(GXTexMapID(i), i); + } + for (int i = 0; i < mTevStageNum; i++) { + GXSetTevOrder(GXTevStageID(i), mTevOrder[i].getTexCoord(), mTevOrder[i].getTexMap(), 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()), + GXTevColorArg(mTevStage[i].getColorB()), + GXTevColorArg(mTevStage[i].getColorC()), + GXTevColorArg(mTevStage[i].getColorD())); + GXSetTevAlphaIn(GXTevStageID(i), GXTevAlphaArg(mTevStage[i].getAlphaA()), + GXTevAlphaArg(mTevStage[i].getAlphaB()), + GXTevAlphaArg(mTevStage[i].getAlphaC()), + GXTevAlphaArg(mTevStage[i].getAlphaD())); + GXSetTevColorOp(GXTevStageID(i), GXTevOp(mTevStage[i].getCOp()), + GXTevBias(mTevStage[i].getCBias()), GXTevScale(mTevStage[i].getCScale()), + mTevStage[i].getCClamp(), GXTevRegID(mTevStage[i].getCReg())); + GXSetTevAlphaOp(GXTevStageID(i), (GXTevOp)mTevStage[i].getAOp(), + GXTevBias(mTevStage[i].getABias()), GXTevScale(mTevStage[i].getAScale()), + mTevStage[i].getAClamp(), GXTevRegID(mTevStage[i].getAReg())); + 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), GXTevColor(mTevSwapModeTable[i].getR()), + GXTevColor(mTevSwapModeTable[i].getG()), + GXTevColor(mTevSwapModeTable[i].getB()), + GXTevColor(mTevSwapModeTable[i].getA())); + } + for (u8 i = 0; i < mTevStageNum; i++) { + mIndTevStage[i].load(i); + } +} + +/* 802EED1C-802EED64 2E965C 0048+00 1/0 0/0 0/0 .text loadTexture__12J2DTevBlock4F11_GXTexMapIDUl + */ +void J2DTevBlock4::loadTexture(GXTexMapID texmapID, u32 texIndex) { + if (texIndex < 4 && mTexture[texIndex] != NULL && mTexture[texIndex]->getTexInfo() != NULL) { + mTexture[texIndex]->load(texmapID); + } +} + +/* 802EED64-802EEE8C 2E96A4 0128+00 0/0 1/1 0/0 .text __ct__12J2DTevBlock8Fv */ +J2DTevBlock8::J2DTevBlock8() { + for (int i = 0; i < 8; i++) { + mTexture[i] = NULL; + } + + mUndeleteFlag = 0; + initialize(); +} + +/* 802EEE8C-802EEF6C 2E97CC 00E0+00 1/0 0/0 0/0 .text __dt__12J2DTevBlock8Fv */ +J2DTevBlock8::~J2DTevBlock8() { + for (int i = 0; i < 8; i++) { + if (mUndeleteFlag & (1 << i)) { + delete mTexture[i]; + } + delete mPalette[i]; + } + + if (mFontUndeleteFlag) { + delete mFont; + } +} + +/* 802EEF6C-802EF1E0 2E98AC 0274+00 1/0 0/0 0/0 .text initialize__12J2DTevBlock8Fv */ +extern "C" void initialize__12J2DTevBlock8Fv() { + // asm void J2DTevBlock8::initialize() { + // NONMATCHING +} + +/* 802EF1E0-802EF2B0 2E9B20 00D0+00 1/0 0/0 0/0 .text prepareTexture__12J2DTevBlock8FUc + */ +bool J2DTevBlock8::prepareTexture(u8 param_0) { + for (u8 i = 0; i < param_0; i++) { + if (i >= 8) { + return 0; + } + + if (mTexture[i] == NULL) { + mTexture[i] = new JUTTexture(); + + if (mTexture[i] == NULL) { + return false; + } + mUndeleteFlag |= (1 << i); + } + } + + return true; +} + +/* 802EF2B0-802EF67C 2E9BF0 03CC+00 1/0 0/0 0/0 .text + * insertTexture__12J2DTevBlock8FUlPC7ResTIMGP10JUTPalette */ +bool J2DTevBlock8::insertTexture(u32 param_0, ResTIMG const* param_1, JUTPalette* param_2) { + // NONMATCHING +} + +/* 802EF67C-802EF80C 2E9FBC 0190+00 1/0 0/0 0/0 .text + * insertTexture__12J2DTevBlock8FUlP10JUTTexture */ +bool J2DTevBlock8::insertTexture(u32 param_0, JUTTexture* p_tex) { + if (param_0 >= 8 || p_tex == NULL) { + return false; + } + + u8 texNo = 0; + for (; texNo < 8; texNo++) { + if (mTexture[texNo] == NULL || mTexture[texNo]->getTexInfo() == NULL) { + break; + } + } + + if (texNo < param_0) { + return false; + } + + if (texNo == 8) { + return false; + } + + if (mTexture[7] != NULL && mTexture[7]->getTexInfo() == NULL) { + if (mUndeleteFlag & 0x80) { + delete mTexture[7]; + } + + mUndeleteFlag &= 0x7F; + } + + for (u8 i = 7; i > param_0; i--) { + mTexture[i] = mTexture[i - 1]; + mPalette[i] = mPalette[i - 1]; + mTexNo[i] = mTexNo[i - 1]; + } + + mTexture[param_0] = p_tex; + mPalette[param_0] = NULL; + mTexNo[param_0] = -1; + shiftDeleteFlag(param_0, true); + mUndeleteFlag &= ~(1 << param_0); + return true; +} + +/* 802EF80C-802EFA98 2EA14C 028C+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock8FUlPC7ResTIMG */ +bool J2DTevBlock8::setTexture(u32 param_0, ResTIMG const* param_1) { + // NONMATCHING +} + +/* 802EFA98-802EFB48 2EA3D8 00B0+00 1/0 0/0 0/0 .text setTexture__12J2DTevBlock8FUlP10JUTTexture + */ +bool J2DTevBlock8::setTexture(u32 param_0, JUTTexture* p_tex) { + if (param_0 >= 8) { + return false; + } + + if (mUndeleteFlag & (1 << param_0)) { + delete mTexture[param_0]; + } + + mTexture[param_0] = p_tex; + mUndeleteFlag &= ~(1 << param_0); + delete mPalette[param_0]; + mPalette[param_0] = NULL; + mTexNo[param_0] = -1; + return true; +} + +/* 802EFB48-802EFC40 2EA488 00F8+00 1/0 0/0 0/0 .text removeTexture__12J2DTevBlock8FUl */ +bool J2DTevBlock8::removeTexture(u32 param_0) { + if (param_0 >= 8) { + return false; + } + + if (mUndeleteFlag & (1 << param_0)) { + delete mTexture[param_0]; + } + delete mPalette[param_0]; + + for (u32 i = param_0; i < 7; i++) { + mTexture[i] = mTexture[i + 1]; + mPalette[i] = mPalette[i + 1]; + mTexNo[i] = mTexNo[i + 1]; + } + + mTexture[7] = NULL; + mPalette[7] = NULL; + mTexNo[7] = -1; + shiftDeleteFlag(param_0, false); + return true; +} + +/* 802EFC40-802EFCEC 2EA580 00AC+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock8FP7ResFONT + */ +bool J2DTevBlock8::setFont(ResFONT* p_font) { + if (p_font == NULL) { + return false; + } + + JUTResFont* resFont = new JUTResFont(p_font, NULL); + if (resFont == NULL) { + return false; + } + + if (mFontUndeleteFlag) { + delete mFont; + } + + mFont = resFont; + mFontUndeleteFlag = true; + return true; +} + +/* 802EFCEC-802EFD68 2EA62C 007C+00 1/0 0/0 0/0 .text setFont__12J2DTevBlock8FP7JUTFont + */ +bool J2DTevBlock8::setFont(JUTFont* p_font) { + if (p_font == NULL) { + return false; + } + + if (mFontUndeleteFlag) { + delete mFont; + } + + mFont = (JUTResFont*)p_font; + mFontUndeleteFlag = false; + return true; +} + +/* 802EFD68-802EFE40 2EA6A8 00D8+00 1/0 0/0 0/0 .text setPalette__12J2DTevBlock8FUlPC7ResTLUT */ +bool J2DTevBlock8::setPalette(u32 param_0, ResTLUT const* p_tlut) { + if (param_0 >= 8) { + return false; + } + + if (p_tlut != NULL) { + if (mPalette[param_0] == NULL) { + mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); + + if (mPalette[param_0] == NULL) { + return false; + } + } else { + mPalette[param_0]->storeTLUT(GX_TLUT0, (ResTLUT*)p_tlut); + } + + if (mTexture[param_0] != NULL) { + mTexture[param_0]->attachPalette(mPalette[param_0]); + } + } else { + delete mPalette[param_0]; + mPalette[param_0] = NULL; + } + + return true; +} + +/* 802EFE40-802EFEAC 2EA780 006C+00 1/0 0/0 0/0 .text shiftDeleteFlag__12J2DTevBlock8FUcb + */ +void J2DTevBlock8::shiftDeleteFlag(u8 param_0, bool param_1) { + if (param_1) { + mUndeleteFlag = (mUndeleteFlag & ((1 << param_0) - 1)) | ((mUndeleteFlag & ~((1 << param_0) - 1)) * 2); + } else { + mUndeleteFlag = (mUndeleteFlag & ((1 << param_0) - 1)) | ((mUndeleteFlag & ~((1 << (param_0 + 1)) - 1)) >> 1); + } +} + +/* 802EFEAC-802F019C 2EA7EC 02F0+00 1/0 0/0 0/0 .text setGX__12J2DTevBlock8Fv */ +void J2DTevBlock8::setGX() { + for (int i = 0; i < 8; i++) { + loadTexture(GXTexMapID(i), i); + } + for (int i = 0; i < mTevStageNum; i++) { + GXSetTevOrder(GXTevStageID(i), mTevOrder[i].getTexCoord(), mTevOrder[i].getTexMap(), 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()), + GXTevColorArg(mTevStage[i].getColorB()), + GXTevColorArg(mTevStage[i].getColorC()), + GXTevColorArg(mTevStage[i].getColorD())); + GXSetTevAlphaIn(GXTevStageID(i), GXTevAlphaArg(mTevStage[i].getAlphaA()), + GXTevAlphaArg(mTevStage[i].getAlphaB()), + GXTevAlphaArg(mTevStage[i].getAlphaC()), + GXTevAlphaArg(mTevStage[i].getAlphaD())); + GXSetTevColorOp(GXTevStageID(i), GXTevOp(mTevStage[i].getCOp()), + GXTevBias(mTevStage[i].getCBias()), GXTevScale(mTevStage[i].getCScale()), + mTevStage[i].getCClamp(), GXTevRegID(mTevStage[i].getCReg())); + GXSetTevAlphaOp(GXTevStageID(i), (GXTevOp)mTevStage[i].getAOp(), + GXTevBias(mTevStage[i].getABias()), GXTevScale(mTevStage[i].getAScale()), + mTevStage[i].getAClamp(), GXTevRegID(mTevStage[i].getAReg())); + 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), GXTevColor(mTevSwapModeTable[i].getR()), + GXTevColor(mTevSwapModeTable[i].getG()), + GXTevColor(mTevSwapModeTable[i].getB()), + GXTevColor(mTevSwapModeTable[i].getA())); + } + for (u8 i = 0; i < mTevStageNum; i++) { + mIndTevStage[i].load(i); + } +} + +/* 802F019C-802F01E4 2EAADC 0048+00 1/0 0/0 0/0 .text loadTexture__12J2DTevBlock8F11_GXTexMapIDUl + */ +void J2DTevBlock8::loadTexture(GXTexMapID texmapID, u32 texIndex) { + if (texIndex < 8 && mTexture[texIndex] != NULL && mTexture[texIndex]->getTexInfo() != NULL) { + mTexture[texIndex]->load(texmapID); + } +} + +/* 802F01E4-802F030C 2EAB24 0128+00 0/0 1/1 0/0 .text __ct__13J2DTevBlock16Fv */ +J2DTevBlock16::J2DTevBlock16() { + for (int i = 0; i < 8; i++) { + mTexture[i] = NULL; + } + + mUndeleteFlag = 0; + initialize(); +} + +/* 802F030C-802F03EC 2EAC4C 00E0+00 1/0 0/0 0/0 .text __dt__13J2DTevBlock16Fv */ +J2DTevBlock16::~J2DTevBlock16() { + for (int i = 0; i < 8; i++) { + if (mUndeleteFlag & (1 << i)) { + delete mTexture[i]; + } + delete mPalette[i]; + } + + if (mFontUndeleteFlag) { + delete mFont; + } +} + +/* 802F03EC-802F0660 2EAD2C 0274+00 1/0 0/0 0/0 .text initialize__13J2DTevBlock16Fv */ +extern "C" void initialize__13J2DTevBlock16Fv() { + // asm void J2DTevBlock16::initialize() { + // NONMATCHING +} + +/* 802F0660-802F0730 2EAFA0 00D0+00 1/0 0/0 0/0 .text prepareTexture__13J2DTevBlock16FUc + */ +bool J2DTevBlock16::prepareTexture(u8 param_0) { + for (u8 i = 0; i < param_0; i++) { + if (i >= 8) { + return 0; + } + + if (mTexture[i] == NULL) { + mTexture[i] = new JUTTexture(); + + if (mTexture[i] == NULL) { + return false; + } + mUndeleteFlag |= (1 << i); + } + } + + return true; +} + +/* 802F0730-802F0AFC 2EB070 03CC+00 1/0 0/0 0/0 .text + * insertTexture__13J2DTevBlock16FUlPC7ResTIMGP10JUTPalette */ +bool J2DTevBlock16::insertTexture(u32 param_0, ResTIMG const* param_1, JUTPalette* param_2) { + // NONMATCHING +} + +/* 802F0AFC-802F0C8C 2EB43C 0190+00 1/0 0/0 0/0 .text + * insertTexture__13J2DTevBlock16FUlP10JUTTexture */ +bool J2DTevBlock16::insertTexture(u32 param_0, JUTTexture* p_tex) { + if (param_0 >= 8 || p_tex == NULL) { + return false; + } + + u8 texNo = 0; + for (; texNo < 8; texNo++) { + if (mTexture[texNo] == NULL || mTexture[texNo]->getTexInfo() == NULL) { + break; + } + } + + if (texNo < param_0) { + return false; + } + + if (texNo == 8) { + return false; + } + + if (mTexture[7] != NULL && mTexture[7]->getTexInfo() == NULL) { + if (mUndeleteFlag & 0x80) { + delete mTexture[7]; + } + + mUndeleteFlag &= 0x7F; + } + + for (u8 i = 7; i > param_0; i--) { + mTexture[i] = mTexture[i - 1]; + mPalette[i] = mPalette[i - 1]; + mTexNo[i] = mTexNo[i - 1]; + } + + mTexture[param_0] = p_tex; + mPalette[param_0] = NULL; + mTexNo[param_0] = -1; + shiftDeleteFlag(param_0, true); + mUndeleteFlag &= ~(1 << param_0); + return true; +} + +/* 802F0C8C-802F0F18 2EB5CC 028C+00 1/0 0/0 0/0 .text setTexture__13J2DTevBlock16FUlPC7ResTIMG */ +bool J2DTevBlock16::setTexture(u32 param_0, ResTIMG const* param_1) { + // NONMATCHING +} + +/* 802F0F18-802F0FC8 2EB858 00B0+00 1/0 0/0 0/0 .text setTexture__13J2DTevBlock16FUlP10JUTTexture + */ +bool J2DTevBlock16::setTexture(u32 param_0, JUTTexture* p_tex) { + if (param_0 >= 8) { + return false; + } + + if (mUndeleteFlag & (1 << param_0)) { + delete mTexture[param_0]; + } + + mTexture[param_0] = p_tex; + mUndeleteFlag &= ~(1 << param_0); + delete mPalette[param_0]; + mPalette[param_0] = NULL; + mTexNo[param_0] = -1; + return true; +} + +/* 802F0FC8-802F10C0 2EB908 00F8+00 1/0 0/0 0/0 .text removeTexture__13J2DTevBlock16FUl + */ +bool J2DTevBlock16::removeTexture(u32 param_0) { + if (param_0 >= 8) { + return false; + } + + if (mUndeleteFlag & (1 << param_0)) { + delete mTexture[param_0]; + } + delete mPalette[param_0]; + + for (u32 i = param_0; i < 7; i++) { + mTexture[i] = mTexture[i + 1]; + mPalette[i] = mPalette[i + 1]; + mTexNo[i] = mTexNo[i + 1]; + } + + mTexture[7] = NULL; + mPalette[7] = NULL; + mTexNo[7] = -1; + shiftDeleteFlag(param_0, false); + return true; +} + +/* 802F10C0-802F116C 2EBA00 00AC+00 1/0 0/0 0/0 .text setFont__13J2DTevBlock16FP7ResFONT + */ +bool J2DTevBlock16::setFont(ResFONT* p_font) { + if (p_font == NULL) { + return false; + } + + JUTResFont* resFont = new JUTResFont(p_font, NULL); + if (resFont == NULL) { + return false; + } + + if (mFontUndeleteFlag) { + delete mFont; + } + + mFont = resFont; + mFontUndeleteFlag = true; + return true; +} + +/* 802F116C-802F11E8 2EBAAC 007C+00 1/0 0/0 0/0 .text setFont__13J2DTevBlock16FP7JUTFont + */ +bool J2DTevBlock16::setFont(JUTFont* p_font) { + if (p_font == NULL) { + return false; + } + + if (mFontUndeleteFlag) { + delete mFont; + } + + mFont = (JUTResFont*)p_font; + mFontUndeleteFlag = false; + return true; +} + +/* 802F11E8-802F12C0 2EBB28 00D8+00 1/0 0/0 0/0 .text setPalette__13J2DTevBlock16FUlPC7ResTLUT */ +bool J2DTevBlock16::setPalette(u32 param_0, ResTLUT const* p_tlut) { + if (param_0 >= 8) { + return false; + } + + if (p_tlut != NULL) { + if (mPalette[param_0] == NULL) { + mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); + + if (mPalette[param_0] == NULL) { + return false; + } + } else { + mPalette[param_0]->storeTLUT(GX_TLUT0, (ResTLUT*)p_tlut); + } + + if (mTexture[param_0] != NULL) { + mTexture[param_0]->attachPalette(mPalette[param_0]); + } + } else { + delete mPalette[param_0]; + mPalette[param_0] = NULL; + } + + return true; +} + +/* 802F12C0-802F132C 2EBC00 006C+00 1/0 0/0 0/0 .text shiftDeleteFlag__13J2DTevBlock16FUcb */ +void J2DTevBlock16::shiftDeleteFlag(u8 param_0, bool param_1) { + if (param_1) { + mUndeleteFlag = (mUndeleteFlag & ((1 << param_0) - 1)) | ((mUndeleteFlag & ~((1 << param_0) - 1)) * 2); + } else { + mUndeleteFlag = (mUndeleteFlag & ((1 << param_0) - 1)) | ((mUndeleteFlag & ~((1 << (param_0 + 1)) - 1)) >> 1); + } +} + +/* 802F132C-802F161C 2EBC6C 02F0+00 1/0 0/0 0/0 .text setGX__13J2DTevBlock16Fv */ +void J2DTevBlock16::setGX() { + for (int i = 0; i < 8; i++) { + loadTexture(GXTexMapID(i), i); + } + for (int i = 0; i < mTevStageNum; i++) { + GXSetTevOrder(GXTevStageID(i), mTevOrder[i].getTexCoord(), mTevOrder[i].getTexMap(), 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()), + GXTevColorArg(mTevStage[i].getColorB()), + GXTevColorArg(mTevStage[i].getColorC()), + GXTevColorArg(mTevStage[i].getColorD())); + GXSetTevAlphaIn(GXTevStageID(i), GXTevAlphaArg(mTevStage[i].getAlphaA()), + GXTevAlphaArg(mTevStage[i].getAlphaB()), + GXTevAlphaArg(mTevStage[i].getAlphaC()), + GXTevAlphaArg(mTevStage[i].getAlphaD())); + GXSetTevColorOp(GXTevStageID(i), GXTevOp(mTevStage[i].getCOp()), + GXTevBias(mTevStage[i].getCBias()), GXTevScale(mTevStage[i].getCScale()), + mTevStage[i].getCClamp(), GXTevRegID(mTevStage[i].getCReg())); + GXSetTevAlphaOp(GXTevStageID(i), (GXTevOp)mTevStage[i].getAOp(), + GXTevBias(mTevStage[i].getABias()), GXTevScale(mTevStage[i].getAScale()), + mTevStage[i].getAClamp(), GXTevRegID(mTevStage[i].getAReg())); + 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), GXTevColor(mTevSwapModeTable[i].getR()), + GXTevColor(mTevSwapModeTable[i].getG()), + GXTevColor(mTevSwapModeTable[i].getB()), + GXTevColor(mTevSwapModeTable[i].getA())); + } + for (u8 i = 0; i < mTevStageNum; i++) { + mIndTevStage[i].load(i); + } +} + +/* 802F161C-802F1664 2EBF5C 0048+00 1/0 0/0 0/0 .text loadTexture__13J2DTevBlock16F11_GXTexMapIDUl + */ +void J2DTevBlock16::loadTexture(GXTexMapID texmapID, u32 texIndex) { + if (texIndex < 8 && mTexture[texIndex] != NULL && mTexture[texIndex]->getTexInfo() != NULL) { + mTexture[texIndex]->load(texmapID); + } +} + +/* 802F1664-802F1730 2EBFA4 00CC+00 1/0 0/0 0/0 .text initialize__15J2DIndBlockFullFv */ +extern "C" void initialize__15J2DIndBlockFullFv() { + // asm void J2DIndBlockFull::initialize() { + // NONMATCHING +} + +/* 802F1730-802F17FC 2EC070 00CC+00 1/0 0/0 0/0 .text setGX__15J2DIndBlockFullFv */ +void J2DIndBlockFull::setGX() { + GXSetNumIndStages(mIndTexStageNum); + for (u8 i = 0; i < mIndTexStageNum; i++) { + mIndTexMtx[i].load(i); + } + for (u8 i = 0; i < mIndTexStageNum; i++) { + mTexCoordScale[i].load(i); + } + for (u8 i = 0; i < mIndTexStageNum; i++) { + mIndTexOrder[i].load(i); + } +} + +/* 802F17FC-802F1840 2EC13C 0044+00 0/0 1/1 0/0 .text initialize__10J2DPEBlockFv */ +void J2DPEBlock::initialize() { + mAlphaComp = J2DAlphaComp(); + mBlend.setBlendInfo(j2dDefaultBlendInfo); + mDither = j2dDefaultPEBlockDither; +} + +/* 802F1840-802F18A0 2EC180 0060+00 0/0 1/1 0/0 .text setGX__10J2DPEBlockFv */ +void J2DPEBlock::setGX() { + GXSetAlphaCompare(GXCompare(mAlphaComp.getComp0()), mAlphaComp.getRef0(), GXAlphaOp(mAlphaComp.getOp()), GXCompare(mAlphaComp.getComp1()), mAlphaComp.getRef1()); + GXSetBlendMode(GXBlendMode(mBlend.getType()), GXBlendFactor(mBlend.getSrcFactor()), GXBlendFactor(mBlend.getDstFactor()), GXLogicOp(mBlend.getOp())); + GXSetDither(mDither); +} + +/* 802F18A0-802F1934 2EC1E0 0094+00 5/5 0/0 0/0 .text __ct__14J2DIndTevStageFv */ +// should be inline +#ifdef NONMATCHING +J2DIndTevStage::J2DIndTevStage() { + mFlags = J2DCalcIndTevStage(j2dDefaultIndTevStageInfo); +} +#else +void __ct__14J2DIndTevStageFv() { + // NONMATCHING +} +#endif + +/* 802F1934-802F1940 2EC274 000C+00 5/5 0/0 0/0 .text __ct__19J2DTevSwapModeTableFv */ +// Should be inline +#ifdef NONMATCHING +J2DTevSwapModeTable::J2DTevSwapModeTable() { + field_0x0 = data_804561AC; +} +#else +void __ct__19J2DTevSwapModeTableFv() { + // NONMATCHING +} +#endif + +/* 802F1940-802F19A8 2EC280 0068+00 5/5 1/1 0/0 .text __ct__11J2DTevStageFv */ +J2DTevStage::J2DTevStage() { + setTevStageInfo(j2dDefaultTevStageInfo); + setTevSwapModeInfo(j2dDefaultTevSwapMode); +} + +/* 802F19A8-802F1B70 2EC2E8 01C8+00 1/1 1/1 0/0 .text + * setTevStageInfo__11J2DTevStageFRC15J2DTevStageInfo */ +void J2DTevStage::setTevStageInfo(J2DTevStageInfo const& info) { + setColorABCD(info.mColorA, info.mColorB, info.mColorC, info.mColorD); + setTevColorOp(info.mCOp, info.mCBias, info.mCScale, info.mCClamp, info.mCReg); + setAlphaABCD(info.mAlphaA, info.mAlphaB, info.mAlphaC, info.mAlphaD); + setTevAlphaOp(info.mAOp, info.mABias, info.mAScale, info.mAClamp, info.mAReg); +} + +/* 802F1B70-802F1B90 2EC4B0 0020+00 5/5 0/0 0/0 .text __ct__11J2DTevOrderFv */ +// Matching but should be inline +#ifdef NONMATCHING +J2DTevOrder::J2DTevOrder() { + mTevOrderInfo = j2dDefaultTevOrderInfoNull; +} +#else +// J2DTevOrder::J2DTevOrder() { +void __ct__11J2DTevOrderFv() { + // NONMATCHING +} +#endif + +/* 802F1B90-802F1B94 2EC4D0 0004+00 5/5 0/0 0/0 .text __ct__13J2DGXColorS10Fv */ +// Most likely inlined +//J2DGXColorS10::J2DGXColorS10() { +void __ct__13J2DGXColorS10Fv() { + /* empty function */ +} + +/* 802F1B94-802F1BA0 2EC4D4 000C+00 1/0 0/0 0/0 .text getType__15J2DIndBlockFullFv */ +u32 J2DIndBlockFull::getType() { + return 'IBLF'; +} + +/* 802F1BA0-802F1BA8 -00001 0008+00 0/0 0/0 0/0 .text setIndTexStageNum__15J2DIndBlockFullFUc */ +void J2DIndBlockFull::setIndTexStageNum(u8 num) { + mIndTexStageNum = num; +} + +/* 802F1BA8-802F1BB0 2EC4E8 0008+00 1/0 0/0 0/0 .text getIndTexStageNum__15J2DIndBlockFullCFv */ +u8 J2DIndBlockFull::getIndTexStageNum() const { + return mIndTexStageNum; +} + +/* 802F1BB0-802F1BCC 2EC4F0 001C+00 1/0 0/0 0/0 .text + * setIndTexOrder__15J2DIndBlockFullFUl14J2DIndTexOrder */ +void J2DIndBlockFull::setIndTexOrder(u32 param_0, J2DIndTexOrder param_1) { + mIndTexOrder[param_0] = param_1; +} + +/* 802F1BCC-802F1BE0 2EC50C 0014+00 1/0 0/0 0/0 .text getIndTexOrder__15J2DIndBlockFullFUl */ +J2DIndTexOrder* J2DIndBlockFull::getIndTexOrder(u32 param_0) { + return &mIndTexOrder[param_0]; +} + +/* 802F1BE0-802F1C38 2EC520 0058+00 1/0 0/0 0/0 .text + * setIndTexMtx__15J2DIndBlockFullFUl12J2DIndTexMtx */ +void J2DIndBlockFull::setIndTexMtx(u32 param_0, J2DIndTexMtx param_1) { + mIndTexMtx[param_0] = param_1; +} + +/* 802F1C38-802F1C4C 2EC578 0014+00 1/0 0/0 0/0 .text getIndTexMtx__15J2DIndBlockFullFUl + */ +J2DIndTexMtx* J2DIndBlockFull::getIndTexMtx(u32 param_0) { + return &mIndTexMtx[param_0]; +} + +/* 802F1C4C-802F1C68 2EC58C 001C+00 1/0 0/0 0/0 .text + * setIndTexCoordScale__15J2DIndBlockFullFUl19J2DIndTexCoordScale */ +void J2DIndBlockFull::setIndTexCoordScale(u32 param_0, J2DIndTexCoordScale param_1) { + mTexCoordScale[param_0] = param_1; +} + +/* 802F1C68-802F1C7C 2EC5A8 0014+00 1/0 0/0 0/0 .text getIndTexCoordScale__15J2DIndBlockFullFUl */ +J2DIndTexCoordScale* J2DIndBlockFull::getIndTexCoordScale(u32 param_0) { + return &mTexCoordScale[param_0]; +} + +/* 802F1C7C-802F1D18 2EC5BC 009C+00 1/0 0/0 0/0 .text __dt__15J2DIndBlockFullFv */ +J2DIndBlockFull::~J2DIndBlockFull() {} + +/* 802F1D18-802F1D24 2EC658 000C+00 1/0 0/0 0/0 .text getType__13J2DTevBlock16Fv */ +u32 J2DTevBlock16::getType() { + return 'TV16'; +} + +/* 802F1D24-802F1D2C 2EC664 0008+00 1/0 0/0 0/0 .text getMaxStage__13J2DTevBlock16Fv */ +u8 J2DTevBlock16::getMaxStage() { + return 16; +} + +/* 802F1D2C-802F1D3C 2EC66C 0010+00 1/0 0/0 0/0 .text setTexNo__13J2DTevBlock16FUlUs */ +void J2DTevBlock16::setTexNo(u32 index, u16 texNo) { + mTexNo[index] = texNo; +} + +/* 802F1D3C-802F1D4C 2EC67C 0010+00 1/0 0/0 0/0 .text getTexNo__13J2DTevBlock16CFUl */ +u32 J2DTevBlock16::getTexNo(u32 index) const { + return mTexNo[index]; +} + +/* 802F1D4C-802F1D54 -00001 0008+00 0/0 0/0 0/0 .text setFontNo__13J2DTevBlock16FUs */ +void J2DTevBlock16::setFontNo(u16 fontNo) { + mFontNo = fontNo; +} + +/* 802F1D54-802F1D5C 2EC694 0008+00 1/0 0/0 0/0 .text getFontNo__13J2DTevBlock16CFv */ +u16 J2DTevBlock16::getFontNo() const { + return mFontNo; +} + +/* 802F1D5C-802F1D80 2EC69C 0024+00 1/0 0/0 0/0 .text setTevOrder__13J2DTevBlock16FUl11J2DTevOrder + */ +void J2DTevBlock16::setTevOrder(u32 index, J2DTevOrder order) { + mTevOrder[index].mTevOrderInfo.mTexCoord = order.mTevOrderInfo.mTexCoord; + mTevOrder[index].mTevOrderInfo.mTexMap = order.mTevOrderInfo.mTexMap; + mTevOrder[index].mTevOrderInfo.mColor = order.mTevOrderInfo.mColor; +} + +/* 802F1D80-802F1D94 2EC6C0 0014+00 1/0 0/0 0/0 .text getTevOrder__13J2DTevBlock16FUl */ +J2DTevOrder* J2DTevBlock16::getTevOrder(u32 index) { + return &mTevOrder[index]; +} + +/* 802F1D94-802F1DC0 2EC6D4 002C+00 1/0 0/0 0/0 .text + * setTevColor__13J2DTevBlock16FUl13J2DGXColorS10 */ +void J2DTevBlock16::setTevColor(u32 index, J2DGXColorS10 color) { + mTevColor[index] = color; +} + +/* 802F1DC0-802F1DD4 2EC700 0014+00 1/0 0/0 0/0 .text getTevColor__13J2DTevBlock16FUl */ +J2DGXColorS10* J2DTevBlock16::getTevColor(u32 index) { + return &mTevColor[index]; +} + +/* 802F1DD4-802F1E00 2EC714 002C+00 1/0 0/0 0/0 .text + * setTevKColor__13J2DTevBlock16FUlQ28JUtility6TColor */ +void J2DTevBlock16::setTevKColor(u32 index, JUtility::TColor color) { + mTevKColor[index].r = color.r; + mTevKColor[index].g = color.g; + mTevKColor[index].b = color.b; + mTevKColor[index].a = color.a; +} + +/* 802F1E00-802F1E14 2EC740 0014+00 1/0 0/0 0/0 .text getTevKColor__13J2DTevBlock16FUl */ +JUtility::TColor* J2DTevBlock16::getTevKColor(u32 index) { + return &mTevKColor[index]; +} + +/* 802F1E14-802F1E20 2EC754 000C+00 1/0 0/0 0/0 .text setTevKColorSel__13J2DTevBlock16FUlUc */ +void J2DTevBlock16::setTevKColorSel(u32 index, u8 sel) { + mTevKColorSel[index] = sel; +} + +/* 802F1E20-802F1E2C 2EC760 000C+00 1/0 0/0 0/0 .text getTevKColorSel__13J2DTevBlock16FUl + */ +u8 J2DTevBlock16::getTevKColorSel(u32 index) { + return mTevKColorSel[index]; +} + +/* 802F1E2C-802F1E38 2EC76C 000C+00 1/0 0/0 0/0 .text setTevKAlphaSel__13J2DTevBlock16FUlUc */ +void J2DTevBlock16::setTevKAlphaSel(u32 index, u8 sel) { + mTevKAlphaSel[index] = sel; +} + +/* 802F1E38-802F1E44 2EC778 000C+00 1/0 0/0 0/0 .text getTevKAlphaSel__13J2DTevBlock16FUl + */ +u8 J2DTevBlock16::getTevKAlphaSel(u32 index) { + return mTevKAlphaSel[index]; +} + +/* 802F1E44-802F1E4C -00001 0008+00 0/0 0/0 0/0 .text setTevStageNum__13J2DTevBlock16FUc + */ +void J2DTevBlock16::setTevStageNum(u8 stageNum) { + mTevStageNum = stageNum; +} + +/* 802F1E4C-802F1E54 2EC78C 0008+00 1/0 0/0 0/0 .text getTevStageNum__13J2DTevBlock16CFv + */ +u8 J2DTevBlock16::getTevStageNum() const { + return mTevStageNum; +} + +/* 802F1E54-802F1E90 2EC794 003C+00 1/0 0/0 0/0 .text setTevStage__13J2DTevBlock16FUl11J2DTevStage + */ +void J2DTevBlock16::setTevStage(u32 index, J2DTevStage stage) { + mTevStage[index] = stage; +} + +/* 802F1E90-802F1EA4 2EC7D0 0014+00 1/0 0/0 0/0 .text getTevStage__13J2DTevBlock16FUl */ +J2DTevStage* J2DTevBlock16::getTevStage(u32 index) { + return &mTevStage[index]; +} + +/* 802F1EA4-802F1EDC 2EC7E4 0038+00 1/0 0/0 0/0 .text + * setTevSwapModeInfo__13J2DTevBlock16FUl18J2DTevSwapModeInfo */ +void J2DTevBlock16::setTevSwapModeInfo(u32 index, J2DTevSwapModeInfo info) { + mTevStage[index].setTevSwapModeInfo(info); +} + +/* 802F1EDC-802F1EEC 2EC81C 0010+00 1/0 0/0 0/0 .text + * setTevSwapModeTable__13J2DTevBlock16FUl19J2DTevSwapModeTable */ +void J2DTevBlock16::setTevSwapModeTable(u32 index, J2DTevSwapModeTable table) { + mTevSwapModeTable[index] = table; +} + +/* 802F1EEC-802F1EFC 2EC82C 0010+00 1/0 0/0 0/0 .text getTevSwapModeTable__13J2DTevBlock16FUl */ +J2DTevSwapModeTable* J2DTevBlock16::getTevSwapModeTable(u32 index) { + return &mTevSwapModeTable[index]; +} + +/* 802F1EFC-802F1F10 2EC83C 0014+00 1/0 0/0 0/0 .text + * setIndTevStage__13J2DTevBlock16FUl14J2DIndTevStage */ +void J2DTevBlock16::setIndTevStage(u32 index, J2DIndTevStage stage) { + mIndTevStage[index] = stage; +} + +/* 802F1F10-802F1F24 2EC850 0014+00 1/0 0/0 0/0 .text getIndTevStage__13J2DTevBlock16FUl + */ +J2DIndTevStage* J2DTevBlock16::getIndTevStage(u32 index) { + return &mIndTevStage[index]; +} + +/* 802F1F24-802F1F54 2EC864 0030+00 1/0 0/0 0/0 .text insertTexture__13J2DTevBlock16FUlPC7ResTIMG + */ +bool J2DTevBlock16::insertTexture(u32 index, ResTIMG const* p_timg) { + return insertTexture(index, p_timg, NULL); +} + +/* 802F1F54-802F1F74 2EC894 0020+00 1/0 0/0 0/0 .text getTexture__13J2DTevBlock16FUl */ +JUTTexture* J2DTevBlock16::getTexture(u32 index) { + if (index >= 8) { + return NULL; + } + + return mTexture[index]; +} + +/* 802F1F74-802F1F94 2EC8B4 0020+00 1/0 0/0 0/0 .text getPalette__13J2DTevBlock16FUl */ +JUTPalette* J2DTevBlock16::getPalette(u32 index) { + if (index >= 8) { + return NULL; + } + + return mPalette[index]; +} + +/* 802F1F94-802F1F9C 2EC8D4 0008+00 1/0 0/0 0/0 .text getFont__13J2DTevBlock16Fv */ +JUTFont* J2DTevBlock16::getFont() { + return mFont; +} + +/* 802F1F9C-802F1FAC 2EC8DC 0010+00 1/0 0/0 0/0 .text setUndeleteFlag__13J2DTevBlock16FUc + */ +void J2DTevBlock16::setUndeleteFlag(u8 flag) { + mUndeleteFlag &= flag; +} + +/* 802F1FAC-802F1FB8 2EC8EC 000C+00 1/0 0/0 0/0 .text setFontUndeleteFlag__13J2DTevBlock16Fv */ +void J2DTevBlock16::setFontUndeleteFlag() { + mFontUndeleteFlag = false; +} + +/* 802F1FB8-802F1FC4 2EC8F8 000C+00 1/0 0/0 0/0 .text getType__12J2DTevBlock8Fv */ +u32 J2DTevBlock8::getType() { + return 'TVB8'; +} + +/* 802F1FC4-802F1FCC 2EC904 0008+00 1/0 0/0 0/0 .text getMaxStage__12J2DTevBlock8Fv */ +u8 J2DTevBlock8::getMaxStage() { + return 8; +} + +/* 802F1FCC-802F1FDC 2EC90C 0010+00 1/0 0/0 0/0 .text setTexNo__12J2DTevBlock8FUlUs */ +void J2DTevBlock8::setTexNo(u32 index, u16 texNo) { + mTexNo[index] = texNo; +} + +/* 802F1FDC-802F1FEC 2EC91C 0010+00 1/0 0/0 0/0 .text getTexNo__12J2DTevBlock8CFUl */ +u32 J2DTevBlock8::getTexNo(u32 index) const { + return mTexNo[index]; +} + +/* 802F1FEC-802F1FF4 -00001 0008+00 0/0 0/0 0/0 .text setFontNo__12J2DTevBlock8FUs */ +void J2DTevBlock8::setFontNo(u16 fontNo) { + mFontNo = fontNo; +} + +/* 802F1FF4-802F1FFC 2EC934 0008+00 1/0 0/0 0/0 .text getFontNo__12J2DTevBlock8CFv */ +u16 J2DTevBlock8::getFontNo() const { + return mFontNo; +} + +/* 802F1FFC-802F2020 2EC93C 0024+00 1/0 0/0 0/0 .text setTevOrder__12J2DTevBlock8FUl11J2DTevOrder + */ +void J2DTevBlock8::setTevOrder(u32 index, J2DTevOrder order) { + mTevOrder[index].mTevOrderInfo.mTexCoord = order.mTevOrderInfo.mTexCoord; + mTevOrder[index].mTevOrderInfo.mTexMap = order.mTevOrderInfo.mTexMap; + mTevOrder[index].mTevOrderInfo.mColor = order.mTevOrderInfo.mColor; +} + +/* 802F2020-802F2034 2EC960 0014+00 1/0 0/0 0/0 .text getTevOrder__12J2DTevBlock8FUl */ +J2DTevOrder* J2DTevBlock8::getTevOrder(u32 index) { + return &mTevOrder[index]; +} + +/* 802F2034-802F2060 2EC974 002C+00 1/0 0/0 0/0 .text + * setTevColor__12J2DTevBlock8FUl13J2DGXColorS10 */ +void J2DTevBlock8::setTevColor(u32 index, J2DGXColorS10 color) { + mTevColor[index] = color; +} + +/* 802F2060-802F2074 2EC9A0 0014+00 1/0 0/0 0/0 .text getTevColor__12J2DTevBlock8FUl */ +J2DGXColorS10* J2DTevBlock8::getTevColor(u32 index) { + return &mTevColor[index]; +} + +/* 802F2074-802F20A0 2EC9B4 002C+00 1/0 0/0 0/0 .text + * setTevKColor__12J2DTevBlock8FUlQ28JUtility6TColor */ +void J2DTevBlock8::setTevKColor(u32 index, JUtility::TColor color) { + mTevKColor[index].r = color.r; + mTevKColor[index].g = color.g; + mTevKColor[index].b = color.b; + mTevKColor[index].a = color.a; +} + +/* 802F20A0-802F20B4 2EC9E0 0014+00 1/0 0/0 0/0 .text getTevKColor__12J2DTevBlock8FUl */ +JUtility::TColor* J2DTevBlock8::getTevKColor(u32 index) { + return &mTevKColor[index]; +} + +/* 802F20B4-802F20C0 2EC9F4 000C+00 1/0 0/0 0/0 .text setTevKColorSel__12J2DTevBlock8FUlUc */ +void J2DTevBlock8::setTevKColorSel(u32 index, u8 sel) { + mTevKColorSel[index] = sel; +} + +/* 802F20C0-802F20CC 2ECA00 000C+00 1/0 0/0 0/0 .text getTevKColorSel__12J2DTevBlock8FUl + */ +u8 J2DTevBlock8::getTevKColorSel(u32 index) { + return mTevKColorSel[index]; +} + +/* 802F20CC-802F20D8 2ECA0C 000C+00 1/0 0/0 0/0 .text setTevKAlphaSel__12J2DTevBlock8FUlUc */ +void J2DTevBlock8::setTevKAlphaSel(u32 index, u8 sel) { + mTevKAlphaSel[index] = sel; +} + +/* 802F20D8-802F20E4 2ECA18 000C+00 1/0 0/0 0/0 .text getTevKAlphaSel__12J2DTevBlock8FUl + */ +u8 J2DTevBlock8::getTevKAlphaSel(u32 index) { + return mTevKAlphaSel[index]; +} + +/* 802F20E4-802F20EC -00001 0008+00 0/0 0/0 0/0 .text setTevStageNum__12J2DTevBlock8FUc + */ +void J2DTevBlock8::setTevStageNum(u8 stageNum) { + mTevStageNum = stageNum; +} + +/* 802F20EC-802F20F4 2ECA2C 0008+00 1/0 0/0 0/0 .text getTevStageNum__12J2DTevBlock8CFv + */ +u8 J2DTevBlock8::getTevStageNum() const { + return mTevStageNum; +} + +/* 802F20F4-802F2130 2ECA34 003C+00 1/0 0/0 0/0 .text setTevStage__12J2DTevBlock8FUl11J2DTevStage + */ +void J2DTevBlock8::setTevStage(u32 index, J2DTevStage stage) { + mTevStage[index] = stage; +} + +/* 802F2130-802F2144 2ECA70 0014+00 1/0 0/0 0/0 .text getTevStage__12J2DTevBlock8FUl */ +J2DTevStage* J2DTevBlock8::getTevStage(u32 index) { + return &mTevStage[index]; +} + +/* 802F2144-802F217C 2ECA84 0038+00 1/0 0/0 0/0 .text + * setTevSwapModeInfo__12J2DTevBlock8FUl18J2DTevSwapModeInfo */ +void J2DTevBlock8::setTevSwapModeInfo(u32 index, J2DTevSwapModeInfo info) { + mTevStage[index].setTevSwapModeInfo(info); +} + +/* 802F217C-802F218C 2ECABC 0010+00 1/0 0/0 0/0 .text + * setTevSwapModeTable__12J2DTevBlock8FUl19J2DTevSwapModeTable */ +void J2DTevBlock8::setTevSwapModeTable(u32 index, J2DTevSwapModeTable table) { + mTevSwapModeTable[index] = table; +} + +/* 802F218C-802F219C 2ECACC 0010+00 1/0 0/0 0/0 .text getTevSwapModeTable__12J2DTevBlock8FUl */ +J2DTevSwapModeTable* J2DTevBlock8::getTevSwapModeTable(u32 index) { + return &mTevSwapModeTable[index]; +} + +/* 802F219C-802F21B0 2ECADC 0014+00 1/0 0/0 0/0 .text + * setIndTevStage__12J2DTevBlock8FUl14J2DIndTevStage */ +void J2DTevBlock8::setIndTevStage(u32 index, J2DIndTevStage stage) { + mIndTevStage[index] = stage; +} + +/* 802F21B0-802F21C4 2ECAF0 0014+00 1/0 0/0 0/0 .text getIndTevStage__12J2DTevBlock8FUl + */ +J2DIndTevStage* J2DTevBlock8::getIndTevStage(u32 index) { + return &mIndTevStage[index]; +} + +/* 802F21C4-802F21F4 2ECB04 0030+00 1/0 0/0 0/0 .text insertTexture__12J2DTevBlock8FUlPC7ResTIMG + */ +bool J2DTevBlock8::insertTexture(u32 index, ResTIMG const* p_timg) { + return insertTexture(index, p_timg, NULL); +} + +/* 802F21F4-802F2214 2ECB34 0020+00 1/0 0/0 0/0 .text getTexture__12J2DTevBlock8FUl */ +JUTTexture* J2DTevBlock8::getTexture(u32 index) { + if (index >= 8) { + return NULL; + } + + return mTexture[index]; +} + +/* 802F2214-802F2234 2ECB54 0020+00 1/0 0/0 0/0 .text getPalette__12J2DTevBlock8FUl */ +JUTPalette* J2DTevBlock8::getPalette(u32 index) { + if (index >= 8) { + return NULL; + } + + return mPalette[index]; +} + +/* 802F2234-802F223C 2ECB74 0008+00 1/0 0/0 0/0 .text getFont__12J2DTevBlock8Fv */ +JUTFont* J2DTevBlock8::getFont() { + return mFont; +} + +/* 802F223C-802F224C 2ECB7C 0010+00 1/0 0/0 0/0 .text setUndeleteFlag__12J2DTevBlock8FUc + */ +void J2DTevBlock8::setUndeleteFlag(u8 flag) { + mUndeleteFlag &= flag; +} + +/* 802F224C-802F2258 2ECB8C 000C+00 1/0 0/0 0/0 .text setFontUndeleteFlag__12J2DTevBlock8Fv */ +void J2DTevBlock8::setFontUndeleteFlag() { + mFontUndeleteFlag = false; +} + +/* 802F2258-802F2264 2ECB98 000C+00 1/0 0/0 0/0 .text getType__12J2DTevBlock4Fv */ +u32 J2DTevBlock4::getType() { + return 'TVB4'; +} + +/* 802F2264-802F226C 2ECBA4 0008+00 1/0 0/0 0/0 .text getMaxStage__12J2DTevBlock4Fv */ +u8 J2DTevBlock4::getMaxStage() { + return 4; +} + +/* 802F226C-802F227C 2ECBAC 0010+00 1/0 0/0 0/0 .text setTexNo__12J2DTevBlock4FUlUs */ +void J2DTevBlock4::setTexNo(u32 index, u16 texNo) { + mTexNo[index] = texNo; +} + +/* 802F227C-802F228C 2ECBBC 0010+00 1/0 0/0 0/0 .text getTexNo__12J2DTevBlock4CFUl */ +u32 J2DTevBlock4::getTexNo(u32 index) const { + return mTexNo[index]; +} + +/* 802F228C-802F2294 -00001 0008+00 0/0 0/0 0/0 .text setFontNo__12J2DTevBlock4FUs */ +void J2DTevBlock4::setFontNo(u16 fontNo) { + mFontNo = fontNo; +} + +/* 802F2294-802F229C 2ECBD4 0008+00 1/0 0/0 0/0 .text getFontNo__12J2DTevBlock4CFv */ +u16 J2DTevBlock4::getFontNo() const { + return mFontNo; +} + +/* 802F229C-802F22C0 2ECBDC 0024+00 1/0 0/0 0/0 .text setTevOrder__12J2DTevBlock4FUl11J2DTevOrder + */ +void J2DTevBlock4::setTevOrder(u32 index, J2DTevOrder order) { + mTevOrder[index].mTevOrderInfo.mTexCoord = order.mTevOrderInfo.mTexCoord; + mTevOrder[index].mTevOrderInfo.mTexMap = order.mTevOrderInfo.mTexMap; + mTevOrder[index].mTevOrderInfo.mColor = order.mTevOrderInfo.mColor; +} + +/* 802F22C0-802F22D4 2ECC00 0014+00 1/0 0/0 0/0 .text getTevOrder__12J2DTevBlock4FUl */ +J2DTevOrder* J2DTevBlock4::getTevOrder(u32 index) { + return &mTevOrder[index]; +} + +/* 802F22D4-802F2300 2ECC14 002C+00 1/0 0/0 0/0 .text + * setTevColor__12J2DTevBlock4FUl13J2DGXColorS10 */ +void J2DTevBlock4::setTevColor(u32 index, J2DGXColorS10 color) { + mTevColor[index] = color; +} + +/* 802F2300-802F2314 2ECC40 0014+00 1/0 0/0 0/0 .text getTevColor__12J2DTevBlock4FUl */ +J2DGXColorS10* J2DTevBlock4::getTevColor(u32 index) { + return &mTevColor[index]; +} + +/* 802F2314-802F2340 2ECC54 002C+00 1/0 0/0 0/0 .text + * setTevKColor__12J2DTevBlock4FUlQ28JUtility6TColor */ +void J2DTevBlock4::setTevKColor(u32 index, JUtility::TColor color) { + mTevKColor[index].r = color.r; + mTevKColor[index].g = color.g; + mTevKColor[index].b = color.b; + mTevKColor[index].a = color.a; +} + +/* 802F2340-802F2354 2ECC80 0014+00 1/0 0/0 0/0 .text getTevKColor__12J2DTevBlock4FUl */ +JUtility::TColor* J2DTevBlock4::getTevKColor(u32 index) { + return &mTevKColor[index]; +} + +/* 802F2354-802F2360 2ECC94 000C+00 1/0 0/0 0/0 .text setTevKColorSel__12J2DTevBlock4FUlUc */ +void J2DTevBlock4::setTevKColorSel(u32 index, u8 sel) { + mTevKColorSel[index] = sel; +} + +/* 802F2360-802F236C 2ECCA0 000C+00 1/0 0/0 0/0 .text getTevKColorSel__12J2DTevBlock4FUl + */ +u8 J2DTevBlock4::getTevKColorSel(u32 index) { + return mTevKColorSel[index]; +} + +/* 802F236C-802F2378 2ECCAC 000C+00 1/0 0/0 0/0 .text setTevKAlphaSel__12J2DTevBlock4FUlUc */ +void J2DTevBlock4::setTevKAlphaSel(u32 index, u8 sel) { + mTevKAlphaSel[index] = sel; +} + +/* 802F2378-802F2384 2ECCB8 000C+00 1/0 0/0 0/0 .text getTevKAlphaSel__12J2DTevBlock4FUl + */ +u8 J2DTevBlock4::getTevKAlphaSel(u32 index) { + return mTevKAlphaSel[index]; +} + +/* 802F2384-802F238C -00001 0008+00 0/0 0/0 0/0 .text setTevStageNum__12J2DTevBlock4FUc + */ +void J2DTevBlock4::setTevStageNum(u8 stageNum) { + mTevStageNum = stageNum; +} + +/* 802F238C-802F2394 2ECCCC 0008+00 1/0 0/0 0/0 .text getTevStageNum__12J2DTevBlock4CFv + */ +u8 J2DTevBlock4::getTevStageNum() const { + return mTevStageNum; +} + +/* 802F2394-802F23D0 2ECCD4 003C+00 1/0 0/0 0/0 .text setTevStage__12J2DTevBlock4FUl11J2DTevStage + */ +void J2DTevBlock4::setTevStage(u32 index, J2DTevStage stage) { + mTevStage[index] = stage; +} + +/* 802F23D0-802F23E4 2ECD10 0014+00 1/0 0/0 0/0 .text getTevStage__12J2DTevBlock4FUl */ +J2DTevStage* J2DTevBlock4::getTevStage(u32 index) { + return &mTevStage[index]; +} + +/* 802F23E4-802F241C 2ECD24 0038+00 1/0 0/0 0/0 .text + * setTevSwapModeInfo__12J2DTevBlock4FUl18J2DTevSwapModeInfo */ +void J2DTevBlock4::setTevSwapModeInfo(u32 index, J2DTevSwapModeInfo info) { + mTevStage[index].setTevSwapModeInfo(info); +} + +/* 802F241C-802F242C 2ECD5C 0010+00 1/0 0/0 0/0 .text + * setTevSwapModeTable__12J2DTevBlock4FUl19J2DTevSwapModeTable */ +void J2DTevBlock4::setTevSwapModeTable(u32 index, J2DTevSwapModeTable table) { + mTevSwapModeTable[index] = table; +} + +/* 802F242C-802F243C 2ECD6C 0010+00 1/0 0/0 0/0 .text getTevSwapModeTable__12J2DTevBlock4FUl */ +J2DTevSwapModeTable* J2DTevBlock4::getTevSwapModeTable(u32 index) { + return &mTevSwapModeTable[index]; +} + +/* 802F243C-802F2450 2ECD7C 0014+00 1/0 0/0 0/0 .text + * setIndTevStage__12J2DTevBlock4FUl14J2DIndTevStage */ +void J2DTevBlock4::setIndTevStage(u32 index, J2DIndTevStage stage) { + mIndTevStage[index] = stage; +} + +/* 802F2450-802F2464 2ECD90 0014+00 1/0 0/0 0/0 .text getIndTevStage__12J2DTevBlock4FUl + */ +J2DIndTevStage* J2DTevBlock4::getIndTevStage(u32 index) { + return &mIndTevStage[index]; +} + +/* 802F2464-802F2494 2ECDA4 0030+00 1/0 0/0 0/0 .text insertTexture__12J2DTevBlock4FUlPC7ResTIMG + */ +bool J2DTevBlock4::insertTexture(u32 index, ResTIMG const* p_timg) { + return insertTexture(index, p_timg, NULL); +} + +/* 802F2494-802F24B4 2ECDD4 0020+00 1/0 0/0 0/0 .text getTexture__12J2DTevBlock4FUl */ +JUTTexture* J2DTevBlock4::getTexture(u32 index) { + if (index >= 4) { + return NULL; + } + + return mTexture[index]; +} + +/* 802F24B4-802F24D4 2ECDF4 0020+00 1/0 0/0 0/0 .text getPalette__12J2DTevBlock4FUl */ +JUTPalette* J2DTevBlock4::getPalette(u32 index) { + if (index >= 4) { + return NULL; + } + + return mPalette[index]; +} + +/* 802F24D4-802F24DC 2ECE14 0008+00 1/0 0/0 0/0 .text getFont__12J2DTevBlock4Fv */ +JUTFont* J2DTevBlock4::getFont() { + return mFont; +} + +/* 802F24DC-802F24EC 2ECE1C 0010+00 1/0 0/0 0/0 .text setUndeleteFlag__12J2DTevBlock4FUc + */ +void J2DTevBlock4::setUndeleteFlag(u8 flag) { + mUndeleteFlag &= flag; +} + +/* 802F24EC-802F24FC 2ECE2C 0010+00 1/0 0/0 0/0 .text setFontUndeleteFlag__12J2DTevBlock4Fv */ +void J2DTevBlock4::setFontUndeleteFlag() { + mUndeleteFlag &= 0x7F; +} + +/* 802F24FC-802F2508 2ECE3C 000C+00 1/0 0/0 0/0 .text getType__12J2DTevBlock2Fv */ +u32 J2DTevBlock2::getType() { + return 'TVB2'; +} + +/* 802F2508-802F2510 2ECE48 0008+00 1/0 0/0 0/0 .text getMaxStage__12J2DTevBlock2Fv */ +u8 J2DTevBlock2::getMaxStage() { + return 2; +} + +/* 802F2510-802F2520 2ECE50 0010+00 1/0 0/0 0/0 .text setTexNo__12J2DTevBlock2FUlUs */ +void J2DTevBlock2::setTexNo(u32 index, u16 texNo) { + mTexNo[index] = texNo; +} + +/* 802F2520-802F2530 2ECE60 0010+00 1/0 0/0 0/0 .text getTexNo__12J2DTevBlock2CFUl */ +u32 J2DTevBlock2::getTexNo(u32 index) const { + return mTexNo[index]; +} + +/* 802F2530-802F2538 -00001 0008+00 0/0 0/0 0/0 .text setFontNo__12J2DTevBlock2FUs */ +void J2DTevBlock2::setFontNo(u16 fontNo) { + mFontNo = fontNo; +} + +/* 802F2538-802F2540 2ECE78 0008+00 1/0 0/0 0/0 .text getFontNo__12J2DTevBlock2CFv */ +u16 J2DTevBlock2::getFontNo() const { + return mFontNo; +} + +/* 802F2540-802F2564 2ECE80 0024+00 1/0 0/0 0/0 .text setTevOrder__12J2DTevBlock2FUl11J2DTevOrder + */ +void J2DTevBlock2::setTevOrder(u32 index, J2DTevOrder order) { + mTevOrder[index].mTevOrderInfo.mTexCoord = order.mTevOrderInfo.mTexCoord; + mTevOrder[index].mTevOrderInfo.mTexMap = order.mTevOrderInfo.mTexMap; + mTevOrder[index].mTevOrderInfo.mColor = order.mTevOrderInfo.mColor; +} + +/* 802F2564-802F2578 2ECEA4 0014+00 1/0 0/0 0/0 .text getTevOrder__12J2DTevBlock2FUl */ +J2DTevOrder* J2DTevBlock2::getTevOrder(u32 index) { + return &mTevOrder[index]; +} + +/* 802F2578-802F25A4 2ECEB8 002C+00 1/0 0/0 0/0 .text + * setTevColor__12J2DTevBlock2FUl13J2DGXColorS10 */ +void J2DTevBlock2::setTevColor(u32 index, J2DGXColorS10 color) { + mTevColor[index] = color; +} + +/* 802F25A4-802F25B8 2ECEE4 0014+00 1/0 0/0 0/0 .text getTevColor__12J2DTevBlock2FUl */ +J2DGXColorS10* J2DTevBlock2::getTevColor(u32 index) { + return &mTevColor[index]; +} + +/* 802F25B8-802F25E4 2ECEF8 002C+00 1/0 0/0 0/0 .text + * setTevKColor__12J2DTevBlock2FUlQ28JUtility6TColor */ +void J2DTevBlock2::setTevKColor(u32 index, JUtility::TColor color) { + mTevKColor[index].r = color.r; + mTevKColor[index].g = color.g; + mTevKColor[index].b = color.b; + mTevKColor[index].a = color.a; +} + +/* 802F25E4-802F25F8 2ECF24 0014+00 1/0 0/0 0/0 .text getTevKColor__12J2DTevBlock2FUl */ +JUtility::TColor* J2DTevBlock2::getTevKColor(u32 index) { + return &mTevKColor[index]; +} + +/* 802F25F8-802F2604 2ECF38 000C+00 1/0 0/0 0/0 .text setTevKColorSel__12J2DTevBlock2FUlUc */ +void J2DTevBlock2::setTevKColorSel(u32 index, u8 sel) { + mTevKColorSel[index] = sel; +} + +/* 802F2604-802F2610 2ECF44 000C+00 1/0 0/0 0/0 .text getTevKColorSel__12J2DTevBlock2FUl + */ +u8 J2DTevBlock2::getTevKColorSel(u32 index) { + return mTevKColorSel[index]; +} + +/* 802F2610-802F261C 2ECF50 000C+00 1/0 0/0 0/0 .text setTevKAlphaSel__12J2DTevBlock2FUlUc */ +void J2DTevBlock2::setTevKAlphaSel(u32 index, u8 sel) { + mTevKAlphaSel[index] = sel; +} + +/* 802F261C-802F2628 2ECF5C 000C+00 1/0 0/0 0/0 .text getTevKAlphaSel__12J2DTevBlock2FUl + */ +u8 J2DTevBlock2::getTevKAlphaSel(u32 index) { + return mTevKAlphaSel[index]; +} + +/* 802F2628-802F2630 -00001 0008+00 0/0 0/0 0/0 .text setTevStageNum__12J2DTevBlock2FUc + */ +void J2DTevBlock2::setTevStageNum(u8 stageNum) { + mTevStageNum = stageNum; +} + +/* 802F2630-802F2638 2ECF70 0008+00 1/0 0/0 0/0 .text getTevStageNum__12J2DTevBlock2CFv + */ +u8 J2DTevBlock2::getTevStageNum() const { + return mTevStageNum; +} + +/* 802F2638-802F2674 2ECF78 003C+00 1/0 0/0 0/0 .text setTevStage__12J2DTevBlock2FUl11J2DTevStage + */ +void J2DTevBlock2::setTevStage(u32 index, J2DTevStage stage) { + mTevStage[index] = stage; +} + +/* 802F2674-802F2688 2ECFB4 0014+00 1/0 0/0 0/0 .text getTevStage__12J2DTevBlock2FUl */ +J2DTevStage* J2DTevBlock2::getTevStage(u32 index) { + return &mTevStage[index]; +} + +/* 802F2688-802F26C0 2ECFC8 0038+00 1/0 0/0 0/0 .text + * setTevSwapModeInfo__12J2DTevBlock2FUl18J2DTevSwapModeInfo */ +void J2DTevBlock2::setTevSwapModeInfo(u32 index, J2DTevSwapModeInfo info) { + mTevStage[index].setTevSwapModeInfo(info); +} + +/* 802F26C0-802F26D0 2ED000 0010+00 1/0 0/0 0/0 .text + * setTevSwapModeTable__12J2DTevBlock2FUl19J2DTevSwapModeTable */ +void J2DTevBlock2::setTevSwapModeTable(u32 index, J2DTevSwapModeTable table) { + mTevSwapModeTable[index] = table; +} + +/* 802F26D0-802F26E0 2ED010 0010+00 1/0 0/0 0/0 .text getTevSwapModeTable__12J2DTevBlock2FUl */ +J2DTevSwapModeTable* J2DTevBlock2::getTevSwapModeTable(u32 index) { + return &mTevSwapModeTable[index]; +} + +/* 802F26E0-802F26F4 2ED020 0014+00 1/0 0/0 0/0 .text + * setIndTevStage__12J2DTevBlock2FUl14J2DIndTevStage */ +void J2DTevBlock2::setIndTevStage(u32 index, J2DIndTevStage stage) { + mIndTevStage[index] = stage; +} + +/* 802F26F4-802F2708 2ED034 0014+00 1/0 0/0 0/0 .text getIndTevStage__12J2DTevBlock2FUl + */ +J2DIndTevStage* J2DTevBlock2::getIndTevStage(u32 index) { + return &mIndTevStage[index]; +} + +/* 802F2708-802F2738 2ED048 0030+00 1/0 0/0 0/0 .text insertTexture__12J2DTevBlock2FUlPC7ResTIMG + */ +bool J2DTevBlock2::insertTexture(u32 index, ResTIMG const* p_timg) { + return insertTexture(index, p_timg, NULL); +} + +/* 802F2738-802F2758 2ED078 0020+00 1/0 0/0 0/0 .text getTexture__12J2DTevBlock2FUl */ +JUTTexture* J2DTevBlock2::getTexture(u32 index) { + if (index >= 2) { + return NULL; + } + + return mTexture[index]; +} + +/* 802F2758-802F2778 2ED098 0020+00 1/0 0/0 0/0 .text getPalette__12J2DTevBlock2FUl */ +JUTPalette* J2DTevBlock2::getPalette(u32 index) { + if (index >= 2) { + return NULL; + } + + return mPalette[index]; +} + +/* 802F2778-802F2780 2ED0B8 0008+00 1/0 0/0 0/0 .text getFont__12J2DTevBlock2Fv */ +JUTFont* J2DTevBlock2::getFont() { + return mFont; +} + +/* 802F2780-802F2790 2ED0C0 0010+00 1/0 0/0 0/0 .text setUndeleteFlag__12J2DTevBlock2FUc + */ +void J2DTevBlock2::setUndeleteFlag(u8 flag) { + mUndeleteFlag &= flag; +} + +/* 802F2790-802F27A0 2ED0D0 0010+00 1/0 0/0 0/0 .text setFontUndeleteFlag__12J2DTevBlock2Fv */ +void J2DTevBlock2::setFontUndeleteFlag() { + mUndeleteFlag &= 0x7F; +} + +/* 802F27A0-802F27AC 2ED0E0 000C+00 1/0 0/0 0/0 .text getType__12J2DTevBlock1Fv */ +u32 J2DTevBlock1::getType() { + return 'TVB1'; +} + +/* 802F27AC-802F27B4 2ED0EC 0008+00 1/0 0/0 0/0 .text getMaxStage__12J2DTevBlock1Fv */ +u8 J2DTevBlock1::getMaxStage() { + return 1; +} + +/* 802F27B4-802F27C4 2ED0F4 0010+00 1/0 0/0 0/0 .text setTexNo__12J2DTevBlock1FUlUs */ +void J2DTevBlock1::setTexNo(u32 index, u16 texNo) { + mTexNo[index] = texNo; +} + +/* 802F27C4-802F27D4 2ED104 0010+00 1/0 0/0 0/0 .text getTexNo__12J2DTevBlock1CFUl */ +u32 J2DTevBlock1::getTexNo(u32 index) const { + return mTexNo[index]; +} + +/* 802F27D4-802F27DC -00001 0008+00 0/0 0/0 0/0 .text setFontNo__12J2DTevBlock1FUs */ +void J2DTevBlock1::setFontNo(u16 fontNo) { + mFontNo = fontNo; +} + +/* 802F27DC-802F27E4 2ED11C 0008+00 1/0 0/0 0/0 .text getFontNo__12J2DTevBlock1CFv */ +u16 J2DTevBlock1::getFontNo() const { + return mFontNo; +} + +/* 802F27E4-802F2808 2ED124 0024+00 1/0 0/0 0/0 .text setTevOrder__12J2DTevBlock1FUl11J2DTevOrder + */ +void J2DTevBlock1::setTevOrder(u32 index, J2DTevOrder order) { + mTevOrder[index].mTevOrderInfo.mTexCoord = order.mTevOrderInfo.mTexCoord; + mTevOrder[index].mTevOrderInfo.mTexMap = order.mTevOrderInfo.mTexMap; + mTevOrder[index].mTevOrderInfo.mColor = order.mTevOrderInfo.mColor; +} + +/* 802F2808-802F281C 2ED148 0014+00 1/0 0/0 0/0 .text getTevOrder__12J2DTevBlock1FUl */ +J2DTevOrder* J2DTevBlock1::getTevOrder(u32 index) { + return &mTevOrder[index]; +} + +/* 802F281C-802F2848 2ED15C 002C+00 1/0 0/0 0/0 .text + * setTevColor__12J2DTevBlock1FUl13J2DGXColorS10 */ +void J2DTevBlock1::setTevColor(u32 index, J2DGXColorS10 color) { + mTevColor[index] = color; +} + +/* 802F2848-802F285C 2ED188 0014+00 1/0 0/0 0/0 .text getTevColor__12J2DTevBlock1FUl */ +J2DGXColorS10* J2DTevBlock1::getTevColor(u32 index) { + return &mTevColor[index]; +} + +/* 802F285C-802F2888 2ED19C 002C+00 1/0 0/0 0/0 .text + * setTevKColor__12J2DTevBlock1FUlQ28JUtility6TColor */ +void J2DTevBlock1::setTevKColor(u32 index, JUtility::TColor color) { + mTevKColor[index].r = color.r; + mTevKColor[index].g = color.g; + mTevKColor[index].b = color.b; + mTevKColor[index].a = color.a; +} + +/* 802F2888-802F289C 2ED1C8 0014+00 1/0 0/0 0/0 .text getTevKColor__12J2DTevBlock1FUl */ +JUtility::TColor* J2DTevBlock1::getTevKColor(u32 index) { + return &mTevKColor[index]; +} + +/* 802F289C-802F28A8 2ED1DC 000C+00 1/0 0/0 0/0 .text setTevKColorSel__12J2DTevBlock1FUlUc */ +void J2DTevBlock1::setTevKColorSel(u32 index, u8 sel) { + mTevKColorSel[index] = sel; +} + +/* 802F28A8-802F28B4 2ED1E8 000C+00 1/0 0/0 0/0 .text getTevKColorSel__12J2DTevBlock1FUl + */ +u8 J2DTevBlock1::getTevKColorSel(u32 index) { + return mTevKColorSel[index]; +} + +/* 802F28B4-802F28C0 2ED1F4 000C+00 1/0 0/0 0/0 .text setTevKAlphaSel__12J2DTevBlock1FUlUc */ +void J2DTevBlock1::setTevKAlphaSel(u32 index, u8 sel) { + mTevKAlphaSel[index] = sel; +} + +/* 802F28C0-802F28CC 2ED200 000C+00 1/0 0/0 0/0 .text getTevKAlphaSel__12J2DTevBlock1FUl + */ +u8 J2DTevBlock1::getTevKAlphaSel(u32 index) { + return mTevKAlphaSel[index]; +} + +/* 802F28CC-802F28D0 2ED20C 0004+00 1/0 0/0 0/0 .text setTevStageNum__12J2DTevBlock1FUc + */ +void J2DTevBlock1::setTevStageNum(u8) { + /* empty function */ +} + +/* 802F28D0-802F28D8 2ED210 0008+00 1/0 0/0 0/0 .text getTevStageNum__12J2DTevBlock1CFv + */ +u8 J2DTevBlock1::getTevStageNum() const { + return 1; +} + +/* 802F28D8-802F2914 2ED218 003C+00 1/0 0/0 0/0 .text setTevStage__12J2DTevBlock1FUl11J2DTevStage + */ +void J2DTevBlock1::setTevStage(u32 index, J2DTevStage stage) { + mTevStage[index] = stage; +} + +/* 802F2914-802F2928 2ED254 0014+00 1/0 0/0 0/0 .text getTevStage__12J2DTevBlock1FUl */ +J2DTevStage* J2DTevBlock1::getTevStage(u32 index) { + return &mTevStage[index]; +} + +/* 802F2928-802F2960 2ED268 0038+00 1/0 0/0 0/0 .text + * setTevSwapModeInfo__12J2DTevBlock1FUl18J2DTevSwapModeInfo */ +void J2DTevBlock1::setTevSwapModeInfo(u32 index, J2DTevSwapModeInfo info) { + mTevStage[index].setTevSwapModeInfo(info); +} + +/* 802F2960-802F2970 2ED2A0 0010+00 1/0 0/0 0/0 .text + * setTevSwapModeTable__12J2DTevBlock1FUl19J2DTevSwapModeTable */ +void J2DTevBlock1::setTevSwapModeTable(u32 index, J2DTevSwapModeTable table) { + mTevSwapModeTable[index] = table; +} + +/* 802F2970-802F2980 2ED2B0 0010+00 1/0 0/0 0/0 .text getTevSwapModeTable__12J2DTevBlock1FUl */ +J2DTevSwapModeTable* J2DTevBlock1::getTevSwapModeTable(u32 index) { + return &mTevSwapModeTable[index]; +} + +/* 802F2980-802F2994 2ED2C0 0014+00 1/0 0/0 0/0 .text + * setIndTevStage__12J2DTevBlock1FUl14J2DIndTevStage */ +void J2DTevBlock1::setIndTevStage(u32 index, J2DIndTevStage stage) { + mIndTevStage[index] = stage; +} + +/* 802F2994-802F29A8 2ED2D4 0014+00 1/0 0/0 0/0 .text getIndTevStage__12J2DTevBlock1FUl + */ +J2DIndTevStage* J2DTevBlock1::getIndTevStage(u32 index) { + return &mIndTevStage[index]; +} + +/* 802F29A8-802F29D8 2ED2E8 0030+00 1/0 0/0 0/0 .text insertTexture__12J2DTevBlock1FUlPC7ResTIMG + */ +bool J2DTevBlock1::insertTexture(u32 index, ResTIMG const* p_timg) { + return insertTexture(index, p_timg, NULL); +} + +/* 802F29D8-802F29F8 2ED318 0020+00 1/0 0/0 0/0 .text getTexture__12J2DTevBlock1FUl */ +JUTTexture* J2DTevBlock1::getTexture(u32 index) { + if (index >= 1) { + return NULL; + } + + return mTexture[index]; +} + +/* 802F29F8-802F2A18 2ED338 0020+00 1/0 0/0 0/0 .text getPalette__12J2DTevBlock1FUl */ +JUTPalette* J2DTevBlock1::getPalette(u32 index) { + if (index >= 1) { + return NULL; + } + + return mPalette[index]; +} + +/* 802F2A18-802F2A20 2ED358 0008+00 1/0 0/0 0/0 .text getFont__12J2DTevBlock1Fv */ +JUTFont* J2DTevBlock1::getFont() { + return mFont; +} + +/* 802F2A20-802F2A30 2ED360 0010+00 1/0 0/0 0/0 .text setUndeleteFlag__12J2DTevBlock1FUc + */ +void J2DTevBlock1::setUndeleteFlag(u8 flag) { + mUndeleteFlag &= flag; +} + +/* 802F2A30-802F2A40 2ED370 0010+00 1/0 0/0 0/0 .text setFontUndeleteFlag__12J2DTevBlock1Fv */ +void J2DTevBlock1::setFontUndeleteFlag() { + mUndeleteFlag &= 0x7F; +} + +/* 802F2A40-802F2A44 2ED380 0004+00 1/0 0/0 0/0 .text initialize__11J2DTevBlockFv */ +void J2DTevBlock::initialize() { + /* empty function */ +} + +/* 802F2A44-802F2A48 2ED384 0004+00 1/0 0/0 0/0 .text loadTexture__11J2DTevBlockF11_GXTexMapIDUl + */ +void J2DTevBlock::loadTexture(GXTexMapID, u32) { + /* empty function */ +} + +/* 802F2A48-802F2A4C 2ED388 0004+00 1/0 0/0 0/0 .text setFontNo__11J2DTevBlockFUs */ +void J2DTevBlock::setFontNo(u16) { + /* empty function */ +} + +/* 802F2A4C-802F2A50 2ED38C 0004+00 1/0 0/0 0/0 .text setTevOrder__11J2DTevBlockFUl11J2DTevOrder + */ +void J2DTevBlock::setTevOrder(u32, J2DTevOrder) { + /* empty function */ +} + +/* 802F2A50-802F2A54 2ED390 0004+00 1/0 0/0 0/0 .text setTevKColorSel__11J2DTevBlockFUlUc + */ +void J2DTevBlock::setTevKColorSel(u32, u8) { + /* empty function */ +} + +/* 802F2A54-802F2A58 2ED394 0004+00 1/0 0/0 0/0 .text setTevKAlphaSel__11J2DTevBlockFUlUc + */ +void J2DTevBlock::setTevKAlphaSel(u32, u8) { + /* empty function */ +} + +/* 802F2A58-802F2A5C 2ED398 0004+00 1/0 0/0 0/0 .text setTevStageNum__11J2DTevBlockFUc */ +void J2DTevBlock::setTevStageNum(u8) { + /* empty function */ +} + +/* 802F2A5C-802F2A60 2ED39C 0004+00 1/0 0/0 0/0 .text setTevStage__11J2DTevBlockFUl11J2DTevStage + */ +void J2DTevBlock::setTevStage(u32, J2DTevStage) { + /* empty function */ +} + +/* 802F2A60-802F2A64 2ED3A0 0004+00 1/0 0/0 0/0 .text + * setTevSwapModeInfo__11J2DTevBlockFUl18J2DTevSwapModeInfo */ +void J2DTevBlock::setTevSwapModeInfo(u32, J2DTevSwapModeInfo) { + /* empty function */ +} + +/* 802F2A64-802F2A68 2ED3A4 0004+00 1/0 0/0 0/0 .text + * setTevSwapModeTable__11J2DTevBlockFUl19J2DTevSwapModeTable */ +void J2DTevBlock::setTevSwapModeTable(u32, J2DTevSwapModeTable) { + /* empty function */ +} + +/* 802F2A68-802F2A6C 2ED3A8 0004+00 1/0 0/0 0/0 .text + * setIndTevStage__11J2DTevBlockFUl14J2DIndTevStage */ +void J2DTevBlock::setIndTevStage(u32, J2DIndTevStage) { + /* empty function */ +} + +/* 802F2A6C-802F2A74 2ED3AC 0008+00 1/0 0/0 0/0 .text insertTexture__11J2DTevBlockFUlP10JUTTexture + */ +bool J2DTevBlock::insertTexture(u32, JUTTexture*) { + return false; +} + +/* 802F2A74-802F2A7C 2ED3B4 0008+00 1/0 0/0 0/0 .text + * insertTexture__11J2DTevBlockFUlPC7ResTIMGP10JUTPalette */ +bool J2DTevBlock::insertTexture(u32, ResTIMG const*, JUTPalette*) { + return false; +} + +/* 802F2A7C-802F2A84 2ED3BC 0008+00 1/0 0/0 0/0 .text insertTexture__11J2DTevBlockFUlPC7ResTIMG */ +bool J2DTevBlock::insertTexture(u32, ResTIMG const*) { + return false; +} + +/* 802F2A84-802F2A8C 2ED3C4 0008+00 1/0 0/0 0/0 .text setTexture__11J2DTevBlockFUlP10JUTTexture */ +bool J2DTevBlock::setTexture(u32, JUTTexture*) { + return false; +} + +/* 802F2A8C-802F2A94 2ED3CC 0008+00 1/0 0/0 0/0 .text setTexture__11J2DTevBlockFUlPC7ResTIMG */ +bool J2DTevBlock::setTexture(u32, ResTIMG const*) { + return false; +} + +/* 802F2A94-802F2A9C 2ED3D4 0008+00 1/0 0/0 0/0 .text removeTexture__11J2DTevBlockFUl */ +bool J2DTevBlock::removeTexture(u32) { + return false; +} + +/* 802F2A9C-802F2AA4 2ED3DC 0008+00 1/0 0/0 0/0 .text setFont__11J2DTevBlockFP7JUTFont */ +bool J2DTevBlock::setFont(JUTFont*) { + return false; +} + +/* 802F2AA4-802F2AAC 2ED3E4 0008+00 1/0 0/0 0/0 .text setFont__11J2DTevBlockFP7ResFONT */ +bool J2DTevBlock::setFont(ResFONT*) { + return false; +} + +/* 802F2AAC-802F2AB4 2ED3EC 0008+00 1/0 0/0 0/0 .text setPalette__11J2DTevBlockFUlPC7ResTLUT */ +bool J2DTevBlock::setPalette(u32, ResTLUT const*) { + return false; +} + +/* 802F2AB4-802F2ABC 2ED3F4 0008+00 1/0 0/0 0/0 .text prepareTexture__11J2DTevBlockFUc */ +bool J2DTevBlock::prepareTexture(u8) { + return false; +} + +/* 802F2ABC-802F2AC4 2ED3FC 0008+00 1/0 0/0 0/0 .text getFont__11J2DTevBlockFv */ +JUTFont* J2DTevBlock::getFont() { + return NULL; +} + +/* 802F2AC4-802F2AC8 2ED404 0004+00 1/0 0/0 0/0 .text shiftDeleteFlag__11J2DTevBlockFUcb + */ +void J2DTevBlock::shiftDeleteFlag(u8, bool) { + /* empty function */ +} + +/* 802F2AC8-802F2ACC 2ED408 0004+00 1/0 0/0 0/0 .text setUndeleteFlag__11J2DTevBlockFUc + */ +void J2DTevBlock::setUndeleteFlag(u8) { + /* empty function */ +} + +/* 802F2ACC-802F2AD0 2ED40C 0004+00 1/0 0/0 0/0 .text setFontUndeleteFlag__11J2DTevBlockFv */ +void J2DTevBlock::setFontUndeleteFlag() { + /* empty function */ +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DMaterial.cpp b/src/JSystem/J2DGraph/J2DMaterial.cpp new file mode 100644 index 0000000000..ac0fad4061 --- /dev/null +++ b/src/JSystem/J2DGraph/J2DMaterial.cpp @@ -0,0 +1,541 @@ +// +// Generated By: dol2asm +// Translation Unit: J2DMaterial +// + +#include "JSystem/J2DGraph/J2DMaterial.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "dol2asm.h" + +// +// Forward References: +// + +extern "C" void __ct__11J2DMaterialFv(); +extern "C" void __dt__11J2DMaterialFv(); +extern "C" void setGX__11J2DMaterialFv(); +extern "C" void createTevBlock__11J2DMaterialFib(); +extern "C" void createIndBlock__11J2DMaterialFib(); +extern "C" void __ct__Q211J2DMaterial21J2DMaterialAnmPointerFv(); +extern "C" void makeAnmPointer__11J2DMaterialFv(); +extern "C" void setAnimation__11J2DMaterialFP11J2DAnmColor(); +extern "C" void setAnimation__11J2DMaterialFP19J2DAnmTextureSRTKey(); +extern "C" void setAnimation__11J2DMaterialFP16J2DAnmTexPattern(); +extern "C" void setAnimation__11J2DMaterialFP15J2DAnmTevRegKey(); +extern "C" void animation__11J2DMaterialFv(); +extern "C" void __dt__13J2DColorBlockFv(); +extern "C" void __dt__11J2DIndBlockFv(); +extern "C" void __dt__11J2DTevBlockFv(); +extern "C" void setGX__11J2DIndBlockFv(); +extern "C" void setGX__11J2DTevBlockFv(); +extern "C" void setTevKColor__11J2DTevBlockFUlQ28JUtility6TColor(); +extern "C" void setTevColor__11J2DTevBlockFUl13J2DGXColorS10(); +extern "C" void setTexNo__11J2DTevBlockFUlUs(); +extern "C" void setGX__15J2DIndBlockNullFv(); +extern "C" void getType__15J2DIndBlockNullFv(); +extern "C" void __dt__15J2DIndBlockNullFv(); +extern "C" void initialize__11J2DIndBlockFv(); +extern "C" void setIndTexStageNum__11J2DIndBlockFUc(); +extern "C" void setIndTexOrder__11J2DIndBlockFUl14J2DIndTexOrder(); +extern "C" void setIndTexMtx__11J2DIndBlockFUl12J2DIndTexMtx(); +extern "C" void setIndTexCoordScale__11J2DIndBlockFUl19J2DIndTexCoordScale(); +extern "C" void __ct__11J2DTexCoordFv(); +extern "C" void __ct__12J2DColorChanFv(); +extern "C" void __dt__19J2DIndTexCoordScaleFv(); +extern "C" void __ct__19J2DIndTexCoordScaleFv(); +extern "C" void __dt__12J2DIndTexMtxFv(); +extern "C" void __ct__12J2DIndTexMtxFv(); +extern "C" void __ct__14J2DIndTexOrderFv(); +extern "C" void getColor__11J2DAnmColorCFUsP8_GXColor(); + +// +// External References: +// + +extern "C" void __ct__Q28JUtility6TColorFv(); +extern "C" void* __nw__FUl(); +extern "C" void* __nw__FUli(); +extern "C" void __dl__FPv(); +extern "C" void storeTIMG__10JUTTextureFPC7ResTIMGP10JUTPalette7_GXTlut(); +extern "C" bool getIndTexCoordScale__11J2DIndBlockFUl(); +extern "C" bool getIndTexMtx__11J2DIndBlockFUl(); +extern "C" bool getIndTexOrder__11J2DIndBlockFUl(); +extern "C" bool getIndTexStageNum__11J2DIndBlockCFv(); +extern "C" void initialize__13J2DColorBlockFv(); +extern "C" void setGX__13J2DColorBlockFv(); +extern "C" void initialize__14J2DTexGenBlockFv(); +extern "C" void setGX__14J2DTexGenBlockFv(); +extern "C" void __dt__14J2DTexGenBlockFv(); +extern "C" void setTexMtx__14J2DTexGenBlockFUlR9J2DTexMtx(); +extern "C" void getTexMtx__14J2DTexGenBlockFUlR9J2DTexMtx(); +extern "C" void __ct__12J2DTevBlock1Fv(); +extern "C" void __ct__12J2DTevBlock2Fv(); +extern "C" void __ct__12J2DTevBlock4Fv(); +extern "C" void __ct__12J2DTevBlock8Fv(); +extern "C" void __ct__13J2DTevBlock16Fv(); +extern "C" void initialize__10J2DPEBlockFv(); +extern "C" void setGX__10J2DPEBlockFv(); +extern "C" void calcTransform__19J2DAnmTextureSRTKeyCFfUsP17J3DTextureSRTInfo(); +extern "C" void getTexNo__16J2DAnmTexPatternCFUsPUs(); +extern "C" void getResTIMG__16J2DAnmTexPatternCFUs(); +extern "C" void getPalette__16J2DAnmTexPatternCFUs(); +extern "C" void getTevColorReg__15J2DAnmTevRegKeyCFUsP11_GXColorS10(); +extern "C" void getTevKonstReg__15J2DAnmTevRegKeyCFUsP8_GXColor(); +extern "C" void __construct_array(); +extern "C" void _savegpr_26(); +extern "C" void _restgpr_26(); +extern "C" extern void* __vt__15J2DIndBlockFull[14]; +extern "C" extern void* __vt__11J2DTevBlock[47]; +extern "C" extern void* __vt__14J2DTexGenBlock[3 + 1 /* padding */]; + +// +// Declarations: +// + +/* ############################################################################################## */ +/* 803CCA08-803CCA40 029B28 0038+00 2/2 0/0 0/0 .data __vt__15J2DIndBlockNull */ +SECTION_DATA extern void* __vt__15J2DIndBlockNull[14] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)initialize__11J2DIndBlockFv, + (void*)setGX__15J2DIndBlockNullFv, + (void*)getType__15J2DIndBlockNullFv, + (void*)setIndTexStageNum__11J2DIndBlockFUc, + (void*)getIndTexStageNum__11J2DIndBlockCFv, + (void*)setIndTexOrder__11J2DIndBlockFUl14J2DIndTexOrder, + (void*)getIndTexOrder__11J2DIndBlockFUl, + (void*)setIndTexMtx__11J2DIndBlockFUl12J2DIndTexMtx, + (void*)getIndTexMtx__11J2DIndBlockFUl, + (void*)setIndTexCoordScale__11J2DIndBlockFUl19J2DIndTexCoordScale, + (void*)getIndTexCoordScale__11J2DIndBlockFUl, + (void*)__dt__15J2DIndBlockNullFv, +}; + +/* 803CCA40-803CCA78 029B60 0038+00 3/3 1/1 0/0 .data __vt__11J2DIndBlock */ +SECTION_DATA extern void* __vt__11J2DIndBlock[14] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)initialize__11J2DIndBlockFv, + (void*)setGX__11J2DIndBlockFv, + (void*)NULL, + (void*)setIndTexStageNum__11J2DIndBlockFUc, + (void*)getIndTexStageNum__11J2DIndBlockCFv, + (void*)setIndTexOrder__11J2DIndBlockFUl14J2DIndTexOrder, + (void*)getIndTexOrder__11J2DIndBlockFUl, + (void*)setIndTexMtx__11J2DIndBlockFUl12J2DIndTexMtx, + (void*)getIndTexMtx__11J2DIndBlockFUl, + (void*)setIndTexCoordScale__11J2DIndBlockFUl19J2DIndTexCoordScale, + (void*)getIndTexCoordScale__11J2DIndBlockFUl, + (void*)__dt__11J2DIndBlockFv, +}; + +/* 803CCA78-803CCA84 029B98 000C+00 2/2 0/0 0/0 .data __vt__11J2DMaterial */ +SECTION_DATA extern void* __vt__11J2DMaterial[3] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)__dt__11J2DMaterialFv, +}; + +/* 803CCA84-803CCA90 029BA4 000C+00 3/3 0/0 0/0 .data __vt__13J2DColorBlock */ +SECTION_DATA extern void* __vt__13J2DColorBlock[3] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)__dt__13J2DColorBlockFv, +}; + +/* 802EA1AC-802EA2CC 2E4AEC 0120+00 0/0 1/1 0/0 .text __ct__11J2DMaterialFv */ +J2DMaterial::J2DMaterial() { + field_0x4 = 0; + mIndex = -1; + mTevBlock = NULL; + mIndBlock = NULL; + mAnmPointer = NULL; + field_0x8 = 1; + mVisible = true; +} + +/* 802EA2CC-802EA38C 2E4C0C 00C0+00 1/0 2/2 0/0 .text __dt__11J2DMaterialFv */ +extern "C" void __dt__11J2DMaterialFv() { + // asm J2DMaterial::~J2DMaterial() { + // NONMATCHING +} + +/* 802EA38C-802EA410 2E4CCC 0084+00 0/0 8/8 0/0 .text setGX__11J2DMaterialFv */ +void J2DMaterial::setGX() { + if (mVisible) { + getColorBlock()->setGX(); + getTexGenBlock()->setGX(); + + if (getTevBlock() != NULL) { + getTevBlock()->setGX(); + } + + if (getIndBlock() != NULL) { + getIndBlock()->setGX(); + } + + getPEBlock()->setGX(); + } +} + +/* 802EA410-802EA5C4 2E4D50 01B4+00 0/0 1/1 0/0 .text createTevBlock__11J2DMaterialFib */ +J2DTevBlock* J2DMaterial::createTevBlock(int block_type, bool noAlign) { + J2DTevBlock* block; + + if (noAlign) { + if (block_type <= 1) { + block = new J2DTevBlock1(); + } else if (block_type == 2) { + block = new J2DTevBlock2(); + } else if (block_type <= 4) { + block = new J2DTevBlock4(); + } else if (block_type <= 8) { + block = new J2DTevBlock8(); + } else { + block = new J2DTevBlock16(); + } + } else { + if (block_type <= 1) { + block = new (-4) J2DTevBlock1(); + } else if (block_type == 2) { + block = new (-4) J2DTevBlock2(); + } else if (block_type <= 4) { + block = new (-4) J2DTevBlock4(); + } else if (block_type <= 8) { + block = new (-4) J2DTevBlock8(); + } else { + block = new (-4) J2DTevBlock16(); + } + } + + return block; +} + +/* 802EA5C4-802EA79C 2E4F04 01D8+00 0/0 1/1 0/0 .text createIndBlock__11J2DMaterialFib */ +J2DIndBlock* J2DMaterial::createIndBlock(int block_type, bool noAlign) { + J2DIndBlock* block; + + if (noAlign) { + if (block_type != 0) { + block = new J2DIndBlockFull(); + } else { + block = new J2DIndBlockNull(); + } + } else { + if (block_type != 0) { + block = new (-4) J2DIndBlockFull(); + } else { + block = new (-4) J2DIndBlockNull(); + } + } + + return block; +} + +/* 802EA79C-802EA84C 2E50DC 00B0+00 1/1 0/0 0/0 .text + * __ct__Q211J2DMaterial21J2DMaterialAnmPointerFv */ +J2DMaterial::J2DMaterialAnmPointer::J2DMaterialAnmPointer() { + field_0x0 = NULL; + field_0x10 = -1; + field_0x4 = 0; + + for (int i = 0; i < 8; i++) { + field_0x12[i] = -1; + } + field_0x8 = 0; + + for (int i = 0; i < 8; i++) { + field_0x22[i] = -1; + } + field_0xc = 0; + + for (int i = 0; i < 4; i++) { + field_0x32[i] = -1; + } + + for (int i = 0; i < 4; i++) { + field_0x3a[i] = -1; + } +} + +/* 802EA84C-802EA89C 2E518C 0050+00 4/4 0/0 0/0 .text makeAnmPointer__11J2DMaterialFv */ +void J2DMaterial::makeAnmPointer() { + if (mAnmPointer == NULL) { + mAnmPointer = new J2DMaterialAnmPointer(); + } +} + +/* 802EA89C-802EA94C 2E51DC 00B0+00 0/0 4/4 0/0 .text setAnimation__11J2DMaterialFP11J2DAnmColor + */ +void J2DMaterial::setAnimation(J2DAnmColor* anm) { + if (anm != NULL || mAnmPointer != NULL) { + makeAnmPointer(); + mAnmPointer->field_0x0 = anm; + mAnmPointer->field_0x10 = -1; + + if (anm != NULL) { + u16 matNum = anm->getUpdateMaterialNum(); + u16 index = getIndex(); + + for (u16 i = 0; i < matNum; i++) { + u16 matID = anm->getUpdateMaterialID(i); + + if (index == matID) { + mAnmPointer->field_0x10 = i; + return; + } + } + } + } +} + +/* 802EA94C-802EAA2C 2E528C 00E0+00 0/0 4/4 0/0 .text + * setAnimation__11J2DMaterialFP19J2DAnmTextureSRTKey */ +void J2DMaterial::setAnimation(J2DAnmTextureSRTKey* anm) { + if (anm != NULL || mAnmPointer != NULL) { + makeAnmPointer(); + mAnmPointer->field_0x4 = anm; + + for (int i = 0; i < 8; i++) { + mAnmPointer->field_0x12[i] = -1; + } + + if (anm != NULL) { + u16 matNum = anm->getUpdateMaterialNum(); + u16 index = getIndex(); + + for (u16 i = 0; i < matNum; i++) { + u16 matID = anm->getUpdateMaterialID(i); + + if (index == matID) { + u8 mtxID = anm->getUpdateTexMtxID(i); + mAnmPointer->field_0x12[mtxID] = i; + } + } + } + } +} + +/* 802EAA2C-802EAB0C 2E536C 00E0+00 0/0 4/4 0/0 .text + * setAnimation__11J2DMaterialFP16J2DAnmTexPattern */ +void J2DMaterial::setAnimation(J2DAnmTexPattern* anm) { + if (anm != NULL || mAnmPointer != NULL) { + makeAnmPointer(); + mAnmPointer->field_0x8 = anm; + + for (int i = 0; i < 8; i++) { + mAnmPointer->field_0x22[i] = -1; + } + + if (anm != NULL) { + u16 matNum = anm->getUpdateMaterialNum(); + u16 index = getIndex(); + J3DAnmTexPatternFullTable* anmTbl = anm->getAnmTable(); + + for (u16 i = 0; i < matNum; i++) { + u16 matID = anm->getUpdateMaterialID(i); + + if (index == matID) { + mAnmPointer->field_0x22[anmTbl[i].mTexNo] = i; + } + } + } + } +} + +/* 802EAB0C-802EAC78 2E544C 016C+00 0/0 4/4 0/0 .text + * setAnimation__11J2DMaterialFP15J2DAnmTevRegKey */ +void J2DMaterial::setAnimation(J2DAnmTevRegKey* anm) { + if (anm != NULL || mAnmPointer != NULL) { + makeAnmPointer(); + mAnmPointer->field_0xc = anm; + + for (int i = 0; i < 4; i++) { + mAnmPointer->field_0x32[i] = -1; + } + + if (anm != NULL) { + u16 matNum = anm->getCRegUpdateMaterialNum(); + u16 index = getIndex(); + + for (u16 i = 0; i < matNum; i++) { + u16 matID = anm->getCRegUpdateMaterialID(i); + + if (index == matID) { + J3DAnmCRegKeyTable* anmTbl = anm->getAnmCRegKeyTable(); + mAnmPointer->field_0x32[anmTbl[i].mColorId] = i; + } + } + } + + for (int i = 0; i < 4; i++) { + mAnmPointer->field_0x3a[i] = -1; + } + + if (anm != NULL) { + u16 matNum = anm->getKRegUpdateMaterialNum(); + u16 index = getIndex(); + + for (u16 i = 0; i < matNum; i++) { + u16 matID = anm->getKRegUpdateMaterialID(i); + + if (index == matID) { + J3DAnmKRegKeyTable* anmTbl = anm->getAnmKRegKeyTable(); + mAnmPointer->field_0x3a[anmTbl[i].mColorId] = i; + } + } + } + } +} + +/* ############################################################################################## */ +/* 804561B0-804561B4 0047B0 0004+00 1/1 0/0 0/0 .sdata2 @1943 */ +SECTION_SDATA2 static f32 lit_1943 = 360.0f; + +/* 804561B4-804561B8 0047B4 0004+00 1/1 0/0 0/0 .sdata2 @1944 */ +SECTION_SDATA2 static f32 lit_1944 = 65535.0f; + +/* 804561B8-804561C0 0047B8 0008+00 1/1 0/0 0/0 .sdata2 @1946 */ +SECTION_SDATA2 static f64 lit_1946 = 4503599627370496.0 /* cast u32 to float */; + +/* 802EAC78-802EB0F4 2E55B8 047C+00 0/0 1/1 0/0 .text animation__11J2DMaterialFv */ +void J2DMaterial::animation() { + // NONMATCHING +} + +/* 802EB0F4-802EB13C 2E5A34 0048+00 1/0 0/0 0/0 .text __dt__13J2DColorBlockFv */ +J2DColorBlock::~J2DColorBlock() { + // NONMATCHING +} + +/* 802EB13C-802EB184 2E5A7C 0048+00 1/0 0/0 0/0 .text __dt__11J2DIndBlockFv */ +// J2DIndBlock::~J2DIndBlock() { +extern "C" void __dt__11J2DIndBlockFv() { + // NONMATCHING +} + +/* 802EB184-802EB1CC 2E5AC4 0048+00 0/0 1/0 0/0 .text __dt__11J2DTevBlockFv */ +// J2DTevBlock::~J2DTevBlock() { +extern "C" void __dt__11J2DTevBlockFv() { + // NONMATCHING +} + +/* 802EB1CC-802EB1D0 2E5B0C 0004+00 1/0 0/0 0/0 .text setGX__11J2DIndBlockFv */ +void J2DIndBlock::setGX() { + /* empty function */ +} + +/* 802EB1D0-802EB1D4 2E5B10 0004+00 0/0 1/0 0/0 .text setGX__11J2DTevBlockFv */ +void J2DTevBlock::setGX() { + /* empty function */ +} + +/* 802EB1D4-802EB1D8 2E5B14 0004+00 0/0 1/0 0/0 .text + * setTevKColor__11J2DTevBlockFUlQ28JUtility6TColor */ +void J2DTevBlock::setTevKColor(u32 param_0, JUtility::TColor param_1) { + /* empty function */ +} + +/* 802EB1D8-802EB1DC 2E5B18 0004+00 0/0 1/0 0/0 .text setTevColor__11J2DTevBlockFUl13J2DGXColorS10 + */ +void J2DTevBlock::setTevColor(u32 param_0, J2DGXColorS10 param_1) { + /* empty function */ +} + +/* 802EB1DC-802EB1E0 2E5B1C 0004+00 0/0 1/0 0/0 .text setTexNo__11J2DTevBlockFUlUs */ +void J2DTevBlock::setTexNo(u32 param_0, u16 param_1) { + /* empty function */ +} + +/* 802EB1E0-802EB1E4 2E5B20 0004+00 1/0 0/0 0/0 .text setGX__15J2DIndBlockNullFv */ +extern "C" void setGX__15J2DIndBlockNullFv() { + /* empty function */ +} + +/* 802EB1E4-802EB1F0 2E5B24 000C+00 1/0 0/0 0/0 .text getType__15J2DIndBlockNullFv */ +u32 J2DIndBlockNull::getType() { + // NONMATCHING +} + +/* 802EB1F0-802EB24C 2E5B30 005C+00 1/0 0/0 0/0 .text __dt__15J2DIndBlockNullFv */ +J2DIndBlockNull::~J2DIndBlockNull() { + // NONMATCHING +} + +/* 802EB24C-802EB250 2E5B8C 0004+00 2/0 0/0 0/0 .text initialize__11J2DIndBlockFv */ +extern "C" void initialize__11J2DIndBlockFv() { + /* empty function */ +} + +/* 802EB250-802EB254 2E5B90 0004+00 2/0 0/0 0/0 .text setIndTexStageNum__11J2DIndBlockFUc + */ +void J2DIndBlock::setIndTexStageNum(u8 param_0) { + /* empty function */ +} + +/* 802EB254-802EB258 2E5B94 0004+00 2/0 0/0 0/0 .text + * setIndTexOrder__11J2DIndBlockFUl14J2DIndTexOrder */ +void J2DIndBlock::setIndTexOrder(u32 param_0, J2DIndTexOrder param_1) { + /* empty function */ +} + +/* 802EB258-802EB25C 2E5B98 0004+00 2/0 0/0 0/0 .text setIndTexMtx__11J2DIndBlockFUl12J2DIndTexMtx + */ +void J2DIndBlock::setIndTexMtx(u32 param_0, J2DIndTexMtx param_1) { + /* empty function */ +} + +/* 802EB25C-802EB260 2E5B9C 0004+00 2/0 0/0 0/0 .text + * setIndTexCoordScale__11J2DIndBlockFUl19J2DIndTexCoordScale */ +void J2DIndBlock::setIndTexCoordScale(u32 param_0, J2DIndTexCoordScale param_1) { + /* empty function */ +} + +/* 802EB260-802EB280 2E5BA0 0020+00 1/1 0/0 0/0 .text __ct__11J2DTexCoordFv */ +//J2DTexCoord::J2DTexCoord() { +void __ct__11J2DTexCoordFv() { + // NONMATCHING +} + +/* 802EB280-802EB290 2E5BC0 0010+00 1/1 0/0 0/0 .text __ct__12J2DColorChanFv */ +void __ct__12J2DColorChanFv() { +//asm J2DColorChan::J2DColorChan() { + // NONMATCHING +} + +/* 802EB290-802EB2CC 2E5BD0 003C+00 1/1 1/1 0/0 .text __dt__19J2DIndTexCoordScaleFv */ +// Most likely inline +// J2DIndTexCoordScale::~J2DIndTexCoordScale() { +void __dt__19J2DIndTexCoordScaleFv() { + // NONMATCHING +} + +/* 802EB2CC-802EB2E4 2E5C0C 0018+00 1/1 0/0 0/0 .text __ct__19J2DIndTexCoordScaleFv */ +//J2DIndTexCoordScale::J2DIndTexCoordScale() { +void __ct__19J2DIndTexCoordScaleFv() { + // NONMATCHING +} + +/* 802EB2E4-802EB320 2E5C24 003C+00 1/1 1/1 0/0 .text __dt__12J2DIndTexMtxFv */ +void __dt__12J2DIndTexMtxFv() { +//asm J2DIndTexMtx::~J2DIndTexMtx() { + // NONMATCHING +} + +/* 802EB320-802EB378 2E5C60 0058+00 1/1 0/0 0/0 .text __ct__12J2DIndTexMtxFv */ +//J2DIndTexMtx::J2DIndTexMtx() { +void __ct__12J2DIndTexMtxFv() { + // NONMATCHING +} + +/* 802EB378-802EB390 2E5CB8 0018+00 1/1 0/0 0/0 .text __ct__14J2DIndTexOrderFv */ +// Most likely inline +//J2DIndTexOrder::J2DIndTexOrder() { +void __ct__14J2DIndTexOrderFv() { + // NONMATCHING +} + +/* 802EB390-802EB394 2E5CD0 0004+00 0/0 1/0 0/0 .text getColor__11J2DAnmColorCFUsP8_GXColor */ +void J2DAnmColor::getColor(u16 param_0, _GXColor* param_1) const { + /* empty function */ +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DMaterialFactory.cpp b/src/JSystem/J2DGraph/J2DMaterialFactory.cpp new file mode 100644 index 0000000000..0f66624c1c --- /dev/null +++ b/src/JSystem/J2DGraph/J2DMaterialFactory.cpp @@ -0,0 +1,522 @@ +// +// Generated By: dol2asm +// Translation Unit: J2DMaterialFactory +// + +#include "JSystem/J2DGraph/J2DMaterialFactory.h" +#include "JSystem/J2DGraph/J2DMaterial.h" +#include "JSystem/JSupport/JSupport.h" +#include "string.h" +#include "dol2asm.h" +#include "dolphin/types.h" + +// +// Forward References: +// + +extern "C" void __ct__18J2DMaterialFactoryFRC16J2DMaterialBlock(); +extern "C" void countStages__18J2DMaterialFactoryCFi(); +extern "C" void +create__18J2DMaterialFactoryCFP11J2DMaterialiUlP15J2DResReferenceP15J2DResReferenceP10JKRArchive(); +extern "C" void newMatColor__18J2DMaterialFactoryCFii(); +extern "C" void newColorChanNum__18J2DMaterialFactoryCFi(); +extern "C" void newColorChan__18J2DMaterialFactoryCFii(); +extern "C" void newTexGenNum__18J2DMaterialFactoryCFi(); +extern "C" void newTexCoord__18J2DMaterialFactoryCFii(); +extern "C" void newTexMtx__18J2DMaterialFactoryCFii(); +extern "C" void newCullMode__18J2DMaterialFactoryCFi(); +extern "C" void newTexNo__18J2DMaterialFactoryCFii(); +extern "C" void newFontNo__18J2DMaterialFactoryCFi(); +extern "C" void newTevOrder__18J2DMaterialFactoryCFii(); +extern "C" void newTevColor__18J2DMaterialFactoryCFii(); +extern "C" void newTevKColor__18J2DMaterialFactoryCFii(); +extern "C" void newTevStageNum__18J2DMaterialFactoryCFi(); +extern "C" void newTevStage__18J2DMaterialFactoryCFii(); +extern "C" void newTevSwapModeTable__18J2DMaterialFactoryCFii(); +extern "C" void newIndTexStageNum__18J2DMaterialFactoryCFi(); +extern "C" void newIndTexOrder__18J2DMaterialFactoryCFii(); +extern "C" void newIndTexMtx__18J2DMaterialFactoryCFii(); +extern "C" void newIndTevStage__18J2DMaterialFactoryCFii(); +extern "C" void newIndTexCoordScale__18J2DMaterialFactoryCFii(); +extern "C" void newAlphaComp__18J2DMaterialFactoryCFi(); +extern "C" void newBlend__18J2DMaterialFactoryCFi(); +extern "C" void newDither__18J2DMaterialFactoryCFi(); +extern "C" void __ct__11J2DTevStageFRC15J2DTevStageInfo(); +extern "C" void func_802F4170(void* _this, void const*, void const*); +extern "C" void func_802F4188(void* _this, void const*, void const*); +extern "C" void func_802F41A0(void* _this, void const*, void const*); +extern "C" void func_802F41B8(void* _this, void const*, void const*); +extern "C" void func_802F41D0(void* _this, void const*, void const*); +extern "C" void func_802F41E8(void* _this, void const*, void const*); +extern "C" void func_802F4200(void* _this, void const*, void const*); +extern "C" void func_802F4218(void* _this, void const*, void const*); +extern "C" void func_802F4230(void* _this, void const*, void const*); +extern "C" void func_802F4248(void* _this, void const*, void const*); +extern "C" u8* func_802F4260(void const*, void const*); +extern "C" void func_802F4278(void* _this, void const*, void const*); +extern "C" void func_802F4290(void* _this, void const*, void const*); +extern "C" void func_802F42A8(void* _this, void const*, void const*); +extern "C" void func_802F42C0(void* _this, void const*, void const*); +extern "C" void func_802F42D8(void* _this, void const*, void const*); + +// +// External References: +// + +extern "C" void* __nw__FUl(); +extern "C" void getResource__15JUTResReferenceFPCvUlP10JKRArchive(); +extern "C" void calc__9J2DTexMtxFv(); +extern "C" void createTevBlock__11J2DMaterialFib(); +extern "C" void createIndBlock__11J2DMaterialFib(); +extern "C" void __ct__11J2DTevStageFv(); +extern "C" void setTevStageInfo__11J2DTevStageFRC15J2DTevStageInfo(); +extern "C" void get__13J2DDataManageFPCc(); +extern "C" void getResReference__15J2DResReferenceCFUs(); +extern "C" void getName__15J2DResReferenceCFUs(); +extern "C" void _savegpr_19(); +extern "C" void _savegpr_29(); +extern "C" void _restgpr_19(); +extern "C" void _restgpr_29(); +extern "C" u8 mDataManage__9J2DScreen[4 + 4 /* padding */]; + +/* 802F2AD0-802F2C94 2ED410 01C4+00 0/0 1/1 0/0 .text + * __ct__18J2DMaterialFactoryFRC16J2DMaterialBlock */ +J2DMaterialFactory::J2DMaterialFactory(J2DMaterialBlock const& param_0) { + field_0x0 = param_0.field_0x8; + field_0x4 = JSUConvertOffsetToPtr<J2DMaterialInitData>(¶m_0, (void*)param_0.field_0xc); + field_0x8 = JSUConvertOffsetToPtr<u16>(¶m_0, (void*)param_0.field_0x10); + if (param_0.field_0x18 && param_0.field_0x18 - param_0.field_0x14 > 4) { + field_0xc = JSUConvertOffsetToPtr<J2DIndInitData>(¶m_0, (void*)param_0.field_0x18); + } + else { + field_0xc = NULL; + } + field_0x30 = JSUConvertOffsetToPtr<_GXCullMode>(¶m_0, (void*)param_0.field_0x1c); + field_0x10 = JSUConvertOffsetToPtr<GXColor>(¶m_0, (void*)param_0.field_0x20); + field_0x14 = JSUConvertOffsetToPtr<u8>(¶m_0, (void*)param_0.field_0x24); + field_0x18 = JSUConvertOffsetToPtr<J2DColorChanInfo>(¶m_0, (void*)param_0.field_0x28); + field_0x1c = JSUConvertOffsetToPtr<u8>(¶m_0, (void*)param_0.field_0x2c); + field_0x20 = JSUConvertOffsetToPtr<J2DTexCoordInfo>(¶m_0, (void*)param_0.field_0x30); + field_0x24 = JSUConvertOffsetToPtr<J2DTexMtxInfo>(¶m_0, (void*)param_0.field_0x34); + field_0x28 = JSUConvertOffsetToPtr<u16>(¶m_0, (void*)param_0.field_0x38); + field_0x2c = JSUConvertOffsetToPtr<u16>(¶m_0, (void*)param_0.field_0x3c); + field_0x34 = JSUConvertOffsetToPtr<J2DTevOrderInfo>(¶m_0, (void*)param_0.field_0x40); + field_0x38 = JSUConvertOffsetToPtr<_GXColorS10>(¶m_0, (void*)param_0.field_0x44); + field_0x3c = JSUConvertOffsetToPtr<GXColor>(¶m_0, (void*)param_0.field_0x48); + field_0x40 = JSUConvertOffsetToPtr<u8>(¶m_0, (void*)param_0.field_0x4c); + field_0x44 = JSUConvertOffsetToPtr<J2DTevStageInfo>(¶m_0, (void*)param_0.field_0x50); + field_0x48 = JSUConvertOffsetToPtr<J2DTevSwapModeInfo>(¶m_0, (void*)param_0.field_0x54); + field_0x4c = JSUConvertOffsetToPtr<J2DTevSwapModeTableInfo>(¶m_0, (void*)param_0.field_0x58); + field_0x50 = JSUConvertOffsetToPtr<J2DAlphaCompInfo>(¶m_0, (void*)param_0.field_0x5c); + field_0x54 = JSUConvertOffsetToPtr<J2DBlendInfo>(¶m_0, (void*)param_0.field_0x60); + field_0x58 = JSUConvertOffsetToPtr<u8>(¶m_0, (void*)param_0.field_0x64); +} + +/* 802F2C94-802F2D1C 2ED5D4 0088+00 1/1 0/0 0/0 .text countStages__18J2DMaterialFactoryCFi */ +u32 J2DMaterialFactory::countStages(int param_0) const { + J2DMaterialInitData* iVar5 = &field_0x4[field_0x8[param_0]]; + u32 uVar4 = 0; + u32 uVar3 = 0; + if (iVar5->field_0x4 != 0xff) { + uVar3 = field_0x40[iVar5->field_0x4]; + } + for (int i = 0; i < 8; i++) { + if (iVar5->field_0x38[i] != 0xffff) { + uVar4++; + } + } + if ((uVar3 != uVar4 && uVar4 != 0)) { + if (uVar3 > uVar4) { + return uVar3; + } + return uVar4; + } + return uVar3; +} + +/* 802F2D1C-802F362C 2ED65C 0910+00 0/0 1/1 0/0 .text + * create__18J2DMaterialFactoryCFP11J2DMaterialiUlP15J2DResReferenceP15J2DResReferenceP10JKRArchive + */ +// Stack issues +#ifdef NONMATCHING +J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 param_2, + J2DResReference* param_3, J2DResReference* param_4, + JKRArchive* param_5) const { + u32 stages = countStages(index); + u32 uVar1 = ((param_2 & 0x1f0000) >> 16); + u32 r28 = stages > uVar1 ? stages : uVar1; + + u32 r25 = r28 <= 8 ? r28 : 8; + + s32 local_3bc = ((param_2 & 0x1000000) != 0); + s32 local_3c0 = (param_2 & 0x1f0000) ? local_3bc : 0; + bool temp = (param_2 & 0x1f0000); + u16 tevBlockNum = r28; + param_0->mTevBlock = J2DMaterial::createTevBlock(tevBlockNum, temp); + param_0->mIndBlock = J2DMaterial::createIndBlock(local_3c0, temp); + param_0->mIndex = index; + param_0->field_0x8 = getMaterialMode(index); + param_0->getColorBlock()->setColorChanNum(newColorChanNum(index)); + param_0->getColorBlock()->setCullMode(newCullMode(index)); + param_0->getTexGenBlock()->setTexGenNum(newTexGenNum(index)); + param_0->getPEBlock()->setAlphaComp(newAlphaComp(index)); + param_0->getPEBlock()->setBlend(newBlend(index)); + param_0->getPEBlock()->setDither(newDither(index)); + param_0->getTevBlock()->setTevStageNum(newTevStageNum(index)); + param_0->mMaterialAlphaCalc = getMaterialAlphaCalc(index); + + JUTResReference aJStack_12c; + for (u8 i = 0; i < r25; i++) { + u16 texNo = newTexNo(index, i); + s8* local_37c = param_3->getResReference(texNo); + void* local_380 = NULL; + if (local_37c != NULL) { + local_380 = aJStack_12c.getResource(local_37c, 'TIMG', param_5); + if (local_380 == NULL && param_5 != NULL) { + local_380 = aJStack_12c.getResource(local_37c, 'TIMG', NULL); + } + if (local_380 == NULL && J2DScreen::getDataManage() != NULL) { + char acStack_230[256]; + strcpy(acStack_230, param_3->getName(texNo)); + local_380 = J2DScreen::getDataManage()->get(acStack_230); + } + } + param_0->getTevBlock()->insertTexture(i, (ResTIMG*)local_380); + param_0->getTevBlock()->setTexNo(i, texNo); + } + u16 fontNo = newFontNo(index); + param_0->getTevBlock()->setFontNo(fontNo); + + s8* local_384 = param_4->getResReference(param_0->getTevBlock()->getFontNo()); + void* local_388 = NULL; + if (local_384 != NULL) { + local_388 = aJStack_12c.getResource(local_384, 'FONT', param_5); + if (local_388 == NULL && param_5 != NULL) { + local_388 = aJStack_12c.getResource(local_384, 'FONT', NULL); + } + if (local_388 == NULL && J2DScreen::getDataManage() != NULL) { + char* pcVar9 = param_4->getName(param_0->getTevBlock()->getFontNo()); + char acStack_334[256]; + strcpy(acStack_334, pcVar9); + local_388 = J2DScreen::getDataManage()->get(acStack_334); + } + } + + param_0->getTevBlock()->setFont((ResFONT*)local_388); + for (u8 i = 0; i < r28; i++) { + param_0->getTevBlock()->setTevOrder(i, newTevOrder(index, i)); + } + for (u8 i = 0; i < r28; i++) { + J2DMaterialInitData* local_38c = &field_0x4[field_0x8[index]]; + param_0->getTevBlock()->setTevStage(i, newTevStage(index, i)); + if (local_38c->field_0xba[i] != 0xffff) { + param_0->getTevBlock()->getTevStage(i)->setTexSel(field_0x48[local_38c->field_0xba[i]].mTexSel); + param_0->getTevBlock()->getTevStage(i)->setRasSel(field_0x48[local_38c->field_0xba[i]].mRasSel); + } + } + for (u8 i = 0; i < 4; i++) { + param_0->getTevBlock()->setTevKColor(i, newTevKColor(index, i)); + } + for (u8 i = 0; i < 4; i++) { + J2DTevBlock* block = param_0->getTevBlock(); + block->setTevColor(i, newTevColor(index, i)); + } + for (u8 i = 0; i < 4; i++) { + param_0->getTevBlock()->setTevSwapModeTable(i, newTevSwapModeTable(index, i)); + } + for (u8 i = 0; i < 2; i++) { + param_0->getColorBlock()->setMatColor(i, newMatColor(index, i)); + } + for (u8 i = 0; i < 4; i++) { + param_0->getColorBlock()->setColorChan(i, newColorChan(index, i)); + } + for (u8 i = 0; i < 8; i++) { + param_0->getTexGenBlock()->setTexCoord(i, newTexCoord(index, i)); + } + for (u8 i = 0; i < 8; i++) { + param_0->getTexGenBlock()->setTexMtx(i, newTexMtx(index, i)); + } + J2DMaterialInitData* local_394 = &field_0x4[field_0x8[index]]; + for (u8 i = 0; i < r28; i++) { + param_0->getTevBlock()->setTevKColorSel(i, local_394->field_0x52[i]); + } + for (u8 i = 0; i < r28; i++) { + param_0->getTevBlock()->setTevKAlphaSel(i, local_394->field_0x62[i]); + } + if (field_0xc != NULL || local_3c0 != 0) { + u8 local_410 = newIndTexStageNum(index); + param_0->mIndBlock->setIndTexStageNum(local_410); + for (u8 i = 0; i < local_410; i++) { + param_0->getIndBlock()->setIndTexMtx(i, newIndTexMtx(index, i)); + } + for (u8 i = 0; i < local_410; i++) { + param_0->getIndBlock()->setIndTexOrder(i, newIndTexOrder(index, i)); + } + for (u8 i = 0; i < local_410; i++) { + param_0->getIndBlock()->setIndTexCoordScale(i, newIndTexCoordScale(index, i)); + } + for (u8 i = 0; i < r28; i++) { + param_0->getTevBlock()->setIndTevStage(i, newIndTevStage(index, i)); + } + } + return param_0; +} +#else +J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int param_1, u32 param_2, + J2DResReference* param_3, J2DResReference* param_4, + JKRArchive* param_5) const { + // NONMATCHING +} +#endif + +/* ############################################################################################## */ + +/* 802F362C-802F36CC 2EDF6C 00A0+00 1/1 0/0 0/0 .text newMatColor__18J2DMaterialFactoryCFii */ +JUtility::TColor J2DMaterialFactory::newMatColor(int param_0, int param_1) const { + GXColor color = {0xff,0xff,0xff,0xff}; + JUtility::TColor local_20 = GXColor(color); + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x8[param_1] != 0xffff) { + return field_0x10[iVar2->field_0x8[param_1]]; + } + return local_20; +} + +/* 802F36CC-802F3704 2EE00C 0038+00 1/1 0/0 0/0 .text newColorChanNum__18J2DMaterialFactoryCFi */ +u8 J2DMaterialFactory::newColorChanNum(int param_0) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x2 != 0xff) { + return field_0x14[iVar2->field_0x2]; + } + return 0; +} + +/* 802F3704-802F3758 2EE044 0054+00 1/1 0/0 0/0 .text newColorChan__18J2DMaterialFactoryCFii */ +J2DColorChan J2DMaterialFactory::newColorChan(int param_0, int param_1) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0xc[param_1] != 0xffff) { + return J2DColorChan(field_0x18[iVar2->field_0xc[param_1]]); + } + return J2DColorChan(); +} + +/* 802F3758-802F3790 2EE098 0038+00 1/1 0/0 0/0 .text newTexGenNum__18J2DMaterialFactoryCFi */ +u32 J2DMaterialFactory::newTexGenNum(int param_0) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x3 != 0xff) { + return field_0x1c[iVar2->field_0x3]; + } + return 0; +} + +/* 802F3790-802F3804 2EE0D0 0074+00 1/1 0/0 0/0 .text newTexCoord__18J2DMaterialFactoryCFii */ +J2DTexCoord J2DMaterialFactory::newTexCoord(int param_0, int param_1) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x14[param_1] != 0xffff) { + return J2DTexCoord(field_0x20[iVar2->field_0x14[param_1]]); + } + return J2DTexCoord(); +} + +/* 802F3804-802F38E0 2EE144 00DC+00 1/1 0/0 0/0 .text newTexMtx__18J2DMaterialFactoryCFii + */ +J2DTexMtx* J2DMaterialFactory::newTexMtx(int param_0, int param_1) const { + J2DTexMtx* rv = NULL; + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x24[param_1] != 0xffff) { + rv = new J2DTexMtx(field_0x24[iVar2->field_0x24[param_1]]); + rv->calc(); + } + return rv; +} + +/* 802F38E0-802F3920 2EE220 0040+00 1/1 0/0 0/0 .text newCullMode__18J2DMaterialFactoryCFi */ +u8 J2DMaterialFactory::newCullMode(int param_0) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x1 != 0xff) { + return field_0x30[iVar2->field_0x1]; + } + return 0xff; +} + +/* 802F3920-802F3968 2EE260 0048+00 1/1 0/0 0/0 .text newTexNo__18J2DMaterialFactoryCFii + */ +u16 J2DMaterialFactory::newTexNo(int param_0, int param_1) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x38[param_1] != 0xffff) { + return field_0x28[iVar2->field_0x38[param_1]]; + } + return 0x1FFFF; +} + +/* 802F3968-802F39A8 2EE2A8 0040+00 1/1 0/0 0/0 .text newFontNo__18J2DMaterialFactoryCFi + */ +u16 J2DMaterialFactory::newFontNo(int param_0) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x48 != 0xffff) { + return field_0x2c[iVar2->field_0x48]; + } + return 0x1FFFF; +} + +/* 802F39A8-802F3A1C 2EE2E8 0074+00 1/1 0/0 0/0 .text newTevOrder__18J2DMaterialFactoryCFii */ +J2DTevOrder J2DMaterialFactory::newTevOrder(int param_0, int param_1) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x72[param_1] != 0xffff) { + return J2DTevOrder(field_0x34[iVar2->field_0x72[param_1]]); + } + return J2DTevOrder(); +} + +/* ############################################################################################## */ +/* 80456BB0-80456BB4 000050 0004+00 1/1 0/0 0/0 .sbss2 @2018 */ +SECTION_SBSS2 static GXColorS10 lit_2018; + +/* 802F3A1C-802F3AB4 2EE35C 0098+00 1/1 0/0 0/0 .text newTevColor__18J2DMaterialFactoryCFii */ +// J2DGXColorS10 init issues +#ifdef NONMATCHING +J2DGXColorS10 J2DMaterialFactory::newTevColor(int param_0, int param_1) const { + J2DGXColorS10 rv = J2DGXColorS10(GXColorS10()); + 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; +} +#else +J2DGXColorS10 J2DMaterialFactory::newTevColor(int param_0, int param_1) const { + // NONMATCHING +} +#endif + +/* ############################################################################################## */ + +/* 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); + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x4a[param_1] != 0xffff) { + return field_0x3c[iVar2->field_0x4a[param_1]]; + } + return local_20; +} + +/* 802F3B54-802F3B8C 2EE494 0038+00 1/1 0/0 0/0 .text newTevStageNum__18J2DMaterialFactoryCFi */ +u8 J2DMaterialFactory::newTevStageNum(int param_0) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x4 != 0xff) { + return field_0x40[iVar2->field_0x4]; + } + return 0xFF; +} + +/* 802F3B8C-802F3BEC 2EE4CC 0060+00 1/1 0/0 0/0 .text newTevStage__18J2DMaterialFactoryCFii */ +J2DTevStage J2DMaterialFactory::newTevStage(int param_0, int param_1) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x9a[param_1] != 0xffff) { + return J2DTevStage(field_0x44[iVar2->field_0x9a[param_1]]); + } + return J2DTevStage(); +} + +/* 802F3BEC-802F3C88 2EE52C 009C+00 1/1 0/0 0/0 .text + * newTevSwapModeTable__18J2DMaterialFactoryCFii */ +J2DTevSwapModeTable J2DMaterialFactory::newTevSwapModeTable(int param_0, int param_1) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0xda[param_1] != 0xffff) { + return J2DTevSwapModeTable(field_0x4c[iVar2->field_0xda[param_1]]); + } + return J2DTevSwapModeTable(j2dDefaultTevSwapModeTable); +} + +/* 802F3C88-802F3CB8 2EE5C8 0030+00 1/1 0/0 0/0 .text newIndTexStageNum__18J2DMaterialFactoryCFi + */ +u8 J2DMaterialFactory::newIndTexStageNum(int param_0) const { + if (field_0xc != NULL) { + if (field_0xc[param_0].field_0x0 == 1) { + return field_0xc[param_0].field_0x1; + } + } + return 0; +} + +/* 802F3CB8-802F3D20 2EE5F8 0068+00 1/1 0/0 0/0 .text newIndTexOrder__18J2DMaterialFactoryCFii */ +J2DIndTexOrder J2DMaterialFactory::newIndTexOrder(int param_0, int param_1) const { + J2DIndTexOrder rv; + if (field_0xc != NULL) { + if (field_0xc[param_0].field_0x0 == 1) { + return J2DIndTexOrder(field_0xc[param_0].field_0x4[param_1]); + } + } + return rv; +} + +/* 802F3D20-802F3E24 2EE660 0104+00 1/1 0/0 0/0 .text newIndTexMtx__18J2DMaterialFactoryCFii */ +J2DIndTexMtx J2DMaterialFactory::newIndTexMtx(int param_0, int param_1) const { + J2DIndTexMtx rv; + if (field_0xc != NULL) { + if (field_0xc[param_0].field_0x0 == 1) { + return J2DIndTexMtx(field_0xc[param_0].field_0xc[param_1]); + } + } + return rv; +} + +/* 802F3E24-802F3F78 2EE764 0154+00 1/1 0/0 0/0 .text newIndTevStage__18J2DMaterialFactoryCFii */ +J2DIndTevStage J2DMaterialFactory::newIndTevStage(int param_0, int param_1) const { + J2DIndTevStage rv; + if (field_0xc != NULL) { + if (field_0xc[param_0].field_0x0 == 1) { + return J2DIndTevStage(field_0xc[param_0].field_0x68[param_1]); + } + } + return rv; +} + +/* 802F3F78-802F3FE0 2EE8B8 0068+00 1/1 0/0 0/0 .text + * newIndTexCoordScale__18J2DMaterialFactoryCFii */ +J2DIndTexCoordScale J2DMaterialFactory::newIndTexCoordScale(int param_0, int param_1) const { + J2DIndTexCoordScale rv; + if (field_0xc != NULL) { + if (field_0xc[param_0].field_0x0 == 1) { + return J2DIndTexCoordScale(field_0xc[param_0].field_0x60[param_1]); + } + } + return rv; +} + +/* 802F3FE0-802F405C 2EE920 007C+00 1/1 0/0 0/0 .text newAlphaComp__18J2DMaterialFactoryCFi */ +J2DAlphaComp J2DMaterialFactory::newAlphaComp(int param_0) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0xe2 != 0xffff) { + return J2DAlphaComp(field_0x50[iVar2->field_0xe2]); + } + return J2DAlphaComp(); +} + +/* 802F405C-802F40D8 2EE99C 007C+00 1/1 0/0 0/0 .text newBlend__18J2DMaterialFactoryCFi + */ +J2DBlend J2DMaterialFactory::newBlend(int param_0) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0xe4 != 0xffff) { + return J2DBlend(field_0x54[iVar2->field_0xe4]); + } + return J2DBlend(); +} + +/* 802F40D8-802F4110 2EEA18 0038+00 1/1 0/0 0/0 .text newDither__18J2DMaterialFactoryCFi + */ +u8 J2DMaterialFactory::newDither(int param_0) const { + J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; + if (iVar2->field_0x5 != 0xff) { + return field_0x58[iVar2->field_0x5]; + } + return 0; +} + +/* 802F4110-802F4170 2EEA50 0060+00 1/1 0/0 0/0 .text __ct__11J2DTevStageFRC15J2DTevStageInfo */ +J2DTevStage::J2DTevStage(J2DTevStageInfo const& param_0) { + setTevStageInfo(param_0); + setTevSwapModeInfo(j2dDefaultTevSwapMode); +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DOrthoGraph.cpp b/src/JSystem/J2DGraph/J2DOrthoGraph.cpp new file mode 100644 index 0000000000..7d3bef94cd --- /dev/null +++ b/src/JSystem/J2DGraph/J2DOrthoGraph.cpp @@ -0,0 +1,93 @@ +#include "JSystem/J2DGraph/J2DOrthoGraph.h" +#include "dolphin/gx.h" + +/* 802E9670-802E96D0 2E3FB0 0060+00 3/3 1/1 0/0 .text __ct__13J2DOrthoGraphFv */ +J2DOrthoGraph::J2DOrthoGraph() : J2DGrafContext(0, 0, 0, 0) { + this->setLookat(); +} + +/* 802E96D0-802E97B4 2E4010 00E4+00 0/0 7/7 0/0 .text __ct__13J2DOrthoGraphFffffff */ +J2DOrthoGraph::J2DOrthoGraph(f32 x, f32 y, f32 width, f32 height, f32 far, f32 near) + : J2DGrafContext(x, y, width, height) { + mOrtho = JGeometry::TBox2<f32>(0, 0, width, height); + mNear = -near; + mFar = -far; + this->setLookat(); +} + +/* 802E97B4-802E980C 2E40F4 0058+00 1/0 6/6 0/0 .text setPort__13J2DOrthoGraphFv */ +void J2DOrthoGraph::setPort() { + this->J2DGrafContext::setPort(); + C_MTXOrtho(mMtx44, mOrtho.i.y, mOrtho.f.y, mOrtho.i.x, mOrtho.f.x, mNear, mFar); + GXSetProjection(mMtx44, GX_ORTHOGRAPHIC); +} + +/* 802E980C-802E9840 2E414C 0034+00 0/0 5/5 0/0 .text + * setOrtho__13J2DOrthoGraphFRCQ29JGeometry8TBox2<f>ff */ +void J2DOrthoGraph::setOrtho(JGeometry::TBox2<f32> const& bounds, f32 far, f32 near) { + mOrtho = bounds; + mNear = -near; + mFar = -far; +} + +/* 802E9840-802E987C 2E4180 003C+00 1/0 0/0 0/0 .text setLookat__13J2DOrthoGraphFv */ +void J2DOrthoGraph::setLookat() { + MTXIdentity(mPosMtx); + GXLoadPosMtxImm(mPosMtx, 0); +} + +/* 802E987C-802E9998 2E41BC 011C+00 0/0 1/1 0/0 .text + * scissorBounds__13J2DOrthoGraphFPQ29JGeometry8TBox2<f>PCQ29JGeometry8TBox2<f> */ +void J2DOrthoGraph::scissorBounds(JGeometry::TBox2<f32>* param_0, + JGeometry::TBox2<f32> const* param_1) { + f32 widthPower = this->getWidthPower(); + f32 heightPower = this->getHeightPower(); + f32 ix = mBounds.i.x >= 0 ? mBounds.i.x : 0; + f32 iy = mBounds.i.y >= 0 ? mBounds.i.y : 0; + f32 f0 = ix + widthPower * (param_1->i.x - mOrtho.i.x); + f32 f2 = ix + widthPower * (param_1->f.x - mOrtho.i.x); + f32 f1 = iy + heightPower * (param_1->i.y - mOrtho.i.y); + f32 f3 = iy + heightPower * (param_1->f.y - mOrtho.i.y); + param_0->set(f0, f1, f2, f3); + param_0->intersect(mScissorBounds); +} + +/* 802E9998-802E9AC4 2E42D8 012C+00 0/0 6/6 0/0 .text J2DDrawLine__FffffQ28JUtility6TColori */ +void J2DDrawLine(f32 x1, f32 y1, f32 x2, f32 y2, JUtility::TColor color, + int line_width) { + J2DOrthoGraph oGrph; + oGrph.setLineWidth(line_width); + oGrph.setColor(color); + oGrph.moveTo(x1, y1); + oGrph.lineTo(x2, y2); +} + +/* 802E9AC4-802E9B0C 2E4404 0048+00 0/0 10/10 0/0 .text J2DFillBox__FffffQ28JUtility6TColor */ +void J2DFillBox(f32 x, f32 y, f32 width, f32 height, JUtility::TColor color) { + J2DFillBox(JGeometry::TBox2<f32>(x, y, x + width, y + height), + color); +} + +/* 802E9B0C-802E9B9C 2E444C 0090+00 1/1 0/0 0/0 .text + * J2DFillBox__FRCQ29JGeometry8TBox2<f>Q28JUtility6TColor */ +void J2DFillBox(JGeometry::TBox2<f32> const& box, JUtility::TColor color) { + J2DOrthoGraph oGrph; + oGrph.setColor(color); + oGrph.fillBox(box); +} + +/* 802E9B9C-802E9BE8 2E44DC 004C+00 0/0 5/5 0/0 .text J2DDrawFrame__FffffQ28JUtility6TColorUc */ +void J2DDrawFrame(f32 x, f32 y, f32 width, f32 height, JUtility::TColor color, + u8 line_width) { + J2DDrawFrame(JGeometry::TBox2<f32>(x, y, x + width, y + height), + color, line_width); +} + +/* 802E9BE8-802E9C88 2E4528 00A0+00 1/1 0/0 0/0 .text + * J2DDrawFrame__FRCQ29JGeometry8TBox2<f>Q28JUtility6TColorUc */ +void J2DDrawFrame(JGeometry::TBox2<f32> const& box, JUtility::TColor color, u8 line_width) { + J2DOrthoGraph oGrph; + oGrph.setColor(color); + oGrph.setLineWidth(line_width); + oGrph.drawFrame(box); +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DPane.cpp b/src/JSystem/J2DGraph/J2DPane.cpp new file mode 100644 index 0000000000..874d04fcff --- /dev/null +++ b/src/JSystem/J2DGraph/J2DPane.cpp @@ -0,0 +1,971 @@ +#include "JSystem/J2DGraph/J2DPane.h" +#include "JSystem/J2DGraph/J2DAnimation.h" +#include "JSystem/J2DGraph/J2DOrthoGraph.h" +#include "JSystem/J2DGraph/J2DScreen.h" +#include "JSystem/JSupport/JSURandomInputStream.h" +#include "JSystem/JUtility/JUTResource.h" + +/* 802F5BF8-802F5CB8 2F0538 00C0+00 0/0 10/10 0/0 .text __ct__7J2DPaneFv */ +J2DPane::J2DPane() : mBounds(), mGlobalBounds(), mClipRect(), mPaneTree(this) { + mTransform = NULL; + mKind = 'PAN1'; + mVisible = true; + mInfoTag = 0; + mUserInfoTag = 0; + mBounds.set(0, 0, 0, 0); + initiate(); + changeUseTrans(NULL); + calcMtx(); +} + +/* 802F5CB8-802F5D40 2F05F8 0088+00 3/3 0/0 0/0 .text initiate__7J2DPaneFv */ +void J2DPane::initiate() { + field_0x4 = -1; + mRotateOffsetY = mRotateOffsetX = mRotateZ = mRotateY = mRotateX = 0; + mBasePosition = 0; + mRotAxis = ROTATE_Z; + mScaleY = mScaleX = 1; + mCullMode = GX_CULL_NONE; + mAlpha = 255; + mIsInfluencedAlpha = true; + mColorAlpha = 255; + mConnected = false; + + calcMtx(); +} + +/* 802F5D40-802F5DD0 2F0680 0090+00 0/0 1/1 0/0 .text + * __ct__7J2DPaneFP7J2DPanebUxRCQ29JGeometry8TBox2<f> */ +J2DPane::J2DPane(J2DPane* p_pane, bool visible, u64 tag, JGeometry::TBox2<f32> const& bounds) + : mBounds(), mGlobalBounds(), mClipRect(), mPaneTree(this) { + mTransform = NULL; + initialize(p_pane, visible, tag, bounds); +} + +/* 802F5DD0-802F5E88 2F0710 00B8+00 1/1 0/0 0/0 .text + * initialize__7J2DPaneFP7J2DPanebUxRCQ29JGeometry8TBox2<f> */ +void J2DPane::initialize(J2DPane* p_pane, bool visible, u64 infoTag, + JGeometry::TBox2<f32> const& bounds) { + mKind = 'PAN1'; + mVisible = visible; + mInfoTag = infoTag; + mUserInfoTag = 0; + mBounds.set(bounds); + if (p_pane != NULL) { + p_pane->mPaneTree.appendChild(&mPaneTree); + } + + initiate(); + changeUseTrans(p_pane); + calcMtx(); +} + +/* 802F5E88-802F5F08 2F07C8 0080+00 0/0 3/3 0/0 .text __ct__7J2DPaneFUxRCQ29JGeometry8TBox2<f> */ +J2DPane::J2DPane(u64 infoTag, JGeometry::TBox2<f32> const& bounds) + : mBounds(), mGlobalBounds(), mClipRect(), mPaneTree(this) { + mTransform = NULL; + initialize(infoTag, bounds); +} + +/* 802F5F08-802F5F9C 2F0848 0094+00 1/1 0/0 0/0 .text + * initialize__7J2DPaneFUxRCQ29JGeometry8TBox2<f> */ +void J2DPane::initialize(u64 tag, const JGeometry::TBox2<f32>& bounds) { + mKind = 'PAN1'; + mVisible = true; + mInfoTag = tag; + mUserInfoTag = 0; + mBounds.set(bounds); + initiate(); + changeUseTrans(NULL); + calcMtx(); +} + +/* 802F5F9C-802F60C4 2F08DC 0128+00 0/0 1/1 0/0 .text + * __ct__7J2DPaneFP7J2DPaneP20JSURandomInputStreamUc */ +J2DPane::J2DPane(J2DPane* p_pane, JSURandomInputStream* p_stream, u8 isEx) : mPaneTree(this) { + mTransform = NULL; + if (!isEx) { + s32 position = p_stream->getPosition(); + + J2DPaneHeader header; + p_stream->read(&header, sizeof(header)); + mKind = header.mKind; + position += header.mSize; + makePaneStream(p_pane, p_stream); + p_stream->seek(position, JSUStreamSeekFrom_SET); + } else { + s32 position = p_stream->getPosition(); + + J2DPaneHeader header; + p_stream->peek(&header, sizeof(header)); + mKind = header.mKind; + position += header.mSize; + makePaneExStream(p_pane, p_stream); + p_stream->seek(position, JSUStreamSeekFrom_SET); + } +} + +/* 802F60C4-802F63F8 2F0A04 0334+00 1/1 3/3 0/0 .text + * makePaneStream__7J2DPaneFP7J2DPaneP20JSURandomInputStream */ +void J2DPane::makePaneStream(J2DPane* p_pane, JSURandomInputStream* p_stream) { + u8 unk; + p_stream->read(&unk, 1); + p_stream->read(&mVisible, 1); + p_stream->skip(2); + + mInfoTag = p_stream->read32b(); + + f32 x0 = p_stream->readS16(); + f32 y0 = p_stream->readS16(); + f32 x1 = x0 + p_stream->readS16(); + f32 y1 = y0 + p_stream->readS16(); + mBounds.set(x0, y0, x1, y1); + + unk -= 6; + mRotateX = 0; + mRotateY = 0; + mRotateZ = 0; + if (unk != 0) { + mRotateZ = p_stream->readU16(); + unk--; + } + + if (unk != 0) { + mBasePosition = p_stream->readU8(); + unk--; + } else { + mBasePosition = 0; + } + mRotAxis = ROTATE_Z; + + mAlpha = 255; + if (unk != 0) { + mAlpha = p_stream->readU8(); + unk--; + } + + mIsInfluencedAlpha = true; + if (unk != 0) { + mIsInfluencedAlpha = p_stream->readU8(); + unk--; + } + + p_stream->align(4); + if (p_pane != NULL) { + p_pane->mPaneTree.appendChild(&mPaneTree); + } + + mCullMode = GX_CULL_NONE; + mColorAlpha = 255; + mConnected = false; + field_0x4 = 0xFFFF; + mScaleX = 1; + mScaleY = 1; + mUserInfoTag = 0; + changeUseTrans(p_pane); + calcMtx(); +} + +/* 802F63F8-802F658C 2F0D38 0194+00 4/4 0/0 0/0 .text changeUseTrans__7J2DPaneFP7J2DPane + */ +void J2DPane::changeUseTrans(J2DPane* p_pane) { + f32 xOffset = 0; + f32 yOffset = 0; + if (mBasePosition % 3 == 1) { + xOffset = mBounds.getWidth() / 2; + } else if (mBasePosition % 3 == 2) { + xOffset = mBounds.getWidth(); + } + + if (mBasePosition / 3 == 1) { + yOffset = mBounds.getHeight() / 2; + } else if (mBasePosition / 3 == 2) { + yOffset = mBounds.getHeight(); + } + + mTranslateX = mBounds.i.x + xOffset; + mTranslateY = mBounds.i.y + yOffset; + + mRotateOffsetX = xOffset; + mRotateOffsetY = yOffset; + + f32 addX = -mTranslateX; + f32 addY = -mTranslateY; + mBounds.addPos(addX, addY); + + if (p_pane != NULL) { + u8 otherBasePos = p_pane->mBasePosition; + f32 width = p_pane->getWidth(); + f32 height = p_pane->getHeight(); + + if (otherBasePos % 3 == 1) { + mTranslateX -= width / 2; + } else if (otherBasePos % 3 == 2) { + mTranslateX -= width; + } + + if (otherBasePos / 3 == 1) { + mTranslateY -= height / 2; + } else if (otherBasePos / 3 == 2) { + mTranslateY -= height; + } + } +} + +/* 802F658C-802F666C 2F0ECC 00E0+00 1/0 4/4 0/0 .text __dt__7J2DPaneFv */ +J2DPane::~J2DPane() { + JSUTreeIterator<J2DPane> iterator; + for (iterator = mPaneTree.getFirstChild(); iterator != mPaneTree.getEndChild();) { + J2DPane* child = (iterator++).getObject(); + delete child; + } +} + +/* 802F666C-802F6714 2F0FAC 00A8+00 0/0 2/2 0/0 .text appendChild__7J2DPaneFP7J2DPane */ +bool J2DPane::appendChild(J2DPane* p_child) { + if (p_child == NULL) + return false; + + const J2DPane* parent = p_child->getParentPane(); + bool result = mPaneTree.appendChild(&p_child->mPaneTree); + + if (result && parent == NULL) { + p_child->add(mBounds.i.x, mBounds.i.y); + p_child->calcMtx(); + } + + return result; +} + +/* 802F6714-802F67E0 2F1054 00CC+00 0/0 1/1 0/0 .text insertChild__7J2DPaneFP7J2DPaneP7J2DPane */ +bool J2DPane::insertChild(J2DPane* p_prev, J2DPane* p_child) { + if (p_child == NULL) + return false; + + const J2DPane* parent = p_child->getParentPane(); + + bool result = + mPaneTree.insertChild(p_prev != NULL ? &p_prev->mPaneTree : NULL, &p_child->mPaneTree); + + if (result && parent == NULL) { + p_child->add(mBounds.i.x, mBounds.i.y); + p_child->calcMtx(); + } + + return result; +} + +/* 802F67E0-802F6D18 2F1120 0538+00 0/0 1/1 0/0 .text draw__7J2DPaneFffPC14J2DGrafContextbb */ +void J2DPane::draw(f32 x, f32 y, J2DGrafContext const* p_grafCtx, bool isOrthoGraf, bool param_4) { + bool unkBool = param_4 && mVisible; + if (p_grafCtx->getGrafType() != 1) { + isOrthoGraf = false; + } + + JSUTree<J2DPane>* parentTree = mPaneTree.getParent(); + J2DPane* parent = NULL; + if (parentTree != NULL) { + parent = parentTree->getObject(); + } + + if (mBounds.isValid()) { + mGlobalBounds = mBounds; + + f32 addX = mTranslateX; + f32 addY = mTranslateY; + mGlobalBounds.addPos(addX, addY); + + if (unkBool) { + mClipRect = mBounds; + rewriteAlpha(); + } + + if (parent != NULL) { + f32 width = parent->mGlobalBounds.i.x - parent->mBounds.i.x; + f32 height = parent->mGlobalBounds.i.y - parent->mBounds.i.y; + mGlobalBounds.addPos(width, height); + MTXConcat(parent->mGlobalMtx, mPositionMtx, mGlobalMtx); + + if (unkBool) { + if (isOrthoGraf) { + mClipRect = mGlobalBounds; + mClipRect.intersect(parent->mClipRect); + } + + mColorAlpha = mAlpha; + if (mIsInfluencedAlpha) { + mColorAlpha = (mAlpha * parent->mColorAlpha) / 255; + } + } + } else { + mGlobalBounds.addPos(x, y); + makeMatrix(mTranslateX + x, mTranslateY + y); + MTXCopy(mPositionMtx, mGlobalMtx); + mClipRect = mGlobalBounds; + mColorAlpha = mAlpha; + } + + JGeometry::TBox2<f32> scissorBounds(0, 0, 0, 0); + if (unkBool && isOrthoGraf) { + ((J2DOrthoGraph*)p_grafCtx)->scissorBounds(&scissorBounds, &mClipRect); + } + + if (unkBool && (mClipRect.isValid() || !isOrthoGraf)) { + J2DGrafContext tmpGraf(*p_grafCtx); + if (isOrthoGraf) { + tmpGraf.scissor(scissorBounds); + tmpGraf.setScissor(); + } + GXSetCullMode((GXCullMode)mCullMode); + drawSelf(x, y, &tmpGraf.mPosMtx); + } + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + iter.getObject()->draw(0, 0, p_grafCtx, isOrthoGraf, unkBool); + } + } +} + +/* 802F6D18-802F6F60 2F1658 0248+00 2/2 4/4 0/0 .text place__7J2DPaneFRCQ29JGeometry8TBox2<f> */ +void J2DPane::place(JGeometry::TBox2<f32> const& box) { + JGeometry::TBox2<f32> tmpBox; + + if (mBounds.i.x == 0) { + tmpBox.i.x = 0; + tmpBox.f.x = box.getWidth(); + mTranslateX = box.i.x; + } else if (mBounds.f.x == 0) { + tmpBox.i.x = -box.getWidth(); + tmpBox.f.x = 0; + mTranslateX = box.f.x; + } else { + tmpBox.i.x = -(box.getWidth() / 2); + tmpBox.f.x = box.getWidth() / 2; + mTranslateX = (box.i.x + box.f.x) / 2; + } + + if (mBounds.i.y == 0) { + tmpBox.i.y = 0; + tmpBox.f.y = box.getHeight(); + mTranslateY = box.i.y; + } else if (mBounds.f.y == 0) { + tmpBox.i.y = -box.getHeight(); + tmpBox.f.y = 0; + mTranslateY = box.f.y; + } else { + tmpBox.i.y = -(box.getHeight() / 2); + tmpBox.f.y = box.getHeight() / 2; + mTranslateY = (box.i.y + box.f.y) / 2; + } + + f32 xOff = tmpBox.i.x - mBounds.i.x; + f32 yOff = tmpBox.i.y - mBounds.i.y; + for (J2DPane* child = getFirstChildPane(); child != NULL; child = child->getNextChildPane()) { + child->mTranslateX += xOff; + child->mTranslateY += yOff; + if (xOff != 0 || yOff != 0) { + child->calcMtx(); + } + } + mBounds = tmpBox; + + J2DPane* parent = getParentPane(); + if (parent != NULL) { + mTranslateX += parent->mBounds.i.x; + mTranslateY += parent->mBounds.i.y; + } + calcMtx(); +} + +/* 802F6F60-802F6FB4 2F18A0 0054+00 1/0 7/0 0/0 .text move__7J2DPaneFff */ +void J2DPane::move(f32 x, f32 y) { + f32 width = getWidth(); + f32 height = getHeight(); + place(JGeometry::TBox2<f32>(x, y, x + width, y + height)); +} + +/* 802F6FB4-802F6FF8 2F18F4 0044+00 1/0 7/0 0/0 .text add__7J2DPaneFff */ +void J2DPane::add(f32 x, f32 y) { + mTranslateX += x; + mTranslateY += y; + calcMtx(); +} + +/* 802F6FF8-802F7100 2F1938 0108+00 1/0 5/2 0/0 .text resize__7J2DPaneFff */ +void J2DPane::resize(f32 x, f32 y) { + JGeometry::TBox2<f32> box = mBounds; + + f32 tX = mTranslateX; + f32 tY = mTranslateY; + + box.addPos(tX, tY); + + const J2DPane* parent = getParentPane(); + if (parent != NULL) { + f32 xAdd = -parent->mBounds.i.x; + f32 yAdd = -parent->mBounds.i.y; + box.addPos(xAdd, yAdd); + } + + box.f.x = box.i.x + x; + box.f.y = box.i.y + y; + place(box); +} + +/* ############################################################################################## */ +/* 804349B0-804349C0 0616D0 0010+00 2/2 0/0 0/0 .bss static_mBounds__7J2DPane */ +JGeometry::TBox2<f32> J2DPane::static_mBounds(0, 0, 0, 0); + +/* 802F7100-802F71DC 2F1A40 00DC+00 0/0 25/25 1/1 .text getBounds__7J2DPaneFv */ +JGeometry::TBox2<f32>& J2DPane::getBounds() { + static_mBounds = mBounds; + + f32 tX = mTranslateX; + f32 tY = mTranslateY; + + static_mBounds.addPos(tX, tY); + + const J2DPane* parent = getParentPane(); + if (parent != NULL) { + f32 xAdd = -parent->mBounds.i.x; + f32 yAdd = -parent->mBounds.i.y; + static_mBounds.addPos(xAdd, yAdd); + } + + return static_mBounds; +} + +/* 802F71DC-802F720C 2F1B1C 0030+00 0/0 12/12 0/0 .text rotate__7J2DPaneFff13J2DRotateAxisf */ +void J2DPane::rotate(f32 offsetX, f32 offsetY, J2DRotateAxis axis, f32 angle) { + mRotateOffsetX = offsetX; + mRotateOffsetY = offsetY; + mRotAxis = axis; + rotate(angle); +} + +/* 802F720C-802F7264 2F1B4C 0058+00 1/1 0/0 0/0 .text rotate__7J2DPaneFf */ +void J2DPane::rotate(f32 angle) { + if (mRotAxis == ROTATE_X) { + mRotateX = angle; + } else if (mRotAxis == ROTATE_Y) { + mRotateY = angle; + } else { + mRotateZ = angle; + } + + calcMtx(); +} + +/* 802F7264-802F72E0 2F1BA4 007C+00 0/0 2/2 0/0 .text clip__7J2DPaneFRCQ29JGeometry8TBox2<f> */ +void J2DPane::clip(JGeometry::TBox2<f32> const& bounds) { + JGeometry::TBox2<f32> boxA(bounds); + JGeometry::TBox2<f32> boxB(mGlobalBounds); + boxA.addPos(boxB.i); + mClipRect.intersect(boxA); +} + +/* 802F72E0-802F7388 2F1C20 00A8+00 1/0 7/1 0/0 .text search__7J2DPaneFUx */ +J2DPane* J2DPane::search(u64 tag) { + if (tag == mInfoTag) { + return this; + } + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + if (J2DPane* result = iter.getObject()->search(tag)) { + return result; + } + } + return NULL; +} + +/* 802F7388-802F7430 2F1CC8 00A8+00 1/0 7/1 0/0 .text searchUserInfo__7J2DPaneFUx */ +J2DPane* J2DPane::searchUserInfo(u64 tag) { + if (tag == mUserInfoTag) { + return this; + } + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + if (J2DPane* result = iter.getObject()->searchUserInfo(tag)) { + return result; + } + } + return NULL; +} + +/* 802F7430-802F74B8 2F1D70 0088+00 1/0 7/7 0/0 .text isUsed__7J2DPaneFPC7ResTIMG */ +bool J2DPane::isUsed(const ResTIMG* p_timg) { + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + if (iter.getObject()->isUsed(p_timg)) + return true; + } + return false; +} + +/* 802F74B8-802F7540 2F1DF8 0088+00 1/0 7/7 0/0 .text isUsed__7J2DPaneFPC7ResFONT */ +bool J2DPane::isUsed(const ResFONT* p_font) { + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + if (iter.getObject()->isUsed(p_font)) + return true; + } + return false; +} + +/* 802F7540-802F7680 2F1E80 0140+00 1/0 7/0 0/0 .text makeMatrix__7J2DPaneFffff */ +void J2DPane::makeMatrix(f32 param_0, f32 param_1, f32 param_2, f32 param_3) { + f32 tmpX = mRotateOffsetX - param_2; + f32 tmpY = mRotateOffsetY - param_3; + Mtx rotX, rotY, rotZ, rotMtx, mtx, tmp; + MTXTrans(mtx, -tmpX, -tmpY, 0); + MTXRotRad(rotX, 'x', DEG_TO_RAD(mRotateX)); + MTXRotRad(rotY, 'y', DEG_TO_RAD(mRotateY)); + MTXRotRad(rotZ, 'z', DEG_TO_RAD(-mRotateZ)); + MTXConcat(rotZ, rotX, tmp); + MTXConcat(rotY, tmp, rotMtx); + MTXScaleApply(mtx, mPositionMtx, mScaleX, mScaleY, 1); + MTXConcat(rotMtx, mPositionMtx, tmp); + MTXTransApply(tmp, mPositionMtx, param_0 + tmpX, param_1 + tmpY, 0); +} + +/* 802F7680-802F76F8 2F1FC0 0078+00 1/0 7/3 0/0 .text setCullBack__7J2DPaneF11_GXCullMode + */ +void J2DPane::setCullBack(GXCullMode mode) { + mCullMode = mode; + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + iter.getObject()->setCullBack(mode); + } +} + +/* 802F76F8-802F77D0 2F2038 00D8+00 0/0 8/8 0/0 .text setBasePosition__7J2DPaneF15J2DBasePosition + */ +void J2DPane::setBasePosition(J2DBasePosition position) { + mBasePosition = position; + mRotAxis = ROTATE_Z; + + mRotateOffsetX = 0; + + if (position % 3 == 1) { + f32 width = getWidth(); + mRotateOffsetX = width / 2; + } else if (position % 3 == 2) { + f32 width = getWidth(); + mRotateOffsetX = width; + } + + mRotateOffsetY = 0; + if (position / 3 == 1) { + f32 height = getHeight(); + mRotateOffsetY = height / 2; + } else if (position / 3 == 2) { + f32 height = getHeight(); + mRotateOffsetY = height; + } + + calcMtx(); +} + +/* 802F77D0-802F79A8 2F2110 01D8+00 0/0 1/1 0/0 .text setInfluencedAlpha__7J2DPaneFbb */ +void J2DPane::setInfluencedAlpha(bool influencedAlpha, bool param_1) { + if (param_1 && mIsInfluencedAlpha != influencedAlpha) { + J2DPane* parent = getParentPane(); + u8 alpha = 255; + + for (; parent != NULL; parent = parent->getParentPane()) { + if (parent->getAlpha() == 0) { + alpha = 0; + break; + } + alpha = (((f32)alpha) * parent->getAlpha() / 255); + if (!parent->mIsInfluencedAlpha) { + break; + } + } + + if (influencedAlpha) { + if (alpha == 0) { + setAlpha(0); + } else { + f32 fAlpha = ((f32)mAlpha) / alpha * 255; + + u8 alpha; + if (fAlpha > 255) { + alpha = 255; + } else { + alpha = fAlpha; + } + setAlpha(alpha); + } + } else { + setAlpha((f32)(alpha * mAlpha) / 255); + } + } + + mIsInfluencedAlpha = influencedAlpha; +} + +/* 802F79A8-802F7A8C 2F22E8 00E4+00 0/0 3/3 0/0 .text getGlbVtx__7J2DPaneCFUc */ +Vec J2DPane::getGlbVtx(u8 param_0) const { + Vec out; + if (param_0 >= 4) { + out.x = 0; + out.y = 0; + out.z = 0; + return out; + } else { + f32 x, y; + if (param_0 & 1) { + x = mBounds.f.x; + } else { + x = mBounds.i.x; + } + + if (param_0 & 2) { + y = mBounds.f.y; + } else { + y = mBounds.i.y; + } + + out.x = x * mGlobalMtx[0][0] + y * mGlobalMtx[0][1] + mGlobalMtx[0][3]; + out.y = x * mGlobalMtx[1][0] + y * mGlobalMtx[1][1] + mGlobalMtx[1][3]; + out.z = x * mGlobalMtx[2][0] + y * mGlobalMtx[2][1] + mGlobalMtx[2][3]; + return out; + } +} + +/* 802F7A8C-802F7AC4 2F23CC 0038+00 1/1 15/15 0/0 .text getFirstChildPane__7J2DPaneFv */ +J2DPane* J2DPane::getFirstChildPane() { + if (!getFirstChild()) + return NULL; + + return getFirstChild()->getObject(); +} + +/* 802F7AC4-802F7AFC 2F2404 0038+00 1/1 8/8 0/0 .text getNextChildPane__7J2DPaneFv */ +J2DPane* J2DPane::getNextChildPane() { + if (getPaneTree()->getNextChild() == NULL) + return NULL; + + return getPaneTree()->getNextChild()->getObject(); +} + +/* 802F7AFC-802F7B18 2F243C 001C+00 6/6 11/11 0/0 .text getParentPane__7J2DPaneFv */ +J2DPane* J2DPane::getParentPane() { + if (getPaneTree()->getParent() == NULL) + return NULL; + + return getPaneTree()->getParent()->getObject(); +} + +/* name unknown */ +struct J2DPaneInfo { + /* 0x00 */ u32 mKind; + /* 0x04 */ u32 mSize; + /* 0x08 */ u16 field_0x8; + /* 0x0A */ u16 field_0xa; + /* 0x0B */ u8 mVisible; + /* 0x0C */ u8 mBasePosition; + /* 0x10 */ u64 mInfoTag; + /* 0x18 */ u64 mUserInfoTag; + /* 0x20 */ f32 mRotOffsetX; + /* 0x24 */ f32 mRotOffsetY; + /* 0x28 */ f32 mScaleX; + /* 0x2C */ f32 mScaleY; + /* 0x30 */ f32 mRotateX; + /* 0x34 */ f32 mRotateY; + /* 0x38 */ f32 mRotateZ; + /* 0x3C */ f32 mTranslateX; + /* 0x40 */ f32 mTranslateY; +}; // Size: 0x48 + +/* 802F7B18-802F7D00 2F2458 01E8+00 1/1 6/6 0/0 .text + * makePaneExStream__7J2DPaneFP7J2DPaneP20JSURandomInputStream */ +void J2DPane::makePaneExStream(J2DPane* p_parent, JSURandomInputStream* p_stream) { + p_stream->getPosition(); + + J2DPaneInfo data; + p_stream->read(&data, sizeof(data)); + field_0x4 = data.field_0xa; + mVisible = !!data.mVisible; + mInfoTag = data.mInfoTag; + mUserInfoTag = data.mUserInfoTag; + mScaleX = data.mScaleX; + mScaleY = data.mScaleY; + mRotateX = data.mRotateX; + mRotateY = data.mRotateY; + mRotateZ = data.mRotateZ; + mTranslateX = data.mTranslateX; + mTranslateY = data.mTranslateY; + mRotAxis = ROTATE_Z; + + if (data.mBasePosition % 3 == 0) { + mRotateOffsetX = 0; + } else if (data.mBasePosition % 3 == 1) { + mRotateOffsetX = data.mRotOffsetX / 2; + } else { + mRotateOffsetX = data.mRotOffsetX; + } + + if (data.mBasePosition / 3 == 0) { + mRotateOffsetY = 0; + } else if (data.mBasePosition / 3 == 1) { + mRotateOffsetY = data.mRotOffsetY / 2; + } else { + mRotateOffsetY = data.mRotOffsetY; + } + + mBounds.set(-mRotateOffsetX, -mRotateOffsetY, data.mRotOffsetX - mRotateOffsetX, + data.mRotOffsetY - mRotateOffsetY); + mBasePosition = data.mBasePosition; + + mAlpha = 255; + mIsInfluencedAlpha = false; + + if (p_parent != NULL) { + p_parent->mPaneTree.appendChild(&mPaneTree); + } + + mCullMode = GX_CULL_NONE; + mColorAlpha = 255; + mConnected = false; + calcMtx(); +} + +/* 802F7D00-802F7DB8 2F2640 00B8+00 0/0 1/1 0/0 .text J2DCast_F32_to_S16__7J2DPaneFfUc */ +s16 J2DPane::J2DCast_F32_to_S16(f32 value, u8 arg2) { + if (arg2 >= 0xF) { + return 0; + } else { + f32 tmpF; + tmpF = value; + if (value < 0) { + tmpF = -value; + } + int tmp = tmpF * (1 << arg2); + if (tmp >= 0x8000) { + if (value < 0) { + return 0x8000; + } else { + return 0x7FFF; + } + } else if (value < 0) { + return ~tmp + 1; + } else { + return tmp; + } + } +} + +/* 802F7DB8-802F7EF4 2F26F8 013C+00 0/0 3/3 0/0 .text + * getPointer__7J2DPaneFP20JSURandomInputStreamUlP10JKRArchive */ +void* J2DPane::getPointer(JSURandomInputStream* p_stream, u32 param_1, JKRArchive* p_archive) { + JUTResReference resRef; + + void* pointer; + if (p_archive == NULL) { + if (J2DScreen::getDataManage() == NULL) { + pointer = resRef.getResource(p_stream, param_1, NULL); + } else { + s32 prevPos = p_stream->getPosition(); + pointer = resRef.getResource(p_stream, param_1, NULL); + if (pointer == NULL) { + p_stream->seek(prevPos, JSUStreamSeekFrom_SET); + pointer = J2DScreen::getDataManage()->get(p_stream); + } + } + } else { + s32 prevPos = p_stream->getPosition(); + pointer = resRef.getResource(p_stream, param_1, p_archive); + if (pointer == NULL) { + p_stream->seek(prevPos, JSUStreamSeekFrom_SET); + pointer = resRef.getResource(p_stream, param_1, NULL); + } + + if (pointer == NULL) { + if (J2DScreen::getDataManage() != NULL) { + p_stream->seek(prevPos, JSUStreamSeekFrom_SET); + pointer = J2DScreen::getDataManage()->get(p_stream); + } + } + } + return pointer; +} + +/* 802F7EF4-802F7FC4 2F2834 00D0+00 2/0 7/4 0/0 .text setAnimation__7J2DPaneFP10J2DAnmBase */ +void J2DPane::setAnimation(J2DAnmBase* p_anm) { + if (p_anm != NULL) { + switch (p_anm->getKind()) { + default: + break; + case KIND_TRANSFORM: + setAnimation(static_cast<J2DAnmTransform*>(p_anm)); + break; + case KIND_COLOR: + setAnimation(static_cast<J2DAnmColor*>(p_anm)); + break; + case KIND_VTX_COLOR: + setAnimation(static_cast<J2DAnmVtxColor*>(p_anm)); + break; + case KIND_TEXTURE_SRT: + setAnimation(static_cast<J2DAnmTextureSRTKey*>(p_anm)); + break; + case KIND_TEX_PATTERN: + setAnimation(static_cast<J2DAnmTexPattern*>(p_anm)); + break; + case KIND_VISIBILITY: + setAnimation(static_cast<J2DAnmVisibilityFull*>(p_anm)); + break; + case KIND_TEV_REG: + setAnimation(static_cast<J2DAnmTevRegKey*>(p_anm)); + break; + } + } +} + +/* 802F7FC4-802F7FCC -00001 0008+00 0/0 0/0 0/0 .text setAnimation__7J2DPaneFP15J2DAnmTransform */ +void J2DPane::setAnimation(J2DAnmTransform* p_anm) { + mTransform = p_anm; +} + +/* 802F7FCC-802F8004 2F290C 0038+00 0/0 57/57 0/0 .text animationTransform__7J2DPaneFv */ +void J2DPane::animationTransform() { + if (mTransform != NULL) + animationTransform(mTransform); +} + +/* 802F8004-802F8080 2F2944 007C+00 1/0 7/1 0/0 .text clearAnmTransform__7J2DPaneFv */ +void J2DPane::clearAnmTransform() { + J2DAnmTransform* none = NULL; + setAnimation(none); + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + iter.getObject()->clearAnmTransform(); + } +} + +/* 802F8080-802F8118 2F29C0 0098+00 1/0 7/0 0/0 .text + * animationTransform__7J2DPaneFPC15J2DAnmTransform */ +const J2DAnmTransform* J2DPane::animationTransform(const J2DAnmTransform* p_transform) { + const J2DAnmTransform* p = p_transform; + if (mTransform != NULL) + p = mTransform; + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + iter.getObject()->animationTransform(p); + } + + updateTransform(p); + return p; +} + +/* 802F8118-802F81A0 2F2A58 0088+00 1/0 8/1 0/0 .text + * setVisibileAnimation__7J2DPaneFP20J2DAnmVisibilityFull */ +void J2DPane::setVisibileAnimation(J2DAnmVisibilityFull* p_visibility) { + setAnimationVF(p_visibility); + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + iter.getObject()->setVisibileAnimation(p_visibility); + } +} + +/* 802F81A0-802F8228 2F2AE0 0088+00 1/0 8/1 0/0 .text + * setVtxColorAnimation__7J2DPaneFP14J2DAnmVtxColor */ +void J2DPane::setVtxColorAnimation(J2DAnmVtxColor* p_vtxColor) { + setAnimationVC(p_vtxColor); + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + iter.getObject()->setVtxColorAnimation(p_vtxColor); + } +} + +/* 802F8228-802F82C0 2F2B68 0098+00 1/0 7/3 0/0 .text animationPane__7J2DPaneFPC15J2DAnmTransform + */ +const J2DAnmTransform* J2DPane::animationPane(const J2DAnmTransform* p_transform) { + const J2DAnmTransform* p = p_transform; + if (mTransform != NULL) + p = mTransform; + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + iter.getObject()->animationPane(p); + } + + updateTransform(p); + return p; +} + +/* 802F82C0-802F83C8 2F2C00 0108+00 2/2 0/0 0/0 .text + * updateTransform__7J2DPaneFPC15J2DAnmTransform */ +void J2DPane::updateTransform(J2DAnmTransform const* p_anmTransform) { + if (field_0x4 != 0xFFFF && p_anmTransform != NULL) { + J3DTransformInfo info; + p_anmTransform->getTransform(field_0x4, &info); + mScaleX = info.mScale.x; + mScaleY = info.mScale.z; + mRotateX = (u16)info.mRotation.x * 360.0f / 65535.0f; + mRotateY = (u16)info.mRotation.z * 360.0f / 65535.0f; + mRotateZ = (u16)info.mRotation.y * 360.0f / 65535.0f; + mTranslateX = info.mTranslate.x; + mTranslateY = info.mTranslate.z; + calcMtx(); + } +} + +/* 802F83C8-802F83CC 2F2D08 0004+00 1/0 0/0 0/0 .text drawSelf__7J2DPaneFffPA3_A4_f */ +void J2DPane::drawSelf(f32, f32, f32 (*)[3][4]) { + /* empty function */ +} + +/* 802F83CC-802F83D0 2F2D0C 0004+00 1/0 1/0 0/0 .text rewriteAlpha__7J2DPaneFv */ +void J2DPane::rewriteAlpha() { + /* empty function */ +} + +/* 802F83D0-802F83FC 2F2D10 002C+00 1/0 6/0 0/0 .text + * setAnimationVF__7J2DPaneFP20J2DAnmVisibilityFull */ +void J2DPane::setAnimationVF(J2DAnmVisibilityFull* p_visibility) { + setAnimation(p_visibility); +} + +/* 802F83FC-802F8428 2F2D3C 002C+00 1/0 6/0 0/0 .text setAnimationVC__7J2DPaneFP14J2DAnmVtxColor + */ +void J2DPane::setAnimationVC(J2DAnmVtxColor* p_vtxColor) { + setAnimation(p_vtxColor); +} + +/* 802F8428-802F8464 2F2D68 003C+00 1/0 4/0 0/0 .text setCullBack__7J2DPaneFb */ +void J2DPane::setCullBack(bool cull) { + GXCullMode mode; + + if (!cull) + mode = GX_CULL_NONE; + else + mode = GX_CULL_BACK; + + setCullBack(mode); +} + +/* 802F8464-802F8474 2F2DA4 0010+00 1/0 5/0 0/0 .text setConnectParent__7J2DPaneFb */ +bool J2DPane::setConnectParent(bool connected) { + mConnected = false; + return false; +} + +/* 802F8474-802F8478 2F2DB4 0004+00 1/0 7/0 0/0 .text update__7J2DPaneFv */ +void J2DPane::update() { + /* empty function */ +} + +/* 802F8478-802F847C 2F2DB8 0004+00 1/0 1/0 0/0 .text drawSelf__7J2DPaneFff */ +void J2DPane::drawSelf(f32, f32) { + /* empty function */ +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DPicture.cpp b/src/JSystem/J2DGraph/J2DPicture.cpp new file mode 100644 index 0000000000..d07ccd851d --- /dev/null +++ b/src/JSystem/J2DGraph/J2DPicture.cpp @@ -0,0 +1,1484 @@ +// +// Generated By: dol2asm +// Translation Unit: J2DPicture +// + +#include "JSystem/J2DGraph/J2DPicture.h" +#include "JSystem/J2DGraph/J2DScreen.h" +#include "JSystem/J2DGraph/J2DMaterial.h" +#include "JSystem/JUtility/JUTPalette.h" +#include "JSystem/JUtility/JUTTexture.h" +#include "JSystem/JUtility/JUTResource.h" +#include "JSystem/JSupport/JSURandomInputStream.h" +#include "dol2asm.h" +#include "dolphin/gx.h" + +// +// Forward References: +// + +extern "C" void __ct__10J2DPictureFv(); +extern "C" void __ct__10J2DPictureFP7J2DPaneP20JSURandomInputStreamP10JKRArchive(); +extern "C" void __ct__10J2DPictureFP7J2DPaneP20JSURandomInputStreamP11J2DMaterial(); +extern "C" void __ct__10J2DPictureFPC7ResTIMG(); +extern "C" void func_802FC800(); +extern "C" void private_readStream__10J2DPictureFP7J2DPaneP20JSURandomInputStreamP10JKRArchive(); +extern "C" void initiate__10J2DPictureFPC7ResTIMGPC7ResTLUT(); +extern "C" void private_initiate__10J2DPictureFPC7ResTIMGPC7ResTLUT(); +extern "C" void initinfo__10J2DPictureFv(); +extern "C" void __dt__10J2DPictureFv(); +extern "C" void prepareTexture__10J2DPictureFUc(); +extern "C" void insert__10J2DPictureFPC7ResTIMGP10JUTPaletteUcf(); +extern "C" void insert__10J2DPictureFPCcP10JUTPaletteUcf(); +extern "C" void insert__10J2DPictureFP10JUTTextureUcf(); +extern "C" void remove__10J2DPictureFUc(); +extern "C" void remove__10J2DPictureFP10JUTTexture(); +extern "C" void changeTexture__10J2DPictureFPC7ResTIMGUc(); +extern "C" void changeTexture__10J2DPictureFPCcUc(); +extern "C" void changeTexture__10J2DPictureFPC7ResTIMGUcP10JUTPalette(); +extern "C" void changeTexture__10J2DPictureFPCcUcP10JUTPalette(); +extern "C" void drawSelf__10J2DPictureFff(); +extern "C" void drawSelf__10J2DPictureFffPA3_A4_f(); +extern "C" void drawFullSet__10J2DPictureFffffPA3_A4_f(); +extern "C" void draw__10J2DPictureFffffbbb(); +extern "C" void func_802FDF88(); +extern "C" void drawTexCoord__10J2DPictureFffffssssssssPA3_A4_f(); +extern "C" void setTevMode__10J2DPictureFv(); +extern "C" void swap__10J2DPictureFRfRf(); +extern "C" void setBlendColorRatio__10J2DPictureFff(); +extern "C" void setBlendAlphaRatio__10J2DPictureFff(); +extern "C" void setBlendKonstColor__10J2DPictureFv(); +extern "C" void setBlendKonstAlpha__10J2DPictureFv(); +extern "C" void getNewColor__10J2DPictureFPQ28JUtility6TColor(); +extern "C" void setTexCoord__10J2DPictureFPC10JUTTexture10J2DBinding9J2DMirrorb(); +extern "C" void func_802FED84(); +extern "C" void isUsed__10J2DPictureFPC7ResTIMG(); +extern "C" void getUsableTlut__10J2DPictureFUc(); +extern "C" void getTlutID__10J2DPictureFPC7ResTIMGUc(); +extern "C" void func_802FF204(void* _this); +extern "C" void append__10J2DPictureFP10JUTTexturef(); +extern "C" void append__10J2DPictureFPC7ResTIMGP10JUTPalettef(); +extern "C" void load__10J2DPictureFUc(); +extern "C" void load__10J2DPictureF11_GXTexMapIDUc(); +extern "C" s32 getTypeID__10J2DPictureCFv(); +extern "C" void append__10J2DPictureFPCcP10JUTPalettef(); +extern "C" void prepend__10J2DPictureFP10JUTTexturef(); +extern "C" void prepend__10J2DPictureFPCcP10JUTPalettef(); +extern "C" void prepend__10J2DPictureFPCcf(); +extern "C" void prepend__10J2DPictureFPC7ResTIMGP10JUTPalettef(); +extern "C" void prepend__10J2DPictureFPC7ResTIMGf(); +extern "C" void remove__10J2DPictureFv(); +extern "C" void draw__10J2DPictureFffUcbbb(); +extern "C" void draw__10J2DPictureFffbbb(); +extern "C" void drawOut__10J2DPictureFffffffff(); +extern "C" void drawOut__10J2DPictureFffffff(); +extern "C" void getTextureCount__10J2DPictureCFv(); +extern "C" void isUsed__10J2DPictureFPC7ResFONT(); +extern "C" void rewriteAlpha__10J2DPictureFv(); + +// +// External References: +// + +extern "C" void setAlpha__7J2DPaneFUc(); +extern "C" void setBlendRatio__10J2DPictureFff(); +extern "C" void append__10J2DPictureFPCcf(); +extern "C" void insert__10J2DPictureFPCcUcf(); +extern "C" void getTexture__10J2DPictureCFUc(); +extern "C" void calcMtx__7J2DPaneFv(); +extern "C" void makeMatrix__7J2DPaneFff(); +extern "C" void setWhite__10J2DPictureFQ28JUtility6TColor(); +extern "C" void setBlack__10J2DPictureFQ28JUtility6TColor(); +extern "C" void setAnimation__7J2DPaneFP15J2DAnmTevRegKey(); +extern "C" void setAnimation__7J2DPaneFP11J2DAnmColor(); +extern "C" void setBlackWhite__10J2DPictureFQ28JUtility6TColorQ28JUtility6TColor(); +extern "C" void setAnimation__7J2DPaneFP19J2DAnmTextureSRTKey(); +extern "C" void __ct__Q28JUtility6TColorFv(); +extern "C" void append__10J2DPictureFPC7ResTIMGf(); +extern "C" void insert__10J2DPictureFPC7ResTIMGUcf(); +extern "C" void getWhite__10J2DPictureCFv(); +extern "C" void getBlack__10J2DPictureCFv(); +extern "C" void setAnimation__7J2DPaneFP14J2DAnmVtxColor(); +extern "C" void setAnimation__7J2DPaneFP20J2DAnmVisibilityFull(); +extern "C" void setAnimation__7J2DPaneFP16J2DAnmTexPattern(); +extern "C" bool getMaterial__10J2DPictureCFv(); +extern "C" void* __nw__FUl(); +extern "C" void __dl__FPv(); +extern "C" void read__14JSUInputStreamFPvl(); +extern "C" void peek__20JSURandomInputStreamFPvl(); +extern "C" void seek__20JSURandomInputStreamFl17JSUStreamSeekFrom(); +extern "C" void __dt__10JUTTextureFv(); +extern "C" void storeTIMG__10JUTTextureFPC7ResTIMGUc(); +extern "C" void storeTIMG__10JUTTextureFPC7ResTIMGP10JUTPalette(); +extern "C" void storeTIMG__10JUTTextureFPC7ResTIMGP10JUTPalette7_GXTlut(); +extern "C" void attachPalette__10JUTTextureFP10JUTPalette(); +extern "C" void load__10JUTTextureF11_GXTexMapID(); +extern "C" void storeTLUT__10JUTPaletteF7_GXTlutP7ResTLUT(); +extern "C" void __ct__7J2DPaneFv(); +extern "C" void func_802F5E88(); +extern "C" void makePaneStream__7J2DPaneFP7J2DPaneP20JSURandomInputStream(); +extern "C" void __dt__7J2DPaneFv(); +extern "C" void func_802F6D18(); +extern "C" void move__7J2DPaneFff(); +extern "C" void add__7J2DPaneFff(); +extern "C" void resize__7J2DPaneFff(); +extern "C" void search__7J2DPaneFUx(); +extern "C" void searchUserInfo__7J2DPaneFUx(); +extern "C" void isUsed__7J2DPaneFPC7ResTIMG(); +extern "C" void isUsed__7J2DPaneFPC7ResFONT(); +extern "C" void makeMatrix__7J2DPaneFffff(); +extern "C" void setCullBack__7J2DPaneF11_GXCullMode(); +extern "C" void makePaneExStream__7J2DPaneFP7J2DPaneP20JSURandomInputStream(); +extern "C" void J2DCast_F32_to_S16__7J2DPaneFfUc(); +extern "C" void getPointer__7J2DPaneFP20JSURandomInputStreamUlP10JKRArchive(); +extern "C" void setAnimation__7J2DPaneFP10J2DAnmBase(); +extern "C" void setAnimation__7J2DPaneFP15J2DAnmTransform(); +extern "C" void clearAnmTransform__7J2DPaneFv(); +extern "C" void animationTransform__7J2DPaneFPC15J2DAnmTransform(); +extern "C" void setVisibileAnimation__7J2DPaneFP20J2DAnmVisibilityFull(); +extern "C" void setVtxColorAnimation__7J2DPaneFP14J2DAnmVtxColor(); +extern "C" void animationPane__7J2DPaneFPC15J2DAnmTransform(); +extern "C" void setAnimationVF__7J2DPaneFP20J2DAnmVisibilityFull(); +extern "C" void setAnimationVC__7J2DPaneFP14J2DAnmVtxColor(); +extern "C" void setCullBack__7J2DPaneFb(); +extern "C" void setConnectParent__7J2DPaneFb(); +extern "C" void update__7J2DPaneFv(); +extern "C" void getNameResource__9J2DScreenFPCc(); +extern "C" void __construct_array(); +extern "C" void _savegpr_21(); +extern "C" void _savegpr_22(); +extern "C" void _savegpr_25(); +extern "C" void _savegpr_26(); +extern "C" void _savegpr_27(); +extern "C" void _savegpr_28(); +extern "C" void _savegpr_29(); +extern "C" void _restgpr_21(); +extern "C" void _restgpr_22(); +extern "C" void _restgpr_25(); +extern "C" void _restgpr_26(); +extern "C" void _restgpr_27(); +extern "C" void _restgpr_28(); +extern "C" void _restgpr_29(); + +// +// Declarations: +// + +/* ############################################################################################## */ +/* 803CD1D8-803CD328 02A2F8 014C+04 6/6 0/0 0/0 .data __vt__10J2DPicture */ +SECTION_DATA extern void* __vt__10J2DPicture[83 + 1 /* padding */] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)__dt__10J2DPictureFv, + (void*)getTypeID__10J2DPictureCFv, + (void*)move__7J2DPaneFff, + (void*)add__7J2DPaneFff, + (void*)resize__7J2DPaneFff, + (void*)setCullBack__7J2DPaneFb, + (void*)setCullBack__7J2DPaneF11_GXCullMode, + (void*)setAlpha__7J2DPaneFUc, + (void*)setConnectParent__7J2DPaneFb, + (void*)calcMtx__7J2DPaneFv, + (void*)update__7J2DPaneFv, + (void*)drawSelf__10J2DPictureFff, + (void*)drawSelf__10J2DPictureFffPA3_A4_f, + (void*)search__7J2DPaneFUx, + (void*)searchUserInfo__7J2DPaneFUx, + (void*)makeMatrix__7J2DPaneFff, + (void*)makeMatrix__7J2DPaneFffff, + (void*)isUsed__10J2DPictureFPC7ResTIMG, + (void*)isUsed__10J2DPictureFPC7ResFONT, + (void*)clearAnmTransform__7J2DPaneFv, + (void*)rewriteAlpha__10J2DPictureFv, + (void*)setAnimation__7J2DPaneFP10J2DAnmBase, + (void*)setAnimation__7J2DPaneFP15J2DAnmTransform, + (void*)setAnimation__7J2DPaneFP11J2DAnmColor, + (void*)setAnimation__7J2DPaneFP16J2DAnmTexPattern, + (void*)setAnimation__7J2DPaneFP19J2DAnmTextureSRTKey, + (void*)setAnimation__7J2DPaneFP15J2DAnmTevRegKey, + (void*)setAnimation__7J2DPaneFP20J2DAnmVisibilityFull, + (void*)setAnimation__7J2DPaneFP14J2DAnmVtxColor, + (void*)animationTransform__7J2DPaneFPC15J2DAnmTransform, + (void*)setVisibileAnimation__7J2DPaneFP20J2DAnmVisibilityFull, + (void*)setAnimationVF__7J2DPaneFP20J2DAnmVisibilityFull, + (void*)setVtxColorAnimation__7J2DPaneFP14J2DAnmVtxColor, + (void*)setAnimationVC__7J2DPaneFP14J2DAnmVtxColor, + (void*)animationPane__7J2DPaneFPC15J2DAnmTransform, + (void*)initiate__10J2DPictureFPC7ResTIMGPC7ResTLUT, + (void*)prepareTexture__10J2DPictureFUc, + (void*)append__10J2DPictureFPC7ResTIMGf, + (void*)append__10J2DPictureFPC7ResTIMGP10JUTPalettef, + (void*)append__10J2DPictureFPCcf, + (void*)append__10J2DPictureFPCcP10JUTPalettef, + (void*)append__10J2DPictureFP10JUTTexturef, + (void*)prepend__10J2DPictureFPC7ResTIMGf, + (void*)prepend__10J2DPictureFPC7ResTIMGP10JUTPalettef, + (void*)prepend__10J2DPictureFPCcf, + (void*)prepend__10J2DPictureFPCcP10JUTPalettef, + (void*)prepend__10J2DPictureFP10JUTTexturef, + (void*)insert__10J2DPictureFPC7ResTIMGUcf, + (void*)insert__10J2DPictureFPC7ResTIMGP10JUTPaletteUcf, + (void*)insert__10J2DPictureFPCcUcf, + (void*)insert__10J2DPictureFPCcP10JUTPaletteUcf, + (void*)insert__10J2DPictureFP10JUTTextureUcf, + (void*)remove__10J2DPictureFUc, + (void*)remove__10J2DPictureFv, + (void*)remove__10J2DPictureFP10JUTTexture, + (void*)draw__10J2DPictureFffbbb, + (void*)draw__10J2DPictureFffUcbbb, + (void*)draw__10J2DPictureFffffbbb, + (void*)drawOut__10J2DPictureFffffff, + (void*)drawOut__10J2DPictureFffffffff, + (void*)func_802FDF88, + (void*)load__10J2DPictureF11_GXTexMapIDUc, + (void*)load__10J2DPictureFUc, + (void*)setBlendRatio__10J2DPictureFff, + (void*)setBlendColorRatio__10J2DPictureFff, + (void*)setBlendAlphaRatio__10J2DPictureFff, + (void*)changeTexture__10J2DPictureFPC7ResTIMGUc, + (void*)changeTexture__10J2DPictureFPCcUc, + (void*)changeTexture__10J2DPictureFPC7ResTIMGUcP10JUTPalette, + (void*)changeTexture__10J2DPictureFPCcUcP10JUTPalette, + (void*)getTexture__10J2DPictureCFUc, + (void*)getTextureCount__10J2DPictureCFv, + (void*)setBlack__10J2DPictureFQ28JUtility6TColor, + (void*)setWhite__10J2DPictureFQ28JUtility6TColor, + (void*)setBlackWhite__10J2DPictureFQ28JUtility6TColorQ28JUtility6TColor, + (void*)getBlack__10J2DPictureCFv, + (void*)getWhite__10J2DPictureCFv, + (void*)getMaterial__10J2DPictureCFv, + (void*)drawFullSet__10J2DPictureFffffPA3_A4_f, + (void*)drawTexCoord__10J2DPictureFffffssssssssPA3_A4_f, + (void*)getUsableTlut__10J2DPictureFUc, + /* padding */ + NULL, +}; + +/* 802FC050-802FC118 2F6990 00C8+00 0/0 2/2 0/0 .text __ct__10J2DPictureFv */ +J2DPicture::J2DPicture() : mPalette(NULL) { + for (int i = 0; i < 2; i++) { + mTexture[i] = NULL; + } + + field_0x109 = 0; + mTextureNum = 0; + initinfo(); +} + + +/* 802FC118-802FC1D4 2F6A58 00BC+00 0/0 1/1 0/0 .text + * __ct__10J2DPictureFP7J2DPaneP20JSURandomInputStreamP10JKRArchive */ +J2DPicture::J2DPicture(J2DPane* p_pane, JSURandomInputStream* p_stream, JKRArchive* p_archive) + : mPalette(NULL) { + private_readStream(p_pane, p_stream, p_archive); +} + + +/* ############################################################################################## */ +/* 80456260-80456268 004860 0008+00 1/1 0/0 0/0 .sdata2 @1739 */ +SECTION_SDATA2 static f64 lit_1739 = 4503599627370496.0 /* cast u32 to float */; + +/* 802FC1D4-802FC708 2F6B14 0534+00 0/0 1/1 0/0 .text + * __ct__10J2DPictureFP7J2DPaneP20JSURandomInputStreamP11J2DMaterial */ +J2DPicture::J2DPicture(J2DPane* p_pane, JSURandomInputStream* p_stream, J2DMaterial* p_material) + : mPalette(NULL) { + int position = p_stream->getPosition(); + + J2DPicHeader header; + p_stream->read(&header, sizeof(header)); + mKind = 'PIC1'; + + int position2 = p_stream->getPosition(); + + J2DPaneHeader panHeader; + p_stream->peek(&panHeader, sizeof(panHeader)); + makePaneExStream(p_pane, p_stream); + p_stream->seek(position2 + panHeader.mSize, JSUStreamSeekFrom_SET); + + J2DScrnBlockPictureParameter picInfo; + p_stream->read(&picInfo, sizeof(picInfo)); + u16 matNum = picInfo.field_0x4; + + for (int i = 0; i < 4; i++) { + field_0x10a[i] = picInfo.field_0x10[i]; + mCornerColor[i] = picInfo.mCornerColor[i]; + } + + p_stream->seek(position + header.mSize, JSUStreamSeekFrom_SET); + + J2DMaterial* material = NULL; + if (matNum != 0xFFFF) { + material = &p_material[matNum]; + } + + mAlpha = 255; + if (material != NULL) { + mAlpha = material->getColorBlock()->getMatColor(0)->a; + } + + mBlack = JUtility::TColor(0); + mWhite = JUtility::TColor(0xFFFFFFFF); + mTextureNum = 0; + + if (material != NULL && material->getTevBlock() != NULL) { + u8 texgenNum = material->getTexGenBlock()->getTexGenNum(); + u32 stageNum = material->getTevBlock()->getTevStageNum(); + + if ((texgenNum == 1 && stageNum != 1) || (texgenNum != 1 && (int)stageNum != texgenNum + 1)) + { + J2DGXColorS10* color0p = material->getTevBlock()->getTevColor(0); + GXColorS10 color0; + color0.r = color0p->r; + color0.g = color0p->g; + color0.b = color0p->b; + color0.a = color0p->a; + + J2DGXColorS10* color1p = material->getTevBlock()->getTevColor(1); + GXColorS10 color1; + color1.r = color1p->r; + color1.g = color1p->g; + color1.b = color1p->b; + color1.a = color1p->a; + + mBlack = JUtility::TColor(((u8)color0.r << 0x18) | ((u8)color0.g << 0x10) | + ((u8)color0.b << 8) | (u8)color0.a); + mWhite = JUtility::TColor(((u8)color1.r << 0x18) | ((u8)color1.g << 0x10) | + ((u8)color1.b << 8) | (u8)color1.a); + } + + mTextureNum = texgenNum <= 2 ? texgenNum : 2; + } + + field_0x109 = 0; + + for (u32 i = 0; i < 2; i++) { + mTexture[i] = NULL; + + if (material != NULL && material->getTevBlock() != NULL) { + JUTTexture* tex = material->getTevBlock()->getTexture(i); + + if (tex != NULL) { + mTexture[i] = tex; + field_0x109 |= (1 << i); + } + } + } + + if (material != NULL && material->getTevBlock() != NULL) { + material->getTevBlock()->setUndeleteFlag(0xF0); + } + + mPalette = NULL; + + JUtility::TColor color(0xFFFFFFFF); + JUtility::TColor alpha(0xFFFFFFFF); + if (material != NULL && material->getTevBlock() != NULL) { + color = *material->getTevBlock()->getTevKColor(3); + alpha = *material->getTevBlock()->getTevKColor(1); + } + + setBlendColorRatio(color.a, color.b); + setBlendAlphaRatio(alpha.a, alpha.b); +} + + +/* ############################################################################################## */ +/* 80456268-8045626C 004868 0004+00 9/9 0/0 0/0 .sdata2 @1767 */ +SECTION_SDATA2 static f32 lit_1767 = 1.0f; + +/* 802FC708-802FC800 2F7048 00F8+00 0/0 20/20 1/1 .text __ct__10J2DPictureFPC7ResTIMG */ +J2DPicture::J2DPicture(ResTIMG const* p_timg) { + for (int i = 0; i < 2; i++) { + mTexture[i] = NULL; + } + + field_0x109 = 0; + mTextureNum = 0; + + if (p_timg != NULL) { + append(p_timg, 1.0f); + } + mPalette = NULL; + initinfo(); +} + + +/* 802FC800-802FC8E8 2F7140 00E8+00 0/0 5/5 0/0 .text + * __ct__10J2DPictureFUxRCQ29JGeometry8TBox2<f>PC7ResTIMGPC7ResTLUT */ +J2DPicture::J2DPicture(u64 tag, JGeometry::TBox2<f32> const& bounds, ResTIMG const* p_timg, + ResTLUT const* p_tlut) + : J2DPane(tag, bounds), mPalette(NULL) { + for (int i = 0; i < 2; i++) { + mTexture[i] = NULL; + } + + field_0x109 = 0; + mTextureNum = 0; + + private_initiate(p_timg, p_tlut); + initinfo(); +} + + +/* 802FC8E8-802FCCDC 2F7228 03F4+00 1/1 0/0 0/0 .text + * private_readStream__10J2DPictureFP7J2DPaneP20JSURandomInputStreamP10JKRArchive */ +void J2DPicture::private_readStream(J2DPane* parent, JSURandomInputStream* stream, + JKRArchive* archive) { + J2DScrnBlockHeader header; + int headerPosition = stream->getPosition(); + + stream->read(&header, sizeof(J2DScrnBlockHeader)); + mKind = header.mTag; + makePaneStream(parent, stream); + + JUTResReference ref; + + ResTIMG* img; + ResTLUT* lut; + u32 var_r27 = 0; + u8 var_r26 = stream->readU8(); + + img = (ResTIMG*)getPointer(stream, 'TIMG', archive); + lut = (ResTLUT*)getPointer(stream, 'TLUT', archive); + + u8 spA = stream->read8b(); + + var_r26 -= 3; + if (var_r26 != 0) { + var_r27 = stream->read8b(); + var_r26--; + } + + if (var_r26 != 0) { + stream->read8b(); + var_r26--; + } + + mBlack = 0; + mWhite = 0xFFFFFFFF; + + if (var_r26 != 0) { + mBlack = stream->readU32(); + var_r26--; + } + + if (var_r26 != 0) { + mWhite = stream->readU32(); + var_r26--; + } + + setCornerColor(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF); + for (int i = 0; var_r26 != 0 && i < 4; i++) { + mCornerColor[i] = stream->readU32(); + var_r26--; + } + + stream->seek(headerPosition + header.mSize, JSUStreamSeekFrom_SET); + + for (int i = 0; i < 2; i++) { + mTexture[i] = NULL; + } + + mTextureNum = 0; + field_0x109 = 1; + + if (img != NULL) { + mTexture[0] = new JUTTexture(img, 0); + mTextureNum++; + } + + if (lut != NULL) { + mPalette = new JUTPalette(GX_TLUT0, lut); + mTexture[0]->attachPalette(mPalette); + } + + setTexCoord(mTexture[0], (J2DBinding)spA, (J2DMirror)(var_r27 & 3), (bool)((var_r27 >> 2) & 1)); + setBlendRatio(1.0f, 1.0f); +} + + +/* ############################################################################################## */ +/* 8045626C-80456270 00486C 0004+00 9/9 0/0 0/0 .sdata2 @2017 */ +SECTION_SDATA2 static u8 lit_2017[4] = { + 0x00, + 0x00, + 0x00, + 0x00, +}; + +/* 80456270-80456278 004870 0008+00 7/7 0/0 0/0 .sdata2 @2021 */ +SECTION_SDATA2 static f64 lit_2021 = 4503601774854144.0 /* cast s32 to float */; + +/* 802FCCDC-802FCD70 2F761C 0094+00 1/0 0/0 0/0 .text initiate__10J2DPictureFPC7ResTIMGPC7ResTLUT + */ +void J2DPicture::initiate(const ResTIMG* img, const ResTLUT* lut) { + private_initiate(img, lut); + if (mTexture[0] == NULL) { + return; + } + + place(JGeometry::TBox2<f32>(0.0f, 0.0f, mTexture[0]->getWidth(), mTexture[0]->getHeight())); +} + + +/* 802FCD70-802FCE9C 2F76B0 012C+00 2/2 0/0 0/0 .text + * private_initiate__10J2DPictureFPC7ResTIMGPC7ResTLUT */ +void J2DPicture::private_initiate(const ResTIMG* timg, const ResTLUT* tlut) { + if (mTextureNum != 0) { + return; + } + + if (timg != NULL) { + if (mTexture[0] == NULL) { + mTexture[0] = new JUTTexture(timg, 0); + if (mTexture[0] != NULL) { + mTextureNum++; + field_0x109 = (field_0x109 & 2) | 1; + } + } else { + mTexture[0]->storeTIMG(timg, (u8)0); + mTextureNum++; + field_0x109 = (field_0x109 & 2) | 1; + } + } + + mPalette = NULL; + if (tlut && mPalette == NULL) { + mPalette = new JUTPalette(GX_TLUT0, const_cast<ResTLUT*>(tlut)); + if (mTexture[0] != NULL) { + mTexture[0]->attachPalette(mPalette); + } + } +} + +/* 802FCE9C-802FCFF0 2F77DC 0154+00 3/3 0/0 0/0 .text initinfo__10J2DPictureFv */ +void J2DPicture::initinfo() { + mKind = 'PIC1'; + setTexCoord(NULL, BIND15, MIRROR0, false); + setBlendRatio(lit_1767, lit_1767); + + mBlack = 0; + mWhite = -1; + setCornerColor(-1, -1, -1, -1); +} + + +/* 802FCFF0-802FD098 2F7930 00A8+00 1/0 3/3 0/0 .text __dt__10J2DPictureFv */ +J2DPicture::~J2DPicture() { + for (int i = 0; i < 2; i++) { + if ((int)(field_0x109 & 1 << i) != 0) { + delete mTexture[i]; + } + } + + delete mPalette; +} + +/* 802FD098-802FD168 2F79D8 00D0+00 1/0 0/0 0/0 .text prepareTexture__10J2DPictureFUc */ +bool J2DPicture::prepareTexture(u8 param_0) { + for (u8 i = 0; i < param_0; i++) { + if (i >= 2) { + return 0; + } + + if (mTexture[i] == NULL) { + JUTTexture* tmp = new JUTTexture(); + mTexture[i] = tmp; + + if (mTexture[i] == NULL) { + return 0; + } + field_0x109 |= (1 << i); + } + } + return 1; +} + +/* 802FD168-802FD4B4 2F7AA8 034C+00 1/0 0/0 0/0 .text + * insert__10J2DPictureFPC7ResTIMGP10JUTPaletteUcf */ +bool J2DPicture::insert(ResTIMG const* img, JUTPalette* palette, u8 param_2, f32 param_3) { + if (img == NULL || mTextureNum >= 2 || param_2 >= 2 || param_2 > mTextureNum) { + return false; + } + + u8 var_r26 = 0; + if (img->indexTexture != 0 && palette == NULL) { + var_r26 = getUsableTlut(mTextureNum); + } + + JUTTexture* var_r31; + if (mTexture[mTextureNum] == NULL) { + var_r31 = new JUTTexture(img, var_r26); + + if (palette != NULL) { + var_r31->storeTIMG(img, palette); + } + + for (u8 i = 1; i > param_2; i--) { + mTexture[i] = mTexture[i - 1]; + field_0x11c[i] = field_0x11c[i - 1]; + field_0x124[i] = field_0x124[i - 1]; + } + + field_0x109 = + (field_0x109 & ((1 << param_2) - 1)) | ((field_0x109 & ~((1 << param_2) - 1)) * 2); + field_0x109 |= (1 << param_2); + } else { + var_r31 = mTexture[mTextureNum]; + if (palette == NULL) { + mTexture[mTextureNum]->storeTIMG(img, var_r26); + } else { + mTexture[mTextureNum]->storeTIMG(img, palette); + } + + u8 sp8[2]; + for (u8 i = 0; i < 2; i++) { + sp8[i] = (field_0x109 & (1 << i)) != 0; + } + + for (u8 i = mTextureNum; i > param_2; i--) { + mTexture[i] = mTexture[i - 1]; + sp8[i] = sp8[i - 1]; + field_0x11c[i] = field_0x11c[i - 1]; + field_0x124[i] = field_0x124[i - 1]; + } + + field_0x109 = 0; + + for (u8 i = 0; i < 2; i++) { + if (sp8[i] != 0) { + field_0x109 |= (1 << i); + } + } + + field_0x109 |= (1 << param_2); + } + + mTexture[param_2] = var_r31; + field_0x11c[param_2] = param_3; + field_0x124[param_2] = param_3; + + if (mTextureNum == 0 && mTexture[0] != NULL) { + place(JGeometry::TBox2<f32>(0.0f, 0.0f, mTexture[0]->getWidth(), mTexture[0]->getHeight())); + setTexCoord(NULL, BIND15, MIRROR0, false); + } + + mTextureNum++; + setBlendKonstColor(); + setBlendKonstAlpha(); + return true; +} + + +/* 802FD4B4-802FD524 2F7DF4 0070+00 1/0 0/0 0/0 .text insert__10J2DPictureFPCcP10JUTPaletteUcf */ +bool J2DPicture::insert(char const* resName, JUTPalette* palette, u8 param_2, f32 param_3) { + void* resource = J2DScreen::getNameResource(resName); + return insert((ResTIMG*)resource, palette, param_2, param_3); +} + +/* 802FD524-802FD6F4 2F7E64 01D0+00 1/0 0/0 0/0 .text insert__10J2DPictureFP10JUTTextureUcf */ +bool J2DPicture::insert(JUTTexture* texture, u8 param_1, f32 param_2) { + if (texture == NULL || mTextureNum >= 2 || param_1 >= 2 || param_1 > mTextureNum) { + return false; + } + + if (mTexture[1] != NULL && field_0x109 & 2) { + delete mTexture[1]; + field_0x109 &= 1; + } + + for (u8 i = 1; i > param_1; i--) { + mTexture[i] = mTexture[i - 1]; + field_0x11c[i] = field_0x11c[i - 1]; + field_0x124[i] = field_0x124[i - 1]; + } + + field_0x109 = + (field_0x109 & ((1 << param_1) - 1)) | ((field_0x109 & ~((1 << param_1) - 1)) * 2); + mTexture[param_1] = texture; + field_0x109 &= ~(1 << param_1); + + field_0x11c[param_1] = param_2; + field_0x124[param_1] = param_2; + + if (mTextureNum == 0 && &mTexture[0] != NULL) { + place(JGeometry::TBox2<f32>(0.0f, 0.0f, mTexture[0]->getWidth(), mTexture[0]->getHeight())); + setTexCoord(NULL, BIND15, MIRROR0, false); + } + + mTextureNum++; + setBlendKonstColor(); + setBlendKonstAlpha(); + return true; +} + + +/* 802FD6F4-802FD814 2F8034 0120+00 1/0 0/0 0/0 .text remove__10J2DPictureFUc */ +bool J2DPicture::remove(u8 param_0) { + if (mTextureNum <= param_0 || mTextureNum == 1) { + return false; + } + + if (field_0x109 & (1 << param_0)) { + delete mTexture[param_0]; + } + + for (u8 i = param_0; i < mTextureNum - 1; i++) { + mTexture[i] = mTexture[i + 1]; + field_0x11c[i] = field_0x11c[i + 1]; + field_0x124[i] = field_0x124[i + 1]; + } + + mTexture[mTextureNum - 1] = NULL; + field_0x109 = + (field_0x109 & ((1 << param_0) - 1)) | ((field_0x109 & ~((1 << (param_0 + 1)) - 1)) >> 1); + + mTextureNum--; + setBlendKonstColor(); + setBlendKonstAlpha(); + return true; +} + +/* 802FD814-802FD874 2F8154 0060+00 1/0 0/0 0/0 .text remove__10J2DPictureFP10JUTTexture + */ +bool J2DPicture::remove(JUTTexture* param_0) { + u8 i = 0; + for (; i < mTextureNum; i++) { + if (mTexture[i] == param_0) { + break; + } + } + return remove(i); +} + +/* 802FD874-802FD964 2F81B4 00F0+00 1/0 0/0 0/0 .text changeTexture__10J2DPictureFPC7ResTIMGUc */ +const ResTIMG* J2DPicture::changeTexture(ResTIMG const* img, u8 texIndex) { + if (texIndex > mTextureNum || 2 <= texIndex || img == NULL) { + return NULL; + } + + const ResTIMG* result; + if (texIndex < mTextureNum) { + JUTTexture* tex = getTexture(texIndex); + result = tex->getTexInfo(); + + u8 var_r30 = 0; + if (img->indexTexture != 0) { + var_r30 = getUsableTlut(texIndex); + } + getTexture(texIndex)->storeTIMG(img, var_r30); + return result; + } + + append(img, 1.0f); + return NULL; +} + + +/* 802FD964-802FD9BC 2F82A4 0058+00 1/0 0/0 0/0 .text changeTexture__10J2DPictureFPCcUc + */ +const ResTIMG* J2DPicture::changeTexture(char const* resName, u8 param_1) { + void* resource = J2DScreen::getNameResource(resName); + return changeTexture((ResTIMG*)resource, param_1); +} + +/* 802FD9BC-802FDAC8 2F82FC 010C+00 1/0 0/0 0/0 .text + * changeTexture__10J2DPictureFPC7ResTIMGUcP10JUTPalette */ +const ResTIMG* J2DPicture::changeTexture(ResTIMG const* img, u8 texIndex, JUTPalette* palette) { + if (texIndex > mTextureNum || 2 <= texIndex || img == NULL) { + return NULL; + } + + const ResTIMG* result; + if (texIndex < mTextureNum) { + JUTTexture* tex = getTexture(texIndex); + result = tex->getTexInfo(); + + GXTlut var_r30 = GX_TLUT0; + if (img->indexTexture != 0) { + var_r30 = getTlutID(img, getUsableTlut(texIndex)); + } + getTexture(texIndex)->storeTIMG(img, palette, var_r30); + return result; + } + + append(img, palette, 1.0f); + return NULL; +} + + +/* 802FDAC8-802FDB28 2F8408 0060+00 1/0 0/0 0/0 .text + * changeTexture__10J2DPictureFPCcUcP10JUTPalette */ +const ResTIMG* J2DPicture::changeTexture(char const* param_0, u8 param_1, JUTPalette* param_2) { + void* resource = J2DScreen::getNameResource(param_0); + return changeTexture((ResTIMG*)resource, param_1, param_2); +} + +/* 802FDB28-802FDB90 2F8468 0068+00 1/0 1/0 0/0 .text drawSelf__10J2DPictureFff */ +void J2DPicture::drawSelf(f32 param_0, f32 param_1) { + Mtx tmp; + MTXIdentity(tmp); + + drawSelf(param_0, param_1, &tmp); +} + +/* 802FDB90-802FDBFC 2F84D0 006C+00 1/0 0/0 0/0 .text drawSelf__10J2DPictureFffPA3_A4_f + */ +void J2DPicture::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) { + if (mTexture[0] != NULL && mTextureNum != 0) { + drawFullSet(mGlobalBounds.i.x + param_0, mGlobalBounds.i.y + param_1, + mBounds.f.x - mBounds.i.x, mBounds.f.y - mBounds.i.y, param_2); + } +} + +/* 802FDBFC-802FDC70 2F853C 0074+00 1/0 0/0 0/0 .text drawFullSet__10J2DPictureFffffPA3_A4_f */ +void J2DPicture::drawFullSet(f32 param_0, f32 param_1, f32 param_2, f32 param_3, Mtx* param_4) { + if (mTexture[0] != NULL && mTextureNum != 0) { + drawTexCoord(mBounds.i.x, mBounds.i.y, param_2, param_3, field_0x10a[0].x, field_0x10a[0].y, + field_0x10a[1].x, field_0x10a[1].y, field_0x10a[2].x, field_0x10a[2].y, + field_0x10a[3].x, field_0x10a[3].y, param_4); + } +} + +/* 802FDC70-802FDF88 2F85B0 0318+00 1/0 1/1 0/0 .text draw__10J2DPictureFffffbbb */ +void J2DPicture::draw(f32 x, f32 y, f32 width, f32 height, bool mirrorX, bool mirrorY, + bool rotate90) { + if (isVisible() && mTextureNum != 0 && mTexture[0] != NULL) { + for (u8 i = 0; i < mTextureNum; i++) { + load(i); + } + + GXSetNumTexGens(mTextureNum); + mColorAlpha = mAlpha; + JUtility::TColor color[4]; + getNewColor(color); + + setTevMode(); + makeMatrix(x, y, 0.0f, 0.0f); + GXLoadPosMtxImm(mPositionMtx, GX_PNMTX0); + GXSetCurrentMtx(GX_PNMTX0); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + + JGeometry::TVec2<s16> coords[4]; + setTexCoord(coords, mTexture[0], BIND15, (J2DMirror)((mirrorX << 1) | mirrorY), rotate90); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_POS_XYZ, GX_S16, 8); + + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + GXPosition3f32(0.0f, 0.0f, 0.0f); + GXColor1u32(color[0]); + GXTexCoord2s16(coords[0].x, coords[0].y); + + GXPosition3f32(width, 0.0f, 0.0f); + GXColor1u32(color[1]); + GXTexCoord2s16(coords[1].x, coords[1].y); + + GXPosition3f32(width, height, 0.0f); + GXColor1u32(color[3]); + GXTexCoord2s16(coords[3].x, coords[3].y); + + GXPosition3f32(0.0f, height, 0.0f); + GXColor1u32(color[2]); + GXTexCoord2s16(coords[2].x, coords[2].y); + GXEnd(); + + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_POS_XYZ, GX_U16, 15); + GXSetNumTexGens(0); + GXSetNumTevStages(1); + GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + + Mtx m; + MTXIdentity(m); + GXLoadPosMtxImm(m, GX_PNMTX0); + GXSetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, + GX_AF_NONE); + GXSetVtxDesc(GX_VA_TEX0, GX_NONE); + } +} + + +/* 802FDF88-802FE380 2F88C8 03F8+00 1/0 0/0 0/0 .text + * drawOut__10J2DPictureFRCQ29JGeometry8TBox2<f>RCQ29JGeometry8TBox2<f> */ +void J2DPicture::drawOut(JGeometry::TBox2<f32> const& posBox, + JGeometry::TBox2<f32> const& texRect) { + if (isVisible() && mTextureNum != 0 && mTexture[0] != NULL) { + for (u8 i = 0; i < mTextureNum; i++) { + load(i); + } + + GXSetNumTexGens(mTextureNum); + + f32 s0 = (posBox.i.x - texRect.i.x) / texRect.getWidth(); + f32 s1 = (posBox.f.x - texRect.f.x) / texRect.getWidth() + 1.0f; + + f32 t0 = (posBox.i.y - texRect.i.y) / texRect.getHeight(); + f32 t1 = (posBox.f.y - texRect.f.y) / texRect.getHeight() + 1.0f; + + mColorAlpha = mAlpha; + JUtility::TColor color[4]; + getNewColor(color); + setTevMode(); + + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + GXPosition3f32((s16)posBox.i.x, (s16)posBox.i.y, 0.0f); + GXColor1u32(color[0]); + GXTexCoord2f32(s0, t0); + + GXPosition3f32((s16)posBox.f.x, (s16)posBox.i.y, 0.0f); + GXColor1u32(color[1]); + GXTexCoord2f32(s1, t0); + + GXPosition3f32((s16)posBox.f.x, (s16)posBox.f.y, 0.0f); + GXColor1u32(color[3]); + GXTexCoord2f32(s1, t1); + + GXPosition3f32((s16)posBox.i.x, (s16)posBox.f.y, 0.0f); + GXColor1u32(color[2]); + GXTexCoord2f32(s0, t1); + GXEnd(); + + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_U16, 15); + GXSetNumTexGens(0); + GXSetNumTevStages(1); + GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, + GX_AF_NONE); + GXSetVtxDesc(GX_VA_TEX0, GX_NONE); + } +} + + +/* 802FE380-802FE5D0 2F8CC0 0250+00 1/0 0/0 0/0 .text + * drawTexCoord__10J2DPictureFffffssssssssPA3_A4_f */ +void J2DPicture::drawTexCoord(f32 param_0, f32 param_1, f32 param_2, f32 param_3, s16 param_4, + s16 param_5, s16 param_6, s16 param_7, s16 param_8, s16 param_9, + s16 param_10, s16 param_11, Mtx* param_12) { + if (mTextureNum != 0) { + for (u8 i = 0; i < mTextureNum; i++) { + load(i); + } + + f32 tmp1 = param_0 + param_2; + f32 tmp2 = param_1 + param_3; + + GXSetNumTexGens(mTextureNum); + + JUtility::TColor black[4]; + + Mtx outputMtx; + + getNewColor(black); + setTevMode(); + MTXConcat((MtxP)param_12, mGlobalMtx, outputMtx); + + GXLoadPosMtxImm(outputMtx, 0); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBA4, 8); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + + GXPosition3f32(param_0, param_1, 0.0f); + GXColor1u32(black[0]); + GXTexCoord2s16(param_4, param_5); + + GXPosition3f32(tmp1, param_1, 0.0f); + GXColor1u32(black[1]); + GXTexCoord2s16(param_6, param_7); + + GXPosition3f32(tmp1, tmp2, 0.0f); + GXColor1u32(black[3]); + GXTexCoord2s16(param_10, param_11); + + GXPosition3f32(param_0, tmp2, 0.0f); + GXColor1u32(black[2]); + GXTexCoord2s16(param_8, param_9); + + GXEnd(); + + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); + } +} + + +/* 802FE5D0-802FEA60 2F8F10 0490+00 3/3 0/0 0/0 .text setTevMode__10J2DPictureFv */ +void J2DPicture::setTevMode() { + u8 i; + for (i = 0; i < mTextureNum; i++) { + GXSetTevOrder(GXTevStageID(i), GXTexCoordID(i), GXTexMapID(i), GX_COLOR_NULL); + } + + GXSetTevColor(GX_TEVREG2, JUtility::TColor(0xFFFFFFFF)); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_TEXC, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO); + + if (mTexture[0] == NULL) { + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A2, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO); + } else if (mTexture[0]->getTransparency()) { + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_TEXA, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO); + } else { + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A2, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO); + } + + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); + GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); + GXSetTevKColor(GX_KCOLOR0, mBlendKonstColor); + GXSetTevKColor(GX_KCOLOR2, mBlendKonstAlpha); + + for (i = 1; i < mTextureNum; i++) { + GXSetTevKColorSel(GXTevStageID(i), GXTevKColorSel(0x20 - i * 4)); + GXSetTevKAlphaSel(GXTevStageID(i), GXTevKAlphaSel(0x22 - i * 4)); + GXSetTevColorIn(GXTevStageID(i), GX_CC_CPREV, GX_CC_TEXC, GX_CC_KONST, GX_CC_ZERO); + + if (mTexture[i] == NULL) { + GXSetTevAlphaIn(GXTevStageID(i), GX_CA_APREV, GX_CA_A2, GX_CA_KONST, GX_CA_ZERO); + } else if (mTexture[i]->getTransparency()) { + GXSetTevAlphaIn(GXTevStageID(i), GX_CA_APREV, GX_CA_TEXA, GX_CA_KONST, GX_CA_ZERO); + } else { + GXSetTevAlphaIn(GXTevStageID(i), GX_CA_APREV, GX_CA_A2, GX_CA_KONST, GX_CA_ZERO); + } + + GXSetTevColorOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, + GX_TEVPREV); + GXSetTevAlphaOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, + GX_TEVPREV); + } + + if (mBlack != 0 || mWhite != 0xFFFFFFFF) { + GXSetTevOrder(GXTevStageID(i), GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL); + GXSetTevColor(GX_TEVREG0, mBlack); + GXSetTevColor(GX_TEVREG1, mWhite); + GXSetTevColorIn(GXTevStageID(i), GX_CC_C0, GX_CC_C1, GX_CC_CPREV, GX_CC_ZERO); + GXSetTevAlphaIn(GXTevStageID(i), GX_CA_A0, GX_CA_A1, GX_CA_APREV, GX_CA_ZERO); + GXSetTevColorOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, + GX_TEVPREV); + GXSetTevAlphaOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, + GX_TEVPREV); + i++; + } + + if (mColorAlpha != 0xFF || mCornerColor[0] != 0xFFFFFFFF || mCornerColor[1] != 0xFFFFFFFF || + mCornerColor[2] != 0xFFFFFFFF || mCornerColor[3] != 0xFFFFFFFF) + { + GXSetTevOrder(GXTevStageID(i), GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetTevColorIn(GXTevStageID(i), GX_CC_ZERO, GX_CC_CPREV, GX_CC_RASC, GX_CC_ZERO); + GXSetTevAlphaIn(GXTevStageID(i), GX_CA_ZERO, GX_CA_APREV, GX_CA_RASA, GX_CA_ZERO); + GXSetTevColorOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, + GX_TEVPREV); + GXSetTevAlphaOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, + GX_TEVPREV); + i++; + } + + GXSetNumTevStages(u8(i)); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); + + for (i = 0; i < mTextureNum; i++) { + GXSetTexCoordGen(GXTexCoordID(i), GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); + } + + GXSetNumChans(1); + GXSetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, + GX_AF_NONE); + GXSetNumIndStages(0); + + for (int i = GX_TEVSTAGE0; i < GX_MAX_TEVSTAGE; i++) { + GXSetTevDirect((GXTevStageID)i); + } +} + +/* 802FEA60-802FEA74 2F93A0 0014+00 1/1 0/0 0/0 .text swap__10J2DPictureFRfRf */ +void J2DPicture::swap(f32& lhs, f32& rhs) { + f32 tmp = lhs; + lhs = rhs; + rhs = tmp; +} + +/* 802FEA74-802FEA9C 2F93B4 0028+00 1/0 0/0 0/0 .text setBlendColorRatio__10J2DPictureFff + */ +void J2DPicture::setBlendColorRatio(f32 param_0, f32 param_1) { + field_0x11c[0] = param_0; + field_0x11c[1] = param_1; + setBlendKonstColor(); +} + +/* 802FEA9C-802FEAC4 2F93DC 0028+00 1/0 0/0 0/0 .text setBlendAlphaRatio__10J2DPictureFff + */ +void J2DPicture::setBlendAlphaRatio(f32 param_0, f32 param_1) { + field_0x124[0] = param_0; + field_0x124[1] = param_1; + setBlendKonstAlpha(); +} + +/* ############################################################################################## */ +/* 80456278-8045627C 004878 0004+00 2/2 0/0 0/0 .sdata2 @2758 */ +SECTION_SDATA2 static f32 lit_2758 = 255.0f; + +/* 802FEAC4-802FEB94 2F9404 00D0+00 4/4 0/0 0/0 .text setBlendKonstColor__10J2DPictureFv + */ +void J2DPicture::setBlendKonstColor() { + int uvar3 = 0; + for (u8 i = 1; i < mTextureNum; i++) { + f32 tmp = 0.0f; + for (u8 j = 0; j < i; j++) { + tmp += field_0x11c[j]; + } + + f32 tmp2 = tmp + field_0x11c[i]; + if (tmp2 != 0.0f) { + // probably fake match but idk whats happening here + uvar3 |= (u8)(255.0f * (1.0f - tmp / tmp2)) << (i - 1) * 8; + } + } + mBlendKonstColor = uvar3; +} + + +/* 802FEB94-802FEC64 2F94D4 00D0+00 4/4 0/0 0/0 .text setBlendKonstAlpha__10J2DPictureFv + */ +void J2DPicture::setBlendKonstAlpha() { + int uvar3 = 0; + for (u8 i = 1; i < mTextureNum; i++) { + f32 tmp = 0.0f; + for (u8 j = 0; j < i; j++) { + tmp += field_0x124[j]; + } + + f32 tmp2 = tmp + field_0x124[i]; + if (tmp2 != 0.0f) { + // probably fake match but idk whats happening here + uvar3 |= (u8)(255.0f * (1.0f - tmp / tmp2)) << (i - 1) * 8; + } + } + mBlendKonstAlpha = uvar3; +} + + +/* 802FEC64-802FED44 2F95A4 00E0+00 3/3 0/0 0/0 .text + * getNewColor__10J2DPictureFPQ28JUtility6TColor */ +void J2DPicture::getNewColor(JUtility::TColor* param_0) { + param_0[0] = mCornerColor[0]; + param_0[1] = mCornerColor[1]; + param_0[2] = mCornerColor[2]; + param_0[3] = mCornerColor[3]; + + if (mColorAlpha != 0xFF) { + param_0[0].a = (param_0[0].a * mColorAlpha) / 0xFF; + param_0[1].a = (param_0[1].a * mColorAlpha) / 0xFF; + param_0[2].a = (param_0[2].a * mColorAlpha) / 0xFF; + param_0[3].a = (param_0[3].a * mColorAlpha) / 0xFF; + } +} + +/* 802FED44-802FED84 2F9684 0040+00 4/4 0/0 0/0 .text + * setTexCoord__10J2DPictureFPC10JUTTexture10J2DBinding9J2DMirrorb */ +void J2DPicture::setTexCoord(JUTTexture const* param_0, J2DBinding param_1, J2DMirror param_2, + bool param_3) { + setTexCoord(&field_0x10a[0], param_0, param_1, param_2, param_3); +} + +/* ############################################################################################## */ +/* 8045627C-80456280 00487C 0004+00 1/1 0/0 0/0 .sdata2 @2933 */ +SECTION_SDATA2 static f32 lit_2933 = 0.5f; + +/* 802FED84-802FF09C 2F96C4 0318+00 2/2 0/0 0/0 .text + * setTexCoord__10J2DPictureFPQ29JGeometry8TVec2<s>PC10JUTTexture10J2DBinding9J2DMirrorb */ +void J2DPicture::setTexCoord(JGeometry::TVec2<s16>* param_0, JUTTexture const* param_1, + J2DBinding binding, J2DMirror mirror, bool rotate90) { + bool bindLeft; + bool bindRight; + bool bindTop; + bool bindBottom; + + if (!rotate90) { + if (mirror & J2DMirror_X) + bindLeft = binding & J2DBind_Right; + else + bindLeft = binding & J2DBind_Left; + + if (mirror & J2DMirror_X) + bindRight = binding & J2DBind_Left; + else + bindRight = binding & J2DBind_Right; + + if (mirror & J2DMirror_Y) + bindTop = binding & J2DBind_Bottom; + else + bindTop = binding & J2DBind_Top; + + if (mirror & J2DMirror_Y) + bindBottom = binding & J2DBind_Top; + else + bindBottom = binding & J2DBind_Bottom; + } else { + if (mirror & J2DMirror_X) + bindLeft = binding & J2DBind_Bottom; + else + bindLeft = binding & J2DBind_Top; + + if (mirror & J2DMirror_X) + bindRight = binding & J2DBind_Top; + else + bindRight = binding & J2DBind_Bottom; + + if (mirror & J2DMirror_Y) + bindTop = binding & J2DBind_Left; + else + bindTop = binding & J2DBind_Right; + + if (mirror & J2DMirror_Y) + bindBottom = binding & J2DBind_Right; + else + bindBottom = binding & J2DBind_Left; + } + + f32 rectWidth; + f32 rectHeight; + + rectWidth = !rotate90 ? getWidth() : getHeight(); + rectHeight = !rotate90 ? getHeight() : getWidth(); + + f32 texWidth; + f32 texHeight; + if (param_1 == NULL) { + texWidth = rectWidth; + texHeight = rectHeight; + } else { + texWidth = param_1->getWidth(); + texHeight = param_1->getHeight(); + } + + f32 s0, t0, s1, t1; + if (bindLeft) { + s0 = 0.0f; + s1 = bindRight ? 1.0f : (rectWidth / texWidth); + } else if (bindRight) { + s0 = 1.0f - (rectWidth / texWidth); + s1 = 1.0f; + } else { + s0 = 0.5f - (rectWidth / texWidth) / 2.0f; + s1 = 0.5f + (rectWidth / texWidth) / 2.0f; + } + + if (bindTop) { + t0 = 0.0f; + t1 = bindBottom ? 1.0f : (rectHeight / texHeight); + } else if (bindBottom) { + t0 = 1.0f - (rectHeight / texHeight); + t1 = 1.0f; + } else { + t0 = 0.5f - (rectHeight / texHeight) / 2.0f; + t1 = 0.5f + (rectHeight / texHeight) / 2.0f; + } + + if (mirror & J2DMirror_X) { + swap(s0, s1); + } + if (mirror & J2DMirror_Y) { + swap(t0, t1); + } + + s16 temp_r27 = J2DCast_F32_to_S16(s0, 8); + s16 temp_r28 = J2DCast_F32_to_S16(s1, 8); + s16 temp_r30 = J2DCast_F32_to_S16(t0, 8); + s16 temp_r31 = J2DCast_F32_to_S16(t1, 8); + + if (!rotate90) { + param_0[0].set(temp_r27, temp_r30); + param_0[1].set(temp_r28, temp_r30); + param_0[2].set(temp_r27, temp_r31); + param_0[3].set(temp_r28, temp_r31); + } else { + param_0[0].set(temp_r27, temp_r31); + param_0[1].set(temp_r27, temp_r30); + param_0[2].set(temp_r28, temp_r31); + param_0[3].set(temp_r28, temp_r30); + } +} + + +/* 802FF09C-802FF100 2F99DC 0064+00 1/0 0/0 0/0 .text isUsed__10J2DPictureFPC7ResTIMG */ +bool J2DPicture::isUsed(ResTIMG const* param_0) { + for (u8 i = 0; i < mTextureNum; i++) { + if (mTexture[i] != NULL && mTexture[i]->getTexInfo() == param_0) { + return true; + } + } + + return J2DPane::isUsed(param_0); +} + +/* 802FF100-802FF1D0 2F9A40 00D0+00 1/0 0/0 0/0 .text getUsableTlut__10J2DPictureFUc */ +u8 J2DPicture::getUsableTlut(u8 param_0) { + u8 var_r8 = 0; + + for (u8 i = 0; i < mTextureNum; i++) { + if (i != param_0 && mTexture[i] != NULL) { + const ResTIMG* img = mTexture[i]->getTexInfo(); + + if (img != NULL && img->indexTexture != 0) { + int name = mTexture[i]->getTlutName(); + int var_r0 = name >= GX_MAX_TLUT ? GX_MAX_TLUT : GX_TLUT0; + + u8 temp_r0 = name - var_r0; + if (temp_r0 < 2) { + var_r8 |= (1 << temp_r0); + } + } + } + } + + u8 var_r26 = 0; + for (u8 i = 0; i < 2; i++) { + if (!(var_r8 & (1 << i))) { + var_r26 = i; + break; + } + } + + return var_r26; +} + +/* 802FF1D0-802FF204 2F9B10 0034+00 1/1 1/1 0/0 .text getTlutID__10J2DPictureFPC7ResTIMGUc */ +GXTlut J2DPicture::getTlutID(ResTIMG const* img, u8 param_1) { + if (img->numColors > 256) { + return (GXTlut)((param_1 % 4) + 0x10); + } + + return (GXTlut)param_1; +} + +/* 802FF204-802FF208 2F9B44 0004+00 5/5 1/1 0/0 .text __ct__Q29JGeometry8TVec2<s>Fv */ +extern "C" void func_802FF204(void* _this) { + /* empty function */ +} + +/* 802FF208-802FF238 2F9B48 0030+00 1/0 0/0 0/0 .text append__10J2DPictureFP10JUTTexturef + */ +bool J2DPicture::append(JUTTexture* param_0, f32 param_1) { + return insert(param_0, mTextureNum, param_1); +} + +/* 802FF238-802FF268 2F9B78 0030+00 1/0 0/0 0/0 .text + * append__10J2DPictureFPC7ResTIMGP10JUTPalettef */ +bool J2DPicture::append(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) { + return insert(param_0, param_1, mTextureNum, param_2); +} + +/* 802FF268-802FF29C 2F9BA8 0034+00 1/0 0/0 0/0 .text load__10J2DPictureFUc */ +void J2DPicture::load(u8 param_0) { + load((_GXTexMapID)param_0, param_0); +} + +/* 802FF29C-802FF2E8 2F9BDC 004C+00 1/0 0/0 0/0 .text load__10J2DPictureF11_GXTexMapIDUc + */ +void J2DPicture::load(_GXTexMapID param_0, u8 param_1) { + if (param_1 < mTextureNum && param_1 < 2 && mTexture[param_1] != NULL) { + mTexture[param_1]->load(param_0); + } +} + +/* 802FF2E8-802FF2F0 2F9C28 0008+00 1/0 1/0 0/0 .text getTypeID__10J2DPictureCFv */ +u16 J2DPicture::getTypeID() const { + return 18; +} + +/* 802FF2F0-802FF320 2F9C30 0030+00 1/0 0/0 0/0 .text append__10J2DPictureFPCcP10JUTPalettef */ +bool J2DPicture::append(char const* param_0, JUTPalette* param_1, f32 param_2) { + return insert(param_0, param_1, mTextureNum, param_2); +} + +/* 802FF320-802FF350 2F9C60 0030+00 1/0 0/0 0/0 .text prepend__10J2DPictureFP10JUTTexturef */ +void J2DPicture::prepend(JUTTexture* param_0, f32 param_1) { + insert(param_0, 0, param_1); +} + +/* 802FF350-802FF380 2F9C90 0030+00 1/0 0/0 0/0 .text prepend__10J2DPictureFPCcP10JUTPalettef */ +void J2DPicture::prepend(char const* param_0, JUTPalette* param_1, f32 param_2) { + insert(param_0, param_1, 0, param_2); +} + +/* 802FF380-802FF3B0 2F9CC0 0030+00 1/0 0/0 0/0 .text prepend__10J2DPictureFPCcf */ +void J2DPicture::prepend(char const* param_0, f32 param_1) { + insert(param_0, 0, param_1); +} + +/* 802FF3B0-802FF3E0 2F9CF0 0030+00 1/0 0/0 0/0 .text + * prepend__10J2DPictureFPC7ResTIMGP10JUTPalettef */ +void J2DPicture::prepend(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) { + insert(param_0, param_1, 0, param_2); +} + +/* 802FF3E0-802FF410 2F9D20 0030+00 1/0 0/0 0/0 .text prepend__10J2DPictureFPC7ResTIMGf + */ +void J2DPicture::prepend(ResTIMG const* param_0, f32 param_1) { + insert(param_0, 0, param_1); +} + +/* 802FF410-802FF448 2F9D50 0038+00 1/0 0/0 0/0 .text remove__10J2DPictureFv */ +bool J2DPicture::remove() { + return remove(mTextureNum - 1); +} + +/* 802FF448-802FF4E0 2F9D88 0098+00 1/0 0/0 0/0 .text draw__10J2DPictureFffUcbbb */ +void J2DPicture::draw(f32 param_0, f32 param_1, u8 param_2, bool param_3, bool param_4, + bool param_5) { + if (param_2 < mTextureNum && mTexture[param_2] != NULL) { + draw(param_0, param_1, mTexture[param_2]->getWidth(), mTexture[param_2]->getHeight(), + param_3, param_4, param_5); + } +} + + +/* 802FF4E0-802FF524 2F9E20 0044+00 1/0 0/0 0/0 .text draw__10J2DPictureFffbbb */ +void J2DPicture::draw(f32 param_0, f32 param_1, bool param_2, bool param_3, bool param_4) { + draw(param_0, param_1, 0, param_2, param_3, param_4); +} + +/* 802FF524-802FF588 2F9E64 0064+00 1/0 0/0 0/0 .text drawOut__10J2DPictureFffffffff */ +void J2DPicture::drawOut(f32 param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, + f32 param_5, f32 param_6, f32 param_7) { + drawOut(JGeometry::TBox2<f32>(param_0, param_1, param_0 + param_2, param_1 + param_3), + JGeometry::TBox2<f32>(param_4, param_5, param_4 + param_6, param_5 + param_7)); +} + +/* 802FF588-802FF634 2F9EC8 00AC+00 1/0 0/0 0/0 .text drawOut__10J2DPictureFffffff */ +void J2DPicture::drawOut(f32 param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, + f32 param_5) { + if (mTexture[0] != NULL) { + drawOut(JGeometry::TBox2<f32>(param_0, param_1, param_0 + param_2, param_1 + param_3), + JGeometry::TBox2<f32>(param_4, param_5, param_4 + mTexture[0]->getWidth(), + param_5 + mTexture[0]->getHeight())); + } +} + + +/* 802FF634-802FF63C 2F9F74 0008+00 1/0 0/0 0/0 .text getTextureCount__10J2DPictureCFv */ +u8 J2DPicture::getTextureCount() const { + return mTextureNum; +} + +/* 802FF63C-802FF65C 2F9F7C 0020+00 1/0 0/0 0/0 .text isUsed__10J2DPictureFPC7ResFONT */ +bool J2DPicture::isUsed(ResFONT const* param_0) { + return J2DPane::isUsed(param_0); +} + +/* 802FF65C-802FF660 2F9F9C 0004+00 1/0 0/0 0/0 .text rewriteAlpha__10J2DPictureFv */ +void J2DPicture::rewriteAlpha() { + /* empty function */ +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DPictureEx.cpp b/src/JSystem/J2DGraph/J2DPictureEx.cpp new file mode 100644 index 0000000000..3a3266fd75 --- /dev/null +++ b/src/JSystem/J2DGraph/J2DPictureEx.cpp @@ -0,0 +1,1094 @@ +// +// Generated By: dol2asm +// Translation Unit: J2DPictureEx +// + +#include "JSystem/J2DGraph/J2DPictureEx.h" +#include "JSystem/J2DGraph/J2DMaterial.h" +#include "JSystem/J2DGraph/J2DScreen.h" +#include "dol2asm.h" +#include "dolphin/types.h" + +// +// Forward References: +// + +extern "C" void initiate__12J2DPictureExFPC7ResTIMGPC7ResTLUT(); +extern "C" void __ct__12J2DPictureExFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial(); +extern "C" void __dt__12J2DPictureExFv(); +extern "C" void prepareTexture__12J2DPictureExFUc(); +extern "C" void drawSelf__12J2DPictureExFffPA3_A4_f(); +extern "C" void drawFullSet__12J2DPictureExFffffPA3_A4_f(); +extern "C" void drawTexCoord__12J2DPictureExFffffssssssssPA3_A4_f(); +extern "C" void append__12J2DPictureExFPC7ResTIMGP10JUTPalettef(); +extern "C" void append__12J2DPictureExFPCcP10JUTPalettef(); +extern "C" void append__12J2DPictureExFP10JUTTexturef(); +extern "C" void insert__12J2DPictureExFPC7ResTIMGP10JUTPaletteUcf(); +extern "C" void insert__12J2DPictureExFPCcP10JUTPaletteUcf(); +extern "C" void insert__12J2DPictureExFP10JUTTextureUcf(); +extern "C" void insertCommon__12J2DPictureExFUcf(); +extern "C" void isInsert__12J2DPictureExCFUc(); +extern "C" void remove__12J2DPictureExFUc(); +extern "C" void remove__12J2DPictureExFv(); +extern "C" void remove__12J2DPictureExFP10JUTTexture(); +extern "C" void isRemove__12J2DPictureExCFUc(); +extern "C" void draw__12J2DPictureExFffUcbbb(); +extern "C" void draw__12J2DPictureExFffffbbb(); +extern "C" void drawOut__12J2DPictureExFffffff(); +extern "C" void func_80304EF0(); +extern "C" void load__12J2DPictureExF11_GXTexMapIDUc(); +extern "C" void setTevOrder__12J2DPictureExFUcUcb(); +extern "C" void setTevStage__12J2DPictureExFUcUcb(); +extern "C" void setStage__12J2DPictureExFP11J2DTevStageQ212J2DPictureEx10stage_enum(); +extern "C" void setTevKColor__12J2DPictureExFUc(); +extern "C" void setTevKColorSel__12J2DPictureExFUc(); +extern "C" void setTevKAlphaSel__12J2DPictureExFUc(); +extern "C" void shiftSetBlendRatio__12J2DPictureExFUcfbb(); +extern "C" void setBlendColorRatio__12J2DPictureExFff(); +extern "C" void setBlendAlphaRatio__12J2DPictureExFff(); +extern "C" void changeTexture__12J2DPictureExFPC7ResTIMGUc(); +extern "C" void changeTexture__12J2DPictureExFPCcUc(); +extern "C" void changeTexture__12J2DPictureExFPC7ResTIMGUcP10JUTPalette(); +extern "C" void changeTexture__12J2DPictureExFPCcUcP10JUTPalette(); +extern "C" void getTexture__12J2DPictureExCFUc(); +extern "C" void getTextureCount__12J2DPictureExCFv(); +extern "C" void setBlack__12J2DPictureExFQ28JUtility6TColor(); +extern "C" void setWhite__12J2DPictureExFQ28JUtility6TColor(); +extern "C" void setBlackWhite__12J2DPictureExFQ28JUtility6TColorQ28JUtility6TColor(); +extern "C" void getBlackWhite__12J2DPictureExCFPQ28JUtility6TColorPQ28JUtility6TColor(); +extern "C" void isSetBlackWhite__12J2DPictureExCFQ28JUtility6TColorQ28JUtility6TColor(); +extern "C" void getBlack__12J2DPictureExCFv(); +extern "C" void getWhite__12J2DPictureExCFv(); +extern "C" void setAlpha__12J2DPictureExFUc(); +extern "C" void setCullBack__12J2DPictureExF11_GXCullMode(); +extern "C" void rewriteAlpha__12J2DPictureExFv(); +extern "C" void isUsed__12J2DPictureExFPC7ResTIMG(); +extern "C" void setAnimation__12J2DPictureExFP11J2DAnmColor(); +extern "C" void setAnimation__12J2DPictureExFP19J2DAnmTextureSRTKey(); +extern "C" void setAnimation__12J2DPictureExFP16J2DAnmTexPattern(); +extern "C" void setAnimation__12J2DPictureExFP15J2DAnmTevRegKey(); +extern "C" void setAnimation__12J2DPictureExFP20J2DAnmVisibilityFull(); +extern "C" void setAnimation__12J2DPictureExFP14J2DAnmVtxColor(); +extern "C" void animationPane__12J2DPictureExFPC15J2DAnmTransform(); +extern "C" void getUsableTlut__12J2DPictureExFUc(); +extern "C" void append__12J2DPictureExFPC7ResTIMGf(); +extern "C" void append__12J2DPictureExFPCcf(); +extern "C" void prepend__12J2DPictureExFP10JUTTexturef(); +extern "C" void prepend__12J2DPictureExFPCcP10JUTPalettef(); +extern "C" void prepend__12J2DPictureExFPCcf(); +extern "C" void prepend__12J2DPictureExFPC7ResTIMGP10JUTPalettef(); +extern "C" void prepend__12J2DPictureExFPC7ResTIMGf(); +extern "C" void insert__12J2DPictureExFPCcUcf(); +extern "C" void insert__12J2DPictureExFPC7ResTIMGUcf(); +extern "C" void draw__12J2DPictureExFffbbb(); +extern "C" void drawOut__12J2DPictureExFffffffff(); +extern "C" void load__12J2DPictureExFUc(); +extern "C" void setCullBack__12J2DPictureExFb(); +extern "C" void isUsed__12J2DPictureExFPC7ResFONT(); +extern "C" void setAnimation__12J2DPictureExFP10J2DAnmBase(); + +// +// External References: +// + +extern "C" void setBlendRatio__10J2DPictureFff(); +extern "C" void calcMtx__7J2DPaneFv(); +extern "C" void makeMatrix__7J2DPaneFff(); +extern "C" void getMaterial__12J2DPictureExCFv(); +extern "C" void setAnimation__12J2DPictureExFP15J2DAnmTransform(); +extern "C" void __dl__FPv(); +extern "C" void read__14JSUInputStreamFPvl(); +extern "C" void peek__20JSURandomInputStreamFPvl(); +extern "C" void seek__20JSURandomInputStreamFl17JSUStreamSeekFrom(); +extern "C" void storeTIMG__10JUTTextureFPC7ResTIMGUc(); +extern "C" void storeTIMG__10JUTTextureFPC7ResTIMGP10JUTPalette7_GXTlut(); +extern "C" void setGX__11J2DMaterialFv(); +extern "C" void setAnimation__11J2DMaterialFP11J2DAnmColor(); +extern "C" void setAnimation__11J2DMaterialFP19J2DAnmTextureSRTKey(); +extern "C" void setAnimation__11J2DMaterialFP16J2DAnmTexPattern(); +extern "C" void setAnimation__11J2DMaterialFP15J2DAnmTevRegKey(); +extern "C" void setTexMtx__14J2DTexGenBlockFUlR9J2DTexMtx(); +extern "C" void move__7J2DPaneFff(); +extern "C" void add__7J2DPaneFff(); +extern "C" void resize__7J2DPaneFff(); +extern "C" void search__7J2DPaneFUx(); +extern "C" void searchUserInfo__7J2DPaneFUx(); +extern "C" void isUsed__7J2DPaneFPC7ResTIMG(); +extern "C" void isUsed__7J2DPaneFPC7ResFONT(); +extern "C" void makeMatrix__7J2DPaneFffff(); +extern "C" void setCullBack__7J2DPaneF11_GXCullMode(); +extern "C" void makePaneExStream__7J2DPaneFP7J2DPaneP20JSURandomInputStream(); +extern "C" void setAnimation__7J2DPaneFP10J2DAnmBase(); +extern "C" void clearAnmTransform__7J2DPaneFv(); +extern "C" void animationTransform__7J2DPaneFPC15J2DAnmTransform(); +extern "C" void setVisibileAnimation__7J2DPaneFP20J2DAnmVisibilityFull(); +extern "C" void setVtxColorAnimation__7J2DPaneFP14J2DAnmVtxColor(); +extern "C" void animationPane__7J2DPaneFPC15J2DAnmTransform(); +extern "C" void setAnimationVF__7J2DPaneFP20J2DAnmVisibilityFull(); +extern "C" void setAnimationVC__7J2DPaneFP14J2DAnmVtxColor(); +extern "C" void setConnectParent__7J2DPaneFb(); +extern "C" void update__7J2DPaneFv(); +extern "C" void getNameResource__9J2DScreenFPCc(); +extern "C" void __ct__10J2DPictureFv(); +extern "C" void __dt__10J2DPictureFv(); +extern "C" void drawSelf__10J2DPictureFff(); +extern "C" void getTlutID__10J2DPictureFPC7ResTIMGUc(); +extern "C" void func_802FF204(void* _this); +extern "C" s32 getTypeID__10J2DPictureCFv(); +extern "C" void getVisibility__20J2DAnmVisibilityFullCFUsPUc(); +extern "C" void __construct_array(); +extern "C" void _savegpr_23(); +extern "C" void _savegpr_25(); +extern "C" void _savegpr_26(); +extern "C" void _savegpr_27(); +extern "C" void _savegpr_28(); +extern "C" void _savegpr_29(); +extern "C" void _restgpr_23(); +extern "C" void _restgpr_25(); +extern "C" void _restgpr_26(); +extern "C" void _restgpr_27(); +extern "C" void _restgpr_28(); +extern "C" void _restgpr_29(); + +// +// Declarations: +// + +/* ############################################################################################## */ +/* 804562C0-804562C4 0048C0 0004+00 7/7 0/0 0/0 .sdata2 @1517 */ +SECTION_SDATA2 static f32 lit_1517 = 1.0f; + +/* 80303640-803036EC 2FDF80 00AC+00 1/0 0/0 0/0 .text + * initiate__12J2DPictureExFPC7ResTIMGPC7ResTLUT */ +void J2DPictureEx::initiate(ResTIMG const* param_0, ResTLUT const* param_1) { + J2DTexGenBlock* this_00 = mMaterial->getTexGenBlock(); + if (this_00->getTexGenNum() == 0 && append(param_0, 1.0f) && param_1 != NULL) { + if (mMaterial->getTevBlock()->getPalette(0) == NULL) { + mMaterial->getTevBlock()->setPalette(0, param_1); + } + } +} + + +/* ############################################################################################## */ +/* 803CD4B8-803CD608 02A5D8 014C+04 2/2 0/0 0/0 .data __vt__12J2DPictureEx */ +SECTION_DATA extern void* __vt__12J2DPictureEx[83 + 1 /* padding */] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)__dt__12J2DPictureExFv, + (void*)getTypeID__10J2DPictureCFv, + (void*)move__7J2DPaneFff, + (void*)add__7J2DPaneFff, + (void*)resize__7J2DPaneFff, + (void*)setCullBack__12J2DPictureExFb, + (void*)setCullBack__12J2DPictureExF11_GXCullMode, + (void*)setAlpha__12J2DPictureExFUc, + (void*)setConnectParent__7J2DPaneFb, + (void*)calcMtx__7J2DPaneFv, + (void*)update__7J2DPaneFv, + (void*)drawSelf__10J2DPictureFff, + (void*)drawSelf__12J2DPictureExFffPA3_A4_f, + (void*)search__7J2DPaneFUx, + (void*)searchUserInfo__7J2DPaneFUx, + (void*)makeMatrix__7J2DPaneFff, + (void*)makeMatrix__7J2DPaneFffff, + (void*)isUsed__12J2DPictureExFPC7ResTIMG, + (void*)isUsed__12J2DPictureExFPC7ResFONT, + (void*)clearAnmTransform__7J2DPaneFv, + (void*)rewriteAlpha__12J2DPictureExFv, + (void*)setAnimation__12J2DPictureExFP10J2DAnmBase, + (void*)setAnimation__12J2DPictureExFP15J2DAnmTransform, + (void*)setAnimation__12J2DPictureExFP11J2DAnmColor, + (void*)setAnimation__12J2DPictureExFP16J2DAnmTexPattern, + (void*)setAnimation__12J2DPictureExFP19J2DAnmTextureSRTKey, + (void*)setAnimation__12J2DPictureExFP15J2DAnmTevRegKey, + (void*)setAnimation__12J2DPictureExFP20J2DAnmVisibilityFull, + (void*)setAnimation__12J2DPictureExFP14J2DAnmVtxColor, + (void*)animationTransform__7J2DPaneFPC15J2DAnmTransform, + (void*)setVisibileAnimation__7J2DPaneFP20J2DAnmVisibilityFull, + (void*)setAnimationVF__7J2DPaneFP20J2DAnmVisibilityFull, + (void*)setVtxColorAnimation__7J2DPaneFP14J2DAnmVtxColor, + (void*)setAnimationVC__7J2DPaneFP14J2DAnmVtxColor, + (void*)animationPane__12J2DPictureExFPC15J2DAnmTransform, + (void*)initiate__12J2DPictureExFPC7ResTIMGPC7ResTLUT, + (void*)prepareTexture__12J2DPictureExFUc, + (void*)append__12J2DPictureExFPC7ResTIMGf, + (void*)append__12J2DPictureExFPC7ResTIMGP10JUTPalettef, + (void*)append__12J2DPictureExFPCcf, + (void*)append__12J2DPictureExFPCcP10JUTPalettef, + (void*)append__12J2DPictureExFP10JUTTexturef, + (void*)prepend__12J2DPictureExFPC7ResTIMGf, + (void*)prepend__12J2DPictureExFPC7ResTIMGP10JUTPalettef, + (void*)prepend__12J2DPictureExFPCcf, + (void*)prepend__12J2DPictureExFPCcP10JUTPalettef, + (void*)prepend__12J2DPictureExFP10JUTTexturef, + (void*)insert__12J2DPictureExFPC7ResTIMGUcf, + (void*)insert__12J2DPictureExFPC7ResTIMGP10JUTPaletteUcf, + (void*)insert__12J2DPictureExFPCcUcf, + (void*)insert__12J2DPictureExFPCcP10JUTPaletteUcf, + (void*)insert__12J2DPictureExFP10JUTTextureUcf, + (void*)remove__12J2DPictureExFUc, + (void*)remove__12J2DPictureExFv, + (void*)remove__12J2DPictureExFP10JUTTexture, + (void*)draw__12J2DPictureExFffbbb, + (void*)draw__12J2DPictureExFffUcbbb, + (void*)draw__12J2DPictureExFffffbbb, + (void*)drawOut__12J2DPictureExFffffff, + (void*)drawOut__12J2DPictureExFffffffff, + (void*)func_80304EF0, + (void*)load__12J2DPictureExF11_GXTexMapIDUc, + (void*)load__12J2DPictureExFUc, + (void*)setBlendRatio__10J2DPictureFff, + (void*)setBlendColorRatio__12J2DPictureExFff, + (void*)setBlendAlphaRatio__12J2DPictureExFff, + (void*)changeTexture__12J2DPictureExFPC7ResTIMGUc, + (void*)changeTexture__12J2DPictureExFPCcUc, + (void*)changeTexture__12J2DPictureExFPC7ResTIMGUcP10JUTPalette, + (void*)changeTexture__12J2DPictureExFPCcUcP10JUTPalette, + (void*)getTexture__12J2DPictureExCFUc, + (void*)getTextureCount__12J2DPictureExCFv, + (void*)setBlack__12J2DPictureExFQ28JUtility6TColor, + (void*)setWhite__12J2DPictureExFQ28JUtility6TColor, + (void*)setBlackWhite__12J2DPictureExFQ28JUtility6TColorQ28JUtility6TColor, + (void*)getBlack__12J2DPictureExCFv, + (void*)getWhite__12J2DPictureExCFv, + (void*)getMaterial__12J2DPictureExCFv, + (void*)drawFullSet__12J2DPictureExFffffPA3_A4_f, + (void*)drawTexCoord__12J2DPictureExFffffssssssssPA3_A4_f, + (void*)getUsableTlut__12J2DPictureExFUc, + /* padding */ + NULL, +}; + +/* 803036EC-8030393C 2FE02C 0250+00 0/0 1/1 0/0 .text + * __ct__12J2DPictureExFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial */ +// Issue with TColor +#ifdef NONMATCHING +J2DPictureEx::J2DPictureEx(J2DPane* param_0, JSURandomInputStream* param_1, u32 param_2, + J2DMaterial* param_3) { + field_0x194 = 0; + field_0x198 = 0; + s32 origPosition = param_1->getPosition(); + u32 local_68[2]; + param_1->read(local_68, 8); + mKind = local_68[0]; + s32 iVar2 = param_1->getPosition(); + u32 auStack_70[2]; + param_1->peek(auStack_70, 8); + makePaneExStream(param_0, param_1); + param_1->seek(iVar2 + auStack_70[1], JSUStreamSeekFrom_SET); + J2DScrnBlockPictureParameter aJStack_60; + param_1->read(&aJStack_60, sizeof(J2DScrnBlockPictureParameter)); + field_0x154 = aJStack_60.mMaterialNum; + field_0x156 = aJStack_60.field_0x4; + + // Issues with this loop + for (int i = 0; i < 4; i++) { + field_0x158[i] = aJStack_60.field_0x8[i]; + field_0x10a[i] = aJStack_60.field_0x10[i]; + mCornerColor[i] = JUtility::TColor(aJStack_60.mCornerColor[i]); + } + + param_1->seek(origPosition + local_68[1], JSUStreamSeekFrom_SET); + mMaterial = NULL; + if (field_0x156 != 0xffff) { + mMaterial = param_3 + field_0x156; + (param_3 + field_0x156)->field_0x4 = this; + } + field_0x190 = 0; + mAlpha = 0xff; + rewriteAlpha(); + for (int iVar1 = 0; iVar1 < 2; iVar1++) { + field_0x11c[iVar1] = 1.0f; + field_0x124[iVar1] = 1.0f; + } + for (int iVar1 = 0; iVar1 < 6; iVar1++) { + field_0x160[iVar1] = 1.0f; + field_0x178[iVar1] = 1.0f; + } +} +#else +J2DPictureEx::J2DPictureEx(J2DPane* param_0, JSURandomInputStream* param_1, u32 param_2, + J2DMaterial* param_3) { + // NONMATCHING +} +#endif + +/* 8030393C-803039CC 2FE27C 0090+00 1/0 0/0 0/0 .text __dt__12J2DPictureExFv */ +// Needs ctor matched +#ifdef NONMATCHING +J2DPictureEx::~J2DPictureEx() { + if (field_0x190) { + delete mMaterial; + } +} +#else +extern "C" void __dt__12J2DPictureExFv() { + // asm J2DPictureEx::~J2DPictureEx() { + // NONMATCHING +} +#endif + +/* 803039CC-80303AB4 2FE30C 00E8+00 1/0 0/0 0/0 .text prepareTexture__12J2DPictureExFUc + */ +bool J2DPictureEx::prepareTexture(u8 param_0) { + if (!mMaterial->getTevBlock()->prepareTexture(param_0)) { + return false; + } + + for (u8 i = 0; i < param_0; i++) { + J2DTexMtx aJStack_68; + mMaterial->getTexGenBlock()->setTexMtx(i, aJStack_68); + } + return true; +} + +/* 80303AB4-80303B80 2FE3F4 00CC+00 1/0 0/0 0/0 .text drawSelf__12J2DPictureExFffPA3_A4_f + */ +void J2DPictureEx::drawSelf(f32 param_0, f32 param_1, f32 (*param_2)[3][4]) { + if (mMaterial != NULL) { + mMaterial->setGX(); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + drawFullSet(param_0, param_1, getWidth(), getHeight(), param_2); + } +} + +/* 80303B80-80303BDC 2FE4C0 005C+00 1/0 0/0 0/0 .text drawFullSet__12J2DPictureExFffffPA3_A4_f */ +void J2DPictureEx::drawFullSet(f32 param_0, f32 param_1, f32 param_2, f32 param_3, + f32 (*param_4)[3][4]) { + drawTexCoord(mBounds.i.x, mBounds.i.y, param_2, param_3, field_0x10a[0].x, field_0x10a[0].y, + field_0x10a[1].x, field_0x10a[1].y, field_0x10a[2].x, field_0x10a[2].y, + field_0x10a[3].x, field_0x10a[3].y, param_4); +} + +/* ############################################################################################## */ +/* 804562C4-804562C8 0048C4 0004+00 5/5 0/0 0/0 .sdata2 @1784 */ +SECTION_SDATA2 static u8 lit_1784[4] = { + 0x00, + 0x00, + 0x00, + 0x00, +}; + +/* 80303BDC-80303E5C 2FE51C 0280+00 1/0 0/0 0/0 .text + * drawTexCoord__12J2DPictureExFffffssssssssPA3_A4_f */ +void J2DPictureEx::drawTexCoord(f32 param_0, f32 param_1, f32 param_2, f32 param_3, s16 param_4, + s16 param_5, s16 param_6, s16 param_7, s16 param_8, s16 param_9, + s16 param_10, s16 param_11, f32 (*param_12)[3][4]) { + f32 dVar12 = param_0 + param_2; + f32 dVar11 = param_1 + param_3; + Mtx auStack_88; + MTXConcat(*param_12, mGlobalMtx, auStack_88); + if (mMaterial == NULL || mMaterial->isVisible()) { + GXLoadPosMtxImm(auStack_88, 0); + JUtility::TColor TStack_8c = mCornerColor[0]; + JUtility::TColor TStack_90 = mCornerColor[1]; + JUtility::TColor TStack_94 = mCornerColor[2]; + JUtility::TColor TStack_98 = mCornerColor[3]; + if (mMaterial != NULL) { + if (mMaterial->getColorBlock()->getColorChan(1)->getMatSrc() == 1) { + if (mMaterial->getMaterialAlphaCalc() == 1) { + TStack_8c.a = TStack_8c.a * mColorAlpha / 255; + TStack_90.a = TStack_90.a * mColorAlpha / 255; + TStack_94.a = TStack_94.a * mColorAlpha / 255; + TStack_98.a = TStack_98.a * mColorAlpha / 255; + } + } else if (mIsInfluencedAlpha) { + GXSetChanMatColor(GX_ALPHA0, JUtility::TColor(mColorAlpha)); + } + } + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBA4, 8); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + GXPosition3f32(param_0, param_1, 0.0f); + GXColor1u32(TStack_8c); + GXTexCoord2s16(param_4, param_5); + GXPosition3f32(dVar12, param_1, 0.0f); + GXColor1u32(TStack_90); + GXTexCoord2s16(param_6, param_7); + GXPosition3f32(dVar12, dVar11, 0.0f); + GXColor1u32(TStack_98); + GXTexCoord2s16(param_10, param_11); + GXPosition3f32(param_0, dVar11, 0.0f); + GXColor1u32(TStack_94); + GXTexCoord2s16(param_8, param_9); + GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); + } +} + + +/* 80303E5C-80303EA4 2FE79C 0048+00 1/0 0/0 0/0 .text + * append__12J2DPictureExFPC7ResTIMGP10JUTPalettef */ +bool J2DPictureEx::append(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) { + if (mMaterial == NULL) { + return false; + } + + return insert(param_0, param_1, mMaterial->getTexGenBlock()->getTexGenNum(), param_2); +} + +/* 80303EA4-80303EEC 2FE7E4 0048+00 1/0 0/0 0/0 .text append__12J2DPictureExFPCcP10JUTPalettef */ +bool J2DPictureEx::append(char const* param_0, JUTPalette* param_1, f32 param_2) { + if (mMaterial == NULL) { + return false; + } + + return insert(param_0, param_1, mMaterial->getTexGenBlock()->getTexGenNum(), param_2); +} + +/* 80303EEC-80303F34 2FE82C 0048+00 1/0 0/0 0/0 .text append__12J2DPictureExFP10JUTTexturef */ +bool J2DPictureEx::append(JUTTexture* param_0, f32 param_1) { + if (mMaterial == NULL) { + return false; + } + + return insert(param_0, mMaterial->getTexGenBlock()->getTexGenNum(), param_1); +} + +/* 80303F34-80303FD8 2FE874 00A4+00 1/0 0/0 0/0 .text + * insert__12J2DPictureExFPC7ResTIMGP10JUTPaletteUcf */ +bool J2DPictureEx::insert(ResTIMG const* param_0, JUTPalette* param_1, u8 param_2, + f32 param_3) { + if (param_0 == NULL) { + return false; + } + + if (!isInsert(param_2)) { + return false; + } + + insertCommon(param_2, param_3); + mMaterial->getTevBlock()->insertTexture(param_2, param_0, param_1); + return true; +} + +/* 80303FD8-80304048 2FE918 0070+00 1/0 0/0 0/0 .text insert__12J2DPictureExFPCcP10JUTPaletteUcf + */ +bool J2DPictureEx::insert(char const* param_0, JUTPalette* param_1, u8 param_2, f32 param_3) { + ResTIMG const* resource = (ResTIMG const*)J2DScreen::getNameResource(param_0); + return insert(resource, param_1, param_2, param_3); +} + +/* 80304048-803040E4 2FE988 009C+00 1/0 0/0 0/0 .text insert__12J2DPictureExFP10JUTTextureUcf */ +bool J2DPictureEx::insert(JUTTexture* param_0, u8 param_1, f32 param_2) { + if (param_0 == NULL) { + return false; + } + + if (!isInsert(param_1)) { + return false; + } + + insertCommon(param_1, param_2); + mMaterial->getTevBlock()->insertTexture(param_1, param_0); + return true; +} + +/* 803040E4-8030437C 2FEA24 0298+00 2/2 0/0 0/0 .text insertCommon__12J2DPictureExFUcf */ +void J2DPictureEx::insertCommon(u8 param_0, f32 param_1) { + // NONMATCHING +} + +/* 8030437C-8030446C 2FECBC 00F0+00 2/2 0/0 0/0 .text isInsert__12J2DPictureExCFUc */ +bool J2DPictureEx::isInsert(u8 param_0) const { + if (mMaterial == NULL) { + return false; + } + if (mMaterial->getTevBlock() == NULL) { + return false; + } + + u8 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum(); + if (texGenNum >= 8 || param_0 >= 8 || param_0 > texGenNum) { + return false; + } + u8 bVar5 = mMaterial->getTevBlock()->getMaxStage(); + if (bVar5 <= 2 && texGenNum != 0) { + return false; + } + + if (bVar5 == mMaterial->getTevBlock()->getTevStageNum() && texGenNum != 0) { + return false; + } + + return true; +} + +/* 8030446C-80304608 2FEDAC 019C+00 1/0 0/0 0/0 .text remove__12J2DPictureExFUc */ +bool J2DPictureEx::remove(u8 param_0) { + // NONMATCHING +} + +/* 80304608-8030466C 2FEF48 0064+00 1/0 0/0 0/0 .text remove__12J2DPictureExFv */ +bool J2DPictureEx::remove() { + if (mMaterial == NULL) { + return false; + } + + if (mMaterial->getTevBlock() == NULL) { + return false; + } + + u8 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum(); + return remove(texGenNum - 1); +} + +/* 8030466C-80304728 2FEFAC 00BC+00 1/0 0/0 0/0 .text remove__12J2DPictureExFP10JUTTexture */ +bool J2DPictureEx::remove(JUTTexture* param_0) { + if (mMaterial == NULL) { + return false; + } + + if (mMaterial->getTevBlock() == NULL) { + return false; + } + + u8 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum(); + u8 i; + for (i = 0; i < texGenNum; i++) { + if (mMaterial->getTevBlock()->getTexture(i) == param_0) + break; + } + return remove(i); +} + +/* 80304728-8030477C 2FF068 0054+00 1/1 0/0 0/0 .text isRemove__12J2DPictureExCFUc */ +bool J2DPictureEx::isRemove(u8 param_0) const { + if (mMaterial == NULL) { + return false; + } + + if (mMaterial->getTevBlock() == NULL) { + return false; + } + + u8 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum(); + if (texGenNum <= param_0 || texGenNum == 1) { + return false; + } + return true; +} + +/* ############################################################################################## */ +/* 804562C8-804562D0 0048C8 0008+00 2/2 0/0 0/0 .sdata2 @2130 */ +SECTION_SDATA2 static f64 lit_2130 = 4503601774854144.0 /* cast s32 to float */; + +/* 8030477C-80304890 2FF0BC 0114+00 1/0 0/0 0/0 .text draw__12J2DPictureExFffUcbbb */ +void J2DPictureEx::draw(f32 param_0, f32 param_1, u8 param_2, bool param_3, bool param_4, + bool param_5) { + // NONMATCHING +} + +/* 80304890-80304D88 2FF1D0 04F8+00 1/0 0/0 0/0 .text draw__12J2DPictureExFffffbbb */ +void J2DPictureEx::draw(f32 param_0, f32 param_1, f32 param_2, f32 param_3, bool param_4, + bool param_5, bool param_6) { + // NONMATCHING +} + +/* 80304D88-80304EF0 2FF6C8 0168+00 1/0 0/0 0/0 .text drawOut__12J2DPictureExFffffff */ +void J2DPictureEx::drawOut(f32 param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, + f32 param_5) { + // NONMATCHING +} + +/* 80304EF0-80305264 2FF830 0374+00 1/0 0/0 0/0 .text + * drawOut__12J2DPictureExFRCQ29JGeometry8TBox2<f>RCQ29JGeometry8TBox2<f> */ +void J2DPictureEx::drawOut(JGeometry::TBox2<f32> const& param_0, + JGeometry::TBox2<f32> const& param_1) { + // NONMATCHING +} + +/* 80305264-803052AC 2FFBA4 0048+00 1/0 0/0 0/0 .text load__12J2DPictureExF11_GXTexMapIDUc */ +void J2DPictureEx::load(_GXTexMapID param_0, u8 param_1) { + if (mMaterial == NULL) { + return; + } + + if (mMaterial->getTevBlock() == NULL) { + return; + } + + mMaterial->getTevBlock()->loadTexture(param_0, param_1); +} + +/* 803052AC-803053E0 2FFBEC 0134+00 3/3 0/0 0/0 .text setTevOrder__12J2DPictureExFUcUcb + */ +void J2DPictureEx::setTevOrder(u8 param_0, u8 param_1, bool param_2) { + // NONMATCHING +} + +/* 803053E0-80305688 2FFD20 02A8+00 3/3 0/0 0/0 .text setTevStage__12J2DPictureExFUcUcb + */ +void J2DPictureEx::setTevStage(u8 param_0, u8 param_1, bool param_2) { + // NONMATCHING +} + +/* ############################################################################################## */ +/* 803A1D50-803A1D70 02E3B0 0020+00 1/1 0/0 0/0 .rodata @2555 */ +SECTION_RODATA static u8 const lit_2555[32] = { + 0x0F, 0x08, 0x0A, 0x0F, 0x0F, 0x08, 0x0A, 0x0F, 0x0F, 0x08, 0x0E, 0x0F, 0x0F, 0x08, 0x0E, 0x00, + 0x0F, 0x0A, 0x00, 0x0F, 0x02, 0x04, 0x08, 0x0F, 0x02, 0x04, 0x08, 0x0F, 0x02, 0x04, 0x00, 0x0F, +}; +COMPILER_STRIP_GATE(0x803A1D50, &lit_2555); + +/* 80305688-80305928 2FFFC8 02A0+00 1/1 0/0 0/0 .text + * setStage__12J2DPictureExFP11J2DTevStageQ212J2DPictureEx10stage_enum */ +void J2DPictureEx::setStage(J2DTevStage* param_0, J2DPictureEx::stage_enum param_1) { + // NONMATCHING +} + +/* ############################################################################################## */ +/* 804562D0-804562D8 0048D0 0004+04 1/1 0/0 0/0 .sdata2 @2690 */ +SECTION_SDATA2 static f32 lit_2690[1 + 1 /* padding */] = { + 255.0f, + /* padding */ + 0.0f, +}; + +/* 80305928-80305C70 300268 0348+00 5/5 0/0 0/0 .text setTevKColor__12J2DPictureExFUc */ +void J2DPictureEx::setTevKColor(u8 param_0) { + // NONMATCHING +} + +/* 80305C70-80305D18 3005B0 00A8+00 3/3 0/0 0/0 .text setTevKColorSel__12J2DPictureExFUc + */ +void J2DPictureEx::setTevKColorSel(u8 param_0) { + for (u8 i = 0; i < param_0; i++) { + if (i < 4) { + mMaterial->getTevBlock()->setTevKColorSel(i, 31 - 4 * i); + } else { + mMaterial->getTevBlock()->setTevKColorSel(i, 30 - 4 * (i - 4)); + } + } +} + +/* 80305D18-80305DC0 300658 00A8+00 3/3 0/0 0/0 .text setTevKAlphaSel__12J2DPictureExFUc + */ +void J2DPictureEx::setTevKAlphaSel(u8 param_0) { + for (u8 i = 0; i < param_0; i++) { + if (i < 4) { + mMaterial->getTevBlock()->setTevKAlphaSel(i, 29 - 4 * i); + } else { + mMaterial->getTevBlock()->setTevKAlphaSel(i, 28 - 4 * (i - 4)); + } + } +} + +/* 80305DC0-80305ED4 300700 0114+00 2/2 0/0 0/0 .text shiftSetBlendRatio__12J2DPictureExFUcfbb */ +void J2DPictureEx::shiftSetBlendRatio(u8 param_0, f32 param_1, bool param_2, bool param_3) { + f32* pJVar4 = param_2 != 0 ? field_0x11c : field_0x124; + f32* local_44 = param_2 != 0 ? field_0x160 : field_0x178; + + if (param_3) { + for (int i = 7; i > param_0; i--) { + if (i > 2) { + local_44[i - 2] = local_44[i - 3]; + } else if (i == 2) { + local_44[0] = pJVar4[1]; + } else { + pJVar4[i] = pJVar4[i - 1]; + } + } + if (param_0 >= 2) { + local_44[param_0 - 2] = param_1; + } else { + pJVar4[param_0] = param_1; + } + } else { + for (int i = param_0 + 1; i < 8; i++) { + if (i > 2) { + local_44[i - 3] = local_44[i - 2]; + } else if (i == 2) { + pJVar4[1] = local_44[0]; + } else { + pJVar4[i - 1] = pJVar4[i]; + } + } + } +} + +/* 80305ED4-80305F34 300814 0060+00 1/0 0/0 0/0 .text setBlendColorRatio__12J2DPictureExFff */ +void J2DPictureEx::setBlendColorRatio(f32 param_0, f32 param_1) { + if (mMaterial == NULL) { + return; + } + + field_0x11c[0] = param_0; + field_0x11c[1] = param_1; + + for (int i = 0; i < 6; i++) { + field_0x160[i] = 1.0f; + } + + setTevKColor(mMaterial->getTexGenBlock()->getTexGenNum()); +} + + +/* 80305F34-80305F94 300874 0060+00 1/0 0/0 0/0 .text setBlendAlphaRatio__12J2DPictureExFff */ +void J2DPictureEx::setBlendAlphaRatio(f32 param_0, f32 param_1) { + if (mMaterial == NULL) { + return; + } + + field_0x124[0] = param_0; + field_0x124[1] = param_1; + + for (int i = 0; i < 6; i++) { + field_0x178[i] = 1.0f; + } + + setTevKColor(mMaterial->getTexGenBlock()->getTexGenNum()); +} + + +/* 80305F94-803060DC 3008D4 0148+00 1/0 0/0 0/0 .text changeTexture__12J2DPictureExFPC7ResTIMGUc + */ +const ResTIMG* J2DPictureEx::changeTexture(ResTIMG const* param_0, u8 param_1) { + // NONMATCHING +} + +/* 803060DC-80306134 300A1C 0058+00 1/0 0/0 0/0 .text changeTexture__12J2DPictureExFPCcUc + */ +const ResTIMG* J2DPictureEx::changeTexture(char const* param_0, u8 param_1) { + ResTIMG const* resource = (ResTIMG const*)J2DScreen::getNameResource(param_0); + return changeTexture(resource, param_1); +} + +/* 80306134-80306298 300A74 0164+00 1/0 0/0 0/0 .text + * changeTexture__12J2DPictureExFPC7ResTIMGUcP10JUTPalette */ +// Issues with param_1 >= bVar5. Maybe some inline min function. +#ifdef NONMATCHING +inline u8 mina(u8 a, u8 b) { + return a > b ? b : a; +} + +const ResTIMG* J2DPictureEx::changeTexture(ResTIMG const* param_0, u8 param_1, JUTPalette* param_2) { + if (mMaterial == NULL || param_0 == NULL) { + return NULL; + } + u32 uVar2 = mMaterial->getTexGenBlock()->getTexGenNum(); + if (param_1 > uVar2) { + return NULL; + } + u8 bVar5 = mMaterial->getTevBlock()->getMaxStage(); + bVar5 = bVar5 > 8 ? 8 : bVar5; + + if (param_1 >= bVar5) { + return NULL; + } + if (param_1 < uVar2) { + const ResTIMG* texInfo = getTexture(param_1)->getTexInfo(); + GXTlut _Var7 = GX_TLUT0; + if (param_0->indexTexture != 0) { + _Var7 = getTlutID(param_0, getUsableTlut(param_1)); + } + getTexture(param_1)->storeTIMG(param_0, param_2, _Var7); + return texInfo; + } + append(param_0, param_2, 1.0f); + return NULL; +} +#else +const ResTIMG* J2DPictureEx::changeTexture(ResTIMG const* param_0, u8 param_1, JUTPalette* param_2) { + // NONMATCHING +} +#endif + +/* 80306298-803062F8 300BD8 0060+00 1/0 0/0 0/0 .text + * changeTexture__12J2DPictureExFPCcUcP10JUTPalette */ +const ResTIMG* J2DPictureEx::changeTexture(char const* param_0, u8 param_1, JUTPalette* param_2) { + ResTIMG const* resource = (ResTIMG const*)J2DScreen::getNameResource(param_0); + return changeTexture(resource, param_1, param_2); +} + +/* 803062F8-80306350 300C38 0058+00 1/0 0/0 0/0 .text getTexture__12J2DPictureExCFUc */ +JUTTexture* J2DPictureEx::getTexture(u8 param_0) const { + if (mMaterial == NULL) { + return NULL; + } + + if (mMaterial->getTevBlock() == NULL) { + return NULL; + } + + return mMaterial->getTevBlock()->getTexture(param_0); +} + +/* 80306350-80306370 300C90 0020+00 1/0 0/0 0/0 .text getTextureCount__12J2DPictureExCFv + */ +u8 J2DPictureEx::getTextureCount() const { + if (mMaterial == NULL) { + return NULL; + } + + return mMaterial->getTexGenBlock()->getTexGenNum(); +} + +/* 80306370-803063F8 300CB0 0088+00 1/0 0/0 0/0 .text setBlack__12J2DPictureExFQ28JUtility6TColor + */ +bool J2DPictureEx::setBlack(JUtility::TColor param_0) { + JUtility::TColor black, white; + if (!getBlackWhite(&black, &white)) { + return false; + } + + return setBlackWhite(param_0, white); +} + +/* 803063F8-80306480 300D38 0088+00 1/0 0/0 0/0 .text setWhite__12J2DPictureExFQ28JUtility6TColor + */ +bool J2DPictureEx::setWhite(JUtility::TColor param_0) { + JUtility::TColor black, white; + if (!getBlackWhite(&black, &white)) { + return false; + } + + return setBlackWhite(black, param_0); +} + +/* 80306480-80306664 300DC0 01E4+00 1/0 0/0 0/0 .text + * setBlackWhite__12J2DPictureExFQ28JUtility6TColorQ28JUtility6TColor */ +bool J2DPictureEx::setBlackWhite(JUtility::TColor param_0, JUtility::TColor param_1) { + if (mMaterial == NULL) { + return false; + } + + if (mMaterial->getTevBlock() == NULL) { + return false; + } + + if (!isSetBlackWhite(param_0, param_1)) { + return false; + } + + bool bVar1; + u8 uVar2; + u8 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum(); + bVar1 = true; + if ((param_0 == 0) && (param_1 == 0xffffffff)) { + bVar1 = false; + } + if (texGenNum == 1) { + uVar2 = (bVar1) ? 2 : 1; + } else { + uVar2 = texGenNum + ((bVar1) ? 2 : 1); + } + mMaterial->getTevBlock()->setTevStageNum(uVar2); + setTevOrder(texGenNum, uVar2, bVar1); + setTevStage(texGenNum, uVar2, bVar1); + setTevKColor(texGenNum); + setTevKColorSel(texGenNum); + setTevKAlphaSel(texGenNum); + if (bVar1) { + J2DGXColorS10 local_38; + local_38.r = param_0.r; + local_38.g = param_0.g; + local_38.b = param_0.b; + local_38.a = param_0.a; + mMaterial->getTevBlock()->setTevColor(0, local_38); + local_38.r = param_1.r; + local_38.g = param_1.g; + local_38.b = param_1.b; + local_38.a = param_1.a; + mMaterial->getTevBlock()->setTevColor(1, local_38); + } + return true; +} + +/* 80306664-80306824 300FA4 01C0+00 4/4 0/0 0/0 .text + * getBlackWhite__12J2DPictureExCFPQ28JUtility6TColorPQ28JUtility6TColor */ +bool J2DPictureEx::getBlackWhite(JUtility::TColor* param_0, JUtility::TColor* param_1) const { + // NONMATCHING +} + +/* 80306824-803068F8 301164 00D4+00 1/1 0/0 0/0 .text + * isSetBlackWhite__12J2DPictureExCFQ28JUtility6TColorQ28JUtility6TColor */ +bool J2DPictureEx::isSetBlackWhite(JUtility::TColor param_0, JUtility::TColor param_1) const { + // NONMATCHING +} + +/* 803068F8-80306958 301238 0060+00 1/0 0/0 0/0 .text getBlack__12J2DPictureExCFv */ +void J2DPictureEx::getBlack() const { + // NONMATCHING +} + +/* 80306958-803069B8 301298 0060+00 1/0 0/0 0/0 .text getWhite__12J2DPictureExCFv */ +void J2DPictureEx::getWhite() const { + // NONMATCHING +} + +/* 803069B8-803069D8 3012F8 0020+00 1/0 0/0 0/0 .text setAlpha__12J2DPictureExFUc */ +void J2DPictureEx::setAlpha(u8 param_0) { + // NONMATCHING +} + +/* 803069D8-80306A0C 301318 0034+00 1/0 0/0 0/0 .text setCullBack__12J2DPictureExF11_GXCullMode */ +void J2DPictureEx::setCullBack(_GXCullMode param_0) { + // NONMATCHING +} + +/* 80306A0C-80306A24 30134C 0018+00 1/0 0/0 0/0 .text rewriteAlpha__12J2DPictureExFv */ +void J2DPictureEx::rewriteAlpha() { + // NONMATCHING +} + +/* 80306A24-80306AC4 301364 00A0+00 1/0 0/0 0/0 .text isUsed__12J2DPictureExFPC7ResTIMG + */ +void J2DPictureEx::isUsed(ResTIMG const* param_0) { + // NONMATCHING +} + +/* 80306AC4-80306AF0 301404 002C+00 1/0 0/0 0/0 .text setAnimation__12J2DPictureExFP11J2DAnmColor + */ +void J2DPictureEx::setAnimation(J2DAnmColor* param_0) { + // NONMATCHING +} + +/* 80306AF0-80306B1C 301430 002C+00 1/0 0/0 0/0 .text + * setAnimation__12J2DPictureExFP19J2DAnmTextureSRTKey */ +void J2DPictureEx::setAnimation(J2DAnmTextureSRTKey* param_0) { + // NONMATCHING +} + +/* 80306B1C-80306B48 30145C 002C+00 1/0 0/0 0/0 .text + * setAnimation__12J2DPictureExFP16J2DAnmTexPattern */ +void J2DPictureEx::setAnimation(J2DAnmTexPattern* param_0) { + // NONMATCHING +} + +/* 80306B48-80306B74 301488 002C+00 1/0 0/0 0/0 .text + * setAnimation__12J2DPictureExFP15J2DAnmTevRegKey */ +void J2DPictureEx::setAnimation(J2DAnmTevRegKey* param_0) { + // NONMATCHING +} + +/* 80306B74-80306B7C -00001 0008+00 0/0 0/0 0/0 .text + * setAnimation__12J2DPictureExFP20J2DAnmVisibilityFull */ +void J2DPictureEx::setAnimation(J2DAnmVisibilityFull* param_0) { + *(u32*)(((u8*)this) + 404) /* this->field_0x194 */ = (u32)(param_0); +} + +/* 80306B7C-80306C70 3014BC 00F4+00 1/0 0/0 0/0 .text + * setAnimation__12J2DPictureExFP14J2DAnmVtxColor */ +void J2DPictureEx::setAnimation(J2DAnmVtxColor* param_0) { + // NONMATCHING +} + +/* 80306C70-80306DC8 3015B0 0158+00 1/0 0/0 0/0 .text + * animationPane__12J2DPictureExFPC15J2DAnmTransform */ +void J2DPictureEx::animationPane(J2DAnmTransform const* param_0) { + // NONMATCHING +} + +/* 80306DC8-80306ED4 301708 010C+00 1/0 0/0 0/0 .text getUsableTlut__12J2DPictureExFUc */ +u8 J2DPictureEx::getUsableTlut(u8 param_0) { + // NONMATCHING +} + +/* 80306ED4-80306F04 301814 0030+00 1/0 0/0 0/0 .text append__12J2DPictureExFPC7ResTIMGf + */ +bool J2DPictureEx::append(ResTIMG const* param_0, f32 param_1) { + // NONMATCHING +} + +/* 80306F04-80306F34 301844 0030+00 1/0 0/0 0/0 .text append__12J2DPictureExFPCcf */ +bool J2DPictureEx::append(char const* param_0, f32 param_1) { + // NONMATCHING +} + +/* 80306F34-80306F64 301874 0030+00 1/0 0/0 0/0 .text prepend__12J2DPictureExFP10JUTTexturef */ +void J2DPictureEx::prepend(JUTTexture* param_0, f32 param_1) { + // NONMATCHING +} + +/* 80306F64-80306F94 3018A4 0030+00 1/0 0/0 0/0 .text prepend__12J2DPictureExFPCcP10JUTPalettef */ +void J2DPictureEx::prepend(char const* param_0, JUTPalette* param_1, f32 param_2) { + // NONMATCHING +} + +/* 80306F94-80306FC4 3018D4 0030+00 1/0 0/0 0/0 .text prepend__12J2DPictureExFPCcf */ +void J2DPictureEx::prepend(char const* param_0, f32 param_1) { + // NONMATCHING +} + +/* 80306FC4-80306FF4 301904 0030+00 1/0 0/0 0/0 .text + * prepend__12J2DPictureExFPC7ResTIMGP10JUTPalettef */ +void J2DPictureEx::prepend(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) { + // NONMATCHING +} + +/* 80306FF4-80307024 301934 0030+00 1/0 0/0 0/0 .text prepend__12J2DPictureExFPC7ResTIMGf + */ +void J2DPictureEx::prepend(ResTIMG const* param_0, f32 param_1) { + // NONMATCHING +} + +/* 80307024-80307058 301964 0034+00 1/0 0/0 0/0 .text insert__12J2DPictureExFPCcUcf */ +bool J2DPictureEx::insert(char const* param_0, u8 param_1, f32 param_2) { + // NONMATCHING +} + +/* 80307058-8030708C 301998 0034+00 1/0 0/0 0/0 .text insert__12J2DPictureExFPC7ResTIMGUcf */ +void J2DPictureEx::insert(ResTIMG const* param_0, u8 param_1, f32 param_2) { + // NONMATCHING +} + +/* 8030708C-803070D0 3019CC 0044+00 1/0 0/0 0/0 .text draw__12J2DPictureExFffbbb */ +void J2DPictureEx::draw(f32 param_0, f32 param_1, bool param_2, bool param_3, bool param_4) { + // NONMATCHING +} + +/* 803070D0-80307134 301A10 0064+00 1/0 0/0 0/0 .text drawOut__12J2DPictureExFffffffff */ +void J2DPictureEx::drawOut(f32 param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, + f32 param_5, f32 param_6, f32 param_7) { + // NONMATCHING +} + +/* 80307134-80307168 301A74 0034+00 1/0 0/0 0/0 .text load__12J2DPictureExFUc */ +void J2DPictureEx::load(u8 param_0) { + // NONMATCHING +} + +/* 80307168-803071A4 301AA8 003C+00 1/0 0/0 0/0 .text setCullBack__12J2DPictureExFb */ +void J2DPictureEx::setCullBack(bool param_0) { + // NONMATCHING +} + +/* 803071A4-803071C4 301AE4 0020+00 1/0 0/0 0/0 .text isUsed__12J2DPictureExFPC7ResFONT + */ +void J2DPictureEx::isUsed(ResFONT const* param_0) { + // NONMATCHING +} + +/* 803071C4-803071E4 301B04 0020+00 1/0 0/0 0/0 .text setAnimation__12J2DPictureExFP10J2DAnmBase + */ +void J2DPictureEx::setAnimation(J2DAnmBase* param_0) { + // NONMATCHING +} + +/* ############################################################################################## */ +/* 803A1D70-803A1D90 02E3D0 0020+00 0/0 0/0 0/0 .rodata @2556 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_2556[32] = { + 0x07, 0x04, 0x05, 0x07, 0x05, 0x07, 0x07, 0x07, 0x07, 0x04, 0x06, 0x07, 0x07, 0x04, 0x06, 0x00, + 0x07, 0x05, 0x00, 0x07, 0x01, 0x02, 0x04, 0x07, 0x07, 0x07, 0x07, 0x02, 0x01, 0x02, 0x00, 0x07, +}; +COMPILER_STRIP_GATE(0x803A1D70, &lit_2556); +#pragma pop + +/* 803A1D90-803A1DB8 02E3F0 0028+00 0/0 0/0 0/0 .rodata @2557 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_2557[40] = { + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +COMPILER_STRIP_GATE(0x803A1D90, &lit_2557); +#pragma pop
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DPrint.cpp b/src/JSystem/J2DGraph/J2DPrint.cpp new file mode 100644 index 0000000000..22f7893e3b --- /dev/null +++ b/src/JSystem/J2DGraph/J2DPrint.cpp @@ -0,0 +1,600 @@ +// +// Generated By: dol2asm +// Translation Unit: J2DPrint +// + +#include "JSystem/J2DGraph/J2DPrint.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JUtility/JUTFont.h" +#include "stdio.h" +#include "stdlib.h" +#include "global.h" + +/* ############################################################################################## */ +/* 80451580-80451584 000A80 0004+00 3/3 0/0 0/0 .sbss mStrBuff__8J2DPrint */ +const u8* J2DPrint::mStrBuff; + +/* 80451584-80451588 000A84 0004+00 1/1 0/0 0/0 .sbss None */ +static bool sStrBufInitialized; + +/* 80451588-8045158C 000A88 0004+00 3/3 0/0 0/0 .sbss mStrBuffSize__8J2DPrint */ +size_t J2DPrint::mStrBuffSize; + +/* 8045158C-80451590 000A8C 0004+00 2/2 0/0 0/0 .sbss None */ +static u8 data_8045158C[4]; + +/* 802F42F0-802F4394 2EEC30 00A4+00 1/1 0/0 0/0 .text J2DPrint_print_alpha_va */ +f32 J2DPrint_print_alpha_va(J2DPrint* pPrint, u8 param_1, const char* fmt, va_list args) { + pPrint->initchar(); + s32 tmp = vsnprintf((char*)J2DPrint::mStrBuff, J2DPrint::mStrBuffSize, fmt, args); + + J2DPrint::TSize size; + if (tmp < 0) { + return 0.0f; + } else if (tmp >= J2DPrint::mStrBuffSize) { + tmp = J2DPrint::mStrBuffSize - 1; + data_8045158C[0] = 1; + } + pPrint->parse(J2DPrint::mStrBuff, tmp, 0x80000000 - 1, NULL, size, param_1, true); + return size.field_0x0; +} + +/* 802F4394-802F4420 2EECD4 008C+00 0/0 6/6 0/0 .text + * __ct__8J2DPrintFP7JUTFontffQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColor + */ +J2DPrint::J2DPrint(JUTFont* pFont, f32 param_1, f32 param_2, JUtility::TColor param_3, + JUtility::TColor param_4, JUtility::TColor param_5, JUtility::TColor param_6) { + private_initiate(pFont, param_1, param_2, param_3, param_4, param_5, param_6, false); +} + +/* 802F4420-802F4468 2EED60 0048+00 1/0 6/6 0/0 .text __dt__8J2DPrintFv */ +J2DPrint::~J2DPrint() {} + +/* 802F4468-802F4658 2EEDA8 01F0+00 1/1 0/0 0/0 .text + * private_initiate__8J2DPrintFP7JUTFontffQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColorb + */ +void J2DPrint::private_initiate(JUTFont* pFont, f32 param_1, f32 param_2, JUtility::TColor param_3, + JUtility::TColor param_4, JUtility::TColor param_5, + JUtility::TColor param_6, bool param_7) { + if (mStrBuff == NULL) { + setBuffer(0x400); // r4 + } + mFont = pFont; + field_0x48 = param_1; + field_0x4c = 32.0f; + + if (mFont != NULL) { + f32 temp; + if (param_7 == false) { + temp = param_2; + } else { + temp = mFont->getLeading(); + } + field_0x4c = temp; + } + + field_0x5a = 1; + locate(0.0f, 0.0f); + mCharColor = param_3; + mGradColor = param_4; + field_0x38 = param_5; + field_0x3c = param_6; + + if (mFont == NULL) { + field_0x58 = 80; + } else { + field_0x58 = mFont->getWidth() << 2; + } + + if (mFont != NULL) { + setFontSize(); + mFont->setGX(field_0x38, field_0x3c); + } + initchar(); +} + +/* 802F4658-802F46C4 2EEF98 006C+00 1/1 1/1 0/0 .text setBuffer__8J2DPrintFUl */ +u8* J2DPrint::setBuffer(size_t size) { + u8* tmp = (u8*)mStrBuff; + if (sStrBufInitialized) { + delete mStrBuff; + } + + mStrBuff = new (JKRHeap::sSystemHeap, 0) u8[size]; + mStrBuffSize = size; + sStrBufInitialized = true; + return tmp; +} + +/* 802F46C4-802F475C 2EF004 0098+00 1/1 0/0 0/0 .text setFontSize__8J2DPrintFv */ +void J2DPrint::setFontSize() { + if (mFont) { + mFontSizeX = mFont->getCellWidth(); + mFontSizeY = mFont->getCellHeight(); + } +} + +/* 802F475C-802F4778 2EF09C 001C+00 2/2 2/2 0/0 .text locate__8J2DPrintFff */ +void J2DPrint::locate(f32 param_0, f32 param_1) { + field_0x24 = param_0; + field_0x28 = param_1; + field_0x2c = param_0; + mCursorV = param_1; + field_0x34 = 0.0f; +} + +/* 802F4778-802F4828 2EF0B8 00B0+00 0/0 2/2 0/0 .text print__8J2DPrintFffUcPCce */ +void J2DPrint::print(f32 param_0, f32 param_1, u8 param_2, char const* fmt, ...) { + locate(param_0, param_1); + + va_list args; + va_start(args, fmt); + J2DPrint_print_alpha_va(this, param_2, fmt, args); + va_end(args); +} + +/* 802F4828-802F4B4C 2EF168 0324+00 0/0 4/4 0/0 .text + * printReturn__8J2DPrintFPCcff18J2DTextBoxHBinding18J2DTextBoxVBindingffUc */ +void J2DPrint::printReturn(char const* param_0, f32 param_1, f32 param_2, + J2DTextBoxHBinding param_3, J2DTextBoxVBinding param_4, f32 param_5, + f32 param_6, u8 param_7) { + if (mFont != NULL) { + initchar(); + field_0x24 = field_0x2c; + field_0x28 = mCursorV; + size_t sVar6 = strlen(param_0); + if (sVar6 >= mStrBuffSize) { + sVar6 = mStrBuffSize - 1; + data_8045158C[0] = 1; + } + u16 local_2b0[260]; + TSize aTStack_2b8; + f32 dVar10 = parse((const u8*)param_0, sVar6, param_1, local_2b0, aTStack_2b8, + param_7, false); + f32 dVar12 = mFont->getAscent()*(mFontSizeY / mFont->getCellHeight()); + f32 dVar13 = dVar10 + dVar12; + switch (param_4) + { + case VBIND_TOP: + break; + case VBIND_BOTTOM: + param_6 += (s32)(param_2 - dVar13 - 0.5f); + break; + case VBIND_CENTER: + param_6 += (s32)(param_2 - dVar13 - 0.5f) / 2; + default: + break; + } + + for (int iVar8 = 0; local_2b0[iVar8] != 0xffff; iVar8++) { + switch (param_3) { + case VBIND_TOP: + local_2b0[iVar8] = 0; + break; + case VBIND_BOTTOM: + local_2b0[iVar8] = param_1 - local_2b0[iVar8]; + break; + case VBIND_CENTER: + f32 fVar1 = (local_2b0[iVar8]); + fVar1 = param_1 - fVar1; + f32 ratio = 0.5f; + local_2b0[iVar8] = fVar1 * ratio; + break; + + } + } + initchar(); + field_0x2c += param_5; + mCursorV += param_6 + dVar12; + field_0x24 = field_0x2c; + field_0x28 = mCursorV; + parse((const u8*)param_0, sVar6, param_1, local_2b0, aTStack_2b8, param_7, true); + } +} + +/* 802F4B4C-802F52E8 2EF48C 079C+00 2/2 0/0 0/0 .text + * parse__8J2DPrintFPCUciiPUsRQ28J2DPrint5TSizeUcb */ +f32 J2DPrint::parse(u8 const* param_0, int param_1, int param_2, u16* param_3, + J2DPrint::TSize& param_4, u8 param_5, bool param_6) { + if (mFont == NULL) { + return 0.0f; + } + const u8* local_a4 = param_0; + u16 r29 = 0; + f32 f30 = field_0x2c; + f32 f28 = mCursorV; + f32 f31 = f30; + f32 local_a8 = f28; + int r27 = *(param_0++); + f32 f29 = field_0x2c; + f32 local_ac = field_0x2c; + f32 local_b0 = mCursorV; + f32 local_b4 = mCursorV; + JUtility::TColor local_b8 = field_0x8; + JUtility::TColor local_bc = field_0xc; + f32 local_c0; + local_b8.a = local_b8.a * param_5 / 0xff; + local_bc.a = local_bc.a * param_5 / 0xff; + mFont->setGradColor(local_b8, field_0x22 ? local_bc : local_b8); + do { + bool local_f0 = false; + bool r25; + if (mFont->isLeadByte(r27)) { + r27 = (r27 << 8) | (*(param_0++)); + local_f0 = true; + } + + if (r27 == 0 || ((u32)param_0 - (u32)local_a4) > param_1) { + if (param_6 == 0 && param_3 != NULL) { + param_3[r29] = 0.5f + f31; + } + r29++; + break; + } else { + r25 = true; + local_c0 = field_0x2c; + if (r27 < 0x20) { + if (r27 == 0x1b) { + u16 local_e8 = doEscapeCode(¶m_0, param_5); + if (local_e8 == 'HM') { + if ((param_6 == 0) && (param_3 != NULL)) { + param_3[r29] = 0.5f + f31; + } + field_0x2c = f30; + mCursorV = f28; + r29++; + if (r29 == 0x100) { + break; + } + f31 = 0.0f; + } + if (local_e8) { + r25 = false; + } + } else { + doCtrlCode(r27); + r25 = false; + if (r27 == 10) { + if ((!param_6) && (param_3 != NULL)) { + param_3[r29] = 0.5f + f31; + } + r29++; + if (r29 == 0x100) { + break; + } + f31 = 0.0f; + } + } + } else if (local_f0 && ((u32)param_0 - (u32)local_a4 > (u32)param_1)) { + if ((!param_6) && (param_3 != NULL)) { + param_3[r29] = 0.5f + f31; + } + r29++; + break; + } else { + if (mFont->isFixed()) { + field_0x34 = mFont->getFixedWidth(); + } else { + JUTFont::TWidth uStack_ec; + mFont->getWidthEntry(r27, &uStack_ec); + field_0x34 = uStack_ec.field_0x1; + } + + field_0x34 *= field_0x18 / mFont->getCellWidth(); + f32 fVar6 = ((field_0x2c + field_0x34) - field_0x24); + fVar6 = 10000.0f * fVar6; + f32 local_c8 = s32(fVar6) / 10000.0f; + if (local_c8 > param_2 && field_0x2c > f30) { + u32 local_e4; + if (local_f0) { + local_e4 = 2; + } else { + local_e4 = 1; + } + param_0 -= local_e4; + mCursorV += field_0x14; + if (!param_6 && (param_3 != NULL)) { + param_3[r29] = 0.5f + f31; + } + r29++; + if (r29 == 0x100) { + break; + } + field_0x2c = field_0x24; + f31 = 0.0f; + r25 = false; + } else { + if (param_6) { + if (param_3 != NULL) { + mFont->drawChar_scale(field_0x2c + (f32)(s16)param_3[r29], mCursorV, + (s32)field_0x18, (s32)field_0x1c, r27, true); + } else { + mFont->drawChar_scale(field_0x2c, mCursorV, + (s32)field_0x18, (s32)field_0x1c, r27, true); + } + } + field_0x2c += field_0x34; + } + } + } + + if (r25) { + if (field_0x2c - f30 > f31) { + f31 = field_0x2c - f30; + } + field_0x2c += field_0x10; + field_0x34 += field_0x10; + f32 local_cc = (field_0x1c / mFont->getHeight()) * mFont->getDescent(); + if (local_a8 < mCursorV + local_cc) { + local_a8 = mCursorV + local_cc; + } + if (field_0x2c > local_ac) { + local_ac = field_0x2c; + } + if (field_0x2c < f29) { + f29 = field_0x2c; + } + if (local_c0 < f29) { + f29 = local_c0; + } + if (mCursorV > local_b4) { + local_b4 = mCursorV; + } + if (mCursorV < local_b0) { + local_b0 = mCursorV; + } + } + r27 = *(param_0++); + } while (true); + + if (param_3 != NULL) { + param_3[r29] = 0xffff; + } + param_4.field_0x0 = local_ac - f29; + param_4.field_0x4 = local_b4 - local_b0 + mFont->getLeading(); + if (!param_6) { + field_0x2c = f30; + mCursorV = f28; + } + return local_a8 - f28; +} + +/* 802F52E8-802F5410 2EFC28 0128+00 2/1 0/0 0/0 .text doCtrlCode__8J2DPrintFi */ +void J2DPrint::doCtrlCode(int param_0) { + switch (param_0) { + case 8: + field_0x2c -= field_0x34; + field_0x34 = 0.0f; + break; + case 9: + if (field_0x20 > 0) { + f32 fVar1 = field_0x2c; + field_0x2c = field_0x20 + field_0x20 * ((int)field_0x2c / field_0x20); + field_0x34 = field_0x2c - fVar1; + } + break; + case 10: + field_0x34 = 0.0f; + field_0x2c = field_0x24; + mCursorV += field_0x14; + break; + case 0xd: + field_0x34 = 0.0f; + field_0x2c = field_0x24; + break; + case 0x1c: + field_0x2c += 1.0f; + break; + case 0x1d: + field_0x2c -= 1.0f; + break; + case 0x1e: + mCursorV -= 1.0f; + break; + case 0x1f: + mCursorV += + 1.0f; + } +} + +/* 802F5410-802F594C 2EFD50 053C+00 1/1 0/0 0/0 .text doEscapeCode__8J2DPrintFPPCUcUc */ +u16 J2DPrint::doEscapeCode(u8 const** param_0, u8 param_1) { + u8 const* puVar9 = *param_0; + u16 uVar11 = 0; + u16 uVar3; + for (int iVar10 = 0; iVar10 < 2; iVar10++) { + if (mFont->isLeadByte(**param_0)) { + uVar3 = ((**param_0) << 8) | (*param_0)[1]; + (*param_0) += 2; + } else { + uVar3 = **param_0; + (*param_0)++; + } + if (uVar3 >= 0x80 || uVar3 < 0x20) { + *param_0 = puVar9; + return 0; + } + uVar11 = ((uVar11) << 8) | uVar3; + } + + JUtility::TColor local_40 = field_0x8; + JUtility::TColor local_44 = field_0xc; + switch(uVar11) { + case 'CU': + mCursorV -= getNumberF32(param_0, 1.0f, 0.0f, 10); + break; + case 'CD': + mCursorV += getNumberF32(param_0, 1.0f, 0.0f, 10); + break; + case 'CL': + field_0x2c -= getNumberF32(param_0, 1.0f, 0.0f, 10); + break; + case 'CR': + field_0x2c += getNumberF32(param_0, 1.0f, 0.0f, 10); + break; + case 'LU': + mCursorV -= field_0x14; + break; + case 'LD': + mCursorV += field_0x14; + break; + case 'ST': + s32 val = getNumberS32(param_0, field_0x20, field_0x20, 10); + if (val > 0) { + field_0x20 = val; + } + break; + case 'CC': + field_0x8 = getNumberS32(param_0, *(u32*)&mCharColor, *(u32*)&field_0x8, 16); + local_40 = field_0x8; + local_40.a = local_40.a * param_1 / 0xff; + local_44.a = local_44.a * param_1 / 0xff; + JUtility::TColor* local_68; + if (field_0x22 != 0) { + local_68 = &local_44; + } + else { + local_68 = &local_40; + } + mFont->setGradColor(local_40, *local_68); + break; + case 'GC': + field_0xc = getNumberS32(param_0, *(u32*)&mGradColor, *(u32*)&field_0xc, 16); + local_44 = field_0xc; + local_40.a = local_40.a * param_1 / 0xff; + local_44.a = local_44.a * param_1 / 0xff; + JUtility::TColor* local_74; + if (field_0x22 != 0) { + local_74 = &local_44; + } + else { + local_74 = &local_40; + } + mFont->setGradColor(local_40, *local_74); + break; + case 'FX': + f32 dVar13 = getNumberF32(param_0, mFontSizeX, field_0x18, 10); + if (dVar13 >= 0) { + field_0x18 = dVar13; + } + break; + case 'FY': + f32 dVar14 = getNumberF32(param_0, mFontSizeY, field_0x1c, 10); + if (dVar14 >= 0) { + field_0x1c = dVar14; + } + break; + case 'SH': + field_0x10 = getNumberF32(param_0, field_0x48, field_0x10, 10); + break; + case 'SV': + field_0x14 = getNumberF32(param_0, field_0x4c, field_0x14, 10); + break; + case 'GM': + s32 isZero = getNumberS32(param_0, field_0x22 == 0, field_0x22, 10) == 0; + field_0x22 = isZero == 0; + local_40.a = local_40.a * param_1 / 0xff; + local_44.a = local_44.a * param_1 / 0xff; + JUtility::TColor* local_80; + if (field_0x22 != 0) { + local_80 = &local_44; + } + else { + local_80 = &local_40; + } + mFont->setGradColor(local_40, *local_80); + break; + case 'HM': + break; + default: + *param_0 = puVar9; + uVar11 = 0; + break; + } + return uVar11; +} + +/* 802F594C-802F59C0 2F028C 0074+00 3/3 0/0 0/0 .text initchar__8J2DPrintFv */ +void J2DPrint::initchar() { + field_0x8 = mCharColor; + field_0xc = mGradColor; + field_0x10 = field_0x48; + field_0x14 = field_0x4c; + field_0x22 = field_0x5a; + field_0x20 = field_0x58; + field_0x18 = mFontSizeX; + field_0x1c = mFontSizeY; +} + +/* 802F59C0-802F5AC4 2F0300 0104+00 1/1 0/0 0/0 .text getNumberS32__8J2DPrintFPPCUclli */ +s32 J2DPrint::getNumberS32(u8 const** param_0, s32 param_1, s32 param_2, int base) { + const u8* puVar1 = *param_0; + s32 uVar2 = param_1; + if (*puVar1 != '[') { + return param_1; + } + (*param_0)++; + uVar2 = 0; + char* local_28; + if (base == 10) { + uVar2 = strtol((char*)*param_0, &local_28, base); + } else if (base == 16) { + uVar2 = strtoul((char*)*param_0, &local_28, base); + if ((u32)local_28 - (u32)*param_0 != 8) { + if ((u32)local_28 - (u32)*param_0 == 6) { + uVar2 = (uVar2 << 8) | 0xff; + } else { + *param_0 = puVar1; + return param_2; + } + } + } + if (local_28[0] != ']') { + *param_0 = puVar1; + return param_2; + } else { + if ((char*)*param_0 == (char*)local_28) { + *param_0 = (const u8*)local_28 + 1; + return param_1; + } else { + *param_0 = (const u8*)local_28 + 1; + } + } + return uVar2; +} + +/* 802F5AC4-802F5BF8 2F0404 0134+00 1/1 0/0 0/0 .text getNumberF32__8J2DPrintFPPCUcffi */ +f32 J2DPrint::getNumberF32(u8 const** param_0, f32 param_1, f32 param_2, int base) { + const u8* puVar1 = *param_0; + s32 uVar2 = param_1; + if (*puVar1 != '[') { + return param_1; + } + (*param_0)++; + uVar2 = 0; + char* local_28; + if (base == 10) { + uVar2 = strtol((char*)*param_0, &local_28, base); + } else if (base == 16) { + uVar2 = strtoul((char*)*param_0, &local_28, base); + if ((u32)local_28 - (u32)*param_0 != 8) { + if ((u32)local_28 - (u32)*param_0 == 6) { + uVar2 = (uVar2 << 8) | 0xff; + } else { + *param_0 = puVar1; + return param_2; + } + } + } + if (local_28[0] != ']') { + *param_0 = puVar1; + return param_2; + } else { + if ((char*)*param_0 == (char*)local_28) { + *param_0 = (const u8*)local_28 + 1; + return param_1; + } else { + *param_0 = (const u8*)local_28 + 1; + } + } + return uVar2; +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DScreen.cpp b/src/JSystem/J2DGraph/J2DScreen.cpp new file mode 100644 index 0000000000..4a104667dc --- /dev/null +++ b/src/JSystem/J2DGraph/J2DScreen.cpp @@ -0,0 +1,705 @@ +// +// Generated By: dol2asm +// Translation Unit: J2DScreen +// + +#include "JSystem/J2DGraph/J2DScreen.h" +#include "JSystem/J2DGraph/J2DPictureEx.h" +#include "JSystem/J2DGraph/J2DTextBoxEx.h" +#include "JSystem/J2DGraph/J2DWindowEx.h" +#include "JSystem/J2DGraph/J2DOrthoGraph.h" +#include "JSystem/JKernel/JKRArchive.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JSupport/JSUMemoryStream.h" +#include "dol2asm.h" +#include "dolphin/types.h" +#include "global.h" + +// +// Forward References: +// + +extern "C" void __ct__9J2DScreenFv(); +extern "C" void __dt__9J2DScreenFv(); +extern "C" void clean__9J2DScreenFv(); +extern "C" void setPriority__9J2DScreenFPCcUlP10JKRArchive(); +extern "C" void setPriority__9J2DScreenFP20JSURandomInputStreamUlP10JKRArchive(); +extern "C" void private_set__9J2DScreenFP20JSURandomInputStreamUlP10JKRArchive(); +extern "C" void checkSignature__9J2DScreenFP20JSURandomInputStream(); +extern "C" void getScreenInformation__9J2DScreenFP20JSURandomInputStream(); +extern "C" void makeHierarchyPanes__9J2DScreenFP7J2DPaneP20JSURandomInputStreamUlP10JKRArchive(); +extern "C" void +createPane__9J2DScreenFRC18J2DScrnBlockHeaderP20JSURandomInputStreamP7J2DPaneUlP10JKRArchive(); +extern "C" void draw__9J2DScreenFffPC14J2DGrafContext(); +extern "C" void search__9J2DScreenFUx(); +extern "C" void searchUserInfo__9J2DScreenFUx(); +extern "C" void drawSelf__9J2DScreenFffPA3_A4_f(); +extern "C" void createMaterial__9J2DScreenFP20JSURandomInputStreamUlP10JKRArchive(); +extern "C" void isUsed__9J2DScreenFPC7ResTIMG(); +extern "C" void isUsed__9J2DScreenFPC7ResFONT(); +extern "C" void getNameResource__9J2DScreenFPCc(); +extern "C" void animation__9J2DScreenFv(); +extern "C" void setAnimation__9J2DScreenFP11J2DAnmColor(); +extern "C" void setAnimation__9J2DScreenFP19J2DAnmTextureSRTKey(); +extern "C" void setAnimation__9J2DScreenFP16J2DAnmTexPattern(); +extern "C" void setAnimation__9J2DScreenFP15J2DAnmTevRegKey(); +extern "C" void setAnimation__9J2DScreenFP14J2DAnmVtxColor(); +extern "C" void setAnimation__9J2DScreenFP20J2DAnmVisibilityFull(); +extern "C" void createPane__9J2DScreenFRC18J2DScrnBlockHeaderP20JSURandomInputStreamP7J2DPaneUl(); +extern "C" s32 getTypeID__9J2DScreenCFv(); +extern "C" void calcMtx__9J2DScreenFv(); +extern "C" void setAnimation__9J2DScreenFP10J2DAnmBase(); +extern "C" void setAnimationVF__9J2DScreenFP20J2DAnmVisibilityFull(); +extern "C" void setAnimationVC__9J2DScreenFP14J2DAnmVtxColor(); +extern "C" u8 mDataManage__9J2DScreen[4 + 4 /* padding */]; + +// +// External References: +// + +extern "C" void setAlpha__7J2DPaneFUc(); +extern "C" void clearAnmTransform__9J2DScreenFv(); +extern "C" void makeMatrix__7J2DPaneFff(); +extern "C" void setAnimation__9J2DScreenFP15J2DAnmTransform(); +extern "C" void* __nw__FUl(); +extern "C" void* __nwa__FUl(); +extern "C" void* __nwa__FUli(); +extern "C" void __dl__FPv(); +extern "C" void __dla__FPv(); +extern "C" void getGlbResource__13JKRFileLoaderFPCcP13JKRFileLoader(); +extern "C" void __dt__14JSUInputStreamFv(); +extern "C" void read__14JSUInputStreamFPvl(); +extern "C" void peek__20JSURandomInputStreamFPvl(); +extern "C" void seek__20JSURandomInputStreamFl17JSUStreamSeekFrom(); +extern "C" void setBuffer__20JSUMemoryInputStreamFPCvl(); +extern "C" void __ct__10JUTNameTabFPC7ResNTAB(); +extern "C" void __ct__13J2DOrthoGraphFffffff(); +extern "C" void setPort__13J2DOrthoGraphFv(); +extern "C" void __ct__11J2DMaterialFv(); +extern "C" void __dt__11J2DMaterialFv(); +extern "C" void setAnimation__11J2DMaterialFP11J2DAnmColor(); +extern "C" void setAnimation__11J2DMaterialFP19J2DAnmTextureSRTKey(); +extern "C" void setAnimation__11J2DMaterialFP16J2DAnmTexPattern(); +extern "C" void setAnimation__11J2DMaterialFP15J2DAnmTevRegKey(); +extern "C" void animation__11J2DMaterialFv(); +extern "C" void __ct__18J2DMaterialFactoryFRC16J2DMaterialBlock(); +extern "C" void +create__18J2DMaterialFactoryCFP11J2DMaterialiUlP15J2DResReferenceP15J2DResReferenceP10JKRArchive(); +extern "C" void func_802F5D40(); +extern "C" void __ct__7J2DPaneFP7J2DPaneP20JSURandomInputStreamUc(); +extern "C" void __dt__7J2DPaneFv(); +extern "C" void draw__7J2DPaneFffPC14J2DGrafContextbb(); +extern "C" void func_802F6D18(); +extern "C" void move__7J2DPaneFff(); +extern "C" void add__7J2DPaneFff(); +extern "C" void resize__7J2DPaneFff(); +extern "C" void search__7J2DPaneFUx(); +extern "C" void searchUserInfo__7J2DPaneFUx(); +extern "C" void isUsed__7J2DPaneFPC7ResTIMG(); +extern "C" void isUsed__7J2DPaneFPC7ResFONT(); +extern "C" void makeMatrix__7J2DPaneFffff(); +extern "C" void setCullBack__7J2DPaneF11_GXCullMode(); +extern "C" void setAnimation__7J2DPaneFP10J2DAnmBase(); +extern "C" void animationTransform__7J2DPaneFPC15J2DAnmTransform(); +extern "C" void setVisibileAnimation__7J2DPaneFP20J2DAnmVisibilityFull(); +extern "C" void setVtxColorAnimation__7J2DPaneFP14J2DAnmVtxColor(); +extern "C" void animationPane__7J2DPaneFPC15J2DAnmTransform(); +extern "C" void rewriteAlpha__7J2DPaneFv(); +extern "C" void setCullBack__7J2DPaneFb(); +extern "C" void setConnectParent__7J2DPaneFb(); +extern "C" void update__7J2DPaneFv(); +extern "C" void drawSelf__7J2DPaneFff(); +extern "C" void __ct__9J2DWindowFP7J2DPaneP20JSURandomInputStreamP10JKRArchive(); +extern "C" void __ct__9J2DWindowFP7J2DPaneP20JSURandomInputStreamP11J2DMaterial(); +extern "C" void __ct__10J2DPictureFP7J2DPaneP20JSURandomInputStreamP10JKRArchive(); +extern "C" void __ct__10J2DPictureFP7J2DPaneP20JSURandomInputStreamP11J2DMaterial(); +extern "C" void __ct__10J2DTextBoxFP7J2DPaneP20JSURandomInputStreamP10JKRArchive(); +extern "C" void __ct__10J2DTextBoxFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial(); +extern "C" void __ct__11J2DWindowExFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial(); +extern "C" void __ct__12J2DPictureExFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial(); +extern "C" void __ct__12J2DTextBoxExFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial(); +extern "C" void get__13J2DDataManageFPCc(); +extern "C" void __destroy_new_array(); +extern "C" void __construct_new_array(); +extern "C" void _savegpr_25(); +extern "C" void _savegpr_26(); +extern "C" void _savegpr_27(); +extern "C" void _savegpr_28(); +extern "C" void _restgpr_25(); +extern "C" void _restgpr_26(); +extern "C" void _restgpr_27(); +extern "C" void _restgpr_28(); +extern "C" extern void* __vt__10JSUIosBase[3]; +extern "C" extern void* __vt__20JSURandomInputStream[9]; +extern "C" extern void* __vt__14JSUInputStream[6 + 1 /* padding */]; +extern "C" extern void* __vt__20JSUMemoryInputStream[9 + 1 /* padding */]; +extern "C" extern void* __vt__14J2DGrafContext[10]; +extern "C" extern void* __vt__13J2DOrthoGraph[10]; + +/* 802F8498-802F8540 2F2DD8 00A8+00 0/0 59/59 4/4 .text __ct__9J2DScreenFv */ +J2DScreen::J2DScreen() + : J2DPane(NULL, true, 'root', JGeometry::TBox2<f32>(JGeometry::TVec2<f32>(0.0f, 0.0f), JGeometry::TVec2<f32>(640.0f, 480.0f))), mColor() { + field_0x4 = -1; + mScissor = false; + mMaterialNum = 0; + mMaterials = NULL; + mTexRes = NULL; + mFontRes = NULL; + mNameTable = NULL; +} + +/* 802F8540-802F85A8 2F2E80 0068+00 1/0 0/0 0/0 .text __dt__9J2DScreenFv */ +J2DScreen::~J2DScreen() { + clean(); +} + +/* 802F85A8-802F8648 2F2EE8 00A0+00 3/3 0/0 0/0 .text clean__9J2DScreenFv */ +void J2DScreen::clean() { + delete[] mMaterials; + mMaterialNum = 0; + mMaterials = NULL; + + delete[] mTexRes; + mTexRes = NULL; + + delete[] mFontRes; + mFontRes = NULL; + + if (mNameTable != NULL) { + delete[] mNameTable->getResNameTable(); + delete mNameTable; + mNameTable = NULL; + } +} + +/* 802F8648-802F8748 2F2F88 0100+00 0/0 58/58 4/4 .text setPriority__9J2DScreenFPCcUlP10JKRArchive + */ +bool J2DScreen::setPriority(char const* resName, u32 param_1, JKRArchive* p_archive) { + if (p_archive == NULL) { + return false; + } + + void* res = JKRFileLoader::getGlbResource(resName, p_archive); + if (res != NULL) { + u32 size = p_archive->getExpandedResSize(res); + JSUMemoryInputStream stream(res, size); + return setPriority(&stream, param_1, p_archive); + } + + return false; +} + +/* 802F8748-802F8778 2F3088 0030+00 1/1 1/1 0/0 .text + * setPriority__9J2DScreenFP20JSURandomInputStreamUlP10JKRArchive */ +bool J2DScreen::setPriority(JSURandomInputStream* p_stream, u32 param_1, JKRArchive* p_archive) { + if (p_archive == NULL) { + return false; + } else { + return private_set(p_stream, param_1, p_archive); + } +} + +/* 802F8778-802F8834 2F30B8 00BC+00 1/1 0/0 0/0 .text + * private_set__9J2DScreenFP20JSURandomInputStreamUlP10JKRArchive */ +bool J2DScreen::private_set(JSURandomInputStream* p_stream, u32 param_1, JKRArchive* p_archive) { + if (!checkSignature(p_stream)) { + return false; + } + + if (!getScreenInformation(p_stream)) { + return false; + } + + bool make_end = makeHierarchyPanes(this, p_stream, param_1, p_archive) != 2; + + if (!(param_1 & 0x1F0000)) { + clean(); + } + + if (make_end) { + return p_stream->isGood(); + } + + return false; +} + +/* 802F8834-802F8894 2F3174 0060+00 1/1 0/0 0/0 .text + * checkSignature__9J2DScreenFP20JSURandomInputStream */ +bool J2DScreen::checkSignature(JSURandomInputStream* p_stream) { + J2DScrnHeader header; + p_stream->read(&header, sizeof(J2DScrnHeader)); + + if (header.mTag != 'SCRN' || (header.mType != 'blo1' && header.mType != 'blo2')) { + return false; + } else { + return true; + } +} + +/* 802F8894-802F8990 2F31D4 00FC+00 1/1 0/0 0/0 .text + * getScreenInformation__9J2DScreenFP20JSURandomInputStream */ +bool J2DScreen::getScreenInformation(JSURandomInputStream* p_stream) { + J2DScrnInfoHeader info; + p_stream->read(&info, sizeof(J2DScrnInfoHeader)); + + if (info.mTag != 'INF1') { + return false; + } + + JGeometry::TBox2<f32> dimensions(0.0f, 0.0f, info.mWidth, info.mHeight); + place(dimensions); + + JUtility::TColor color(info.mColor); + mColor = color; + + if (info.mSize > 0x10) { + p_stream->skip(info.mSize - 0x10); + } + + return true; +} + +/* 802F8990-802F8B98 2F32D0 0208+00 1/1 0/0 0/0 .text + * makeHierarchyPanes__9J2DScreenFP7J2DPaneP20JSURandomInputStreamUlP10JKRArchive */ +s32 J2DScreen::makeHierarchyPanes(J2DPane* p_basePane, JSURandomInputStream* p_stream, u32 param_2, + JKRArchive* p_archive) { + J2DPane* next_pane = p_basePane; + + while (true) { + J2DScrnBlockHeader header; + p_stream->peek(&header, sizeof(J2DScrnBlockHeader)); + + switch (header.mTag) { + case 'EXT1': + p_stream->seek(header.mSize, JSUStreamSeekFrom_CUR); + return 1; + case 'BGN1': + p_stream->seek(header.mSize, JSUStreamSeekFrom_CUR); + + int ret = makeHierarchyPanes(next_pane, p_stream, param_2, p_archive); + if (ret != 0) { + return ret; + } + break; + case 'END1': + p_stream->seek(header.mSize, JSUStreamSeekFrom_CUR); + return 0; + case 'TEX1': + J2DResReference* texRes = getResReference(p_stream, param_2); + mTexRes = texRes; + + if (texRes == NULL) { + return 2; + } + break; + case 'FNT1': + J2DResReference* fntRes = getResReference(p_stream, param_2); + mFontRes = fntRes; + + if (fntRes == NULL) { + return 2; + } + break; + case 'MAT1': + if (!createMaterial(p_stream, param_2, p_archive)) { + return 2; + } + break; + default: + if (p_archive == NULL) { + next_pane = createPane(header, p_stream, p_basePane, param_2); + } else { + next_pane = createPane(header, p_stream, p_basePane, param_2, p_archive); + } + + if (next_pane == NULL) { + return 2; + } + break; + } + } +} + +/* 802F8B98-802F8ED4 2F34D8 033C+00 1/0 0/0 0/0 .text + * createPane__9J2DScreenFRC18J2DScrnBlockHeaderP20JSURandomInputStreamP7J2DPaneUlP10JKRArchive */ +J2DPane* J2DScreen::createPane(J2DScrnBlockHeader const& header, JSURandomInputStream* p_stream, + J2DPane* p_basePane, u32 param_3, JKRArchive* p_archive) { + J2DPane* newPane; + + switch (header.mTag) { + case 'PAN1': + newPane = new J2DPane(p_basePane, p_stream, 0); + break; + case 'WIN1': + newPane = new J2DWindow(p_basePane, p_stream, p_archive); + break; + case 'PIC1': + newPane = new J2DPicture(p_basePane, p_stream, p_archive); + break; + case 'TBX1': + newPane = new J2DTextBox(p_basePane, p_stream, p_archive); + break; + case 'PAN2': + newPane = new J2DPane(p_basePane, p_stream, 1); + break; + case 'WIN2': + if (param_3 & 0x1F0000) { + newPane = new J2DWindowEx(p_basePane, p_stream, param_3, mMaterials); + break; + } + newPane = new J2DWindow(p_basePane, p_stream, mMaterials); + break; + case 'PIC2': + if (param_3 & 0x1F0000) { + newPane = new J2DPictureEx(p_basePane, p_stream, param_3, mMaterials); + break; + } + newPane = new J2DPicture(p_basePane, p_stream, mMaterials); + break; + case 'TBX2': + if (param_3 & 0x1F0000) { + newPane = new J2DTextBoxEx(p_basePane, p_stream, param_3, mMaterials); + break; + } + newPane = new J2DTextBox(p_basePane, p_stream, param_3, mMaterials); + break; + default: + s32 position = p_stream->getPosition(); + s32 size = header.mSize; + s32 start = size + position; + + newPane = new J2DPane(p_basePane, p_stream, 0); + p_stream->seek(start, JSUStreamSeekFrom_SET); + break; + } + + return newPane; +} + +/* 802F8ED4-802F90A0 2F3814 01CC+00 0/0 51/51 4/4 .text draw__9J2DScreenFffPC14J2DGrafContext */ +void J2DScreen::draw(f32 x, f32 y, J2DGrafContext const* grafCtx) { + u32 l_x, l_y, width, height; + + if (mScissor) { + GXGetScissor(&l_x, &l_y, &width, &height); + } + + if (grafCtx != NULL) { + J2DPane::draw(x, y, grafCtx, mScissor, true); + } else { + J2DOrthoGraph ortho(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0f); + ortho.setPort(); + J2DPane::draw(x, y, &ortho, mScissor, true); + } + + if (mScissor) { + GXSetScissor(l_x, l_y, width, height); + } + + GXSetNumIndStages(0); + for (int i = 0; i < 0x10; i++) { + GXSetTevDirect((GXTevStageID)i); + } + GXSetNumTevStages(1); + GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetVtxDesc(GX_VA_TEX0, GX_NONE); + GXSetCullMode(GX_CULL_NONE); + GXSetNumTexGens(0); + GXSetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, + GX_AF_NONE); + for (int i = 0; i < 4; i++) { + GXSetTevSwapModeTable((GXTevSwapSel)i, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA); + } +} + +/* 802F90A0-802F90E0 2F39E0 0040+00 1/0 0/0 0/0 .text search__9J2DScreenFUx */ +J2DPane* J2DScreen::search(u64 tag) { + if (tag == 0) { + return NULL; + } + + return J2DPane::search(tag); +} + +/* 802F90E0-802F9120 2F3A20 0040+00 1/0 0/0 0/0 .text searchUserInfo__9J2DScreenFUx */ +J2DPane* J2DScreen::searchUserInfo(u64 tag) { + if (tag == 0) { + return NULL; + } + + return J2DPane::searchUserInfo(tag); +} + +/* 802F9120-802F9280 2F3A60 0160+00 1/0 0/0 0/0 .text drawSelf__9J2DScreenFffPA3_A4_f */ +void J2DScreen::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) { + JUtility::TColor color(mColor); + u8 alpha = (color.a * mAlpha) / 255; + + if (alpha != 0) { + JUtility::TColor sp8(alpha | ((u32)color & 0xFFFFFF00)); + color = sp8; + + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + + GXPosition3f32(0.0f, 0.0f, 0.0f); + GXColor1u32(color); + + GXPosition3f32(getWidth(), 0.0f, 0.0f); + GXColor1u32(color); + + GXPosition3f32(getWidth(), getHeight(), 0.0f); + GXColor1u32(color); + + GXPosition3f32(0.0f, getHeight(), 0.0f); + GXColor1u32(color); + + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0); + GXEnd(); + } +} + +/* 802F9280-802F937C 2F3BC0 00FC+00 1/1 0/0 0/0 .text + * getResReference__9J2DScreenFP20JSURandomInputStreamUl */ +J2DResReference* J2DScreen::getResReference(JSURandomInputStream* p_stream, u32 param_1) { + s32 position = p_stream->getPosition(); + p_stream->skip(4); + + s32 size1, size2; + size1 = p_stream->readS32(); + p_stream->skip(4); + size2 = p_stream->readS32(); + p_stream->seek(position + size2, JSUStreamSeekFrom_SET); + + size1 = size1 - size2; + + char* buffer; + if (param_1 & 0x1F0000) { + buffer = new char[size1]; + } else { + buffer = new (-4) char[size1]; + } + + if (buffer != NULL) { + p_stream->read(buffer, size1); + } + + return (J2DResReference*)buffer; +} + +/* 802F937C-802F9600 2F3CBC 0284+00 1/1 0/0 0/0 .text + * createMaterial__9J2DScreenFP20JSURandomInputStreamUlP10JKRArchive */ +// nametab section has issues +#ifdef NONMATCHING +bool J2DScreen::createMaterial(JSURandomInputStream* p_stream, u32 param_1, JKRArchive* p_archive) { + s32 position = p_stream->getPosition(); + + J2DScrnBlockHeader header; + p_stream->read(&header, 8); + mMaterialNum = p_stream->readU16(); + + p_stream->skip(2); + + if (param_1 & 0x1F0000) { + mMaterials = new J2DMaterial[mMaterialNum]; + } else { + mMaterials = new (-4) J2DMaterial[mMaterialNum]; + } + + u8* buffer = new (-4) u8[header.mSize]; + if (mMaterials != NULL && buffer != NULL) { + p_stream->seek(position, JSUStreamSeekFrom_SET); + p_stream->read(buffer, header.mSize); + J2DMaterialFactory factory(*(J2DMaterialBlock*)buffer); + + for (u16 i = 0; i < mMaterialNum; i++) { + factory.create(&mMaterials[i], i, param_1, mTexRes, mFontRes, p_archive); + } + + if (param_1 & 0x1F0000) { + u32 offset = + buffer[0x14] << 0x18 | buffer[0x15] << 0x10 | buffer[0x16] << 8 | buffer[0x17]; + char* sec = (char*)buffer + offset; + u16* sec_s = ((u16*)sec); + u32 size = ((u16*)sec)[0]*2; + u16 num = sec_s[size + 1]; + while (sec[num] != 0) { + num++; + } + num++; + + u8* nametab = new u8[num]; + if (nametab != NULL) { + for (u16 i = 0; i < num; i++) { + nametab[i] = sec[i]; + } + + mNameTable = new JUTNameTab((ResNTAB*)nametab); + if (mNameTable == NULL) { + delete[] nametab; + } else { + success: + delete[] buffer; + return true; + } + } + } else { + goto success; + } + } + + delete[] buffer; + clean(); + return false; +} +#else +bool J2DScreen::createMaterial(JSURandomInputStream* param_0, u32 param_1, + JKRArchive* param_2) { + // NONMATCHING +} +#endif + +/* 802F9600-802F9620 2F3F40 0020+00 1/0 0/0 0/0 .text isUsed__9J2DScreenFPC7ResTIMG */ +bool J2DScreen::isUsed(ResTIMG const* p_timg) { + return J2DPane::isUsed(p_timg); +} + +/* 802F9620-802F9640 2F3F60 0020+00 1/0 0/0 0/0 .text isUsed__9J2DScreenFPC7ResFONT */ +bool J2DScreen::isUsed(ResFONT const* p_font) { + return J2DPane::isUsed(p_font); +} + +/* ############################################################################################## */ +/* 80451590-80451598 000A90 0004+04 1/1 3/3 0/0 .sbss mDataManage__9J2DScreen */ +J2DDataManage* J2DScreen::mDataManage; + +/* 802F9640-802F9690 2F3F80 0050+00 0/0 6/6 0/0 .text getNameResource__9J2DScreenFPCc */ +void* J2DScreen::getNameResource(char const* resName) { + void* res = JKRFileLoader::getGlbResource(resName, NULL); + + if (res == NULL && mDataManage != NULL) { + res = mDataManage->get(resName); + } + + return res; +} + +/* 802F9690-802F9704 2F3FD0 0074+00 0/0 30/30 3/3 .text animation__9J2DScreenFv */ +void J2DScreen::animation() { + animationPane(mTransform); + + for (u16 i = 0; i < mMaterialNum; i++) { + mMaterials[i].animation(); + } +} + +/* 802F9704-802F9798 2F4044 0094+00 1/0 0/0 0/0 .text setAnimation__9J2DScreenFP11J2DAnmColor */ +void J2DScreen::setAnimation(J2DAnmColor* p_anmColor) { + p_anmColor->searchUpdateMaterialID(this); + u16 matNum = p_anmColor->getUpdateMaterialNum(); + + for (u16 i = 0; i < matNum; i++) { + u16 matID = p_anmColor->getUpdateMaterialID(i); + if (matID < mMaterialNum) { + mMaterials[matID].setAnimation(p_anmColor); + } + } +} + +/* 802F9798-802F9838 2F40D8 00A0+00 1/0 0/0 0/0 .text + * setAnimation__9J2DScreenFP19J2DAnmTextureSRTKey */ +void J2DScreen::setAnimation(J2DAnmTextureSRTKey* p_anmSRTKey) { + p_anmSRTKey->searchUpdateMaterialID(this); + u16 matNum = p_anmSRTKey->getUpdateMaterialNum(); + + for (u16 i = 0; i < matNum; i++) { + u16 matID = p_anmSRTKey->getUpdateMaterialID(i); + if (matID < mMaterialNum) { + mMaterials[matID].setAnimation(p_anmSRTKey); + } + } +} + +/* 802F9838-802F98CC 2F4178 0094+00 1/0 0/0 0/0 .text setAnimation__9J2DScreenFP16J2DAnmTexPattern + */ +void J2DScreen::setAnimation(J2DAnmTexPattern* p_anmPattern) { + p_anmPattern->searchUpdateMaterialID(this); + u16 matNum = p_anmPattern->getUpdateMaterialNum(); + + for (u16 i = 0; i < matNum; i++) { + u16 matID = p_anmPattern->getUpdateMaterialID(i); + if (matID < mMaterialNum) { + mMaterials[matID].setAnimation(p_anmPattern); + } + } +} + +/* 802F98CC-802F99A8 2F420C 00DC+00 1/0 0/0 0/0 .text setAnimation__9J2DScreenFP15J2DAnmTevRegKey + */ +void J2DScreen::setAnimation(J2DAnmTevRegKey* p_anmRegKey) { + p_anmRegKey->searchUpdateMaterialID(this); + + u16 cMatNum = p_anmRegKey->getCRegUpdateMaterialNum(); + for (u16 i = 0; i < cMatNum; i++) { + u16 matID = p_anmRegKey->getCRegUpdateMaterialID(i); + if (matID < mMaterialNum) { + mMaterials[matID].setAnimation(p_anmRegKey); + } + } + + u16 kMatNum = p_anmRegKey->getKRegUpdateMaterialNum(); + for (u16 i = 0; i < kMatNum; i++) { + u16 matID = p_anmRegKey->getKRegUpdateMaterialID(i); + if (matID < mMaterialNum) { + mMaterials[matID].setAnimation(p_anmRegKey); + } + } +} + +/* 802F99A8-802F99C8 2F42E8 0020+00 1/0 0/0 0/0 .text setAnimation__9J2DScreenFP14J2DAnmVtxColor + */ +void J2DScreen::setAnimation(J2DAnmVtxColor* p_anmVtxColor) { + J2DPane::setVtxColorAnimation(p_anmVtxColor); +} + +/* 802F99C8-802F99E8 2F4308 0020+00 1/0 0/0 0/0 .text + * setAnimation__9J2DScreenFP20J2DAnmVisibilityFull */ +void J2DScreen::setAnimation(J2DAnmVisibilityFull* p_anmVisibility) { + J2DPane::setVisibileAnimation(p_anmVisibility); +} + +/* 802F99E8-802F9A18 2F4328 0030+00 1/0 0/0 0/0 .text + * createPane__9J2DScreenFRC18J2DScrnBlockHeaderP20JSURandomInputStreamP7J2DPaneUl */ +J2DPane* J2DScreen::createPane(J2DScrnBlockHeader const& header, JSURandomInputStream* p_stream, + J2DPane* p_basePane, u32 param_3) { + return createPane(header, p_stream, p_basePane, param_3, NULL); +} + +/* 802F9A18-802F9A20 2F4358 0008+00 1/0 0/0 0/0 .text getTypeID__9J2DScreenCFv */ +u16 J2DScreen::getTypeID() const { + return 8; +} + +/* 802F9A20-802F9A54 2F4360 0034+00 1/0 0/0 0/0 .text calcMtx__9J2DScreenFv */ +void J2DScreen::calcMtx() { + makeMatrix(mTranslateX, mTranslateY); +} + +/* 802F9A54-802F9A74 2F4394 0020+00 1/0 0/0 0/0 .text setAnimation__9J2DScreenFP10J2DAnmBase */ +void J2DScreen::setAnimation(J2DAnmBase* p_anm) { + J2DPane::setAnimation(p_anm); +} + +/* 802F9A74-802F9A78 2F43B4 0004+00 1/0 0/0 0/0 .text + * setAnimationVF__9J2DScreenFP20J2DAnmVisibilityFull */ +void J2DScreen::setAnimationVF(J2DAnmVisibilityFull*) { + /* empty function */ +} + +/* 802F9A78-802F9A7C 2F43B8 0004+00 1/0 0/0 0/0 .text setAnimationVC__9J2DScreenFP14J2DAnmVtxColor + */ +void J2DScreen::setAnimationVC(J2DAnmVtxColor*) { + /* empty function */ +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DTevs.cpp b/src/JSystem/J2DGraph/J2DTevs.cpp new file mode 100644 index 0000000000..b4f92d97b4 --- /dev/null +++ b/src/JSystem/J2DGraph/J2DTevs.cpp @@ -0,0 +1,239 @@ +// +// J2DTevs +// + +#include "JSystem/J2DGraph/J2DTevs.h" +#include "JSystem/J2DGraph/J2DMatBlock.h" +#include "math.h" +#include "dolphin/gx.h" + +/* 802E9C90-802E9CC4 2E45D0 0034+00 0/0 1/1 0/0 .text load__9J2DTexMtxFUl */ +void J2DTexMtx::load(u32 mtxIdx) { + GXLoadTexMtxImm(mTexMtx, mtxIdx * 3 + GX_TEXMTX0, mInfo.getTexMtxType()); +} + +/* 802E9CC4-802E9D2C 2E4604 0068+00 0/0 2/2 0/0 .text calc__9J2DTexMtxFv */ +void J2DTexMtx::calc() { + if (mInfo.mTexMtxDCC == J2DTexMtxInfo::DCC_NONE) { + getTextureMtx(mInfo.mTexSRTInfo, mInfo.mCenter, mTexMtx); + } else if (mInfo.mTexMtxDCC == J2DTexMtxInfo::DCC_MAYA) { + getTextureMtxMaya(mInfo.mTexSRTInfo, mTexMtx); + } +} + +/* 802E9D2C-802E9EBC 2E466C 0190+00 1/1 0/0 0/0 .text + * getTextureMtx__9J2DTexMtxFRC17J2DTextureSRTInfo3VecPA4_f */ +void J2DTexMtx::getTextureMtx(J2DTextureSRTInfo const& param_0, Vec param_1, Mtx param_2) { + float f31 = (param_0.field_0x8 * M_PI) / 180.0f; + param_2[0][0] = param_0.field_0x0 * i_cosf(f31); + param_2[0][1] = -param_0.field_0x0 * i_sinf(f31); + param_2[0][2] = 0.0f; + param_2[0][3] = -param_0.field_0x0 * i_cosf(f31) * param_1.x + param_1.y * (param_0.field_0x0 * i_sinf(f31)) + + param_1.x + param_0.field_0xc; + param_2[1][0] = param_0.field_0x4 * i_sinf(f31); + param_2[1][1] = param_0.field_0x4 * i_cosf(f31); + param_2[1][2] = 0.0f; + param_2[1][3] = -param_0.field_0x4 * i_sinf(f31) * param_1.x - param_1.y * (param_0.field_0x4 * i_cosf(f31)) + + param_1.y + param_0.field_0x10; + param_2[2][0] = 0.0f; + param_2[2][1] = 0.0f; + param_2[2][2] = 1.0f; + param_2[2][3] = 0.0f; +} + +/* 802E9EBC-802EA044 2E47FC 0188+00 1/1 0/0 0/0 .text + * getTextureMtxMaya__9J2DTexMtxFRC17J2DTextureSRTInfoPA4_f */ +void J2DTexMtx::getTextureMtxMaya(J2DTextureSRTInfo const& param_0, Mtx param_1) { + float f31 = (param_0.field_0x8 * M_PI) / 180.0f; + param_1[0][0] = param_0.field_0x0 * i_cosf(f31); + param_1[0][1] = param_0.field_0x4 * i_sinf(f31); + param_1[0][2] = 0.0f; + param_1[0][3] = (param_0.field_0xc - 0.5f) * i_cosf(f31) - + (param_0.field_0x10 - 0.5f + param_0.field_0x4) * i_sinf(f31) + 0.5f; + param_1[1][0] = -param_0.field_0x0 * i_sinf(f31); + param_1[1][1] = param_0.field_0x4 * i_cosf(f31); + param_1[1][2] = 0.0f; + param_1[1][3] = -(param_0.field_0xc - 0.5f) * i_sinf(f31) - + (param_0.field_0x10 - 0.5f + param_0.field_0x4) * i_cosf(f31) + 0.5f; + param_1[2][0] = 0.0f; + param_1[2][1] = 0.0f; + param_1[2][2] = 1.0f; + param_1[2][3] = 0.0f; +} + +/* 802EA044-802EA098 2E4984 0054+00 0/0 5/5 0/0 .text load__14J2DIndTevStageFUc */ +void J2DIndTevStage::load(u8 tevStage) { + GXSetTevIndirect((GXTevStageID)tevStage, getIndStage(), getIndFormat(), getBiasSel(), + getMtxSel(), getWrapS(), getWrapT(), getPrev(), getLod(), getAlphaSel()); +} + +/* 802EA098-802EA0CC 2E49D8 0034+00 0/0 1/1 0/0 .text load__12J2DIndTexMtxFUc */ +void J2DIndTexMtx::load(u8 indTexMtx) { + GXSetIndTexMtx((GXIndTexMtxID)(GX_ITM_0 + indTexMtx), (f32*)mIndTexMtxInfo.mMtx, + mIndTexMtxInfo.mScaleExp); +} + +/* 802EA0CC-802EA0FC 2E4A0C 0030+00 0/0 1/1 0/0 .text load__19J2DIndTexCoordScaleFUc */ +void J2DIndTexCoordScale::load(u8 indTexStage) { + GXSetIndTexCoordScale((GXIndTexStageID)indTexStage, mInfo.getScaleS(), mInfo.getScaleT()); +} + +/* 802EA0FC-802EA12C 2E4A3C 0030+00 0/0 1/1 0/0 .text load__14J2DIndTexOrderFUc */ +void J2DIndTexOrder::load(u8 indTexStage) { + GXSetIndTexOrder((GXIndTexStageID)indTexStage, mInfo.getTexCoordID(), mInfo.getTexMapID()); +} + +/* 802EA12C-802EA134 2E4A6C 0008+00 0/0 1/0 0/0 .text getTevSwapModeTable__11J2DTevBlockFUl */ +J2DTevSwapModeTable* J2DTevBlock::getTevSwapModeTable(u32 param_0) { + return NULL; +} + +/* 802EA134-802EA13C 2E4A74 0008+00 0/0 1/0 0/0 .text getTevStage__11J2DTevBlockFUl */ +J2DTevStage* J2DTevBlock::getTevStage(u32 param_0) { + return NULL; +} + +/* 802EA13C-802EA144 2E4A7C 0008+00 0/0 1/0 0/0 .text getTevColor__11J2DTevBlockFUl */ +J2DGXColorS10* J2DTevBlock::getTevColor(u32 param_0) { + return NULL; +} + +/* 802EA144-802EA14C 2E4A84 0008+00 0/0 1/0 0/0 .text getTevOrder__11J2DTevBlockFUl */ +J2DTevOrder* J2DTevBlock::getTevOrder(u32 param_0) { + return NULL; +} + +/* 802EA14C-802EA154 2E4A8C 0008+00 0/0 1/0 0/0 .text getTevKAlphaSel__11J2DTevBlockFUl + */ +u8 J2DTevBlock::getTevKAlphaSel(u32 param_0) { + return 0; +} + +/* 802EA154-802EA15C 2E4A94 0008+00 0/0 1/0 0/0 .text getTevKColorSel__11J2DTevBlockFUl + */ +u8 J2DTevBlock::getTevKColorSel(u32 param_0) { + return 0; +} + +/* 802EA15C-802EA164 2E4A9C 0008+00 0/0 1/0 0/0 .text getTevKColor__11J2DTevBlockFUl */ +JUtility::TColor* J2DTevBlock::getTevKColor(u32 param_0) { + return NULL; +} + +/* 802EA164-802EA170 2E4AA4 000C+00 0/0 1/0 0/0 .text getFontNo__11J2DTevBlockCFv */ +u16 J2DTevBlock::getFontNo() const { + return 0xFFFF; +} + +/* 802EA170-802EA17C 2E4AB0 000C+00 0/0 1/0 0/0 .text getTexNo__11J2DTevBlockCFUl */ +u32 J2DTevBlock::getTexNo(u32 param_0) const { + return 0xFFFF; +} + +/* 802EA17C-802EA184 2E4ABC 0008+00 0/0 1/0 0/0 .text getTevStageNum__11J2DTevBlockCFv */ +u8 J2DTevBlock::getTevStageNum() const { + return 1; +} + +/* 802EA184-802EA18C 2E4AC4 0008+00 0/0 1/0 0/0 .text getIndTevStage__11J2DTevBlockFUl */ +J2DIndTevStage* J2DTevBlock::getIndTevStage(u32 param_0) { + return NULL; +} + +/* 802EA18C-802EA194 2E4ACC 0008+00 0/0 2/0 0/0 .text getIndTexCoordScale__11J2DIndBlockFUl */ +J2DIndTexCoordScale* J2DIndBlock::getIndTexCoordScale(u32 param_0) { + return NULL; +} + +/* 802EA194-802EA19C 2E4AD4 0008+00 0/0 2/0 0/0 .text getIndTexMtx__11J2DIndBlockFUl */ +J2DIndTexMtx* J2DIndBlock::getIndTexMtx(u32 param_0) { + return NULL; +} + +/* 802EA19C-802EA1A4 2E4ADC 0008+00 0/0 2/0 0/0 .text getIndTexOrder__11J2DIndBlockFUl */ +J2DIndTexOrder* J2DIndBlock::getIndTexOrder(u32 param_0) { + return NULL; +} + +/* 802EA1A4-802EA1AC 2E4AE4 0008+00 0/0 2/0 0/0 .text getIndTexStageNum__11J2DIndBlockCFv + */ +u8 J2DIndBlock::getIndTexStageNum() const { + return 0; +} + +/* ############################################################################################## */ +/* 803A1B80-803A1BA0 02E1E0 0020+00 0/0 3/3 0/0 .rodata j2dDefaultTexCoordInfo */ +J2DTexCoordInfo const j2dDefaultTexCoordInfo[8] = { + {GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, 0}, {GX_TG_MTX2x4, GX_TG_TEX1, GX_IDENTITY, 0}, + {GX_TG_MTX2x4, GX_TG_TEX2, GX_IDENTITY, 0}, {GX_TG_MTX2x4, GX_TG_TEX3, GX_IDENTITY, 0}, + {GX_TG_MTX2x4, GX_TG_TEX4, GX_IDENTITY, 0}, {GX_TG_MTX2x4, GX_TG_TEX5, GX_IDENTITY, 0}, + {GX_TG_MTX2x4, GX_TG_TEX6, GX_IDENTITY, 0}, {GX_TG_MTX2x4, GX_TG_TEX7, GX_IDENTITY, 0}, +}; + +/* 803A1BA0-803A1BC4 02E200 0024+00 0/0 3/3 0/0 .rodata j2dDefaultTexMtxInfo */ +J2DTexMtxInfo const j2dDefaultTexMtxInfo = {1, 1, 255, 255, 0.5f, 0.5f, + 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f}; + +/* 803A1BC4-803A1BE0 02E224 001C+00 0/0 3/3 0/0 .rodata j2dDefaultIndTexMtxInfo */ +J2DIndTexMtxInfo const j2dDefaultIndTexMtxInfo = {{0.5f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f}, 1}; + +/* 803A1BE0-803A1BF4 02E240 0014+00 0/0 1/1 0/0 .rodata j2dDefaultTevStageInfo */ +extern J2DTevStageInfo const j2dDefaultTevStageInfo = { + 4, GX_CC_RASC, GX_CC_ZERO, GX_CC_ZERO, GX_CC_CPREV, GX_TEV_ADD, + GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV, GX_CA_RASA, GX_CA_ZERO, + GX_CA_ZERO, GX_CA_APREV, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, + GX_TEVPREV}; + +/* 803A1BF4-803A1C00 02E254 000C+00 0/0 7/7 0/0 .rodata j2dDefaultIndTevStageInfo */ +extern const J2DIndTevStageInfo j2dDefaultIndTevStageInfo = { + GX_INDTEXSTAGE0, GX_ITB_NONE, GX_ITB_NONE, GX_ITM_OFF, GX_ITW_OFF, + GX_ITW_OFF, 0, 0, GX_ITBA_OFF, +}; + +/* 8045617C-80456180 00477C 0004+00 0/0 1/1 0/0 .sdata2 j2dDefaultColInfo */ +extern const GXColor j2dDefaultColInfo = {255, 255, 255, 255}; + +/* 80456180-80456184 004780 0004+00 0/0 7/7 0/0 .sdata2 j2dDefaultTevOrderInfoNull */ +extern const J2DTevOrderInfo j2dDefaultTevOrderInfoNull = { + GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL, 0}; + +/* 80456184-80456188 004784 0002+02 0/0 3/3 0/0 .sdata2 j2dDefaultIndTexOrderNull */ +extern const J2DIndTexOrderInfo j2dDefaultIndTexOrderNull = { + GX_TEXCOORD_NULL, + GX_TEXMAP_NULL, +}; + +/* 80456188-80456190 004788 0008+00 0/0 5/5 0/0 .sdata2 j2dDefaultTevColor */ +extern const GXColorS10 j2dDefaultTevColor = {255, 255, 255, 255}; + +/* 80456190-80456194 004790 0002+02 0/0 3/3 0/0 .sdata2 j2dDefaultIndTexCoordScaleInfo */ +extern const J2DIndTexCoordScaleInfo j2dDefaultIndTexCoordScaleInfo = { + GX_ITS_1, + GX_ITS_1, +}; + +/* 80456194-80456198 004794 0004+00 0/0 5/5 0/0 .sdata2 j2dDefaultTevKColor */ +extern const GXColor j2dDefaultTevKColor = {255, 255, 255, 255}; + +/* 80456198-8045619C 004798 0004+00 0/0 2/2 0/0 .sdata2 j2dDefaultTevSwapMode */ +extern const J2DTevSwapModeInfo j2dDefaultTevSwapMode = {GX_TEV_SWAP0, GX_TEV_SWAP0, 0, 0}; + +/* 8045619C-804561A0 00479C 0004+00 0/0 6/6 0/0 .sdata2 j2dDefaultTevSwapModeTable */ +extern const J2DTevSwapModeTableInfo j2dDefaultTevSwapModeTable = { + GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA}; + +/* 804561A0-804561A4 0047A0 0004+00 0/0 3/3 0/0 .sdata2 j2dDefaultBlendInfo */ +extern const J2DBlendInfo j2dDefaultBlendInfo = {GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, + GX_LO_NOOP}; + +/* 804561A4-804561A8 0047A4 0004+00 0/0 1/1 0/0 .sdata2 None */ +extern const u8 j2dDefaultPEBlockDither = 0; + +/* 804561A8-804561AC 0047A8 0004+00 0/0 3/3 0/0 .sdata2 j2dDefaultColorChanInfo */ +extern const J2DColorChanInfo j2dDefaultColorChanInfo = {0, 3, 0, 0}; + +/* 804561AC-804561AE 0047AC 0002+00 0/0 1/1 0/0 .sdata2 None */ +extern const u8 data_804561AC = 0x1B; + +/* 804561AE-804561B0 0047AE 0002+00 0/0 3/3 0/0 .sdata2 j2dDefaultAlphaCmp */ +extern const u16 j2dDefaultAlphaCmp = 0x00E7;
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DTextBox.cpp b/src/JSystem/J2DGraph/J2DTextBox.cpp new file mode 100644 index 0000000000..b08ac705ac --- /dev/null +++ b/src/JSystem/J2DGraph/J2DTextBox.cpp @@ -0,0 +1,491 @@ +// +// Generated By: dol2asm +// Translation Unit: J2DTextBox +// + +#include "JSystem/J2DGraph/J2DTextBox.h" +#include "JSystem/J2DGraph/J2DPrint.h" +#include "JSystem/JSupport/JSURandomInputStream.h" +#include "JSystem/JUtility/JUTResFont.h" +#include "dol2asm.h" + +/* 802FF660-802FF6D8 2F9FA0 0078+00 0/0 1/1 0/0 .text __ct__10J2DTextBoxFv */ +J2DTextBox::J2DTextBox() + : mFont(NULL), mCharColor(), mGradientColor(), mStringPtr(NULL), mWhiteColor(), mBlackColor() { + initiate(NULL, NULL, 0, HBIND_LEFT, VBIND_TOP); +} + +/* 802FF6D8-802FF75C 2FA018 0084+00 0/0 1/1 0/0 .text + * __ct__10J2DTextBoxFP7J2DPaneP20JSURandomInputStreamP10JKRArchive */ +J2DTextBox::J2DTextBox(J2DPane* p_pane, JSURandomInputStream* p_stream, JKRArchive* p_archive) + : mFont(NULL), mCharColor(), mGradientColor(), mStringPtr(NULL), mWhiteColor(), mBlackColor() { + private_readStream(p_pane, p_stream, p_archive); +} + +/* 802FF75C-802FFBC4 2FA09C 0468+00 0/0 1/1 0/0 .text + * __ct__10J2DTextBoxFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial */ +J2DTextBox::J2DTextBox(J2DPane* p_pane, JSURandomInputStream* p_stream, u32 param_2, + J2DMaterial* p_material) + : mFont(NULL), mCharColor(), mGradientColor(), mStringPtr(NULL), mWhiteColor(), mBlackColor() { + J2DTextBoxInfo info; + + int startPos = p_stream->getPosition(); + + J2DTbxBlockHeader header; + p_stream->read(&header, 8); + mKind = 'TBX1'; + + int panHeaderPos = p_stream->getPosition(); + J2DTbxBlockHeader panHeader; + p_stream->peek(&panHeader, 8); + makePaneExStream(p_pane, p_stream); + p_stream->seek(panHeaderPos + panHeader.mSize, JSUStreamSeekFrom_SET); + + p_stream->read(&info, 0x20); + J2DMaterial* mat = NULL; + + if (info.mMaterialNum != 0xFFFF) { + mat = &p_material[info.mMaterialNum]; + + if (mat != NULL) { + if (mat->getTevBlock() != NULL) { + JUTFont* font = mat->getTevBlock()->getFont(); + + if (font != NULL) { + mFont = font; + mat->getTevBlock()->setFontUndeleteFlag(); + } + } + mAlpha = mat->getColorBlock()->getMatColor(0)->a; + } + } + + mCharSpacing = info.mCharSpace; + mLineSpacing = info.mLineSpace; + mFontSizeX = info.mFontSizeX; + mFontSizeY = info.mFontSizeY; + mFlags = (info.mHBind << 2) | info.mVBind; + mCharColor = JUtility::TColor(info.mCharColor); + mGradientColor = JUtility::TColor(info.mGradColor); + setConnectParent(info.mConnected); + + u16 strLength = 0; + if (!(param_2 & 0x2000000)) { + strLength = info.field_0x1c; + if ((s16)info.field_0x1c == -1) { + strLength = info.field_0x1e + 1; + } + } + + mStringLength = 0; + mStringPtr = NULL; + + if (strLength != 0) { + mStringPtr = new char[strLength]; + } + + if (mStringPtr != NULL) { + mStringLength = strLength; + int temp_r0 = (u16)strLength - 1; + u16 var_r26_2 = info.field_0x1e; + + if (temp_r0 < var_r26_2) { + var_r26_2 = (u16)temp_r0; + } + + p_stream->peek(mStringPtr, var_r26_2); + mStringPtr[var_r26_2] = 0; + } + + p_stream->skip(info.field_0x1e); + p_stream->seek(startPos + header.mSize, JSUStreamSeekFrom_SET); + mBlackColor = JUtility::TColor(0); + mWhiteColor = JUtility::TColor(0xFFFFFFFF); + + if (mat != NULL && mat->getTevBlock() != NULL) { + if (mat->getTevBlock()->getTevStageNum() != 1) { + J2DGXColorS10* color0p = mat->getTevBlock()->getTevColor(0); + GXColorS10 color0; + color0.r = color0p->r; + color0.g = color0p->g; + color0.b = color0p->b; + color0.a = color0p->a; + + J2DGXColorS10* color1p = mat->getTevBlock()->getTevColor(1); + GXColorS10 color1; + color1.r = color1p->r; + color1.g = color1p->g; + color1.b = color1p->b; + color1.a = color1p->a; + + mBlackColor = JUtility::TColor(((u8)color0.r << 0x18) | ((u8)color0.g << 0x10) | + ((u8)color0.b << 8) | (u8)color0.a); + mWhiteColor = JUtility::TColor(((u8)color1.r << 0x18) | ((u8)color1.g << 0x10) | + ((u8)color1.b << 8) | (u8)color1.a); + } + } + + field_0x10c = 0.0f; + field_0x110 = 0.0f; + mTextFontOwned = true; +} + +/* 802FFBC4-802FFC58 2FA504 0094+00 0/0 1/1 0/0 .text + * __ct__10J2DTextBoxFUxRCQ29JGeometry8TBox2<f>PC7ResFONTPCcs18J2DTextBoxHBinding18J2DTextBoxVBinding + */ +J2DTextBox::J2DTextBox(u64 tag, JGeometry::TBox2<f32> const& bounds, ResFONT const* p_font, + char const* string, s16 strLength, J2DTextBoxHBinding hBind, + J2DTextBoxVBinding vBind) + : J2DPane(tag, bounds), mFont(NULL), mCharColor(), mGradientColor(), mStringPtr(NULL), + mWhiteColor(), mBlackColor() { + initiate(p_font, string, strLength, hBind, vBind); +} + +/* 802FFC58-802FFE88 2FA598 0230+00 2/2 1/0 0/0 .text + * initiate__10J2DTextBoxFPC7ResFONTPCcs18J2DTextBoxHBinding18J2DTextBoxVBinding */ +void J2DTextBox::initiate(ResFONT const* p_font, char const* string, s16 length, + J2DTextBoxHBinding hBind, J2DTextBoxVBinding vBind) { + if (p_font != NULL) { + mFont = new JUTResFont(p_font, NULL); + } + + mCharColor.set(0xFFFFFFFF); + mGradientColor.set(0xFFFFFFFF); + mBlackColor = JUtility::TColor(0); + mWhiteColor = JUtility::TColor(0xFFFFFFFF); + + mFlags = (hBind << 2) | vBind; + mStringLength = 0; + mStringPtr = NULL; + + if (string != NULL && length != 0) { + u32 len = strlen(string); + u16 stringLen = length; + + if (length == -1) { + if (len >= 0xFFFF) { + len = 0xFFFF - 1; + } + stringLen = len + 1; + } + + mStringPtr = new char[stringLen]; + + if (stringLen != 0 && mStringPtr != NULL) { + strncpy(mStringPtr, string, stringLen - 1); + mStringPtr[stringLen - 1] = 0; + mStringLength = stringLen; + } + } + + field_0x10c = 0.0f; + field_0x110 = 0.0f; + mCharSpacing = 0.0f; + + if (mFont == NULL) { + mLineSpacing = 0.0f; + mFontSizeX = 0.0f; + mFontSizeY = 0.0f; + } else { + mLineSpacing = mFont->getLeading(); + mFontSizeX = mFont->getWidth(); + mFontSizeY = mFont->getHeight(); + } + + mKind = 'TBX1'; + mTextFontOwned = true; +} + +/* 802FFE88-803001E0 2FA7C8 0358+00 1/1 0/0 0/0 .text + * private_readStream__10J2DTextBoxFP7J2DPaneP20JSURandomInputStreamP10JKRArchive */ +void J2DTextBox::private_readStream(J2DPane* p_pane, JSURandomInputStream* p_stream, + JKRArchive* p_archive) { + int position = p_stream->getPosition(); + + J2DTbxBlockHeader header; + p_stream->read(&header, 8); + mKind = header.mTag; + + makePaneStream(p_pane, p_stream); + u8 spA = p_stream->readU8(); + + ResFONT* fontPtr = (ResFONT*)getPointer(p_stream, 'FONT', p_archive); + if (fontPtr != NULL) { + mFont = new JUTResFont(fontPtr, NULL); + } + + mCharColor.set(p_stream->read32b()); + mGradientColor.set(p_stream->read32b()); + mFlags = p_stream->read8b(); + mCharSpacing = p_stream->readS16(); + mLineSpacing = p_stream->readS16(); + mFontSizeX = p_stream->read16b(); + mFontSizeY = p_stream->read16b(); + + s16 stringLen = p_stream->read16b(); + mStringPtr = new char[stringLen + 1]; + + if (mStringPtr != NULL) { + p_stream->read(mStringPtr, stringLen); + mStringPtr[stringLen] = 0; + mStringLength = stringLen + 1; + } else { + p_stream->skip(stringLen); + mStringLength = 0; + } + + spA -= 10; + if (spA != 0) { + u8 sp8 = p_stream->read8b(); + if (sp8 != 0) { + setConnectParent(true); + } + + spA--; + } + + mBlackColor = JUtility::TColor(0); + mWhiteColor = JUtility::TColor(0xFFFFFFFF); + + if (spA != 0) { + mBlackColor.set(p_stream->read32b()); + spA--; + } + + if (spA != 0) { + mWhiteColor.set(p_stream->read32b()); + } + + field_0x10c = 0.0f; + field_0x110 = 0.0f; + p_stream->seek(position + header.mSize, JSUStreamSeekFrom_SET); + mTextFontOwned = true; +} + +/* 803001E0-80300278 2FAB20 0098+00 1/0 2/2 0/0 .text __dt__10J2DTextBoxFv */ +J2DTextBox::~J2DTextBox() { + if (mTextFontOwned) { + delete mFont; + } + + delete[] mStringPtr; +} + +/* 80300278-803002E8 2FABB8 0070+00 1/0 0/0 0/0 .text setFont__10J2DTextBoxFP7JUTFont */ +void J2DTextBox::setFont(JUTFont* p_font) { + if (p_font) { + if (mTextFontOwned) { + delete mFont; + } + mFont = p_font; + mTextFontOwned = false; + } +} + +/* 803002E8-80300490 2FAC28 01A8+00 1/0 0/0 0/0 .text draw__10J2DTextBoxFff */ +void J2DTextBox::draw(f32 posX, f32 posY) { + Mtx m; + + if (isVisible()) { + J2DPrint print(mFont, mCharSpacing, mLineSpacing, mCharColor, mGradientColor, mBlackColor, + mWhiteColor); + print.setFontSize(mFontSizeX, mFontSizeY); + makeMatrix(posX, posY, 0.0f, 0.0f); + + GXLoadPosMtxImm(mPositionMtx, GX_PNMTX0); + GXSetCurrentMtx(0); + GXSetNumIndStages(0); + for (int i = 0; i < 16; i++) { + GXSetTevDirect((GXTevStageID)i); + } + GXSetNumTexGens(1); + GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 60, GX_FALSE, 125); + + if (mStringPtr != NULL) { + print.print(0.0f, 0.0f, mAlpha, "%s", mStringPtr); + } + MTXIdentity(m); + GXLoadPosMtxImm(m, 0); + } +} + +/* 80300490-80300658 2FADD0 01C8+00 1/0 1/1 0/0 .text draw__10J2DTextBoxFfff18J2DTextBoxHBinding + */ +void J2DTextBox::draw(f32 posX, f32 posY, f32 param_2, J2DTextBoxHBinding hBind) { + Mtx m; + + if (isVisible()) { + J2DPrint print(mFont, mCharSpacing, mLineSpacing, mCharColor, mGradientColor, mBlackColor, + mWhiteColor); + print.setFontSize(mFontSizeX, mFontSizeY); + makeMatrix(posX, posY, 0.0f, 0.0f); + + GXLoadPosMtxImm(mPositionMtx, GX_PNMTX0); + GXSetCurrentMtx(0); + GXSetNumIndStages(0); + for (int i = 0; i < 16; i++) { + GXSetTevDirect((GXTevStageID)i); + } + GXSetNumTexGens(1); + GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 60, GX_FALSE, 125); + + if (mStringPtr != NULL) { + print.printReturn(mStringPtr, param_2, 0.0f, hBind, VBIND_TOP, 0.0f, -mFontSizeY, + mAlpha); + } + MTXIdentity(m); + GXLoadPosMtxImm(m, 0); + } +} + +/* 80300658-80300660 2FAF98 0008+00 0/0 62/62 2/2 .text getStringPtr__10J2DTextBoxCFv */ +char* J2DTextBox::getStringPtr() const { + return mStringPtr; +} + +/* 80300660-8030074C 2FAFA0 00EC+00 0/0 6/6 0/0 .text setString__10J2DTextBoxFPCce */ +s32 J2DTextBox::setString(char const* string, ...) { + va_list args; + va_start(args, string); + + delete[] mStringPtr; + + u32 len = strlen(string); + + if (len >= 0xFFFF) { + len = 0xFFFF - 1; + } + + mStringLength = 0; + char* tmp = new char[len + 1]; + mStringPtr = tmp; + + if (mStringPtr) { + mStringLength = len + 1; + strcpy(mStringPtr, string); + } + + va_end(args); + return len; +} + +/* 8030074C-80300870 2FB08C 0124+00 0/0 41/41 2/2 .text setString__10J2DTextBoxFsPCce */ +s32 J2DTextBox::setString(s16 length, char const* string, ...) { + va_list args; + va_start(args, string); + + delete[] mStringPtr; + mStringPtr = NULL; + + u32 len = strlen(string); + u16 stringLen = length; + + if (length == -1) { + if (len >= 0xFFFF) { + len = 0xFFFF - 1; + } + stringLen = len + 1; + } + + mStringLength = 0; + + if (stringLen != 0) { + mStringPtr = new char[stringLen]; + } + + if (mStringPtr != NULL) { + strncpy(mStringPtr, string, stringLen - 1); + mStringPtr[stringLen - 1] = 0; + mStringLength = stringLen; + } + + va_end(args); + return len; +} + +/* 80300870-803008E8 2FB1B0 0078+00 1/0 1/0 0/0 .text setConnectParent__10J2DTextBoxFb */ +bool J2DTextBox::setConnectParent(bool connected) { + if (getPaneTree()->getParent() == NULL) { + return false; + } + + if (getPaneTree()->getParent()->getObject()->getTypeID() != 0x11) { + return false; + } + + mConnected = connected; + return connected; +} + +/* 803008E8-80300950 2FB228 0068+00 1/0 1/0 0/0 .text drawSelf__10J2DTextBoxFff */ +void J2DTextBox::drawSelf(f32 param_0, f32 param_1) { + Mtx identity; + MTXIdentity(identity); + + drawSelf(param_0, param_1, &identity); +} + +/* 80300950-80300AF8 2FB290 01A8+00 1/0 0/0 0/0 .text drawSelf__10J2DTextBoxFffPA3_A4_f + */ +void J2DTextBox::drawSelf(f32 param_0, f32 param_1, Mtx* p_mtx) { + Mtx m; + + J2DPrint print(mFont, mCharSpacing, mLineSpacing, mCharColor, mGradientColor, mBlackColor, + mWhiteColor); + print.setFontSize(mFontSizeX, mFontSizeY); + MTXConcat(*p_mtx, mGlobalMtx, m); + + GXLoadPosMtxImm(m, GX_PNMTX0); + GXSetNumIndStages(0); + for (int i = 0; i < 16; i++) { + GXSetTevDirect((GXTevStageID)i); + } + GXSetNumTexGens(1); + GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 60, GX_FALSE, 125); + + print.locate(param_0 + mBounds.i.x, param_1 + mBounds.i.y); + if (mStringPtr != NULL) { + print.printReturn(mStringPtr, mBounds.getWidth() + 0.0001f, mBounds.getHeight(), + getHBinding(), getVBinding(), field_0x10c, field_0x110, mColorAlpha); + } +} + +/* 80300AF8-80300BFC 2FB438 0104+00 1/0 1/0 0/0 .text resize__10J2DTextBoxFff */ +void J2DTextBox::resize(f32 x, f32 y) { + if (mConnected && getPaneTree() != NULL && getPaneTree()->getParent() != NULL) { + J2DPane* obj = getPaneTree()->getParent()->getObject(); + + if (obj->getTypeID() == 0x11) { + f32 obj_x = obj->getWidth() + (x - getWidth()); + f32 obj_y = obj->getHeight() + (y - getHeight()); + obj->resize(obj_x, obj_y); + return; + } + } + + J2DPane::resize(x, y); +} + +/* 80300BFC-80300C68 2FB53C 006C+00 1/0 0/0 0/0 .text isUsed__10J2DTextBoxFPC7ResFONT */ +bool J2DTextBox::isUsed(ResFONT const* p_font) { + if (mFont != NULL && mFont->getResFont() == p_font) { + return true; + } + + return J2DPane::isUsed(p_font); +} + +/* 80300C68-80300C70 2FB5A8 0008+00 1/0 1/0 0/0 .text getTypeID__10J2DTextBoxCFv */ +u16 J2DTextBox::getTypeID() const { + return 19; +} + +/* 80300C70-80300C90 2FB5B0 0020+00 1/0 0/0 0/0 .text isUsed__10J2DTextBoxFPC7ResTIMG */ +bool J2DTextBox::isUsed(ResTIMG const* p_timg) { + return J2DPane::isUsed(p_timg); +} + +/* 80300C90-80300C94 2FB5D0 0004+00 1/0 0/0 0/0 .text rewriteAlpha__10J2DTextBoxFv */ +void J2DTextBox::rewriteAlpha() { + /* empty function */ +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DTextBoxEx.cpp b/src/JSystem/J2DGraph/J2DTextBoxEx.cpp new file mode 100644 index 0000000000..9944dd2a20 --- /dev/null +++ b/src/JSystem/J2DGraph/J2DTextBoxEx.cpp @@ -0,0 +1,598 @@ +// +// J2DTextBoxEx +// + +#include "JSystem/J2DGraph/J2DTextBoxEx.h" +#include "JSystem/J2DGraph/J2DPrint.h" +#include "JSystem/JSupport/JSURandomInputStream.h" +#include "JSystem/JUtility/JUTResFont.h" + +/* 803071E4-8030751C 301B24 0338+00 0/0 1/1 0/0 .text + * __ct__12J2DTextBoxExFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial */ +J2DTextBoxEx::J2DTextBoxEx(J2DPane* p_pane, JSURandomInputStream* p_stream, u32 param_2, + J2DMaterial* p_material) { + J2DTextBoxInfo info; + + mVisibilityAnm = NULL; + + int startPos = p_stream->getPosition(); + + J2DTbxBlockHeader header; + p_stream->read(&header, 8); + mKind = header.mTag; + + int panHeaderPos = p_stream->getPosition(); + J2DTbxBlockHeader panHeader; + p_stream->peek(&panHeader, 8); + makePaneExStream(p_pane, p_stream); + p_stream->seek(panHeaderPos + panHeader.mSize, JSUStreamSeekFrom_SET); + + p_stream->read(&info, 0x20); + field_0x13c = info.field_0x2; + field_0x13e = info.mMaterialNum; + mMaterial = NULL; + + if (field_0x13e != 0xFFFF) { + mMaterial = &p_material[field_0x13e]; + p_material[field_0x13e].field_0x4 = this; + rewriteAlpha(); + + if (mMaterial != NULL) { + if (mMaterial->getTevBlock() != NULL) { + mFont = mMaterial->getTevBlock()->getFont(); + } + } + } + + mCharSpacing = info.mCharSpace; + mLineSpacing = info.mLineSpace; + mFontSizeX = info.mFontSizeX; + mFontSizeY = info.mFontSizeY; + mFlags = (info.mHBind << 2) | info.mVBind; + mCharColor = JUtility::TColor(info.mCharColor); + mGradientColor = JUtility::TColor(info.mGradColor); + setConnectParent(info.mConnected); + + u16 strLength = 0; + if (!(param_2 & 0x2000000)) { + strLength = info.field_0x1c; + if ((s16)info.field_0x1c == -1) { + strLength = info.field_0x1e + 1; + } + } + + mStringLength = 0; + mStringPtr = NULL; + + if (strLength != 0) { + mStringPtr = new char[strLength]; + } + + if (mStringPtr != NULL) { + mStringLength = strLength; + int temp_r0 = (u16)strLength - 1; + u16 var_r26_2 = info.field_0x1e; + + if (temp_r0 < var_r26_2) { + var_r26_2 = (u16)temp_r0; + } + + p_stream->peek(mStringPtr, var_r26_2); + mStringPtr[var_r26_2] = 0; + } + + p_stream->skip(info.field_0x1e); + p_stream->seek(startPos + header.mSize, JSUStreamSeekFrom_SET); + + field_0x10c = 0.0f; + field_0x110 = 0.0f; + mTextFontOwned = false; + field_0x140 = 0; +} + +/* 8030751C-803075AC 301E5C 0090+00 1/0 0/0 0/0 .text __dt__12J2DTextBoxExFv */ +J2DTextBoxEx::~J2DTextBoxEx() { + if (field_0x140 != 0) { + delete mMaterial; + } +} + +/* 803075AC-803078AC 301EEC 0300+00 1/0 0/0 0/0 .text drawSelf__12J2DTextBoxExFffPA3_A4_f + */ +void J2DTextBoxEx::drawSelf(f32 param_0, f32 param_1, Mtx* p_mtx) { + Mtx m; + + JUTFont* font = NULL; + if (mMaterial != NULL && mMaterial->getTevBlock() != NULL) { + font = mMaterial->getTevBlock()->getFont(); + } + + J2DPrint print(font, (int)mCharSpacing, (int)mLineSpacing, mCharColor, mGradientColor, mBlackColor, + mWhiteColor); + print.setFontSize((int)mFontSizeX, (int)mFontSizeY); + + if (mMaterial != NULL) { + mMaterial->setGX(); + MTXConcat(*p_mtx, mGlobalMtx, m); + + GXLoadPosMtxImm(m, GX_PNMTX0); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + + print.locate(param_0 + mBounds.i.x, param_1 + mBounds.i.y); + + if (mMaterial->isVisible() && mStringPtr != NULL) { + u8 alpha = 255; + + if (mMaterial->getColorBlock()->getColorChan(1)->getMatSrc() == 1) { + if (mMaterial->getMaterialAlphaCalc() == 1) { + alpha = mColorAlpha; + } + } else if (mIsInfluencedAlpha) { + GXSetChanMatColor(GX_ALPHA0, JUtility::TColor(mColorAlpha)); + } + + print.printReturn(mStringPtr, (int)(mBounds.getWidth() + 0.0001f), (int)mBounds.getHeight(), + getHBinding(), getVBinding(), field_0x10c, field_0x110, alpha); + } + } +} + +/* 803078AC-80307AF0 3021EC 0244+00 1/0 0/0 0/0 .text draw__12J2DTextBoxExFff */ +void J2DTextBoxEx::draw(f32 posX, f32 posY) { + Mtx m; + + if (isVisible()) { + JUTFont* font = NULL; + if (mMaterial != NULL && mMaterial->getTevBlock() != NULL) { + font = mMaterial->getTevBlock()->getFont(); + } + + J2DPrint print(font, mCharSpacing, mLineSpacing, mCharColor, mGradientColor, mBlackColor, + mWhiteColor); + print.setFontSize(mFontSizeX, mFontSizeY); + mColorAlpha = mAlpha; + + if (mMaterial != NULL) { + mMaterial->setGX(); + makeMatrix(posX, posY, 0.0f, 0.0f); + + GXLoadPosMtxImm(mPositionMtx, GX_PNMTX0); + GXSetCurrentMtx(0); + + if (!mMaterial->isVisible()) { + return; + } + + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + + if (mStringPtr != NULL) { + u8 alpha = 255; + if (mMaterial->getMaterialAlphaCalc() == 1) { + alpha = mColorAlpha; + } + + print.print(0.0f, 0.0f, alpha, "%s", mStringPtr); + } + + for (int i = 0; i < 4; i++) { + GXSetTevSwapModeTable((GXTevSwapSel)i, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA); + } + + GXSetNumIndStages(0); + + for (int i = 0; i < 16; i++) { + GXSetTevDirect((GXTevStageID)i); + } + + MTXIdentity(m); + GXLoadPosMtxImm(m, 0); + } + } +} + +/* 80307AF0-80307D5C 302430 026C+00 1/0 0/0 0/0 .text draw__12J2DTextBoxExFfff18J2DTextBoxHBinding + */ +void J2DTextBoxEx::draw(f32 posX, f32 posY, f32 param_2, J2DTextBoxHBinding hBind) { + Mtx m; + + if (isVisible()) { + JUTFont* font = NULL; + if (mMaterial != NULL && mMaterial->getTevBlock() != NULL) { + font = mMaterial->getTevBlock()->getFont(); + } + + J2DPrint print(font, mCharSpacing, mLineSpacing, mCharColor, mGradientColor, mBlackColor, + mWhiteColor); + print.setFontSize(mFontSizeX, mFontSizeY); + mColorAlpha = mAlpha; + + if (mMaterial != NULL) { + mMaterial->setGX(); + makeMatrix(posX, posY, 0.0f, 0.0f); + + GXLoadPosMtxImm(mPositionMtx, GX_PNMTX0); + GXSetCurrentMtx(0); + + if (!mMaterial->isVisible()) { + return; + } + + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + + if (mStringPtr != NULL) { + u8 alpha = 255; + if (mMaterial->getMaterialAlphaCalc() == 1) { + alpha = mColorAlpha; + } + + print.printReturn(mStringPtr, param_2, 0.0f, hBind, VBIND_TOP, 0.0f, -mFontSizeY, + alpha); + } + + for (int i = 0; i < 4; i++) { + GXSetTevSwapModeTable((GXTevSwapSel)i, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA); + } + + GXSetNumIndStages(0); + + for (int i = 0; i < 16; i++) { + GXSetTevDirect((GXTevStageID)i); + } + + MTXIdentity(m); + GXLoadPosMtxImm(m, 0); + } + } +} + +/* 80307D5C-80307DC0 30269C 0064+00 1/0 0/0 0/0 .text setFont__12J2DTextBoxExFP7JUTFont + */ +void J2DTextBoxEx::setFont(JUTFont* p_font) { + if (p_font != NULL && mMaterial != NULL && mMaterial->getTevBlock() != NULL) { + mMaterial->getTevBlock()->setFont(p_font); + mFont = p_font; + } +} + +/* 80307DC0-80307E0C 302700 004C+00 1/0 0/0 0/0 .text getFont__12J2DTextBoxExCFv */ +JUTFont* J2DTextBoxEx::getFont() const { + if (mMaterial != NULL && mMaterial->getTevBlock() != NULL) { + return mMaterial->getTevBlock()->getFont(); + } + + return NULL; +} + +/* 80307E0C-80307EF0 30274C 00E4+00 1/1 0/0 0/0 .text setTevOrder__12J2DTextBoxExFb */ +void J2DTextBoxEx::setTevOrder(bool param_0) { + u16 local_18[2]; + if (!param_0) { + local_18[0] = 4; + local_18[1] = 0xffff; + } else { + local_18[0] = 0xff; + local_18[1] = 0xff04; + } + for (u8 i = 0; i < 2; i++) { + if (mMaterial->getTevBlock()->getMaxStage() > i) { + J2DTevOrderInfo info; + info.mTexCoord = (local_18[i]) >> 8; + info.mTexMap = (local_18[i]) >> 8; + info.mColor = local_18[i] & 0xff; + J2DTevOrder tevOrder = info; + mMaterial->getTevBlock()->setTevOrder(i, tevOrder); + } + } +} + +/* 80307EF0-80307F94 302830 00A4+00 1/1 0/0 0/0 .text setTevStage__12J2DTextBoxExFb */ +void J2DTextBoxEx::setTevStage(bool param_0) { + J2DTevStage* stage = mMaterial->getTevBlock()->getTevStage(0); + + if (!param_0) { + setStage(stage, STAGE_0); + } else { + setStage(stage, STAGE_1); + setStage(mMaterial->getTevBlock()->getTevStage(1), STAGE_2); + } +} + +/* 80307F94-8030823C 3028D4 02A8+00 1/1 0/0 0/0 .text + * setStage__12J2DTextBoxExFP11J2DTevStageQ212J2DTextBoxEx10stage_enum */ +void J2DTextBoxEx::setStage(J2DTevStage* param_0, J2DTextBoxEx::stage_enum param_1) { + const u8 tevColors[3][4] = { + {0x0F, 0x08, 0x0A, 0x0F}, {0x02, 0x04, 0x08, 0x0F}, {0x0F, 0x0A, 0x00, 0x0F}, + }; + const u8 tevAlpha[3][4] = { + {0x07, 0x04, 0x05, 0x07}, {0x01, 0x02, 0x04, 0x07}, {0x07, 0x05, 0x00, 0x07}, + }; + + const u8 tevColorOps[3][5] = { + {0x00, 0x00, 0x00, 0x01, 0x00}, + {0x00, 0x00, 0x00, 0x01, 0x00}, + {0x00, 0x00, 0x00, 0x01, 0x00}, + }; + + const u8 tevAlphaOps[3][5] = { + {0x00, 0x00, 0x00, 0x01, 0x00}, + {0x00, 0x00, 0x00, 0x01, 0x00}, + {0x00, 0x00, 0x00, 0x01, 0x00}, + }; + + param_0->setTevColorAB(tevColors[param_1][0], tevColors[param_1][1]); + param_0->setTevColorCD(tevColors[param_1][2], tevColors[param_1][3]); + param_0->setTevColorOp( + tevColorOps[param_1][0], tevColorOps[param_1][1], tevColorOps[param_1][2], tevColorOps[param_1][3], tevColorOps[param_1][4]); + param_0->setAlphaABCD( + tevAlpha[param_1][0], tevAlpha[param_1][1], tevAlpha[param_1][2], tevAlpha[param_1][3]); + param_0->setTevAlphaOp( + tevAlphaOps[param_1][0], tevAlphaOps[param_1][1], tevAlphaOps[param_1][2], tevAlphaOps[param_1][3], tevAlphaOps[param_1][4]); +} + +/* 8030823C-803082C4 302B7C 0088+00 1/0 0/0 0/0 .text setBlack__12J2DTextBoxExFQ28JUtility6TColor + */ +bool J2DTextBoxEx::setBlack(JUtility::TColor black) { + JUtility::TColor tevBlack; + JUtility::TColor tevWhite; + + if (!getBlackWhite(&tevBlack, &tevWhite)) { + return false; + } else { + return setBlackWhite(black, tevWhite); + } +} + +/* 803082C4-8030834C 302C04 0088+00 1/0 0/0 0/0 .text setWhite__12J2DTextBoxExFQ28JUtility6TColor + */ +bool J2DTextBoxEx::setWhite(JUtility::TColor white) { + JUtility::TColor tevBlack; + JUtility::TColor tevWhite; + + if (!getBlackWhite(&tevBlack, &tevWhite)) { + return false; + } else { + return setBlackWhite(tevBlack, white); + } +} + +/* 8030834C-803084CC 302C8C 0180+00 1/0 0/0 0/0 .text + * setBlackWhite__12J2DTextBoxExFQ28JUtility6TColorQ28JUtility6TColor */ +bool J2DTextBoxEx::setBlackWhite(JUtility::TColor param_0, JUtility::TColor param_1) { + if (mMaterial == NULL) { + return false; + } + + if (mMaterial->getTevBlock() == NULL) { + return false; + } + + if (!isSetBlackWhite(param_0, param_1)) { + return false; + } + + bool bvar = false; + if (param_0 != 0 || param_1 != -1) { + bvar = true; + } + + mMaterial->getTevBlock()->setTevStageNum(bvar ? 2 : 1); + setTevOrder(bvar); + setTevStage(bvar); + + if (bvar) { + J2DGXColorS10 color; + color.r = param_0.r; + color.g = param_0.g; + color.b = param_0.b; + color.a = param_0.a; + mMaterial->getTevBlock()->setTevColor(0, color); + + color.r = param_1.r; + color.g = param_1.g; + color.b = param_1.b; + color.a = param_1.a; + mMaterial->getTevBlock()->setTevColor(1, color); + } + + return true; +} + +/* 803084CC-80308668 302E0C 019C+00 4/4 0/0 0/0 .text + * getBlackWhite__12J2DTextBoxExCFPQ28JUtility6TColorPQ28JUtility6TColor */ +bool J2DTextBoxEx::getBlackWhite(JUtility::TColor* param_0, JUtility::TColor* param_1) const { + if (mMaterial == NULL) { + return false; + } + + if (mMaterial->getTevBlock() == NULL) { + return false; + } + + bool tevStageNum = mMaterial->getTevBlock()->getTevStageNum() != 1; + *param_0 = JUtility::TColor(0); + *param_1 = JUtility::TColor(0xffffffff); + if (tevStageNum) { + J2DGXColorS10* local_30 = mMaterial->getTevBlock()->getTevColor(0); + s16 color0r = local_30->r; + s16 color0g = local_30->g; + s16 color0b = local_30->b; + s16 color0a = local_30->a; + J2DGXColorS10* local_38 = mMaterial->getTevBlock()->getTevColor(1); + s16 color1r = local_38->r; + s16 color1g = local_38->g; + s16 color1b = local_38->b; + s16 color1a = local_38->a; + *param_0 = JUtility::TColor( + (((u8)color0r) << 24) | (((u8)color0g) << 16) | (((u8)color0b) << 8) | + ((u8)color0a)); + *param_1 = JUtility::TColor( + (((u8)color1r) << 24) | (((u8)color1g) << 16) | (((u8)color1b) << 8) | + ((u8)color1a)); + } + return true; +} + +/* 80308668-803086FC 302FA8 0094+00 1/1 0/0 0/0 .text + * isSetBlackWhite__12J2DTextBoxExCFQ28JUtility6TColorQ28JUtility6TColor */ +bool J2DTextBoxEx::isSetBlackWhite(JUtility::TColor param_0, JUtility::TColor param_1) const { + if ((u32)param_0 == 0 && (u32)param_1 == 0xffffffff) { + return 1; + } + mMaterial->getTevBlock()->getTevStageNum(); + if (mMaterial->getTevBlock()->getMaxStage() == 1) { + return 0; + } + return 1; +} + +/* 803086FC-8030875C 30303C 0060+00 1/0 0/0 0/0 .text getBlack__12J2DTextBoxExCFv */ +JUtility::TColor J2DTextBoxEx::getBlack() const { + JUtility::TColor black; + JUtility::TColor white; + if (getBlackWhite(&black, &white) == 0) { + return JUtility::TColor(0); + } + return black; +} + +/* 8030875C-803087BC 30309C 0060+00 1/0 0/0 0/0 .text getWhite__12J2DTextBoxExCFv */ +JUtility::TColor J2DTextBoxEx::getWhite() const { + JUtility::TColor black; + JUtility::TColor white; + if (getBlackWhite(&black, &white) == 0) { + return JUtility::TColor(0xffffffff); + } + return white; +} + +/* 803087BC-803087DC 3030FC 0020+00 1/0 0/0 0/0 .text setAlpha__12J2DTextBoxExFUc */ +void J2DTextBoxEx::setAlpha(u8 alpha) { + mAlpha = alpha; + + if (mMaterial == NULL) { + return; + } + + if (mMaterial->getColorBlock()->getMatColor(0) == NULL) { + return; + } + + mMaterial->getColorBlock()->getMatColor(0)->a = alpha; +} + +/* 803087DC-80308810 30311C 0034+00 1/0 0/0 0/0 .text setCullBack__12J2DTextBoxExF11_GXCullMode */ +void J2DTextBoxEx::setCullBack(GXCullMode mode) { + mCullMode = mode; + + if (mMaterial != NULL) { + mMaterial->getColorBlock()->setCullMode(mode); + } + + J2DPane::setCullBack(mode); +} + +/* 80308810-80308828 303150 0018+00 1/0 0/0 0/0 .text rewriteAlpha__12J2DTextBoxExFv */ +void J2DTextBoxEx::rewriteAlpha() { + if (mMaterial == NULL) { + return; + } + + mAlpha = mMaterial->getColorBlock()->getMatColor(0)->a; +} + +/* 80308828-803088B4 303168 008C+00 1/0 0/0 0/0 .text isUsed__12J2DTextBoxExFPC7ResFONT + */ +bool J2DTextBoxEx::isUsed(ResFONT const* p_font) { + if (getFont() != NULL && getFont()->getResFont() == p_font) { + return true; + } + + return J2DPane::isUsed(p_font); +} + +/* 803088B4-803088E0 3031F4 002C+00 1/0 0/0 0/0 .text setAnimation__12J2DTextBoxExFP11J2DAnmColor + */ +void J2DTextBoxEx::setAnimation(J2DAnmColor* anm) { + if (mMaterial != NULL) { + mMaterial->setAnimation(anm); + } +} + +/* 803088E0-8030890C 303220 002C+00 1/0 0/0 0/0 .text + * setAnimation__12J2DTextBoxExFP19J2DAnmTextureSRTKey */ +void J2DTextBoxEx::setAnimation(J2DAnmTextureSRTKey* anm) { + if (mMaterial != NULL) { + mMaterial->setAnimation(anm); + } +} + +/* 8030890C-80308938 30324C 002C+00 1/0 0/0 0/0 .text + * setAnimation__12J2DTextBoxExFP16J2DAnmTexPattern */ +void J2DTextBoxEx::setAnimation(J2DAnmTexPattern* anm) { + if (mMaterial != NULL) { + mMaterial->setAnimation(anm); + } +} + +/* 80308938-80308964 303278 002C+00 1/0 0/0 0/0 .text + * setAnimation__12J2DTextBoxExFP15J2DAnmTevRegKey */ +void J2DTextBoxEx::setAnimation(J2DAnmTevRegKey* anm) { + if (mMaterial != NULL) { + mMaterial->setAnimation(anm); + } +} + +/* 80308964-8030896C -00001 0008+00 0/0 0/0 0/0 .text + * setAnimation__12J2DTextBoxExFP20J2DAnmVisibilityFull */ +void J2DTextBoxEx::setAnimation(J2DAnmVisibilityFull* anm) { + mVisibilityAnm = anm; +} + +/* 8030896C-803089EC 3032AC 0080+00 1/0 0/0 0/0 .text + * animationPane__12J2DTextBoxExFPC15J2DAnmTransform */ +const J2DAnmTransform* J2DTextBoxEx::animationPane(J2DAnmTransform const* param_0) { + if (mVisibilityAnm != NULL && field_0x13c != 0xffff) { + u8 visibility; + mVisibilityAnm->getVisibility(field_0x13c, &visibility); + if (visibility != 0) { + show(); + } else { + hide(); + } + } + return J2DPane::animationPane(param_0); +} + +/* 803089EC-80308A28 30332C 003C+00 1/0 0/0 0/0 .text setCullBack__12J2DTextBoxExFb */ +void J2DTextBoxEx::setCullBack(bool param_0) { + setCullBack(param_0 ? GX_CULL_BACK : GX_CULL_NONE); +} + +/* 80308A28-80308A48 303368 0020+00 1/0 0/0 0/0 .text isUsed__12J2DTextBoxExFPC7ResTIMG + */ +bool J2DTextBoxEx::isUsed(ResTIMG const* p_timg) { + return J2DPane::isUsed(p_timg); +} + +/* 80308A48-80308A4C 303388 0004+00 1/0 0/0 0/0 .text + * setAnimation__12J2DTextBoxExFP14J2DAnmVtxColor */ +void J2DTextBoxEx::setAnimation(J2DAnmVtxColor* param_0) { + /* empty function */ +} + +/* 80308A4C-80308A6C 30338C 0020+00 1/0 0/0 0/0 .text setAnimation__12J2DTextBoxExFP10J2DAnmBase + */ +void J2DTextBoxEx::setAnimation(J2DAnmBase* anm) { + J2DPane::setAnimation(anm); +} + +/* 803A1DF0-803A1DF0 02E450 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DWindow.cpp b/src/JSystem/J2DGraph/J2DWindow.cpp new file mode 100644 index 0000000000..f4a1530087 --- /dev/null +++ b/src/JSystem/J2DGraph/J2DWindow.cpp @@ -0,0 +1,679 @@ +#include "JSystem/J2DGraph/J2DWindow.h" +#include "JSystem/JSupport/JSURandomInputStream.h" +#include "JSystem/JUtility/JUTPalette.h" +#include "JSystem/JUtility/JUTResource.h" +#include "JSystem/JUtility/JUTTexture.h" + +/* 802F9A7C-802F9B74 2F43BC 00F8+00 0/0 1/1 0/0 .text __ct__9J2DWindowFv */ +J2DWindow::J2DWindow() + : field_0x100(NULL), field_0x104(NULL), field_0x108(NULL), field_0x10c(NULL), field_0x110(NULL), + mPalette(NULL) { + field_0x144 = 0; + setContentsColor(JUtility::TColor(0xffffffff)); + mBlack = JUtility::TColor(0); + mWhite = JUtility::TColor(0xffffffff); +} + +/* 802F9B74-802F9C10 2F44B4 009C+00 0/0 1/1 0/0 .text + * __ct__9J2DWindowFP7J2DPaneP20JSURandomInputStreamP10JKRArchive */ +J2DWindow::J2DWindow(J2DPane* param_0, JSURandomInputStream* param_1, JKRArchive* param_2) + : field_0x100(NULL), field_0x104(NULL), field_0x108(NULL), field_0x10c(NULL), field_0x110(NULL), + mPalette(NULL) { + private_readStream(param_0, param_1, param_2); +} + +struct J2DWindowData { + u8 field_0x0[0x10]; + u16 field_0x10[4]; + u8 field_0x18; + u8 field_0x19; + u16 field_0x1a; + u16 field_0x1c; + u16 field_0x1e; + u16 field_0x20; + u16 field_0x22; + u16 field_0x24; + u8 field_0x26[0xa]; + u32 field_0x30[4]; +}; + +/* 802F9C10-802FA118 2F4550 0508+00 0/0 1/1 0/0 .text + * __ct__9J2DWindowFP7J2DPaneP20JSURandomInputStreamP11J2DMaterial */ +J2DWindow::J2DWindow(J2DPane* param_0, JSURandomInputStream* param_1, J2DMaterial* param_2) : + field_0x100(NULL), + field_0x104(NULL), + field_0x108(NULL), + field_0x10c(NULL), + field_0x110(NULL), + mPalette(NULL) { + u32 auStack_78[2]; + u32 position = param_1->getPosition(); + param_1->read(auStack_78, 8); + mKind = 'WIN1'; + u32 local_dc = param_1->getPosition(); + int auStack_b8[2]; + param_1->peek(auStack_b8, 8); + makePaneExStream(param_0, param_1); + param_1->seek(local_dc + auStack_b8[1], JSUStreamSeekFrom_SET); + J2DWindowData buffer; + param_1->read(&buffer, sizeof(J2DWindowData)); + + JUtility::TColor* colors[4] = { + &field_0x128, + &field_0x12C, + &field_0x130, + &field_0x134, + }; + + u16 local_c0[4]; + J2DMaterial *local_98[4]; + for (int iVar7 = 0; iVar7 < 4; iVar7++) { + local_c0[iVar7] = buffer.field_0x10[iVar7]; + local_98[iVar7] = NULL; + if (local_c0[iVar7] != 0xffff) { + local_98[iVar7] = param_2 + local_c0[iVar7]; + } + *colors[iVar7] = JUtility::TColor(buffer.field_0x30[iVar7]); + } + + field_0x144 = buffer.field_0x18; + field_0x114.set( + buffer.field_0x1a, + buffer.field_0x1c, + buffer.field_0x1a + buffer.field_0x1e, + buffer.field_0x1c + buffer.field_0x20); + u16 temp = buffer.field_0x24; + J2DMaterial* pJVar5 = NULL; + if (temp != 0xffff) { + pJVar5 = param_2 + temp; + } + + param_1->seek(position + auStack_78[1], JSUStreamSeekFrom_SET); + if (local_98[0] != NULL) { + mAlpha = local_98[0]->getColorBlock()->getMatColor(0)->a; + } + + mBlack = JUtility::TColor(0); + mWhite = JUtility::TColor(0xffffffff); + + if (local_98[0] != NULL && local_98[0]->getTevBlock() != NULL) { + if (local_98[0]->getTevBlock()->getTevStageNum() != 1) { + J2DGXColorS10* local_c8 = local_98[0]->getTevBlock()->getTevColor(0); + s16 blackr = local_c8->r; + s16 blackg = local_c8->g; + s16 blackb = local_c8->b; + s16 blacka = local_c8->a; + J2DGXColorS10* local_d0 = local_98[0]->getTevBlock()->getTevColor(1); + s16 whiter = local_d0->r; + s16 whiteg = local_d0->g; + s16 whiteb = local_d0->b; + s16 whitea = local_d0->a; + mBlack = JUtility::TColor( + (((u8)blackr) << 24) | (((u8)blackg) << 16) | (((u8)blackb) << 8) | + ((u8)blacka)); + mWhite = JUtility::TColor( + (((u8)whiter) << 24) | (((u8)whiteg) << 16) | (((u8)whiteb) << 8) | + ((u8)whitea)); + } + } + + JUTTexture** textures[4] = { + &field_0x100, + &field_0x104, + &field_0x108, + &field_0x10c, + }; + + J2DMaterial * mat; + for (u32 uVar6 = 0; uVar6 < 4; uVar6++) { + mat = local_98[uVar6]; + if (mat != NULL && mat->getTevBlock() != NULL) { + JUTTexture* local_e0 = mat->getTevBlock()->getTexture(0); + if (local_e0 != NULL) { + *textures[uVar6] = local_e0; + mat->getTevBlock()->setUndeleteFlag(0xfe); + } + } + } + + field_0x110 = NULL; + if (pJVar5 != NULL && pJVar5->getTevBlock() != NULL) { + JUTTexture* local_e0 = pJVar5->getTevBlock()->getTexture(0); + if (local_e0 != NULL) { + field_0x110 = local_e0; + pJVar5->getTevBlock()->setUndeleteFlag(0xfe); + } + } + initinfo2(); +} + +/* 802FA118-802FA604 2F4A58 04EC+00 1/1 0/0 0/0 .text + * private_readStream__9J2DWindowFP7J2DPaneP20JSURandomInputStreamP10JKRArchive */ +void J2DWindow::private_readStream(J2DPane* param_0, JSURandomInputStream* param_1, + JKRArchive* param_2) { + s32 local_188 = param_1->getPosition(); + u32 local_180[2]; + param_1->read(local_180, 8); + mKind = local_180[0]; + makePaneStream(param_0, param_1); + JUTResReference stack_178; + u8 r27 = param_1->readU8(); + f32 f31 = param_1->read16b(); + f32 f30 = param_1->read16b(); + f32 f29 = f31 + param_1->read16b(); + f32 f28 = f30 + param_1->read16b(); + field_0x114.set(f31, f30, f29, f28); + ResTIMG* timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2); + if (timg) { + field_0x100 = new JUTTexture(timg, 0); + } + timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2); + if (timg) { + field_0x104 = new JUTTexture(timg, 0); + } + timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2); + if (timg) { + field_0x108 = new JUTTexture(timg, 0); + } + timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2); + if (timg) { + field_0x10c = new JUTTexture(timg, 0); + } + ResTLUT* tlut = (ResTLUT*)getPointer(param_1, 'TLUT', param_2); + if (tlut) { + mPalette = new JUTPalette(GX_TLUT0, tlut); + } + field_0x144 = param_1->read8b(); + field_0x128.set(param_1->read32b()); + field_0x12C.set(param_1->read32b()); + field_0x130.set(param_1->read32b()); + field_0x134.set(param_1->read32b()); + r27 -= 14; + field_0x110 = NULL; + if (r27) { + timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2); + if (timg) { + field_0x110 = new JUTTexture(timg, 0); + } + r27--; + } + mBlack = JUtility::TColor(0); + mWhite = JUtility::TColor(0xffffffff); + if (r27) { + mBlack = JUtility::TColor(param_1->readU32()); + r27--; + } + if (r27) { + mWhite = JUtility::TColor(param_1->readU32()); + } + param_1->seek(local_188 + local_180[1], JSUStreamSeekFrom_SET); + initinfo2(); +} + +/* 802FA604-802FA880 2F4F44 027C+00 2/2 0/0 0/0 .text initinfo2__9J2DWindowFv */ +void J2DWindow::initinfo2() { + if (field_0x100 && field_0x104 && field_0x108 && field_0x10c) { + field_0x140 = field_0x100->getWidth() + field_0x104->getWidth(); + field_0x142 = field_0x100->getHeight() + field_0x108->getHeight(); + } else { + field_0x140 = 1; + field_0x142 = 1; + return; + } + field_0x145 = 0; + JUTTexture* r30 = field_0x100; + if (*field_0x104 != *r30) { + field_0x145 |= 1; + r30 = field_0x104; + } + if (*field_0x10c != *r30) { + field_0x145 |= 2; + r30 = field_0x10c; + } + if (*field_0x108 != *r30) { + field_0x145 |= 4; + } +} + +/* 802FA880-802FA928 2F51C0 00A8+00 1/0 1/1 0/0 .text __dt__9J2DWindowFv */ +J2DWindow::~J2DWindow() { + delete field_0x100; + delete field_0x104; + delete field_0x108; + delete field_0x10c; + delete mPalette; + delete field_0x110; +} + +/* 802FA928-802FAA5C 2F5268 0134+00 1/0 0/0 0/0 .text draw__9J2DWindowFRCQ29JGeometry8TBox2<f> */ +void J2DWindow::draw(JGeometry::TBox2<f32> const& param_0) { + JGeometry::TBox2<f32> stack_58; + if (field_0x100 && field_0x104 && field_0x108 && field_0x10c) { + stack_58.set(field_0x100->getWidth(), field_0x100->getHeight(), + param_0.getWidth() - field_0x104->getWidth(), + param_0.getHeight() - field_0x108->getHeight()); + } else { + stack_58.set(0.0f, 0.0f, param_0.getWidth(), param_0.getHeight()); + } + draw(param_0, stack_58); +} + +/* 802FAA5C-802FAED0 2F539C 0474+00 2/2 0/0 0/0 .text + * draw_private__9J2DWindowFRCQ29JGeometry8TBox2<f>RCQ29JGeometry8TBox2<f> */ +void J2DWindow::draw_private(JGeometry::TBox2<f32> const& param_0, + JGeometry::TBox2<f32> const& param_1) { + JGeometry::TBox2<f32> stack_a0(param_1); + stack_a0.addPos(param_0.i); + drawContents(stack_a0); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + GXSetNumTexGens(1); + if (field_0x100 && field_0x104 && field_0x108 && field_0x10c) { + f32 f29 = param_0.i.x; + f32 f28 = param_0.i.y; + f32 f31 = param_0.f.x - field_0x10c->getWidth(); + f32 f30 = param_0.f.y - field_0x10c->getHeight(); + f32 f27 = f29 + field_0x100->getWidth(); + f32 f26 = f28 + field_0x100->getHeight(); + drawFrameTexture(field_0x100, f29, f28, field_0x144 & 0x80, field_0x144 & 0x40, true); + bool r24 = isField0x145Set(1); + drawFrameTexture(field_0x104, f31, f28, field_0x144 & 0x20, field_0x144 & 0x10, r24); + u16 local_a6; + if (field_0x144 & 0x20) { + local_a6 = 0x8000; + } else { + local_a6 = 0; + } + u16 local_a8; + if (field_0x144 & 0x10) { + local_a8 = 0; + } else { + local_a8 = 0x8000; + } + u16 local_a82 = local_a8 ^ 0x8000; + + drawFrameTexture(field_0x104, f27, f28, f31 - f27, field_0x104->getHeight(), local_a6, + local_a8, local_a6, local_a82, false); + bool isset2 = isField0x145Set(2); + drawFrameTexture(field_0x10c, f31, f30, field_0x144 & 2, field_0x144 & 1, isset2); + u16 local_aa; + if (field_0x144 & 2) { + local_aa = 0x8000; + } else { + local_aa = 0; + } + u16 local_ac; + if (field_0x144 & 1) { + local_ac = 0; + } else { + local_ac = 0x8000; + } + local_a82 = local_ac ^ 0x8000; + drawFrameTexture(field_0x10c, f27, f30, f31 - f27, field_0x10c->getHeight(), local_aa, + local_ac, local_aa, local_a82, false); + u16 local_ae; + if (field_0x144 & 2) { + local_ae = 0; + } else { + local_ae = 0x8000; + } + u16 local_ae2 = local_ae ^ 0x8000; + u16 local_b0; + if (field_0x144 & 1) { + local_b0 = 0x8000; + } else { + local_b0 = 0; + } + drawFrameTexture(field_0x10c, f31, f26, field_0x10c->getWidth(), f30 - f26, local_ae, + local_b0, local_ae2, local_b0, false); + bool isset4 = isField0x145Set(4); + drawFrameTexture(field_0x108, f29, f30, field_0x144 & 8, field_0x144 & 4, isset4); + + u16 local_b2; + if (field_0x144 & 8) { + local_b2 = 0; + } else { + local_b2 = 0x8000; + } + u16 local_b22 = local_b2 ^ 0x8000; + u16 local_b4; + if (field_0x144 & 4) { + local_b4 = 0x8000; + } else { + local_b4 = 0; + } + drawFrameTexture(field_0x108, f29, f26, field_0x108->getWidth(), f30 - f26, local_b2, + local_b4, local_b22, local_b4, false); + } + GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetNumTexGens(0); + GXSetVtxDesc(GX_VA_TEX0, GX_NONE); +} + +/* 802FAED0-802FB000 2F5810 0130+00 1/0 0/0 0/0 .text + * draw__9J2DWindowFRCQ29JGeometry8TBox2<f>RCQ29JGeometry8TBox2<f> */ +void J2DWindow::draw(JGeometry::TBox2<f32> const& param_0, JGeometry::TBox2<f32> const& param_1) { + if (param_0.getWidth() >= field_0x140 && param_0.getHeight() >= field_0x142 && isVisible()) { + makeMatrix(param_0.i.x, param_0.i.y, 0, 0); + GXLoadPosMtxImm(mPositionMtx, GX_PNMTX0); + GXSetCurrentMtx(0); + mColorAlpha = mAlpha; + JGeometry::TBox2<f32> stack_70(0.0f, 0.0f, param_0.getWidth(), param_0.getHeight()); + draw_private(stack_70, param_1); + Mtx stack_60; + MTXIdentity(stack_60); + GXLoadPosMtxImm(stack_60, GX_PNMTX0); + } +} + +/* 802FB000-802FB12C 2F5940 012C+00 1/0 1/0 0/0 .text resize__9J2DWindowFff */ +void J2DWindow::resize(f32 param_0, f32 param_1) { + f32 f31 = getWidth(); + f32 f30 = getHeight(); + J2DPane::resize(param_0, param_1); + field_0x114.f.x += param_0 - f31; + field_0x114.f.y += param_1 - f30; + for (JSUTreeIterator<J2DPane> it(getFirstChild()); it != getEndChild(); it++) { + if (it->getTypeID() == 19 && it->isConnectParent()) { + f32 f29 = param_0 - f31 + it->getWidth(); + f32 f28 = param_1 - f30 + it->getHeight(); + it->J2DPane::resize(f29, f28); + } + } +} + +/* 802FB12C-802FB1D8 2F5A6C 00AC+00 1/1 0/0 0/0 .text + * setContentsColor__9J2DWindowFQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColor + */ +void J2DWindow::setContentsColor(JUtility::TColor param_0, JUtility::TColor param_1, + JUtility::TColor param_2, JUtility::TColor param_3) { + field_0x128.set(param_0); + field_0x12C.set(param_1); + field_0x130.set(param_2); + field_0x134.set(param_3); +} + +/* 802FB1D8-802FB240 2F5B18 0068+00 1/0 1/0 0/0 .text drawSelf__9J2DWindowFff */ +void J2DWindow::drawSelf(f32 param_0, f32 param_1) { + Mtx stack_38; + MTXIdentity(stack_38); + drawSelf(param_0, param_1, &stack_38); +} + +/* 802FB240-802FB338 2F5B80 00F8+00 1/0 0/0 0/0 .text drawSelf__9J2DWindowFffPA3_A4_f */ +void J2DWindow::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) { + JGeometry::TBox2<f32> stack_50(mBounds); + stack_50.addPos(JGeometry::TVec2<f32>(param_0, param_1)); + if (stack_50.getWidth() >= field_0x140 && stack_50.getHeight() >= field_0x142) { + Mtx stack_40; + MTXConcat(*param_2, mGlobalMtx, stack_40); + GXLoadPosMtxImm(stack_40, GX_PNMTX0); + draw_private(stack_50, field_0x114); + } + clip(field_0x114); +} + +/* 802FB338-802FB634 2F5C78 02FC+00 1/0 0/0 0/0 .text + * drawContents__9J2DWindowFRCQ29JGeometry8TBox2<f> */ +void J2DWindow::drawContents(JGeometry::TBox2<f32> const& param_0) { + if (param_0.isValid()) { + GXSetNumChans(1); + GXSetNumTexGens(0); + GXSetNumTevStages(1); + GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + if ((field_0x128 & 0xff) == 0xff && (field_0x12C & 0xff) == 0xff && + (field_0x130 & 0xff) == 0xff && (field_0x134 & 0xff) == 0xff && mColorAlpha == 0xff) + { + GXSetBlendMode(GX_BM_NONE, GX_BL_ONE, GX_BL_ZERO, GX_LO_SET); + } else { + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); + } + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetChanCtrl(GX_COLOR0A0, 0, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, + GX_AF_NONE); + GXSetNumIndStages(0); + for (int i = 0; i < 16; i++) { + GXSetTevDirect(GXTevStageID(i)); + } + if (field_0x110 == NULL) { + JUtility::TColor color1(field_0x128); + JUtility::TColor color2(field_0x130); + JUtility::TColor color3(field_0x12C); + JUtility::TColor color4(field_0x134); + if (mColorAlpha != 0xff) { + color1.a = color1.a * mColorAlpha / 0xff; + color2.a = color2.a * mColorAlpha / 0xff; + color3.a = color3.a * mColorAlpha / 0xff; + color4.a = color4.a * mColorAlpha / 0xff; + } + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + GXPosition3f32(param_0.i.x, param_0.i.y, 0.0f); + GXColor1u32(color1); + GXPosition3f32(param_0.f.x, param_0.i.y, 0.0f); + GXColor1u32(color3); + GXPosition3f32(param_0.f.x, param_0.f.y, 0.0f); + GXColor1u32(color4); + GXPosition3f32(param_0.i.x, param_0.f.y, 0.0f); + GXColor1u32(color2); + GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0); + } else { + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + GXSetNumTexGens(1); + drawContentsTexture(param_0.i.x, param_0.i.y, param_0.getWidth(), param_0.getHeight()); + } + } +} + +/* 802FB634-802FB7C8 2F5F74 0194+00 2/2 0/0 0/0 .text + * drawFrameTexture__9J2DWindowFP10JUTTextureffffUsUsUsUsb */ +void J2DWindow::drawFrameTexture(JUTTexture* param_0, f32 param_1, f32 param_2, f32 param_3, + f32 param_4, u16 param_5, u16 param_6, u16 param_7, u16 param_8, + bool param_9) { + f32 f31 = param_1 + param_3; + f32 f30 = param_2 + param_4; + if (param_9) { + param_0->load(GX_TEXMAP0); + setTevMode(param_0, mBlack, mWhite); + } + JUtility::TColor stack_64(mColorAlpha | 0xffffff00); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + GXPosition3f32(param_1, param_2, 0.0f); + GXColor1u32(stack_64); + GXTexCoord2u16(param_7, param_8); + GXPosition3f32(f31, param_2, 0.0f); + GXColor1u32(stack_64); + GXTexCoord2u16(param_5, param_8); + GXPosition3f32(f31, f30, 0.0f); + GXColor1u32(stack_64); + GXTexCoord2u16(param_5, param_6); + GXPosition3f32(param_1, f30, 0.0f); + GXColor1u32(stack_64); + GXTexCoord2u16(param_7, param_6); + GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0); +} + +/* 802FB7C8-802FB868 2F6108 00A0+00 1/1 0/0 0/0 .text + * drawFrameTexture__9J2DWindowFP10JUTTextureffbbb */ +void J2DWindow::drawFrameTexture(JUTTexture* param_0, f32 param_1, f32 param_2, bool param_3, + bool param_4, bool param_5) { + u16 r31 = param_4 ? u16(0x8000) : u16(0); + u16 r30 = param_3 ? u16(0x8000) : u16(0); + u16 r29 = param_4 ? u16(0) : u16(0x8000); + u16 r28 = param_3 ? u16(0) : u16(0x8000); + drawFrameTexture(param_0, param_1, param_2, param_0->getWidth(), param_0->getHeight(), r28, r29, + r30, r31, param_5); +} + +/* 802FB868-802FBB90 2F61A8 0328+00 1/1 0/0 0/0 .text drawContentsTexture__9J2DWindowFffff */ +void J2DWindow::drawContentsTexture(f32 param_0, f32 param_1, f32 param_2, f32 param_3) { + f32 f29 = param_0 + param_2; + f32 f28 = param_1 + param_3; + f32 width = field_0x110->getWidth(); + f32 height = field_0x110->getHeight(); + f32 f27 = -(param_2 / width - 1.0f) / 2.0f; + f32 f26 = -(param_3 / height - 1.0f) / 2.0f; + f32 f25 = f27 + param_2 / width; + f32 f24 = f26 + param_3 / height; + TContentsColor stack_f0; + getContentsColor(stack_f0); + if (mColorAlpha != 0xff) { + stack_f0.field_0x0.a = stack_f0.field_0x0.a * mColorAlpha / 0xff; + stack_f0.field_0x4.a = stack_f0.field_0x4.a * mColorAlpha / 0xff; + stack_f0.field_0x8.a = stack_f0.field_0x8.a * mColorAlpha / 0xff; + stack_f0.field_0xc.a = stack_f0.field_0xc.a * mColorAlpha / 0xff; + } + field_0x110->load(GX_TEXMAP0); + setTevMode(field_0x110, 0, 0xffffffff); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBA6, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + GXPosition3f32(param_0, param_1, 0.0f); + GXColor1u32(stack_f0.field_0x0); + GXTexCoord2f32(f27, f26); + GXPosition3f32(f29, param_1, 0.0f); + GXColor1u32(stack_f0.field_0x4); + GXTexCoord2f32(f25, f26); + GXPosition3f32(f29, f28, 0.0f); + GXColor1u32(stack_f0.field_0xc); + GXTexCoord2f32(f25, f24); + GXPosition3f32(param_0, f28, 0.0f); + GXColor1u32(stack_f0.field_0x8); + GXTexCoord2f32(f27, f24); + GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0); +} + +/* 802FBB90-802FBE60 2F64D0 02D0+00 2/2 0/0 0/0 .text + * setTevMode__9J2DWindowFP10JUTTextureQ28JUtility6TColorQ28JUtility6TColor */ +void J2DWindow::setTevMode(JUTTexture* param_0, JUtility::TColor param_1, + JUtility::TColor param_2) { + if (param_1 == 0 && param_2 == 0xffffffff) { + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_TEXC, GX_CC_RASC, GX_CC_ZERO); + if (param_0->getTransparency()) { + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_TEXA, GX_CA_RASA, GX_CA_ZERO); + } else { + GXSetTevColor(GX_TEVREG2, JUtility::TColor(0xffffffff)); + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_A2, GX_CA_RASA, GX_CA_ZERO); + } + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); + GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); + GXSetNumTevStages(1); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); + } else { + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL); + GXSetTevColor(GX_TEVREG0, param_1); + GXSetTevColor(GX_TEVREG1, param_2); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C0, GX_CC_C1, GX_CC_TEXC, GX_CC_ZERO); + if (param_0->getTransparency()) { + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A0, GX_CA_A1, GX_CA_TEXA, GX_CA_ZERO); + } else { + GXSetTevColor(GX_TEVREG2, JUtility::TColor(0xffffffff)); + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A0, GX_CA_A1, GX_CA_A2, GX_CA_ZERO); + } + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); + GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); + GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_CPREV, GX_CC_RASC, GX_CC_ZERO); + GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_APREV, GX_CA_RASA, GX_CA_ZERO); + GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); + GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, 1, GX_TEVPREV); + GXSetNumTevStages(2); + } + GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); +} + +/* 802FBE60-802FBEDC 2F67A0 007C+00 1/0 0/0 0/0 .text getFrameTexture__9J2DWindowCFUcUc + */ +JUTTexture* J2DWindow::getFrameTexture(u8 param_0, u8 param_1) const { + JUTTexture* tmp[4] = {NULL, NULL, NULL, NULL}; + tmp[0] = field_0x100; + tmp[1] = field_0x104; + tmp[2] = field_0x108; + tmp[3] = field_0x10c; + if (param_0 >= 4 || param_1 != 0) { + return NULL; + } + return tmp[param_0]; +} + +/* 802FBEDC-802FBF98 2F681C 00BC+00 1/0 0/0 0/0 .text isUsed__9J2DWindowFPC7ResTIMG */ +bool J2DWindow::isUsed(ResTIMG const* param_0) { + JUTTexture* tmp[5] = {NULL, NULL, NULL, NULL, NULL}; + tmp[0] = field_0x100; + tmp[1] = field_0x104; + tmp[2] = field_0x108; + tmp[3] = field_0x10c; + tmp[4] = field_0x110; + for (u8 i = 0; i < 5; i++) { + if (tmp[i] && tmp[i]->getTexInfo() == param_0) { + return true; + } + } + return J2DPane::isUsed(param_0); +} + +/* 802FBF98-802FBFA0 2F68D8 0008+00 1/0 1/0 0/0 .text getTypeID__9J2DWindowCFv */ +u16 J2DWindow::getTypeID() const { + return 17; +} + +/* 802FBFA0-802FBFE8 2F68E0 0048+00 1/0 0/0 0/0 .text draw__9J2DWindowFffff */ +void J2DWindow::draw(f32 param_0, f32 param_1, f32 param_2, f32 param_3) { + draw(JGeometry::TBox2<f32>(param_0, param_1, param_0 + param_2, param_1 + param_3)); +} + +/* 802FBFE8-802FC000 2F6928 0018+00 1/0 0/0 0/0 .text getContentsTexture__9J2DWindowCFUc + */ +JUTTexture* J2DWindow::getContentsTexture(u8 param_0) const { + if (param_0 != 0) { + return NULL; + } + return field_0x110; +} + +/* 802FC000-802FC01C 2F6940 001C+00 1/0 0/0 0/0 .text + * getMaterial__9J2DWindowCFRQ29J2DWindow9TMaterial */ +void J2DWindow::getMaterial(J2DWindow::TMaterial& param_0) const { + param_0.field_0x0 = NULL; + param_0.field_0x4 = NULL; + param_0.field_0x8 = NULL; + param_0.field_0xc = NULL; + param_0.field_0x10 = NULL; +} + +/* 802FC01C-802FC024 2F695C 0008+00 1/0 0/0 0/0 .text getFrameMaterial__9J2DWindowCFUc */ +J2DMaterial* J2DWindow::getFrameMaterial(u8 param_0) const { + return NULL; +} + +/* 802FC024-802FC02C 2F6964 0008+00 1/0 0/0 0/0 .text getContentsMaterial__9J2DWindowCFv + */ +J2DMaterial* J2DWindow::getContentsMaterial() const { + return NULL; +} + +/* 802FC02C-802FC04C 2F696C 0020+00 1/0 0/0 0/0 .text isUsed__9J2DWindowFPC7ResFONT */ +bool J2DWindow::isUsed(ResFONT const* param_0) { + return J2DPane::isUsed(param_0); +} + +/* 802FC04C-802FC050 2F698C 0004+00 1/0 0/0 0/0 .text rewriteAlpha__9J2DWindowFv */ +void J2DWindow::rewriteAlpha() { + /* empty function */ +}
\ No newline at end of file diff --git a/src/JSystem/J2DGraph/J2DWindowEx.cpp b/src/JSystem/J2DGraph/J2DWindowEx.cpp new file mode 100644 index 0000000000..e3e0baa2bc --- /dev/null +++ b/src/JSystem/J2DGraph/J2DWindowEx.cpp @@ -0,0 +1,1323 @@ +// +// Generated By: dol2asm +// Translation Unit: J2DWindowEx +// + +#include "JSystem/J2DGraph/J2DWindowEx.h" +#include "JSystem/JUtility/JUTTexture.h" +#include "JSystem/JSupport/JSURandomInputStream.h" +#include "dol2asm.h" + +// +// Forward References: +// + +extern "C" void __ct__11J2DWindowExFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial(); +extern "C" void setMinSize__11J2DWindowExFv(); +extern "C" void __dt__11J2DWindowExFv(); +extern "C" void drawSelf__11J2DWindowExFffPA3_A4_f(); +extern "C" void func_803012CC(); +extern "C" void func_80301994(); +extern "C" void drawFrameTexture__11J2DWindowExFffffUsUsUsUsP11J2DMaterialb(); +extern "C" void func_80301FC8(); +extern "C" void func_80302164(); +extern "C" void setTevOrder__11J2DWindowExFb(); +extern "C" void setTevStage__11J2DWindowExFb(); +extern "C" void setStage__11J2DWindowExFP11J2DTevStageQ211J2DWindowEx10stage_enum(); +extern "C" void setBlack__11J2DWindowExFQ28JUtility6TColor(); +extern "C" void setWhite__11J2DWindowExFQ28JUtility6TColor(); +extern "C" void setBlackWhite__11J2DWindowExFQ28JUtility6TColorQ28JUtility6TColor(); +extern "C" void getBlackWhite__11J2DWindowExCFPQ28JUtility6TColorPQ28JUtility6TColor(); +extern "C" void isSetBlackWhite__11J2DWindowExCFQ28JUtility6TColorQ28JUtility6TColor(); +extern "C" void getBlack__11J2DWindowExCFv(); +extern "C" void getWhite__11J2DWindowExCFv(); +extern "C" void setAlpha__11J2DWindowExFUc(); +extern "C" void setCullBack__11J2DWindowExF11_GXCullMode(); +extern "C" void rewriteAlpha__11J2DWindowExFv(); +extern "C" void getFrameTexture__11J2DWindowExCFUcUc(); +extern "C" void getContentsTexture__11J2DWindowExCFUc(); +extern "C" void isUsed__11J2DWindowExFPC7ResTIMG(); +extern "C" void setAnimation__11J2DWindowExFP11J2DAnmColor(); +extern "C" void setAnimation__11J2DWindowExFP19J2DAnmTextureSRTKey(); +extern "C" void setAnimation__11J2DWindowExFP16J2DAnmTexPattern(); +extern "C" void setAnimation__11J2DWindowExFP15J2DAnmTevRegKey(); +extern "C" void isNeedSetAnm__11J2DWindowExFUc(); +extern "C" void setAnimation__11J2DWindowExFP20J2DAnmVisibilityFull(); +extern "C" void setAnimation__11J2DWindowExFP14J2DAnmVtxColor(); +extern "C" void animationPane__11J2DWindowExFPC15J2DAnmTransform(); +extern "C" void getFrameMaterial__11J2DWindowExCFUc(); +extern "C" void getContentsMaterial__11J2DWindowExCFv(); +extern "C" void getMaterial__11J2DWindowExCFRQ29J2DWindow9TMaterial(); +extern "C" void draw__11J2DWindowExFffff(); +extern "C" void setCullBack__11J2DWindowExFb(); +extern "C" void isUsed__11J2DWindowExFPC7ResFONT(); +extern "C" void setAnimation__11J2DWindowExFP10J2DAnmBase(); +extern "C" void getColor__14J2DAnmVtxColorCFUcUsP8_GXColor(); + +// +// External References: +// + +extern "C" void calcMtx__7J2DPaneFv(); +extern "C" void makeMatrix__7J2DPaneFff(); +extern "C" void setAnimation__11J2DWindowExFP15J2DAnmTransform(); +extern "C" void __dl__FPv(); +extern "C" void read__14JSUInputStreamFPvl(); +extern "C" void peek__20JSURandomInputStreamFPvl(); +extern "C" void seek__20JSURandomInputStreamFl17JSUStreamSeekFrom(); +extern "C" void setGX__11J2DMaterialFv(); +extern "C" void setAnimation__11J2DMaterialFP11J2DAnmColor(); +extern "C" void setAnimation__11J2DMaterialFP19J2DAnmTextureSRTKey(); +extern "C" void setAnimation__11J2DMaterialFP16J2DAnmTexPattern(); +extern "C" void setAnimation__11J2DMaterialFP15J2DAnmTevRegKey(); +extern "C" void move__7J2DPaneFff(); +extern "C" void add__7J2DPaneFff(); +extern "C" void func_802F7264(); +extern "C" void search__7J2DPaneFUx(); +extern "C" void searchUserInfo__7J2DPaneFUx(); +extern "C" void isUsed__7J2DPaneFPC7ResTIMG(); +extern "C" void isUsed__7J2DPaneFPC7ResFONT(); +extern "C" void makeMatrix__7J2DPaneFffff(); +extern "C" void setCullBack__7J2DPaneF11_GXCullMode(); +extern "C" void getParentPane__7J2DPaneFv(); +extern "C" void makePaneExStream__7J2DPaneFP7J2DPaneP20JSURandomInputStream(); +extern "C" void setAnimation__7J2DPaneFP10J2DAnmBase(); +extern "C" void clearAnmTransform__7J2DPaneFv(); +extern "C" void animationTransform__7J2DPaneFPC15J2DAnmTransform(); +extern "C" void setVisibileAnimation__7J2DPaneFP20J2DAnmVisibilityFull(); +extern "C" void setVtxColorAnimation__7J2DPaneFP14J2DAnmVtxColor(); +extern "C" void animationPane__7J2DPaneFPC15J2DAnmTransform(); +extern "C" void setAnimationVF__7J2DPaneFP20J2DAnmVisibilityFull(); +extern "C" void setAnimationVC__7J2DPaneFP14J2DAnmVtxColor(); +extern "C" void setConnectParent__7J2DPaneFb(); +extern "C" void update__7J2DPaneFv(); +extern "C" void __ct__9J2DWindowFv(); +extern "C" void __dt__9J2DWindowFv(); +extern "C" void resize__9J2DWindowFff(); +extern "C" void drawSelf__9J2DWindowFff(); +extern "C" s32 getTypeID__9J2DWindowCFv(); +extern "C" void getVisibility__20J2DAnmVisibilityFullCFUsPUc(); +extern "C" void _savegpr_20(); +extern "C" void _savegpr_25(); +extern "C" void _savegpr_26(); +extern "C" void _savegpr_27(); +extern "C" void _savegpr_28(); +extern "C" void _savegpr_29(); +extern "C" void _restgpr_20(); +extern "C" void _restgpr_25(); +extern "C" void _restgpr_26(); +extern "C" void _restgpr_27(); +extern "C" void _restgpr_28(); +extern "C" void _restgpr_29(); + +// +// Declarations: +// + +/* ############################################################################################## */ +/* 803A1C60-803A1C70 02E2C0 0010+00 2/2 0/0 0/0 .rodata @1508 */ +SECTION_RODATA static u8 const lit_1508[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +COMPILER_STRIP_GATE(0x803A1C60, &lit_1508); + +/* 803CD3E8-803CD4B8 02A508 00CC+04 2/2 0/0 0/0 .data __vt__11J2DWindowEx */ +SECTION_DATA extern void* __vt__11J2DWindowEx[51 + 1 /* padding */] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)__dt__11J2DWindowExFv, + (void*)getTypeID__9J2DWindowCFv, + (void*)move__7J2DPaneFff, + (void*)add__7J2DPaneFff, + (void*)resize__9J2DWindowFff, + (void*)setCullBack__11J2DWindowExFb, + (void*)setCullBack__11J2DWindowExF11_GXCullMode, + (void*)setAlpha__11J2DWindowExFUc, + (void*)setConnectParent__7J2DPaneFb, + (void*)calcMtx__7J2DPaneFv, + (void*)update__7J2DPaneFv, + (void*)drawSelf__9J2DWindowFff, + (void*)drawSelf__11J2DWindowExFffPA3_A4_f, + (void*)search__7J2DPaneFUx, + (void*)searchUserInfo__7J2DPaneFUx, + (void*)makeMatrix__7J2DPaneFff, + (void*)makeMatrix__7J2DPaneFffff, + (void*)isUsed__11J2DWindowExFPC7ResTIMG, + (void*)isUsed__11J2DWindowExFPC7ResFONT, + (void*)clearAnmTransform__7J2DPaneFv, + (void*)rewriteAlpha__11J2DWindowExFv, + (void*)setAnimation__11J2DWindowExFP10J2DAnmBase, + (void*)setAnimation__11J2DWindowExFP15J2DAnmTransform, + (void*)setAnimation__11J2DWindowExFP11J2DAnmColor, + (void*)setAnimation__11J2DWindowExFP16J2DAnmTexPattern, + (void*)setAnimation__11J2DWindowExFP19J2DAnmTextureSRTKey, + (void*)setAnimation__11J2DWindowExFP15J2DAnmTevRegKey, + (void*)setAnimation__11J2DWindowExFP20J2DAnmVisibilityFull, + (void*)setAnimation__11J2DWindowExFP14J2DAnmVtxColor, + (void*)animationTransform__7J2DPaneFPC15J2DAnmTransform, + (void*)setVisibileAnimation__7J2DPaneFP20J2DAnmVisibilityFull, + (void*)setAnimationVF__7J2DPaneFP20J2DAnmVisibilityFull, + (void*)setVtxColorAnimation__7J2DPaneFP14J2DAnmVtxColor, + (void*)setAnimationVC__7J2DPaneFP14J2DAnmVtxColor, + (void*)animationPane__11J2DWindowExFPC15J2DAnmTransform, + (void*)func_80301FC8, + (void*)func_80302164, + (void*)draw__11J2DWindowExFffff, + (void*)setBlack__11J2DWindowExFQ28JUtility6TColor, + (void*)setWhite__11J2DWindowExFQ28JUtility6TColor, + (void*)setBlackWhite__11J2DWindowExFQ28JUtility6TColorQ28JUtility6TColor, + (void*)getBlack__11J2DWindowExCFv, + (void*)getWhite__11J2DWindowExCFv, + (void*)getFrameTexture__11J2DWindowExCFUcUc, + (void*)getContentsTexture__11J2DWindowExCFUc, + (void*)getMaterial__11J2DWindowExCFRQ29J2DWindow9TMaterial, + (void*)getFrameMaterial__11J2DWindowExCFUc, + (void*)getContentsMaterial__11J2DWindowExCFv, + (void*)func_80301994, + /* padding */ + NULL, +}; + +/* 804562A0-804562A8 0048A0 0008+00 4/4 0/0 0/0 .sdata2 @1549 */ +SECTION_SDATA2 static f64 lit_1549 = 4503601774854144.0 /* cast s32 to float */; + +/* 804562A8-804562B0 0048A8 0008+00 1/1 0/0 0/0 .sdata2 @1552 */ +SECTION_SDATA2 static f64 lit_1552 = 4503599627370496.0 /* cast u32 to float */; + +struct J2DWindowExDef { + u32 field_0x0[4]; + u16 field_0x10[4]; + u8 field_0x18; + u8 field_0x19; + u16 field_0x1A; + u16 field_0x1C; + u16 field_0x1E; + u16 field_0x20; + u16 field_0x22; + u16 field_0x24; + u16 field_0x26; + u16 field_0x28[4]; + u32 field_0x30[4]; +}; + +STATIC_ASSERT(sizeof(J2DWindowExDef) == 0x40); + +/* 80300C94-80300F80 2FB5D4 02EC+00 0/0 1/1 0/0 .text + * __ct__11J2DWindowExFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial */ +J2DWindowEx::J2DWindowEx(J2DPane* param_0, JSURandomInputStream* param_1, u32 param_2, + J2DMaterial* param_3) : J2DWindow() { + mAnmVisibilityFull = NULL; + mAnmVtxColor = NULL; + s32 position = param_1->getPosition(); + int uStack_88[2]; + param_1->read(uStack_88, 8); + mKind = uStack_88[0]; + s32 iVar2 = param_1->getPosition(); + int auStack_90[2]; + param_1->peek(auStack_90, 8); + makePaneExStream(param_0, param_1); + param_1->seek(iVar2 + auStack_90[1], JSUStreamSeekFrom_SET); + J2DWindowExDef auStack_70; + param_1->read(&auStack_70, sizeof(J2DWindowExDef)); + + JUtility::TColor* colors[4] = {NULL}; + colors[0] = &field_0x128; + colors[1] = &field_0x12C; + colors[2] = &field_0x130; + colors[3] = &field_0x134; + + for (int i = 0; i < 4; i++) { + field_0x158[i] = auStack_70.field_0x10[i]; + mFrameMaterial[i] = 0; + if (field_0x158[i] != 0xffff) { + mFrameMaterial[i] = param_3 + field_0x158[i]; + (param_3 + field_0x158[i])->field_0x4 = this; + } + field_0x168[i] = auStack_70.field_0x28[i]; + *(colors[i]) = JUtility::TColor(auStack_70.field_0x30[i]); + } + + field_0x144 = auStack_70.field_0x18; + field_0x114.set(auStack_70.field_0x1A, auStack_70.field_0x1C, + auStack_70.field_0x1A + auStack_70.field_0x1E, + auStack_70.field_0x1C + auStack_70.field_0x20); + field_0x166 = auStack_70.field_0x22; + field_0x164 = auStack_70.field_0x24; + mContentsMaterial = NULL; + + if (field_0x164 != 0xffff) { + mContentsMaterial = ¶m_3[field_0x164]; + param_3[field_0x164].field_0x4 = this; + } + + param_1->seek(position + uStack_88[1], JSUStreamSeekFrom_SET); + rewriteAlpha(); + field_0x100 = NULL; + field_0x104 = NULL; + field_0x108 = NULL; + field_0x10c = NULL; + mPalette = NULL; + field_0x110 = NULL; + field_0x170 = 0; + setMinSize(); +} + + +/* 80300F80-80301144 2FB8C0 01C4+00 1/1 0/0 0/0 .text setMinSize__11J2DWindowExFv */ +void J2DWindowEx::setMinSize() { + field_0x140 = 1; + field_0x142 = 1; + + if (mFrameMaterial[0] == NULL) return; + if (mFrameMaterial[1] == NULL) return; + if (mFrameMaterial[2] == NULL) return; + if (mFrameMaterial[3] == NULL) return; + if (mFrameMaterial[0]->getTevBlock() == NULL) return; + if (mFrameMaterial[1]->getTevBlock() == NULL) return; + if (mFrameMaterial[2]->getTevBlock() == NULL) return; + if (mFrameMaterial[3]->getTevBlock() == NULL) return; + if (mFrameMaterial[0]->getTevBlock()->getTexture(0) == NULL) return; + if (mFrameMaterial[1]->getTevBlock()->getTexture(0) == NULL) return; + if (mFrameMaterial[2]->getTevBlock()->getTexture(0) == NULL) return; + if (mFrameMaterial[3]->getTevBlock()->getTexture(0) == NULL) return; + + field_0x140 = mFrameMaterial[0]->getTevBlock()->getTexture(0)->getWidth() + mFrameMaterial[1]->getTevBlock()->getTexture(0)->getWidth(); + field_0x142 = mFrameMaterial[0]->getTevBlock()->getTexture(0)->getHeight() + mFrameMaterial[2]->getTevBlock()->getTexture(0)->getHeight(); +} + +/* 80301144-8030122C 2FBA84 00E8+00 1/0 0/0 0/0 .text __dt__11J2DWindowExFv */ +J2DWindowEx::~J2DWindowEx() { + for (u8 i = 0; i < 4; i++) { + if (field_0x170 & (1 << i)) { + delete mFrameMaterial[i]; + } + } + + if (field_0x170 & 0x10) { + delete mContentsMaterial; + } +} + +/* 8030122C-803012CC 2FBB6C 00A0+00 1/0 0/0 0/0 .text drawSelf__11J2DWindowExFffPA3_A4_f + */ +void J2DWindowEx::drawSelf(f32 param_0, f32 param_1, f32 (*param_2)[3][4]) { + JGeometry::TBox2<f32> aTStack_50(mBounds); + Mtx auStack_40; + aTStack_50.addPos(JGeometry::TVec2<f32>(param_0, param_1)); + MTXConcat(*param_2, mGlobalMtx, auStack_40); + GXLoadPosMtxImm(auStack_40, 0); + draw_private(aTStack_50, field_0x114); + clip(field_0x114); +} + +/* 803012CC-80301994 2FBC0C 06C8+00 2/2 0/0 0/0 .text + * draw_private__11J2DWindowExFRCQ29JGeometry8TBox2<f>RCQ29JGeometry8TBox2<f> */ +void J2DWindowEx::draw_private(JGeometry::TBox2<f32> const& param_0, + JGeometry::TBox2<f32> const& param_1) { + if (param_0.getWidth() >= field_0x140 && param_0.getHeight() >= field_0x142) { + JUTTexture* textures[4]; + bool anyFrameMaterialNull = false; + for (int i = 0; i < 4; i++) { + if (mFrameMaterial[i] == NULL) { + return; + } + J2DTevBlock* block = mFrameMaterial[i]->getTevBlock(); + if (block == NULL) { + return; + } + + textures[i] = block->getTexture(0); + if (textures[i] == NULL) { + anyFrameMaterialNull = true; + } + } + + JGeometry::TBox2<f32> aTStack_b8(param_1); + aTStack_b8.addPos(param_0.i); + drawContents(aTStack_b8); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + + if (!anyFrameMaterialNull) { + f32 dVar16 = param_0.i.x; + f32 dVar15 = param_0.i.y; + f32 dVar18 = param_0.f.x - textures[3]->getWidth(); + f32 dVar17 = param_0.f.y - textures[3]->getHeight(); + f32 dVar14 = dVar16 + textures[0]->getWidth(); + f32 dVar12 = dVar15 + textures[0]->getHeight(); + u16 local_c4; + if (field_0x144 & 0x80) { + local_c4 = 0; + } else { + local_c4 = 0x8000; + } + u16 local_c6; + if (field_0x144 & 0x40) { + local_c6 = 0; + } else { + local_c6 = 0x8000; + } + + drawFrameTexture(dVar16, dVar15, textures[0]->getWidth(), textures[0]->getHeight(), + local_c4, local_c6, 0x8000 - local_c4, 0x8000 - local_c6, + mFrameMaterial[0], true); + bool r9 = mFrameMaterial[1] != mFrameMaterial[0]; + u16 local_c8; + if (field_0x144 & 0x20) { + local_c8 = 0; + } else { + local_c8 = 0x8000; + } + u16 local_ca; + if (field_0x144 & 0x10) { + local_ca = 0; + } else { + local_ca = 0x8000; + } + drawFrameTexture(dVar18, dVar15, textures[3]->getWidth(), textures[0]->getHeight(), + local_c8, local_ca, 0x8000 - local_c8, 0x8000 - local_ca, + mFrameMaterial[1], r9); + + u16 local_cc; + if (field_0x144 & 0x20) { + local_cc = 0x8000; + } else { + local_cc = 0; + } + + u16 local_ce; + if (field_0x144 & 0x10) { + local_ce = 0; + } else { + local_ce = 0x8000; + } + drawFrameTexture(dVar14, dVar15, dVar18 - dVar14, textures[0]->getHeight(), local_cc, + local_ce, local_cc, local_ce ^ 0x8000, mFrameMaterial[1], false); + + r9 = mFrameMaterial[3] != mFrameMaterial[1]; + u16 local_d0; + if (field_0x144 & 2) { + local_d0 = 0; + } else { + local_d0 = 0x8000; + } + u16 local_d2; + if (field_0x144 & 1) { + local_d2 = 0; + } else { + local_d2 = 0x8000; + } + + drawFrameTexture(dVar18, dVar17, textures[3]->getWidth(), textures[3]->getHeight(), + local_d0, local_d2, 0x8000 - local_d0, 0x8000 - local_d2, + mFrameMaterial[3], r9); + + u16 local_d4; + if (field_0x144 & 2) { + local_d4 = 0x8000; + } else { + local_d4 = 0; + } + + u16 local_d6; + if (field_0x144 & 1) { + local_d6 = 0; + } else { + local_d6 = 0x8000; + } + drawFrameTexture(dVar14, dVar17, dVar18 - dVar14, textures[3]->getHeight(), local_d4, + local_d6, local_d4, local_d6 ^ 0x8000, mFrameMaterial[3], false); + + u16 local_d8; + if (field_0x144 & 2) { + local_d8 = 0; + } else { + local_d8 = 0x8000; + } + + u16 local_da; + if (field_0x144 & 1) { + local_da = 0x8000; + } else { + local_da = 0; + } + drawFrameTexture(dVar18, dVar12, textures[3]->getWidth(), dVar17 - dVar12, local_d8, + local_da, local_d8 ^ 0x8000, local_da, mFrameMaterial[3], false); + + r9 = mFrameMaterial[2] != mFrameMaterial[3]; + u16 local_dc; + if (field_0x144 & 8) { + local_dc = 0; + } else { + local_dc = 0x8000; + } + + u16 local_de; + if (field_0x144 & 4) { + local_de = 0; + } else { + local_de = 0x8000; + } + drawFrameTexture(dVar16, dVar17, textures[0]->getWidth(), textures[3]->getHeight(), + local_dc, local_de, 0x8000 - local_dc, 0x8000 - local_de, + mFrameMaterial[2], r9); + + u16 local_e0; + if (field_0x144 & 8) { + local_e0 = 0; + } else { + local_e0 = 0x8000; + } + + u16 local_e2; + if (field_0x144 & 4) { + local_e2 = 0x8000; + } else { + local_e2 = 0; + } + drawFrameTexture(dVar16, dVar12, textures[0]->getWidth(), dVar17 - dVar12, local_e0, + local_e2, local_e0 ^ 0x8000, local_e2, mFrameMaterial[2], false); + } + + GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetNumTexGens(0); + GXSetVtxDesc(GX_VA_TEX0, GX_NONE); + } +} + + +/* ############################################################################################## */ +/* 804562B0-804562B4 0048B0 0004+00 4/4 0/0 0/0 .sdata2 @1827 */ +SECTION_SDATA2 static u8 lit_1827[4] = { + 0x00, + 0x00, + 0x00, + 0x00, +}; + +/* 804562B4-804562B8 0048B4 0004+00 1/1 0/0 0/0 .sdata2 @2256 */ +SECTION_SDATA2 static f32 lit_2256 = 1.0f; + +/* 804562B8-804562C0 0048B8 0004+04 1/1 0/0 0/0 .sdata2 @2257 */ +SECTION_SDATA2 static f32 lit_2257[1 + 1 /* padding */] = { + 0.5f, + /* padding */ + 0.0f, +}; + +/* 80301994-80301D74 2FC2D4 03E0+00 1/0 0/0 0/0 .text + * drawContents__11J2DWindowExFRCQ29JGeometry8TBox2<f> */ +void J2DWindowEx::drawContents(JGeometry::TBox2<f32> const& param_1) { + if (!param_1.isValid() || mContentsMaterial == NULL) { + return; + } + if (!mContentsMaterial->isVisible()) { + return; + } + mContentsMaterial->setGX(); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + JUtility::TColor TStack_b4(field_0x128); + JUtility::TColor TStack_b8(field_0x130); + JUtility::TColor TStack_bc(field_0x12C); + JUtility::TColor TStack_c0(field_0x134); + if (mContentsMaterial->getColorBlock()->getColorChan(1)->getMatSrc() == 1) { + if (mContentsMaterial->getMaterialAlphaCalc() == 1) { + TStack_b4.a = (TStack_b4.a * mColorAlpha) / 0xff; + TStack_b8.a = (TStack_b8.a * mColorAlpha) / 0xff; + TStack_bc.a = (TStack_bc.a * mColorAlpha) / 0xff; + TStack_c0.a = (TStack_c0.a * mColorAlpha) / 0xff; + } + } else if (mIsInfluencedAlpha) { + GXSetChanMatColor(GX_ALPHA0, JUtility::TColor(mColorAlpha)); + } + bool bVar5 = false; + f32 in_f31; + f32 in_f30; + f32 in_f29; + f32 in_f28; + if (mContentsMaterial->getTevBlock() != NULL) { + if (mContentsMaterial->getTevBlock()->getTexture(0)) { + bVar5 = true; + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + f32 dVar15 = mContentsMaterial->getTevBlock()->getTexture(0)->getWidth(); + f32 dVar14 = mContentsMaterial->getTevBlock()->getTexture(0)->getHeight(); + + f32 dVar12 = param_1.getWidth(); + f32 dVar13 = param_1.getHeight(); + in_f31 = -(dVar12 / dVar15 - 1.0f) / 2; + in_f30 = -((dVar13 / dVar14) - 1.0f) / 2; + in_f29 = in_f31 + (dVar12 / dVar15); + in_f28 = in_f30 + (dVar13 / dVar14); + } + } + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_F32, 0); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + GXPosition3f32(param_1.i.x, param_1.i.y, + 0.0f); + GXColor1u32(TStack_b4); + if (bVar5) { + GXTexCoord2f32(in_f31, in_f30); + } + GXPosition3f32(param_1.f.x, param_1.i.y, + 0.0f); + GXColor1u32(TStack_bc); + if (bVar5) { + GXTexCoord2f32(in_f29, in_f30); + } + GXPosition3f32(param_1.f.x, param_1.f.y, + 0.0f); + GXColor1u32(TStack_c0); + if (bVar5) { + GXTexCoord2f32(in_f29, in_f28); + } + GXPosition3f32(param_1.i.x, param_1.f.y, + 0.0f); + GXColor1u32(TStack_b8); + if (bVar5) { + GXTexCoord2f32(in_f31, in_f28); + } + GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); +} + + +/* 80301D74-80301FC8 2FC6B4 0254+00 1/1 0/0 0/0 .text + * drawFrameTexture__11J2DWindowExFffffUsUsUsUsP11J2DMaterialb */ +void J2DWindowEx::drawFrameTexture(f32 param_1, f32 param_2, f32 param_3, f32 param_4, u16 param_5, + u16 param_6, u16 param_7, u16 param_8, J2DMaterial* param_9, + bool param_10) { + if (param_9 != NULL && param_9->isVisible()) { + f32 dVar15 = param_1 + param_3; + f32 dVar14 = param_2 + param_4; + if (param_10) { + param_9->setGX(); + } + JUtility::TColor aTStack_84(0xffffffff); + J2DPane* parentPane = getParentPane(); + if (param_9->getColorBlock()->getColorChan(1)->getMatSrc() == 1) { + if (param_9->getMaterialAlphaCalc() == 1) { + u8 uVar11 = 0xff; + if (param_9->getColorBlock()->getMatColor(0) != 0) { + uVar11 = param_9->getColorBlock()->getMatColor(0)->a; + } + if (parentPane != NULL && mIsInfluencedAlpha != 0) { + uVar11 = ((uVar11 * parentPane->mColorAlpha) / 0xff); + } + aTStack_84 = JUtility::TColor((u32)uVar11 | 0xffffff00); + } + } else if (parentPane != NULL && mIsInfluencedAlpha != 0 && param_10) { + s32 matColorAlpha = param_9->getColorBlock()->getMatColor(0)->a; + s32 colorAlpha = parentPane->mColorAlpha; + GXSetChanMatColor(GX_ALPHA0, JUtility::TColor((matColorAlpha * colorAlpha / 0xff) & 0xff)); + } + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + GXPosition3f32(param_1, param_2, 0.0f); + GXColor1u32(aTStack_84); + GXTexCoord2u16(param_7, param_8); + GXPosition3f32(dVar15, param_2, 0.0f); + GXColor1u32(aTStack_84); + GXTexCoord2u16(param_5, param_8); + GXPosition3f32(dVar15, dVar14, 0.0f); + GXColor1u32(aTStack_84); + GXTexCoord2u16(param_5, param_6); + GXPosition3f32(param_1, dVar14, 0.0f); + GXColor1u32(aTStack_84); + GXTexCoord2u16(param_7, param_6); + GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); + } +} + + +/* 80301FC8-80302164 2FC908 019C+00 1/0 0/0 0/0 .text draw__11J2DWindowExFRCQ29JGeometry8TBox2<f> + */ +void J2DWindowEx::draw(JGeometry::TBox2<f32> const& param_1) { + bool isMissingTexture = false; + JUTTexture* local_68[4]; + for (int i = 0; i < 4; i++) { + if (mFrameMaterial[i] == NULL) { + return; + } + if (mFrameMaterial[i]->getTevBlock() == NULL) { + return; + } + local_68[i] = mFrameMaterial[i]->getTevBlock()->getTexture(0); + if (local_68[i] == NULL) { + isMissingTexture = true; + } + } + JGeometry::TBox2<f32> aTStack_78; + if (!isMissingTexture) { + aTStack_78.set(local_68[0]->getWidth(), local_68[0]->getHeight(), + param_1.getWidth() - local_68[1]->getWidth(), + param_1.getHeight() - local_68[2]->getHeight()); + } else { + aTStack_78.set(0.0f, 0.0f, param_1.getWidth(), param_1.getHeight()); + } + draw(param_1, aTStack_78); +} + + +/* 80302164-80302284 2FCAA4 0120+00 1/0 0/0 0/0 .text + * draw__11J2DWindowExFRCQ29JGeometry8TBox2<f>RCQ29JGeometry8TBox2<f> */ +void J2DWindowEx::draw(JGeometry::TBox2<f32> const& param_1, JGeometry::TBox2<f32> const& param_2) { + rewriteAlpha(); + mColorAlpha = mAlpha; + makeMatrix(param_1.i.x, param_1.i.y, 0.0f, 0.0f); + GXLoadPosMtxImm(mPositionMtx, 0); + GXSetCurrentMtx(0); + JGeometry::TBox2<f32> aTStack_70(0.0f, 0.0f, param_1.getWidth(), param_1.getHeight()); + draw_private(aTStack_70, param_2); + for (int i = GX_TEV_SWAP0; i < GX_MAX_TEVSWAP; i++) { + GXSetTevSwapModeTable((GXTevSwapSel)i, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA); + } + GXSetNumIndStages(0); + for (int i = GX_TEVSTAGE0; i < GX_MAX_TEVSTAGE; i++) { + GXSetTevDirect((GXTevStageID)i); + } + Mtx auStack_60; + MTXIdentity(auStack_60); + GXLoadPosMtxImm(auStack_60, 0); +} + + +/* 80302284-80302388 2FCBC4 0104+00 1/1 0/0 0/0 .text setTevOrder__11J2DWindowExFb */ +void J2DWindowEx::setTevOrder(bool param_0) { + u16 local_28[2]; + if (!param_0) { + local_28[0] = 4; + local_28[1] = 0xffff; + } else { + local_28[0] = 0xff; + local_28[1] = 0xff04; + } + for (u8 i = 0; i < 2; i++) { + s32 uVar1 = local_28[i]; + J2DTevOrderInfo info; + info.mTexCoord = uVar1 >> 8; + info.mTexMap = uVar1 >> 8; + info.mColor = uVar1; + J2DTevOrder local_30(info); + for (int j = 0; j < 4; j++) { + if (mFrameMaterial[j]->getTevBlock()->getMaxStage() > i) { + mFrameMaterial[j]->getTevBlock()->setTevOrder(i, local_30); + } + } + } +} + +/* 80302388-803024B4 2FCCC8 012C+00 1/1 0/0 0/0 .text setTevStage__11J2DWindowExFb */ +void J2DWindowEx::setTevStage(bool param_1) { + for (int i = 0; i < 4; i++) { + J2DTevStage* pJVar3 = mFrameMaterial[i]->getTevBlock()->getTevStage(0); + JUTTexture* this_00 = mFrameMaterial[i]->getTevBlock()->getTexture(0); + bool bVar1 = false; + if (this_00 != NULL && ((s32)this_00->getFormat() == 0 || (s32)this_00->getFormat() == 1) && + this_00->getTransparency() == 0) + { + bVar1 = true; + } + if (!param_1) { + setStage(pJVar3, bVar1 ? STAGE_ENUM_1 : STAGE_ENUM_0); + } else { + stage_enum sVar5; + if (bVar1) { + sVar5 = STAGE_ENUM_4; + } else { + sVar5 = STAGE_ENUM_3; + } + setStage(pJVar3, sVar5); + setStage(mFrameMaterial[i]->getTevBlock()->getTevStage(1), STAGE_ENUM_2); + } + } +} + +/* 803024B4-80302764 2FCDF4 02B0+00 1/1 0/0 0/0 .text + * setStage__11J2DWindowExFP11J2DTevStageQ211J2DWindowEx10stage_enum */ +void J2DWindowEx::setStage(J2DTevStage* param_0, J2DWindowEx::stage_enum param_1) { + s8 local_30[6][4] = { + {0x0f, 0x08, 0x0a, 0x0f}, {0x0f, 0x08, 0x0a, 0x0f}, {0x0f, 0x0a, 0x00, 0x0f}, + {0x02, 0x04, 0x08, 0x0f}, {0x02, 0x04, 0x08, 0x0f}, {0x0f, 0x0f, 0x0f, 0x0a}, + }; + s8 local_48[6][4] = { + {0x07, 0x04, 0x05, 0x07}, {0x05, 0x07, 0x07, 0x07}, {0x07, 0x05, 0x00, 0x07}, + {0x01, 0x02, 0x04, 0x07}, {0x07, 0x07, 0x07, 0x02}, {0x07, 0x07, 0x07, 0x05}, + }; + s8 local_68[6][5] = { + {1, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 1, 0, 0, 1}, + {0, 0, 1, 0, 0}, {1, 0, 0, 0, 0}, {0, 0, 0, 0, 1}, + }; + + param_0->setTevColorAB(local_30[param_1][0], local_30[param_1][1]); + param_0->setTevColorCD(local_30[param_1][2], local_30[param_1][3]); + param_0->setTevColorOp(local_68[param_1][0], local_68[param_1][1], local_68[param_1][2], + local_68[param_1][3], local_68[param_1][4]); + param_0->setAlphaABCD(local_48[param_1][0], local_48[param_1][1], local_48[param_1][2], + local_48[param_1][3]); + param_0->setTevAlphaOp(local_68[param_1][0], local_68[param_1][1], local_68[param_1][2], + local_68[param_1][3], local_68[param_1][4]); +} + + +/* 80302764-803027EC 2FD0A4 0088+00 1/0 0/0 0/0 .text setBlack__11J2DWindowExFQ28JUtility6TColor + */ +bool J2DWindowEx::setBlack(JUtility::TColor black) { + JUtility::TColor dummy,white; + + if (!getBlackWhite(&dummy, &white)) { + return false; + } + + return setBlackWhite(black, white); +} + +/* 803027EC-80302874 2FD12C 0088+00 1/0 0/0 0/0 .text setWhite__11J2DWindowExFQ28JUtility6TColor + */ +bool J2DWindowEx::setWhite(JUtility::TColor white) { + JUtility::TColor black,dummy; + + if (!getBlackWhite(&black, &dummy)) { + return false; + } + + return setBlackWhite(black, white); +} + +/* 80302874-80302A4C 2FD1B4 01D8+00 1/0 0/0 0/0 .text + * setBlackWhite__11J2DWindowExFQ28JUtility6TColorQ28JUtility6TColor */ +// J2DGXColorS10 issue +#ifdef NONMATCHING +bool J2DWindowEx::setBlackWhite(JUtility::TColor black, JUtility::TColor white) { + for (int i = 0; i < 4; i++) { + if (mFrameMaterial[i] == NULL) { + return false; + } + + if (mFrameMaterial[i]->getTevBlock() == NULL) { + return false; + } + } + + if (!isSetBlackWhite(black, white)) { + return false; + } + + bool bVar1 = false; + if ((u32)black != 0 || (u32)white != 0xffffffff) { + bVar1 = true; + } + u8 uVar3 = bVar1 ? 2 : 1; + for (int i = 0; i < 4; i++) { + mFrameMaterial[i]->getTevBlock()->setTevStageNum(uVar3); + } + setTevOrder(bVar1); + setTevStage(bVar1); + if (bVar1) { + J2DGXColorS10 color0; + J2DGXColorS10 color1; + color0.r = black.r; + color0.g = black.g; + color0.b = black.b; + color0.a = black.a; + color1.r = white.r; + color1.g = white.g; + color1.b = white.b; + color1.a = white.a; + + for (int i = 0; i < 4; i++) { + mFrameMaterial[i]->getTevBlock()->setTevColor(0, color0); + mFrameMaterial[i]->getTevBlock()->setTevColor(1, color1); + } + } + return true; +} +#else +bool J2DWindowEx::setBlackWhite(JUtility::TColor param_0, JUtility::TColor param_1) { + // NONMATCHING +} +#endif + +/* 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; + } + + if (mFrameMaterial[0]->getTevBlock() == NULL) { + return false; + } + + bool cVar6 = mFrameMaterial[0]->getTevBlock()->getTevStageNum() != 1; + *param_0 = JUtility::TColor(0); + *param_1 = JUtility::TColor(0xffffffff); + if (cVar6) { + J2DGXColorS10* color0p = mFrameMaterial[0]->getTevBlock()->getTevColor(0); + GXColorS10 color0; + color0.r = color0p->r; + color0.g = color0p->g; + color0.b = color0p->b; + color0.a = color0p->a; + J2DGXColorS10* color1p = mFrameMaterial[0]->getTevBlock()->getTevColor(1); + GXColorS10 color1; + color1.r = color1p->r; + color1.g = color1p->g; + color1.b = color1p->b; + color1.a = color1p->a; + *param_0 = JUtility::TColor((((u8)color0.r) << 0x18) | (((u8)color0.g) << 0x10) | (((u8)color0.b) << 0x8) | (((u8)color0.a))); + *param_1 = JUtility::TColor((((u8)color1.r) << 0x18) | (((u8)color1.g) << 0x10) | (((u8)color1.b) << 0x8) | (((u8)color1.a))); + } + return true; +} + +/* 80302BE8-80302C88 2FD528 00A0+00 1/1 0/0 0/0 .text + * isSetBlackWhite__11J2DWindowExCFQ28JUtility6TColorQ28JUtility6TColor */ +bool J2DWindowEx::isSetBlackWhite(JUtility::TColor param_0, JUtility::TColor param_1) const { + if ((u32)param_0 == 0 && (u32)param_1 == 0xffffffff) { + return true; + } + for (int i = 0; i < 4; i++) { + if (mFrameMaterial[i]->getTevBlock()->getMaxStage() == 1) { + return false; + } + } + return true; +} + +/* 80302C88-80302CE8 2FD5C8 0060+00 1/0 0/0 0/0 .text getBlack__11J2DWindowExCFv */ +JUtility::TColor J2DWindowEx::getBlack() const { + JUtility::TColor black, white; + if (!getBlackWhite(&black, &white)) { + return JUtility::TColor(0); + } + + return black; +} + +/* 80302CE8-80302D48 2FD628 0060+00 1/0 0/0 0/0 .text getWhite__11J2DWindowExCFv */ +JUtility::TColor J2DWindowEx::getWhite() const { + JUtility::TColor black, white; + if (!getBlackWhite(&black, &white)) { + return JUtility::TColor(0xffffffff); + } + + return white; +} + +/* 80302D48-80302D98 2FD688 0050+00 1/0 0/0 0/0 .text setAlpha__11J2DWindowExFUc */ +void J2DWindowEx::setAlpha(u8 param_0) { + mAlpha = param_0; + + for (int i = 0; i < 4; i++) { + if (mFrameMaterial[i] != NULL) { + if (mFrameMaterial[i]->getColorBlock()->getMatColor(0) != NULL) { + mFrameMaterial[i]->getColorBlock()->getMatColor(0)->a = param_0; + } + } + } + + if (mContentsMaterial != NULL) { + if (mContentsMaterial->getColorBlock()->getMatColor(0) != 0) { + mContentsMaterial->getColorBlock()->getMatColor(0)->a = param_0; + } + } +} + +/* 80302D98-80302DF4 2FD6D8 005C+00 1/0 0/0 0/0 .text setCullBack__11J2DWindowExF11_GXCullMode */ +void J2DWindowEx::setCullBack(_GXCullMode param_0) { + mCullMode = param_0; + + for (int i = 0; i < 4; i++) { + if (mFrameMaterial[i] != NULL) { + mFrameMaterial[i]->getColorBlock()->setCullMode(param_0); + } + } + + if (mContentsMaterial != NULL) { + mContentsMaterial->getColorBlock()->setCullMode(param_0); + } + J2DPane::setCullBack(param_0); +} + +/* 80302DF4-80302E0C 2FD734 0018+00 1/0 0/0 0/0 .text rewriteAlpha__11J2DWindowExFv */ +void J2DWindowEx::rewriteAlpha() { + if (mContentsMaterial != NULL) { + mAlpha = mContentsMaterial->getColorBlock()->getMatColor(0)->a; + } +} + +/* 80302E0C-80302E74 2FD74C 0068+00 1/0 0/0 0/0 .text getFrameTexture__11J2DWindowExCFUcUc */ +JUTTexture* J2DWindowEx::getFrameTexture(u8 param_0, u8 param_1) const { + J2DMaterial* frameMaterial = getFrameMaterial(param_0); + if (frameMaterial != NULL && frameMaterial->getTevBlock() != NULL) { + return frameMaterial->getTevBlock()->getTexture(param_1); + } + return NULL; +} + +/* 80302E74-80302EDC 2FD7B4 0068+00 1/0 0/0 0/0 .text getContentsTexture__11J2DWindowExCFUc */ +JUTTexture* J2DWindowEx::getContentsTexture(u8 param_0) const { + J2DMaterial* frameMaterial = getContentsMaterial(); + if (frameMaterial != NULL && frameMaterial->getTevBlock() != NULL) { + return frameMaterial->getTevBlock()->getTexture(param_0); + } + return NULL; +} + +/* 80302EDC-80302FFC 2FD81C 0120+00 1/0 0/0 0/0 .text isUsed__11J2DWindowExFPC7ResTIMG */ +bool J2DWindowEx::isUsed(ResTIMG const* timg) { + for (u8 i = 0; i < 4; i++) { + if (mFrameMaterial[i] != NULL && mFrameMaterial[i]->getTevBlock() != NULL) { + for (u32 j = 0; j < 8; j++) { + JUTTexture* texture = mFrameMaterial[i]->getTevBlock()->getTexture(j); + if (texture != NULL && texture->getTexInfo() == timg) { + return true; + } + } + } + } + + if (mContentsMaterial != NULL && mContentsMaterial->getTevBlock() != NULL) { + for (u32 j = 0; j < 8; j++) { + JUTTexture* texture = mContentsMaterial->getTevBlock()->getTexture(j); + if (texture != NULL && texture->getTexInfo() == timg) { + return true; + } + } + } + + return J2DPane::isUsed(timg); +} + +/* 80302FFC-80303084 2FD93C 0088+00 1/0 0/0 0/0 .text setAnimation__11J2DWindowExFP11J2DAnmColor + */ +void J2DWindowEx::setAnimation(J2DAnmColor* anmColor) { + for (u8 i = 0; i < 4; i++) { + if (isNeedSetAnm(i)) { + mFrameMaterial[i]->setAnimation(anmColor); + } + } + if (mContentsMaterial != NULL) { + mContentsMaterial->setAnimation(anmColor); + } +} + +/* 80303084-8030310C 2FD9C4 0088+00 1/0 0/0 0/0 .text + * setAnimation__11J2DWindowExFP19J2DAnmTextureSRTKey */ +void J2DWindowEx::setAnimation(J2DAnmTextureSRTKey* param_0) { + for (u8 i = 0; i < 4; i++) { + if (isNeedSetAnm(i)) { + mFrameMaterial[i]->setAnimation(param_0); + } + } + if (mContentsMaterial != NULL) { + mContentsMaterial->setAnimation(param_0); + } +} + +/* 8030310C-80303194 2FDA4C 0088+00 1/0 0/0 0/0 .text + * setAnimation__11J2DWindowExFP16J2DAnmTexPattern */ +void J2DWindowEx::setAnimation(J2DAnmTexPattern* param_0) { + for (u8 i = 0; i < 4; i++) { + if (isNeedSetAnm(i)) { + mFrameMaterial[i]->setAnimation(param_0); + } + } + if (mContentsMaterial != NULL) { + mContentsMaterial->setAnimation(param_0); + } +} + +/* 80303194-8030321C 2FDAD4 0088+00 1/0 0/0 0/0 .text + * setAnimation__11J2DWindowExFP15J2DAnmTevRegKey */ +void J2DWindowEx::setAnimation(J2DAnmTevRegKey* param_0) { + for (u8 i = 0; i < 4; i++) { + if (isNeedSetAnm(i)) { + mFrameMaterial[i]->setAnimation(param_0); + } + } + if (mContentsMaterial != NULL) { + mContentsMaterial->setAnimation(param_0); + } +} + +/* 8030321C-80303274 2FDB5C 0058+00 4/4 0/0 0/0 .text isNeedSetAnm__11J2DWindowExFUc */ +bool J2DWindowEx::isNeedSetAnm(u8 param_0) { + for (u8 i = 0; i < param_0; i++) { + if (mFrameMaterial[i] == mFrameMaterial[param_0]) { + return false; + } + } + return mFrameMaterial[param_0] != NULL; +} + +/* 80303274-8030327C -00001 0008+00 0/0 0/0 0/0 .text + * setAnimation__11J2DWindowExFP20J2DAnmVisibilityFull */ +void J2DWindowEx::setAnimation(J2DAnmVisibilityFull* param_0) { + mAnmVisibilityFull = param_0; +} + +/* 8030327C-80303370 2FDBBC 00F4+00 1/0 0/0 0/0 .text + * setAnimation__11J2DWindowExFP14J2DAnmVtxColor */ +void J2DWindowEx::setAnimation(J2DAnmVtxColor* param_0) { + mAnmVtxColor = param_0; + field_0x17c = 0; + if (param_0 != NULL) { + u16 uVar3 = param_0->getAnmTableNum(0); + for (u8 i = 0; i < 4; i++) { + if (field_0x168[i] != 0xffff) { + for (u16 j = 0; j < uVar3; j++) { + J3DAnmVtxColorIndexData* puVar1 = param_0->getAnmVtxColorIndexData(0, j); + u16* indexPointer = param_0->getVtxColorIndexPointer(0); + u16* indexPointer2 = indexPointer + (u32)puVar1->mpData; + for (u16 k = 0; k < puVar1->mNum; k++) { + if (indexPointer2[k] == field_0x168[i]) { + mAnmVtxColor = param_0; + field_0x17c |= 1 << i; + goto nexti; + } + } + } + } + nexti:; + } + } + + if (field_0x17c == 0) { + mAnmVtxColor = NULL; + } +} + +/* ############################################################################################## */ +/* 803A1C70-803A1C80 02E2D0 0010+00 0/0 0/0 0/0 .rodata @1557 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_1557[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +COMPILER_STRIP_GATE(0x803A1C70, &lit_1557); +#pragma pop + +/* 803A1C80-803A1C90 02E2E0 0010+00 0/0 0/0 0/0 .rodata @1566 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_1566[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +COMPILER_STRIP_GATE(0x803A1C80, &lit_1566); +#pragma pop + +/* 803A1C90-803A1CA0 02E2F0 0010+00 0/0 0/0 0/0 .rodata @1575 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_1575[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +COMPILER_STRIP_GATE(0x803A1C90, &lit_1575); +#pragma pop + +/* 803A1CA0-803A1CB0 02E300 0010+00 0/0 0/0 0/0 .rodata @1581 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_1581[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +COMPILER_STRIP_GATE(0x803A1CA0, &lit_1581); +#pragma pop + +/* 803A1CB0-803A1CC0 02E310 0010+00 0/0 0/0 0/0 .rodata @1587 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_1587[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +COMPILER_STRIP_GATE(0x803A1CB0, &lit_1587); +#pragma pop + +/* 803A1CC0-803A1CD0 02E320 0010+00 0/0 0/0 0/0 .rodata @1596 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_1596[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +COMPILER_STRIP_GATE(0x803A1CC0, &lit_1596); +#pragma pop + +/* 803A1CD0-803A1CE0 02E330 0010+00 0/0 0/0 0/0 .rodata @1605 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_1605[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +COMPILER_STRIP_GATE(0x803A1CD0, &lit_1605); +#pragma pop + +/* 803A1CE0-803A1CF0 02E340 0010+00 0/0 0/0 0/0 .rodata @1612 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_1612[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +COMPILER_STRIP_GATE(0x803A1CE0, &lit_1612); +#pragma pop + +/* 803A1CF0-803A1D08 02E350 0018+00 0/0 0/0 0/0 .rodata @2530 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_2530[24] = { + 0x0F, 0x08, 0x0A, 0x0F, 0x0F, 0x08, 0x0A, 0x0F, 0x0F, 0x0A, 0x00, 0x0F, + 0x02, 0x04, 0x08, 0x0F, 0x02, 0x04, 0x08, 0x0F, 0x0F, 0x0F, 0x0F, 0x0A, +}; +COMPILER_STRIP_GATE(0x803A1CF0, &lit_2530); +#pragma pop + +/* 803A1D08-803A1D20 02E368 0018+00 0/0 0/0 0/0 .rodata @2531 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_2531[24] = { + 0x07, 0x04, 0x05, 0x07, 0x05, 0x07, 0x07, 0x07, 0x07, 0x05, 0x00, 0x07, + 0x01, 0x02, 0x04, 0x07, 0x07, 0x07, 0x07, 0x02, 0x07, 0x07, 0x07, 0x05, +}; +COMPILER_STRIP_GATE(0x803A1D08, &lit_2531); +#pragma pop + +/* 803A1D20-803A1D40 02E380 001E+02 0/0 0/0 0/0 .rodata @2532 */ +#pragma push +#pragma force_active on +SECTION_RODATA static u8 const lit_2532[30 + 2 /* padding */] = { + 0x00, + 0x00, + 0x00, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x00, + /* padding */ + 0x00, + 0x00, +}; +COMPILER_STRIP_GATE(0x803A1D20, &lit_2532); +#pragma pop + +/* 80303370-80303510 2FDCB0 01A0+00 1/0 0/0 0/0 .text + * animationPane__11J2DWindowExFPC15J2DAnmTransform */ +const J2DAnmTransform* J2DWindowEx::animationPane(J2DAnmTransform const* param_0) { + if (mAnmVisibilityFull != 0 && field_0x166 != 0xffff) { + u8 visibility; + mAnmVisibilityFull->getVisibility(field_0x166, &visibility); + if (visibility) { + J2DPane::show(); + } else { + J2DPane::hide(); + } + } + + JUtility::TColor* local_38[4] = {NULL}; + local_38[0] = &field_0x128; + local_38[1] = &field_0x12C; + local_38[2] = &field_0x130; + local_38[3] = &field_0x134; + if (mAnmVtxColor != NULL) { + u16 uVar3 = mAnmVtxColor->getAnmTableNum(0); + for (u8 i = 0; i < 4; i++) { + if ((field_0x17c & (1 << i))) { + for (u16 j = 0; j < uVar3; j++) { + J3DAnmVtxColorIndexData* puVar1 = mAnmVtxColor->getAnmVtxColorIndexData(0, j); + u16* indexPointer = mAnmVtxColor->getVtxColorIndexPointer(0); + u16* indexPointer2 = indexPointer + (u32)puVar1->mpData; + for (u16 k = 0; k < puVar1->mNum; k++) { + if (indexPointer2[k] == field_0x168[i]) { + mAnmVtxColor->getColor(0, j, local_38[i]); + goto nexti; + } + } + } + } + nexti:; + } + } + return J2DPane::animationPane(param_0); +} + +/* 80303510-80303534 2FDE50 0024+00 1/0 0/0 0/0 .text getFrameMaterial__11J2DWindowExCFUc + */ +J2DMaterial* J2DWindowEx::getFrameMaterial(u8 index) const { + if (index >= 4) { + return NULL; + } + + return mFrameMaterial[index]; +} + +/* 80303534-8030353C 2FDE74 0008+00 1/0 0/0 0/0 .text getContentsMaterial__11J2DWindowExCFv */ +J2DMaterial* J2DWindowEx::getContentsMaterial() const { + return mContentsMaterial; +} + +/* 8030353C-80303568 2FDE7C 002C+00 1/0 0/0 0/0 .text + * getMaterial__11J2DWindowExCFRQ29J2DWindow9TMaterial */ +void J2DWindowEx::getMaterial(J2DWindow::TMaterial& param_0) const { + param_0.field_0x0 = mFrameMaterial[0]; + param_0.field_0x4 = mFrameMaterial[1]; + param_0.field_0x8 = mFrameMaterial[2]; + param_0.field_0xc = mFrameMaterial[3]; + param_0.field_0x10 = mContentsMaterial; +} + +/* 80303568-803035C0 2FDEA8 0058+00 1/0 0/0 0/0 .text draw__11J2DWindowExFffff */ +void J2DWindowEx::draw(f32 param_0, f32 param_1, f32 param_2, f32 param_3) { + draw(JGeometry::TBox2<f32>(JGeometry::TVec2<f32>(param_0, param_1), + JGeometry::TVec2<f32>(param_0 + param_2, param_1 + param_3))); +} + +/* 803035C0-803035FC 2FDF00 003C+00 1/0 0/0 0/0 .text setCullBack__11J2DWindowExFb */ +void J2DWindowEx::setCullBack(bool param_0) { + _GXCullMode mode; + if (param_0) { + mode = GX_CULL_BACK; + } else { + mode = GX_CULL_NONE; + } + setCullBack(mode); +} + +/* 803035FC-8030361C 2FDF3C 0020+00 1/0 0/0 0/0 .text isUsed__11J2DWindowExFPC7ResFONT */ +bool J2DWindowEx::isUsed(ResFONT const* param_0) { + return J2DPane::isUsed(param_0); +} + +/* 8030361C-8030363C 2FDF5C 0020+00 1/0 0/0 0/0 .text setAnimation__11J2DWindowExFP10J2DAnmBase */ +void J2DWindowEx::setAnimation(J2DAnmBase* param_0) { + J2DPane::setAnimation(param_0); +}
\ No newline at end of file |
