diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2021-08-28 07:25:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-28 16:25:03 +0200 |
| commit | daf45f768d9ae091a97dce1be8d048ac2b7bd54c (patch) | |
| tree | 138798649ad35cb95ff5a0dd49bc7884ed6cdff0 /libs | |
| parent | e14b04c54a40e95f0117df44f1186f2d44799ac7 (diff) | |
move J2D / JUTResFont (#144)
* move some JSystem and meter2_info stuff
* more J2D / JUTTexture / JUTPalette
* setup dScnKy_env_light_c
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/JSystem/J2DGraph/J2DAnimation.cpp | 75 | ||||
| -rw-r--r-- | libs/JSystem/J2DGraph/J2DGrafContext.cpp | 40 | ||||
| -rw-r--r-- | libs/JSystem/J2DGraph/J2DManage.cpp | 18 | ||||
| -rw-r--r-- | libs/JSystem/J2DGraph/J2DMaterial.cpp | 41 | ||||
| -rw-r--r-- | libs/JSystem/J2DGraph/J2DPane.cpp | 669 | ||||
| -rw-r--r-- | libs/JSystem/J2DGraph/J2DPicture.cpp | 568 | ||||
| -rw-r--r-- | libs/JSystem/J2DGraph/J2DScreen.cpp | 280 | ||||
| -rw-r--r-- | libs/JSystem/J2DGraph/J2DTextBox.cpp | 280 | ||||
| -rw-r--r-- | libs/JSystem/JAudio2/JAISoundInfo.cpp | 9 | ||||
| -rw-r--r-- | libs/JSystem/JAudio2/JASAudioReseter.cpp | 10 | ||||
| -rw-r--r-- | libs/JSystem/JUtility/JUTFont.cpp | 8 | ||||
| -rw-r--r-- | libs/JSystem/JUtility/JUTPalette.cpp | 114 | ||||
| -rw-r--r-- | libs/JSystem/JUtility/JUTResFont.cpp | 313 | ||||
| -rw-r--r-- | libs/JSystem/JUtility/JUTTexture.cpp | 181 | ||||
| -rw-r--r-- | libs/Z2AudioLib/Z2AudioMgr.cpp | 11 | ||||
| -rw-r--r-- | libs/Z2AudioLib/Z2EnvSeMgr.cpp | 40 |
16 files changed, 969 insertions, 1688 deletions
diff --git a/libs/JSystem/J2DGraph/J2DAnimation.cpp b/libs/JSystem/J2DGraph/J2DAnimation.cpp index 887497e5e2..d1d2613923 100644 --- a/libs/JSystem/J2DGraph/J2DAnimation.cpp +++ b/libs/JSystem/J2DGraph/J2DAnimation.cpp @@ -15,10 +15,6 @@ struct _GXTlutFmt {}; struct _GXTlut {}; -struct _GXColorS10 {}; - -struct _GXColor {}; - struct JUTTransparency {}; struct JKRArchive {}; @@ -55,77 +51,6 @@ struct J2DDataManage { /* 8030CE18 */ void get(char const*); }; -struct J2DAnmVtxColorKey { - /* 8030B704 */ void getColor(u8, u16, _GXColor*) const; - /* 8030CC20 */ ~J2DAnmVtxColorKey(); -}; - -struct J2DAnmVtxColorFull { - /* 8030B4C4 */ void getColor(u8, u16, _GXColor*) const; - /* 8030CC8C */ ~J2DAnmVtxColorFull(); -}; - -struct J2DAnmVisibilityFull { - /* 8030C048 */ void getVisibility(u16, u8*) const; -}; - -struct J2DAnmTransformKey { - /* 801959C0 */ ~J2DAnmTransformKey(); - /* 8030AAFC */ void calcTransform(f32, u16, J3DTransformInfo*) const; - /* 8030CD7C */ void getTransform(u16, J3DTransformInfo*) const; -}; - -struct J2DAnmTransformFull { - /* 8030A590 */ void getTransform(u16, J3DTransformInfo*) const; - /* 8030CDAC */ ~J2DAnmTransformFull(); -}; - -struct J2DAnmTextureSRTKey { - /* 80184274 */ ~J2DAnmTextureSRTKey(); - /* 8030B9F0 */ void calcTransform(f32, u16, J3DTextureSRTInfo*) const; - /* 8030BC60 */ void searchUpdateMaterialID(J2DScreen*); -}; - -struct J2DAnmTexPattern { - struct J2DAnmTexPatternTIMGPointer { - /* 8030CB2C */ J2DAnmTexPatternTIMGPointer(); - /* 8030CB3C */ ~J2DAnmTexPatternTIMGPointer(); - }; - - /* 8030BD10 */ void searchUpdateMaterialID(J2DScreen*); - /* 8030BEE8 */ void getTexNo(u16, u16*) const; - /* 8030BF9C */ void getResTIMG(u16) const; - /* 8030BFF0 */ void getPalette(u16) const; - /* 8030CB90 */ ~J2DAnmTexPattern(); -}; - -struct J2DAnmTevRegKey { - /* 801841EC */ ~J2DAnmTevRegKey(); - /* 8030C0F0 */ void getTevColorReg(u16, _GXColorS10*) const; - /* 8030C3B4 */ void getTevKonstReg(u16, _GXColor*) const; - /* 8030C678 */ void searchUpdateMaterialID(J2DScreen*); -}; - -struct J2DAnmColorKey { - /* 80239BE0 */ ~J2DAnmColorKey(); - /* 8030B200 */ void getColor(u16, _GXColor*) const; -}; - -struct J2DAnmColorFull { - /* 8030AFC8 */ void getColor(u16, _GXColor*) const; - /* 8030CCF8 */ ~J2DAnmColorFull(); -}; - -struct J2DAnmColor { - /* 801842FC */ ~J2DAnmColor(); - /* 802EB390 */ void getColor(u16, _GXColor*) const; - /* 8030AF24 */ void searchUpdateMaterialID(J2DScreen*); -}; - -struct J2DAnmBase { - /* 800569B0 */ void searchUpdateMaterialID(J2DScreen*); -}; - // // Forward References: // diff --git a/libs/JSystem/J2DGraph/J2DGrafContext.cpp b/libs/JSystem/J2DGraph/J2DGrafContext.cpp index cf29efd972..0d7f12952a 100644 --- a/libs/JSystem/J2DGraph/J2DGrafContext.cpp +++ b/libs/JSystem/J2DGraph/J2DGrafContext.cpp @@ -8,46 +8,6 @@ #include "dolphin/types.h" // -// Types: -// - -struct JUtility { - struct TColor {}; -}; - -struct JGeometry { - template <typename A1> - struct TBox2 {}; - /* TBox2<f32> */ - struct TBox2__template0 {}; - - template <typename A1> - struct TVec2 {}; - /* TVec2<f32> */ - struct TVec2__template1 {}; -}; - -struct J2DGrafContext { - /* 802E8B08 */ J2DGrafContext(f32, f32, f32, f32); - /* 802E8BB4 */ void setPort(); - /* 802E8C44 */ void setup2D(); - /* 802E8E20 */ void setScissor(); - /* 802E90C0 */ void scissor(JGeometry::TBox2<f32> const&); - /* 802E90E4 */ void place(JGeometry::TBox2<f32> const&); - /* 802E961C */ void place(f32, f32, f32, f32); - /* 802E9118 */ void setColor(JUtility::TColor, JUtility::TColor, JUtility::TColor, - JUtility::TColor); - /* 802E9234 */ void setLineWidth(u8); - /* 802E9260 */ void fillBox(JGeometry::TBox2<f32> const&); - /* 802E9368 */ void drawFrame(JGeometry::TBox2<f32> const&); - /* 802E9488 */ void line(JGeometry::TVec2<f32>, JGeometry::TVec2<f32>); - /* 802E9564 */ void lineTo(JGeometry::TVec2<f32>); - /* 802E95D4 */ ~J2DGrafContext(); - /* 802E9664 */ bool getGrafType() const; - /* 802E966C */ void setLookat(); -}; - -// // Forward References: // diff --git a/libs/JSystem/J2DGraph/J2DManage.cpp b/libs/JSystem/J2DGraph/J2DManage.cpp index c261a7986e..fa9b518c61 100644 --- a/libs/JSystem/J2DGraph/J2DManage.cpp +++ b/libs/JSystem/J2DGraph/J2DManage.cpp @@ -8,24 +8,6 @@ #include "dolphin/types.h" // -// Types: -// - -struct JSUInputStream { - /* 802DC298 */ void read(void*, s32); -}; - -struct J2DResReference { - /* 8030CF10 */ void getResReference(u16) const; - /* 8030CF44 */ void getName(u16) const; -}; - -struct J2DDataManage { - /* 8030CE18 */ void get(char const*); - /* 8030CE7C */ void get(JSUInputStream*); -}; - -// // Forward References: // diff --git a/libs/JSystem/J2DGraph/J2DMaterial.cpp b/libs/JSystem/J2DGraph/J2DMaterial.cpp index 2ea0b7aa3d..def8304ad0 100644 --- a/libs/JSystem/J2DGraph/J2DMaterial.cpp +++ b/libs/JSystem/J2DGraph/J2DMaterial.cpp @@ -13,10 +13,6 @@ struct _GXTlut {}; -struct _GXColorS10 {}; - -struct _GXColor {}; - struct ResTIMG {}; struct JUtility { @@ -82,43 +78,6 @@ struct J2DPEBlock { /* 802F1840 */ void setGX(); }; -struct J2DAnmTexPattern { - /* 8030BEE8 */ void getTexNo(u16, u16*) const; - /* 8030BF9C */ void getResTIMG(u16) const; - /* 8030BFF0 */ void getPalette(u16) const; -}; - -struct J2DAnmTevRegKey { - /* 8030C0F0 */ void getTevColorReg(u16, _GXColorS10*) const; - /* 8030C3B4 */ void getTevKonstReg(u16, _GXColor*) const; -}; - -struct J2DAnmTextureSRTKey { - /* 8030B9F0 */ void calcTransform(f32, u16, J3DTextureSRTInfo*) const; -}; - -struct J2DAnmColor { - /* 802EB390 */ void getColor(u16, _GXColor*) const; -}; - -struct J2DMaterial { - struct J2DMaterialAnmPointer { - /* 802EA79C */ J2DMaterialAnmPointer(); - }; - - /* 802EA1AC */ J2DMaterial(); - /* 802EA2CC */ ~J2DMaterial(); - /* 802EA38C */ void setGX(); - /* 802EA410 */ void createTevBlock(int, bool); - /* 802EA5C4 */ void createIndBlock(int, bool); - /* 802EA84C */ void makeAnmPointer(); - /* 802EA94C */ void setAnimation(J2DAnmTextureSRTKey*); - /* 802EAA2C */ void setAnimation(J2DAnmTexPattern*); - /* 802EAB0C */ void setAnimation(J2DAnmTevRegKey*); - /* 802EA89C */ void setAnimation(J2DAnmColor*); - /* 802EAC78 */ void animation(); -}; - struct J2DIndTexOrder { /* 802EB378 */ J2DIndTexOrder(); }; diff --git a/libs/JSystem/J2DGraph/J2DPane.cpp b/libs/JSystem/J2DGraph/J2DPane.cpp index 418be8b670..c866eeae07 100644 --- a/libs/JSystem/J2DGraph/J2DPane.cpp +++ b/libs/JSystem/J2DGraph/J2DPane.cpp @@ -11,145 +11,10 @@ // Types: // -struct _GXCullMode {}; - -struct ResTIMG {}; - -struct ResFONT {}; - -struct JSUInputStream { - /* 802DC298 */ void read(void*, s32); -}; - -struct JKRArchive {}; - struct JUTResReference { /* 802DE078 */ void getResource(JSUInputStream*, u32, JKRArchive*); }; -struct JSUStreamSeekFrom {}; - -struct JSURandomInputStream { - /* 802DC370 */ void align(s32); - /* 802DC458 */ void peek(void*, s32); - /* 802DC4DC */ void seek(s32, JSUStreamSeekFrom); -}; - -struct JSUPtrLink { - /* 802DBDFC */ JSUPtrLink(void*); - /* 802DBE14 */ ~JSUPtrLink(); -}; - -struct JSUPtrList { - /* 802DBEAC */ ~JSUPtrList(); - /* 802DBF14 */ void initiate(); - /* 802DBF4C */ void append(JSUPtrLink*); - /* 802DC094 */ void insert(JSUPtrLink*, JSUPtrLink*); -}; - -struct JGeometry { - template <typename A1> - struct TBox2 {}; - /* TBox2<f32> */ - struct TBox2__template0 {}; -}; - -struct J2DScreen { - static u8 mDataManage[4 + 4 /* padding */]; -}; - -struct J2DRotateAxis {}; - -struct J2DAnmVisibilityFull {}; - -struct J2DAnmBase {}; - -struct J2DAnmTexPattern {}; - -struct J2DAnmColor {}; - -struct J2DAnmTevRegKey {}; - -struct J2DGrafContext { - /* 802E8E20 */ void setScissor(); - /* 802E90C0 */ void scissor(JGeometry::TBox2<f32> const&); -}; - -struct J2DBasePosition {}; - -struct J2DAnmTextureSRTKey {}; - -struct J2DAnmVtxColor {}; - -struct J2DAnmTransform {}; - -struct J2DPane { - /* 80053BC0 */ void calcMtx(); - /* 80053C00 */ void makeMatrix(f32, f32); - /* 802F7540 */ void makeMatrix(f32, f32, f32, f32); - /* 80053C3C */ s32 getTypeID() const; - /* 80256018 */ void setAnimation(J2DAnmVtxColor*); - /* 8025601C */ void setAnimation(J2DAnmVisibilityFull*); - /* 80256020 */ void setAnimation(J2DAnmTexPattern*); - /* 8018BF28 */ void setAnimation(J2DAnmTextureSRTKey*); - /* 802F7FC4 */ void setAnimation(J2DAnmTransform*); - /* 80126350 */ void setAnimation(J2DAnmTevRegKey*); - /* 80126354 */ void setAnimation(J2DAnmColor*); - /* 802F7EF4 */ void setAnimation(J2DAnmBase*); - /* 802F5E88 */ J2DPane(u64, JGeometry::TBox2<f32> const&); - /* 802F5F9C */ J2DPane(J2DPane*, JSURandomInputStream*, u8); - /* 802F5BF8 */ J2DPane(); - /* 802F5D40 */ J2DPane(J2DPane*, bool, u64, JGeometry::TBox2<f32> const&); - /* 802F5CB8 */ void initiate(); - /* 802F5F08 */ void initialize(u64, JGeometry::TBox2<f32> const&); - /* 802F5DD0 */ void initialize(J2DPane*, bool, u64, JGeometry::TBox2<f32> const&); - /* 802F60C4 */ void makePaneStream(J2DPane*, JSURandomInputStream*); - /* 802F63F8 */ void changeUseTrans(J2DPane*); - /* 802F658C */ ~J2DPane(); - /* 802F666C */ void appendChild(J2DPane*); - /* 802F6714 */ void insertChild(J2DPane*, J2DPane*); - /* 802F67E0 */ void draw(f32, f32, J2DGrafContext const*, bool, bool); - /* 802F6D18 */ void place(JGeometry::TBox2<f32> const&); - /* 802F6F60 */ void move(f32, f32); - /* 802F6FB4 */ void add(f32, f32); - /* 802F6FF8 */ void resize(f32, f32); - /* 802F7100 */ void getBounds(); - /* 802F720C */ void rotate(f32); - /* 802F71DC */ void rotate(f32, f32, J2DRotateAxis, f32); - /* 802F7264 */ void clip(JGeometry::TBox2<f32> const&); - /* 802F72E0 */ void search(u64); - /* 802F7388 */ void searchUserInfo(u64); - /* 802F7430 */ void isUsed(ResTIMG const*); - /* 802F74B8 */ void isUsed(ResFONT const*); - /* 802F7680 */ void setCullBack(_GXCullMode); - /* 802F8428 */ void setCullBack(bool); - /* 802F76F8 */ void setBasePosition(J2DBasePosition); - /* 802F77D0 */ void setInfluencedAlpha(bool, bool); - /* 802F79A8 */ void getGlbVtx(u8) const; - /* 802F7A8C */ void getFirstChildPane(); - /* 802F7AC4 */ void getNextChildPane(); - /* 802F7AFC */ void getParentPane(); - /* 802F7B18 */ void makePaneExStream(J2DPane*, JSURandomInputStream*); - /* 802F7D00 */ void J2DCast_F32_to_S16(f32, u8); - /* 802F7DB8 */ void getPointer(JSURandomInputStream*, u32, JKRArchive*); - /* 802F8080 */ void animationTransform(J2DAnmTransform const*); - /* 802F7FCC */ void animationTransform(); - /* 802F8004 */ void clearAnmTransform(); - /* 802F8118 */ void setVisibileAnimation(J2DAnmVisibilityFull*); - /* 802F81A0 */ void setVtxColorAnimation(J2DAnmVtxColor*); - /* 802F8228 */ void animationPane(J2DAnmTransform const*); - /* 802F82C0 */ void updateTransform(J2DAnmTransform const*); - /* 802F83C8 */ void drawSelf(f32, f32, f32 (*)[3][4]); - /* 802F8478 */ void drawSelf(f32, f32); - /* 802F83CC */ void rewriteAlpha(); - /* 802F83D0 */ void setAnimationVF(J2DAnmVisibilityFull*); - /* 802F83FC */ void setAnimationVC(J2DAnmVtxColor*); - /* 802F8464 */ void setConnectParent(bool); - /* 802F8474 */ void update(); - - static f32 static_mBounds[4]; -}; - struct J2DOrthoGraph { /* 802E987C */ void scissorBounds(JGeometry::TBox2<f32>*, JGeometry::TBox2<f32> const*); }; @@ -248,12 +113,6 @@ extern "C" void setScissor__14J2DGrafContextFv(); extern "C" void func_802E90C0(); extern "C" void func_802E987C(); extern "C" void get__13J2DDataManageFP14JSUInputStream(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXConcat(); -extern "C" void PSMTXRotRad(); -extern "C" void PSMTXTrans(); -extern "C" void PSMTXTransApply(); -extern "C" void PSMTXScaleApply(); extern "C" void GXSetCullMode(); extern "C" void _savegpr_25(); extern "C" void _savegpr_27(); @@ -335,28 +194,38 @@ SECTION_SDATA2 static u8 lit_1469[4] = { }; /* 802F5BF8-802F5CB8 2F0538 00C0+00 0/0 10/10 0/0 .text __ct__7J2DPaneFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm J2DPane::J2DPane() { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/__ct__7J2DPaneFv.s" +J2DPane::J2DPane() : mBounds(), mGlobalBounds(), mClipRect(), mPaneTree(this) { + mTransform = NULL; + id = 'PAN1'; + mVisible = true; + mInfoTag = 0; + mUserInfoTag = 0; + mBounds.set(FLOAT_LABEL(lit_1469), FLOAT_LABEL(lit_1469), FLOAT_LABEL(lit_1469), + FLOAT_LABEL(lit_1469)); + initiate(); + changeUseTrans(NULL); + calcMtx(); } -#pragma pop /* ############################################################################################## */ /* 804561F4-804561F8 0047F4 0004+00 3/3 0/0 0/0 .sdata2 @1489 */ SECTION_SDATA2 static f32 lit_1489 = 1.0f; /* 802F5CB8-802F5D40 2F05F8 0088+00 3/3 0/0 0/0 .text initiate__7J2DPaneFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::initiate() { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/initiate__7J2DPaneFv.s" +void J2DPane::initiate() { + _4 = -1; + mRotateOffsetY = mRotateOffsetX = mRotateZ = mRotateY = mRotateX = FLOAT_LABEL(lit_1469); + mBasePosition = 0; + mRotAxis = ROTATE_Z; + mScaleY = mScaleX = lit_1489; + mCullMode = GX_CULL_NONE; + mAlpha = 0xFF; + mIsInfluencedAlpha = true; + mColorAlpha = 0xFF; + mConnected = false; + + calcMtx(); } -#pragma pop /* 802F5D40-802F5DD0 2F0680 0090+00 0/0 1/1 0/0 .text * __ct__7J2DPaneFP7J2DPanebUxRCQ29JGeometry8TBox2<f> */ @@ -394,6 +263,18 @@ asm J2DPane::J2DPane(u64 param_0, JGeometry::TBox2<f32> const& param_1) { /* 802F5F08-802F5F9C 2F0848 0094+00 1/1 0/0 0/0 .text * initialize__7J2DPaneFUxRCQ29JGeometry8TBox2<f> */ +#ifdef NONMATCHING // templating..... again +void J2DPane::initialize(u64 tag, const TBox2<f32>& dim) { + id = 'PAN1'; + mVisible = true; + mInfoTag = tag; + mUserInfoTag = tag; + mBounds.set(dim); + initiate(); + changeUseTrans(NULL); + calcMtx(); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -402,6 +283,7 @@ asm void J2DPane::initialize(u64 param_0, JGeometry::TBox2<f32> const& param_1) #include "asm/JSystem/J2DGraph/J2DPane/func_802F5F08.s" } #pragma pop +#endif /* 802F5F9C-802F60C4 2F08DC 0128+00 0/0 1/1 0/0 .text * __ct__7J2DPaneFP7J2DPaneP20JSURandomInputStreamUc */ @@ -451,31 +333,56 @@ asm void J2DPane::changeUseTrans(J2DPane* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm J2DPane::~J2DPane() { +// asm J2DPane::~J2DPane() { +extern "C" asm void __dt__7J2DPaneFv() { nofralloc #include "asm/JSystem/J2DGraph/J2DPane/__dt__7J2DPaneFv.s" } #pragma pop /* 802F666C-802F6714 2F0FAC 00A8+00 0/0 2/2 0/0 .text appendChild__7J2DPaneFP7J2DPane */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::appendChild(J2DPane* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/appendChild__7J2DPaneFP7J2DPane.s" +bool J2DPane::appendChild(J2DPane* pChild) { + if (pChild == NULL) + return false; + + const J2DPane* parent = pChild->getParentPane(); + bool result = mPaneTree.appendChild(&pChild->mPaneTree); + + if (result && parent == NULL) { + pChild->add(mBounds.i.x, mBounds.i.y); + pChild->calcMtx(); + } + + return result; } -#pragma pop /* 802F6714-802F67E0 2F1054 00CC+00 0/0 1/1 0/0 .text insertChild__7J2DPaneFP7J2DPaneP7J2DPane */ +#ifdef NONMATCHING +bool J2DPane::insertChild(J2DPane* before, J2DPane* child) { + if (child == NULL) + return false; + + const J2DPane* parent = child->getParentPane(); + + bool result = mPaneTree.insertChild(&before->mPaneTree, &child->mPaneTree); + + if (result && parent == NULL) { + child->add(mBounds.i.x, mBounds.i.y); + child->calcMtx(); + } + + return result; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DPane::insertChild(J2DPane* param_0, J2DPane* param_1) { +asm bool J2DPane::insertChild(J2DPane* param_0, J2DPane* param_1) { nofralloc #include "asm/JSystem/J2DGraph/J2DPane/insertChild__7J2DPaneFP7J2DPaneP7J2DPane.s" } #pragma pop +#endif /* 802F67E0-802F6D18 2F1120 0538+00 0/0 1/1 0/0 .text draw__7J2DPaneFffPC14J2DGrafContextbb */ #pragma push @@ -499,6 +406,11 @@ asm void J2DPane::place(JGeometry::TBox2<f32> const& param_0) { #pragma pop /* 802F6F60-802F6FB4 2F18A0 0054+00 1/0 7/0 0/0 .text move__7J2DPaneFff */ +#ifdef NONMATCHING +void J2DPane::move(f32 x, f32 y) { + place(TBox2<f32>(x, y, x + getWidth(), y + getHeight())); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -507,18 +419,32 @@ asm void J2DPane::move(f32 param_0, f32 param_1) { #include "asm/JSystem/J2DGraph/J2DPane/move__7J2DPaneFff.s" } #pragma pop +#endif /* 802F6FB4-802F6FF8 2F18F4 0044+00 1/0 7/0 0/0 .text add__7J2DPaneFff */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::add(f32 param_0, f32 param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/add__7J2DPaneFff.s" +void J2DPane::add(f32 x, f32 y) { + mTranslateX += x; + mTranslateY += y; + calcMtx(); } -#pragma pop /* 802F6FF8-802F7100 2F1938 0108+00 1/0 5/2 0/0 .text resize__7J2DPaneFff */ +#ifdef NONMATCHING +void J2DPane::resize(f32 x, f32 y) { + TBox2<f32> box = mBounds; + + box.addPos(TVec2<f32>(mTranslateX, mTranslateY)); + + const J2DPane* parent = getParentPane(); + if (parent != NULL) { + box.addPos(TVec2<f32>(-parent->mBounds.i.x, -parent->mBounds.i.y)); + } + + box.f.x = box.i.x + x; + box.f.y = box.i.y + y; + place(box); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -527,40 +453,56 @@ asm void J2DPane::resize(f32 param_0, f32 param_1) { #include "asm/JSystem/J2DGraph/J2DPane/resize__7J2DPaneFff.s" } #pragma pop +#endif /* ############################################################################################## */ /* 804349B0-804349C0 0616D0 0010+00 2/2 0/0 0/0 .bss static_mBounds__7J2DPane */ f32 J2DPane::static_mBounds[4]; /* 802F7100-802F71DC 2F1A40 00DC+00 0/0 25/25 1/1 .text getBounds__7J2DPaneFv */ +#ifdef NONMATCHING // close ish +TBox2<f32>& J2DPane::getBounds() { + lbl_804349B0 = mBounds; + lbl_804349B0.addPos(TVec2<f32>(mTranslateX, mTranslateY)); + + const J2DPane* parent = getParentPane(); + if (parent != NULL) { + lbl_804349B0.addPos(TVec2<f32>(-parent->mBounds.i.x, -parent->mBounds.i.y)); + } + + return lbl_804349B0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DPane::getBounds() { +asm JGeometry::TBox2<f32>& J2DPane::getBounds() { nofralloc #include "asm/JSystem/J2DGraph/J2DPane/getBounds__7J2DPaneFv.s" } #pragma pop +#endif /* 802F71DC-802F720C 2F1B1C 0030+00 0/0 12/12 0/0 .text rotate__7J2DPaneFff13J2DRotateAxisf */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::rotate(f32 param_0, f32 param_1, J2DRotateAxis param_2, f32 param_3) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/rotate__7J2DPaneFff13J2DRotateAxisf.s" +void J2DPane::rotate(f32 offsetX, f32 offsetY, J2DRotateAxis axis, f32 angle) { + mRotateOffsetX = offsetX; + mRotateOffsetY = offsetY; + mRotAxis = axis; + rotate(angle); } -#pragma pop /* 802F720C-802F7264 2F1B4C 0058+00 1/1 0/0 0/0 .text rotate__7J2DPaneFf */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::rotate(f32 param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/rotate__7J2DPaneFf.s" +void J2DPane::rotate(f32 angle) { + if (mRotAxis == ROTATE_X) { + mRotateX = angle; + } else if (mRotAxis == ROTATE_Y) { + mRotateY = angle; + } else { + mRotateZ = angle; + } + + calcMtx(); } -#pragma pop /* 802F7264-802F72E0 2F1BA4 007C+00 0/0 2/2 0/0 .text clip__7J2DPaneFRCQ29JGeometry8TBox2<f> */ #pragma push @@ -573,44 +515,54 @@ asm void J2DPane::clip(JGeometry::TBox2<f32> const& param_0) { #pragma pop /* 802F72E0-802F7388 2F1C20 00A8+00 1/0 7/1 0/0 .text search__7J2DPaneFUx */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::search(u64 param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/search__7J2DPaneFUx.s" +const J2DPane* J2DPane::search(u64 tag) { + if (tag == mInfoTag) { + return this; + } + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + if (const J2DPane* result = iter.getObject()->search(tag)) { + return result; + } + } + return NULL; } -#pragma pop /* 802F7388-802F7430 2F1CC8 00A8+00 1/0 7/1 0/0 .text searchUserInfo__7J2DPaneFUx */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::searchUserInfo(u64 param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/searchUserInfo__7J2DPaneFUx.s" +const J2DPane* J2DPane::searchUserInfo(u64 tag) { + if (tag == mUserInfoTag) { + return this; + } + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + if (const J2DPane* result = iter.getObject()->searchUserInfo(tag)) { + return result; + } + } + return NULL; } -#pragma pop /* 802F7430-802F74B8 2F1D70 0088+00 1/0 7/7 0/0 .text isUsed__7J2DPaneFPC7ResTIMG */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::isUsed(ResTIMG const* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/isUsed__7J2DPaneFPC7ResTIMG.s" +bool J2DPane::isUsed(const ResTIMG* timg) { + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + if (iter.getObject()->isUsed(timg)) + return true; + } + return false; } -#pragma pop /* 802F74B8-802F7540 2F1DF8 0088+00 1/0 7/7 0/0 .text isUsed__7J2DPaneFPC7ResFONT */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::isUsed(ResFONT const* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/isUsed__7J2DPaneFPC7ResFONT.s" +bool J2DPane::isUsed(const ResFONT* font) { + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + if (iter.getObject()->isUsed(font)) + return true; + } + return false; } -#pragma pop /* ############################################################################################## */ /* 8045620C-80456210 00480C 0004+00 1/1 0/0 0/0 .sdata2 @2466 */ @@ -628,25 +580,42 @@ asm void J2DPane::makeMatrix(f32 param_0, f32 param_1, f32 param_2, f32 param_3) /* 802F7680-802F76F8 2F1FC0 0078+00 1/0 7/3 0/0 .text setCullBack__7J2DPaneF11_GXCullMode */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::setCullBack(_GXCullMode param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/setCullBack__7J2DPaneF11_GXCullMode.s" +void J2DPane::setCullBack(_GXCullMode mode) { + mCullMode = mode; + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + iter.getObject()->setCullBack(mode); + } } -#pragma pop /* 802F76F8-802F77D0 2F2038 00D8+00 0/0 8/8 0/0 .text setBasePosition__7J2DPaneF15J2DBasePosition */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::setBasePosition(J2DBasePosition param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/setBasePosition__7J2DPaneF15J2DBasePosition.s" +void J2DPane::setBasePosition(J2DBasePosition position) { + mBasePosition = position; + mRotAxis = ROTATE_Z; + + mRotateOffsetX = FLOAT_LABEL(lit_1469); + + if (position % 3 == 1) { + f32 width = getWidth(); + mRotateOffsetX = width * lit_1725; + } else if (position % 3 == 2) { + f32 width = getWidth(); + mRotateOffsetX = width; + } + + mRotateOffsetY = FLOAT_LABEL(lit_1469); + if (position / 3 == 1) { + f32 height = getHeight(); + mRotateOffsetY = height * lit_1725; + } else if (position / 3 == 2) { + f32 height = getHeight(); + mRotateOffsetY = height; + } + + calcMtx(); } -#pragma pop /* ############################################################################################## */ /* 80456210-80456214 004810 0004+00 1/1 0/0 0/0 .sdata2 @2547 */ @@ -673,34 +642,39 @@ asm void J2DPane::getGlbVtx(u8 param_0) const { #pragma pop /* 802F7A8C-802F7AC4 2F23CC 0038+00 1/1 15/15 0/0 .text getFirstChildPane__7J2DPaneFv */ +#ifdef NONMATCHING // probably an issue with JSUTree +const J2DPane* J2DPane::getFirstChildPane() { + if (!getFirstChild()) + return NULL; + + return getFirstChild()->getObject(); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DPane::getFirstChildPane() { +asm const J2DPane* J2DPane::getFirstChildPane() { nofralloc #include "asm/JSystem/J2DGraph/J2DPane/getFirstChildPane__7J2DPaneFv.s" } #pragma pop +#endif /* 802F7AC4-802F7AFC 2F2404 0038+00 1/1 8/8 0/0 .text getNextChildPane__7J2DPaneFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::getNextChildPane() { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/getNextChildPane__7J2DPaneFv.s" +const J2DPane* J2DPane::getNextChildPane() { + if (getPaneTree()->getNextChild() == NULL) + return NULL; + + return getPaneTree()->getNextChild()->getObject(); } -#pragma pop /* 802F7AFC-802F7B18 2F243C 001C+00 6/6 11/11 0/0 .text getParentPane__7J2DPaneFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::getParentPane() { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/getParentPane__7J2DPaneFv.s" +const J2DPane* J2DPane::getParentPane() { + if (getPaneTree()->getParent() == NULL) + return NULL; + + return getPaneTree()->getParent()->getObject(); } -#pragma pop /* 802F7B18-802F7D00 2F2458 01E8+00 1/1 6/6 0/0 .text * makePaneExStream__7J2DPaneFP7J2DPaneP20JSURandomInputStream */ @@ -714,27 +688,92 @@ asm void J2DPane::makePaneExStream(J2DPane* param_0, JSURandomInputStream* param #pragma pop /* 802F7D00-802F7DB8 2F2640 00B8+00 0/0 1/1 0/0 .text J2DCast_F32_to_S16__7J2DPaneFfUc */ +#ifdef NONMATCHING // not happening +s16 J2DPane::J2DCast_F32_to_S16(f32 value, u8 arg2) { + f32 temp; + s32 temp2; + s16 result; + + if (arg2 < 0xf) { + temp = value; + if (temp < lbl_804561F0) + temp = -value; + + temp2 = value; + + if (temp2 < 0x8000) { + if (value >= lbl_804561F0) { + result = temp2; + } else { + result = ~temp2 + 1; + } + } else { + if (value >= lbl_804561F0) { + result = 0x7fff; + } else { + result = -0x8000; + } + } + } else { + result = 0; + } + + return result; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DPane::J2DCast_F32_to_S16(f32 param_0, u8 param_1) { +asm s16 J2DPane::J2DCast_F32_to_S16(f32 param_0, u8 param_1) { nofralloc #include "asm/JSystem/J2DGraph/J2DPane/J2DCast_F32_to_S16__7J2DPaneFfUc.s" } #pragma pop +#endif /* 802F7DB8-802F7EF4 2F26F8 013C+00 0/0 3/3 0/0 .text * getPointer__7J2DPaneFP20JSURandomInputStreamUlP10JKRArchive */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DPane::getPointer(JSURandomInputStream* param_0, u32 param_1, JKRArchive* param_2) { +asm void* J2DPane::getPointer(JSURandomInputStream* param_0, u32 param_1, JKRArchive* param_2) { nofralloc #include "asm/JSystem/J2DGraph/J2DPane/getPointer__7J2DPaneFP20JSURandomInputStreamUlP10JKRArchive.s" } #pragma pop /* 802F7EF4-802F7FC4 2F2834 00D0+00 2/0 7/4 0/0 .text setAnimation__7J2DPaneFP10J2DAnmBase */ +#ifdef NONMATCHING // matching in diff.py, what gives? +void J2DPane::setAnimation(J2DAnmBase* anm) { + if (anm != NULL) { + switch (anm->getKind()) { + default: + break; + case 0: + setAnimation(static_cast<J2DAnmTransform*>(anm)); + break; + case 1: + setAnimation(static_cast<J2DAnmColor*>(anm)); + break; + case 2: + setAnimation(static_cast<J2DAnmVtxColor*>(anm)); + break; + case 4: + setAnimation(static_cast<J2DAnmTextureSRTKey*>(anm)); + break; + case 5: + setAnimation(static_cast<J2DAnmTexPattern*>(anm)); + break; + case 6: + setAnimation(static_cast<J2DAnmVisibilityFull*>(anm)); + break; + case 7: + setAnimation(static_cast<J2DAnmTevRegKey*>(anm)); + break; + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -743,75 +782,83 @@ asm void J2DPane::setAnimation(J2DAnmBase* param_0) { #include "asm/JSystem/J2DGraph/J2DPane/setAnimation__7J2DPaneFP10J2DAnmBase.s" } #pragma pop +#endif /* 802F7FC4-802F7FCC -00001 0008+00 0/0 0/0 0/0 .text setAnimation__7J2DPaneFP15J2DAnmTransform */ -void J2DPane::setAnimation(J2DAnmTransform* param_0) { - *(u32*)(((u8*)this) + 248) /* this->field_0xf8 */ = (u32)(param_0); +void J2DPane::setAnimation(J2DAnmTransform* anm) { + mTransform = anm; } /* 802F7FCC-802F8004 2F290C 0038+00 0/0 57/57 0/0 .text animationTransform__7J2DPaneFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::animationTransform() { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/animationTransform__7J2DPaneFv.s" +void J2DPane::animationTransform() { + if (mTransform != NULL) + animationTransform(mTransform); } -#pragma pop /* 802F8004-802F8080 2F2944 007C+00 1/0 7/1 0/0 .text clearAnmTransform__7J2DPaneFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::clearAnmTransform() { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/clearAnmTransform__7J2DPaneFv.s" +void J2DPane::clearAnmTransform() { + J2DAnmTransform* none = NULL; + setAnimation(none); + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + iter.getObject()->clearAnmTransform(); + } } -#pragma pop /* 802F8080-802F8118 2F29C0 0098+00 1/0 7/0 0/0 .text * animationTransform__7J2DPaneFPC15J2DAnmTransform */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::animationTransform(J2DAnmTransform const* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/animationTransform__7J2DPaneFPC15J2DAnmTransform.s" +const J2DAnmTransform* J2DPane::animationTransform(const J2DAnmTransform* transform) { + const J2DAnmTransform* 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; } -#pragma pop /* 802F8118-802F81A0 2F2A58 0088+00 1/0 8/1 0/0 .text * setVisibileAnimation__7J2DPaneFP20J2DAnmVisibilityFull */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::setVisibileAnimation(J2DAnmVisibilityFull* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/setVisibileAnimation__7J2DPaneFP20J2DAnmVisibilityFull.s" +void J2DPane::setVisibileAnimation(J2DAnmVisibilityFull* visibility) { + setAnimationVF(visibility); + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + iter.getObject()->setVisibileAnimation(visibility); + } } -#pragma pop /* 802F81A0-802F8228 2F2AE0 0088+00 1/0 8/1 0/0 .text * setVtxColorAnimation__7J2DPaneFP14J2DAnmVtxColor */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::setVtxColorAnimation(J2DAnmVtxColor* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/setVtxColorAnimation__7J2DPaneFP14J2DAnmVtxColor.s" +void J2DPane::setVtxColorAnimation(J2DAnmVtxColor* vtx_color) { + setAnimationVC(vtx_color); + + JSUTreeIterator<J2DPane> iter; + for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) { + iter.getObject()->setVtxColorAnimation(vtx_color); + } } -#pragma pop /* 802F8228-802F82C0 2F2B68 0098+00 1/0 7/3 0/0 .text animationPane__7J2DPaneFPC15J2DAnmTransform */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::animationPane(J2DAnmTransform const* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/animationPane__7J2DPaneFPC15J2DAnmTransform.s" +const J2DAnmTransform* J2DPane::animationPane(const J2DAnmTransform* transform) { + const J2DAnmTransform* 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; } -#pragma pop /* ############################################################################################## */ /* 80456214-80456218 004814 0004+00 1/1 0/0 0/0 .sdata2 @2890 */ @@ -847,45 +894,33 @@ void J2DPane::rewriteAlpha() { /* 802F83D0-802F83FC 2F2D10 002C+00 1/0 6/0 0/0 .text * setAnimationVF__7J2DPaneFP20J2DAnmVisibilityFull */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::setAnimationVF(J2DAnmVisibilityFull* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/setAnimationVF__7J2DPaneFP20J2DAnmVisibilityFull.s" +void J2DPane::setAnimationVF(J2DAnmVisibilityFull* visibility) { + setAnimation(visibility); } -#pragma pop /* 802F83FC-802F8428 2F2D3C 002C+00 1/0 6/0 0/0 .text setAnimationVC__7J2DPaneFP14J2DAnmVtxColor */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::setAnimationVC(J2DAnmVtxColor* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/setAnimationVC__7J2DPaneFP14J2DAnmVtxColor.s" +void J2DPane::setAnimationVC(J2DAnmVtxColor* vtx_color) { + setAnimation(vtx_color); } -#pragma pop /* 802F8428-802F8464 2F2D68 003C+00 1/0 4/0 0/0 .text setCullBack__7J2DPaneFb */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::setCullBack(bool param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/setCullBack__7J2DPaneFb.s" +void J2DPane::setCullBack(bool cull) { + GXCullMode mode; + + if (!cull) + mode = GX_CULL_NONE; + else + mode = GX_CULL_BACK; + + setCullBack(mode); } -#pragma pop /* 802F8464-802F8474 2F2DA4 0010+00 1/0 5/0 0/0 .text setConnectParent__7J2DPaneFb */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPane::setConnectParent(bool param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPane/setConnectParent__7J2DPaneFb.s" +bool J2DPane::setConnectParent(bool connected) { + mConnected = false; + return false; } -#pragma pop /* 802F8474-802F8478 2F2DB4 0004+00 1/0 7/0 0/0 .text update__7J2DPaneFv */ void J2DPane::update() { diff --git a/libs/JSystem/J2DGraph/J2DPicture.cpp b/libs/JSystem/J2DGraph/J2DPicture.cpp index 0d4d12982a..ede225ac4f 100644 --- a/libs/JSystem/J2DGraph/J2DPicture.cpp +++ b/libs/JSystem/J2DGraph/J2DPicture.cpp @@ -8,207 +8,6 @@ #include "dolphin/types.h" // -// Types: -// - -struct _GXTlut {}; - -struct _GXTexMapID {}; - -struct _GXCullMode {}; - -struct ResTLUT {}; - -struct ResTIMG {}; - -struct ResFONT {}; - -struct JUtility { - struct TColor { - /* 80193960 */ TColor(); - }; -}; - -struct JUTPalette { - /* 802DE890 */ void storeTLUT(_GXTlut, ResTLUT*); -}; - -struct JUTTexture { - /* 802DE234 */ ~JUTTexture(); - /* 802DE480 */ void storeTIMG(ResTIMG const*, JUTPalette*, _GXTlut); - /* 802DE2A8 */ void storeTIMG(ResTIMG const*, u8); - /* 802DE44C */ void storeTIMG(ResTIMG const*, JUTPalette*); - /* 802DE5B0 */ void attachPalette(JUTPalette*); - /* 802DE840 */ void load(_GXTexMapID); -}; - -struct JSUStreamSeekFrom {}; - -struct JSURandomInputStream { - /* 802DC458 */ void peek(void*, s32); - /* 802DC4DC */ void seek(s32, JSUStreamSeekFrom); -}; - -struct JSUInputStream { - /* 802DC298 */ void read(void*, s32); -}; - -struct JKRArchive {}; - -struct JGeometry { - template <typename A1> - struct TBox2 {}; - /* TBox2<f32> */ - struct TBox2__template0 {}; - - template <typename A1> - struct TVec2 {}; - /* TVec2<s16> */ - struct TVec2__template0 { - /* 802FF204 */ void func_802FF204(void* _this); - }; -}; - -struct J2DScreen { - /* 802F9640 */ void getNameResource(char const*); -}; - -struct J2DMirror {}; - -struct J2DAnmTexPattern {}; - -struct J2DAnmVisibilityFull {}; - -struct J2DAnmBase {}; - -struct J2DAnmColor {}; - -struct J2DAnmTevRegKey {}; - -struct J2DAnmTextureSRTKey {}; - -struct J2DAnmTransform {}; - -struct J2DAnmVtxColor {}; - -struct J2DPane { - /* 80053BC0 */ void calcMtx(); - /* 80053C00 */ void makeMatrix(f32, f32); - /* 802F7540 */ void makeMatrix(f32, f32, f32, f32); - /* 80256018 */ void setAnimation(J2DAnmVtxColor*); - /* 8025601C */ void setAnimation(J2DAnmVisibilityFull*); - /* 80256020 */ void setAnimation(J2DAnmTexPattern*); - /* 8018BF28 */ void setAnimation(J2DAnmTextureSRTKey*); - /* 80126350 */ void setAnimation(J2DAnmTevRegKey*); - /* 80126354 */ void setAnimation(J2DAnmColor*); - /* 802F7EF4 */ void setAnimation(J2DAnmBase*); - /* 802F5E88 */ J2DPane(u64, JGeometry::TBox2<f32> const&); - /* 802F5BF8 */ J2DPane(); - /* 802F60C4 */ void makePaneStream(J2DPane*, JSURandomInputStream*); - /* 802F658C */ ~J2DPane(); - /* 802F6D18 */ void place(JGeometry::TBox2<f32> const&); - /* 802F6F60 */ void move(f32, f32); - /* 802F6FB4 */ void add(f32, f32); - /* 802F6FF8 */ void resize(f32, f32); - /* 802F72E0 */ void search(u64); - /* 802F7388 */ void searchUserInfo(u64); - /* 802F7430 */ void isUsed(ResTIMG const*); - /* 802F74B8 */ void isUsed(ResFONT const*); - /* 802F7680 */ void setCullBack(_GXCullMode); - /* 802F8428 */ void setCullBack(bool); - /* 802F7B18 */ void makePaneExStream(J2DPane*, JSURandomInputStream*); - /* 802F7D00 */ void J2DCast_F32_to_S16(f32, u8); - /* 802F7DB8 */ void getPointer(JSURandomInputStream*, u32, JKRArchive*); - /* 802F8004 */ void clearAnmTransform(); - /* 802F8080 */ void animationTransform(J2DAnmTransform const*); - /* 802F8118 */ void setVisibileAnimation(J2DAnmVisibilityFull*); - /* 802F81A0 */ void setVtxColorAnimation(J2DAnmVtxColor*); - /* 802F8228 */ void animationPane(J2DAnmTransform const*); - /* 802F83D0 */ void setAnimationVF(J2DAnmVisibilityFull*); - /* 802F83FC */ void setAnimationVC(J2DAnmVtxColor*); - /* 802F8464 */ void setConnectParent(bool); - /* 802F8474 */ void update(); -}; - -struct J2DMaterial {}; - -struct J2DBinding {}; - -struct J2DPicture { - /* 800202CC */ void setBlendRatio(f32, f32); - /* 802FF208 */ void append(JUTTexture*, f32); - /* 802FF238 */ void append(ResTIMG const*, JUTPalette*, f32); - /* 80020338 */ void append(char const*, f32); - /* 801BDD40 */ void append(ResTIMG const*, f32); - /* 802FF2F0 */ void append(char const*, JUTPalette*, f32); - /* 802FD524 */ void insert(JUTTexture*, u8, f32); - /* 802FD4B4 */ void insert(char const*, JUTPalette*, u8, f32); - /* 802FD168 */ void insert(ResTIMG const*, JUTPalette*, u8, f32); - /* 80020368 */ void insert(char const*, u8, f32); - /* 801BDD70 */ void insert(ResTIMG const*, u8, f32); - /* 800539DC */ void getTexture(u8) const; - /* 80053C44 */ void setWhite(JUtility::TColor); - /* 80053C6C */ void setBlack(JUtility::TColor); - /* 8018BEE0 */ void setBlackWhite(JUtility::TColor, JUtility::TColor); - /* 801DFA40 */ void getWhite() const; - /* 801DFA4C */ void getBlack() const; - /* 8025603C */ bool getMaterial() const; - /* 802FC800 */ J2DPicture(u64, JGeometry::TBox2<f32> const&, ResTIMG const*, ResTLUT const*); - /* 802FC708 */ J2DPicture(ResTIMG const*); - /* 802FC118 */ J2DPicture(J2DPane*, JSURandomInputStream*, JKRArchive*); - /* 802FC050 */ J2DPicture(); - /* 802FC1D4 */ J2DPicture(J2DPane*, JSURandomInputStream*, J2DMaterial*); - /* 802FC8E8 */ void private_readStream(J2DPane*, JSURandomInputStream*, JKRArchive*); - /* 802FCCDC */ void initiate(ResTIMG const*, ResTLUT const*); - /* 802FCD70 */ void private_initiate(ResTIMG const*, ResTLUT const*); - /* 802FCE9C */ void initinfo(); - /* 802FCFF0 */ ~J2DPicture(); - /* 802FD098 */ void prepareTexture(u8); - /* 802FF410 */ void remove(); - /* 802FD814 */ void remove(JUTTexture*); - /* 802FD6F4 */ void remove(u8); - /* 802FD9BC */ void changeTexture(ResTIMG const*, u8, JUTPalette*); - /* 802FDAC8 */ void changeTexture(char const*, u8, JUTPalette*); - /* 802FD964 */ void changeTexture(char const*, u8); - /* 802FD874 */ void changeTexture(ResTIMG const*, u8); - /* 802FDB90 */ void drawSelf(f32, f32, f32 (*)[3][4]); - /* 802FDB28 */ void drawSelf(f32, f32); - /* 802FDBFC */ void drawFullSet(f32, f32, f32, f32, f32 (*)[3][4]); - /* 802FF448 */ void draw(f32, f32, u8, bool, bool, bool); - /* 802FF4E0 */ void draw(f32, f32, bool, bool, bool); - /* 802FDC70 */ void draw(f32, f32, f32, f32, bool, bool, bool); - /* 802FDF88 */ void drawOut(JGeometry::TBox2<f32> const&, JGeometry::TBox2<f32> const&); - /* 802FF588 */ void drawOut(f32, f32, f32, f32, f32, f32); - /* 802FF524 */ void drawOut(f32, f32, f32, f32, f32, f32, f32, f32); - /* 802FE380 */ void drawTexCoord(f32, f32, f32, f32, s16, s16, s16, s16, s16, s16, s16, s16, - f32 (*)[3][4]); - /* 802FE5D0 */ void setTevMode(); - /* 802FEA60 */ void swap(f32&, f32&); - /* 802FEA74 */ void setBlendColorRatio(f32, f32); - /* 802FEA9C */ void setBlendAlphaRatio(f32, f32); - /* 802FEAC4 */ void setBlendKonstColor(); - /* 802FEB94 */ void setBlendKonstAlpha(); - /* 802FEC64 */ void getNewColor(JUtility::TColor*); - /* 802FED84 */ void setTexCoord(JGeometry::TVec2<s16>*, JUTTexture const*, J2DBinding, - J2DMirror, bool); - /* 802FED44 */ void setTexCoord(JUTTexture const*, J2DBinding, J2DMirror, bool); - /* 802FF09C */ void isUsed(ResTIMG const*); - /* 802FF63C */ void isUsed(ResFONT const*); - /* 802FF100 */ void getUsableTlut(u8); - /* 802FF1D0 */ void getTlutID(ResTIMG const*, u8); - /* 802FF29C */ void load(_GXTexMapID, u8); - /* 802FF268 */ void load(u8); - /* 802FF2E8 */ s32 getTypeID() const; - /* 802FF380 */ void prepend(char const*, f32); - /* 802FF320 */ void prepend(JUTTexture*, f32); - /* 802FF3B0 */ void prepend(ResTIMG const*, JUTPalette*, f32); - /* 802FF350 */ void prepend(char const*, JUTPalette*, f32); - /* 802FF3E0 */ void prepend(ResTIMG const*, f32); - /* 802FF634 */ void getTextureCount() const; - /* 802FF65C */ void rewriteAlpha(); -}; - -// // Forward References: // @@ -339,30 +138,13 @@ extern "C" void setCullBack__7J2DPaneFb(); extern "C" void setConnectParent__7J2DPaneFb(); extern "C" void update__7J2DPaneFv(); extern "C" void getNameResource__9J2DScreenFPCc(); -extern "C" void PSMTXIdentity(); -extern "C" void PSMTXConcat(); -extern "C" void GXSetVtxDesc(); extern "C" void GXClearVtxDesc(); -extern "C" void GXSetVtxAttrFmt(); extern "C" void GXSetTexCoordGen2(); -extern "C" void GXSetNumTexGens(); -extern "C" void GXBegin(); -extern "C" void GXSetNumChans(); -extern "C" void GXSetChanCtrl(); extern "C" void GXSetNumIndStages(); extern "C" void GXSetTevDirect(); -extern "C" void GXSetTevOp(); -extern "C" void GXSetTevColorIn(); -extern "C" void GXSetTevAlphaIn(); -extern "C" void GXSetTevColorOp(); -extern "C" void GXSetTevAlphaOp(); -extern "C" void GXSetTevColor(); extern "C" void GXSetTevKColor(); extern "C" void GXSetTevKColorSel(); extern "C" void GXSetTevKAlphaSel(); -extern "C" void GXSetTevOrder(); -extern "C" void GXSetNumTevStages(); -extern "C" void GXSetBlendMode(); extern "C" void GXLoadPosMtxImm(); extern "C" void GXSetCurrentMtx(); extern "C" void __construct_array(); @@ -476,6 +258,19 @@ SECTION_DATA extern void* __vt__10J2DPicture[83 + 1 /* padding */] = { }; /* 802FC050-802FC118 2F6990 00C8+00 0/0 2/2 0/0 .text __ct__10J2DPictureFv */ +#ifdef NONMATCHING +J2DPicture::J2DPicture() + : field_0x10a(), field_0x12c(NULL), mWhite(), mBlack(), mCornerColor(), field_0x148(), + field_0x14c() { + for (int i = 0; i < 2; i++) { + mTexture[i] = NULL; + } + + field_0x109 = 0; + mTextureCount = 0; + initinfo(); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -484,6 +279,7 @@ asm J2DPicture::J2DPicture() { #include "asm/JSystem/J2DGraph/J2DPicture/__ct__10J2DPictureFv.s" } #pragma pop +#endif /* 802FC118-802FC1D4 2F6A58 00BC+00 0/0 1/1 0/0 .text * __ct__10J2DPictureFP7J2DPaneP20JSURandomInputStreamP10JKRArchive */ @@ -584,6 +380,18 @@ asm void J2DPicture::private_initiate(ResTIMG const* param_0, ResTLUT const* par #pragma pop /* 802FCE9C-802FCFF0 2F77DC 0154+00 3/3 0/0 0/0 .text initinfo__10J2DPictureFv */ +// matches with real literal +#ifdef NONMATCHING +void J2DPicture::initinfo() { + id = 'PIC1'; + setTexCoord(NULL, BIND15, MIRROR0, false); + setBlendRatio(lit_1767, lit_1767); + + mBlack = 0; + mWhite = -1; + setCornerColor(-1, -1, -1, -1); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -592,26 +400,37 @@ asm void J2DPicture::initinfo() { #include "asm/JSystem/J2DGraph/J2DPicture/initinfo__10J2DPictureFv.s" } #pragma pop +#endif /* 802FCFF0-802FD098 2F7930 00A8+00 1/0 3/3 0/0 .text __dt__10J2DPictureFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm J2DPicture::~J2DPicture() { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/__dt__10J2DPictureFv.s" +J2DPicture::~J2DPicture() { + for (int i = 0; i < 2; i++) { + if ((int)(field_0x109 & 1 << i) != 0) { + delete mTexture[i]; + } + } + delete field_0x12c; } -#pragma pop /* 802FD098-802FD168 2F79D8 00D0+00 1/0 0/0 0/0 .text prepareTexture__10J2DPictureFUc */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::prepareTexture(u8 param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/prepareTexture__10J2DPictureFUc.s" +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; } -#pragma pop /* 802FD168-802FD4B4 2F7AA8 034C+00 1/0 0/0 0/0 .text * insert__10J2DPictureFPC7ResTIMGP10JUTPaletteUcf */ @@ -625,14 +444,10 @@ asm void J2DPicture::insert(ResTIMG const* param_0, JUTPalette* param_1, u8 para #pragma pop /* 802FD4B4-802FD524 2F7DF4 0070+00 1/0 0/0 0/0 .text insert__10J2DPictureFPCcP10JUTPaletteUcf */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::insert(char const* param_0, JUTPalette* param_1, u8 param_2, f32 param_3) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/insert__10J2DPictureFPCcP10JUTPaletteUcf.s" +void J2DPicture::insert(char const* param_0, JUTPalette* param_1, u8 param_2, f32 param_3) { + void* resource = J2DScreen::getNameResource(param_0); + insert((ResTIMG*)resource, param_1, param_2, param_3); } -#pragma pop /* 802FD524-802FD6F4 2F7E64 01D0+00 1/0 0/0 0/0 .text insert__10J2DPictureFP10JUTTextureUcf */ #pragma push @@ -648,7 +463,7 @@ asm void J2DPicture::insert(JUTTexture* param_0, u8 param_1, f32 param_2) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DPicture::remove(u8 param_0) { +asm int J2DPicture::remove(u8 param_0) { nofralloc #include "asm/JSystem/J2DGraph/J2DPicture/remove__10J2DPictureFUc.s" } @@ -656,14 +471,15 @@ asm void J2DPicture::remove(u8 param_0) { /* 802FD814-802FD874 2F8154 0060+00 1/0 0/0 0/0 .text remove__10J2DPictureFP10JUTTexture */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::remove(JUTTexture* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/remove__10J2DPictureFP10JUTTexture.s" +void J2DPicture::remove(JUTTexture* param_0) { + u8 i = 0; + for (; i < mTextureCount; i++) { + if (mTexture[i] == param_0) { + break; + } + } + remove(i); } -#pragma pop /* 802FD874-802FD964 2F81B4 00F0+00 1/0 0/0 0/0 .text changeTexture__10J2DPictureFPC7ResTIMGUc */ #pragma push @@ -677,14 +493,10 @@ asm void J2DPicture::changeTexture(ResTIMG const* param_0, u8 param_1) { /* 802FD964-802FD9BC 2F82A4 0058+00 1/0 0/0 0/0 .text changeTexture__10J2DPictureFPCcUc */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::changeTexture(char const* param_0, u8 param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/changeTexture__10J2DPictureFPCcUc.s" +void J2DPicture::changeTexture(char const* param_0, u8 param_1) { + void* resource = J2DScreen::getNameResource(param_0); + changeTexture((ResTIMG*)resource, param_1); } -#pragma pop /* 802FD9BC-802FDAC8 2F82FC 010C+00 1/0 0/0 0/0 .text * changeTexture__10J2DPictureFPC7ResTIMGUcP10JUTPalette */ @@ -699,46 +511,36 @@ asm void J2DPicture::changeTexture(ResTIMG const* param_0, u8 param_1, JUTPalett /* 802FDAC8-802FDB28 2F8408 0060+00 1/0 0/0 0/0 .text * changeTexture__10J2DPictureFPCcUcP10JUTPalette */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::changeTexture(char const* param_0, u8 param_1, JUTPalette* param_2) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/changeTexture__10J2DPictureFPCcUcP10JUTPalette.s" +void J2DPicture::changeTexture(char const* param_0, u8 param_1, JUTPalette* param_2) { + void* resource = J2DScreen::getNameResource(param_0); + changeTexture((ResTIMG*)resource, param_1, param_2); } -#pragma pop /* 802FDB28-802FDB90 2F8468 0068+00 1/0 1/0 0/0 .text drawSelf__10J2DPictureFff */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::drawSelf(f32 param_0, f32 param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/drawSelf__10J2DPictureFff.s" +void J2DPicture::drawSelf(f32 param_0, f32 param_1) { + Mtx tmp; + PSMTXIdentity(tmp); + + drawSelf(param_0, param_1, &tmp); } -#pragma pop /* 802FDB90-802FDBFC 2F84D0 006C+00 1/0 0/0 0/0 .text drawSelf__10J2DPictureFffPA3_A4_f */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::drawSelf(f32 param_0, f32 param_1, f32 (*param_2)[3][4]) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/drawSelf__10J2DPictureFffPA3_A4_f.s" +void J2DPicture::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) { + if (mTexture[0] != NULL && mTextureCount != 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); + } } -#pragma pop /* 802FDBFC-802FDC70 2F853C 0074+00 1/0 0/0 0/0 .text drawFullSet__10J2DPictureFffffPA3_A4_f */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::drawFullSet(f32 param_0, f32 param_1, f32 param_2, f32 param_3, - f32 (*param_4)[3][4]) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/drawFullSet__10J2DPictureFffffPA3_A4_f.s" +void J2DPicture::drawFullSet(f32 param_0, f32 param_1, f32 param_2, f32 param_3, Mtx* param_4) { + if (mTexture[0] != NULL && mTextureCount != 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); + } } -#pragma pop /* 802FDC70-802FDF88 2F85B0 0318+00 1/0 1/1 0/0 .text draw__10J2DPictureFffffbbb */ #pragma push @@ -787,36 +589,27 @@ asm void J2DPicture::setTevMode() { #pragma pop /* 802FEA60-802FEA74 2F93A0 0014+00 1/1 0/0 0/0 .text swap__10J2DPictureFRfRf */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::swap(f32& param_0, f32& param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/swap__10J2DPictureFRfRf.s" +void J2DPicture::swap(f32& lhs, f32& rhs) { + f32 tmp = lhs; + lhs = rhs; + rhs = tmp; } -#pragma pop /* 802FEA74-802FEA9C 2F93B4 0028+00 1/0 0/0 0/0 .text setBlendColorRatio__10J2DPictureFff */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::setBlendColorRatio(f32 param_0, f32 param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/setBlendColorRatio__10J2DPictureFff.s" +void J2DPicture::setBlendColorRatio(f32 param_0, f32 param_1) { + field_0x11c[0] = param_0; + field_0x11c[1] = param_1; + setBlendKonstColor(); } -#pragma pop /* 802FEA9C-802FEAC4 2F93DC 0028+00 1/0 0/0 0/0 .text setBlendAlphaRatio__10J2DPictureFff */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::setBlendAlphaRatio(f32 param_0, f32 param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/setBlendAlphaRatio__10J2DPictureFff.s" +void J2DPicture::setBlendAlphaRatio(f32 param_0, f32 param_1) { + field_0x11c[2] = param_0; + field_0x11c[3] = param_1; + setBlendKonstAlpha(); } -#pragma pop /* ############################################################################################## */ /* 80456278-8045627C 004878 0004+00 2/2 0/0 0/0 .sdata2 @2758 */ @@ -824,6 +617,25 @@ SECTION_SDATA2 static f32 lit_2758 = 255.0f; /* 802FEAC4-802FEB94 2F9404 00D0+00 4/4 0/0 0/0 .text setBlendKonstColor__10J2DPictureFv */ +// matches with real literals +#ifdef NONMATCHING +void J2DPicture::setBlendKonstColor() { + int uvar3 = 0; + for (u8 i = 1; i < mTextureCount; 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; + } + } + field_0x148 = uvar3; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -832,6 +644,7 @@ asm void J2DPicture::setBlendKonstColor() { #include "asm/JSystem/J2DGraph/J2DPicture/setBlendKonstColor__10J2DPictureFv.s" } #pragma pop +#endif /* 802FEB94-802FEC64 2F94D4 00D0+00 4/4 0/0 0/0 .text setBlendKonstAlpha__10J2DPictureFv */ @@ -857,15 +670,10 @@ asm void J2DPicture::getNewColor(JUtility::TColor* param_0) { /* 802FED44-802FED84 2F9684 0040+00 4/4 0/0 0/0 .text * setTexCoord__10J2DPictureFPC10JUTTexture10J2DBinding9J2DMirrorb */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::setTexCoord(JUTTexture const* param_0, J2DBinding param_1, J2DMirror param_2, - bool param_3) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/setTexCoord__10J2DPictureFPC10JUTTexture10J2DBinding9J2DMirrorb.s" +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); } -#pragma pop /* ############################################################################################## */ /* 8045627C-80456280 00487C 0004+00 1/1 0/0 0/0 .sdata2 @2933 */ @@ -884,14 +692,15 @@ asm void J2DPicture::setTexCoord(JGeometry::TVec2<s16>* param_0, JUTTexture cons #pragma pop /* 802FF09C-802FF100 2F99DC 0064+00 1/0 0/0 0/0 .text isUsed__10J2DPictureFPC7ResTIMG */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::isUsed(ResTIMG const* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/isUsed__10J2DPictureFPC7ResTIMG.s" +bool J2DPicture::isUsed(ResTIMG const* param_0) { + for (u8 i = 0; i < mTextureCount; i++) { + if (mTexture[i] != NULL && mTexture[i]->getTexInfo() == param_0) { + return true; + } + } + + return J2DPane::isUsed(param_0); } -#pragma pop /* 802FF100-802FF1D0 2F9A40 00D0+00 1/0 0/0 0/0 .text getUsableTlut__10J2DPictureFUc */ #pragma push @@ -907,7 +716,7 @@ asm void J2DPicture::getUsableTlut(u8 param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DPicture::getTlutID(ResTIMG const* param_0, u8 param_1) { +asm u8 J2DPicture::getTlutID(ResTIMG const* param_0, u8 param_1) { nofralloc #include "asm/JSystem/J2DGraph/J2DPicture/getTlutID__10J2DPictureFPC7ResTIMGUc.s" } @@ -920,46 +729,28 @@ extern "C" void func_802FF204(void* _this) { /* 802FF208-802FF238 2F9B48 0030+00 1/0 0/0 0/0 .text append__10J2DPictureFP10JUTTexturef */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::append(JUTTexture* param_0, f32 param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/append__10J2DPictureFP10JUTTexturef.s" +void J2DPicture::append(JUTTexture* param_0, f32 param_1) { + insert(param_0, mTextureCount, param_1); } -#pragma pop /* 802FF238-802FF268 2F9B78 0030+00 1/0 0/0 0/0 .text * append__10J2DPictureFPC7ResTIMGP10JUTPalettef */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::append(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/append__10J2DPictureFPC7ResTIMGP10JUTPalettef.s" +void J2DPicture::append(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) { + insert(param_0, param_1, mTextureCount, param_2); } -#pragma pop /* 802FF268-802FF29C 2F9BA8 0034+00 1/0 0/0 0/0 .text load__10J2DPictureFUc */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::load(u8 param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/load__10J2DPictureFUc.s" +void J2DPicture::load(u8 param_0) { + load((_GXTexMapID)param_0, param_0); } -#pragma pop /* 802FF29C-802FF2E8 2F9BDC 004C+00 1/0 0/0 0/0 .text load__10J2DPictureF11_GXTexMapIDUc */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::load(_GXTexMapID param_0, u8 param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/load__10J2DPictureF11_GXTexMapIDUc.s" +void J2DPicture::load(_GXTexMapID param_0, u8 param_1) { + if (param_1 < mTextureCount && param_1 < 2 && mTexture[param_1] != NULL) { + mTexture[param_1]->load(param_0); + } } -#pragma pop /* 802FF2E8-802FF2F0 2F9C28 0008+00 1/0 1/0 0/0 .text getTypeID__10J2DPictureCFv */ s32 J2DPicture::getTypeID() const { @@ -967,76 +758,41 @@ s32 J2DPicture::getTypeID() const { } /* 802FF2F0-802FF320 2F9C30 0030+00 1/0 0/0 0/0 .text append__10J2DPictureFPCcP10JUTPalettef */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::append(char const* param_0, JUTPalette* param_1, f32 param_2) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/append__10J2DPictureFPCcP10JUTPalettef.s" +void J2DPicture::append(char const* param_0, JUTPalette* param_1, f32 param_2) { + insert(param_0, param_1, mTextureCount, param_2); } -#pragma pop /* 802FF320-802FF350 2F9C60 0030+00 1/0 0/0 0/0 .text prepend__10J2DPictureFP10JUTTexturef */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::prepend(JUTTexture* param_0, f32 param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/prepend__10J2DPictureFP10JUTTexturef.s" +void J2DPicture::prepend(JUTTexture* param_0, f32 param_1) { + insert(param_0, 0, param_1); } -#pragma pop /* 802FF350-802FF380 2F9C90 0030+00 1/0 0/0 0/0 .text prepend__10J2DPictureFPCcP10JUTPalettef */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::prepend(char const* param_0, JUTPalette* param_1, f32 param_2) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/prepend__10J2DPictureFPCcP10JUTPalettef.s" +void J2DPicture::prepend(char const* param_0, JUTPalette* param_1, f32 param_2) { + insert(param_0, param_1, 0, param_2); } -#pragma pop /* 802FF380-802FF3B0 2F9CC0 0030+00 1/0 0/0 0/0 .text prepend__10J2DPictureFPCcf */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::prepend(char const* param_0, f32 param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/prepend__10J2DPictureFPCcf.s" +void J2DPicture::prepend(char const* param_0, f32 param_1) { + insert(param_0, 0, param_1); } -#pragma pop /* 802FF3B0-802FF3E0 2F9CF0 0030+00 1/0 0/0 0/0 .text * prepend__10J2DPictureFPC7ResTIMGP10JUTPalettef */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::prepend(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/prepend__10J2DPictureFPC7ResTIMGP10JUTPalettef.s" +void J2DPicture::prepend(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) { + insert(param_0, param_1, 0, param_2); } -#pragma pop /* 802FF3E0-802FF410 2F9D20 0030+00 1/0 0/0 0/0 .text prepend__10J2DPictureFPC7ResTIMGf */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::prepend(ResTIMG const* param_0, f32 param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/prepend__10J2DPictureFPC7ResTIMGf.s" +void J2DPicture::prepend(ResTIMG const* param_0, f32 param_1) { + insert(param_0, 0, param_1); } -#pragma pop /* 802FF410-802FF448 2F9D50 0038+00 1/0 0/0 0/0 .text remove__10J2DPictureFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::remove() { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/remove__10J2DPictureFv.s" +int J2DPicture::remove() { + return remove(mTextureCount - 1); } -#pragma pop /* 802FF448-802FF4E0 2F9D88 0098+00 1/0 0/0 0/0 .text draw__10J2DPictureFffUcbbb */ #pragma push @@ -1082,24 +838,14 @@ asm void J2DPicture::drawOut(f32 param_0, f32 param_1, f32 param_2, f32 param_3, #pragma pop /* 802FF634-802FF63C 2F9F74 0008+00 1/0 0/0 0/0 .text getTextureCount__10J2DPictureCFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::getTextureCount() const { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/getTextureCount__10J2DPictureCFv.s" +u8 J2DPicture::getTextureCount() const { + return mTextureCount; } -#pragma pop /* 802FF63C-802FF65C 2F9F7C 0020+00 1/0 0/0 0/0 .text isUsed__10J2DPictureFPC7ResFONT */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DPicture::isUsed(ResFONT const* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DPicture/isUsed__10J2DPictureFPC7ResFONT.s" +bool J2DPicture::isUsed(ResFONT const* param_0) { + return J2DPane::isUsed(param_0); } -#pragma pop /* 802FF65C-802FF660 2F9F9C 0004+00 1/0 0/0 0/0 .text rewriteAlpha__10J2DPictureFv */ void J2DPicture::rewriteAlpha() { diff --git a/libs/JSystem/J2DGraph/J2DScreen.cpp b/libs/JSystem/J2DGraph/J2DScreen.cpp index 84132bea69..bdb965a63f 100644 --- a/libs/JSystem/J2DGraph/J2DScreen.cpp +++ b/libs/JSystem/J2DGraph/J2DScreen.cpp @@ -11,103 +11,10 @@ // Types: // -struct _GXCullMode {}; - -struct ResTIMG {}; - -struct ResNTAB {}; - -struct ResFONT {}; - -struct JUTNameTab { - /* 802DE9E0 */ JUTNameTab(ResNTAB const*); -}; - -struct JSUStreamSeekFrom {}; - -struct JSURandomInputStream { - /* 802DC458 */ void peek(void*, s32); - /* 802DC4DC */ void seek(s32, JSUStreamSeekFrom); -}; - struct JSUMemoryInputStream { /* 802DC520 */ void setBuffer(void const*, s32); }; -struct JSUInputStream { - /* 802DC23C */ ~JSUInputStream(); - /* 802DC298 */ void read(void*, s32); -}; - -struct JKRFileLoader { - /* 802D4270 */ void getGlbResource(char const*, JKRFileLoader*); -}; - -struct JKRArchive {}; - -struct JGeometry { - template <typename A1> - struct TBox2 {}; - /* TBox2<f32> */ - struct TBox2__template0 {}; -}; - -struct J2DAnmVisibilityFull {}; - -struct J2DAnmBase {}; - -struct J2DGrafContext {}; - -struct J2DAnmTransform {}; - -struct J2DAnmVtxColor {}; - -struct J2DPane { - /* 80053C00 */ void makeMatrix(f32, f32); - /* 802F7540 */ void makeMatrix(f32, f32, f32, f32); - /* 802F5F9C */ J2DPane(J2DPane*, JSURandomInputStream*, u8); - /* 802F5D40 */ J2DPane(J2DPane*, bool, u64, JGeometry::TBox2<f32> const&); - /* 802F658C */ ~J2DPane(); - /* 802F67E0 */ void draw(f32, f32, J2DGrafContext const*, bool, bool); - /* 802F6D18 */ void place(JGeometry::TBox2<f32> const&); - /* 802F6F60 */ void move(f32, f32); - /* 802F6FB4 */ void add(f32, f32); - /* 802F6FF8 */ void resize(f32, f32); - /* 802F72E0 */ void search(u64); - /* 802F7388 */ void searchUserInfo(u64); - /* 802F7430 */ void isUsed(ResTIMG const*); - /* 802F74B8 */ void isUsed(ResFONT const*); - /* 802F7680 */ void setCullBack(_GXCullMode); - /* 802F8428 */ void setCullBack(bool); - /* 802F7EF4 */ void setAnimation(J2DAnmBase*); - /* 802F8080 */ void animationTransform(J2DAnmTransform const*); - /* 802F8118 */ void setVisibileAnimation(J2DAnmVisibilityFull*); - /* 802F81A0 */ void setVtxColorAnimation(J2DAnmVtxColor*); - /* 802F8228 */ void animationPane(J2DAnmTransform const*); - /* 802F83CC */ void rewriteAlpha(); - /* 802F8464 */ void setConnectParent(bool); - /* 802F8474 */ void update(); - /* 802F8478 */ void drawSelf(f32, f32); -}; - -struct J2DAnmTexPattern {}; - -struct J2DAnmTevRegKey {}; - -struct J2DAnmTextureSRTKey {}; - -struct J2DAnmColor {}; - -struct J2DMaterial { - /* 802EA1AC */ J2DMaterial(); - /* 802EA2CC */ ~J2DMaterial(); - /* 802EAA2C */ void setAnimation(J2DAnmTexPattern*); - /* 802EA94C */ void setAnimation(J2DAnmTextureSRTKey*); - /* 802EAB0C */ void setAnimation(J2DAnmTevRegKey*); - /* 802EA89C */ void setAnimation(J2DAnmColor*); - /* 802EAC78 */ void animation(); -}; - struct J2DWindowEx { /* 80300C94 */ J2DWindowEx(J2DPane*, JSURandomInputStream*, u32, J2DMaterial*); }; @@ -126,50 +33,6 @@ struct J2DTextBox { /* 802FF75C */ J2DTextBox(J2DPane*, JSURandomInputStream*, u32, J2DMaterial*); }; -struct J2DScrnBlockHeader {}; - -struct J2DScreen { - /* 80053BA0 */ void clearAnmTransform(); - /* 802F9704 */ void setAnimation(J2DAnmColor*); - /* 80192414 */ void setAnimation(J2DAnmTransform*); - /* 802F9798 */ void setAnimation(J2DAnmTextureSRTKey*); - /* 802F99A8 */ void setAnimation(J2DAnmVtxColor*); - /* 802F9838 */ void setAnimation(J2DAnmTexPattern*); - /* 802F99C8 */ void setAnimation(J2DAnmVisibilityFull*); - /* 802F98CC */ void setAnimation(J2DAnmTevRegKey*); - /* 802F9A54 */ void setAnimation(J2DAnmBase*); - /* 802F8498 */ J2DScreen(); - /* 802F8540 */ ~J2DScreen(); - /* 802F85A8 */ void clean(); - /* 802F8648 */ void setPriority(char const*, u32, JKRArchive*); - /* 802F8748 */ void setPriority(JSURandomInputStream*, u32, JKRArchive*); - /* 802F8778 */ void private_set(JSURandomInputStream*, u32, JKRArchive*); - /* 802F8834 */ void checkSignature(JSURandomInputStream*); - /* 802F8894 */ void getScreenInformation(JSURandomInputStream*); - /* 802F8990 */ void makeHierarchyPanes(J2DPane*, JSURandomInputStream*, u32, JKRArchive*); - /* 802F8B98 */ void createPane(J2DScrnBlockHeader const&, JSURandomInputStream*, J2DPane*, u32, - JKRArchive*); - /* 802F99E8 */ void createPane(J2DScrnBlockHeader const&, JSURandomInputStream*, J2DPane*, u32); - /* 802F8ED4 */ void draw(f32, f32, J2DGrafContext const*); - /* 802F90A0 */ void search(u64); - /* 802F90E0 */ void searchUserInfo(u64); - /* 802F9120 */ void drawSelf(f32, f32, f32 (*)[3][4]); - /* 802F9280 */ void getResReference(JSURandomInputStream*, u32); - /* 802F937C */ void createMaterial(JSURandomInputStream*, u32, JKRArchive*); - /* 802F9600 */ void isUsed(ResTIMG const*); - /* 802F9620 */ void isUsed(ResFONT const*); - /* 802F9640 */ void getNameResource(char const*); - /* 802F9690 */ void animation(); - /* 802F9A18 */ s32 getTypeID() const; - /* 802F9A20 */ void calcMtx(); - /* 802F9A74 */ void setAnimationVF(J2DAnmVisibilityFull*); - /* 802F9A78 */ void setAnimationVC(J2DAnmVtxColor*); - - static u8 mDataManage[4 + 4 /* padding */]; -}; - -struct J2DResReference {}; - struct J2DPictureEx { /* 803036EC */ J2DPictureEx(J2DPane*, JSURandomInputStream*, u32, J2DMaterial*); }; @@ -192,10 +55,6 @@ struct J2DMaterialFactory { JKRArchive*) const; }; -struct J2DDataManage { - /* 8030CE18 */ void get(char const*); -}; - // // Forward References: // @@ -301,19 +160,9 @@ extern "C" void __ct__11J2DWindowExFP7J2DPaneP20JSURandomInputStreamUlP11J2DMate extern "C" void __ct__12J2DPictureExFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial(); extern "C" void __ct__12J2DTextBoxExFP7J2DPaneP20JSURandomInputStreamUlP11J2DMaterial(); extern "C" void get__13J2DDataManageFPCc(); -extern "C" void GXSetVtxDesc(); -extern "C" void GXSetVtxAttrFmt(); -extern "C" void GXSetNumTexGens(); -extern "C" void GXBegin(); -extern "C" void GXSetCullMode(); -extern "C" void GXSetChanCtrl(); extern "C" void GXSetNumIndStages(); extern "C" void GXSetTevDirect(); -extern "C" void GXSetTevOp(); extern "C" void GXSetTevSwapModeTable(); -extern "C" void GXSetTevOrder(); -extern "C" void GXSetNumTevStages(); -extern "C" void GXSetBlendMode(); extern "C" void GXSetScissor(); extern "C" void GXGetScissor(); extern "C" void __destroy_new_array(); @@ -416,21 +265,31 @@ asm J2DScreen::J2DScreen() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm J2DScreen::~J2DScreen() { +// asm J2DScreen::~J2DScreen() { +extern "C" asm void __dt__9J2DScreenFv() { nofralloc #include "asm/JSystem/J2DGraph/J2DScreen/__dt__9J2DScreenFv.s" } #pragma pop /* 802F85A8-802F8648 2F2EE8 00A0+00 3/3 0/0 0/0 .text clean__9J2DScreenFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DScreen::clean() { - nofralloc -#include "asm/JSystem/J2DGraph/J2DScreen/clean__9J2DScreenFv.s" +void J2DScreen::clean() { + delete[] mMaterials; + mMaterialNum = 0; + mMaterials = NULL; + + delete[] field_0x108; + field_0x108 = NULL; + + delete[] field_0x10c; + field_0x10c = NULL; + + if (mNameTable != NULL) { + delete[] mNameTable->getResNameTable(); + delete mNameTable; + mNameTable = NULL; + } } -#pragma pop /* 802F8648-802F8748 2F2F88 0100+00 0/0 58/58 4/4 .text setPriority__9J2DScreenFPCcUlP10JKRArchive */ @@ -445,21 +304,20 @@ asm void J2DScreen::setPriority(char const* param_0, u32 param_1, JKRArchive* pa /* 802F8748-802F8778 2F3088 0030+00 1/1 1/1 0/0 .text * setPriority__9J2DScreenFP20JSURandomInputStreamUlP10JKRArchive */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DScreen::setPriority(JSURandomInputStream* param_0, u32 param_1, JKRArchive* param_2) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DScreen/setPriority__9J2DScreenFP20JSURandomInputStreamUlP10JKRArchive.s" +bool J2DScreen::setPriority(JSURandomInputStream* param_0, u32 param_1, JKRArchive* param_2) { + if (param_2 == NULL) { + return false; + } else { + return private_set(param_0, param_1, param_2); + } } -#pragma pop /* 802F8778-802F8834 2F30B8 00BC+00 1/1 0/0 0/0 .text * private_set__9J2DScreenFP20JSURandomInputStreamUlP10JKRArchive */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DScreen::private_set(JSURandomInputStream* param_0, u32 param_1, JKRArchive* param_2) { +asm bool J2DScreen::private_set(JSURandomInputStream* param_0, u32 param_1, JKRArchive* param_2) { nofralloc #include "asm/JSystem/J2DGraph/J2DScreen/private_set__9J2DScreenFP20JSURandomInputStreamUlP10JKRArchive.s" } @@ -467,14 +325,27 @@ asm void J2DScreen::private_set(JSURandomInputStream* param_0, u32 param_1, JKRA /* 802F8834-802F8894 2F3174 0060+00 1/1 0/0 0/0 .text * checkSignature__9J2DScreenFP20JSURandomInputStream */ +#ifdef NONMATCHING +bool J2DScreen::checkSignature(JSURandomInputStream* param_0) { + int tag; + param_0->read(&tag, 32); + + if (tag == 'SCRN' && (tag2 == 'blo1' || tag2 == 'blo2')) { + return true; + } else { + return false; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DScreen::checkSignature(JSURandomInputStream* param_0) { +asm bool J2DScreen::checkSignature(JSURandomInputStream* param_0) { nofralloc #include "asm/JSystem/J2DGraph/J2DScreen/checkSignature__9J2DScreenFP20JSURandomInputStream.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80456230-80456238 004830 0008+00 1/1 0/0 0/0 .sdata2 @1705 */ @@ -536,7 +407,7 @@ asm void J2DScreen::draw(f32 param_0, f32 param_1, J2DGrafContext const* param_2 #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DScreen::search(u64 param_0) { +asm const J2DPane* J2DScreen::search(u64 param_0) { nofralloc #include "asm/JSystem/J2DGraph/J2DScreen/search__9J2DScreenFUx.s" } @@ -546,7 +417,7 @@ asm void J2DScreen::search(u64 param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DScreen::searchUserInfo(u64 param_0) { +asm const J2DPane* J2DScreen::searchUserInfo(u64 param_0) { nofralloc #include "asm/JSystem/J2DGraph/J2DScreen/searchUserInfo__9J2DScreenFUx.s" } @@ -586,34 +457,24 @@ asm void J2DScreen::createMaterial(JSURandomInputStream* param_0, u32 param_1, #pragma pop /* 802F9600-802F9620 2F3F40 0020+00 1/0 0/0 0/0 .text isUsed__9J2DScreenFPC7ResTIMG */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DScreen::isUsed(ResTIMG const* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DScreen/isUsed__9J2DScreenFPC7ResTIMG.s" +bool J2DScreen::isUsed(ResTIMG const* param_0) { + return J2DPane::isUsed(param_0); } -#pragma pop /* 802F9620-802F9640 2F3F60 0020+00 1/0 0/0 0/0 .text isUsed__9J2DScreenFPC7ResFONT */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DScreen::isUsed(ResFONT const* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DScreen/isUsed__9J2DScreenFPC7ResFONT.s" +bool J2DScreen::isUsed(ResFONT const* param_0) { + return J2DPane::isUsed(param_0); } -#pragma pop /* ############################################################################################## */ /* 80451590-80451598 000A90 0004+04 1/1 3/3 0/0 .sbss mDataManage__9J2DScreen */ -u8 J2DScreen::mDataManage[4 + 4 /* padding */]; +J2DDataManage* J2DScreen::mDataManage; /* 802F9640-802F9690 2F3F80 0050+00 0/0 6/6 0/0 .text getNameResource__9J2DScreenFPCc */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DScreen::getNameResource(char const* param_0) { +asm void* J2DScreen::getNameResource(char const* param_0) { nofralloc #include "asm/JSystem/J2DGraph/J2DScreen/getNameResource__9J2DScreenFPCc.s" } @@ -674,37 +535,22 @@ asm void J2DScreen::setAnimation(J2DAnmTevRegKey* param_0) { /* 802F99A8-802F99C8 2F42E8 0020+00 1/0 0/0 0/0 .text setAnimation__9J2DScreenFP14J2DAnmVtxColor */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DScreen::setAnimation(J2DAnmVtxColor* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DScreen/setAnimation__9J2DScreenFP14J2DAnmVtxColor.s" +void J2DScreen::setAnimation(J2DAnmVtxColor* param_0) { + J2DPane::setVtxColorAnimation(param_0); } -#pragma pop /* 802F99C8-802F99E8 2F4308 0020+00 1/0 0/0 0/0 .text * setAnimation__9J2DScreenFP20J2DAnmVisibilityFull */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DScreen::setAnimation(J2DAnmVisibilityFull* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DScreen/setAnimation__9J2DScreenFP20J2DAnmVisibilityFull.s" +void J2DScreen::setAnimation(J2DAnmVisibilityFull* param_0) { + J2DPane::setVisibileAnimation(param_0); } -#pragma pop /* 802F99E8-802F9A18 2F4328 0030+00 1/0 0/0 0/0 .text * createPane__9J2DScreenFRC18J2DScrnBlockHeaderP20JSURandomInputStreamP7J2DPaneUl */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DScreen::createPane(J2DScrnBlockHeader const& param_0, JSURandomInputStream* param_1, - J2DPane* param_2, u32 param_3) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DScreen/createPane__9J2DScreenFRC18J2DScrnBlockHeaderP20JSURandomInputStreamP7J2DPaneUl.s" +void J2DScreen::createPane(J2DScrnBlockHeader const& param_0, JSURandomInputStream* param_1, + J2DPane* param_2, u32 param_3) { + createPane(param_0, param_1, param_2, param_3, NULL); } -#pragma pop /* 802F9A18-802F9A20 2F4358 0008+00 1/0 0/0 0/0 .text getTypeID__9J2DScreenCFv */ s32 J2DScreen::getTypeID() const { @@ -712,24 +558,14 @@ s32 J2DScreen::getTypeID() const { } /* 802F9A20-802F9A54 2F4360 0034+00 1/0 0/0 0/0 .text calcMtx__9J2DScreenFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DScreen::calcMtx() { - nofralloc -#include "asm/JSystem/J2DGraph/J2DScreen/calcMtx__9J2DScreenFv.s" +void J2DScreen::calcMtx() { + makeMatrix(mTranslateX, mTranslateY); } -#pragma pop /* 802F9A54-802F9A74 2F4394 0020+00 1/0 0/0 0/0 .text setAnimation__9J2DScreenFP10J2DAnmBase */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DScreen::setAnimation(J2DAnmBase* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DScreen/setAnimation__9J2DScreenFP10J2DAnmBase.s" +void J2DScreen::setAnimation(J2DAnmBase* param_0) { + J2DPane::setAnimation(param_0); } -#pragma pop /* 802F9A74-802F9A78 2F43B4 0004+00 1/0 0/0 0/0 .text * setAnimationVF__9J2DScreenFP20J2DAnmVisibilityFull */ diff --git a/libs/JSystem/J2DGraph/J2DTextBox.cpp b/libs/JSystem/J2DGraph/J2DTextBox.cpp index 26c004387e..bd7e7dfe77 100644 --- a/libs/JSystem/J2DGraph/J2DTextBox.cpp +++ b/libs/JSystem/J2DGraph/J2DTextBox.cpp @@ -6,140 +6,12 @@ #include "JSystem/J2DGraph/J2DTextBox.h" #include "dol2asm.h" #include "dolphin/types.h" +#include "msl_c/string.h" // // Types: // -struct _GXCullMode {}; - -struct ResTIMG {}; - -struct ResFONT {}; - -struct JUtility { - struct TColor {}; -}; - -struct JKRHeap {}; - -struct JUTResFont { - /* 802DEF94 */ JUTResFont(ResFONT const*, JKRHeap*); -}; - -struct JUTFont {}; - -struct JSUStreamSeekFrom {}; - -struct JSURandomInputStream { - /* 802DC458 */ void peek(void*, s32); - /* 802DC4DC */ void seek(s32, JSUStreamSeekFrom); -}; - -struct JSUInputStream { - /* 802DC298 */ void read(void*, s32); -}; - -struct JKRArchive {}; - -struct JGeometry { - template <typename A1> - struct TBox2 {}; - /* TBox2<f32> */ - struct TBox2__template0 {}; -}; - -struct J2DTextBoxVBinding {}; - -struct J2DTextBoxHBinding {}; - -struct J2DAnmTexPattern {}; - -struct J2DAnmVisibilityFull {}; - -struct J2DAnmBase {}; - -struct J2DAnmColor {}; - -struct J2DAnmTevRegKey {}; - -struct J2DAnmTextureSRTKey {}; - -struct J2DAnmTransform {}; - -struct J2DAnmVtxColor {}; - -struct J2DPane { - /* 80053BC0 */ void calcMtx(); - /* 80053C00 */ void makeMatrix(f32, f32); - /* 802F7540 */ void makeMatrix(f32, f32, f32, f32); - /* 80256018 */ void setAnimation(J2DAnmVtxColor*); - /* 8025601C */ void setAnimation(J2DAnmVisibilityFull*); - /* 80256020 */ void setAnimation(J2DAnmTexPattern*); - /* 8018BF28 */ void setAnimation(J2DAnmTextureSRTKey*); - /* 80126350 */ void setAnimation(J2DAnmTevRegKey*); - /* 80126354 */ void setAnimation(J2DAnmColor*); - /* 802F7EF4 */ void setAnimation(J2DAnmBase*); - /* 802F5E88 */ J2DPane(u64, JGeometry::TBox2<f32> const&); - /* 802F5BF8 */ J2DPane(); - /* 802F60C4 */ void makePaneStream(J2DPane*, JSURandomInputStream*); - /* 802F658C */ ~J2DPane(); - /* 802F6F60 */ void move(f32, f32); - /* 802F6FB4 */ void add(f32, f32); - /* 802F6FF8 */ void resize(f32, f32); - /* 802F72E0 */ void search(u64); - /* 802F7388 */ void searchUserInfo(u64); - /* 802F7430 */ void isUsed(ResTIMG const*); - /* 802F74B8 */ void isUsed(ResFONT const*); - /* 802F7680 */ void setCullBack(_GXCullMode); - /* 802F8428 */ void setCullBack(bool); - /* 802F7B18 */ void makePaneExStream(J2DPane*, JSURandomInputStream*); - /* 802F7DB8 */ void getPointer(JSURandomInputStream*, u32, JKRArchive*); - /* 802F8004 */ void clearAnmTransform(); - /* 802F8080 */ void animationTransform(J2DAnmTransform const*); - /* 802F8118 */ void setVisibileAnimation(J2DAnmVisibilityFull*); - /* 802F81A0 */ void setVtxColorAnimation(J2DAnmVtxColor*); - /* 802F8228 */ void animationPane(J2DAnmTransform const*); - /* 802F83D0 */ void setAnimationVF(J2DAnmVisibilityFull*); - /* 802F83FC */ void setAnimationVC(J2DAnmVtxColor*); - /* 802F8474 */ void update(); -}; - -struct J2DMaterial {}; - -struct J2DTextBox { - /* 80186C84 */ void setWhite(JUtility::TColor); - /* 8019230C */ void setBlackWhite(JUtility::TColor, JUtility::TColor); - /* 801DFA28 */ void getWhite() const; - /* 801DFA34 */ void getBlack() const; - /* 8021C7F4 */ void getFont() const; - /* 80254408 */ void setBlack(JUtility::TColor); - /* 8025602C */ bool getMaterial() const; - /* 802FFBC4 */ J2DTextBox(u64, JGeometry::TBox2<f32> const&, ResFONT const*, char const*, s16, - J2DTextBoxHBinding, J2DTextBoxVBinding); - /* 802FF6D8 */ J2DTextBox(J2DPane*, JSURandomInputStream*, JKRArchive*); - /* 802FF75C */ J2DTextBox(J2DPane*, JSURandomInputStream*, u32, J2DMaterial*); - /* 802FF660 */ J2DTextBox(); - /* 802FFC58 */ void initiate(ResFONT const*, char const*, s16, J2DTextBoxHBinding, - J2DTextBoxVBinding); - /* 802FFE88 */ void private_readStream(J2DPane*, JSURandomInputStream*, JKRArchive*); - /* 803001E0 */ ~J2DTextBox(); - /* 80300278 */ void setFont(JUTFont*); - /* 80300490 */ void draw(f32, f32, f32, J2DTextBoxHBinding); - /* 803002E8 */ void draw(f32, f32); - /* 80300658 */ void getStringPtr() const; - /* 8030074C */ void setString(s16, char const*, ...); - /* 80300660 */ void setString(char const*, ...); - /* 80300870 */ void setConnectParent(bool); - /* 80300950 */ void drawSelf(f32, f32, f32 (*)[3][4]); - /* 803008E8 */ void drawSelf(f32, f32); - /* 80300AF8 */ void resize(f32, f32); - /* 80300C70 */ void isUsed(ResTIMG const*); - /* 80300BFC */ void isUsed(ResFONT const*); - /* 80300C68 */ s32 getTypeID() const; - /* 80300C90 */ void rewriteAlpha(); -}; - struct J2DPrint { /* 802F4394 */ J2DPrint(JUTFont*, f32, f32, JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor); @@ -237,10 +109,7 @@ extern "C" void setAnimationVF__7J2DPaneFP20J2DAnmVisibilityFull(); extern "C" void setAnimationVC__7J2DPaneFP14J2DAnmVtxColor(); extern "C" void setCullBack__7J2DPaneFb(); extern "C" void update__7J2DPaneFv(); -extern "C" void PSMTXIdentity(); -extern "C" void PSMTXConcat(); extern "C" void GXSetTexCoordGen2(); -extern "C" void GXSetNumTexGens(); extern "C" void GXSetNumIndStages(); extern "C" void GXSetTevDirect(); extern "C" void GXLoadPosMtxImm(); @@ -255,9 +124,6 @@ extern "C" void _restgpr_26(); extern "C" void _restgpr_27(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); -extern "C" void strncpy(); -extern "C" void strcpy(); -extern "C" void strlen(); // // Declarations: @@ -318,25 +184,17 @@ SECTION_DATA extern void* __vt__10J2DTextBox[47 + 1 /* padding */] = { }; /* 802FF660-802FF6D8 2F9FA0 0078+00 0/0 1/1 0/0 .text __ct__10J2DTextBoxFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm J2DTextBox::J2DTextBox() { - nofralloc -#include "asm/JSystem/J2DGraph/J2DTextBox/__ct__10J2DTextBoxFv.s" +J2DTextBox::J2DTextBox() + : mFont(NULL), mCharColor(), mGradientColor(), mStringPtr(NULL), mWhiteColor(), mBlackColor() { + initiate(NULL, 0, 0, HBIND_LEFT, VBIND_TOP); } -#pragma pop /* 802FF6D8-802FF75C 2FA018 0084+00 0/0 1/1 0/0 .text * __ct__10J2DTextBoxFP7J2DPaneP20JSURandomInputStreamP10JKRArchive */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm J2DTextBox::J2DTextBox(J2DPane* param_0, JSURandomInputStream* param_1, JKRArchive* param_2) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DTextBox/__ct__10J2DTextBoxFP7J2DPaneP20JSURandomInputStreamP10JKRArchive.s" +J2DTextBox::J2DTextBox(J2DPane* param_0, JSURandomInputStream* param_1, JKRArchive* param_2) + : mFont(NULL), mCharColor(), mGradientColor(), mStringPtr(NULL), mWhiteColor(), mBlackColor() { + private_readStream(param_0, param_1, param_2); } -#pragma pop /* ############################################################################################## */ /* 80456280-80456288 004880 0004+04 6/6 0/0 0/0 .sdata2 @1660 */ @@ -367,16 +225,13 @@ asm J2DTextBox::J2DTextBox(J2DPane* param_0, JSURandomInputStream* param_1, u32 /* 802FFBC4-802FFC58 2FA504 0094+00 0/0 1/1 0/0 .text * __ct__10J2DTextBoxFUxRCQ29JGeometry8TBox2<f>PC7ResFONTPCcs18J2DTextBoxHBinding18J2DTextBoxVBinding */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm J2DTextBox::J2DTextBox(u64 param_0, JGeometry::TBox2<f32> const& param_1, - ResFONT const* param_2, char const* param_3, s16 param_4, - J2DTextBoxHBinding param_5, J2DTextBoxVBinding param_6) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DTextBox/func_802FFBC4.s" +J2DTextBox::J2DTextBox(u64 param_0, JGeometry::TBox2<f32> const& param_1, ResFONT const* param_2, + char const* param_3, s16 param_4, J2DTextBoxHBinding param_5, + J2DTextBoxVBinding param_6) + : J2DPane(param_0, param_1), mFont(NULL), mCharColor(), mGradientColor(), mStringPtr(NULL), + mWhiteColor(), mBlackColor() { + initiate(param_2, param_3, param_4, param_5, param_6); } -#pragma pop /* 802FFC58-802FFE88 2FA598 0230+00 2/2 1/0 0/0 .text * initiate__10J2DTextBoxFPC7ResFONTPCcs18J2DTextBoxHBinding18J2DTextBoxVBinding */ @@ -406,21 +261,23 @@ asm void J2DTextBox::private_readStream(J2DPane* param_0, JSURandomInputStream* #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm J2DTextBox::~J2DTextBox() { +// asm J2DTextBox::~J2DTextBox() { +extern "C" asm void __dt__10J2DTextBoxFv() { nofralloc #include "asm/JSystem/J2DGraph/J2DTextBox/__dt__10J2DTextBoxFv.s" } #pragma pop /* 80300278-803002E8 2FABB8 0070+00 1/0 0/0 0/0 .text setFont__10J2DTextBoxFP7JUTFont */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DTextBox::setFont(JUTFont* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DTextBox/setFont__10J2DTextBoxFP7JUTFont.s" +void J2DTextBox::setFont(JUTFont* pFont) { + if (pFont) { + if (mTextFontOwned) { + delete mFont; + } + mFont = pFont; + mTextFontOwned = false; + } } -#pragma pop /* ############################################################################################## */ /* 803A1C58-803A1C58 02E2B8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -451,54 +308,100 @@ asm void J2DTextBox::draw(f32 param_0, f32 param_1, f32 param_2, J2DTextBoxHBind #pragma pop /* 80300658-80300660 2FAF98 0008+00 0/0 62/62 2/2 .text getStringPtr__10J2DTextBoxCFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DTextBox::getStringPtr() const { - nofralloc -#include "asm/JSystem/J2DGraph/J2DTextBox/getStringPtr__10J2DTextBoxCFv.s" +char* J2DTextBox::getStringPtr() const { + return mStringPtr; } -#pragma pop /* 80300660-8030074C 2FAFA0 00EC+00 0/0 6/6 0/0 .text setString__10J2DTextBoxFPCce */ +// missing block of instructions before delete[] +#ifdef NONMATCHING +s32 J2DTextBox::setString(char const* 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); + } + return len; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DTextBox::setString(char const* param_0, ...) { +asm s32 J2DTextBox::setString(char const* param_0, ...) { nofralloc #include "asm/JSystem/J2DGraph/J2DTextBox/setString__10J2DTextBoxFPCce.s" } #pragma pop +#endif /* 8030074C-80300870 2FB08C 0124+00 0/0 41/41 2/2 .text setString__10J2DTextBoxFsPCce */ +#ifdef NONMATCHING +s32 J2DTextBox::setString(s16 param_0, char const* string, ...) { + delete[] mStringPtr; + mStringPtr = NULL; + + u32 len = strlen(string); + + if (param_0 == -1) { + if (len >= 0xFFFF) { + len = 0xFFFF - 1; + } + param_0 = len + 1; + } + + mStringLength = 0; + + if (param_0 != 0) { + char* tmp = new char[param_0]; + mStringPtr = tmp; + } + + if (mStringPtr) { + strncpy(mStringPtr, string, param_0 - 1); + mStringPtr[param_0 - 1] = 0; + mStringLength = param_0; + } + return len; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DTextBox::setString(s16 param_0, char const* param_1, ...) { +asm s32 J2DTextBox::setString(s16 param_0, char const* param_1, ...) { nofralloc #include "asm/JSystem/J2DGraph/J2DTextBox/setString__10J2DTextBoxFsPCce.s" } #pragma pop +#endif /* 80300870-803008E8 2FB1B0 0078+00 1/0 1/0 0/0 .text setConnectParent__10J2DTextBoxFb */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DTextBox::setConnectParent(bool param_0) { +asm bool J2DTextBox::setConnectParent(bool param_0) { nofralloc #include "asm/JSystem/J2DGraph/J2DTextBox/setConnectParent__10J2DTextBoxFb.s" } #pragma pop /* 803008E8-80300950 2FB228 0068+00 1/0 1/0 0/0 .text drawSelf__10J2DTextBoxFff */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DTextBox::drawSelf(f32 param_0, f32 param_1) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DTextBox/drawSelf__10J2DTextBoxFff.s" +void J2DTextBox::drawSelf(f32 param_0, f32 param_1) { + Mtx tmp; + PSMTXIdentity(tmp); + + drawSelf(param_0, param_1, &tmp); } -#pragma pop /* ############################################################################################## */ /* 80456298-804562A0 004898 0004+04 1/1 0/0 0/0 .sdata2 @2049 */ @@ -533,7 +436,7 @@ asm void J2DTextBox::resize(f32 param_0, f32 param_1) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J2DTextBox::isUsed(ResFONT const* param_0) { +asm bool J2DTextBox::isUsed(ResFONT const* param_0) { nofralloc #include "asm/JSystem/J2DGraph/J2DTextBox/isUsed__10J2DTextBoxFPC7ResFONT.s" } @@ -545,14 +448,9 @@ s32 J2DTextBox::getTypeID() const { } /* 80300C70-80300C90 2FB5B0 0020+00 1/0 0/0 0/0 .text isUsed__10J2DTextBoxFPC7ResTIMG */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J2DTextBox::isUsed(ResTIMG const* param_0) { - nofralloc -#include "asm/JSystem/J2DGraph/J2DTextBox/isUsed__10J2DTextBoxFPC7ResTIMG.s" +bool J2DTextBox::isUsed(ResTIMG const* param_0) { + return J2DPane::isUsed(param_0); } -#pragma pop /* 80300C90-80300C94 2FB5D0 0004+00 1/0 0/0 0/0 .text rewriteAlpha__10J2DTextBoxFv */ void J2DTextBox::rewriteAlpha() { diff --git a/libs/JSystem/JAudio2/JAISoundInfo.cpp b/libs/JSystem/JAudio2/JAISoundInfo.cpp index d23eb630b5..ce12f5c6c6 100644 --- a/libs/JSystem/JAudio2/JAISoundInfo.cpp +++ b/libs/JSystem/JAudio2/JAISoundInfo.cpp @@ -8,15 +8,6 @@ #include "dolphin/types.h" // -// Types: -// - -struct JAISoundInfo { - /* 802A2D34 */ JAISoundInfo(bool); - /* 802A2D50 */ ~JAISoundInfo(); -}; - -// // Forward References: // diff --git a/libs/JSystem/JAudio2/JASAudioReseter.cpp b/libs/JSystem/JAudio2/JASAudioReseter.cpp index 7a811aae21..ab89daf5d8 100644 --- a/libs/JSystem/JAudio2/JASAudioReseter.cpp +++ b/libs/JSystem/JAudio2/JASAudioReseter.cpp @@ -26,16 +26,6 @@ struct JASAudioThread { /* 8029CDC0 */ void stop(); }; -struct JASAudioReseter { - /* 8029D0B4 */ JASAudioReseter(); - /* 8029D0FC */ ~JASAudioReseter(); - /* 8029D138 */ void start(u32, bool); - /* 8029D1D4 */ void resume(); - /* 8029D1F8 */ void checkDone() const; - /* 8029D200 */ void calc(); - /* 8029D2D4 */ void callback(void*); -}; - // // Forward References: // diff --git a/libs/JSystem/JUtility/JUTFont.cpp b/libs/JSystem/JUtility/JUTFont.cpp index 6d3a9d433c..ba078e8ace 100644 --- a/libs/JSystem/JUtility/JUTFont.cpp +++ b/libs/JSystem/JUtility/JUTFont.cpp @@ -31,15 +31,15 @@ extern "C" extern void* __vt__7JUTFont[17]; /* 802DECF8-802DED24 2D9638 002C+00 0/0 2/2 0/0 .text __ct__7JUTFontFv */ JUTFont::JUTFont() : mColor1(), mColor2(), mColor3(), mColor4() { - unk4 = 0; + mValid = false; } /* 802DED24-802DED70 2D9664 004C+00 0/0 9/9 0/0 .text initialize_state__7JUTFontFv */ void JUTFont::initialize_state() { setCharColor(JUtility::TColor()); - unk5 = false; - unk8 = 0; - unk4 = false; + mFixed = false; + mFixedWidth = 0; + mValid = false; } /* 802DED70-802DEDC4 2D96B0 0054+00 1/1 3/3 0/0 .text setCharColor__7JUTFontFQ28JUtility6TColor */ diff --git a/libs/JSystem/JUtility/JUTPalette.cpp b/libs/JSystem/JUtility/JUTPalette.cpp index 4cb8693f04..6b1cd63333 100644 --- a/libs/JSystem/JUtility/JUTPalette.cpp +++ b/libs/JSystem/JUtility/JUTPalette.cpp @@ -1,93 +1,33 @@ -// -// Generated By: dol2asm -// Translation Unit: JUTPalette -// - #include "JSystem/JUtility/JUTPalette.h" -#include "dol2asm.h" -#include "dolphin/types.h" - -// -// Types: -// - -struct _GXTlutFmt {}; - -struct _GXTlut {}; - -struct ResTLUT {}; - -struct JUTTransparency {}; - -struct JUTPalette { - /* 802DE890 */ void storeTLUT(_GXTlut, ResTLUT*); - /* 802DE91C */ void storeTLUT(_GXTlut, _GXTlutFmt, JUTTransparency, u16, void*); - /* 802DE95C */ void load(); -}; - -// -// Forward References: -// - -extern "C" void storeTLUT__10JUTPaletteF7_GXTlutP7ResTLUT(); -extern "C" void storeTLUT__10JUTPaletteF7_GXTlut10_GXTlutFmt15JUTTransparencyUsPv(); -extern "C" void load__10JUTPaletteFv(); -extern "C" extern char const* const JUTPalette__stringBase0; - -// -// External References: -// - -extern "C" void OSPanic(); -extern "C" void GXInitTlutObj(); -extern "C" void GXLoadTlut(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_29(); - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 8039D360-8039D360 0299C0 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8039D360 = "JUTPalette.cpp"; -SECTION_DEAD static char const* const stringBase_8039D36F = "JUTTexture: TLUT is NULL\n"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_8039D389 = "\0\0\0\0\0\0"; -#pragma pop - -/* 802DE890-802DE91C 2D91D0 008C+00 0/0 8/8 0/0 .text storeTLUT__10JUTPaletteF7_GXTlutP7ResTLUT */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTPalette::storeTLUT(_GXTlut param_0, ResTLUT* param_1) { - nofralloc -#include "asm/JSystem/JUtility/JUTPalette/storeTLUT__10JUTPaletteF7_GXTlutP7ResTLUT.s" +#include "dolphin/os/OS.h" + +void JUTPalette::storeTLUT(_GXTlut param_0, ResTLUT* tlut) { + if (tlut == NULL) { + OSPanic("JUTPalette.cpp", 35, "JUTTexture: TLUT is NULL\n"); + } + mTlutName = param_0; + mFormat = tlut->format; + mTransparency = tlut->transparency; + mNumColors = tlut->numColors; + mColorTable = tlut + 8; + GXInitTlutObj(&mTlutObj, (void*)mColorTable, (GXTlutFmt)mFormat, mNumColors); } -#pragma pop -/* 802DE91C-802DE95C 2D925C 0040+00 0/0 3/3 0/0 .text - * storeTLUT__10JUTPaletteF7_GXTlut10_GXTlutFmt15JUTTransparencyUsPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTPalette::storeTLUT(_GXTlut param_0, _GXTlutFmt param_1, JUTTransparency param_2, - u16 param_3, void* param_4) { - nofralloc -#include "asm/JSystem/JUtility/JUTPalette/storeTLUT__10JUTPaletteF7_GXTlut10_GXTlutFmt15JUTTransparencyUsPv.s" +void JUTPalette::storeTLUT(_GXTlut param_0, _GXTlutFmt param_1, JUTTransparency param_2, + u16 param_3, void* param_4) { + mTlutName = param_0; + mFormat = param_1; + mTransparency = param_2; + mNumColors = param_3; + mColorTable = (ResTLUT*)param_4; + GXInitTlutObj(&mTlutObj, (void*)mColorTable, (GXTlutFmt)mFormat, mNumColors); } -#pragma pop -/* 802DE95C-802DE9A0 2D929C 0044+00 0/0 1/1 0/0 .text load__10JUTPaletteFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTPalette::load() { - nofralloc -#include "asm/JSystem/JUtility/JUTPalette/load__10JUTPaletteFv.s" -} -#pragma pop +bool JUTPalette::load() { + bool check = mNumColors != 0; + if (check) { + GXLoadTlut(&mTlutObj, mTlutName); + } -/* 8039D360-8039D360 0299C0 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ + return check; +} diff --git a/libs/JSystem/JUtility/JUTResFont.cpp b/libs/JSystem/JUtility/JUTResFont.cpp index d662c33417..10c2614859 100644 --- a/libs/JSystem/JUtility/JUTResFont.cpp +++ b/libs/JSystem/JUtility/JUTResFont.cpp @@ -8,62 +8,6 @@ #include "dolphin/types.h" // -// Types: -// - -struct _GXTexMapID {}; - -struct ResFONT {}; - -struct JUtility { - struct TColor {}; -}; - -struct JUTFont { - struct TWidth {}; - - /* 802DECF8 */ JUTFont(); - /* 802DED24 */ void initialize_state(); - /* 802E0108 */ bool isLeadByte_1Byte(int); - /* 802E0110 */ bool isLeadByte_2Byte(int); - /* 802E0118 */ void isLeadByte_ShiftJIS(int); -}; - -struct JKRHeap {}; - -struct JUTResFont { - /* 802DDFD8 */ void getResFont() const; - /* 802DDFE0 */ void getFontType() const; - /* 802DDFEC */ void getLeading() const; - /* 802DDFF8 */ void getWidth() const; - /* 802DE004 */ void getAscent() const; - /* 802DE010 */ void getDescent() const; - /* 802DE01C */ void getHeight() const; - /* 802DEF94 */ JUTResFont(ResFONT const*, JKRHeap*); - /* 802DEF48 */ JUTResFont(); - /* 802DF000 */ ~JUTResFont(); - /* 802DF08C */ void deleteMemBlocks_ResFont(); - /* 802DF0B0 */ void initialize_state(); - /* 802DF0DC */ void initiate(ResFONT const*, JKRHeap*); - /* 802DF13C */ void protected_initiate(ResFONT const*, JKRHeap*); - /* 802DF248 */ void countBlock(); - /* 802DF344 */ void setBlock(); - /* 802DF584 */ void setGX(JUtility::TColor, JUtility::TColor); - /* 802DF48C */ void setGX(); - /* 802DF7C4 */ void drawChar_scale(f32, f32, f32, f32, int, bool); - /* 802DFBE8 */ void loadFont(int, _GXTexMapID, JUTFont::TWidth*); - /* 802DFC64 */ void getWidthEntry(int, JUTFont::TWidth*) const; - /* 802DFD0C */ void getCellWidth() const; - /* 802DFD58 */ void getCellHeight() const; - /* 802DFDA4 */ void isLeadByte(int) const; - /* 802DFDD8 */ void getFontCode(int) const; - /* 802DFF60 */ void loadImage(int, _GXTexMapID); - /* 802E00C4 */ void convertSjis(int, u16*) const; - - static void* const saoAboutEncoding_[3]; -}; - -// // Forward References: // @@ -110,25 +54,7 @@ extern "C" void getHeight__10JUTResFontCFv(); extern "C" void __ct__7JUTFontFv(); extern "C" void initialize_state__7JUTFontFv(); extern "C" void JUTReportConsole(); -extern "C" void GXSetVtxDesc(); extern "C" void GXClearVtxDesc(); -extern "C" void GXSetVtxAttrFmt(); -extern "C" void GXSetNumTexGens(); -extern "C" void GXBegin(); -extern "C" void GXSetNumChans(); -extern "C" void GXSetChanCtrl(); -extern "C" void GXInitTexObj(); -extern "C" void GXInitTexObjLOD(); -extern "C" void GXLoadTexObj(); -extern "C" void GXSetTevOp(); -extern "C" void GXSetTevColorIn(); -extern "C" void GXSetTevAlphaIn(); -extern "C" void GXSetTevColorOp(); -extern "C" void GXSetTevAlphaOp(); -extern "C" void GXSetTevColor(); -extern "C" void GXSetTevOrder(); -extern "C" void GXSetNumTevStages(); -extern "C" void GXSetBlendMode(); extern "C" void _savegpr_25(); extern "C" void _savegpr_27(); extern "C" void _savegpr_28(); @@ -170,76 +96,107 @@ SECTION_DATA extern void* __vt__10JUTResFont[19 + 1 /* padding */] = { }; /* 802DEF48-802DEF94 2D9888 004C+00 0/0 1/1 0/0 .text __ct__10JUTResFontFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm JUTResFont::JUTResFont() { - nofralloc -#include "asm/JSystem/JUtility/JUTResFont/__ct__10JUTResFontFv.s" +JUTResFont::JUTResFont() { + initialize_state(); + JUTFont::initialize_state(); } -#pragma pop /* 802DEF94-802DF000 2D98D4 006C+00 0/0 10/10 0/0 .text __ct__10JUTResFontFPC7ResFONTP7JKRHeap */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm JUTResFont::JUTResFont(ResFONT const* param_0, JKRHeap* param_1) { - nofralloc -#include "asm/JSystem/JUtility/JUTResFont/__ct__10JUTResFontFPC7ResFONTP7JKRHeap.s" +JUTResFont::JUTResFont(ResFONT const* param_0, JKRHeap* param_1) { + initialize_state(); + JUTFont::initialize_state(); + initiate(param_0, param_1); } -#pragma pop /* 802DF000-802DF08C 2D9940 008C+00 1/0 2/2 0/0 .text __dt__10JUTResFontFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm JUTResFont::~JUTResFont() { - nofralloc -#include "asm/JSystem/JUtility/JUTResFont/__dt__10JUTResFontFv.s" +JUTResFont::~JUTResFont() { + if (mValid) { + deleteMemBlocks_ResFont(); + initialize_state(); + JUTFont::initialize_state(); + } } -#pragma pop /* 802DF08C-802DF0B0 2D99CC 0024+00 3/3 3/3 0/0 .text deleteMemBlocks_ResFont__10JUTResFontFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTResFont::deleteMemBlocks_ResFont() { - nofralloc -#include "asm/JSystem/JUtility/JUTResFont/deleteMemBlocks_ResFont__10JUTResFontFv.s" +void JUTResFont::deleteMemBlocks_ResFont() { + delete[] field_0x50; } -#pragma pop /* 802DF0B0-802DF0DC 2D99F0 002C+00 5/5 3/3 0/0 .text initialize_state__10JUTResFontFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTResFont::initialize_state() { - nofralloc -#include "asm/JSystem/JUtility/JUTResFont/initialize_state__10JUTResFontFv.s" +void JUTResFont::initialize_state() { + mResFont = NULL; + field_0x50 = NULL; + mWid1Ptr = NULL; + mGly1Ptr = NULL; + mMap1Ptr = NULL; + field_0x1c = NULL; + field_0x20 = NULL; + field_0x44 = -1; } -#pragma pop /* 802DF0DC-802DF13C 2D9A1C 0060+00 1/1 0/0 0/0 .text initiate__10JUTResFontFPC7ResFONTP7JKRHeap */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTResFont::initiate(ResFONT const* param_0, JKRHeap* param_1) { - nofralloc -#include "asm/JSystem/JUtility/JUTResFont/initiate__10JUTResFontFPC7ResFONTP7JKRHeap.s" +bool JUTResFont::initiate(ResFONT const* param_0, JKRHeap* param_1) { + if (!protected_initiate(param_0, param_1)) { + deleteMemBlocks_ResFont(); + initialize_state(); + JUTFont::initialize_state(); + mValid = false; + return false; + } else { + return true; + } } -#pragma pop /* 802DF13C-802DF248 2D9A7C 010C+00 1/1 0/0 0/0 .text * protected_initiate__10JUTResFontFPC7ResFONTP7JKRHeap */ +// regalloc +#ifdef NONMATCHING +bool JUTResFont::protected_initiate(ResFONT const* param_0, JKRHeap* param_1) { + delete_and_initialize(); + JUTFont::initialize_state(); + + if (!param_0) { + return false; + } else { + mResFont = param_0; + mValid = true; + + countBlock(); + + void* tmp = new (param_1, 0) void*[mWid1BlockNum + mGly1BlockNum + mMap1BlockNum]; + field_0x50 = tmp; + + if (!field_0x50) { + return false; + } else { + if (mWid1BlockNum != 0) { + mWid1Ptr = (ResFONT::WID1*)tmp; + (int*)tmp += mWid1BlockNum; + } + if (mGly1BlockNum != 0) { + mGly1Ptr = (ResFONT::GLY1*)tmp; + (int*)tmp += mGly1BlockNum; + } + if (mMap1BlockNum != 0) { + mMap1Ptr = (ResFONT::MAP1*)tmp; + } + setBlock(); + return true; + } + } + return false; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JUTResFont::protected_initiate(ResFONT const* param_0, JKRHeap* param_1) { +asm bool JUTResFont::protected_initiate(ResFONT const* param_0, JKRHeap* param_1) { nofralloc #include "asm/JSystem/JUtility/JUTResFont/protected_initiate__10JUTResFontFPC7ResFONTP7JKRHeap.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8039D45C-8039D45C 029ABC 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -284,25 +241,55 @@ asm void JUTResFont::setBlock() { #pragma pop /* 802DF48C-802DF584 2D9DCC 00F8+00 1/0 1/0 0/0 .text setGX__10JUTResFontFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTResFont::setGX() { - nofralloc -#include "asm/JSystem/JUtility/JUTResFont/setGX__10JUTResFontFv.s" +void JUTResFont::setGX() { + GXSetNumChans(1); + GXSetNumTevStages(1); + GXSetNumTexGens(1); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); + GXSetChanCtrl(GX_COLOR0A0, 0, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT0, GX_DF_NONE, GX_AF_NONE); + GXSetTevOp(GX_TEVSTAGE0, GX_MODULATE); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); + 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, 15); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); } -#pragma pop /* 802DF584-802DF7C4 2D9EC4 0240+00 1/0 1/0 0/0 .text * setGX__10JUTResFontFQ28JUtility6TColorQ28JUtility6TColor */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTResFont::setGX(JUtility::TColor param_0, JUtility::TColor param_1) { - nofralloc -#include "asm/JSystem/JUtility/JUTResFont/setGX__10JUTResFontFQ28JUtility6TColorQ28JUtility6TColor.s" +void JUTResFont::setGX(JUtility::TColor param_0, JUtility::TColor param_1) { + if (param_0 == 0 && param_1 == -1) { + setGX(); + } else { + GXSetNumChans(1); + GXSetNumTevStages(2); + GXSetNumTexGens(1); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL); + GXSetChanCtrl(GX_COLOR0A0, 0, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT0, GX_DF_NONE, GX_AF_NONE); + GXSetTevColor(GX_TEVREG0, param_0); + GXSetTevColor(GX_TEVREG1, param_1); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C0, GX_CC_C1, GX_CC_TEXC, GX_CC_ZERO); + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A0, GX_CA_A1, GX_CA_TEXA, 7); + 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, 7, GX_CA_APREV, GX_CA_TEXB, 7); + 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); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); + 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, 15); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + } } -#pragma pop /* ############################################################################################## */ /* 80455FF0-80455FF8 0045F0 0004+04 2/2 0/0 0/0 .sdata2 @647 */ @@ -323,8 +310,8 @@ SECTION_SDATA2 static f64 lit_651 = 4503599627370496.0 /* cast u32 to float */; #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JUTResFont::drawChar_scale(f32 param_0, f32 param_1, f32 param_2, f32 param_3, int param_4, - bool param_5) { +asm f32 JUTResFont::drawChar_scale(f32 param_0, f32 param_1, f32 param_2, f32 param_3, int param_4, + bool param_5) { nofralloc #include "asm/JSystem/JUtility/JUTResFont/drawChar_scale__10JUTResFontFffffib.s" } @@ -332,17 +319,37 @@ asm void JUTResFont::drawChar_scale(f32 param_0, f32 param_1, f32 param_2, f32 p /* 802DFBE8-802DFC64 2DA528 007C+00 1/1 0/0 0/0 .text * loadFont__10JUTResFontFi11_GXTexMapIDPQ27JUTFont6TWidth */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTResFont::loadFont(int param_0, _GXTexMapID param_1, JUTFont::TWidth* param_2) { - nofralloc -#include "asm/JSystem/JUtility/JUTResFont/loadFont__10JUTResFontFi11_GXTexMapIDPQ27JUTFont6TWidth.s" +void JUTResFont::loadFont(int param_0, _GXTexMapID param_1, JUTFont::TWidth* param_2) { + if (param_2 != 0) { + getWidthEntry(param_0, param_2); + } + + int code = getFontCode(param_0); + loadImage(code, param_1); } -#pragma pop /* 802DFC64-802DFD0C 2DA5A4 00A8+00 1/0 1/0 0/0 .text * getWidthEntry__10JUTResFontCFiPQ27JUTFont6TWidth */ +#ifdef NONMATCHING +void JUTResFont::getWidthEntry(int param_0, JUTFont::TWidth* param_1) const { + int code = getFontCode(param_0); + int tmp = 0; + param_1->field_0x0 = 0; + param_1->field_0x1 = mInf1Ptr->width; + + for (int i = mWid1BlockNum; i > 0; i--) { + if (i = 0) { + return; + } + + ResFONT::WID1* tmp2 = mWid1Ptr + tmp; + if (tmp2->startCode <= code && code <= tmp2->endCode) { + break; + } + tmp += 4; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -351,22 +358,38 @@ asm void JUTResFont::getWidthEntry(int param_0, JUTFont::TWidth* param_1) const #include "asm/JSystem/JUtility/JUTResFont/getWidthEntry__10JUTResFontCFiPQ27JUTFont6TWidth.s" } #pragma pop +#endif /* 802DFD0C-802DFD58 2DA64C 004C+00 1/0 1/0 0/0 .text getCellWidth__10JUTResFontCFv */ +// regalloc +#ifdef NONMATCING +u16 JUTResFont::getCellWidth() const { + u16 width; + + if (mGly1Ptr && mGly1Ptr->magic != 0) { + width = mGly1Ptr->cellWidth; + } else { + width = getWidth(); + } + + return width; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JUTResFont::getCellWidth() const { +asm u16 JUTResFont::getCellWidth() const { nofralloc #include "asm/JSystem/JUtility/JUTResFont/getCellWidth__10JUTResFontCFv.s" } #pragma pop +#endif /* 802DFD58-802DFDA4 2DA698 004C+00 1/0 1/0 0/0 .text getCellHeight__10JUTResFontCFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JUTResFont::getCellHeight() const { +asm u16 JUTResFont::getCellHeight() const { nofralloc #include "asm/JSystem/JUtility/JUTResFont/getCellHeight__10JUTResFontCFv.s" } @@ -376,7 +399,7 @@ asm void JUTResFont::getCellHeight() const { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JUTResFont::isLeadByte(int param_0) const { +asm bool JUTResFont::isLeadByte(int param_0) const { nofralloc #include "asm/JSystem/JUtility/JUTResFont/isLeadByte__10JUTResFontCFi.s" } @@ -585,7 +608,7 @@ COMPILER_STRIP_GATE(0x8039D39C, &halftofull); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JUTResFont::getFontCode(int param_0) const { +asm int JUTResFont::getFontCode(int param_0) const { nofralloc #include "asm/JSystem/JUtility/JUTResFont/getFontCode__10JUTResFontCFi.s" } @@ -625,7 +648,7 @@ bool JUTFont::isLeadByte_2Byte(int param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JUTFont::isLeadByte_ShiftJIS(int param_0) { +asm bool JUTFont::isLeadByte_ShiftJIS(int param_0) { nofralloc #include "asm/JSystem/JUtility/JUTResFont/isLeadByte_ShiftJIS__7JUTFontFi.s" } diff --git a/libs/JSystem/JUtility/JUTTexture.cpp b/libs/JSystem/JUtility/JUTTexture.cpp index be9a985b67..1fb148939d 100644 --- a/libs/JSystem/JUtility/JUTTexture.cpp +++ b/libs/JSystem/JUtility/JUTTexture.cpp @@ -8,35 +8,6 @@ #include "dolphin/types.h" // -// Types: -// - -struct _GXTlutFmt {}; - -struct _GXTlut {}; - -struct _GXTexMapID {}; - -struct JUTTransparency {}; - -struct JUTPalette { - /* 802DE91C */ void storeTLUT(_GXTlut, _GXTlutFmt, JUTTransparency, u16, void*); - /* 802DE95C */ void load(); -}; - -struct JUTTexture { - /* 802DE234 */ ~JUTTexture(); - /* 802DE480 */ void storeTIMG(ResTIMG const*, JUTPalette*, _GXTlut); - /* 802DE2A8 */ void storeTIMG(ResTIMG const*, u8); - /* 802DE44C */ void storeTIMG(ResTIMG const*, JUTPalette*); - /* 802DE5B0 */ void attachPalette(JUTPalette*); - /* 802DE608 */ void init(); - /* 802DE744 */ void initTexObj(_GXTlut); - /* 802DE658 */ void initTexObj(); - /* 802DE840 */ void load(_GXTexMapID); -}; - -// // Forward References: // @@ -59,10 +30,7 @@ extern "C" void __dl__FPv(); extern "C" void __dla__FPv(); extern "C" void storeTLUT__10JUTPaletteF7_GXTlut10_GXTlutFmt15JUTTransparencyUsPv(); extern "C" void load__10JUTPaletteFv(); -extern "C" void GXInitTexObj(); extern "C" void GXInitTexObjCI(); -extern "C" void GXInitTexObjLOD(); -extern "C" void GXLoadTexObj(); extern "C" void _savegpr_29(); extern "C" void _restgpr_29(); @@ -71,16 +39,68 @@ extern "C" void _restgpr_29(); // /* 802DE234-802DE2A8 2D8B74 0074+00 0/0 30/30 0/0 .text __dt__10JUTTextureFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm JUTTexture::~JUTTexture() { - nofralloc -#include "asm/JSystem/JUtility/JUTTexture/__dt__10JUTTextureFv.s" +JUTTexture::~JUTTexture() { + if (getCaptureFlag()) { + delete[] field_0x3c; + } + if (getEmbPaletteDelFlag()) { + delete mEmbPalette; + } } -#pragma pop /* 802DE2A8-802DE44C 2D8BE8 01A4+00 0/0 18/18 0/0 .text storeTIMG__10JUTTextureFPC7ResTIMGUc */ +#ifdef NONMATCHING +void JUTTexture::storeTIMG(ResTIMG const* param_0, u8 param_1) { + _GXTlut tlut; + + if (param_0 && param_1 < 0x10) { + mTexInfo = param_0; + mTexData = (void*)((int)mTexInfo + mTexInfo->texDataOffset); + + if (mTexInfo->texDataOffset == 0) { + mTexData = (void*)((int)mTexInfo + 0x20); + } + + field_0x2c = NULL; + mTlutName = 0; + mWrapS = mTexInfo->wrapS; + mWrapT = mTexInfo->wrapT; + mMinFilter = mTexInfo->minFilter; + mMagFilter = mTexInfo->magFilter; + mMinLOD = (s8)mTexInfo->minLOD; + mMaxLOD = (s8)mTexInfo->maxLOD; + mLODBias = mTexInfo->LODBias; + + ResTIMG* tmp = (ResTIMG*)mTexInfo; + + if (mTexInfo->paletteCount == 0) { + initTexObj(); + } else { + if (mTexInfo->paletteCount > 0x100) { + tlut = (_GXTlut)param_1; + } else { + tlut = (_GXTlut)((param_1 & 3) + GX_BIGTLUT0); + } + + if (mEmbPalette == NULL || !getEmbPaletteDelFlag()) { + JUTPalette* palette = new JUTPalette(); + if (palette) { + palette->storeTLUT(tlut, (_GXTlutFmt)tmp->paletteFormat, + (JUTTransparency)tmp->alphaEnabled, tmp->paletteCount, + (void*)(tmp->format + tmp->paletteOffset)); + } + mEmbPalette = palette; + mFlags = mFlags & 1 | 2; + } else { + mEmbPalette->storeTLUT(tlut, (_GXTlutFmt)tmp->paletteFormat, + (JUTTransparency)tmp->alphaEnabled, tmp->paletteCount, + (void*)(tmp->format + tmp->paletteOffset)); + } + attachPalette(mEmbPalette); + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -89,17 +109,20 @@ asm void JUTTexture::storeTIMG(ResTIMG const* param_0, u8 param_1) { #include "asm/JSystem/JUtility/JUTTexture/storeTIMG__10JUTTextureFPC7ResTIMGUc.s" } #pragma pop +#endif /* 802DE44C-802DE480 2D8D8C 0034+00 0/0 6/6 0/0 .text * storeTIMG__10JUTTextureFPC7ResTIMGP10JUTPalette */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTTexture::storeTIMG(ResTIMG const* param_0, JUTPalette* param_1) { - nofralloc -#include "asm/JSystem/JUtility/JUTTexture/storeTIMG__10JUTTextureFPC7ResTIMGP10JUTPalette.s" +void JUTTexture::storeTIMG(ResTIMG const* param_0, JUTPalette* param_1) { + _GXTlut type; + + if (param_1 != NULL) { + type = (_GXTlut)param_1->getTlutName(); + } else { + type = GX_TLUT0; + } + storeTIMG(param_0, param_1, type); } -#pragma pop /* 802DE480-802DE5B0 2D8DC0 0130+00 1/1 3/3 0/0 .text * storeTIMG__10JUTTextureFPC7ResTIMGP10JUTPalette7_GXTlut */ @@ -113,24 +136,31 @@ asm void JUTTexture::storeTIMG(ResTIMG const* param_0, JUTPalette* param_1, _GXT #pragma pop /* 802DE5B0-802DE608 2D8EF0 0058+00 1/1 7/7 0/0 .text attachPalette__10JUTTextureFP10JUTPalette */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTTexture::attachPalette(JUTPalette* param_0) { - nofralloc -#include "asm/JSystem/JUtility/JUTTexture/attachPalette__10JUTTextureFP10JUTPalette.s" +void JUTTexture::attachPalette(JUTPalette* param_0) { + if (mTexInfo->palettesEnabled) { + if (param_0 == NULL && mEmbPalette != NULL) { + field_0x2c = mEmbPalette; + } else { + field_0x2c = param_0; + } + _GXTlut name = (_GXTlut)field_0x2c->getTlutName(); + initTexObj(name); + } } -#pragma pop /* 802DE608-802DE658 2D8F48 0050+00 1/1 0/0 0/0 .text init__10JUTTextureFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTTexture::init() { - nofralloc -#include "asm/JSystem/JUtility/JUTTexture/init__10JUTTextureFv.s" +void JUTTexture::init() { + if (mTexInfo->paletteCount == 0) { + initTexObj(); + } else { + if (mEmbPalette != NULL) { + field_0x2c = mEmbPalette; + + _GXTlut name = (_GXTlut)field_0x2c->getTlutName(); + initTexObj(name); + } + } } -#pragma pop /* ############################################################################################## */ /* 80455FD8-80455FDC 0045D8 0004+00 2/2 0/0 0/0 .sdata2 @453 */ @@ -146,6 +176,24 @@ SECTION_SDATA2 static f64 lit_456 = 4503599627370496.0 /* cast u32 to float */; SECTION_SDATA2 static f64 lit_459 = 4503601774854144.0 /* cast s32 to float */; /* 802DE658-802DE744 2D8F98 00EC+00 2/2 0/0 0/0 .text initTexObj__10JUTTextureFv */ +#ifdef NONMATCHING +void JUTTexture::initTexObj() { + int offset; + + if (mTexInfo->mipmapEnabled) { + offset = mTexInfo->texDataOffset; + } else { + offset = 0x20; + } + + GXInitTexObj(mTexObj, &mTexInfo + offset, mTexInfo->width, mTexInfo->height, + (GXTexFmt)mTexInfo->format, (GXTexWrapMode)mTexInfo->wrapS, + (GXTexWrapMode)mTexInfo->wrapT, mTexInfo->mipmapEnabled); + GXInitTexObjLOD(mTexObj, (GXTexFilter)mTexInfo->minFilter, (GXTexFilter)mTexInfo->magFilter, + mTexInfo->minLOD, mTexInfo->maxLOD, mTexInfo->LODBias, mTexInfo->biasClamp, + mTexInfo->doEdgeLOD, (GXAnisotropy)mTexInfo->maxAnisotropy); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -154,6 +202,7 @@ asm void JUTTexture::initTexObj() { #include "asm/JSystem/JUtility/JUTTexture/initTexObj__10JUTTextureFv.s" } #pragma pop +#endif /* 802DE744-802DE840 2D9084 00FC+00 2/2 0/0 0/0 .text initTexObj__10JUTTextureF7_GXTlut */ @@ -168,11 +217,9 @@ asm void JUTTexture::initTexObj(_GXTlut param_0) { /* 802DE840-802DE890 2D9180 0050+00 0/0 14/14 0/0 .text load__10JUTTextureF11_GXTexMapID */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void JUTTexture::load(_GXTexMapID param_0) { - nofralloc -#include "asm/JSystem/JUtility/JUTTexture/load__10JUTTextureF11_GXTexMapID.s" +void JUTTexture::load(_GXTexMapID param_0) { + if (field_0x2c) { + field_0x2c->load(); + } + GXLoadTexObj(&mTexObj, param_0); } -#pragma pop diff --git a/libs/Z2AudioLib/Z2AudioMgr.cpp b/libs/Z2AudioLib/Z2AudioMgr.cpp index 1e253033bd..568ca39d77 100644 --- a/libs/Z2AudioLib/Z2AudioMgr.cpp +++ b/libs/Z2AudioLib/Z2AudioMgr.cpp @@ -16,10 +16,6 @@ struct Z2SpeechMgr2 { /* 802CC9D0 */ void framework(); }; -struct Z2SoundObjMgr { - /* 802BF920 */ Z2SoundObjMgr(); -}; - struct Z2SoundMgr { /* 802A9E80 */ Z2SoundMgr(); /* 802AA67C */ void framework(); @@ -134,13 +130,6 @@ struct JASDriver { /* 8029E178 */ void setOutputMode(u32); }; -struct JASAudioReseter { - /* 8029D0B4 */ JASAudioReseter(); - /* 8029D138 */ void start(u32, bool); - /* 8029D1D4 */ void resume(); - /* 8029D1F8 */ void checkDone() const; -}; - struct JASAramStream { static u8 sBlockSize[4]; }; diff --git a/libs/Z2AudioLib/Z2EnvSeMgr.cpp b/libs/Z2AudioLib/Z2EnvSeMgr.cpp index 97532c0456..515de1317e 100644 --- a/libs/Z2AudioLib/Z2EnvSeMgr.cpp +++ b/libs/Z2AudioLib/Z2EnvSeMgr.cpp @@ -42,8 +42,6 @@ struct Z2SoundMgr { struct JAISoundID {}; -struct Vec {}; - struct Z2SeMgr { /* 802AB984 */ void seStart(JAISoundID, Vec const*, u32, s8, f32, f32, f32, f32, u8); }; @@ -57,44 +55,6 @@ struct Z2MultiSeMgr { /* 802AEDC0 */ void getDolbyPower(); }; -struct Z2EnvSeMgr { - /* 802C611C */ Z2EnvSeMgr(); - /* 802C6540 */ ~Z2EnvSeMgr(); - /* 802C66B0 */ void framework(); - /* 802C6998 */ void resetScene(); - /* 802C699C */ void resetSceneInner(); - /* 802C6AC0 */ void initSceneEnvSe(s32, s8, f32); - /* 802C6C1C */ void playSceneEnvSe(); - /* 802C6C84 */ void initStaticEnvSe(u8, u8, u8, u8, Vec*); - /* 802C70C8 */ void startStaticEnvSe(s8); - /* 802C780C */ void registWindowPos(Vec*); - /* 802C7830 */ void startRainSe(s32, s8); - /* 802C7CF4 */ void startNearThunderSe(s8); - /* 802C7E68 */ void startFarThunderSe(Vec*, s8); - /* 802C7FB4 */ void setSnowPower(s8); - /* 802C7FBC */ void initStrongWindSe(); - /* 802C7FC8 */ void setWindDirection(Vec*); - /* 802C800C */ void startStrongWindSe(s8); - /* 802C80F8 */ void initRiverSe(u8, u8, u8, u8); - /* 802C8234 */ void registRiverSePos(Vec*); - /* 802C8258 */ void setHyrulSewerOpen(bool); - /* 802C8300 */ void startRiverSe(s8); - /* 802C8730 */ void initFallSe(u8, u8, u8, u8); - /* 802C886C */ void registFallSePos(Vec*); - /* 802C8890 */ void startFallSe(s8); - /* 802C8A90 */ void initEtcSe(u8, u8, u8, u8); - /* 802C8C24 */ void registEtcSePos(Vec*); - /* 802C8C48 */ void startEtcSe(s8); - /* 802C92C8 */ void registWolfSmellSePos(Vec*); - /* 802C92EC */ void startFogWipeTrigger(Vec*); - /* 802C93A0 */ void setFogWipeWidth(f32); - /* 802C93E4 */ void getFogDensity(); - /* 802C9400 */ void startFogSe(); - /* 802C950C */ void initLv3WaterSe(u8, u8, u8, u8); - /* 802C9F58 */ void registLv3WaterSePos(u8, Vec*); - /* 802CA794 */ void startLv3WaterSe(s8); -}; - struct Z2EnvSeDir { /* 802C5C9C */ Z2EnvSeDir(Vec*); /* 802C5D1C */ ~Z2EnvSeDir(); |
