diff --git a/libs/JSystem/include/JSystem/J3DGraphBase/J3DTexture.h b/libs/JSystem/include/JSystem/J3DGraphBase/J3DTexture.h index 516ddac887..5b05b08bcc 100644 --- a/libs/JSystem/include/JSystem/J3DGraphBase/J3DTexture.h +++ b/libs/JSystem/include/JSystem/J3DGraphBase/J3DTexture.h @@ -20,7 +20,7 @@ private: /* 0x4 */ ResTIMG* mpRes; #if TARGET_PC - TGXTlutObj* mpTlutObj; + GXTlutObj* mpTlutObj; TGXTexObj* mpTexObj; u8** mpImgDataPtr; u8** mpTlutDataPtr; @@ -31,22 +31,20 @@ public: J3D_ASSERT_NULLPTR(52, res != NULL || num == 0); #if TARGET_PC mpTexObj = new TGXTexObj[num]; - mpTlutObj = new TGXTlutObj[num]; + mpTlutObj = new GXTlutObj[num]; mpImgDataPtr = new u8*[num]; mpTlutDataPtr = new u8*[num]; for (u16 i = 0; i < num; i++) { mpImgDataPtr[i] = (u8*)(&mpRes[i]) + mpRes[i].imageOffset; mpTlutDataPtr[i] = (u8*)(&mpRes[i]) + mpRes[i].paletteOffset; - initGXTexObj(i); + loadGXTexObj(i); } #endif } void loadGX(u16, GXTexMapID) const; #if TARGET_PC - void initGXTexObj(u16); - TGXTexObj* getTexObj(u16 i) const { return &mpTexObj[i]; } - TGXTlutObj* getTlutObj(u16 i) const { return &mpTlutObj[i]; } + void loadGXTexObj(u16); #endif void entryNum(u16); void addResTIMG(u16, ResTIMG const*); @@ -79,7 +77,7 @@ public: #if TARGET_PC mpImgDataPtr[index] = ((u8*)&timg) + timg.imageOffset; mpTlutDataPtr[index] = ((u8*)&timg) + timg.paletteOffset; - initGXTexObj(index); + loadGXTexObj(index); #else mpRes[index].imageOffset = ((mpRes[index].imageOffset + (uintptr_t)&timg - (uintptr_t)(mpRes + index))); mpRes[index].paletteOffset = ((mpRes[index].paletteOffset + (uintptr_t)&timg - (uintptr_t)(mpRes + index))); diff --git a/libs/JSystem/src/J3DGraphBase/J3DMatBlock.cpp b/libs/JSystem/src/J3DGraphBase/J3DMatBlock.cpp index dada6a19e8..f401f16c43 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DMatBlock.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DMatBlock.cpp @@ -246,37 +246,22 @@ s32 J3DTexGenBlockBasic::countDLSize() { } s32 J3DTevBlockPatched::countDLSize() { -#if TARGET_PC - return 2048; -#endif return 560; } s32 J3DTevBlock1::countDLSize() { -#if TARGET_PC - return 256; -#endif return 105; } s32 J3DTevBlock2::countDLSize() { -#if TARGET_PC - return 512; -#endif return 335; } s32 J3DTevBlock4::countDLSize() { -#if TARGET_PC - return 1024; -#endif return 580; } s32 J3DTevBlock16::countDLSize() { -#if TARGET_PC - return 2048; -#endif return 1000; } diff --git a/libs/JSystem/src/J3DGraphBase/J3DMaterial.cpp b/libs/JSystem/src/J3DGraphBase/J3DMaterial.cpp index 7f59692bc0..1bd619c0e0 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DMaterial.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DMaterial.cpp @@ -222,6 +222,9 @@ void J3DMaterial::makeSharedDisplayList() { void J3DMaterial::load() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (!j3dSys.checkFlag(2)) { loadNBTScale(*mTexGenBlock->getNBTScale()); } @@ -229,6 +232,9 @@ void J3DMaterial::load() { void J3DMaterial::loadSharedDL() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (!j3dSys.checkFlag(2)) { mSharedDLObj->callDL(); loadNBTScale(*mTexGenBlock->getNBTScale()); @@ -406,6 +412,9 @@ void J3DPatchedMaterial::makeSharedDisplayList() {} void J3DPatchedMaterial::load() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (j3dSys.checkFlag(2)) { return; } @@ -413,6 +422,9 @@ void J3DPatchedMaterial::load() { void J3DPatchedMaterial::loadSharedDL() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (!j3dSys.checkFlag(0x02)) mSharedDLObj->callDL(); } @@ -431,6 +443,9 @@ void J3DLockedMaterial::makeSharedDisplayList() {} void J3DLockedMaterial::load() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (j3dSys.checkFlag(2)) { return; } @@ -438,6 +453,9 @@ void J3DLockedMaterial::load() { void J3DLockedMaterial::loadSharedDL() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (!j3dSys.checkFlag(0x02)) mSharedDLObj->callDL(); } diff --git a/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp b/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp index 354dee4130..fb82b8244d 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp @@ -212,6 +212,9 @@ bool J3DMatPacket::isSame(J3DMatPacket* pOther) const { void J3DMatPacket::draw() { ZoneScoped; +#if TARGET_PC + j3dSys.setTexture(mpTexture); +#endif mpMaterial->load(); #if DEBUG && TARGET_PC @@ -225,6 +228,9 @@ void J3DMatPacket::draw() { callDL(); J3DShapePacket* packet = getShapePacket(); +#if TARGET_PC + packet->mpModel->getVertexBuffer()->setArray(); +#endif packet->getShape()->loadPreDrawSetting(); while (packet != NULL) { diff --git a/libs/JSystem/src/J3DGraphBase/J3DTevs.cpp b/libs/JSystem/src/J3DGraphBase/J3DTevs.cpp index b43663731d..1bfb22e73e 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DTevs.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DTevs.cpp @@ -11,10 +11,6 @@ #include "JSystem/J3DGraphBase/J3DTransform.h" #include "global.h" -#if TARGET_PC -#include "aurora/lib/gfx/texture.hpp" -#endif - static void J3DGDLoadTexMtxImm(f32 (*)[4], u32, GXTexMtxType); static void J3DGDLoadPostTexMtxImm(f32 (*)[4], u32); @@ -284,46 +280,6 @@ u16 getTexNoReg(void* pDL) { return var_r31 & 0xFFFFFF; } -#if TARGET_PC -inline void J3DGDWrite_u64(u64 data) { - __GDWrite((u8)((data >> 56) & 0xFF)); - __GDWrite((u8)((data >> 48) & 0xFF)); - __GDWrite((u8)((data >> 40) & 0xFF)); - __GDWrite((u8)((data >> 32) & 0xFF)); - __GDWrite((u8)((data >> 24) & 0xFF)); - __GDWrite((u8)((data >> 16) & 0xFF)); - __GDWrite((u8)((data >> 8) & 0xFF)); - __GDWrite((u8)((data >> 0) & 0xFF)); -} - -void J3D_emit_loaded_texobj_metadata(const GXTexObj_& obj, GXTexMapID id) { - GDOverflowCheck(38); - J3DGDWrite_u8(GX_AURORA); - J3DGDWrite_u16(GX_AURORA_LOAD_TEXOBJ); - J3DGDWrite_u8(static_cast(id)); - J3DGDWrite_u64(reinterpret_cast(obj.data)); - J3DGDWrite_u32(obj.width()); - J3DGDWrite_u32(obj.height()); - J3DGDWrite_u32(obj.format()); - J3DGDWrite_u32(static_cast(obj.tlut)); - J3DGDWrite_u8(static_cast(obj.has_mips())); - J3DGDWrite_u32(obj.texObjId); - J3DGDWrite_u32(obj.texDataVersion); -} - -void J3D_emit_loaded_tlut_metadata(const GXTlutObj_& obj, u32 idx) { - GDOverflowCheck(22); - J3DGDWrite_u8(GX_AURORA); - J3DGDWrite_u16(GX_AURORA_LOAD_TLUT); - J3DGDWrite_u8(static_cast(idx)); - J3DGDWrite_u64(reinterpret_cast(obj.data)); - J3DGDWrite_u32(static_cast(obj.format)); - J3DGDWrite_u16(obj.numEntries); - J3DGDWrite_u32(obj.tlutObjId); - J3DGDWrite_u32(obj.tlutDataVersion); -} -#endif - void loadTexNo(u32 param_0, const u16& texNo) { ResTIMG* resTIMG = j3dSys.getTexture()->getResTIMG(texNo); J3D_ASSERT_NULLPTR(462, resTIMG != NULL); @@ -331,15 +287,6 @@ void loadTexNo(u32 param_0, const u16& texNo) { J3DSys::sTexCoordScaleTable[param_0].field_0x00 = (u16)resTIMG->width; J3DSys::sTexCoordScaleTable[param_0].field_0x02 = (u16)resTIMG->height; -#if TARGET_PC - J3D_emit_loaded_texobj_metadata( - *reinterpret_cast(j3dSys.getTexture()->getTexObj(texNo)), GXTexMapID(param_0)); - if (resTIMG->indexTexture) { - J3D_emit_loaded_tlut_metadata( - *reinterpret_cast(j3dSys.getTexture()->getTlutObj(texNo)), param_0); - } -#endif - GDOverflowCheck(0x14); J3DGDSetTexImgPtr(GXTexMapID(param_0), (u8*)resTIMG + resTIMG->imageOffset); J3DGDSetTexImgAttr(GXTexMapID(param_0), resTIMG->width, resTIMG->height, GXTexFmt(resTIMG->format & 0x0f)); diff --git a/libs/JSystem/src/J3DGraphBase/J3DTexture.cpp b/libs/JSystem/src/J3DGraphBase/J3DTexture.cpp index 971d5d08dd..a01e605abb 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DTexture.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DTexture.cpp @@ -49,7 +49,7 @@ void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const { } #if TARGET_PC -void J3DTexture::initGXTexObj(u16 idx) { +void J3DTexture::loadGXTexObj(u16 idx) { J3D_ASSERT_RANGE(29, idx < mNum); ResTIMG* timg = getResTIMG(idx); @@ -89,7 +89,7 @@ void J3DTexture::entryNum(u16 num) { delete[] mpImgDataPtr; delete[] mpTlutDataPtr; mpTexObj = new TGXTexObj[num](); - mpTlutObj = new TGXTlutObj[num](); + mpTlutObj = new GXTlutObj[num](); mpImgDataPtr = new u8*[num](); mpTlutDataPtr = new u8*[num](); diff --git a/src/d/actor/d_a_midna.cpp b/src/d/actor/d_a_midna.cpp index b4889370d8..83380867dc 100644 --- a/src/d/actor/d_a_midna.cpp +++ b/src/d/actor/d_a_midna.cpp @@ -513,7 +513,6 @@ int daMidna_c::createHeap() { ResTIMG* timg = tex->getResTIMG(i); timg->mipmapEnabled = false; tex->initGXTexObj(i); - modelData->makeSharedDL(); break; } }