1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-24 18:04:20 +00:00

Cleanups, Use VT macros

This commit is contained in:
Thar0 2020-04-05 02:50:46 +01:00
parent b452adfecb
commit 668d35b77f
4 changed files with 28 additions and 31 deletions

View file

@ -7,7 +7,7 @@
.section .data .section .data
# temporary name, rename to something more appropriate when decompiled # temporary file name, rename to something more appropriate when decompiled
glabel gLetterTLUT glabel gLetterTLUT
.incbin "baserom.z64", 0xBA18E0, 0x80 .incbin "baserom.z64", 0xBA18E0, 0x80

View file

@ -1263,7 +1263,7 @@ u32 func_800AA148();
void func_800AA15C(); void func_800AA15C();
void func_800AA16C(); void func_800AA16C();
void func_800AA178(u32); 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); View* func_800AA1F8(GraphicsContext* gfxCtx);
void func_800AA250(View* view); void func_800AA250(View* view);
void func_800AA278(View*, GraphicsContext*); void func_800AA278(View*, GraphicsContext*);

View file

@ -286,8 +286,7 @@ typedef struct {
/* 0x16 */ char unk_16[0x02]; /* 0x16 */ char unk_16[0x02];
} Input; // size = 0x18 } Input; // size = 0x18
typedef struct typedef struct {
{
/* 0x0000 */ s16 unk_0; /* 0x0000 */ s16 unk_0;
/* 0x0002 */ s16 unk_2; /* 0x0002 */ s16 unk_2;
/* 0x0004 */ u16 unk_4; /* 0x0004 */ u16 unk_4;
@ -296,25 +295,23 @@ typedef struct
/* 0x000A */ s16 unk_A; /* 0x000A */ s16 unk_A;
/* 0x000C */ u16 unk_C; /* 0x000C */ u16 unk_C;
/* 0x000E */ u16 unk_E; /* 0x000E */ u16 unk_E;
} UNK_VIEW_STRUCT; // size = 0x10, probably a viewport in disguise } UnkViewStruct; // size = 0x10, probably a viewport in disguise
typedef struct typedef struct {
{ /* 0x0000 */ s32 topY; // uly (upper left y)
/* 0x0000 */ s32 topY; //uly (upper left y) /* 0x0004 */ s32 bottomY; // lry (lower right y)
/* 0x0004 */ s32 bottomY; //lry (lower right y) /* 0x0008 */ s32 leftX; // ulx (upper left x)
/* 0x0008 */ s32 leftX; //ulx (upper left x) /* 0x000C */ s32 rightX; // lrx (lower right x)
/* 0x000C */ s32 rightX; //lrx (lower right x)
} Viewport; // size = 0x10 } Viewport; // size = 0x10
typedef struct typedef struct {
{ /* 0x0000 */ s32 magic; // string literal "VIEW" / 0x56494557
/* 0x0000 */ s32 viewStart; //string literal "VIEW" / 0x56494557
/* 0x0004 */ GraphicsContext* gfxCtx; /* 0x0004 */ GraphicsContext* gfxCtx;
/* 0x0008 */ Viewport viewport; /* 0x0008 */ Viewport viewport;
/* 0x0018 */ f32 fieldOfView; //fovy /* 0x0018 */ f32 fieldOfView; // fovy
/* 0x001C */ f32 fogDistance; //near /* 0x001C */ f32 fogDistance; // near
/* 0x0020 */ f32 zDepth; //far /* 0x0020 */ f32 zDepth; // far
/* 0x0024 */ f32 unk_24; //scale /* 0x0024 */ f32 unk_24; // scale
/* 0x0028 */ Vec3f eye; /* 0x0028 */ Vec3f eye;
/* 0x0034 */ Vec3f unk_34; /* 0x0034 */ Vec3f unk_34;
/* 0x0040 */ Vec3f unk_40; /* 0x0040 */ Vec3f unk_40;
@ -329,7 +326,7 @@ typedef struct
/* 0x0100 */ f32 unk_100; /* 0x0100 */ f32 unk_100;
/* 0x0104 */ Vec3f unk_104; /* 0x0104 */ Vec3f unk_104;
/* 0x0110 */ Vec3f unk_110; /* 0x0110 */ Vec3f unk_110;
/* 0x011C */ u16 unk_11C; //normal /* 0x011C */ u16 unk_11C; // normal
/* 0x011E */ u16 unk_11E; /* 0x011E */ u16 unk_11E;
/* 0x0120 */ s32 unk_120; /* 0x0120 */ s32 unk_120;
/* 0x0124 */ s32 unk_124; /* 0x0124 */ s32 unk_124;

View file

@ -1,10 +1,11 @@
#include <ultra64.h> #include <ultra64.h>
#include <global.h> #include <global.h>
#include <vt.h>
volatile u32 D_8012ABF0 = 1; volatile u32 D_8012ABF0 = 1;
// TODO replace UNK_VIEW_STRUCT with Viewport and match with that instead // TODO replace UnkViewStruct with Viewport and match with that instead
void func_800AA190(UNK_VIEW_STRUCT* arg0, Viewport* viewport) { void func_800AA190(UnkViewStruct* arg0, Viewport* viewport) {
s32 xLen; s32 xLen;
s32 yLen; s32 yLen;
@ -21,12 +22,12 @@ void func_800AA190(UNK_VIEW_STRUCT* arg0, Viewport* viewport) {
} }
View* func_800AA1F8(GraphicsContext* gfxCtx) { View* func_800AA1F8(GraphicsContext* gfxCtx) {
View* allocated = SystemArena_MallocDebug(sizeof(View), "../z_view.c", 285); View* view = SystemArena_MallocDebug(sizeof(View), "../z_view.c", 285);
if (allocated != NULL) { if (view != NULL) {
func_80106860(allocated, 0, sizeof(View)); // TODO prototype this func_80106860(view, 0, sizeof(View)); // TODO prototype this
func_800AA278(allocated, gfxCtx); func_800AA278(view, gfxCtx);
} }
return allocated; return view;
} }
void func_800AA250(View* view) { void func_800AA250(View* view) {
@ -39,7 +40,7 @@ void func_800AA278(View* view, GraphicsContext* gfxCtx) {
view->viewport.bottomY = 240; view->viewport.bottomY = 240;
view->viewport.leftX = 0; view->viewport.leftX = 0;
view->viewport.rightX = 320; view->viewport.rightX = 320;
view->viewStart = 0x56494557; //"VIEW" view->magic = 0x56494557; //"VIEW"
view->eye.x = 0.0f; view->eye.x = 0.0f;
view->eye.y = 0.0f; view->eye.y = 0.0f;
view->unk_24 = 1.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, guPerspective(projection, &view->unk_11C, view->fieldOfView, (f32)xlen / (f32)ylen, view->fogDistance,
view->zDepth, view->unk_24); 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, 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); view->zDepth, view->unk_24, (f32)xlen / (f32)ylen, view->unk_11C);
Matrix_MtxToMtxF(projection, &mtxF); 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") #pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AAA9C.s")
#endif #endif
//#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AB0A8.s")
s32 func_800AB0A8(View* view) { s32 func_800AB0A8(View* view) {
Viewport* viewport; Viewport* viewport;
Mtx* projection; Mtx* projection;
@ -594,10 +594,10 @@ s32 func_800ABE74(f32 eyeX, f32 eyeY, f32 eyeZ) {
} }
} }
if (errorCode != 0) { if (errorCode != 0) {
osSyncPrintf("\x1b[31m"); osSyncPrintf(VT_SGR("31"));
// Is too large // Is too large
osSyncPrintf("eye が大きすぎます eye=[%8.3f %8.3f %8.3f] error=%d\n", eyeX, eyeY, eyeZ, errorCode); osSyncPrintf("eye が大きすぎます eye=[%8.3f %8.3f %8.3f] error=%d\n", eyeX, eyeY, eyeZ, errorCode);
osSyncPrintf("\x1b[m"); osSyncPrintf(VT_RST);
} }
return errorCode; return errorCode;
} }