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 <hensley.derek58@gmail.com>

* Update src/boot_O2_g3/fault.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/boot_O2_g3/fault.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* review

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* 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 <hensley.derek58@gmail.com>

* review

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/boot_O2_g3/fault.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* 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 <hensley.derek58@gmail.com>
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
Anghelo Carvajal
2023-07-08 14:41:25 -04:00
committed by GitHub
parent a506e8620a
commit b3eae0e5b7
41 changed files with 1007 additions and 874 deletions
+18 -12
View File
@@ -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) {
+4 -3
View File
@@ -1,12 +1,11 @@
#include "audiomgr.h"
#include "fault.h"
#include "idle.h"
#include "irqmgr.h"
#include "padmgr.h"
#include "scheduler.h"
#include "stack.h"
#include "stackcheck.h"
#include "system_heap.h"
#include "z64thread.h"
// Variables are put before most headers as a hacky way to bypass bss reordering
OSMesgQueue sSerialEventQueue;
@@ -32,6 +31,8 @@ PadMgr gPadMgr;
#include "main.h"
#include "buffers.h"
#include "global.h"
#include "system_heap.h"
#include "z64thread.h"
s32 gScreenWidth = SCREEN_WIDTH;
s32 gScreenHeight = SCREEN_HEIGHT;
@@ -47,7 +48,7 @@ void Main(void* arg) {
gScreenHeight = SCREEN_HEIGHT;
Nmi_Init();
Fault_Start();
Fault_Init();
Check_RegionIsSupported();
Check_ExpansionPak();
+3 -1
View File
@@ -30,9 +30,11 @@
* `osContStartReadData` to receiving the data. By running this on a separate thread to the game state, work can be
* done while waiting for this operation to complete.
*/
#include "global.h"
#include "io/controller.h"
#include "ultra64/motor.h"
#include "fault.h"
#define PADMGR_RETRACE_MSG (1 << 0)
#define PADMGR_PRE_NMI_MSG (1 << 1)
@@ -641,7 +643,7 @@ void PadMgr_HandleRetrace(void) {
}
// Rumble Pak
if (gFaultStruct.msgId != 0) {
if (gFaultMgr.msgId != 0) {
// If fault is active, no rumble
PadMgr_RumbleStop();
} else if (sPadMgrInstance->rumbleOffTimer > 0) {
+14 -10
View File
@@ -1,15 +1,8 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "fault.h"
#include "idle.h"
#include "stackcheck.h"
#include "z64thread.h"
#define RSP_DONE_MSG 667
#define RDP_DONE_MSG 668
#define ENTRY_MSG 670
#define RDP_AUDIO_CANCEL_MSG 671
#define RSP_GFX_CANCEL_MSG 672
#include "z64.h"
// Variables are put before most headers as a hacky way to bypass bss reordering
FaultClient sSchedFaultClient;
OSTime sRSPGFXStartTime;
@@ -20,6 +13,17 @@ OSTime sRDPStartTime;
u64* gAudioSPDataPtr;
u32 gAudioSPDataSize;
#include "functions.h"
#include "variables.h"
#include "stackcheck.h"
#include "z64thread.h"
#define RSP_DONE_MSG 667
#define RDP_DONE_MSG 668
#define ENTRY_MSG 670
#define RDP_AUDIO_CANCEL_MSG 671
#define RSP_GFX_CANCEL_MSG 672
void Sched_SwapFramebuffer(CfbInfo* cfbInfo) {
if (cfbInfo->swapBuffer != NULL) {
osViSwapBuffer(cfbInfo->swapBuffer);
+1
View File
@@ -1,5 +1,6 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "fault.h"
#include "stack.h"
#include "stackcheck.h"
#include "system_malloc.h"
+2 -1
View File
@@ -7,6 +7,7 @@
* are DMA'd directly to fixed RAM addresses.
*/
#include "global.h"
#include "fault.h"
#include "misc/locerrmsg/locerrmsg.h"
#include "misc/memerrmsg/memerrmsg.h"
@@ -23,7 +24,7 @@
// Address with enough room after to load either of the error message image files before the fault screen buffer at the
// end of RDRAM
#define CHECK_ERRMSG_STATIC_SEGMENT (u8*)(FAULT_FB_ADDRESS - MAX(SIZEOF_LOCERRMSG, SIZEOF_MEMERRMSG))
#define CHECK_ERRMSG_STATIC_SEGMENT (u8*)((uintptr_t)FAULT_FB_ADDRESS - MAX(SIZEOF_LOCERRMSG, SIZEOF_MEMERRMSG))
void Check_WriteRGBA16Pixel(u16* buffer, u32 x, u32 y, u32 value) {
if (value & RGBA16_PIXEL_OPAQUE) {
+1
View File
@@ -39,6 +39,7 @@
* (APPLY), or to just overwrite it (NEW).
*/
#include "prevent_bss_reordering.h"
#include "global.h"
/* data */
+1
View File
@@ -4,6 +4,7 @@
*/
#include "global.h"
#include "fault.h"
#include "loadfragment.h"
#include "z64horse.h"
#include "z64quake.h"
+4 -2
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "fault.h"
// Init Vars declarations (also used in the table below)
#define DEFINE_ACTOR(name, _enumValue, _allocType, _debugName) extern ActorInit name##_InitVars;
@@ -60,7 +61,7 @@ void ActorOverlayTable_FaultClient(void* arg0, void* arg1) {
}
}
void* ActorOverlayTable_FaultAddrConv(void* address, void* param) {
uintptr_t ActorOverlayTable_FaultAddrConv(uintptr_t address, void* param) {
uintptr_t addr = address;
ActorOverlay* actorOvl = &gActorOverlayTable[0];
size_t ramConv;
@@ -79,7 +80,8 @@ void* ActorOverlayTable_FaultAddrConv(void* address, void* param) {
}
}
}
return NULL;
return 0;
}
void ActorOverlayTable_Init(void) {
+7 -7
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "fault.h"
#include "fixed_point.h"
#include "vt.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
@@ -80,9 +81,15 @@ BgSpecialSceneMaxObjects sCustomDynapolyMem[] = {
// TODO: All these bss variables are localized to one function and can
// likely be made into in-function static bss variables in the future
char D_801ED950[80];
char D_801ED9A0[80];
Vec3f D_801ED9F0[3]; // polyVerts
Vec3f D_801EDA18[3]; // polyVerts
MtxF sModelToWorldMtxF;
Vec3f D_801EDA80[3]; // polyVerts
char D_801EDAA8[80];
char D_801EDAF8[80];
Vec3f D_801EDB48[3]; // polyVerts
#ifndef NON_MATCHING
@@ -92,13 +99,6 @@ Sphere16 D_801EDBA8; // sphere;
TriNorm D_801EDBB0; // tri;
#endif
char D_801ED950[80];
char D_801ED9A0[80];
char D_801EDAA8[80];
char D_801EDAF8[80];
MtxF sModelToWorldMtxF;
void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector);
f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast);
s32 BgCheck_SphVsDynaWall(CollisionContext* colCtx, u16 xpFlags, f32* outX, f32* outZ, Vec3f* pos, f32 radius,
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "z64collision_check.h"
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "z64quake.h"
#include "z64rumble.h"
+3 -2
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "fault.h"
#include "loadfragment.h"
#define KALEIDO_OVERLAY(name) \
@@ -16,7 +17,7 @@ void* sKaleidoAreaPtr = NULL;
KaleidoMgrOverlay* gKaleidoMgrCurOvl = NULL;
FaultAddrConvClient sKaleidoMgrFaultAddrConvClient;
void* KaleidoManager_FaultAddrConv(void* address, void* param) {
uintptr_t KaleidoManager_FaultAddrConv(uintptr_t address, void* param) {
uintptr_t addr = address;
KaleidoMgrOverlay* kaleidoMgrOvl = gKaleidoMgrCurOvl;
size_t ramConv;
@@ -34,7 +35,7 @@ void* KaleidoManager_FaultAddrConv(void* address, void* param) {
}
}
}
return NULL;
return 0;
}
void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl) {
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "buffers.h"
#include "idle.h"
-1
View File
@@ -3,7 +3,6 @@
* Description: Set of library functions to interact with the Player system
*/
#include "prevent_bss_reordering.h"
#include "global.h"
#include "objects/gameplay_keep/gameplay_keep.h"