diff --git a/configure.py b/configure.py index 6f3cdf734..898365920 100644 --- a/configure.py +++ b/configure.py @@ -201,14 +201,21 @@ LIBS = [ "objects": [ NonMatching("JSystem/JFramework/JFWDisplay.cpp"), NonMatching("JSystem/JFramework/JFWSystem.cpp"), + Matching ("JSystem/J3DU/J3DUDL.cpp"), + NonMatching("JSystem/JParticle/JPATexture.cpp"), Matching ("JSystem/JKernel/JKRFile.cpp"), Matching ("JSystem/JSupport/JSUList.cpp"), NonMatching("JSystem/JSupport/JSUInputStream.cpp"), Matching ("JSystem/JSupport/JSUMemoryStream.cpp"), Matching ("JSystem/JSupport/JSUFileStream.cpp"), - Matching ("JSystem/JUtility/JUTNameTab.cpp"), + Matching ("JSystem/JUtility/JUTResource.cpp"), + Matching ("JSystem/JUtility/JUTTexture.cpp"), Matching ("JSystem/JUtility/JUTPalette.cpp"), - NonMatching("JSystem/JParticle/JPATexture.cpp"), + Matching ("JSystem/JUtility/JUTNameTab.cpp"), + Matching ("JSystem/JUtility/JUTGraphFifo.cpp"), + Matching ("JSystem/JUtility/JUTFont.cpp"), + NonMatching("JSystem/J2DGraph/J2DGrafContext.cpp"), + NonMatching("JSystem/J2DGraph/J2DOrthoGraph.cpp"), ], }, { diff --git a/include/JSystem/J2DGraph/J2DGrafContext.h b/include/JSystem/J2DGraph/J2DGrafContext.h index 1d41b5098..244aaf56e 100644 --- a/include/JSystem/J2DGraph/J2DGrafContext.h +++ b/include/JSystem/J2DGraph/J2DGrafContext.h @@ -14,33 +14,32 @@ public: /* 0x2 */ u8 mDstFactor; }; - - /* 802E8B08 */ J2DGrafContext(f32 x, f32 y, f32 width, f32 height); - /* 802E90C0 */ void scissor(JGeometry::TBox2 const& bounds); + J2DGrafContext(f32 x, f32 y, f32 width, f32 height); + void scissor(JGeometry::TBox2 const& bounds); void setColor(JUtility::TColor c) { this->setColor(c, c, c, c); } - /* 802E9118 */ void setColor(JUtility::TColor colorTL, JUtility::TColor colorTR, - JUtility::TColor colorBR, JUtility::TColor colorBL); - /* 802E9234 */ void setLineWidth(u8); - /* 802E9260 */ void fillBox(JGeometry::TBox2 const& box); - /* 802E9368 */ void drawFrame(JGeometry::TBox2 const& box); - /* 802E9488 */ void line(JGeometry::TVec2 start, JGeometry::TVec2 end); - /* 802E9564 */ void lineTo(JGeometry::TVec2 pos); + void setColor(JUtility::TColor colorTL, JUtility::TColor colorTR, JUtility::TColor colorBR, + JUtility::TColor colorBL); + void setLineWidth(u8); + void fillBox(JGeometry::TBox2 const& box); + void drawFrame(JGeometry::TBox2 const& box); + void line(JGeometry::TVec2 start, JGeometry::TVec2 end); + void lineTo(JGeometry::TVec2 pos); void lineTo(f32 x, f32 y) { this->lineTo(JGeometry::TVec2(x, y)); } void moveTo(f32 x, f32 y) { this->moveTo(JGeometry::TVec2(x, y)); } void moveTo(JGeometry::TVec2 pos) { mPrevPos = pos; } - /* 802E95D4 */ virtual ~J2DGrafContext() {} - /* 802E90E4 */ virtual void place(JGeometry::TBox2 const& bounds); - /* 802E961C */ virtual void place(f32 x, f32 y, f32 width, f32 height) { + virtual ~J2DGrafContext() {} + virtual void place(JGeometry::TBox2 const& bounds); + virtual void place(f32 x, f32 y, f32 width, f32 height) { JGeometry::TBox2 box(x, y, x + width, y + height); this->place(box); } - /* 802E8BB4 */ virtual void setPort(); - /* 802E8C44 */ virtual void setup2D(); - /* 802E8E20 */ virtual void setScissor(); - /* 802E9664 */ virtual s32 getGrafType() const { return 0; } - /* 802E966C */ virtual void setLookat() {} + virtual void setPort(); + virtual void setup2D(); + virtual void setScissor(); + virtual s32 getGrafType() const { return 0; } + virtual void setLookat() {} public: /* 0x04 */ JGeometry::TBox2 mBounds; diff --git a/include/JSystem/J3DGraphBase/J3DShapeMtx.h b/include/JSystem/J3DGraphBase/J3DShapeMtx.h index 5f23e39db..029e73ece 100644 --- a/include/JSystem/J3DGraphBase/J3DShapeMtx.h +++ b/include/JSystem/J3DGraphBase/J3DShapeMtx.h @@ -11,12 +11,12 @@ public: Mtx& getMtx(u16 idx) { return mpTexMtx[idx]; } private: - /* 0x00 */ Mtx *mpTexMtx; + /* 0x00 */ Mtx* mpTexMtx; }; class J3DDifferedTexMtx { public: - /* 8031322C */ static void loadExecute(f32 const (*)[4]); + static void loadExecute(f32 const (*)[4]); static inline void load(Mtx m) { if (sTexGenBlock != NULL) @@ -34,22 +34,20 @@ extern u8 struct_804515B3; class J3DShapeMtx { public: - J3DShapeMtx(u16 useMtxIndex) - : mUseMtxIndex(useMtxIndex) - {} + J3DShapeMtx(u16 useMtxIndex) : mUseMtxIndex(useMtxIndex) {} - /* 803130A8 */ void resetMtxLoadCache(); - /* 803130E4 */ void loadMtxIndx_PNGP(int, u16) const; - /* 80313128 */ void loadMtxIndx_PCPU(int, u16) const; - /* 80313188 */ void loadMtxIndx_NCPU(int, u16) const; - /* 803131D4 */ void loadMtxIndx_PNCPU(int, u16) const; + void resetMtxLoadCache(); + void loadMtxIndx_PNGP(int, u16) const; + void loadMtxIndx_PCPU(int, u16) const; + void loadMtxIndx_NCPU(int, u16) const; + void loadMtxIndx_PNCPU(int, u16) const; - /* 80314798 */ virtual ~J3DShapeMtx(); - /* 803147E0 */ virtual u32 getType() const; - /* 80273E08 */ virtual u32 getUseMtxNum() const; - /* 8031459C */ virtual u32 getUseMtxIndex(u16) const; - /* 80313B94 */ virtual void load() const; - /* 80313BF0 */ virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]); + virtual ~J3DShapeMtx(); + virtual u32 getType() const; + virtual u32 getUseMtxNum() const; + virtual u32 getUseMtxIndex(u16) const; + virtual void load() const; + virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]); static u8 sMtxLoadPipeline[48]; static u16 sMtxLoadCache[10 + 2 /* padding */]; @@ -69,21 +67,19 @@ private: class J3DShapeMtxConcatView : public J3DShapeMtx { public: - J3DShapeMtxConcatView(u16 useMtxIndex) - : J3DShapeMtx(useMtxIndex) - {} + J3DShapeMtxConcatView(u16 useMtxIndex) : J3DShapeMtx(useMtxIndex) {} - /* 80314730 */ virtual ~J3DShapeMtxConcatView(); - /* 803147E0 */ virtual u32 getType() const; - /* 80313C54 */ virtual void load() const; - /* 80314598 */ virtual void loadNrmMtx(int, u16) const; - /* 80313D28 */ virtual void loadNrmMtx(int, u16, f32 (*)[4]) const; + virtual ~J3DShapeMtxConcatView(); + virtual u32 getType() const; + virtual void load() const; + virtual void loadNrmMtx(int, u16) const; + virtual void loadNrmMtx(int, u16, f32 (*)[4]) const; - /* 80313828 */ void loadMtxConcatView_PNGP(int, u16) const; - /* 803138C8 */ void loadMtxConcatView_PCPU(int, u16) const; - /* 8031396C */ void loadMtxConcatView_NCPU(int, u16) const; - /* 80313A14 */ void loadMtxConcatView_PNCPU(int, u16) const; - /* 80313AC8 */ void loadMtxConcatView_PNGP_LOD(int, u16) const; + void loadMtxConcatView_PNGP(int, u16) const; + void loadMtxConcatView_PCPU(int, u16) const; + void loadMtxConcatView_NCPU(int, u16) const; + void loadMtxConcatView_PNCPU(int, u16) const; + void loadMtxConcatView_PNGP_LOD(int, u16) const; static u8 sMtxLoadPipeline[48]; static u8 sMtxLoadLODPipeline[48]; @@ -92,40 +88,33 @@ public: class J3DShapeMtxYBBoardConcatView : public J3DShapeMtxConcatView { public: - J3DShapeMtxYBBoardConcatView(u16 useMtxIndex) - : J3DShapeMtxConcatView(useMtxIndex) - {} + J3DShapeMtxYBBoardConcatView(u16 useMtxIndex) : J3DShapeMtxConcatView(useMtxIndex) {} - /* 80314520 */ virtual ~J3DShapeMtxYBBoardConcatView(); - /* 803147E0 */ virtual u32 getType() const; - /* 803143E4 */ virtual void load() const; + virtual ~J3DShapeMtxYBBoardConcatView(); + virtual u32 getType() const; + virtual void load() const; }; class J3DShapeMtxBBoardConcatView : public J3DShapeMtxConcatView { public: - J3DShapeMtxBBoardConcatView(u16 useMtxIndex) - : J3DShapeMtxConcatView(useMtxIndex) - {} + J3DShapeMtxBBoardConcatView(u16 useMtxIndex) : J3DShapeMtxConcatView(useMtxIndex) {} - /* 803145A4 */ virtual ~J3DShapeMtxBBoardConcatView(); - /* 803147E0 */ virtual u32 getType() const; - /* 803142D4 */ virtual void load() const; + virtual ~J3DShapeMtxBBoardConcatView(); + virtual u32 getType() const; + virtual void load() const; }; class J3DShapeMtxMulti : public J3DShapeMtx { public: J3DShapeMtxMulti(u16 useMtxIndex, u16 useMtxNum, u16* useMtxIndexTable) - : J3DShapeMtx(useMtxIndex) - , mUseMtxNum(useMtxNum) - , mUseMtxIndexTable(useMtxIndexTable) - {} + : J3DShapeMtx(useMtxIndex), mUseMtxNum(useMtxNum), mUseMtxIndexTable(useMtxIndexTable) {} - /* 803146B0 */ virtual ~J3DShapeMtxMulti(); - /* 803147E0 */ virtual u32 getType() const; - /* 80273E08 */ virtual u32 getUseMtxNum() const; - /* 8031459C */ virtual u32 getUseMtxIndex(u16) const; - /* 80313E4C */ virtual void load() const; - /* 80313EEC */ virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]); + virtual ~J3DShapeMtxMulti(); + virtual u32 getType() const; + virtual u32 getUseMtxNum() const; + virtual u32 getUseMtxIndex(u16) const; + virtual void load() const; + virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]); private: /* 0x6 */ u16 mUseMtxNum; @@ -135,18 +124,16 @@ private: class J3DShapeMtxMultiConcatView : public J3DShapeMtxConcatView { public: J3DShapeMtxMultiConcatView(u16 useMtxIndex, u16 useMtxNum, u16* useMtxIndexTable) - : J3DShapeMtxConcatView(useMtxIndex) - , mUseMtxNum(useMtxNum) - , mUseMtxIndexTable(useMtxIndexTable) - {} + : J3DShapeMtxConcatView(useMtxIndex), mUseMtxNum(useMtxNum), + mUseMtxIndexTable(useMtxIndexTable) {} - /* 8031461C */ virtual ~J3DShapeMtxMultiConcatView(); - /* 803147E0 */ virtual u32 getType() const; - /* 80273E08 */ virtual u32 getUseMtxNum() const; - /* 8031459C */ virtual u32 getUseMtxIndex(u16) const; - /* 80313FA4 */ virtual void load() const; - /* 803146AC */ virtual void loadNrmMtx(int, u16) const; - /* 8031419C */ virtual void loadNrmMtx(int, u16, f32 (*)[4]) const; + virtual ~J3DShapeMtxMultiConcatView(); + virtual u32 getType() const; + virtual u32 getUseMtxNum() const; + virtual u32 getUseMtxIndex(u16) const; + virtual void load() const; + virtual void loadNrmMtx(int, u16) const; + virtual void loadNrmMtx(int, u16, f32 (*)[4]) const; private: /* 0x6 */ u16 mUseMtxNum; diff --git a/include/JSystem/JUtility/JUTGraphFifo.h b/include/JSystem/JUtility/JUTGraphFifo.h index 6304ec0a5..aab9ae642 100644 --- a/include/JSystem/JUtility/JUTGraphFifo.h +++ b/include/JSystem/JUtility/JUTGraphFifo.h @@ -5,9 +5,8 @@ class JUTGraphFifo { public: - /* 802DEB58 */ JUTGraphFifo(u32); - - /* 802DEC34 */ virtual ~JUTGraphFifo(); + JUTGraphFifo(u32); + virtual ~JUTGraphFifo(); void getGpStatus() { GXGetGPStatus((GXBool*)&mGpStatus[0], (GXBool*)&mGpStatus[1], (GXBool*)&mGpStatus[2], @@ -21,6 +20,7 @@ public: void save() { GXSaveCPUFifo(this->mFifo); } + static bool sInitiated; static JUTGraphFifo* sCurrentFifo; static bool mGpStatus[5]; @@ -31,6 +31,8 @@ private: /* 0x10 */ u8 field_0x10[0xC]; }; -inline void JUTCreateFifo(u32 bufSize) { new JUTGraphFifo(bufSize); } +inline void JUTCreateFifo(u32 bufSize) { + new JUTGraphFifo(bufSize); +} #endif /* JUTGRAPHFIFO_H */ diff --git a/include/JSystem/JUtility/JUTPalette.h b/include/JSystem/JUtility/JUTPalette.h index 4a3d297bc..2eb547504 100644 --- a/include/JSystem/JUtility/JUTPalette.h +++ b/include/JSystem/JUtility/JUTPalette.h @@ -18,13 +18,11 @@ public: this->storeTLUT(p1, p2, p3, p4, p5); } - JUTPalette(GXTlut tlutNo, ResTLUT* p_tlutRes) { - storeTLUT(tlutNo, p_tlutRes); - } + JUTPalette(GXTlut tlutNo, ResTLUT* p_tlutRes) { storeTLUT(tlutNo, p_tlutRes); } - /* 802DE890 */ void storeTLUT(_GXTlut, ResTLUT*); - /* 802DE91C */ void storeTLUT(_GXTlut, _GXTlutFmt, JUTTransparency, u16, void*); - /* 802DE95C */ bool load(); + void storeTLUT(_GXTlut, ResTLUT*); + void storeTLUT(_GXTlut, _GXTlutFmt, JUTTransparency, u16, void*); + bool load(); u8 getTlutName() const { return mTlutName; } u8 getFormat() const { return mFormat; } diff --git a/include/JSystem/JUtility/JUTResource.h b/include/JSystem/JUtility/JUTResource.h index 8a6b3120c..a352d9afd 100644 --- a/include/JSystem/JUtility/JUTResource.h +++ b/include/JSystem/JUtility/JUTResource.h @@ -8,9 +8,9 @@ class JSUInputStream; class JUTResReference { private: - /* 0x001 */ u8 mType; - /* 0x002 */ u8 mNameLength; - /* 0x003 */ char mName[0x100]; + /* 0x0 */ u8 mType; + /* 0x1 */ u8 mNameLength; + /* 0x2 */ char mName[0x100]; public: enum ResType { @@ -21,10 +21,8 @@ public: RESTYPE_Unk4 = 4, }; JUTResReference() { mType = 0; } - /* 802DE078 */ void* getResource(JSUInputStream*, u32, JKRArchive*); - /* 802DE120 */ void* getResource(void const*, u32, JKRArchive*); - /* 802DE1BC */ void* getResource(u32, JKRArchive*); + void* getResource(JSUInputStream*, u32, JKRArchive*); + void* getResource(u32, JKRArchive*); }; -// only rough size known due to getPointer__7J2DPaneFP20JSURandomInputStreamUlP10JKRArchive #endif /* JUTRESOURCE_H */ diff --git a/include/JSystem/JUtility/JUTTexture.h b/include/JSystem/JUtility/JUTTexture.h index f55f3217c..40629f5e5 100644 --- a/include/JSystem/JUtility/JUTTexture.h +++ b/include/JSystem/JUtility/JUTTexture.h @@ -68,29 +68,22 @@ public: void setCaptureFlag(bool flag) { mFlags &= 2 | flag; } u8 getCaptureFlag() const { return mFlags & 1; } u8 getEmbPaletteDelFlag() const { return mFlags & 2; } - void setEmbPaletteDelFlag(bool flag) { mFlags = (mFlags & 1) | (flag << 1);} + void setEmbPaletteDelFlag(bool flag) { mFlags = (mFlags & 1) | (flag << 1); } u8 getTlutName() const { return mTlutName; } bool operator==(const JUTTexture& other) { - return mTexInfo == other.mTexInfo - && field_0x2c == other.field_0x2c - && mWrapS == other.mWrapS - && mWrapT == other.mWrapT - && mMinFilter == other.mMinFilter - && mMagFilter == other.mMagFilter - && mMinLOD == other.mMinLOD - && mMinLOD == other.mMinLOD - && mLODBias == other.mLODBias; - } - bool operator!=(const JUTTexture& other) { - return !operator==(other); + return mTexInfo == other.mTexInfo && mAttachedPalette == other.mAttachedPalette && + mWrapS == other.mWrapS && mWrapT == other.mWrapT && mMinFilter == other.mMinFilter && + mMagFilter == other.mMagFilter && mMinLOD == other.mMinLOD && + mMinLOD == other.mMinLOD && mLODBias == other.mLODBias; } + bool operator!=(const JUTTexture& other) { return !operator==(other); } private: /* 0x00 */ GXTexObj mTexObj; /* 0x20 */ const ResTIMG* mTexInfo; /* 0x24 */ void* mTexData; /* 0x28 */ JUTPalette* mEmbPalette; - /* 0x2C */ JUTPalette* field_0x2c; + /* 0x2C */ JUTPalette* mAttachedPalette; /* 0x30 */ u8 mWrapS; /* 0x31 */ u8 mWrapT; /* 0x32 */ u8 mMinFilter; diff --git a/src/JSystem/J2DGraph/J2DGrafContext.cpp b/src/JSystem/J2DGraph/J2DGrafContext.cpp index 30c9f17d5..4ddfb3b7e 100644 --- a/src/JSystem/J2DGraph/J2DGrafContext.cpp +++ b/src/JSystem/J2DGraph/J2DGrafContext.cpp @@ -4,84 +4,195 @@ // #include "JSystem/J2DGraph/J2DGrafContext.h" +#include "dolphin/gx/GX.h" #include "dolphin/types.h" /* 802CD050-802CD0FC .text __ct__14J2DGrafContextFffff */ -J2DGrafContext::J2DGrafContext(float, float, float, float) { - /* Nonmatching */ +J2DGrafContext::J2DGrafContext(f32 x, f32 y, f32 width, f32 height) + : mBounds(x, y, x + width, y + height), mScissorBounds(x, y, x + width, y + height) { + JUtility::TColor color(-1); + setColor(color); + setLineWidth(6); } /* 802CD0FC-802CD16C .text setPort__14J2DGrafContextFv */ void J2DGrafContext::setPort() { - /* Nonmatching */ + setScissor(); + setup2D(); + + JGeometry::TBox2 bounds(mBounds); + + GXSetViewport(bounds.i.x, bounds.i.y, bounds.getWidth(), bounds.getHeight(), 0.0f, 1.875f); +} + +static inline void GXSetTexCoordGen(GXTexCoordID dst, GXTexGenType type, GXTexGenSrc src, u32 mtx) { + GXSetTexCoordGen2(dst, type, src, mtx, GX_FALSE, GX_PTIDENTITY); } /* 802CD16C-802CD340 .text setup2D__14J2DGrafContextFv */ void J2DGrafContext::setup2D() { - /* Nonmatching */ + GXSetNumIndStages(0); + for (int i = 0; i < GX_TEVSTAGE8; i++) { + GXSetTevDirect((GXTevStageID)i); + } + GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0); + GXSetZMode(GX_FALSE, GX_LEQUAL, GX_FALSE); + GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); + GXSetNumChans(1); + GXSetNumTevStages(1); + GXSetNumTexGens(0); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetCullMode(GX_CULL_NONE); + GXLoadPosMtxImm(mPosMtx, 0); + Mtx mtx; + MTXIdentity(mtx); + GXLoadTexMtxImm(mtx, GX_IDENTITY, GX_MTX3x4); + GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, + GX_AF_NONE); + GXSetChanCtrl(GX_COLOR1A1, GX_FALSE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, + GX_AF_NONE); + GXSetCurrentMtx(0); + GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX1, GX_CLR_RGBA, GX_RGBX8, 0xf); + GXSetLineWidth(mLineWidth, GX_TO_ZERO); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_NONE); } /* 802CD340-802CD590 .text setScissor__14J2DGrafContextFv */ void J2DGrafContext::setScissor() { - /* Nonmatching */ + JGeometry::TBox2 bounds(0, 0, 1024, 1024); + JGeometry::TBox2 curBounds(mScissorBounds); + mScissorBounds.intersect(bounds); + curBounds.absolute(); + if (curBounds.intersect(bounds)) { + GXSetScissor(curBounds.i.x, curBounds.i.y, curBounds.getWidth(), curBounds.getHeight()); + } else { + GXSetScissor(0, 0, 0, 0); + } } /* 802CD590-802CD5B4 .text scissor__14J2DGrafContextFRCQ29JGeometry8TBox2 */ -void J2DGrafContext::scissor(const JGeometry::TBox2&) { - /* Nonmatching */ +void J2DGrafContext::scissor(const JGeometry::TBox2& bounds) { + mScissorBounds = bounds; } /* 802CD5B4-802CD5F8 .text place__14J2DGrafContextFRCQ29JGeometry8TBox2 */ -void J2DGrafContext::place(const JGeometry::TBox2&) { - /* Nonmatching */ +void J2DGrafContext::place(const JGeometry::TBox2& bounds) { + mBounds = bounds; + mScissorBounds = bounds; } -/* 802CD5F8-802CD714 .text setColor__14J2DGrafContextFQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColor */ -void J2DGrafContext::setColor(JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor) { - /* Nonmatching */ +/* 802CD5F8-802CD714 .text + * setColor__14J2DGrafContextFQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColor + */ +void J2DGrafContext::setColor(JUtility::TColor colorTL, JUtility::TColor colorTR, + JUtility::TColor colorBR, JUtility::TColor colorBL) { + mColorTL = colorTL; + mColorTR = colorTR; + mColorBR = colorBR; + mColorBL = colorBL; + field_0xb0.mType = GX_BM_BLEND; + field_0xb0.mSrcFactor = GX_BL_SRC_ALPHA; + field_0xb0.mDstFactor = GX_BL_INV_SRC_ALPHA; + mLinePart.mType = GX_BM_BLEND; + mLinePart.mSrcFactor = GX_BL_SRC_ALPHA; + mLinePart.mDstFactor = GX_BL_INV_SRC_ALPHA; + mBoxPart.mType = GX_BM_BLEND; + mBoxPart.mSrcFactor = GX_BL_SRC_ALPHA; + mBoxPart.mDstFactor = GX_BL_INV_SRC_ALPHA; + if ((mColorTL & 0xFF) != 0xFF) { + return; + } + field_0xb0.mType = GX_BM_NONE; + field_0xb0.mSrcFactor = GX_BL_ONE; + field_0xb0.mDstFactor = GX_BL_ZERO; + if ((mColorBR & 0xFF) != 0xFF) { + return; + } + mLinePart.mType = GX_BM_NONE; + mLinePart.mSrcFactor = GX_BL_ONE; + mLinePart.mDstFactor = GX_BL_ZERO; + if ((mColorTR & 0xFF) != 0xFF) { + return; + } + if ((mColorBL & 0xFF) != 0xFF) { + return; + } + mBoxPart.mType = GX_BM_NONE; + mBoxPart.mSrcFactor = GX_BL_ONE; + mBoxPart.mDstFactor = GX_BL_ZERO; } /* 802CD714-802CD740 .text setLineWidth__14J2DGrafContextFUc */ -void J2DGrafContext::setLineWidth(unsigned char) { - /* Nonmatching */ +void J2DGrafContext::setLineWidth(u8 lineWidth) { + mLineWidth = lineWidth; + GXSetLineWidth(mLineWidth, GX_TO_ZERO); } /* 802CD740-802CD858 .text fillBox__14J2DGrafContextFRCQ29JGeometry8TBox2 */ -void J2DGrafContext::fillBox(const JGeometry::TBox2&) { - /* Nonmatching */ +void J2DGrafContext::fillBox(const JGeometry::TBox2& box) { + GXSetBlendMode((GXBlendMode)mBoxPart.mType, (GXBlendFactor)mBoxPart.mSrcFactor, + (GXBlendFactor)mBoxPart.mDstFactor, GX_LO_SET); + GXLoadPosMtxImm(mPosMtx, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + GXPosition3f32(box.i.x, box.i.y, 0); + GXColor1u32(mColorTL); + GXPosition3f32(box.f.x, box.i.y, 0); + GXColor1u32(mColorTR); + GXPosition3f32(box.f.x, box.f.y, 0); + GXColor1u32(mColorBL); + GXPosition3f32(box.i.x, box.f.y, 0); + GXColor1u32(mColorBR); + i_GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); } /* 802CD858-802CD990 .text drawFrame__14J2DGrafContextFRCQ29JGeometry8TBox2 */ -void J2DGrafContext::drawFrame(const JGeometry::TBox2&) { - /* Nonmatching */ +void J2DGrafContext::drawFrame(const JGeometry::TBox2& box) { + GXSetBlendMode((GXBlendMode)mBoxPart.mType, (GXBlendFactor)mBoxPart.mSrcFactor, + (GXBlendFactor)mBoxPart.mDstFactor, GX_LO_SET); + GXLoadPosMtxImm(mPosMtx, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXBegin(GX_LINESTRIP, GX_VTXFMT0, 5); + GXPosition3f32(box.i.x, box.i.y, 0); + GXColor1u32(mColorTL); + GXPosition3f32(box.f.x, box.i.y, 0); + GXColor1u32(mColorTR); + GXPosition3f32(box.f.x, box.f.y, 0); + GXColor1u32(mColorBL); + GXPosition3f32(box.i.x, box.f.y, 0); + GXColor1u32(mColorBR); + GXPosition3f32(box.i.x, box.i.y, 0); + GXColor1u32(mColorTL); + i_GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); } -/* 802CD990-802CDA6C .text line__14J2DGrafContextFQ29JGeometry8TVec2Q29JGeometry8TVec2 */ -void J2DGrafContext::line(JGeometry::TVec2, JGeometry::TVec2) { - /* Nonmatching */ +/* 802CD990-802CDA6C .text line__14J2DGrafContextFQ29JGeometry8TVec2Q29JGeometry8TVec2 + */ +void J2DGrafContext::line(JGeometry::TVec2 start, JGeometry::TVec2 end) { + GXSetBlendMode((GXBlendMode)mLinePart.mType, (GXBlendFactor)mLinePart.mSrcFactor, + (GXBlendFactor)mLinePart.mDstFactor, GX_LO_SET); + GXLoadPosMtxImm(mPosMtx, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXBegin(GX_LINES, GX_VTXFMT0, 2); + GXPosition3f32(start.x, start.y, 0); + GXColor1u32(mColorTL); + GXPosition3f32(end.x, end.y, 0); + GXColor1u32(mColorBR); + i_GXEnd(); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); } /* 802CDA6C-802CDADC .text lineTo__14J2DGrafContextFQ29JGeometry8TVec2 */ -void J2DGrafContext::lineTo(JGeometry::TVec2) { - /* Nonmatching */ -} - -/* 802CDADC-802CDB24 .text __dt__14J2DGrafContextFv */ -J2DGrafContext::~J2DGrafContext() { - /* Nonmatching */ -} - -/* 802CDB24-802CDB6C .text place__14J2DGrafContextFffff */ -void J2DGrafContext::place(float, float, float, float) { - /* Nonmatching */ -} - -/* 802CDB6C-802CDB74 .text getGrafType__14J2DGrafContextCFv */ -void J2DGrafContext::getGrafType() const { - /* Nonmatching */ -} - -/* 802CDB74-802CDB78 .text setLookat__14J2DGrafContextFv */ -void J2DGrafContext::setLookat() { - /* Nonmatching */ +void J2DGrafContext::lineTo(JGeometry::TVec2 pos) { + this->line(mPrevPos, pos); + mPrevPos = pos; } diff --git a/src/JSystem/J2DGraph/J2DOrthoGraph.cpp b/src/JSystem/J2DGraph/J2DOrthoGraph.cpp index 5eef13a8b..b1cf346c0 100644 --- a/src/JSystem/J2DGraph/J2DOrthoGraph.cpp +++ b/src/JSystem/J2DGraph/J2DOrthoGraph.cpp @@ -4,64 +4,86 @@ // #include "JSystem/J2DGraph/J2DOrthoGraph.h" +#include "dolphin/gx/GX.h" #include "dolphin/types.h" /* 802CDB78-802CDBD8 .text __ct__13J2DOrthoGraphFv */ -J2DOrthoGraph::J2DOrthoGraph() { - /* Nonmatching */ +J2DOrthoGraph::J2DOrthoGraph() : J2DGrafContext(0, 0, 0, 0) { + this->setLookat(); } /* 802CDBD8-802CDCB4 .text __ct__13J2DOrthoGraphFffffff */ -J2DOrthoGraph::J2DOrthoGraph(float, float, float, float, float, float) { - /* Nonmatching */ +J2DOrthoGraph::J2DOrthoGraph(f32 x, f32 y, f32 width, f32 height, f32 far, f32 near) + : J2DGrafContext(x, y, width, height) { + mOrtho = JGeometry::TBox2(0, 0, width, height); + mNear = far; + mFar = near; + this->setLookat(); } /* 802CDCB4-802CDD14 .text setPort__13J2DOrthoGraphFv */ void J2DOrthoGraph::setPort() { - /* Nonmatching */ + this->J2DGrafContext::setPort(); + C_MTXOrtho(mMtx44, mOrtho.i.y, mOrtho.f.y + 0.5f, mOrtho.i.x, mOrtho.f.x, mNear, mFar); + GXSetProjection(mMtx44, GX_ORTHOGRAPHIC); } /* 802CDD14-802CDD48 .text setOrtho__13J2DOrthoGraphFRCQ29JGeometry8TBox2ff */ -void J2DOrthoGraph::setOrtho(const JGeometry::TBox2&, float, float) { - /* Nonmatching */ +void J2DOrthoGraph::setOrtho(const JGeometry::TBox2& bounds, f32 far, f32 near) { + mOrtho = bounds; + mNear = -near; + mFar = -far; } /* 802CDD48-802CDD84 .text setLookat__13J2DOrthoGraphFv */ void J2DOrthoGraph::setLookat() { - /* Nonmatching */ + MTXIdentity(mPosMtx); + GXLoadPosMtxImm(mPosMtx, 0); } -/* 802CDD84-802CDE10 .text scissorBounds__13J2DOrthoGraphFPQ29JGeometry8TBox2PCQ29JGeometry8TBox2 */ -void J2DOrthoGraph::scissorBounds(JGeometry::TBox2*, const JGeometry::TBox2*) { - /* Nonmatching */ +/* 802CDD84-802CDE10 .text + * scissorBounds__13J2DOrthoGraphFPQ29JGeometry8TBox2PCQ29JGeometry8TBox2 */ +void J2DOrthoGraph::scissorBounds(JGeometry::TBox2* param_0, + const JGeometry::TBox2* param_1) { + f32 widthPower = this->getWidthPower(); + f32 heightPower = this->getHeightPower(); + f32 f0 = mBounds.i.x + widthPower * (param_1->i.x - mOrtho.i.x); + f32 f2 = mBounds.i.x + widthPower * (param_1->f.x - mOrtho.i.x); + f32 f1 = mBounds.i.y + heightPower * (param_1->i.y - mOrtho.i.y); + f32 f3 = mBounds.i.y + heightPower * (param_1->f.y - mOrtho.i.y); + param_0->set(f0, f1, f2, f3); } /* 802CDE10-802CDF3C .text J2DDrawLine__FffffQ28JUtility6TColori */ -void J2DDrawLine(float, float, float, float, JUtility::TColor, int) { - /* Nonmatching */ +void J2DDrawLine(f32 x1, f32 y1, f32 x2, f32 y2, JUtility::TColor color, int line_width) { + J2DOrthoGraph oGrph; + oGrph.setLineWidth(line_width); + oGrph.setColor(color); + oGrph.moveTo(x1, y1); + oGrph.lineTo(x2, y2); } /* 802CDF3C-802CDF84 .text J2DFillBox__FffffQ28JUtility6TColor */ -void J2DFillBox(float, float, float, float, JUtility::TColor) { - /* Nonmatching */ +void J2DFillBox(f32 x, f32 y, f32 width, f32 height, JUtility::TColor color) { + J2DFillBox(JGeometry::TBox2(x, y, x + width, y + height), color); } /* 802CDF84-802CE014 .text J2DFillBox__FRCQ29JGeometry8TBox2Q28JUtility6TColor */ -void J2DFillBox(const JGeometry::TBox2&, JUtility::TColor) { - /* Nonmatching */ +void J2DFillBox(const JGeometry::TBox2& box, JUtility::TColor color) { + J2DOrthoGraph oGrph; + oGrph.setColor(color); + oGrph.fillBox(box); } /* 802CE014-802CE060 .text J2DDrawFrame__FffffQ28JUtility6TColorUc */ -void J2DDrawFrame(float, float, float, float, JUtility::TColor, unsigned char) { - /* Nonmatching */ +void J2DDrawFrame(f32 x, f32 y, f32 width, f32 height, JUtility::TColor color, u8 line_width) { + J2DDrawFrame(JGeometry::TBox2(x, y, x + width, y + height), color, line_width); } /* 802CE060-802CE100 .text J2DDrawFrame__FRCQ29JGeometry8TBox2Q28JUtility6TColorUc */ -void J2DDrawFrame(const JGeometry::TBox2&, JUtility::TColor, unsigned char) { - /* Nonmatching */ -} - -/* 802CE100-802CE108 .text getGrafType__13J2DOrthoGraphCFv */ -void J2DOrthoGraph::getGrafType() const { - /* Nonmatching */ +void J2DDrawFrame(const JGeometry::TBox2& box, JUtility::TColor color, u8 line_width) { + J2DOrthoGraph oGrph; + oGrph.setColor(color); + oGrph.setLineWidth(line_width); + oGrph.drawFrame(box); } diff --git a/src/JSystem/J3DU/J3DUDL.cpp b/src/JSystem/J3DU/J3DUDL.cpp index 11b477fa4..56e121c9e 100644 --- a/src/JSystem/J3DU/J3DUDL.cpp +++ b/src/JSystem/J3DU/J3DUDL.cpp @@ -3,10 +3,10 @@ // Translation Unit: J3DUDL.cpp // -#include "JSystem/J3DU/J3DUDL.h" +#include "JSystem/J3DGraphBase/J3DShapeMtx.h" #include "dolphin/types.h" /* 80256F80-80256F88 .text getUseMtxNum__11J3DShapeMtxCFv */ -void J3DShapeMtx::getUseMtxNum() const { - /* Nonmatching */ +u32 J3DShapeMtx::getUseMtxNum() const { + return 1; } diff --git a/src/JSystem/JUtility/JUTFont.cpp b/src/JSystem/JUtility/JUTFont.cpp index 42bdbe580..265239952 100644 --- a/src/JSystem/JUtility/JUTFont.cpp +++ b/src/JSystem/JUtility/JUTFont.cpp @@ -8,25 +8,51 @@ /* 802C1DA4-802C1DD0 .text __ct__7JUTFontFv */ JUTFont::JUTFont() { - /* Nonmatching */ + mValid = false; } /* 802C1DD0-802C1E1C .text initialize_state__7JUTFontFv */ void JUTFont::initialize_state() { - /* Nonmatching */ + setCharColor(JUtility::TColor()); + mFixed = false; + mFixedWidth = 0; + mValid = false; } /* 802C1E1C-802C1EA0 .text setCharColor__7JUTFontFQ28JUtility6TColor */ -void JUTFont::setCharColor(JUtility::TColor) { - /* Nonmatching */ +void JUTFont::setCharColor(JUtility::TColor col1) { + mColor1 = col1; + mColor2 = col1; + mColor3 = col1; + mColor4 = col1; } /* 802C1EA0-802C1F24 .text setGradColor__7JUTFontFQ28JUtility6TColorQ28JUtility6TColor */ -void JUTFont::setGradColor(JUtility::TColor, JUtility::TColor) { - /* Nonmatching */ +void JUTFont::setGradColor(JUtility::TColor col1, JUtility::TColor col2) { + mColor1 = col1; + mColor2 = col1; + mColor3 = col2; + mColor4 = col2; } /* 802C1F24-802C2044 .text drawString_size_scale__7JUTFontFffffPCcUlb */ -void JUTFont::drawString_size_scale(float, float, float, float, const char*, unsigned long, bool) { - /* Nonmatching */ +f32 JUTFont::drawString_size_scale(f32 a1, f32 a2, f32 a3, f32 a4, const char* str, u32 usz, + bool a7) { + f32 temp = a1; + + for (; usz > 0; usz--, str++) { + u32 c = *(u8*)str; + u32 b = c; + if (isLeadByte(b)) { + str++; + b <<= 8; + b |= *(u8*)str; + usz--; + } + + a1 += drawChar_scale(a1, a2, a3, a4, b, a7); + a7 = 1; + } + + return a1 - temp; } diff --git a/src/JSystem/JUtility/JUTGraphFifo.cpp b/src/JSystem/JUtility/JUTGraphFifo.cpp index 40b9bcad8..a5aabbf53 100644 --- a/src/JSystem/JUtility/JUTGraphFifo.cpp +++ b/src/JSystem/JUtility/JUTGraphFifo.cpp @@ -4,14 +4,40 @@ // #include "JSystem/JUtility/JUTGraphFifo.h" +#include "JSystem/JKernel/JKRHeap.h" #include "dolphin/types.h" +bool JUTGraphFifo::sInitiated; +JUTGraphFifo* JUTGraphFifo::sCurrentFifo; + /* 802C1C04-802C1CE0 .text __ct__12JUTGraphFifoFUl */ -JUTGraphFifo::JUTGraphFifo(unsigned long) { - /* Nonmatching */ +JUTGraphFifo::JUTGraphFifo(u32 size) { + mSize = size + 0x1F & ~0x1F; + if (sInitiated) { + mFifo = (GXFifoObj*)JKRAllocFromSysHeap(mSize + 0x80, 32); + mBase = mFifo + 1; + GXInitFifoBase(mFifo, mBase, mSize); + GXInitFifoPtrs(mFifo, mBase, mBase); + } else { + mBase = JKRAllocFromSysHeap(mSize + 0xA0, 32); + mBase = (void*)((int)mBase + 0x1F & ~0x1F); + mFifo = GXInit(mBase, mSize); + sInitiated = true; + sCurrentFifo = this; + } } +bool JUTGraphFifo::mGpStatus[5]; + /* 802C1CE0-802C1DA4 .text __dt__12JUTGraphFifoFv */ JUTGraphFifo::~JUTGraphFifo() { - /* Nonmatching */ + sCurrentFifo->save(); + + do { + } while (isGPActive()); + + if (sCurrentFifo == this) { + sCurrentFifo = NULL; + } + JKRFreeToSysHeap(mBase); } diff --git a/src/JSystem/JUtility/JUTResource.cpp b/src/JSystem/JUtility/JUTResource.cpp index e1dec9d50..a47d1ee54 100644 --- a/src/JSystem/JUtility/JUTResource.cpp +++ b/src/JSystem/JUtility/JUTResource.cpp @@ -4,14 +4,39 @@ // #include "JSystem/JUtility/JUTResource.h" +#include "JSystem/JKernel/JKRArchive.h" +#include "JSystem/JSupport/JSUInputStream.h" #include "dolphin/types.h" /* 802C12DC-802C1384 .text getResource__15JUTResReferenceFP14JSUInputStreamUlP10JKRArchive */ -void JUTResReference::getResource(JSUInputStream*, unsigned long, JKRArchive*) { - /* Nonmatching */ +void* JUTResReference::getResource(JSUInputStream* stream, u32 resType, JKRArchive* archive) { + stream->read(&mType, 1); + stream->read(&mNameLength, 1); + stream->read(&mName, mNameLength); + + if (mType == RESTYPE_Unk2 || mType == RESTYPE_Unk3 || mType == RESTYPE_Unk4) { + mName[mNameLength] = 0; + } + + return getResource(resType, archive); } /* 802C1384-802C13FC .text getResource__15JUTResReferenceFUlP10JKRArchive */ -void JUTResReference::getResource(unsigned long, JKRArchive*) { - /* Nonmatching */ +void* JUTResReference::getResource(u32 resType, JKRArchive* archive) { + void* res = NULL; + switch (mType) { + case RESTYPE_Unk1: + break; + case RESTYPE_Unk2: + res = JKRArchive::getGlbResource(resType, mName, archive); + break; + case RESTYPE_Unk3: + res = JKRFileLoader::getGlbResource(mName, archive); + break; + case RESTYPE_Unk4: + res = JKRFileLoader::getGlbResource(mName); + break; + } + + return res; } diff --git a/src/JSystem/JUtility/JUTTexture.cpp b/src/JSystem/JUtility/JUTTexture.cpp index 353378bd0..7a8dfe6e1 100644 --- a/src/JSystem/JUtility/JUTTexture.cpp +++ b/src/JSystem/JUtility/JUTTexture.cpp @@ -4,34 +4,117 @@ // #include "JSystem/JUtility/JUTTexture.h" +#include "JSystem/JUtility/JUTPalette.h" +#include "dolphin/gx/GX.h" #include "dolphin/types.h" /* 802C13FC-802C1470 .text __dt__10JUTTextureFv */ JUTTexture::~JUTTexture() { - /* Nonmatching */ + if (getCaptureFlag()) { + delete[] field_0x3c; + } + if (getEmbPaletteDelFlag()) { + delete mEmbPalette; + } } /* 802C1470-802C15FC .text storeTIMG__10JUTTextureFPC7ResTIMGUc */ -void JUTTexture::storeTIMG(const ResTIMG*, unsigned char) { - /* Nonmatching */ +void JUTTexture::storeTIMG(const ResTIMG* pTimg, u8 param_1) { + _GXTlut tlut; + + if (pTimg && param_1 < 0x10) { + mTexInfo = pTimg; + mTexData = (void*)((int)mTexInfo + mTexInfo->imageOffset); + + if (mTexInfo->imageOffset == 0) { + mTexData = (void*)((int)mTexInfo + 0x20); + } + + if (getEmbPaletteDelFlag()) { + delete mEmbPalette; + } + mEmbPalette = NULL; + mAttachedPalette = 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; + + if (mTexInfo->numColors == 0) { + initTexObj(); + } else { + if (mTexInfo->numColors > 0x100) { + tlut = (_GXTlut)((param_1 % 4) + GX_BIGTLUT0); + } else { + tlut = (_GXTlut)param_1; + } + + mEmbPalette = new JUTPalette( + tlut, (_GXTlutFmt)mTexInfo->colorFormat, (JUTTransparency)mTexInfo->alphaEnabled, + mTexInfo->numColors, (void*)(&mTexInfo->format + mTexInfo->paletteOffset)); + + mFlags = mFlags & 1 | 2; + attachPalette(mEmbPalette); + } + } } /* 802C15FC-802C1654 .text attachPalette__10JUTTextureFP10JUTPalette */ -void JUTTexture::attachPalette(JUTPalette*) { - /* Nonmatching */ +void JUTTexture::attachPalette(JUTPalette* pPalette) { + if (mTexInfo->indexTexture) { + if (pPalette == NULL && mEmbPalette != NULL) { + mAttachedPalette = mEmbPalette; + } else { + mAttachedPalette = pPalette; + } + _GXTlut name = (_GXTlut)mAttachedPalette->getTlutName(); + initTexObj(name); + } } /* 802C1654-802C1740 .text initTexObj__10JUTTextureFv */ void JUTTexture::initTexObj() { - /* Nonmatching */ + GXBool mipmapEnabled; + if (mTexInfo->mipmapEnabled != 0) { + mipmapEnabled = 1; + } else { + mipmapEnabled = 0; + } + u8* image = ((u8*)mTexInfo); + image += (mTexInfo->imageOffset ? mTexInfo->imageOffset : 0x20); + GXInitTexObj(&mTexObj, image, mTexInfo->width, mTexInfo->height, (GXTexFmt)mTexInfo->format, + (GXTexWrapMode)mWrapS, (GXTexWrapMode)mWrapT, mipmapEnabled); + GXInitTexObjLOD(&mTexObj, (GXTexFilter)mMinFilter, (GXTexFilter)mMagFilter, mMinLOD / 8.0f, + mMaxLOD / 8.0f, mLODBias / 100.0f, mTexInfo->biasClamp, mTexInfo->doEdgeLOD, + (GXAnisotropy)mTexInfo->maxAnisotropy); } /* 802C1740-802C183C .text initTexObj__10JUTTextureF7_GXTlut */ -void JUTTexture::initTexObj(_GXTlut) { - /* Nonmatching */ +void JUTTexture::initTexObj(_GXTlut tlut) { + GXBool mipmapEnabled; + if (mTexInfo->mipmapEnabled != 0) { + mipmapEnabled = 1; + } else { + mipmapEnabled = 0; + } + mTlutName = tlut; + u8* image = ((u8*)mTexInfo); + image += (mTexInfo->imageOffset ? mTexInfo->imageOffset : 0x20); + GXInitTexObjCI(&mTexObj, image, mTexInfo->width, mTexInfo->height, (GXCITexFmt)mTexInfo->format, + (GXTexWrapMode)mWrapS, (GXTexWrapMode)mWrapT, mipmapEnabled, tlut); + GXInitTexObjLOD(&mTexObj, (GXTexFilter)mMinFilter, (GXTexFilter)mMagFilter, mMinLOD / 8.0f, + mMaxLOD / 8.0f, mLODBias / 100.0f, mTexInfo->biasClamp, mTexInfo->doEdgeLOD, + (GXAnisotropy)mTexInfo->maxAnisotropy); } /* 802C183C-802C188C .text load__10JUTTextureF11_GXTexMapID */ -void JUTTexture::load(_GXTexMapID) { - /* Nonmatching */ +void JUTTexture::load(_GXTexMapID id) { + if (mAttachedPalette) { + mAttachedPalette->load(); + } + GXLoadTexObj(&mTexObj, id); }