Fix endianness & 64-bit in 3D asset loading code

Combination of plumbing BE(T) through everything, making BE<T> have template specializations, and inverting at load time where more practical.
This commit is contained in:
PJB3005
2026-02-25 20:20:45 +01:00
parent 31149794f1
commit e7861f1ee3
32 changed files with 830 additions and 553 deletions
+10 -8
View File
@@ -43,7 +43,7 @@ void J3DShape::addTexMtxIndexInDL(GXAttr attr, u32 valueBase) {
s32 stride = 0;
bool found = false;
for (GXVtxDescList* vtxDesc = getVtxDesc(); vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
for (BE(GXVtxDescList)* vtxDesc = getVtxDesc(); vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
if (vtxDesc->attr == GX_VA_PNMTXIDX)
pnmtxidxOffs = stride;
@@ -69,7 +69,7 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
s32 attrOffs = -1;
s32 stride = 0;
GXVtxDescList* vtxDesc = getVtxDesc();
BE(GXVtxDescList)* vtxDesc = getVtxDesc();
s32 attrCount = 0;
for (; vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
@@ -82,11 +82,11 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
if (attrIdx == -1)
return;
GXVtxDescList* newVtxDesc = new GXVtxDescList[attrCount + 2];
BE(GXVtxDescList)* newVtxDesc = new BE(GXVtxDescList)[attrCount + 2];
bool inserted = false;
vtxDesc = getVtxDesc();
GXVtxDescList* dst = newVtxDesc;
BE(GXVtxDescList)* dst = newVtxDesc;
for (; vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
if ((attr < vtxDesc->attr) && !inserted) {
dst->attr = attr;
@@ -154,7 +154,7 @@ bool J3DShape::isSameVcdVatCmd(J3DShape* other) {
}
void J3DShape::makeVtxArrayCmd() {
GXVtxAttrFmtList* vtxAttr = mVertexData->getVtxAttrFmtList();
BE(GXVtxAttrFmtList)* vtxAttr = mVertexData->getVtxAttrFmtList();
u8 stride[12];
void* array[12];
@@ -210,7 +210,7 @@ void J3DShape::makeVtxArrayCmd() {
}
}
GXVtxDescList* vtxDesc = mVtxDesc;
BE(GXVtxDescList)* vtxDesc = mVtxDesc;
mHasPNMTXIdx = false;
for (; vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
if (vtxDesc->attr == GX_VA_NBT && vtxDesc->type != GX_NONE) {
@@ -237,9 +237,11 @@ void J3DShape::makeVcdVatCmd() {
GDLObj gdl_obj;
GDInitGDLObj(&gdl_obj, mVcdVatCmd, kVcdVatDLSize);
GDSetCurrent(&gdl_obj);
GDSetVtxDescv(mVtxDesc);
puts("GDSetVtxDescv is stubbed out due to BE issues");
// GDSetVtxDescv(mVtxDesc);
makeVtxArrayCmd();
J3DGDSetVtxAttrFmtv(GX_VTXFMT0, mVertexData->getVtxAttrFmtList(), mHasNBT);
puts("J3DGDSetVtxAttrFmtv is stubbed out due to BE issues");
// J3DGDSetVtxAttrFmtv(GX_VTXFMT0, mVertexData->getVtxAttrFmtList(), mHasNBT);
GDPadCurr32();
GDFlushCurrToMem();
GDSetCurrent(NULL);