Merge pull request #172 from TakaRikka/arrays

Update GXSetArray usages (fixes & `le` arg)
This commit is contained in:
TakaRikka
2026-03-31 00:11:07 -07:00
committed by GitHub
14 changed files with 65 additions and 82 deletions
+3 -3
View File
@@ -268,9 +268,9 @@ void daMant_packet_c::draw() {
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_CLR_RGB, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_F32, 0);
GXSETARRAY(GX_VA_POS, this->getPos(), sizeof(mPos[0]), 12);
GXSETARRAY(GX_VA_NRM, this->getNrm(), sizeof(mNrm[0]), 12);
GXSETARRAY(GX_VA_TEX0, &l_texCoord, sizeof(l_texCoord), 8);
GXSETARRAY(GX_VA_POS, this->getPos(), sizeof(mPos[0]), 12, true);
GXSETARRAY(GX_VA_NRM, this->getNrm(), sizeof(mNrm[0]), 12, true);
GXSETARRAY(GX_VA_TEX0, &l_texCoord, sizeof(l_texCoord), 8, false); // TODO: set to true when converted to float literals
GXSetZCompLoc(0);
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
+4 -4
View File
@@ -274,9 +274,9 @@ void FlagCloth_c::draw() {
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_CLR_RGB, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_F32, 0);
GXSETARRAY(GX_VA_POS, getPos(), sizeof(mPositions), sizeof(cXyz));
GXSETARRAY(GX_VA_NRM, getNormal(), sizeof(mNormals), sizeof(cXyz));
GXSETARRAY(GX_VA_TEX0, mpTexCoord, sizeof(mpTexCoord), 8);
GXSETARRAY(GX_VA_POS, getPos(), sizeof(mPositions), sizeof(cXyz), true);
GXSETARRAY(GX_VA_NRM, getNormal(), sizeof(mNormals), sizeof(cXyz), true);
GXSETARRAY(GX_VA_TEX0, mpTexCoord, sizeof(l_texCoord), 8, true);
GXSetZCompLoc(GX_FALSE);
GXSetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
GXLoadTexObj(&mTexObj, GX_TEXMAP0);
@@ -304,7 +304,7 @@ void FlagCloth_c::draw() {
GXSetClipMode(GX_CLIP_ENABLE);
GXSetCullMode(GX_CULL_BACK);
GXCallDisplayList(l_pennant_flagDL, 0x80);
GXSETARRAY(GX_VA_NRM, getNormalBack(), sizeof(mNormalBacks), sizeof(cXyz));
GXSETARRAY(GX_VA_NRM, getNormalBack(), sizeof(mNormalBacks), sizeof(cXyz), true);
GXSetCullMode(GX_CULL_FRONT);
GXCallDisplayList(l_pennant_flagDL, 0x80);
J3DShape::resetVcdVatCache();
+4 -4
View File
@@ -233,9 +233,9 @@ inline void FlagCloth2_c::draw() {
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_CLR_RGB, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_F32, 0);
GXSETARRAY(GX_VA_POS, getPos(), sizeof(mPositions), sizeof(cXyz));
GXSETARRAY(GX_VA_NRM, getNormal(), sizeof(mNormals), sizeof(cXyz));
GXSETARRAY(GX_VA_TEX0, mTexCoord, sizeof(mTexCoord), 8);
GXSETARRAY(GX_VA_POS, getPos(), sizeof(mPositions), sizeof(cXyz), true);
GXSETARRAY(GX_VA_NRM, getNormal(), sizeof(mNormals), sizeof(cXyz), true);
GXSETARRAY(GX_VA_TEX0, mTexCoord, sizeof(mTexCoord), 8, true);
GXSetZCompLoc(GX_FALSE);
GXSetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
GXLoadTexObj(&mTexObj, GX_TEXMAP0);
@@ -276,7 +276,7 @@ inline void FlagCloth2_c::draw() {
GXEnd();
}
GXSETARRAY(GX_VA_NRM, getNormalBack(), sizeof(mNormalBacks), sizeof(cXyz));
GXSETARRAY(GX_VA_NRM, getNormalBack(), sizeof(mNormalBacks), sizeof(cXyz), true);
GXSetCullMode(GX_CULL_FRONT);
for (int i = 0; i < 5; i++) {
+8 -34
View File
@@ -521,32 +521,6 @@ dFlower_packet_c::dFlower_packet_c() {
unused += 0x2000;
}
#if TARGET_LITTLE_ENDIAN
static bool initialized = false;
if (!initialized) {
for (int i = 0; i < (ARRAY_SIZE(l_flowerPos) / sizeof(Vec)); i++) {
be_swap(((Vec*)l_flowerPos)[i]);
}
for (int i = 0; i < (ARRAY_SIZE(l_flowerTexCoord) / sizeof(Vec)); i++) {
be_swap(((Vec*)l_flowerTexCoord)[i]);
}
for (int i = 0; i < (ARRAY_SIZE(l_flowerPos2) / sizeof(Vec)); i++) {
be_swap(((Vec*)l_flowerPos2)[i]);
}
for (int i = 0; i < (ARRAY_SIZE(l_flowerTexCoord2) / sizeof(Vec)); i++) {
be_swap(((Vec*)l_flowerTexCoord2)[i]);
}
for (int i = 0; i < (ARRAY_SIZE(l_flowerNormal) / sizeof(Vec)); i++) {
be_swap(((Vec*)l_flowerNormal)[i]);
}
for (int i = 0; i < (ARRAY_SIZE(l_flowerNormal2) / sizeof(Vec)); i++) {
be_swap(((Vec*)l_flowerNormal2)[i]);
}
initialized = true;
}
#endif
#if TARGET_PC
GXInitTexObj(&mTexObj_l_J_Ohana00_64TEX, l_J_Ohana00_64TEX,
l_J_Ohana00_64TEX__width, l_J_Ohana00_64TEX__height, GX_TF_CMPR, GX_MIRROR, GX_MIRROR, GX_FALSE
@@ -579,10 +553,10 @@ void dFlower_packet_c::draw() {
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_NRM_XYZ, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
GXSETARRAY(GX_VA_POS, &l_flowerPos, sizeof(l_flowerPos), 0xC);
GXSETARRAY(GX_VA_NRM, &l_flowerNormal, sizeof(l_flowerNormal), 0xC);
GXSETARRAY(GX_VA_CLR0, &l_flowerColor, sizeof(l_flowerColor), 4);
GXSETARRAY(GX_VA_TEX0, &l_flowerTexCoord, sizeof(l_flowerTexCoord), 8);
GXSETARRAY(GX_VA_POS, &l_flowerPos, sizeof(l_flowerPos), 0xC, false);
GXSETARRAY(GX_VA_NRM, &l_flowerNormal, sizeof(l_flowerNormal), 0xC, false);
GXSETARRAY(GX_VA_CLR0, &l_flowerColor, sizeof(l_flowerColor), 4, false);
GXSETARRAY(GX_VA_TEX0, &l_flowerTexCoord, sizeof(l_flowerTexCoord), 8, false);
GXColor sp64;
dFlower_room_c* sp5C = m_room;
@@ -678,10 +652,10 @@ void dFlower_packet_c::draw() {
sp5C++;
}
GXSETARRAY(GX_VA_POS, mp_pos, sizeof(l_flowerPos2), 0xC);
GXSETARRAY(GX_VA_NRM, &l_flowerNormal2, sizeof(l_flowerNormal2), 0xC);
GXSETARRAY(GX_VA_CLR0, mp_colors, sizeof(l_flowerColor2), 4);
GXSETARRAY(GX_VA_TEX0, mp_texCoords, sizeof(l_flowerTexCoord2), 8);
GXSETARRAY(GX_VA_POS, mp_pos, sizeof(l_flowerPos2), 0xC, true);
GXSETARRAY(GX_VA_NRM, &l_flowerNormal2, sizeof(l_flowerNormal2), 0xC, false);
GXSETARRAY(GX_VA_CLR0, mp_colors, sizeof(l_flowerColor2), 4, true);
GXSETARRAY(GX_VA_TEX0, mp_texCoords, sizeof(l_flowerTexCoord2), 8, true);
sp5C = m_room;
+4 -4
View File
@@ -536,10 +536,10 @@ void dGrass_packet_c::draw() {
GXSetVtxDescv(l_vtxDescList);
GXSetVtxAttrFmtv(GX_VTXFMT0, l_vtxAttrFmtList);
GXSETARRAY(GX_VA_POS, mp_pos, sizeof(l_pos), sizeof(Vec));
GXSETARRAY(GX_VA_NRM, mp_normal, sizeof(l_normal), sizeof(Vec));
GXSETARRAY(GX_VA_CLR0, mp_colors, sizeof(l_color), sizeof(GXColor));
GXSETARRAY(GX_VA_TEX0, mp_texCoords, sizeof(l_texCoord), 8);
GXSETARRAY(GX_VA_POS, mp_pos, sizeof(l_pos), sizeof(Vec), true);
GXSETARRAY(GX_VA_NRM, mp_normal, sizeof(l_normal), sizeof(Vec), true);
GXSETARRAY(GX_VA_CLR0, mp_colors, sizeof(l_color), sizeof(GXColor), true);
GXSETARRAY(GX_VA_TEX0, mp_texCoords, sizeof(l_texCoord), 8, true);
GXColorS10 spA0 = {0, 0, 0, 0};
GXColorS10 sp98 = {0, 0, 0, 0};
+2 -2
View File
@@ -1521,7 +1521,7 @@ void dDlst_shadowControl_c::draw(Mtx param_0) {
dKy_GxFog_set();
GXSetChanCtrl(GX_ALPHA0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
GXSETARRAY(GX_VA_POS, l_shadowVolPos, sizeof(l_shadowVolPos), sizeof(l_shadowVolPos[0]));
GXSETARRAY(GX_VA_POS, l_shadowVolPos, sizeof(l_shadowVolPos), sizeof(l_shadowVolPos[0]), true);
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_POS, GX_TEXMTX0);
GXSetNumTevStages(1);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
@@ -1553,7 +1553,7 @@ void dDlst_shadowControl_c::draw(Mtx param_0) {
GXSetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGB8, 0);
GXSETARRAY(GX_VA_POS, l_simpleShadowPos, sizeof(l_simpleShadowPos), sizeof(l_simpleShadowPos[0]));
GXSETARRAY(GX_VA_POS, l_simpleShadowPos, sizeof(l_simpleShadowPos), sizeof(l_simpleShadowPos[0]), true);
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
+1 -1
View File
@@ -375,7 +375,7 @@ void renderingAmap_c::draw() {
dMap_HIO_prm_res_dst_s::m_res->field_0x1a7, tmp);
setAmapPaletteColor(0x2E, temp_r31, temp_r30, temp_r29, temp_r28);
renderingDAmap_c::draw();
GX_DEBUG_GROUP(renderingDAmap_c::draw);
}
int renderingAmap_c::getDispType() const {
+13 -5
View File
@@ -292,11 +292,22 @@ void dDrawPath_c::rendering(dDrawPath_c::floor_class const* p_floor) {
}
}
#ifdef TARGET_PC
static u32 getRoomPosArraySize(const dDrawPath_c::room_class* room) {
if (room->mpFloor == NULL || room->mpFloatData == NULL || room->mFloorNum == 0) {
return 0;
}
const dDrawPath_c::group_class* firstGroup = room->mpFloor[0].mpGroup;
JUT_ASSERT(0, firstGroup != NULL);
JUT_ASSERT(0, (const u8*)firstGroup >= (const u8*)room->mpFloatData);
return (const u8*)firstGroup - (const u8*)room->mpFloatData;
}
#endif
void dDrawPath_c::rendering(dDrawPath_c::room_class const* room) {
JUT_ASSERT(1043, room != NULL);
if (room != NULL) {
// TODO: FILL IN SIZE.
GXSETARRAY(GX_VA_POS, room->mpFloatData, 0, 8);
GXSetArray(GX_VA_POS, room->mpFloatData, getRoomPosArraySize(room), 8, false);
floor_class* floor = room->mpFloor;
if (floor != NULL) {
@@ -492,13 +503,10 @@ void dRenderingFDAmap_c::renderingDecoration(dDrawPath_c::line_class const* p_li
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
#endif
// aurora doesn't support GX_POINTS yet
#if !TARGET_PC
GXBegin(GX_POINTS, GX_VTXFMT0, 1);
GXPosition1x16(data_p[0]);
GXTexCoord2f32(0, 0);
GXEnd();
#endif
data_p++;
}
+3 -3
View File
@@ -848,7 +848,7 @@ void renderingPlusDoor_c::drawDoorCommon(stage_tgsc_data_class const* i_doorData
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGB565, 0);
GXSETARRAY(GX_VA_TEX0, (void*)l_tex0, sizeof(l_tex0), 2);
GXSETARRAY(GX_VA_TEX0, l_tex0, sizeof(l_tex0), 2, true);
setTevSettingIntensityTextureToCI();
@@ -1007,7 +1007,7 @@ void renderingPlusDoorAndCursor_c::drawTreasure() {
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGB, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGB565, 0);
GXSETARRAY(GX_VA_TEX0, (void*)l_iconTex0, sizeof(l_iconTex0), 2);
GXSETARRAY(GX_VA_TEX0, l_iconTex0, sizeof(l_iconTex0), 2, true);
setTevSettingIntensityTextureToCI();
@@ -1081,7 +1081,7 @@ void renderingPlusDoorAndCursor_c::drawTreasureAfterPlayer() {
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGB, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGB565, 0);
GXSETARRAY(GX_VA_TEX0, (void*)l_iconTex0, sizeof(l_iconTex0), 2);
GXSETARRAY(GX_VA_TEX0, l_iconTex0, sizeof(l_iconTex0), 2, true);
setTevSettingIntensityTextureToCI();
+8 -8
View File
@@ -2383,8 +2383,8 @@ void mDoExt_3DlineMat0_c::draw() {
int var_r26 = (field_0x14 << 1) & 0xFFFF;
for (int i = 0; i < field_0x10; i++) {
GXSETARRAY(GX_VA_POS, field_0x18->field_0x8[field_0x16], sizeof(cXyz) * var_r26, sizeof(cXyz));
GXSETARRAY(GX_VA_NRM, field_0x18->field_0x10[field_0x16], 3 * var_r26, 3);
GXSETARRAY(GX_VA_POS, field_0x18->field_0x8[field_0x16], sizeof(cXyz) * var_r26, sizeof(cXyz), true);
GXSETARRAY(GX_VA_NRM, field_0x18->field_0x10[field_0x16], 3 * var_r26, 3, true);
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT0, var_r26);
for (u16 j = 0; j < (u16)var_r26; j++) {
@@ -2699,11 +2699,11 @@ void mDoExt_3DlineMat1_c::draw() {
mDoExt_3Dline_c* lines = mpLines;
u16 vert_num = field_0x34 << 1;
for (s32 i = 0; i < mNumLines; i++) {
GXSETARRAY(GX_VA_POS, lines->field_0x8[mIsDrawn], vert_num * sizeof(cXyz), sizeof(cXyz));
GXSETARRAY(GX_VA_POS, lines->field_0x8[mIsDrawn], vert_num * sizeof(cXyz), sizeof(cXyz), true);
GXSETARRAY(GX_VA_NRM, lines->field_0x10[mIsDrawn],
vert_num * sizeof(mDoExt_3Dline_field_0x10_c),
sizeof(mDoExt_3Dline_field_0x10_c));
GXSETARRAY(GX_VA_TEX0, lines->field_0x18[mIsDrawn], vert_num * sizeof(cXy), sizeof(cXy));
sizeof(mDoExt_3Dline_field_0x10_c), true);
GXSETARRAY(GX_VA_TEX0, lines->field_0x18[mIsDrawn], vert_num * sizeof(cXy), sizeof(cXy), true);
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT0, vert_num);
u16 j = 0;
@@ -3036,7 +3036,7 @@ mDoExt_cube8pPacket::mDoExt_cube8pPacket(cXyz* i_points, const GXColor& i_color)
}
void drawCube(MtxP mtx, cXyz* pos, const GXColor& color) {
GXSETARRAY(GX_VA_POS, pos, sizeof(*pos), sizeof(*pos));
GXSETARRAY(GX_VA_POS, pos, sizeof(cXyz) * 8, sizeof(cXyz), true);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GXClearVtxDesc();
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
@@ -3115,7 +3115,7 @@ mDoExt_quadPacket::mDoExt_quadPacket(cXyz* i_points, const GXColor& i_color, u8
}
void mDoExt_quadPacket::draw() {
GXSETARRAY(GX_VA_POS, mPoints, sizeof(mPoints), sizeof(cXyz));
GXSETARRAY(GX_VA_POS, mPoints, sizeof(mPoints), sizeof(cXyz), true);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GXClearVtxDesc();
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
@@ -3167,7 +3167,7 @@ mDoExt_trianglePacket::mDoExt_trianglePacket(cXyz* i_points, const GXColor& i_co
void mDoExt_trianglePacket::draw() {
j3dSys.reinitGX();
GXSETARRAY(GX_VA_POS, mPoints, sizeof(mPoints), sizeof(cXyz));
GXSETARRAY(GX_VA_POS, mPoints, sizeof(mPoints), sizeof(cXyz), true);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GXClearVtxDesc();
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);