diff --git a/data/z_text.data.s b/data/z_text.data.s index 06d05bfa94..55419e9474 100644 --- a/data/z_text.data.s +++ b/data/z_text.data.s @@ -7,7 +7,7 @@ .section .data -# temporary name, rename to something more appropriate when decompiled +# temporary file name, rename to something more appropriate when decompiled glabel gLetterTLUT .incbin "baserom.z64", 0xBA18E0, 0x80 diff --git a/include/functions.h b/include/functions.h index c1a6ec32d3..4f909af8b5 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1263,7 +1263,7 @@ u32 func_800AA148(); void func_800AA15C(); void func_800AA16C(); void func_800AA178(u32); -void func_800AA190(UNK_VIEW_STRUCT* arg0, Viewport* viewport); +void func_800AA190(UnkViewStruct* arg0, Viewport* viewport); View* func_800AA1F8(GraphicsContext* gfxCtx); void func_800AA250(View* view); void func_800AA278(View*, GraphicsContext*); diff --git a/include/z64.h b/include/z64.h index 9c129805e2..6cc0485a93 100644 --- a/include/z64.h +++ b/include/z64.h @@ -286,8 +286,7 @@ typedef struct { /* 0x16 */ char unk_16[0x02]; } Input; // size = 0x18 -typedef struct -{ +typedef struct { /* 0x0000 */ s16 unk_0; /* 0x0002 */ s16 unk_2; /* 0x0004 */ u16 unk_4; @@ -296,25 +295,23 @@ typedef struct /* 0x000A */ s16 unk_A; /* 0x000C */ u16 unk_C; /* 0x000E */ u16 unk_E; -} UNK_VIEW_STRUCT; // size = 0x10, probably a viewport in disguise +} UnkViewStruct; // size = 0x10, probably a viewport in disguise -typedef struct -{ - /* 0x0000 */ s32 topY; //uly (upper left y) - /* 0x0004 */ s32 bottomY; //lry (lower right y) - /* 0x0008 */ s32 leftX; //ulx (upper left x) - /* 0x000C */ s32 rightX; //lrx (lower right x) +typedef struct { + /* 0x0000 */ s32 topY; // uly (upper left y) + /* 0x0004 */ s32 bottomY; // lry (lower right y) + /* 0x0008 */ s32 leftX; // ulx (upper left x) + /* 0x000C */ s32 rightX; // lrx (lower right x) } Viewport; // size = 0x10 -typedef struct -{ - /* 0x0000 */ s32 viewStart; //string literal "VIEW" / 0x56494557 +typedef struct { + /* 0x0000 */ s32 magic; // string literal "VIEW" / 0x56494557 /* 0x0004 */ GraphicsContext* gfxCtx; /* 0x0008 */ Viewport viewport; - /* 0x0018 */ f32 fieldOfView; //fovy - /* 0x001C */ f32 fogDistance; //near - /* 0x0020 */ f32 zDepth; //far - /* 0x0024 */ f32 unk_24; //scale + /* 0x0018 */ f32 fieldOfView; // fovy + /* 0x001C */ f32 fogDistance; // near + /* 0x0020 */ f32 zDepth; // far + /* 0x0024 */ f32 unk_24; // scale /* 0x0028 */ Vec3f eye; /* 0x0034 */ Vec3f unk_34; /* 0x0040 */ Vec3f unk_40; @@ -329,7 +326,7 @@ typedef struct /* 0x0100 */ f32 unk_100; /* 0x0104 */ Vec3f unk_104; /* 0x0110 */ Vec3f unk_110; - /* 0x011C */ u16 unk_11C; //normal + /* 0x011C */ u16 unk_11C; // normal /* 0x011E */ u16 unk_11E; /* 0x0120 */ s32 unk_120; /* 0x0124 */ s32 unk_124; diff --git a/src/code/z_view.c b/src/code/z_view.c index f574c1d85c..0faaf7962a 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -1,10 +1,11 @@ #include #include +#include volatile u32 D_8012ABF0 = 1; -// TODO replace UNK_VIEW_STRUCT with Viewport and match with that instead -void func_800AA190(UNK_VIEW_STRUCT* arg0, Viewport* viewport) { +// TODO replace UnkViewStruct with Viewport and match with that instead +void func_800AA190(UnkViewStruct* arg0, Viewport* viewport) { s32 xLen; s32 yLen; @@ -21,12 +22,12 @@ void func_800AA190(UNK_VIEW_STRUCT* arg0, Viewport* viewport) { } View* func_800AA1F8(GraphicsContext* gfxCtx) { - View* allocated = SystemArena_MallocDebug(sizeof(View), "../z_view.c", 285); - if (allocated != NULL) { - func_80106860(allocated, 0, sizeof(View)); // TODO prototype this - func_800AA278(allocated, gfxCtx); + View* view = SystemArena_MallocDebug(sizeof(View), "../z_view.c", 285); + if (view != NULL) { + func_80106860(view, 0, sizeof(View)); // TODO prototype this + func_800AA278(view, gfxCtx); } - return allocated; + return view; } void func_800AA250(View* view) { @@ -39,7 +40,7 @@ void func_800AA278(View* view, GraphicsContext* gfxCtx) { view->viewport.bottomY = 240; view->viewport.leftX = 0; view->viewport.rightX = 320; - view->viewStart = 0x56494557; //"VIEW" + view->magic = 0x56494557; //"VIEW" view->eye.x = 0.0f; view->eye.y = 0.0f; view->unk_24 = 1.0f; @@ -303,7 +304,7 @@ s32 func_800AAA9C(View* view) { guPerspective(projection, &view->unk_11C, view->fieldOfView, (f32)xlen / (f32)ylen, view->fogDistance, view->zDepth, view->unk_24); } - if ((QREG(88) & 1) != 0) { + if (QREG(88) & 1) { osSyncPrintf("fovy %f near %f far %f scale %f aspect %f normal %08x\n", view->fieldOfView, view->fogDistance, view->zDepth, view->unk_24, (f32)xlen / (f32)ylen, view->unk_11C); Matrix_MtxToMtxF(projection, &mtxF); @@ -356,7 +357,6 @@ s32 func_800AAA9C(View* view) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AAA9C.s") #endif -//#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AB0A8.s") s32 func_800AB0A8(View* view) { Viewport* viewport; Mtx* projection; @@ -594,10 +594,10 @@ s32 func_800ABE74(f32 eyeX, f32 eyeY, f32 eyeZ) { } } if (errorCode != 0) { - osSyncPrintf("\x1b[31m"); + osSyncPrintf(VT_SGR("31")); // Is too large osSyncPrintf("eye が大きすぎます eye=[%8.3f %8.3f %8.3f] error=%d\n", eyeX, eyeY, eyeZ, errorCode); - osSyncPrintf("\x1b[m"); + osSyncPrintf(VT_RST); } return errorCode; }