From b45a089e15d79821b07be020db628e01a49b1fd2 Mon Sep 17 00:00:00 2001 From: TakaRikka <38417346+TakaRikka@users.noreply.github.com> Date: Thu, 4 Sep 2025 07:56:59 -0700 Subject: some J3D/misc cleanup (#2628) * some j3d cleanup * begin using uintptr_t * j3dgraphbase cleanup * j3dgraphanimator cleanup --- src/JSystem/J3DGraphBase/J3DShapeDraw.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/JSystem/J3DGraphBase/J3DShapeDraw.cpp') diff --git a/src/JSystem/J3DGraphBase/J3DShapeDraw.cpp b/src/JSystem/J3DGraphBase/J3DShapeDraw.cpp index ee7ada7dee..a5f933cb95 100644 --- a/src/JSystem/J3DGraphBase/J3DShapeDraw.cpp +++ b/src/JSystem/J3DGraphBase/J3DShapeDraw.cpp @@ -1,20 +1,15 @@ -// -// Generated By: dol2asm -// Translation Unit: J3DShapeDraw -// - #include "JSystem/J3DGraphBase/J3DShapeDraw.h" #include "JSystem/JKernel/JKRHeap.h" -#include "string.h" -#include "dolphin/gx.h" -#include -#include "global.h" +#include +#include +#include /* 80314924-80314974 30F264 0050+00 1/1 0/0 0/0 .text countVertex__12J3DShapeDrawFUl */ u32 J3DShapeDraw::countVertex(u32 stride) { u32 count = 0; - u32 dlStart = (u32)getDisplayList(); - for (u8* dl = (u8*)dlStart; ((u32)dl - dlStart) < getDisplayListSize();) { + uintptr_t dlStart = (uintptr_t)getDisplayList(); + + for (u8* dl = (u8*)dlStart; ((uintptr_t)dl - dlStart) < getDisplayListSize();) { if (*dl != GX_TRIANGLEFAN && *dl != GX_TRIANGLESTRIP) break; u16 vtxNum = *((u16*)(dl + 1)); @@ -22,6 +17,7 @@ u32 J3DShapeDraw::countVertex(u32 stride) { dl += stride * vtxNum; dl += 3; } + return count; } @@ -34,6 +30,7 @@ void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) { u8* oldDLStart = getDisplayList(); u8* oldDL = oldDLStart; u8* newDL = newDLStart; + for (; (oldDL - oldDLStart) < mDisplayListSize;) { // Copy command u8 h = *oldDL; @@ -62,16 +59,17 @@ void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) { oldDL += 3; } - u32 realSize = ALIGN_NEXT((u32)newDL - (u32)newDLStart, 0x20); + u32 realSize = ALIGN_NEXT((uintptr_t)newDL - (uintptr_t)newDLStart, 0x20); for (; (newDL - newDLStart) < newSize; newDL++) *newDL = 0; + mDisplayListSize = realSize; mDisplayList = newDLStart; DCStoreRange(newDLStart, mDisplayListSize); } /* 80314ABC-80314AD4 30F3FC 0018+00 0/0 1/1 0/0 .text __ct__12J3DShapeDrawFPCUcUl */ -J3DShapeDraw::J3DShapeDraw(u8 const* displayList, u32 displayListSize) { +J3DShapeDraw::J3DShapeDraw(const u8* displayList, u32 displayListSize) { mDisplayList = (void*)displayList; mDisplayListSize = displayListSize; } -- cgit v1.2.3