diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2025-09-04 07:56:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-04 17:56:59 +0300 |
| commit | b45a089e15d79821b07be020db628e01a49b1fd2 (patch) | |
| tree | 948057548cc19b19d644bd4f300ca6434e6bff11 /src/JSystem/J3DGraphBase/J3DShapeDraw.cpp | |
| parent | ee8b843996f4d888903f8c125b95ec1af376877e (diff) | |
some J3D/misc cleanup (#2628)
* some j3d cleanup
* begin using uintptr_t
* j3dgraphbase cleanup
* j3dgraphanimator cleanup
Diffstat (limited to 'src/JSystem/J3DGraphBase/J3DShapeDraw.cpp')
| -rw-r--r-- | src/JSystem/J3DGraphBase/J3DShapeDraw.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
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 <dolphin/os.h> -#include "global.h" +#include <string.h> +#include <stdint.h> +#include <dolphin/gx.h> /* 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; } |
