From b3eae0e5b7bcc2c5d3c8a1d562f0737d80c7e35c Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Sat, 8 Jul 2023 14:41:25 -0400 Subject: Port OoT's docs for `fault.c` and `fault_drawer.c` (#1199) * fault.h * some docs stealing * fix building * fault_internal.h * pass * finish stealing docs * finish cleanup * format * warning * Update src/boot_O2_g3/fault.c Co-authored-by: Derek Hensley * Update src/boot_O2_g3/fault.c Co-authored-by: Derek Hensley * Update src/boot_O2_g3/fault.c Co-authored-by: Derek Hensley * review Co-authored-by: Derek Hensley * arggggg * arggggg part 2 * STACK * PHYS_TO_K0(0x400000) * format * fix * Instance * format * Neutral reset * variables.h cleanup * bss * frameBuffer * format * Update src/boot_O2_g3/fault.c Co-authored-by: Derek Hensley * review Co-authored-by: Derek Hensley * Update src/boot_O2_g3/fault.c Co-authored-by: Derek Hensley * bss * bss * bss * callback cleanup * fix function declarations * fix again * bss * bss * Update src/overlays/actors/ovl_En_Fishing/z_en_fishing.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/boot_O2_g3/fault.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * bss * bss * Update src/boot_O2_g3/fault.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * review * import bss * format * minor cleanup * bss * review * fix * bss * bss * bss * bss * bss * format * a * Z_PRIORITY_FAULT * bss * fix * idle.c bss doesn't want to get fixed :c * review * bss --------- Co-authored-by: Derek Hensley Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --- src/code/graph.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src/code/graph.c') diff --git a/src/code/graph.c b/src/code/graph.c index 6d4665b39..ce929e6c0 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -1,5 +1,17 @@ -#include "prevent_bss_reordering.h" -#include "global.h" +#include "z64.h" +#include "regs.h" +#include "functions.h" +#include "fault.h" + +// Variables are put before most headers as a hacky way to bypass bss reordering +FaultAddrConvClient sGraphFaultAddrConvClient; +FaultClient sGraphFaultClient; +GfxMasterList* gGfxMasterDL; +CfbInfo sGraphCfbInfos[3]; +OSTime sGraphTaskStartTime; + +#include "variables.h" +#include "macros.h" #include "buffers.h" #include "idle.h" #include "system_malloc.h" @@ -10,12 +22,6 @@ #include "overlays/gamestates/ovl_title/z_title.h" #include "z_title_setup.h" -FaultAddrConvClient sGraphFaultAddrConvClient; -FaultClient sGraphFaultClient; -GfxMasterList* gGfxMasterDL; -CfbInfo sGraphCfbInfos[3]; -OSTime sGraphTaskStartTime; - void Graph_FaultClient(void) { FaultDrawer_DrawText(30, 100, "ShowFrameBuffer PAGE 0/1"); osViSwapBuffer(SysCfb_GetFramebuffer(0)); @@ -93,7 +99,7 @@ GameStateOverlay* Graph_GetNextGameState(GameState* gameState) { return NULL; } -void* Graph_FaultAddrConv(void* address, void* param) { +uintptr_t Graph_FaultAddrConv(uintptr_t address, void* param) { uintptr_t addr = address; GameStateOverlay* gameStateOvl = &gGameStateOverlayTable[0]; size_t ramConv; @@ -112,7 +118,7 @@ void* Graph_FaultAddrConv(void* address, void* param) { } } } - return NULL; + return 0; } void Graph_Init(GraphicsContext* gfxCtx) { @@ -124,7 +130,7 @@ void Graph_Init(GraphicsContext* gfxCtx) { gfxCtx->xScale = gViConfigXScale; gfxCtx->yScale = gViConfigYScale; osCreateMesgQueue(&gfxCtx->queue, gfxCtx->msgBuff, ARRAY_COUNT(gfxCtx->msgBuff)); - Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, NULL, NULL); + Fault_AddClient(&sGraphFaultClient, (void*)Graph_FaultClient, NULL, NULL); Fault_AddAddrConvClient(&sGraphFaultAddrConvClient, Graph_FaultAddrConv, NULL); } @@ -354,7 +360,7 @@ void Graph_ThreadEntry(void* arg) { gGfxSPTaskOutputBufferEndHiRes = (u8*)gGfxSPTaskOutputBufferHiRes + sizeof(*gGfxSPTaskOutputBufferHiRes); SysCfb_Init(); - Fault_SetFB(gWorkBuffer, SCREEN_WIDTH, SCREEN_HEIGHT); + Fault_SetFrameBuffer(gWorkBuffer, SCREEN_WIDTH, SCREEN_HEIGHT); Graph_Init(&gfxCtx); while (nextOvl) { -- cgit v1.2.3