diff --git a/mm/src/code/graph.c b/mm/src/code/graph.c index 219df9897..0766de493 100644 --- a/mm/src/code/graph.c +++ b/mm/src/code/graph.c @@ -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++); diff --git a/mm/src/code/z_fbdemo_fade.c b/mm/src/code/z_fbdemo_fade.c index 3d4f1933e..9118bf59a 100644 --- a/mm/src/code/z_fbdemo_fade.c +++ b/mm/src/code/z_fbdemo_fade.c @@ -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; } } diff --git a/mm/src/code/z_kankyo.c b/mm/src/code/z_kankyo.c index f21865065..3e3775f83 100644 --- a/mm/src/code/z_kankyo.c +++ b/mm/src/code/z_kankyo.c @@ -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); diff --git a/mm/src/code/z_play.c b/mm/src/code/z_play.c index 02d67be05..f8b601a78 100644 --- a/mm/src/code/z_play.c +++ b/mm/src/code/z_play.c @@ -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; diff --git a/mm/src/code/z_play_hireso.c b/mm/src/code/z_play_hireso.c index 6364a6997..b05b3ae4b 100644 --- a/mm/src/code/z_play_hireso.c +++ b/mm/src/code/z_play_hireso.c @@ -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); diff --git a/mm/src/code/z_rcp.c b/mm/src/code/z_rcp.c index 98f50b3ae..fc0794e31 100644 --- a/mm/src/code/z_rcp.c +++ b/mm/src/code/z_rcp.c @@ -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); diff --git a/mm/src/code/z_viscvg.c b/mm/src/code/z_viscvg.c index 4edef66df..1f0c3bc22 100644 --- a/mm/src/code/z_viscvg.c +++ b/mm/src/code/z_viscvg.c @@ -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) { diff --git a/mm/src/code/z_visfbuf.c b/mm/src/code/z_visfbuf.c index 79d403d27..85f495e7a 100644 --- a/mm/src/code/z_visfbuf.c +++ b/mm/src/code/z_visfbuf.c @@ -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; } diff --git a/mm/src/code/z_vismono.c b/mm/src/code/z_vismono.c index 94ccd5cf4..510d027ef 100644 --- a/mm/src/code/z_vismono.c +++ b/mm/src/code/z_vismono.c @@ -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); diff --git a/mm/src/code/z_viszbuf.c b/mm/src/code/z_viszbuf.c index 2a4856af9..a6ae02fb3 100644 --- a/mm/src/code/z_viszbuf.c +++ b/mm/src/code/z_viszbuf.c @@ -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++, diff --git a/mm/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/mm/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index 5510fad02..5c80d0343 100644 --- a/mm/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/mm/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -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); diff --git a/mm/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/mm/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index e6353dc32..f168c225b 100644 --- a/mm/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/mm/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -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 diff --git a/mm/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/mm/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index e2b281cd9..0c01e8c3b 100644 --- a/mm/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/mm/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -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); diff --git a/mm/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c b/mm/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c index 7b506e8b6..e9e361d41 100644 --- a/mm/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c +++ b/mm/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c @@ -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); }