some J3D/misc cleanup (#2628)

* some j3d cleanup

* begin using uintptr_t

* j3dgraphbase cleanup

* j3dgraphanimator cleanup
This commit is contained in:
TakaRikka
2025-09-04 07:56:59 -07:00
committed by GitHub
parent ee8b843996
commit b45a089e15
290 changed files with 4221 additions and 3605 deletions
+11 -13
View File
@@ -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;
}