diff options
| author | Caroline Madsen <69010899+randomsalience@users.noreply.github.com> | 2025-04-09 16:45:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-09 13:45:30 -0700 |
| commit | c6f76e7240dde8bbcf40a88d6d88cf87cab616b4 (patch) | |
| tree | bf9afbb1c32e66f45bdba30f61a9e4f0d92f804a /src/JSystem/J2DGraph | |
| parent | 6672817e41064e04951ec28d51070b66fc8377ac (diff) | |
Various JSystem work (#2383)
* JKernel and JStudio cleanup
* JMessage cleanup
* JAudio cleanup
* JASBNKParser work
* functionvalue work
* fvb work
* J2D and J3D cleanup
* steal from tww
* J2DPictureEx mostly done
* fix build
Diffstat (limited to 'src/JSystem/J2DGraph')
| -rw-r--r-- | src/JSystem/J2DGraph/J2DMaterial.cpp | 9 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DMaterialFactory.cpp | 7 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DPicture.cpp | 404 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DPictureEx.cpp | 778 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DScreen.cpp | 1 | ||||
| -rw-r--r-- | src/JSystem/J2DGraph/J2DWindowEx.cpp | 208 |
6 files changed, 748 insertions, 659 deletions
diff --git a/src/JSystem/J2DGraph/J2DMaterial.cpp b/src/JSystem/J2DGraph/J2DMaterial.cpp index ea9712dff8..3b7165967d 100644 --- a/src/JSystem/J2DGraph/J2DMaterial.cpp +++ b/src/JSystem/J2DGraph/J2DMaterial.cpp @@ -8,7 +8,6 @@ #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JUtility/JUTPalette.h" #include "JSystem/JUtility/JUTTexture.h" -#include "dol2asm.h" /* 802EA1AC-802EA2CC 2E4AEC 0120+00 0/0 1/1 0/0 .text __ct__11J2DMaterialFv */ J2DMaterial::J2DMaterial() { @@ -305,17 +304,17 @@ void J2DMaterial::animation() { ResTIMG* img = mAnmPointer->mPatternAnm->getResTIMG(idx); if (texture->getTexInfo() != img) { JUTPalette* palette = NULL; - u32 tlut = GX_TLUT0; + GXTlut tlut = GX_TLUT0; if (img->indexTexture != 0) { palette = mAnmPointer->mPatternAnm->getPalette(idx); if (palette->getNumColors() > 256) { - tlut = i % 4 + 16; + tlut = (GXTlut)(i % 4 + 16); } else { - tlut = i; + tlut = (GXTlut)i; } } - texture->storeTIMG(img, palette, (GXTlut)tlut); + texture->storeTIMG(img, palette, tlut); } } } diff --git a/src/JSystem/J2DGraph/J2DMaterialFactory.cpp b/src/JSystem/J2DGraph/J2DMaterialFactory.cpp index ba95fb632c..c2f9f9b7ea 100644 --- a/src/JSystem/J2DGraph/J2DMaterialFactory.cpp +++ b/src/JSystem/J2DGraph/J2DMaterialFactory.cpp @@ -9,7 +9,6 @@ #include "JSystem/JSupport/JSupport.h" #include "JSystem/JUtility/JUTResource.h" #include "string.h" -#include "dol2asm.h" #include "dolphin/types.h" /* 802F2AD0-802F2C94 2ED410 01C4+00 0/0 1/1 0/0 .text @@ -108,7 +107,7 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par local_380 = aJStack_12c.getResource(local_37c, 'TIMG', NULL); } if (local_380 == NULL && J2DScreen::getDataManage() != NULL) { - char acStack_230[256]; + char acStack_230[257]; strcpy(acStack_230, param_3->getName(texNo)); local_380 = J2DScreen::getDataManage()->get(acStack_230); } @@ -128,7 +127,7 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par } if (local_388 == NULL && J2DScreen::getDataManage() != NULL) { char* pcVar9 = param_4->getName(param_0->getTevBlock()->getFontNo()); - char acStack_334[256]; + char acStack_334[257]; strcpy(acStack_334, pcVar9); local_388 = J2DScreen::getDataManage()->get(acStack_334); } @@ -294,7 +293,7 @@ J2DTevOrder J2DMaterialFactory::newTevOrder(int param_0, int param_1) const { /* 802F3A1C-802F3AB4 2EE35C 0098+00 1/1 0/0 0/0 .text newTevColor__18J2DMaterialFactoryCFii */ // NONMATCHING - J2DGXColorS10 init issues J2DGXColorS10 J2DMaterialFactory::newTevColor(int param_0, int param_1) const { - GXColorS10 color = {}; + GXColorS10 color = {0, 0, 0, 0}; J2DGXColorS10 rv = J2DGXColorS10(color); J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]]; if (iVar2->field_0x92[param_1] != 0xffff) { diff --git a/src/JSystem/J2DGraph/J2DPicture.cpp b/src/JSystem/J2DGraph/J2DPicture.cpp index 03c2fff0a0..3c86bcda20 100644 --- a/src/JSystem/J2DGraph/J2DPicture.cpp +++ b/src/JSystem/J2DGraph/J2DPicture.cpp @@ -10,250 +10,8 @@ #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++) { @@ -273,11 +31,6 @@ J2DPicture::J2DPicture(J2DPane* p_pane, JSURandomInputStream* p_stream, JKRArchi 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) @@ -381,11 +134,6 @@ J2DPicture::J2DPicture(J2DPane* p_pane, JSURandomInputStream* p_stream, J2DMater 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++) { @@ -419,7 +167,6 @@ J2DPicture::J2DPicture(u64 tag, JGeometry::TBox2<f32> const& bounds, ResTIMG con initinfo(); } - /* 802FC8E8-802FCCDC 2F7228 03F4+00 1/1 0/0 0/0 .text * private_readStream__10J2DPictureFP7J2DPaneP20JSURandomInputStreamP10JKRArchive */ void J2DPicture::private_readStream(J2DPane* parent, JSURandomInputStream* stream, @@ -496,19 +243,6 @@ void J2DPicture::private_readStream(J2DPane* parent, JSURandomInputStream* strea 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) { @@ -520,7 +254,6 @@ void J2DPicture::initiate(const ResTIMG* img, const ResTLUT* lut) { 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) { @@ -555,7 +288,7 @@ void J2DPicture::private_initiate(const ResTIMG* timg, const ResTLUT* tlut) { void J2DPicture::initinfo() { mKind = 'PIC1'; setTexCoord(NULL, BIND15, MIRROR0, false); - setBlendRatio(lit_1767, lit_1767); + setBlendRatio(1.0f, 1.0f); mBlack = 0; mWhite = -1; @@ -782,6 +515,11 @@ const ResTIMG* J2DPicture::changeTexture(char const* resName, u8 param_1) { return changeTexture((ResTIMG*)resource, param_1); } +static bool dummy_weak_order(JUTTexture* tex) { + J2DPicture* picture; + return picture->append(tex, 1.0f); +} + /* 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) { @@ -1125,10 +863,6 @@ void J2DPicture::setBlendAlphaRatio(f32 param_0, f32 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() { @@ -1148,7 +882,6 @@ void J2DPicture::setBlendKonstColor() { mBlendKonstColor = uvar3; } - /* 802FEB94-802FEC64 2F94D4 00D0+00 4/4 0/0 0/0 .text setBlendKonstAlpha__10J2DPictureFv */ void J2DPicture::setBlendKonstAlpha() { @@ -1168,7 +901,6 @@ void J2DPicture::setBlendKonstAlpha() { mBlendKonstAlpha = uvar3; } - /* 802FEC64-802FED44 2F95A4 00E0+00 3/3 0/0 0/0 .text * getNewColor__10J2DPictureFPQ28JUtility6TColor */ void J2DPicture::getNewColor(JUtility::TColor* param_0) { @@ -1192,10 +924,6 @@ void J2DPicture::setTexCoord(JUTTexture const* param_0, J2DBinding param_1, J2DM 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, @@ -1362,123 +1090,3 @@ GXTlut J2DPicture::getTlutID(ResTIMG const* img, u8 param_1) { 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 */ -} diff --git a/src/JSystem/J2DGraph/J2DPictureEx.cpp b/src/JSystem/J2DGraph/J2DPictureEx.cpp index 4cddb568a7..87a4af54ee 100644 --- a/src/JSystem/J2DGraph/J2DPictureEx.cpp +++ b/src/JSystem/J2DGraph/J2DPictureEx.cpp @@ -226,12 +226,56 @@ bool J2DPictureEx::insert(JUTTexture* param_0, u8 param_1, f32 param_2) { } /* 803040E4-8030437C 2FEA24 0298+00 2/2 0/0 0/0 .text insertCommon__12J2DPictureExFUcf */ -void J2DPictureEx::insertCommon(u8 param_0, f32 param_1) { - // NONMATCHING +void J2DPictureEx::insertCommon(u8 pos, f32 param_1) { + u8 new_tev_stage_num; + u8 tex_gen_num = mMaterial->getTexGenBlock()->getTexGenNum(); + mMaterial->getTevBlock()->getMaxStage(); + int tev_stage_num = mMaterial->getTevBlock()->getTevStageNum(); + bool bVar1; + if (tex_gen_num <= 1) { + bVar1 = tev_stage_num != 1; + } else { + bVar1 = tev_stage_num != tex_gen_num + 1; + } + + shiftSetBlendRatio(pos, param_1, true, true); + shiftSetBlendRatio(pos, param_1, false, true); + + tex_gen_num++; + mMaterial->getTexGenBlock()->setTexGenNum(tex_gen_num); + + J2DTexCoordInfo tex_coord_info; + tex_coord_info.mTexGenType = GX_TG_MTX2x4; + tex_coord_info.mTexGenSrc = GX_TG_TEX0; + for (int i = tex_gen_num - 1; i >= pos; i--) { + tex_coord_info.mTexGenMtx = i * 3 + 30; + J2DTexCoord tex_coord(tex_coord_info); + mMaterial->getTexGenBlock()->setTexCoord((u8)i, tex_coord); + } + + for (int i = tex_gen_num - 1; i > pos; i--) { + mMaterial->getTexGenBlock()->setTexMtx((u8)i, mMaterial->getTexGenBlock()->getTexMtx((u8)(i - 1))); + } + + J2DTexMtx tex_mtx; + mMaterial->getTexGenBlock()->setTexMtx(pos, tex_mtx); + + if (tex_gen_num == 1) { + new_tev_stage_num = 1; + } else { + new_tev_stage_num = tex_gen_num + (bVar1 ? 2 : 1); + } + mMaterial->getTevBlock()->setTevStageNum(new_tev_stage_num); + + setTevOrder(tex_gen_num, new_tev_stage_num, bVar1); + setTevStage(tex_gen_num, new_tev_stage_num, bVar1); + setTevKColor(tex_gen_num); + setTevKColorSel(tex_gen_num); + setTevKAlphaSel(tex_gen_num); } /* 8030437C-8030446C 2FECBC 00F0+00 2/2 0/0 0/0 .text isInsert__12J2DPictureExCFUc */ -bool J2DPictureEx::isInsert(u8 param_0) const { +bool J2DPictureEx::isInsert(u8 pos) const { if (mMaterial == NULL) { return false; } @@ -240,7 +284,7 @@ bool J2DPictureEx::isInsert(u8 param_0) const { } u8 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum(); - if (texGenNum >= 8 || param_0 >= 8 || param_0 > texGenNum) { + if (texGenNum >= 8 || pos >= 8 || pos > texGenNum) { return false; } u8 bVar5 = mMaterial->getTevBlock()->getMaxStage(); @@ -256,8 +300,36 @@ bool J2DPictureEx::isInsert(u8 param_0) const { } /* 8030446C-80304608 2FEDAC 019C+00 1/0 0/0 0/0 .text remove__12J2DPictureExFUc */ -bool J2DPictureEx::remove(u8 param_0) { - // NONMATCHING +// NONMATCHING regalloc +bool J2DPictureEx::remove(u8 pos) { + if (!isRemove(pos)) { + return false; + } + + u8 tex_gen_num = mMaterial->getTexGenBlock()->getTexGenNum(); + u8 tev_stage_num = mMaterial->getTevBlock()->getTevStageNum(); + bool bVar1 = tev_stage_num != tex_gen_num + 1; + + shiftSetBlendRatio(pos, 0.0f, true, false); + shiftSetBlendRatio(pos, 0.0f, false, false); + + tex_gen_num--; + mMaterial->getTexGenBlock()->setTexGenNum(tex_gen_num); + mMaterial->getTevBlock()->removeTexture(pos); + + if (tex_gen_num != 1) { + tev_stage_num = tex_gen_num + (bVar1 ? 2 : 1); + } else { + tev_stage_num = bVar1 ? 2 : 1; + } + mMaterial->getTevBlock()->setTevStageNum(tev_stage_num); + + setTevOrder(tex_gen_num, tev_stage_num, bVar1); + setTevStage(tex_gen_num, tev_stage_num, bVar1); + setTevKColor(tex_gen_num); + setTevKColorSel(tex_gen_num); + setTevKAlphaSel(tex_gen_num); + return true; } /* 80304608-8030466C 2FEF48 0064+00 1/0 0/0 0/0 .text remove__12J2DPictureExFv */ @@ -311,28 +383,232 @@ bool J2DPictureEx::isRemove(u8 param_0) const { } /* 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 +void J2DPictureEx::draw(f32 param_0, f32 param_1, u8 texNo, bool param_3, bool param_4, + bool param_5) { + if (mMaterial == NULL) { + return; + } + + if (mMaterial->getTevBlock() == NULL) { + return; + } + + if (!isVisible()) { + return; + } + + if (texNo >= mMaterial->getTexGenBlock()->getTexGenNum()) { + return; + } + + JUTTexture* texture = mMaterial->getTevBlock()->getTexture(texNo); + if (texture != NULL) { + draw(param_0, param_1, texture->getWidth(), texture->getHeight(), + param_3, param_4, param_5); + } } /* 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 +void J2DPictureEx::draw(f32 param_0, f32 param_1, f32 width, f32 height, bool param_4, + bool param_5, bool param_6) { + if (!isVisible()) { + return; + } + + if (mMaterial == NULL) { + return; + } + + if (mMaterial->getTevBlock() == NULL) { + return; + } + + if (mMaterial->getTexGenBlock()->getTexGenNum() == 0) { + return; + } + + mMaterial->setGX(); + makeMatrix(param_0, param_1, 0.0f, 0.0f); + GXLoadPosMtxImm(mPositionMtx, GX_PNMTX0); + GXSetCurrentMtx(GX_PNMTX0); + + if (!mMaterial->isVisible()) { + return; + } + + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + + mColorAlpha = mAlpha; + + JUtility::TColor corner_color[4]; + for (int i = 0; i < 4; i++) { + corner_color[i] = mCornerColor[i]; + } + + if (mMaterial->getMaterialAlphaCalc() == 1) { + for (int i = 0; i < 4; i++) { + corner_color[i].a = (mColorAlpha * corner_color[i].a) / 0xff; + } + } + + 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(corner_color[0]); + if (!param_6) { + GXTexCoord2u16(param_4 ? 0x8000 : 0, param_5 ? 0x8000 : 0); + } else { + GXTexCoord2u16(param_4 ? 0x8000 : 0, param_5 ? 0 : 0x8000); + } + + GXPosition3f32(width, 0.0f, 0.0f); + GXColor1u32(corner_color[1]); + if (!param_6) { + GXTexCoord2u16(param_4 ? 0 : 0x8000, param_5 ? 0x8000 : 0); + } else { + GXTexCoord2u16(param_4 ? 0x8000 : 0, param_5 ? 0x8000 : 0); + } + + GXPosition3f32(width, height, 0.0f); + GXColor1u32(corner_color[3]); + if (!param_6) { + GXTexCoord2u16(param_4 ? 0 : 0x8000, param_5 ? 0 : 0x8000); + } else { + GXTexCoord2u16(param_4 ? 0 : 0x8000, param_5 ? 0x8000 : 0); + } + + GXPosition3f32(0.0f, height, 0.0f); + GXColor1u32(corner_color[2]); + if (!param_6) { + GXTexCoord2u16(param_4 ? 0x8000 : 0, param_5 ? 0 : 0x8000); + } else { + GXTexCoord2u16(param_4 ? 0 : 0x8000, param_5 ? 0 : 0x8000); + } + + GXEnd(); + + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0); + GXSetNumTexGens(0); + GXSetNumTevStages(1); + GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + 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); + } + Mtx mtx; + MTXIdentity(mtx); + GXLoadPosMtxImm(mtx, GX_PNMTX0); + GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); + GXSetVtxDesc(GX_VA_TEX0, GX_NONE); } /* 80304D88-80304EF0 2FF6C8 0168+00 1/0 0/0 0/0 .text drawOut__12J2DPictureExFffffff */ +// NONMATCHING stack ordering void J2DPictureEx::drawOut(f32 param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, - f32 param_5) { - // NONMATCHING + f32 param_5) { + if (mMaterial == NULL) { + return; + } + + if (mMaterial->getTevBlock() == NULL) { + return; + } + + if (!isVisible()) { + return; + } + + JUTTexture* texture = mMaterial->getTevBlock()->getTexture(0); + if (texture != NULL) { + JGeometry::TBox2<f32> box1(param_4, param_5, param_4 + texture->getWidth(), param_5 + texture->getHeight()); + JGeometry::TBox2<f32> box2(param_0, param_1, param_0 + param_2, param_1 + param_3); + drawOut(box1, box2); + } } /* 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 + JGeometry::TBox2<f32> const& param_1) { + if (mMaterial == NULL) { + return; + } + + if (mMaterial->getTevBlock() == NULL) { + return; + } + + if (!isVisible()) { + return; + } + + mMaterial->setGX(); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + + if (!mMaterial->isVisible()) { + return; + } + + mColorAlpha = mAlpha; + JUtility::TColor corner_color[4]; + for (int i = 0; i < 4; i++) { + corner_color[i] = mCornerColor[i]; + } + if (mMaterial->getMaterialAlphaCalc() == 1) { + for (int i = 0; i < 4; i++) { + corner_color[i].a = (mColorAlpha * corner_color[i].a) / 0xff; + } + } + + f32 x1 = (param_0.i.x - param_1.i.x) / param_1.getWidth(); + f32 x2 = (param_0.f.x - param_1.f.x) / param_1.getWidth() + 1.0f; + f32 y1 = (param_0.i.y - param_1.i.y) / param_1.getHeight(); + f32 y2 = (param_0.f.y - param_1.f.y) / param_1.getHeight() + 1.0f; + + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + + GXPosition3f32(param_0.i.x, param_0.i.y, 0.0f); + GXColor1u32(corner_color[0]); + GXTexCoord2f32(x1, y1); + GXPosition3f32(param_0.f.x, param_0.i.y, 0.0f); + GXColor1u32(corner_color[1]); + GXTexCoord2f32(x2, y1); + GXPosition3f32(param_0.f.x, param_0.f.y, 0.0f); + GXColor1u32(corner_color[3]); + GXTexCoord2f32(x2, y2); + GXPosition3f32(param_0.i.x, param_0.f.y, 0.0f); + GXColor1u32(corner_color[2]); + GXTexCoord2f32(x1, y2); + + GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 15); + GXSetNumTexGens(0); + GXSetNumTevStages(1); + GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + 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); + } + GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); + GXSetVtxDesc(GX_VA_TEX0, GX_NONE); } /* 80305264-803052AC 2FFBA4 0048+00 1/0 0/0 0/0 .text load__12J2DPictureExF11_GXTexMapIDUc */ @@ -351,32 +627,171 @@ void J2DPictureEx::load(_GXTexMapID param_0, u8 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 + u16 local_30[16]; + if (param_0 == 1) { + if (!param_2) { + local_30[0] = 4; + } else { + local_30[0] = 0xff; + local_30[1] = 0xff04; + } + } else { + for (u8 i = 0; i < param_0; i++) { + local_30[i] = (i << 8) | 0xff; + } + if (!param_2) { + local_30[param_0] = 0xff04; + } else { + local_30[param_0] = 0xffff; + local_30[param_0 + 1] = 0xff04; + } + } + + for (u8 i = 0; i < param_1; i++) { + J2DTevOrderInfo info; + info.mTexMap = info.mTexCoord = local_30[i] >> 8; + info.mColor = local_30[i] & 0xff; + J2DTevOrder order(info); + mMaterial->getTevBlock()->setTevOrder(i, order); + } } /* 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 + if (param_0 == 1) { + J2DTevStage* stage = mMaterial->getTevBlock()->getTevStage(0); + JUTTexture* texture = mMaterial->getTevBlock()->getTexture(0); + bool bVar1 = false; + if (texture != NULL && texture->getTexInfo() != NULL + && (texture->getFormat() == 0 || texture->getFormat() == 1) + && texture->getTransparency() == 0) + { + bVar1 = true; + } + if (!param_2) { + setStage(stage, bVar1 ? STAGE_1 : STAGE_0); + } else { + setStage(stage, bVar1 ? STAGE_6 : STAGE_5); + stage = mMaterial->getTevBlock()->getTevStage(1); + setStage(stage, STAGE_4); + } + } else if (!param_2) { + J2DTevStage* stage = mMaterial->getTevBlock()->getTevStage(0); + setStage(stage, STAGE_2); + for (u8 i = 1; i < param_0; i++) { + stage = mMaterial->getTevBlock()->getTevStage(i); + setStage(stage, STAGE_3); + } + stage = mMaterial->getTevBlock()->getTevStage(param_0); + setStage(stage, STAGE_4); + } else { + J2DTevStage* stage = mMaterial->getTevBlock()->getTevStage(0); + setStage(stage, STAGE_2); + for (u8 i = 1; i < param_0; i++) { + stage = mMaterial->getTevBlock()->getTevStage(i); + setStage(stage, STAGE_3); + } + stage = mMaterial->getTevBlock()->getTevStage(param_0); + setStage(stage, STAGE_7); + stage = mMaterial->getTevBlock()->getTevStage((u8)(param_0 + 1)); + setStage(stage, STAGE_4); + } } -/* ############################################################################################## */ -/* 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 +void J2DPictureEx::setStage(J2DTevStage* stage, J2DPictureEx::stage_enum idx) { + s8 colorData[8][4] = { + {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}, + }; + s8 alphaData[8][4] = { + {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}, + }; + s8 opData[8][5] = { + {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}, + }; + + stage->setTevColorAB(colorData[idx][0], colorData[idx][1]); + stage->setTevColorCD(colorData[idx][2], colorData[idx][3]); + stage->setTevColorOp(opData[idx][0], opData[idx][1], opData[idx][2], opData[idx][3], opData[idx][4]); + stage->setAlphaABCD(alphaData[idx][0], alphaData[idx][1], alphaData[idx][2], alphaData[idx][3]); + stage->setTevAlphaOp(opData[idx][0], opData[idx][1], opData[idx][2], opData[idx][3], opData[idx][4]); } /* 80305928-80305C70 300268 0348+00 5/5 0/0 0/0 .text setTevKColor__12J2DPictureExFUc */ void J2DPictureEx::setTevKColor(u8 param_0) { - // NONMATCHING + if (param_0 == 1) { + return; + } + + f32 fVar2 = 0.0f; + f32 fVar3 = 0.0f; + + if (param_0 < 2) { + for (u8 i = 0; i < param_0; i++) { + fVar2 += field_0x11c[i]; + fVar3 += field_0x124[i]; + } + } else { + for (u8 i = 0; i < 2; i++) { + fVar2 += field_0x11c[i]; + fVar3 += field_0x124[i]; + } + for (u8 i = 0; i < param_0 - 2; i++) { + fVar2 += field_0x160[i]; + fVar3 += field_0x178[i]; + } + } + + u8 local_3c[8]; + u8 local_44[8]; + + for (u8 i = 0; i < 8; i++) { + local_3c[i] = 0xff; + local_44[i] = 0xff; + } + + for (u8 i = 0; i < param_0; i++) { + if (i < 2) { + local_3c[i] = field_0x11c[i] * 0xff / fVar2; + local_44[i] = field_0x124[i] * 0xff / fVar3; + } else { + local_3c[i] = field_0x160[i - 2] * 0xff / fVar2; + local_44[i] = field_0x178[i - 2] * 0xff / fVar3; + } + } + + JUtility::TColor color[4]; + color[3] = local_3c[3] << 24 | local_3c[2] << 16 | local_3c[1] << 8 | local_3c[0]; + color[2] = local_3c[7] << 24 | local_3c[6] << 16 | local_3c[5] << 8 | local_3c[4]; + color[1] = local_44[3] << 24 | local_44[2] << 16 | local_44[1] << 8 | local_44[0]; + color[0] = local_44[7] << 24 | local_44[6] << 16 | local_44[5] << 8 | local_44[4]; + + for (u8 i = 0; i < 4; i++) { + mMaterial->getTevBlock()->setTevKColor(i, color[i]); + } } /* 80305C70-80305D18 3005B0 00A8+00 3/3 0/0 0/0 .text setTevKColorSel__12J2DPictureExFUc @@ -472,8 +887,35 @@ void J2DPictureEx::setBlendAlphaRatio(f32 param_0, f32 param_1) { /* 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 +// NONMATCHING small regalloc +const ResTIMG* J2DPictureEx::changeTexture(ResTIMG const* img, u8 param_1) { + if (mMaterial == NULL || img == NULL) { + return NULL; + } + + u32 tex_gen_num = mMaterial->getTexGenBlock()->getTexGenNum(); + if (param_1 > tex_gen_num) { + return NULL; + } + + u8 max_stage = mMaterial->getTevBlock()->getMaxStage(); + max_stage = max_stage > 8 ? 8 : max_stage; + if (param_1 >= max_stage) { + return NULL; + } + + if (param_1 < tex_gen_num) { + const ResTIMG* texinfo = getTexture(param_1)->getTexInfo(); + u8 uVar6 = 0; + if (img->indexTexture) { + uVar6 = getUsableTlut(param_1); + } + getTexture(param_1)->storeTIMG(img, uVar6); + return texinfo; + } else { + append(img, 1.0f); + return NULL; + } } /* 803060DC-80306134 300A1C 0058+00 1/0 0/0 0/0 .text changeTexture__12J2DPictureExFPCcUc @@ -485,7 +927,7 @@ const ResTIMG* J2DPictureEx::changeTexture(char const* param_0, u8 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. +// NONMATCHING Issues with param_1 >= bVar5. Maybe some inline min function. inline u8 mina(u8 a, u8 b) { return a > b ? b : a; } @@ -620,193 +1062,331 @@ bool J2DPictureEx::setBlackWhite(JUtility::TColor param_0, JUtility::TColor para /* 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 +// NONMATCHING regswap +bool J2DPictureEx::getBlackWhite(JUtility::TColor* black, JUtility::TColor* white) const { + if (mMaterial == NULL) { + return false; + } + + if (mMaterial->getTevBlock() == NULL) { + return false; + } + + u8 tex_gen_num = mMaterial->getTexGenBlock()->getTexGenNum(); + u32 tev_stage_num = mMaterial->getTevBlock()->getTevStageNum(); + bool bVar1; + if (tex_gen_num == 1) { + bVar1 = tev_stage_num != 1; + } else { + bVar1 = tev_stage_num != tex_gen_num + 1; + } + + *black = 0x00000000; + *white = 0xffffffff; + + if (bVar1) { + J2DGXColorS10 tevColor0 = *mMaterial->getTevBlock()->getTevColor(0); + J2DGXColorS10 tevColor1 = *mMaterial->getTevBlock()->getTevColor(1); + *black = (u8)tevColor0.r << 24 | (u8)tevColor0.g << 16 | (u8)tevColor0.b << 8 | (u8)tevColor0.a; + *white = (u8)tevColor1.r << 24 | (u8)tevColor1.g << 16 | (u8)tevColor1.b << 8 | (u8)tevColor1.a; + } + + return true; } /* 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 +// NONMATCHING missing clrlwi, regalloc +bool J2DPictureEx::isSetBlackWhite(JUtility::TColor black, JUtility::TColor white) const { + if (black == 0x00000000 && white == 0xffffffff) { + return true; + } + + u8 tex_gen_num = mMaterial->getTexGenBlock()->getTexGenNum(); + u32 tev_stage_num = mMaterial->getTevBlock()->getTevStageNum(); + u8 max_tev_stage = mMaterial->getTevBlock()->getMaxStage(); + + if (max_tev_stage == 16) { + return true; + } + + if (max_tev_stage == 1) { + return false; + } + + u8 tmp = tex_gen_num == 1 ? 2 : tex_gen_num + 2; + return max_tev_stage <= tmp; } /* 803068F8-80306958 301238 0060+00 1/0 0/0 0/0 .text getBlack__12J2DPictureExCFv */ JUtility::TColor J2DPictureEx::getBlack() const { - // NONMATCHING + JUtility::TColor black, white; + if (!getBlackWhite(&black, &white)) { + return 0x00000000; + } else { + return black; + } } /* 80306958-803069B8 301298 0060+00 1/0 0/0 0/0 .text getWhite__12J2DPictureExCFv */ JUtility::TColor J2DPictureEx::getWhite() const { - // NONMATCHING + JUtility::TColor black, white; + if (!getBlackWhite(&black, &white)) { + return 0xffffffff; + } else { + return white; + } } /* 803069B8-803069D8 3012F8 0020+00 1/0 0/0 0/0 .text setAlpha__12J2DPictureExFUc */ -void J2DPictureEx::setAlpha(u8 param_0) { - // NONMATCHING +void J2DPictureEx::setAlpha(u8 alpha) { + mAlpha = alpha; + if (mMaterial != NULL && mMaterial->getColorBlock()->getMatColor(0) != NULL) { + mMaterial->getColorBlock()->getMatColor(0)->a = alpha; + } } /* 803069D8-80306A0C 301318 0034+00 1/0 0/0 0/0 .text setCullBack__12J2DPictureExF11_GXCullMode */ -void J2DPictureEx::setCullBack(_GXCullMode param_0) { - // NONMATCHING +void J2DPictureEx::setCullBack(GXCullMode cullMode) { + mCullMode = cullMode; + if (mMaterial != NULL) { + mMaterial->getColorBlock()->setCullMode(cullMode); + } + J2DPane::setCullBack(cullMode); } /* 80306A0C-80306A24 30134C 0018+00 1/0 0/0 0/0 .text rewriteAlpha__12J2DPictureExFv */ void J2DPictureEx::rewriteAlpha() { - // NONMATCHING + if (mMaterial != NULL) { + mAlpha = mMaterial->getColorBlock()->getMatColor(0)->a; + } } /* 80306A24-80306AC4 301364 00A0+00 1/0 0/0 0/0 .text isUsed__12J2DPictureExFPC7ResTIMG */ -bool J2DPictureEx::isUsed(ResTIMG const* param_0) { - // NONMATCHING +bool J2DPictureEx::isUsed(ResTIMG const* texInfo) { + if (mMaterial != NULL && mMaterial->getTevBlock() != NULL) { + for (u32 i = 0; i < 8; i++) { + JUTTexture* texture = mMaterial->getTevBlock()->getTexture(i); + if (texture != NULL && texture->getTexInfo() == texInfo) { + return true; + } + } + } + return J2DPane::isUsed(texInfo); } /* 80306AC4-80306AF0 301404 002C+00 1/0 0/0 0/0 .text setAnimation__12J2DPictureExFP11J2DAnmColor */ -void J2DPictureEx::setAnimation(J2DAnmColor* param_0) { - // NONMATCHING +void J2DPictureEx::setAnimation(J2DAnmColor* anm) { + if (mMaterial != NULL) { + mMaterial->setAnimation(anm); + } } /* 80306AF0-80306B1C 301430 002C+00 1/0 0/0 0/0 .text * setAnimation__12J2DPictureExFP19J2DAnmTextureSRTKey */ -void J2DPictureEx::setAnimation(J2DAnmTextureSRTKey* param_0) { - // NONMATCHING +void J2DPictureEx::setAnimation(J2DAnmTextureSRTKey* anm) { + if (mMaterial != NULL) { + mMaterial->setAnimation(anm); + } } /* 80306B1C-80306B48 30145C 002C+00 1/0 0/0 0/0 .text * setAnimation__12J2DPictureExFP16J2DAnmTexPattern */ -void J2DPictureEx::setAnimation(J2DAnmTexPattern* param_0) { - // NONMATCHING +void J2DPictureEx::setAnimation(J2DAnmTexPattern* anm) { + if (mMaterial != NULL) { + mMaterial->setAnimation(anm); + } } /* 80306B48-80306B74 301488 002C+00 1/0 0/0 0/0 .text * setAnimation__12J2DPictureExFP15J2DAnmTevRegKey */ -void J2DPictureEx::setAnimation(J2DAnmTevRegKey* param_0) { - // NONMATCHING +void J2DPictureEx::setAnimation(J2DAnmTevRegKey* anm) { + if (mMaterial != NULL) { + mMaterial->setAnimation(anm); + } } /* 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); +void J2DPictureEx::setAnimation(J2DAnmVisibilityFull* anm) { + field_0x194 = anm; } /* 80306B7C-80306C70 3014BC 00F4+00 1/0 0/0 0/0 .text * setAnimation__12J2DPictureExFP14J2DAnmVtxColor */ -void J2DPictureEx::setAnimation(J2DAnmVtxColor* param_0) { - // NONMATCHING +// NONMATCHING regswap +void J2DPictureEx::setAnimation(J2DAnmVtxColor* anm) { + field_0x198 = anm; + field_0x19c = 0; + + if (anm != NULL) { + u16 anm_table_num = anm->getAnmTableNum(0); + for (u8 i = 0; i < 4; i++) { + if (field_0x158[i] != 0xffff) { + for (u16 j = 0; j < anm_table_num; j++) { + J3DAnmVtxColorIndexData* data = anm->getAnmVtxColorIndexData(0, j); + u16* index = anm->getVtxColorIndexPointer(0) + (u32)data->mpData; + for (u16 k = 0; k < data->mNum; k++) { + if (index[k] == field_0x158[i]) { + field_0x198 = anm; + field_0x19c |= 1 << i; + goto next; + } + } + } + } + next:; + } + } + + if (field_0x19c == 0) { + field_0x198 = NULL; + } } /* 80306C70-80306DC8 3015B0 0158+00 1/0 0/0 0/0 .text * animationPane__12J2DPictureExFPC15J2DAnmTransform */ -const J2DAnmTransform* J2DPictureEx::animationPane(J2DAnmTransform const* param_0) { - // NONMATCHING +const J2DAnmTransform* J2DPictureEx::animationPane(J2DAnmTransform const* anm) { + if (field_0x194 != NULL && field_0x154 != 0xffff) { + u8 tmp; + field_0x194->getVisibility(field_0x154, &tmp); + if (tmp != 0) { + show(); + } else { + hide(); + } + } + + if (field_0x198 != NULL) { + u16 anm_table_num = field_0x198->getAnmTableNum(0); + for (u8 i = 0; i < 4; i++) { + if (field_0x19c & (1 << i)) { + for (u16 j = 0; j < anm_table_num; j++) { + J3DAnmVtxColorIndexData* data = field_0x198->getAnmVtxColorIndexData(0, j); + u16* index = field_0x198->getVtxColorIndexPointer(0) + (u32)data->mpData; + for (u16 k = 0; k < data->mNum; k++) { + if (index[k] == field_0x158[i]) { + field_0x198->getColor(0, j, &mCornerColor[i]); + goto next; + } + } + } + } + next:; + } + } + + return J2DPane::animationPane(anm); } /* 80306DC8-80306ED4 301708 010C+00 1/0 0/0 0/0 .text getUsableTlut__12J2DPictureExFUc */ u8 J2DPictureEx::getUsableTlut(u8 param_0) { - // NONMATCHING + u32 tex_gen_num = mMaterial->getTexGenBlock()->getTexGenNum(); + u8 usedTluts = 0; + + for (u8 i = 0; i < tex_gen_num; i++) { + JUTTexture* texture = mMaterial->getTevBlock()->getTexture(i); + if (i != param_0 && texture != NULL) { + const ResTIMG* texInfo = texture->getTexInfo(); + if (texInfo != NULL && texInfo->indexTexture != 0) { + int tlut_name = texture->getTlutName(); + u8 tlut_index = tlut_name - (tlut_name >= GX_BIGTLUT0 ? GX_BIGTLUT0 : GX_TLUT0); + if (tlut_index < 8) { + usedTluts |= 1 << tlut_index; + } + } + } + } + + u8 i = 0; + for (; i < 8; i++) { + if (!(usedTluts & (1 << i))) { + return i; + } + } + return 0; } /* 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 + return append(param_0, NULL, param_1); } /* 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 + return append(param_0, NULL, param_1); } /* 80306F34-80306F64 301874 0030+00 1/0 0/0 0/0 .text prepend__12J2DPictureExFP10JUTTexturef */ void J2DPictureEx::prepend(JUTTexture* param_0, f32 param_1) { - // NONMATCHING + insert(param_0, 0, param_1); } /* 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 + insert(param_0, param_1, 0, param_2); } /* 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 + insert(param_0, 0, param_1); } /* 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 + insert(param_0, param_1, 0, param_2); } /* 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 + insert(param_0, 0, param_1); } /* 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 + return insert(param_0, NULL, param_1, param_2); } /* 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 +bool J2DPictureEx::insert(ResTIMG const* param_0, u8 param_1, f32 param_2) { + return insert(param_0, NULL, param_1, param_2); } /* 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 + return draw(param_0, param_1, 0, param_2, param_3, param_4); } /* 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 + 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)); } /* 80307134-80307168 301A74 0034+00 1/0 0/0 0/0 .text load__12J2DPictureExFUc */ void J2DPictureEx::load(u8 param_0) { - // NONMATCHING + load((GXTexMapID)param_0, param_0); } /* 80307168-803071A4 301AA8 003C+00 1/0 0/0 0/0 .text setCullBack__12J2DPictureExFb */ void J2DPictureEx::setCullBack(bool param_0) { - // NONMATCHING + setCullBack(param_0 ? GX_CULL_BACK : GX_CULL_NONE); } /* 803071A4-803071C4 301AE4 0020+00 1/0 0/0 0/0 .text isUsed__12J2DPictureExFPC7ResFONT */ bool J2DPictureEx::isUsed(ResFONT const* param_0) { - // NONMATCHING + return J2DPane::isUsed(param_0); } /* 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 -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 -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 + J2DPane::setAnimation(param_0); +} diff --git a/src/JSystem/J2DGraph/J2DScreen.cpp b/src/JSystem/J2DGraph/J2DScreen.cpp index 51772c610b..6772f6fe69 100644 --- a/src/JSystem/J2DGraph/J2DScreen.cpp +++ b/src/JSystem/J2DGraph/J2DScreen.cpp @@ -13,7 +13,6 @@ #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JSupport/JSUMemoryStream.h" #include "dolphin/types.h" -#include "global.h" /* 802F8498-802F8540 2F2DD8 00A8+00 0/0 59/59 4/4 .text __ct__9J2DScreenFv */ J2DScreen::J2DScreen() diff --git a/src/JSystem/J2DGraph/J2DWindowEx.cpp b/src/JSystem/J2DGraph/J2DWindowEx.cpp index 16e9f72dd3..7bf755fdd2 100644 --- a/src/JSystem/J2DGraph/J2DWindowEx.cpp +++ b/src/JSystem/J2DGraph/J2DWindowEx.cpp @@ -6,14 +6,6 @@ #include "JSystem/J2DGraph/J2DWindowEx.h" #include "JSystem/JUtility/JUTTexture.h" #include "JSystem/JSupport/JSURandomInputStream.h" -#include "dol2asm.h" - -/* ############################################################################################## */ -/* 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); struct J2DWindowExDef { u32 field_0x0[4]; @@ -93,7 +85,6 @@ J2DWindowEx::J2DWindowEx(J2DPane* param_0, JSURandomInputStream* param_1, u32 pa setMinSize(); } - /* 80300F80-80301144 2FB8C0 01C4+00 1/1 0/0 0/0 .text setMinSize__11J2DWindowExFv */ void J2DWindowEx::setMinSize() { field_0x140 = 1; @@ -112,8 +103,10 @@ void J2DWindowEx::setMinSize() { 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(); + 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 */ @@ -319,6 +312,10 @@ void J2DWindowEx::draw_private(JGeometry::TBox2<f32> const& param_0, } } +static f32 dummy_literal() { + return 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) { @@ -447,7 +444,6 @@ void J2DWindowEx::drawFrameTexture(f32 param_1, f32 param_2, f32 param_3, f32 pa } } - /* 80301FC8-80302164 2FC908 019C+00 1/0 0/0 0/0 .text draw__11J2DWindowExFRCQ29JGeometry8TBox2<f> */ void J2DWindowEx::draw(JGeometry::TBox2<f32> const& param_1) { @@ -476,7 +472,6 @@ void J2DWindowEx::draw(JGeometry::TBox2<f32> const& param_1) { 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) { @@ -499,7 +494,6 @@ void J2DWindowEx::draw(JGeometry::TBox2<f32> const& param_1, JGeometry::TBox2<f3 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]; @@ -551,6 +545,48 @@ void J2DWindowEx::setTevStage(bool param_1) { } } +/* 803A1C70-803A1C80 02E2D0 0010+00 0/0 0/0 0/0 .rodata @1557 */ +static u8 const lit_1557[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* 803A1C80-803A1C90 02E2E0 0010+00 0/0 0/0 0/0 .rodata @1566 */ +static u8 const lit_1566[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* 803A1C90-803A1CA0 02E2F0 0010+00 0/0 0/0 0/0 .rodata @1575 */ +static u8 const lit_1575[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + + +/* 803A1CA0-803A1CB0 02E300 0010+00 0/0 0/0 0/0 .rodata @1581 */ +static u8 const lit_1581[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + + +/* 803A1CB0-803A1CC0 02E310 0010+00 0/0 0/0 0/0 .rodata @1587 */ +static u8 const lit_1587[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* 803A1CC0-803A1CD0 02E320 0010+00 0/0 0/0 0/0 .rodata @1596 */ +static u8 const lit_1596[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* 803A1CD0-803A1CE0 02E330 0010+00 0/0 0/0 0/0 .rodata @1605 */ +static u8 const lit_1605[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* 803A1CE0-803A1CF0 02E340 0010+00 0/0 0/0 0/0 .rodata @1612 */ +static u8 const lit_1612[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + /* 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) { @@ -563,8 +599,8 @@ void J2DWindowEx::setStage(J2DTevStage* param_0, J2DWindowEx::stage_enum param_1 {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}, + {0, 0, 0, 1, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 1, 0}, + {0, 0, 0, 1, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 1, 0}, }; param_0->setTevColorAB(local_30[param_1][0], local_30[param_1][1]); @@ -677,8 +713,10 @@ bool J2DWindowEx::getBlackWhite(JUtility::TColor* param_0, JUtility::TColor* par 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))); + *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; } @@ -901,140 +939,6 @@ void J2DWindowEx::setAnimation(J2DAnmVtxColor* param_0) { } } -/* ############################################################################################## */ -/* 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) { |
