1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-05 15:34:41 +00:00

Format all src C files

This commit is contained in:
Roman971 2020-03-22 22:19:43 +01:00
parent 251aea64ab
commit 8cfe7cce9f
652 changed files with 12488 additions and 19093 deletions

View file

@ -5,73 +5,43 @@
#include <regs.h>
#include <PR/os_cont.h>
typedef struct
{
typedef struct {
u8 x;
u8 y;
u8 colorId;
char text[0x15];
} PrintTextBuffer;
typedef struct
{
typedef struct {
u16 push;
u16 held;
} InputCombo;
GameInfo* gGameInfo;
int D_8015FA94; //no known symbols
GameInfo* gGameInfo;
int D_8015FA94; // no known symbols
PrintTextBuffer D_8015FA98[0x16];
s16 D_8011E0B0 = 0; //PrintTextBuffer index
s16 D_8011E0B0 = 0; // PrintTextBuffer index
Color_RGBA8 printTextColors[] = {
{ 0xFF, 0xFF, 0x20, 0xC0 },
{ 0xFF, 0x96, 0x80, 0xC0 },
{ 0x80, 0x60, 0x00, 0x40 },
{ 0xC0, 0x80, 0x10, 0x80 },
{ 0xFF, 0xC0, 0x20, 0x80 },
{ 0xE6, 0xE6, 0xDC, 0x40 },
{ 0x80, 0x96, 0xFF, 0x80 },
{ 0x80, 0xFF, 0x20, 0x80 },
{ 0xFF, 0xFF, 0x20, 0xC0 }, { 0xFF, 0x96, 0x80, 0xC0 }, { 0x80, 0x60, 0x00, 0x40 }, { 0xC0, 0x80, 0x10, 0x80 },
{ 0xFF, 0xC0, 0x20, 0x80 }, { 0xE6, 0xE6, 0xDC, 0x40 }, { 0x80, 0x96, 0xFF, 0x80 }, { 0x80, 0xFF, 0x20, 0x80 },
};
InputCombo inputCombos[REG_GROUPS] = {
{ L_TRIG, U_CBUTTONS },
{ L_TRIG, L_CBUTTONS },
{ L_TRIG, D_CBUTTONS },
{ L_TRIG, A_BUTTON },
{ R_TRIG, D_CBUTTONS },
{ L_TRIG, R_CBUTTONS },
{ L_TRIG, R_TRIG },
{ L_TRIG, L_JPAD },
{ L_TRIG, R_JPAD },
{ L_TRIG, U_JPAD },
{ L_TRIG, B_BUTTON },
{ L_TRIG, Z_TRIG },
{ L_TRIG, D_JPAD },
{ R_TRIG, A_BUTTON },
{ R_TRIG, B_BUTTON },
{ R_TRIG, Z_TRIG },
{ R_TRIG, L_TRIG },
{ R_TRIG, U_CBUTTONS },
{ R_TRIG, R_CBUTTONS },
{ R_TRIG, L_JPAD },
{ R_TRIG, L_CBUTTONS },
{ R_TRIG, START_BUTTON },
{ L_TRIG, START_BUTTON },
{ R_TRIG, R_JPAD },
{ R_TRIG, U_JPAD },
{ START_BUTTON, R_TRIG },
{ START_BUTTON, A_BUTTON },
{ START_BUTTON, B_BUTTON },
{ L_TRIG, U_CBUTTONS }, { L_TRIG, L_CBUTTONS }, { L_TRIG, D_CBUTTONS }, { L_TRIG, A_BUTTON },
{ R_TRIG, D_CBUTTONS }, { L_TRIG, R_CBUTTONS }, { L_TRIG, R_TRIG }, { L_TRIG, L_JPAD },
{ L_TRIG, R_JPAD }, { L_TRIG, U_JPAD }, { L_TRIG, B_BUTTON }, { L_TRIG, Z_TRIG },
{ L_TRIG, D_JPAD }, { R_TRIG, A_BUTTON }, { R_TRIG, B_BUTTON }, { R_TRIG, Z_TRIG },
{ R_TRIG, L_TRIG }, { R_TRIG, U_CBUTTONS }, { R_TRIG, R_CBUTTONS }, { R_TRIG, L_JPAD },
{ R_TRIG, L_CBUTTONS }, { R_TRIG, START_BUTTON }, { L_TRIG, START_BUTTON }, { R_TRIG, R_JPAD },
{ R_TRIG, U_JPAD }, { START_BUTTON, R_TRIG }, { START_BUTTON, A_BUTTON }, { START_BUTTON, B_BUTTON },
{ START_BUTTON, R_CBUTTONS },
};
char regChar[] = " SOPQMYDUIZCNKXcsiWAVHGmnBdkb";
//initialize GameInfo
void func_800636C0()
{
// initialize GameInfo
void func_800636C0() {
s32 i;
gGameInfo = (GameInfo*)SystemArena_MallocDebug(sizeof(GameInfo), "../z_debug.c", 260);
@ -80,26 +50,22 @@ void func_800636C0()
gGameInfo->regCur = 0;
gGameInfo->dpadLast = 0;
gGameInfo->repeat = 0;
for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++)
{
for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++) {
gGameInfo->data[i] = 0;
}
}
//Called when free movement is active.
//8011D394 to enable camera debugger
void func_8006375C(s32 arg0, s32 arg1, float* d_80855320)
{
// Called when free movement is active.
// 8011D394 to enable camera debugger
void func_8006375C(s32 arg0, s32 arg1, float* d_80855320) {
}
#ifdef NON_MATCHING //regalloc
//Copy Camera Debugger Text
void func_8006376C(u8 x, u8 y, u8 colorId, const char* text)
{
#ifdef NON_MATCHING // regalloc
// Copy Camera Debugger Text
void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) {
PrintTextBuffer* buf;
char* bufText;
s16 i; //v1
s16 i; // v1
buf = &D_8015FA98[D_8011E0B0];
if (D_8011E0B0 < 0x16) {
@ -112,9 +78,11 @@ void func_8006376C(u8 x, u8 y, u8 colorId, const char* text)
bufText = buf->text + 1;
if (*buf->text = *text++) {
do if (i++ > 0x14) {
break;
} while (*bufText++ = *text++);
do
if (i++ > 0x14) {
break;
}
while (*bufText++ = *text++);
}
*bufText = '\0';
@ -124,34 +92,31 @@ void func_8006376C(u8 x, u8 y, u8 colorId, const char* text)
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_8006376C.s")
#endif
#endif
//Draw Text
void func_80063828(GfxPrint* gfxPrint)
{
// Draw Text
void func_80063828(GfxPrint* gfxPrint) {
s32 i;
Color_RGBA8* color;
PrintTextBuffer* buffer;
char* text;
i = 0;
if (D_8011E0B0 > 0)
{
do
{
if (D_8011E0B0 > 0) {
do {
buffer = &D_8015FA98[i];
text = buffer->text;
color = &printTextColors[buffer->colorId];
GfxPrint_SetColor(gfxPrint, color->r, color->g, color->b, color->a);
GfxPrint_SetPos(gfxPrint, buffer->x, buffer->y);
GfxPrint_Printf(gfxPrint, "%s", text);
GfxPrint_Printf(gfxPrint, "%s", text);
i += 1;
} while (i < D_8011E0B0);
}
}
//Edit REG
// Edit REG
void func_8006390C(Input* input) {
s32 dpad;
@ -162,18 +127,14 @@ void func_8006390C(Input* input) {
regGroup = (gGameInfo->regGroup * REG_PAGES + gGameInfo->regPage) * REG_PER_PAGE - REG_PER_PAGE;
dpad = input->raw.pad & 0xF00;
if (!~(input->raw.pad | ~L_TRIG) ||
!~(input->raw.pad | ~R_TRIG) ||
!~(input->raw.pad | ~START_BUTTON)) {
if (!~(input->raw.pad | ~L_TRIG) || !~(input->raw.pad | ~R_TRIG) || !~(input->raw.pad | ~START_BUTTON)) {
input_combo = inputCombos;
for (i = 0; i < REG_GROUPS; i++)
{
if (~(~input_combo->push | input->raw.pad) ||
~(~input_combo->held | input->padPressed)) {
for (i = 0; i < REG_GROUPS; i++) {
if (~(~input_combo->push | input->raw.pad) || ~(~input_combo->held | input->padPressed)) {
input_combo++;
}
else
} else {
break;
}
}
if (i < REG_GROUPS) {
@ -184,10 +145,8 @@ void func_8006390C(Input* input) {
gGameInfo->regGroup = i;
gGameInfo->regPage = 0;
}
}
else {
switch (gGameInfo->regPage - 1)
{
} else {
switch (gGameInfo->regPage - 1) {
case 0:
case 1:
case 2:
@ -195,80 +154,73 @@ void func_8006390C(Input* input) {
case 4:
case 5:
if (dpad == gGameInfo->dpadLast) {
gGameInfo->repeat--;
if (gGameInfo->repeat < 0) {
gGameInfo->repeat = 1;
if (dpad == gGameInfo->dpadLast) {
gGameInfo->repeat--;
if (gGameInfo->repeat < 0) {
gGameInfo->repeat = 1;
} else {
dpad ^= gGameInfo->dpadLast;
}
} else {
gGameInfo->repeat = 0x10;
gGameInfo->dpadLast = dpad;
}
else {
dpad ^= gGameInfo->dpadLast;
}
}
else {
gGameInfo->repeat = 0x10;
gGameInfo->dpadLast = dpad;
}
increment =
(dpad & R_JPAD) ? (
!~(input->raw.pad | ~(A_BUTTON | B_BUTTON)) ? 1000 :
!~(input->raw.pad | ~A_BUTTON) ? 100 :
!~(input->raw.pad | ~B_BUTTON) ? 10 : 1) :
(dpad & L_JPAD) ? (
!~(input->raw.pad | ~(A_BUTTON | B_BUTTON)) ? -1000 :
!~(input->raw.pad | ~A_BUTTON) ? -100 :
!~(input->raw.pad | ~B_BUTTON) ? -10 : -1) :
0;
increment = (dpad & R_JPAD)
? (!~(input->raw.pad | ~(A_BUTTON | B_BUTTON))
? 1000
: !~(input->raw.pad | ~A_BUTTON) ? 100 : !~(input->raw.pad | ~B_BUTTON) ? 10 : 1)
: (dpad & L_JPAD) ? (!~(input->raw.pad | ~(A_BUTTON | B_BUTTON))
? -1000
: !~(input->raw.pad | ~A_BUTTON)
? -100
: !~(input->raw.pad | ~B_BUTTON) ? -10 : -1)
: 0;
gGameInfo->data[gGameInfo->regCur + regGroup] += increment;
if (dpad & U_JPAD) {
gGameInfo->regCur--;
if (gGameInfo->regCur < 0) {
gGameInfo->regCur = REG_PER_PAGE - 1;
gGameInfo->data[gGameInfo->regCur + regGroup] += increment;
if (dpad & U_JPAD) {
gGameInfo->regCur--;
if (gGameInfo->regCur < 0) {
gGameInfo->regCur = REG_PER_PAGE - 1;
}
} else if (dpad & D_JPAD) {
gGameInfo->regCur++;
if (gGameInfo->regCur >= REG_PER_PAGE) {
gGameInfo->regCur = 0;
}
}
}
else if (dpad & D_JPAD) {
gGameInfo->regCur++;
if (gGameInfo->regCur >= REG_PER_PAGE) {
gGameInfo->regCur = 0;
if (iREG(0)) {
iREG(0) = 0;
func_800AA000(0, iREG(1), iREG(2), iREG(3));
}
}
if (iREG(0)) {
iREG(0) = 0;
func_800AA000(0, iREG(1), iREG(2), iREG(3));
}
}
}
}
//Draw Memory Viewer
void func_80063C04(GfxPrint* gfxPrint)
{
// Draw Memory Viewer
void func_80063C04(GfxPrint* gfxPrint) {
s32 i;
s32 page;
s32 regGroup;
s32 test; //removing affects stack
s32 test; // removing affects stack
char name[3];
page = (gGameInfo->regPage * REG_PER_PAGE) - REG_PER_PAGE;
regGroup = (gGameInfo->regGroup * REG_PAGES + gGameInfo->regPage) * REG_PER_PAGE - REG_PER_PAGE;
//set up register name string
// set up register name string
name[0] = 'R';
name[1] = regChar[gGameInfo->regGroup]; //r_group type char
name[1] = regChar[gGameInfo->regGroup]; // r_group type char
name[2] = '\0';
GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80);
for (i = 0; i != REG_PER_PAGE; i++)
{
if (i == gGameInfo->regCur)
{
for (i = 0; i != REG_PER_PAGE; i++) {
if (i == gGameInfo->regCur) {
GfxPrint_SetColor(gfxPrint, 0, 0xff, 0xff, 0xff);
}
GfxPrint_SetPos(gfxPrint, 3, i + 5);
GfxPrint_Printf(gfxPrint, "%s%02d%6d", &name, page + i, gGameInfo->data[i + regGroup]);
if (i == gGameInfo->regCur)
{
if (i == gGameInfo->regCur) {
GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80);
}
}
@ -281,7 +233,7 @@ void func_80063D7C(GraphicsContext* gfxCtx) {
void* unk2[6];
GfxPrint gfxPrint;
void* unk[2];
Gfx* dlFrame[4]; //stores state of GfxCtx next ptrs
Gfx* dlFrame[4]; // stores state of GfxCtx next ptrs
func_800C6AC4(&dlFrame, gfxCtx, "../z_debug.c", 628);
GfxPrint_Ctor(&gfxPrint);
@ -303,7 +255,7 @@ void func_80063D7C(GraphicsContext* gfxCtx) {
gSPEndDisplayList(sp7C++);
func_800C6C28(sp78, sp7C);
gfxCtx->polyOpa.p = sp7C;
if (0);
if (0) {}
func_800C6B54(&dlFrame, gfxCtx, "../z_debug.c", 664);
GfxPrint_Dtor(&gfxPrint);
}