Chore: Replace rest of segment 0x0E calculations with macro (#16)

* replace rest of segment 0x0E calculations with macro

* switch to original gsp macro
This commit is contained in:
Archez 2024-01-10 22:57:43 -05:00 committed by Garrett Cox
parent e392725058
commit 8c91bab60f
14 changed files with 28 additions and 43 deletions

View File

@ -275,19 +275,12 @@ void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState) {
{
Gfx* gfx = gGfxMasterDL->taskStart;
gSPSegment(gfx++, 0x0E, gGfxMasterDL->taskStart);
//__gSPDisplayList(gfx++, 0x0E000000 + ((uintptr_t)&D_0E000000.disps[3] - (uintptr_t)&D_0E000000) + 1);
//__gSPDisplayList(gfx++, 0x0E000000 + ((uintptr_t)&D_0E000000.disps[0] - (uintptr_t)&D_0E000000) + 1);
//__gSPDisplayList(gfx++, 0x0E000000 + ((uintptr_t)&D_0E000000.disps[1] - (uintptr_t)&D_0E000000) + 1);
//__gSPDisplayList(gfx++, 0x0E000000 + ((uintptr_t)&D_0E000000.disps[2] - (uintptr_t)&D_0E000000) + 1);
//__gSPDisplayList(gfx++, 0x0E000000 + ((uintptr_t)&D_0E000000.debugDisp[0] - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(gfx++, gfxCtx->work.start);
gSPDisplayList(gfx++, gGfxPools[gfxCtx->gfxPoolIdx % 2].workBuffer);
gSPDisplayList(gfx++, gGfxPools[gfxCtx->gfxPoolIdx % 2].polyOpaBuffer);
gSPDisplayList(gfx++, gGfxPools[gfxCtx->gfxPoolIdx % 2].polyXluBuffer);
gSPDisplayList(gfx++, gGfxPools[gfxCtx->gfxPoolIdx % 2].overlayBuffer);
gSPDisplayList(gfx++, gGfxPools[gfxCtx->gfxPoolIdx % 2].debugBuffer);
gSPSegment(gfx++, 0x0E, gGfxMasterDL);
gSPDisplayList(gfx++, D_0E000000_TO_SEGMENTED(disps[3])); // Work buffer
gSPDisplayList(gfx++, D_0E000000_TO_SEGMENTED(disps[0])); // OPA buffer
gSPDisplayList(gfx++, D_0E000000_TO_SEGMENTED(disps[1])); // XLU buffer
gSPDisplayList(gfx++, D_0E000000_TO_SEGMENTED(disps[2])); // Overlay buffer
gSPDisplayList(gfx++, D_0E000000_TO_SEGMENTED(debugDisp[0])); // Debug buffer
gDPPipeSync(gfx++);
gDPFullSync(gfx++);

View File

@ -116,7 +116,7 @@ void TransitionFade_Draw(void* thisx, Gfx** gfxP) {
gfx = *gfxP;
gSPDisplayList(gfx++, sTransFadeSetupDL);
gDPSetPrimColor(gfx++, 0, 0, color->r, color->g, color->b, color->a);
gSPDisplayList(gfx++, 0x0E000000 + ((uintptr_t)&D_0E000000.fillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(gfx++, D_0E000000_TO_SEGMENTED(fillRect));
*gfxP = gfx;
}
}

View File

@ -1998,7 +1998,7 @@ void Environment_DrawLensFlare(PlayState* play, EnvironmentContext* envCtx, View
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, (u8)(weight * 75.0f) + 180, (u8)(weight * 155.0f) + 100,
(u8)envCtx->glareAlpha);
gSPDisplayList(POLY_XLU_DISP++, 0x0E000000 + ((uintptr_t)&D_0E000000.clearFillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_XLU_DISP++, D_0E000000_TO_SEGMENTED(clearFillRect));
} else {
envCtx->glareAlpha = 0.0f;
}
@ -2180,7 +2180,7 @@ void Environment_DrawSkyboxFilters(PlayState* play) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, play->lightCtx.fogColor[0] + 16, play->lightCtx.fogColor[1] + 16,
play->lightCtx.fogColor[2] + 16, 255.0f * D_801F4E74);
}
gSPDisplayList(POLY_OPA_DISP++, 0x0E000000 + ((uintptr_t)&D_0E000000.clearFillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_OPA_DISP++, D_0E000000_TO_SEGMENTED(clearFillRect));
CLOSE_DISPS(play->state.gfxCtx);
}
@ -2191,7 +2191,7 @@ void Environment_DrawSkyboxFilters(PlayState* play) {
Gfx_SetupDL57_Opa(play->state.gfxCtx);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, play->envCtx.skyboxFilterColor[0], play->envCtx.skyboxFilterColor[1],
play->envCtx.skyboxFilterColor[2], play->envCtx.skyboxFilterColor[3]);
gSPDisplayList(POLY_OPA_DISP++, 0x0E000000 + ((uintptr_t)&D_0E000000.clearFillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_OPA_DISP++, D_0E000000_TO_SEGMENTED(clearFillRect));
CLOSE_DISPS(play->state.gfxCtx);
}
@ -2202,7 +2202,7 @@ void Environment_DrawLightningFlash(PlayState* play, u8 red, u8 green, u8 blue,
Gfx_SetupDL57_Opa(play->state.gfxCtx);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, red, green, blue, alpha);
gSPDisplayList(POLY_OPA_DISP++, 0x0E000000 + ((uintptr_t)&D_0E000000.clearFillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_OPA_DISP++, D_0E000000_TO_SEGMENTED(clearFillRect));
CLOSE_DISPS(play->state.gfxCtx);
}
@ -2657,8 +2657,7 @@ void Environment_FillScreen(GraphicsContext* gfxCtx, u8 red, u8 green, u8 blue,
gDPSetAlphaDither(POLY_OPA_DISP++, G_AD_DISABLE);
gDPSetColorDither(POLY_OPA_DISP++, G_CD_DISABLE);
__gSPDisplayList(POLY_OPA_DISP++,
0x0E000000 + ((uintptr_t)&D_0E000000.clearFillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_OPA_DISP++, D_0E000000_TO_SEGMENTED(clearFillRect));
}
if (drawFlags & FILL_SCREEN_XLU) {
@ -2672,8 +2671,7 @@ void Environment_FillScreen(GraphicsContext* gfxCtx, u8 red, u8 green, u8 blue,
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE);
gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE);
__gSPDisplayList(POLY_XLU_DISP++,
0x0E000000 + ((uintptr_t)&D_0E000000.clearFillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_XLU_DISP++, D_0E000000_TO_SEGMENTED(clearFillRect));
}
CLOSE_DISPS(gfxCtx);

View File

@ -1275,8 +1275,7 @@ void Play_DrawMain(PlayState* this) {
func_80170798(&this->pauseBgPreRender, &sp8C);
}
__gSPDisplayList(sp8C++,
0x0E000000 + ((uintptr_t)&D_0E000000.syncSegments - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(sp8C++, D_0E000000_TO_SEGMENTED(syncSegments));
POLY_OPA_DISP = sp8C;
sp25B = true;
goto PostWorldDraw;

View File

@ -1084,7 +1084,7 @@ void BombersNotebook_Draw(BombersNotebook* this, GraphicsContext* gfxCtx) {
gDPPipeSync(gfx++);
__gSPDisplayList(gfx++, 0x0E000000 + ((uintptr_t)&D_0E000000.setScissor - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(gfx++, D_0E000000_TO_SEGMENTED(setScissor));
BombersNotebook_DrawTimeOfDay(&gfx);

View File

@ -1458,7 +1458,7 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g
masterGfx = gGfxMasterDL->setupBuffers;
__gSPDisplayList(&masterGfx[0], 0x0E000000 + ((uintptr_t)&D_0E000000.syncSegments - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(&masterGfx[0], D_0E000000_TO_SEGMENTED(syncSegments));
gSPDisplayList(&masterGfx[1], sFillSetupDL);
@ -1490,7 +1490,7 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g
gDPSetRenderMode(&masterGfx[3], G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor(&masterGfx[4], (GPACK_RGBA5551(255, 255, 240, 0) << 16) | GPACK_RGBA5551(255, 255, 240, 0));
gSPDisplayList(&masterGfx[5], 0x0E000000 + ((uintptr_t)&D_0E000000.clearFillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(&masterGfx[5], D_0E000000_TO_SEGMENTED(clearFillRect));
gDPSetColorImage(&masterGfx[6], G_IM_FMT_RGBA, G_IM_SIZ_16b, gCfbWidth, D_0F000000);
gSPEndDisplayList(&masterGfx[7]);
@ -1505,7 +1505,7 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g
gDPSetRenderMode(&masterGfx[2], G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor(&masterGfx[3], (GPACK_RGBA5551(r, g, b, 1) << 16) | GPACK_RGBA5551(r, g, b, 1));
gSPBranchList(&masterGfx[4], 0x0E000000 + ((uintptr_t)&D_0E000000.clearFillRect - (uintptr_t)&D_0E000000) + 1);
gSPBranchList(&masterGfx[4], D_0E000000_TO_SEGMENTED(clearFillRect));
// Fillrect used by the above buffer clearing routines
@ -1544,12 +1544,10 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g
gSPDisplayList(DEBUG_DISP++, gGfxMasterDL->setupBuffers);
if (clearZb) {
__gSPDisplayList(POLY_OPA_DISP++,
0x0E000000 + ((uintptr_t)&D_0E000000.clearZBuffer - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_OPA_DISP++, D_0E000000_TO_SEGMENTED(clearZBuffer));
}
if (clearFb) {
__gSPDisplayList(POLY_OPA_DISP++,
0x0E000000 + ((uintptr_t)&D_0E000000.clearFrameBuffer - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_OPA_DISP++, D_0E000000_TO_SEGMENTED(clearFrameBuffer));
}
CLOSE_DISPS(gfxCtx);

View File

@ -59,7 +59,7 @@ void VisCvg_Draw(VisCvg* this, Gfx** gfxp) {
gDPSetPrimDepth(gfx++, -1, -1);
if (this->setScissor == true) {
__gSPDisplayList(gfx++, 0x0E000000 + ((uintptr_t)&D_0E000000.setScissor - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(gfx++, D_0E000000_TO_SEGMENTED(setScissor));
}
switch (this->type) {

View File

@ -54,7 +54,7 @@ void VisFbuf_DrawBgToColorImage(Gfx** gfxP, uObjBg* bg, void* img, s32 width, s3
gDPPipeSync(gfx++);
// Reset the color image and scissor to frame's defaults
gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gCfbWidth, D_0F000000);
gSPDisplayList(gfx++, 0x0E000000 + ((uintptr_t)&D_0E000000.setScissor - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(gfx++, D_0E000000_TO_SEGMENTED(setScissor));
*gfxP = gfx;
}

View File

@ -154,7 +154,7 @@ void VisMono_Draw(VisMono* this, Gfx** gfxp) {
gDPPipeSync(gfx++);
if (this->setScissor == true) {
__gSPDisplayList(gfx++, 0x0E000000 + ((uintptr_t)&D_0E000000.setScissor - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(gfx++, D_0E000000_TO_SEGMENTED(setScissor));
}
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba);

View File

@ -33,7 +33,7 @@ void VisZbuf_Draw(VisZbuf* this, Gfx** gfxP, void* zbuffer) {
gDPPipeSync(gfx++);
if (this->setScissor == true) {
__gSPDisplayList(gfx++, 0x0E000000 + ((uintptr_t)&D_0E000000.setScissor - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(gfx++, D_0E000000_TO_SEGMENTED(setScissor));
}
gDPSetOtherMode(gfx++,

View File

@ -265,8 +265,7 @@ void ArrowFire_Draw(Actor* thisx, PlayState* play) {
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE);
gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE);
__gSPDisplayList(POLY_XLU_DISP++,
0x0E000000 + ((uintptr_t)&D_0E000000.fillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_XLU_DISP++, D_0E000000_TO_SEGMENTED(fillRect));
}
Gfx_SetupDL25_Xlu(play->state.gfxCtx);

View File

@ -208,8 +208,7 @@ void ArrowIce_Draw(Actor* thisx, PlayState* play) {
(s32)(150.0f * this->blueingEffectMagnitude) & 0xFF);
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE);
gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE);
__gSPDisplayList(POLY_XLU_DISP++,
0x0E000000 + ((uintptr_t)&D_0E000000.fillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_XLU_DISP++, D_0E000000_TO_SEGMENTED(fillRect));
}
// Draw ice on the arrow

View File

@ -200,8 +200,7 @@ void ArrowLight_Draw(Actor* thisx, PlayState* play) {
(s32)(150.0f * this->screenFillIntensity) & 0xFF);
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE);
gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE);
__gSPDisplayList(POLY_XLU_DISP++,
0x0E000000 + ((uintptr_t)&D_0E000000.fillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_XLU_DISP++, D_0E000000_TO_SEGMENTED(fillRect));
}
Gfx_SetupDL25_Xlu(play->state.gfxCtx);

View File

@ -2404,7 +2404,7 @@ void FileSelect_Main(GameState* thisx) {
gDPPipeSync(POLY_OPA_DISP++);
gSPDisplayList(POLY_OPA_DISP++, sScreenFillSetupDL);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, this->screenFillAlpha);
gSPDisplayList(POLY_OPA_DISP++, 0x0E000000 + ((uintptr_t)&D_0E000000.fillRect - (uintptr_t)&D_0E000000) + 1);
gSPDisplayList(POLY_OPA_DISP++, D_0E000000_TO_SEGMENTED(fillRect));
CLOSE_DISPS(this->state.gfxCtx);
}