Misc Cleanup (#1665)

* prefix in-function static data in z_scene_proc with s

prefix in-function static data in z_eff_blure with s

prefix in-function static data in Graph_TaskSet00 with s

prefix in-function static data in Fault_SetOptions with s

* Use uintptr_t in main

* hardware_regs.ld

* Remove some unessary blob comments

* object_link_child_TLUT_00DA80

* object_kz texture and tlut

* initialize typos
This commit is contained in:
Derek Hensley
2024-07-28 10:04:09 -07:00
committed by GitHub
parent d0cf4fbcea
commit 43cac34566
26 changed files with 185 additions and 195 deletions
+6 -6
View File
@@ -138,8 +138,8 @@ void Graph_Destroy(GraphicsContext* gfxCtx) {
* If it does not signal completion in that time, retry or trigger a crash.
*/
void Graph_TaskSet00(GraphicsContext* gfxCtx, GameState* gameState) {
static s32 retryCount = 10;
static s32 cfbIdx = 0;
static s32 sRetryCount = 10;
static s32 sCfbIndex = 0;
OSTask_t* task = &gfxCtx->task.list.t;
OSScTask* scTask = &gfxCtx->task;
OSTimer timer;
@@ -153,8 +153,8 @@ retry:
if (msg == (OSMesg)666) {
osSyncPrintf("GRAPH SP TIMEOUT\n");
if (retryCount >= 0) {
retryCount--;
if (sRetryCount >= 0) {
sRetryCount--;
Sched_SendGfxCancelMsg(&gScheduler);
goto retry;
} else {
@@ -200,8 +200,8 @@ retry:
{ s32 pad; }
cfb = &sGraphCfbInfos[cfbIdx];
cfbIdx = (cfbIdx + 1) % ARRAY_COUNT(sGraphCfbInfos);
cfb = &sGraphCfbInfos[sCfbIndex];
sCfbIndex = (sCfbIndex + 1) % ARRAY_COUNT(sGraphCfbInfos);
cfb->framebuffer = gfxCtx->curFrameBuffer;
cfb->swapBuffer = gfxCtx->curFrameBuffer;
+3 -3
View File
@@ -42,8 +42,8 @@ s32 gScreenHeight = SCREEN_HEIGHT;
size_t gSystemHeapSize = 0;
void Main(void* arg) {
intptr_t fb;
intptr_t sysHeap;
uintptr_t fb;
uintptr_t sysHeap;
s32 exit;
s16* msg;
@@ -55,7 +55,7 @@ void Main(void* arg) {
Check_RegionIsSupported();
Check_ExpansionPak();
sysHeap = (intptr_t)SEGMENT_START(system_heap);
sysHeap = (uintptr_t)SEGMENT_START(system_heap);
fb = FRAMEBUFFERS_START_ADDR;
gSystemHeapSize = fb - sysHeap;
SystemHeap_Init((void*)sysHeap, gSystemHeapSize);
+10 -10
View File
@@ -390,7 +390,7 @@ void EffectBlure_SetupSmooth(EffectBlure* this, GraphicsContext* gfxCtx) {
void EffectBlure_DrawElemNoInterpolation(EffectBlure* this, EffectBlureElement* elem, s32 index,
GraphicsContext* gfxCtx) {
static Vtx_t baseVtx = VTX_T(0, 0, 0, 0, 0, 255, 255, 255, 255);
static Vtx_t sBaseVtx = VTX_T(0, 0, 0, 0, 0, 255, 255, 255, 255);
Vtx* vtx;
Vec3s sp8C;
Vec3s sp84;
@@ -408,10 +408,10 @@ void EffectBlure_DrawElemNoInterpolation(EffectBlure* this, EffectBlureElement*
vtx = GRAPH_ALLOC(gfxCtx, 4 * sizeof(Vtx));
if (vtx == NULL) {
} else {
vtx[0].v = baseVtx;
vtx[1].v = baseVtx;
vtx[2].v = baseVtx;
vtx[3].v = baseVtx;
vtx[0].v = sBaseVtx;
vtx[1].v = sBaseVtx;
vtx[2].v = sBaseVtx;
vtx[3].v = sBaseVtx;
ratio = (f32)elem->timer / (f32)this->elemDuration;
EffectBlure_GetComputedValues(this, index, ratio, &sp8C, &sp84, &sp7C, &sp78);
@@ -480,7 +480,7 @@ void EffectBlure_DrawElemNoInterpolation(EffectBlure* this, EffectBlureElement*
void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElement* elem, s32 index,
GraphicsContext* gfxCtx) {
static Vtx_t baseVtx = VTX_T(0, 0, 0, 0, 0, 255, 255, 255, 255);
static Vtx_t sBaseVtx = VTX_T(0, 0, 0, 0, 0, 255, 255, 255, 255);
Vtx* vtx;
Vec3s sp1EC;
Vec3s sp1E4;
@@ -568,8 +568,8 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem
Color_RGBA8_Copy(&sp148, &sp1A4);
Color_RGBA8_Copy(&sp144, &sp1A0);
vtx[0].v = baseVtx;
vtx[1].v = baseVtx;
vtx[0].v = sBaseVtx;
vtx[1].v = sBaseVtx;
vtx[0].v.ob[0] = Math_FNearbyIntF(sp158.x);
vtx[0].v.ob[1] = Math_FNearbyIntF(sp158.y);
@@ -613,8 +613,8 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem
Math_Vec3f_Diff(&spE0, &sp138, &sp14C);
Math_Vec3f_Scale(&sp14C, 10.0f);
vtx[j1].v = baseVtx;
vtx[j2].v = baseVtx;
vtx[j1].v = sBaseVtx;
vtx[j2].v = sBaseVtx;
vtx[j1].v.ob[0] = Math_FNearbyIntF(sp158.x);
vtx[j1].v.ob[1] = Math_FNearbyIntF(sp158.y);
+1 -1
View File
@@ -54,5 +54,5 @@ void ZeldaArena_Cleanup(void) {
}
u8 ZeldaArena_IsInitialized(void) {
return __osMallocIsInitalized(&sZeldaArena);
return __osMallocIsInitialized(&sZeldaArena);
}
+20 -20
View File
@@ -23,7 +23,7 @@ static Gfx sSceneDrawDefaultDL[] = {
* Executes the current scene draw config handler.
*/
void Scene_Draw(PlayState* play) {
static void (*sceneDrawConfigHandlers[])(PlayState*) = {
static void (*sSceneDrawConfigHandlers[])(PlayState*) = {
Scene_DrawConfigDefault,
Scene_DrawConfigMatAnim,
Scene_DrawConfigDoNothing,
@@ -34,7 +34,7 @@ void Scene_Draw(PlayState* play) {
Scene_DrawConfigMatAnimManualStep,
};
sceneDrawConfigHandlers[play->sceneConfig](play);
sSceneDrawConfigHandlers[play->sceneConfig](play);
}
/**
@@ -386,7 +386,7 @@ void AnimatedMat_DrawTexCycle(PlayState* play, s32 segment, void* params) {
* There are six different animated material types, which should be set in the provided `AnimatedMaterial`.
*/
void AnimatedMat_DrawMain(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step, u32 flags) {
static void (*matAnimDrawHandlers[])(PlayState*, s32 segment, void* params) = {
static void (*sMatAnimDrawHandlers[])(PlayState*, s32 segment, void* params) = {
AnimatedMat_DrawTexScroll, AnimatedMat_DrawTwoTexScroll, AnimatedMat_DrawColor,
AnimatedMat_DrawColorLerp, AnimatedMat_DrawColorNonLinearInterp, AnimatedMat_DrawTexCycle,
};
@@ -401,7 +401,7 @@ void AnimatedMat_DrawMain(PlayState* play, AnimatedMaterial* matAnim, f32 alphaR
do {
segment = matAnim->segment;
segmentAbs = ABS_ALT(segment) + 7;
matAnimDrawHandlers[matAnim->type](play, segmentAbs, Lib_SegmentedToVirtual(matAnim->params));
sMatAnimDrawHandlers[matAnim->type](play, segmentAbs, Lib_SegmentedToVirtual(matAnim->params));
matAnim++;
} while (segment >= 0);
}
@@ -573,14 +573,14 @@ void Scene_DrawConfigDoNothing(PlayState* play) {
* Stores a displaylist in the provided segment ID that sets a render mode from the index provided.
*/
void Scene_SetRenderModeXlu(PlayState* play, s32 index, u32 flags) {
static Gfx renderModeSetNoneDL[] = {
static Gfx sRenderModeSetNoneDL[] = {
gsSPEndDisplayList(),
// These instructions will never get executed
gsSPEndDisplayList(),
gsSPEndDisplayList(),
gsSPEndDisplayList(),
};
static Gfx renderModeSetXluSingleCycleDL[] = {
static Gfx sRenderModeSetXluSingleCycleDL[] = {
gsDPSetRenderMode(AA_EN | Z_CMP | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL |
GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1),
G_RM_AA_ZB_XLU_SURF2),
@@ -591,7 +591,7 @@ void Scene_SetRenderModeXlu(PlayState* play, s32 index, u32 flags) {
G_RM_AA_ZB_XLU_SURF2),
gsSPEndDisplayList(),
};
static Gfx renderModeSetXluTwoCycleDL[] = {
static Gfx sRenderModeSetXluTwoCycleDL[] = {
gsDPSetRenderMode(AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL |
GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1),
AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL |
@@ -604,12 +604,12 @@ void Scene_SetRenderModeXlu(PlayState* play, s32 index, u32 flags) {
GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)),
gsSPEndDisplayList(),
};
static Gfx* dLists[] = {
renderModeSetNoneDL,
renderModeSetXluSingleCycleDL,
renderModeSetXluTwoCycleDL,
static Gfx* sDLists[] = {
sRenderModeSetNoneDL,
sRenderModeSetXluSingleCycleDL,
sRenderModeSetXluTwoCycleDL,
};
Gfx* dList = dLists[index];
Gfx* dList = sDLists[index];
OPEN_DISPS(play->state.gfxCtx);
@@ -629,19 +629,19 @@ void Scene_SetRenderModeXlu(PlayState* play, s32 index, u32 flags) {
* from the index provided.
*/
void Scene_SetCullFlag(PlayState* play, s32 index, u32 flags) {
static Gfx setBackCullDL[] = {
static Gfx sSetBackCullDL[] = {
gsSPSetGeometryMode(G_CULL_BACK),
gsSPEndDisplayList(),
};
static Gfx setFrontCullDL[] = {
static Gfx sSetFrontCullDL[] = {
gsSPSetGeometryMode(G_CULL_FRONT),
gsSPEndDisplayList(),
};
static Gfx* dLists[] = {
setBackCullDL,
setFrontCullDL,
static Gfx* sDLists[] = {
sSetBackCullDL,
sSetFrontCullDL,
};
Gfx* dList = dLists[index];
Gfx* dList = sDLists[index];
OPEN_DISPS(play->state.gfxCtx);
@@ -703,7 +703,7 @@ void Scene_DrawConfigMatAnimManualStep(PlayState* play) {
* activated.
*/
void Scene_DrawConfigGreatBayTemple(PlayState* play) {
static Gfx greatBayTempleColorSetDL[] = {
static Gfx sGreatBayTempleColorSetDL[] = {
gsDPSetPrimColor(0, 255, 255, 255, 255, 255),
gsSPEndDisplayList(),
};
@@ -728,7 +728,7 @@ void Scene_DrawConfigGreatBayTemple(PlayState* play) {
for (gfx = gfxHead, i = 0; i < 9; i++, gfx += 2) {
lodFrac = 0;
bcopy(greatBayTempleColorSetDL, gfx, sizeof(greatBayTempleColorSetDL));
bcopy(sGreatBayTempleColorSetDL, gfx, sizeof(sGreatBayTempleColorSetDL));
switch (i) {
case 0: