mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-03 20:10:31 -04:00
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:
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "fault.h"
|
||||
|
||||
void __assert(const char* file, u32 lineNum) {
|
||||
osGetThreadId(NULL);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "fault.h"
|
||||
|
||||
UNK_TYPE4 D_8009BE30;
|
||||
UNK_TYPE4 D_8009BE34;
|
||||
@@ -17,7 +18,7 @@ void CIC6105_PrintRomInfo(void) {
|
||||
}
|
||||
|
||||
void CIC6105_AddRomInfoFaultPage(void) {
|
||||
Fault_AddClient(&romInfoFaultClient, CIC6105_PrintRomInfo, 0, 0);
|
||||
Fault_AddClient(&romInfoFaultClient, (void*)CIC6105_PrintRomInfo, NULL, NULL);
|
||||
}
|
||||
|
||||
void CIC6105_RemoveRomInfoFaultPage(void) {
|
||||
|
||||
+587
-385
File diff suppressed because it is too large
Load Diff
+139
-96
@@ -1,28 +1,64 @@
|
||||
/**
|
||||
* @file fault_drawer.c
|
||||
*
|
||||
* Implements routines for drawing text with a fixed font directly to a framebuffer, used in displaying
|
||||
* the crash screen implemented by fault.c
|
||||
*/
|
||||
|
||||
#include "fault.h"
|
||||
#include "fault_internal.h"
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16* frameBuffer;
|
||||
/* 0x04 */ u16 w;
|
||||
/* 0x06 */ u16 h;
|
||||
/* 0x08 */ u16 yStart;
|
||||
/* 0x0A */ u16 yEnd;
|
||||
/* 0x0C */ u16 xStart;
|
||||
/* 0x0E */ u16 xEnd;
|
||||
/* 0x10 */ u16 foreColor;
|
||||
/* 0x12 */ u16 backColor;
|
||||
/* 0x14 */ u16 cursorX;
|
||||
/* 0x16 */ u16 cursorY;
|
||||
/* 0x18 */ const u32* fontData;
|
||||
/* 0x1C */ u8 charW;
|
||||
/* 0x1D */ u8 charH;
|
||||
/* 0x1E */ s8 charWPad;
|
||||
/* 0x1F */ s8 charHPad;
|
||||
/* 0x20 */ u16 printColors[10];
|
||||
/* 0x34 */ u8 escCode; // bool
|
||||
/* 0x35 */ u8 osSyncPrintfEnabled;
|
||||
/* 0x38 */ FaultDrawerCallback inputCallback;
|
||||
} FaultDrawer; // size = 0x3C
|
||||
|
||||
extern const u32 sFaultDrawerFont[];
|
||||
|
||||
FaultDrawer sFaultDrawerStruct;
|
||||
FaultDrawer sFaultDrawer;
|
||||
|
||||
FaultDrawer* sFaultDrawerInstance = &sFaultDrawer;
|
||||
|
||||
#define FAULT_DRAWER_CURSOR_X 22
|
||||
#define FAULT_DRAWER_CURSOR_Y 16
|
||||
|
||||
FaultDrawer* sFaultDrawContext = &sFaultDrawerStruct;
|
||||
FaultDrawer sFaultDrawerDefault = {
|
||||
FAULT_FB_ADDRESS, // fb
|
||||
SCREEN_WIDTH, // w
|
||||
SCREEN_HEIGHT, // h
|
||||
16, // yStart
|
||||
223, // yEnd
|
||||
22, // xStart
|
||||
297, // xEnd
|
||||
GPACK_RGBA5551(255, 255, 255, 255), // foreColor
|
||||
GPACK_RGBA5551(0, 0, 0, 0), // backColor
|
||||
22, // cursorX
|
||||
16, // cursorY
|
||||
sFaultDrawerFont, // font
|
||||
8, // charW
|
||||
8, // charH
|
||||
0, // charWPad
|
||||
0, // charHPad
|
||||
FAULT_FB_ADDRESS, // frameBuffer
|
||||
SCREEN_WIDTH, // w
|
||||
SCREEN_HEIGHT, // h
|
||||
FAULT_DRAWER_CURSOR_Y, // yStart
|
||||
SCREEN_HEIGHT - FAULT_DRAWER_CURSOR_Y - 1, // yEnd
|
||||
FAULT_DRAWER_CURSOR_X, // xStart
|
||||
SCREEN_WIDTH - FAULT_DRAWER_CURSOR_X - 1, // xEnd
|
||||
GPACK_RGBA5551(255, 255, 255, 255), // foreColor
|
||||
GPACK_RGBA5551(0, 0, 0, 0), // backColor
|
||||
FAULT_DRAWER_CURSOR_X, // cursorX
|
||||
FAULT_DRAWER_CURSOR_Y, // cursorY
|
||||
sFaultDrawerFont, // fontData
|
||||
8, // charW
|
||||
8, // charH
|
||||
0, // charWPad
|
||||
0, // charHPad
|
||||
{
|
||||
// printColors
|
||||
GPACK_RGBA5551(0, 0, 0, 1), // BLACK
|
||||
@@ -36,24 +72,24 @@ FaultDrawer sFaultDrawerDefault = {
|
||||
GPACK_RGBA5551(120, 120, 120, 1), // DARK GRAY
|
||||
GPACK_RGBA5551(176, 176, 176, 1), // LIGHT GRAY
|
||||
},
|
||||
0, // escCode
|
||||
0, // osSyncPrintfEnabled
|
||||
NULL, // inputCallback
|
||||
false, // escCode
|
||||
false, // osSyncPrintfEnabled
|
||||
NULL, // inputCallback
|
||||
};
|
||||
|
||||
//! TODO: Needs to be extracted
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/fault_drawer/sFaultDrawerFont.s")
|
||||
|
||||
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {
|
||||
sFaultDrawContext->osSyncPrintfEnabled = enabled;
|
||||
sFaultDrawerInstance->osSyncPrintfEnabled = enabled;
|
||||
}
|
||||
|
||||
void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 color) {
|
||||
u16* fb;
|
||||
u16* frameBuffer;
|
||||
s32 x;
|
||||
s32 y;
|
||||
s32 xDiff = sFaultDrawContext->w - xStart;
|
||||
s32 yDiff = sFaultDrawContext->h - yStart;
|
||||
s32 xDiff = sFaultDrawerInstance->w - xStart;
|
||||
s32 yDiff = sFaultDrawerInstance->h - yStart;
|
||||
s32 xSize = xEnd - xStart + 1;
|
||||
s32 ySize = yEnd - yStart + 1;
|
||||
|
||||
@@ -66,12 +102,12 @@ void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 col
|
||||
ySize = yDiff;
|
||||
}
|
||||
|
||||
fb = sFaultDrawContext->fb + sFaultDrawContext->w * yStart + xStart;
|
||||
frameBuffer = sFaultDrawerInstance->frameBuffer + sFaultDrawerInstance->w * yStart + xStart;
|
||||
for (y = 0; y < ySize; y++) {
|
||||
for (x = 0; x < xSize; x++) {
|
||||
*fb++ = color;
|
||||
*frameBuffer++ = color;
|
||||
}
|
||||
fb += sFaultDrawContext->w - xSize;
|
||||
frameBuffer += sFaultDrawerInstance->w - xSize;
|
||||
}
|
||||
|
||||
osWritebackDCacheAll();
|
||||
@@ -82,29 +118,29 @@ void FaultDrawer_DrawChar(char c) {
|
||||
s32 x;
|
||||
s32 y;
|
||||
u32 data;
|
||||
s32 cursorX = sFaultDrawContext->cursorX;
|
||||
s32 cursorY = sFaultDrawContext->cursorY;
|
||||
s32 cursorX = sFaultDrawerInstance->cursorX;
|
||||
s32 cursorY = sFaultDrawerInstance->cursorY;
|
||||
s32 shift = c % 4;
|
||||
const u32* dataPtr = &sFaultDrawContext->font[(((c / 8) * 16) + ((c & 4) >> 2))];
|
||||
u16* fb = sFaultDrawContext->fb + (sFaultDrawContext->w * cursorY) + cursorX;
|
||||
const u32* dataPtr = &sFaultDrawerInstance->fontData[(((c / 8) * 16) + ((c & 4) >> 2))];
|
||||
u16* frameBuffer = sFaultDrawerInstance->frameBuffer + (sFaultDrawerInstance->w * cursorY) + cursorX;
|
||||
|
||||
if ((sFaultDrawContext->xStart <= cursorX) &&
|
||||
((sFaultDrawContext->charW + cursorX - 1) <= sFaultDrawContext->xEnd) &&
|
||||
(sFaultDrawContext->yStart <= cursorY) &&
|
||||
((sFaultDrawContext->charH + cursorY - 1) <= sFaultDrawContext->yEnd)) {
|
||||
for (y = 0; y < sFaultDrawContext->charH; y++) {
|
||||
if ((sFaultDrawerInstance->xStart <= cursorX) &&
|
||||
((sFaultDrawerInstance->charW + cursorX - 1) <= sFaultDrawerInstance->xEnd) &&
|
||||
(sFaultDrawerInstance->yStart <= cursorY) &&
|
||||
((sFaultDrawerInstance->charH + cursorY - 1) <= sFaultDrawerInstance->yEnd)) {
|
||||
for (y = 0; y < sFaultDrawerInstance->charH; y++) {
|
||||
u32 mask = 0x10000000 << shift;
|
||||
|
||||
data = *dataPtr;
|
||||
for (x = 0; x < sFaultDrawContext->charW; x++) {
|
||||
for (x = 0; x < sFaultDrawerInstance->charW; x++) {
|
||||
if (mask & data) {
|
||||
fb[x] = sFaultDrawContext->foreColor;
|
||||
} else if (sFaultDrawContext->backColor & 1) {
|
||||
fb[x] = sFaultDrawContext->backColor;
|
||||
frameBuffer[x] = sFaultDrawerInstance->foreColor;
|
||||
} else if (sFaultDrawerInstance->backColor & 1) {
|
||||
frameBuffer[x] = sFaultDrawerInstance->backColor;
|
||||
}
|
||||
mask >>= 4;
|
||||
}
|
||||
fb += sFaultDrawContext->w;
|
||||
frameBuffer += sFaultDrawerInstance->w;
|
||||
dataPtr += 2;
|
||||
}
|
||||
}
|
||||
@@ -113,37 +149,39 @@ void FaultDrawer_DrawChar(char c) {
|
||||
s32 FaultDrawer_ColorToPrintColor(u16 color) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (color == sFaultDrawContext->printColors[i]) {
|
||||
for (i = 0; i < ARRAY_COUNT(sFaultDrawerInstance->printColors); i++) {
|
||||
if (color == sFaultDrawerInstance->printColors[i]) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void FaultDrawer_UpdatePrintColor() {
|
||||
s32 idx;
|
||||
void FaultDrawer_UpdatePrintColor(void) {
|
||||
s32 index;
|
||||
|
||||
if (sFaultDrawContext->osSyncPrintfEnabled) {
|
||||
if (sFaultDrawerInstance->osSyncPrintfEnabled) {
|
||||
osSyncPrintf(VT_RST);
|
||||
idx = FaultDrawer_ColorToPrintColor(sFaultDrawContext->foreColor);
|
||||
if ((idx >= 0) && (idx < 8)) {
|
||||
osSyncPrintf(VT_SGR("3%d"), idx);
|
||||
|
||||
index = FaultDrawer_ColorToPrintColor(sFaultDrawerInstance->foreColor);
|
||||
if ((index >= 0) && (index < 8)) {
|
||||
osSyncPrintf(VT_SGR("3%d"), index);
|
||||
}
|
||||
idx = FaultDrawer_ColorToPrintColor(sFaultDrawContext->backColor);
|
||||
if ((idx >= 0) && (idx < 8)) {
|
||||
osSyncPrintf(VT_SGR("4%d"), idx);
|
||||
|
||||
index = FaultDrawer_ColorToPrintColor(sFaultDrawerInstance->backColor);
|
||||
if ((index >= 0) && (index < 8)) {
|
||||
osSyncPrintf(VT_SGR("4%d"), index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FaultDrawer_SetForeColor(u16 color) {
|
||||
sFaultDrawContext->foreColor = color;
|
||||
sFaultDrawerInstance->foreColor = color;
|
||||
FaultDrawer_UpdatePrintColor();
|
||||
}
|
||||
|
||||
void FaultDrawer_SetBackColor(u16 color) {
|
||||
sFaultDrawContext->backColor = color;
|
||||
sFaultDrawerInstance->backColor = color;
|
||||
FaultDrawer_UpdatePrintColor();
|
||||
}
|
||||
|
||||
@@ -152,70 +190,71 @@ void FaultDrawer_SetFontColor(u16 color) {
|
||||
}
|
||||
|
||||
void FaultDrawer_SetCharPad(s8 padW, s8 padH) {
|
||||
sFaultDrawContext->charWPad = padW;
|
||||
sFaultDrawContext->charHPad = padH;
|
||||
sFaultDrawerInstance->charWPad = padW;
|
||||
sFaultDrawerInstance->charHPad = padH;
|
||||
}
|
||||
|
||||
void FaultDrawer_SetCursor(s32 x, s32 y) {
|
||||
if (sFaultDrawContext->osSyncPrintfEnabled) {
|
||||
osSyncPrintf(VT_CUP("%d", "%d"),
|
||||
(y - sFaultDrawContext->yStart) / (sFaultDrawContext->charH + sFaultDrawContext->charHPad),
|
||||
(x - sFaultDrawContext->xStart) / (sFaultDrawContext->charW + sFaultDrawContext->charWPad));
|
||||
if (sFaultDrawerInstance->osSyncPrintfEnabled) {
|
||||
osSyncPrintf(
|
||||
VT_CUP("%d", "%d"),
|
||||
(y - sFaultDrawerInstance->yStart) / (sFaultDrawerInstance->charH + sFaultDrawerInstance->charHPad),
|
||||
(x - sFaultDrawerInstance->xStart) / (sFaultDrawerInstance->charW + sFaultDrawerInstance->charWPad));
|
||||
}
|
||||
sFaultDrawContext->cursorX = x;
|
||||
sFaultDrawContext->cursorY = y;
|
||||
sFaultDrawerInstance->cursorX = x;
|
||||
sFaultDrawerInstance->cursorY = y;
|
||||
}
|
||||
|
||||
void FaultDrawer_FillScreen() {
|
||||
if (sFaultDrawContext->osSyncPrintfEnabled) {
|
||||
if (sFaultDrawerInstance->osSyncPrintfEnabled) {
|
||||
osSyncPrintf(VT_CLS);
|
||||
}
|
||||
|
||||
FaultDrawer_DrawRecImpl(sFaultDrawContext->xStart, sFaultDrawContext->yStart, sFaultDrawContext->xEnd,
|
||||
sFaultDrawContext->yEnd, sFaultDrawContext->backColor | 1);
|
||||
FaultDrawer_SetCursor(sFaultDrawContext->xStart, sFaultDrawContext->yStart);
|
||||
FaultDrawer_DrawRecImpl(sFaultDrawerInstance->xStart, sFaultDrawerInstance->yStart, sFaultDrawerInstance->xEnd,
|
||||
sFaultDrawerInstance->yEnd, sFaultDrawerInstance->backColor | 1);
|
||||
FaultDrawer_SetCursor(sFaultDrawerInstance->xStart, sFaultDrawerInstance->yStart);
|
||||
}
|
||||
|
||||
void* FaultDrawer_FormatStringFunc(void* arg, const char* str, size_t count) {
|
||||
for (; count != 0; count--, str++) {
|
||||
if (sFaultDrawContext->escCode) {
|
||||
sFaultDrawContext->escCode = false;
|
||||
if ((*str >= '1') && (*str <= '9')) {
|
||||
FaultDrawer_SetForeColor(sFaultDrawContext->printColors[*str - '0']);
|
||||
if (sFaultDrawerInstance->escCode) {
|
||||
sFaultDrawerInstance->escCode = false;
|
||||
if (*str >= '1' && *str <= '9') {
|
||||
FaultDrawer_SetForeColor(sFaultDrawerInstance->printColors[*str - '0']);
|
||||
}
|
||||
} else {
|
||||
switch (*str) {
|
||||
case '\n':
|
||||
if (sFaultDrawContext->osSyncPrintfEnabled) {
|
||||
if (sFaultDrawerInstance->osSyncPrintfEnabled) {
|
||||
osSyncPrintf("\n");
|
||||
}
|
||||
|
||||
sFaultDrawContext->cursorX = sFaultDrawContext->w;
|
||||
sFaultDrawerInstance->cursorX = sFaultDrawerInstance->w;
|
||||
break;
|
||||
|
||||
case '\x1A':
|
||||
sFaultDrawContext->escCode = true;
|
||||
case FAULT_ESC:
|
||||
sFaultDrawerInstance->escCode = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (sFaultDrawContext->osSyncPrintfEnabled) {
|
||||
if (sFaultDrawerInstance->osSyncPrintfEnabled) {
|
||||
osSyncPrintf("%c", *str);
|
||||
}
|
||||
|
||||
FaultDrawer_DrawChar(*str);
|
||||
sFaultDrawContext->cursorX += sFaultDrawContext->charW + sFaultDrawContext->charWPad;
|
||||
sFaultDrawerInstance->cursorX += sFaultDrawerInstance->charW + sFaultDrawerInstance->charWPad;
|
||||
}
|
||||
}
|
||||
|
||||
if (sFaultDrawContext->cursorX >= (sFaultDrawContext->xEnd - sFaultDrawContext->charW)) {
|
||||
sFaultDrawContext->cursorX = sFaultDrawContext->xStart;
|
||||
sFaultDrawContext->cursorY += sFaultDrawContext->charH + sFaultDrawContext->charHPad;
|
||||
if (sFaultDrawContext->yEnd - sFaultDrawContext->charH <= sFaultDrawContext->cursorY) {
|
||||
if (sFaultDrawContext->inputCallback != NULL) {
|
||||
sFaultDrawContext->inputCallback();
|
||||
if (sFaultDrawerInstance->cursorX >= (sFaultDrawerInstance->xEnd - sFaultDrawerInstance->charW)) {
|
||||
sFaultDrawerInstance->cursorX = sFaultDrawerInstance->xStart;
|
||||
sFaultDrawerInstance->cursorY += sFaultDrawerInstance->charH + sFaultDrawerInstance->charHPad;
|
||||
if (sFaultDrawerInstance->yEnd - sFaultDrawerInstance->charH <= sFaultDrawerInstance->cursorY) {
|
||||
if (sFaultDrawerInstance->inputCallback != NULL) {
|
||||
sFaultDrawerInstance->inputCallback();
|
||||
FaultDrawer_FillScreen();
|
||||
}
|
||||
sFaultDrawContext->cursorY = sFaultDrawContext->yStart;
|
||||
sFaultDrawerInstance->cursorY = sFaultDrawerInstance->yStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,17 +266,21 @@ void* FaultDrawer_FormatStringFunc(void* arg, const char* str, size_t count) {
|
||||
|
||||
const char D_80099080[] = "(null)";
|
||||
|
||||
void FaultDrawer_VPrintf(const char* fmt, va_list ap) {
|
||||
_Printf(FaultDrawer_FormatStringFunc, sFaultDrawContext, fmt, ap);
|
||||
s32 FaultDrawer_VPrintf(const char* fmt, va_list ap) {
|
||||
return _Printf(FaultDrawer_FormatStringFunc, sFaultDrawerInstance, fmt, ap);
|
||||
}
|
||||
|
||||
void FaultDrawer_Printf(const char* fmt, ...) {
|
||||
s32 FaultDrawer_Printf(const char* fmt, ...) {
|
||||
s32 ret;
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
||||
FaultDrawer_VPrintf(fmt, args);
|
||||
ret = FaultDrawer_VPrintf(fmt, args);
|
||||
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...) {
|
||||
@@ -250,18 +293,18 @@ void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...) {
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void FaultDrawer_SetDrawerFB(void* fb, u16 w, u16 h) {
|
||||
sFaultDrawContext->fb = (u16*)fb;
|
||||
sFaultDrawContext->w = w;
|
||||
sFaultDrawContext->h = h;
|
||||
void FaultDrawer_SetDrawerFrameBuffer(void* frameBuffer, u16 w, u16 h) {
|
||||
sFaultDrawerInstance->frameBuffer = frameBuffer;
|
||||
sFaultDrawerInstance->w = w;
|
||||
sFaultDrawerInstance->h = h;
|
||||
}
|
||||
|
||||
void FaultDrawer_SetInputCallback(FaultDrawerCallback callback) {
|
||||
sFaultDrawContext->inputCallback = callback;
|
||||
sFaultDrawerInstance->inputCallback = callback;
|
||||
}
|
||||
|
||||
void FaultDrawer_Init() {
|
||||
sFaultDrawContext = &sFaultDrawerStruct;
|
||||
bcopy(&sFaultDrawerDefault, sFaultDrawContext, sizeof(FaultDrawer));
|
||||
sFaultDrawContext->fb = (u16*)((osMemSize | 0x80000000) - 0x25800);
|
||||
sFaultDrawerInstance = &sFaultDrawer;
|
||||
bcopy(&sFaultDrawerDefault, sFaultDrawerInstance, sizeof(FaultDrawer));
|
||||
sFaultDrawerInstance->frameBuffer = (u16*)(PHYS_TO_K0(osMemSize) - SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(u16));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
#include "fault.h"
|
||||
|
||||
u8 sYaz0DataBuffer[0x400];
|
||||
u8* sYaz0CurDataEnd;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
#include "fault.h"
|
||||
#include "stack.h"
|
||||
#include "stackcheck.h"
|
||||
#include "z64thread.h"
|
||||
|
||||
+18
-12
@@ -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
@@ -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
@@ -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
@@ -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,5 +1,6 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
#include "fault.h"
|
||||
#include "stack.h"
|
||||
#include "stackcheck.h"
|
||||
#include "system_malloc.h"
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
* (APPLY), or to just overwrite it (NEW).
|
||||
*/
|
||||
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
|
||||
/* data */
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "fault.h"
|
||||
#include "loadfragment.h"
|
||||
#include "z64horse.h"
|
||||
#include "z64quake.h"
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,3 +1,4 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
#include "z64collision_check.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
#include "z64quake.h"
|
||||
#include "z64rumble.h"
|
||||
|
||||
@@ -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,3 +1,4 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
#include "buffers.h"
|
||||
#include "idle.h"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
#include "global.h"
|
||||
|
||||
void osCreateThread(OSThread* t, OSId id, void* entry, void* arg, void* sp, OSPri p) {
|
||||
void osCreateThread(OSThread* thread, OSId id, void* entry, void* arg, void* sp, OSPri p) {
|
||||
register u32 saveMask;
|
||||
OSIntMask mask;
|
||||
|
||||
t->id = id;
|
||||
t->priority = p;
|
||||
t->next = NULL;
|
||||
t->queue = NULL;
|
||||
t->context.pc = (u32)entry;
|
||||
t->context.a0 = arg;
|
||||
t->context.sp = (u64)(s32)sp - 16;
|
||||
t->context.ra = __osCleanupThread;
|
||||
thread->id = id;
|
||||
thread->priority = p;
|
||||
thread->next = NULL;
|
||||
thread->queue = NULL;
|
||||
thread->context.pc = (u32)entry;
|
||||
thread->context.a0 = arg;
|
||||
thread->context.sp = (u64)(s32)sp - 16;
|
||||
thread->context.ra = __osCleanupThread;
|
||||
|
||||
mask = 0x3FFF01;
|
||||
t->context.sr = 0xFF03;
|
||||
t->context.rcp = (mask & 0x3F0000) >> 16;
|
||||
t->context.fpcsr = 0x01000800;
|
||||
t->fp = 0;
|
||||
t->state = 1;
|
||||
t->flags = 0;
|
||||
thread->context.sr = 0xFF03;
|
||||
thread->context.rcp = (mask & 0x3F0000) >> 16;
|
||||
thread->context.fpcsr = 0x01000800;
|
||||
thread->fp = 0;
|
||||
thread->state = 1;
|
||||
thread->flags = 0;
|
||||
|
||||
saveMask = __osDisableInt();
|
||||
t->tlnext = __osActiveQueue;
|
||||
__osActiveQueue = t;
|
||||
thread->tlnext = __osActiveQueue;
|
||||
__osActiveQueue = thread;
|
||||
__osRestoreInt(saveMask);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#include "global.h"
|
||||
|
||||
void osSetThreadPri(OSThread* t, OSPri p) {
|
||||
void osSetThreadPri(OSThread* thread, OSPri p) {
|
||||
register u32 saveMask;
|
||||
|
||||
saveMask = __osDisableInt();
|
||||
|
||||
if (t == NULL) {
|
||||
t = __osRunningThread;
|
||||
if (thread == NULL) {
|
||||
thread = __osRunningThread;
|
||||
}
|
||||
|
||||
if (t->priority != p) {
|
||||
t->priority = p;
|
||||
if (thread->priority != p) {
|
||||
thread->priority = p;
|
||||
|
||||
if (t != __osRunningThread && t->state != 1) {
|
||||
__osDequeueThread(t->queue, t);
|
||||
__osEnqueueThread(t->queue, t);
|
||||
if (thread != __osRunningThread && thread->state != 1) {
|
||||
__osDequeueThread(thread->queue, thread);
|
||||
__osEnqueueThread(thread->queue, thread);
|
||||
}
|
||||
|
||||
if (__osRunningThread->priority < __osRunQueue->priority) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Description: Twinmold
|
||||
*/
|
||||
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "z_boss_02.h"
|
||||
#include "z64rumble.h"
|
||||
#include "z64shrink_window.h"
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* Description: Seahorse
|
||||
*/
|
||||
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "z_en_ot.h"
|
||||
#include "objects/object_ot/object_ot.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Overlay: ovl_Obj_Hunsui
|
||||
* Description: Switch-Activated Geyser
|
||||
*/
|
||||
|
||||
#include "z_obj_hunsui.h"
|
||||
#include "objects/object_hunsui/object_hunsui.h"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Overlay: ovl_player_actor
|
||||
* Description: Player
|
||||
*/
|
||||
#include "prevent_bss_reordering.h"
|
||||
|
||||
#include "global.h"
|
||||
#include "z64horse.h"
|
||||
#include "z64quake.h"
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Overlay: ovl_kaleido_scope
|
||||
* Description: Pause Menu
|
||||
*/
|
||||
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "z_kaleido_scope.h"
|
||||
#include "z64view.h"
|
||||
#include "overlays/gamestates/ovl_opening/z_opening.h"
|
||||
|
||||
Reference in New Issue
Block a user