regs, cleanup

This commit is contained in:
engineer124
2022-10-08 14:06:57 -04:00
parent 2d64b28e8e
commit 612819cbbc
4 changed files with 104 additions and 69 deletions
+40 -20
View File
@@ -45,12 +45,27 @@
/* TODO: Actually confirm these, in case of miss-match it's at least a simple list to `sed` */
#define R_TIME_SPEED REG(15)
#define R_RUN_SPEED_LIMIT REG(45)
#define R_ENABLE_ARENA_DBG SREG(0) // Same as OoT
#define R_UPDATE_RATE SREG(30)
#define R_PAUSE_MENU_MODE SREG(94)
#define R_PAUSE_WORLD_MAP_YAW YREG(24)
#define R_PAUSE_WORLD_MAP_Y_OFFSET YREG(25)
#define R_PAUSE_WORLD_MAP_DEPTH YREG(26)
#define R_PAUSE_WORLD_MAP_YAW YREG(24)
#define R_PAUSE_WORLD_MAP_Y_OFFSET YREG(25)
#define R_PAUSE_WORLD_MAP_DEPTH YREG(26)
#define R_PICTO_FOCUS_BORDER_TOPLEFT_X YREG(32)
#define R_PICTO_FOCUS_BORDER_TOPLEFT_Y YREG(33)
#define R_PICTO_FOCUS_BORDER_TOPRIGHT_X YREG(34)
#define R_PICTO_FOCUS_BORDER_TOPRIGHT_Y YREG(35)
#define R_PICTO_FOCUS_BORDER_BOTTOMLEFT_X YREG(36)
#define R_PICTO_FOCUS_BORDER_BOTTOMLEFT_Y YREG(37)
#define R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_X YREG(38)
#define R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_Y YREG(39)
#define R_PICTO_FOCUS_ICON_X YREG(40)
#define R_PICTO_FOCUS_ICON_Y YREG(41)
#define R_PICTO_FOCUS_TEXT_X YREG(42)
#define R_PICTO_FOCUS_TEXT_Y YREG(43)
#define R_MAGIC_FILL_COLOR(i) ZREG(0 + i)
#define R_C_BTN_COLOR(i) ZREG(39 + i)
#define R_B_BTN_COLOR(i) ZREG(43 + i)
@@ -67,23 +82,28 @@
#define R_ITEM_ICON_X(i) ZREG(82 + i)
#define R_ITEM_ICON_Y(i) ZREG(86 + i)
#define R_ITEM_ICON_DD(i) ZREG(90 + i)
#define R_MAGIC_DBG_SET_UPGRADE XREG(4)
#define R_A_BTN_Y XREG(16)
#define R_A_BTN_X XREG(17)
#define R_A_ICON_Y XREG(19)
#define R_A_ICON_X XREG(20)
#define R_A_BTN_COLOR(i) XREG(22 + i)
#define R_A_BTN_Y_OFFSET XREG(31)
#define R_MAGIC_CONSUME_TIMER_GIANTS_MASK XREG(41)
#define R_PAUSE_DBG_MAP_CLOUD_ON XREG(50)
#define R_PAUSE_DBG_MAP_CLOUD_X XREG(52)
#define R_PAUSE_DBG_MAP_CLOUD_Y XREG(53)
#define R_MOON_CRASH_TIMER_Y XREG(80)
#define R_MOON_CRASH_TIMER_X XREG(81)
#define R_PAUSE_OWLWARP_ALPHA XREG(87)
#define R_STORY_FILL_SCREEN_ALPHA XREG(91)
#define R_REVERSE_FLOOR_INDEX XREG(94)
#define R_MINIMAP_DISABLED XREG(95)
#define R_MAGIC_DBG_SET_UPGRADE XREG(4)
#define R_A_BTN_Y XREG(16)
#define R_A_BTN_X XREG(17)
#define R_A_ICON_Y XREG(19)
#define R_A_ICON_X XREG(20)
#define R_A_BTN_COLOR(i) XREG(22 + i)
#define R_A_BTN_Y_OFFSET XREG(31)
#define R_MAGIC_CONSUME_TIMER_GIANTS_MASK XREG(41)
#define R_THREE_DAY_CLOCK_Y_POS XREG(43) // TODO: Test
#define R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF XREG(44)
#define R_THREE_DAY_CLOCK_HOUR_DIGIT_CUTOFF XREG(45)
#define R_PAUSE_DBG_MAP_CLOUD_ON XREG(50)
#define R_PAUSE_DBG_MAP_CLOUD_X XREG(52)
#define R_PAUSE_DBG_MAP_CLOUD_Y XREG(53)
#define R_MOON_CRASH_TIMER_Y XREG(80)
#define R_MOON_CRASH_TIMER_X XREG(81)
#define R_PAUSE_OWLWARP_ALPHA XREG(87)
#define R_STORY_FILL_SCREEN_ALPHA XREG(91)
#define R_REVERSE_FLOOR_INDEX XREG(94)
#define R_MINIMAP_DISABLED XREG(95)
#define R_B_LABEL_DD WREG(0)
#define R_OW_MINIMAP_X WREG(29)
#define R_OW_MINIMAP_Y WREG(30)
+2 -2
View File
@@ -148,9 +148,9 @@ typedef enum {
#define PICTO_RESOLUTION_X 160
#define PICTO_RESOLUTION_Y 112
#define PICTO_POS_X ((void)0, ((SCREEN_WIDTH - PICTO_RESOLUTION_X) / 2))
#define PICTO_TOPLEFT_X ((SCREEN_WIDTH - PICTO_RESOLUTION_X) / 2)
// Picture is offset up by 33 pixels to give room for the message box at the bottom
#define PICTO_POS_Y (((void)0, ((SCREEN_HEIGHT - PICTO_RESOLUTION_Y) / 2)) - 33)
#define PICTO_TOPLEFT_Y (((SCREEN_HEIGHT - PICTO_RESOLUTION_Y) / 2) - 33)
typedef struct SramContext {
/* 0x00 */ u8* readBuff;
+18 -16
View File
@@ -7,12 +7,13 @@ void Setup_SetRegs(void) {
XREG(11) = 20;
XREG(12) = 14;
XREG(13) = 0;
XREG(31) = 0;
R_A_BTN_Y_OFFSET = 0;
R_MAGIC_CONSUME_TIMER_GIANTS_MASK = 80;
XREG(43) = 0xFC54;
XREG(44) = 0xD7;
XREG(45) = 0xDA;
R_THREE_DAY_CLOCK_Y_POS = 64596;
R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF = 215;
R_THREE_DAY_CLOCK_HOUR_DIGIT_CUTOFF = 218;
XREG(68) = 0x61;
XREG(69) = 0x93;
XREG(70) = 0x28;
@@ -27,22 +28,23 @@ void Setup_SetRegs(void) {
XREG(88) = 0x56;
XREG(89) = 0x258;
XREG(90) = 0x1C2;
R_STORY_FILL_SCREEN_ALPHA = 0;
R_REVERSE_FLOOR_INDEX = 0;
R_MINIMAP_DISABLED = false;
YREG(32) = 0x50;
YREG(33) = 0x3C;
YREG(34) = 0xDC;
YREG(35) = 0x3C;
YREG(36) = 0x50;
YREG(37) = 0xA0;
YREG(38) = 0xDC;
YREG(39) = 0xA0;
YREG(40) = 0x8E;
YREG(41) = 0x6C;
YREG(42) = 0xCC;
YREG(43) = 0xB1;
R_PICTO_FOCUS_BORDER_TOPLEFT_X = 80;
R_PICTO_FOCUS_BORDER_TOPLEFT_Y = 60;
R_PICTO_FOCUS_BORDER_TOPRIGHT_X = 220;
R_PICTO_FOCUS_BORDER_TOPRIGHT_Y = 60;
R_PICTO_FOCUS_BORDER_BOTTOMLEFT_X = 80;
R_PICTO_FOCUS_BORDER_BOTTOMLEFT_Y = 160;
R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_X = 220;
R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_Y = 160;
R_PICTO_FOCUS_ICON_X = 142;
R_PICTO_FOCUS_ICON_Y = 108;
R_PICTO_FOCUS_TEXT_X = 204;
R_PICTO_FOCUS_TEXT_Y = 177;
}
void Setup_InitImpl(SetupState* this) {
+44 -31
View File
@@ -4594,7 +4594,8 @@ void Interface_DrawClock(PlayState* play) {
* Cuts off Three-Day Clock's Sun and Moon when they dip below the clock
*/
gDPPipeSync(OVERLAY_DISP++);
gDPSetScissorFrac(OVERLAY_DISP++, G_SC_NON_INTERLACE, 400, 620, 880, XREG(44) * 4.0f);
gDPSetScissorFrac(OVERLAY_DISP++, G_SC_NON_INTERLACE, 400, 620, 880,
R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF * 4.0f);
// determines the current hour
for (sp1C6 = 0; sp1C6 <= 24; sp1C6++) {
@@ -4645,7 +4646,8 @@ void Interface_DrawClock(PlayState* play) {
* Cuts off Three-Day Clock's Hour Digits when they dip below the clock
*/
gDPPipeSync(OVERLAY_DISP++);
gDPSetScissorFrac(OVERLAY_DISP++, G_SC_NON_INTERLACE, 400, 620, 880, XREG(45) * 4.0f);
gDPSetScissorFrac(OVERLAY_DISP++, G_SC_NON_INTERLACE, 400, 620, 880,
R_THREE_DAY_CLOCK_HOUR_DIGIT_CUTOFF * 4.0f);
/**
* Draws Three-Day Clock's Hour Digit Above the Sun
@@ -4653,7 +4655,7 @@ void Interface_DrawClock(PlayState* play) {
sp1CC = gSaveContext.save.time * 0.000096131f;
// Rotates Three-Day Clock's Hour Digit To Above the Sun
Matrix_Translate(0.0f, XREG(43) / 10.0f, 0.0f, MTXMODE_NEW);
Matrix_Translate(0.0f, R_THREE_DAY_CLOCK_Y_POS / 10.0f, 0.0f, MTXMODE_NEW);
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
Matrix_RotateZF(-(sp1CC - 3.15f), MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx),
@@ -4678,7 +4680,7 @@ void Interface_DrawClock(PlayState* play) {
* Draws Three-Day Clock's Hour Digit Above the Moon
*/
// Rotates Three-Day Clock's Hour Digit To Above the Moon
Matrix_Translate(0.0f, XREG(43) / 10.0f, 0.0f, MTXMODE_NEW);
Matrix_Translate(0.0f, R_THREE_DAY_CLOCK_Y_POS / 10.0f, 0.0f, MTXMODE_NEW);
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
Matrix_RotateZF(-sp1CC, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx),
@@ -6099,9 +6101,9 @@ void Interface_Draw(PlayState* play) {
s16 sp2CA;
s16 sp2C8;
PauseContext* pauseCtx = &play->pauseCtx;
f32 sp2C0;
s16 counterDigits[4]; // sp2B8
s16 sp4C;
f32 minigameCountdownScale;
s16 counterDigits[4];
s16 magicAlpha;
OPEN_DISPS(play->state.gfxCtx);
@@ -6293,14 +6295,14 @@ void Interface_Draw(PlayState* play) {
sp2CC = sRupeeDigitsFirst[CUR_UPG_VALUE(UPG_WALLET)];
sp2C8 = sRupeeDigitsCount[CUR_UPG_VALUE(UPG_WALLET)];
sp4C = interfaceCtx->magicAlpha;
if (sp4C > 180) {
sp4C = 180;
magicAlpha = interfaceCtx->magicAlpha;
if (magicAlpha > 180) {
magicAlpha = 180;
}
for (sp2CE = 0, sp2CA = 42; sp2CE < sp2C8; sp2CE++, sp2CC++, sp2CA += 8) {
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, sp4C);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, magicAlpha);
OVERLAY_DISP = Gfx_DrawTexRectI8(OVERLAY_DISP, (u8*)gCounterDigit0Tex + (8 * 16 * counterDigits[sp2CC]), 8,
16, sp2CA + 1, 207, 8, 16, 1 << 10, 1 << 10);
@@ -6322,7 +6324,7 @@ void Interface_Draw(PlayState* play) {
Magic_DrawMeter(play);
Minimap_Draw(play);
if ((SREG(94) != 2) && (SREG(94) != 3)) {
if ((R_PAUSE_MENU_MODE != 2) && (R_PAUSE_MENU_MODE != 3)) {
Actor_DrawZTarget(&play->actorCtx.targetContext, play);
}
@@ -6347,7 +6349,7 @@ void Interface_Draw(PlayState* play) {
if (((u32)interfaceCtx->minigameState % 2) == 0) {
sp2CE = (interfaceCtx->minigameState >> 1) - 1;
sp2C0 = interfaceCtx->minigameCountdownScale / 100.0f;
minigameCountdownScale = interfaceCtx->minigameCountdownScale / 100.0f;
if (sp2CE == 3) {
interfaceCtx->actionVtx[40 + 0].v.ob[0] = interfaceCtx->actionVtx[40 + 2].v.ob[0] = -20;
@@ -6367,7 +6369,7 @@ void Interface_Draw(PlayState* play) {
interfaceCtx->minigameCountdownAlpha);
Matrix_Translate(0.0f, -40.0f, 0.0f, MTXMODE_NEW);
Matrix_Scale(sp2C0, sp2C0, 0.0f, MTXMODE_APPLY);
Matrix_Scale(minigameCountdownScale, minigameCountdownScale, 0.0f, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -6402,26 +6404,35 @@ void Interface_Draw(PlayState* play) {
gDPLoadTextureBlock_4b(OVERLAY_DISP++, gPictoBoxFocusBorderTex, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP,
G_TX_MIRROR | G_TX_WRAP, 4, 4, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(OVERLAY_DISP++, YREG(32) << 2, YREG(33) << 2, (YREG(32) << 2) + (16 << 2),
(YREG(33) << 2) + (16 << 2), G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
gSPTextureRectangle(OVERLAY_DISP++, YREG(34) << 2, YREG(35) << 2, (YREG(34) << 2) + (16 << 2),
(YREG(35) << 2) + (16 << 2), G_TX_RENDERTILE, 512, 0, 1 << 10, 1 << 10);
gSPTextureRectangle(OVERLAY_DISP++, YREG(36) << 2, YREG(37) << 2, (YREG(36) << 2) + (16 << 2),
(YREG(37) << 2) + (16 << 2), G_TX_RENDERTILE, 0, 512, 1 << 10, 1 << 10);
gSPTextureRectangle(OVERLAY_DISP++, YREG(38) << 2, YREG(39) << 2, (YREG(38) << 2) + (16 << 2),
(YREG(39) << 2) + (16 << 2), G_TX_RENDERTILE, 512, 512, 1 << 10, 1 << 10);
gSPTextureRectangle(OVERLAY_DISP++, R_PICTO_FOCUS_BORDER_TOPLEFT_X << 2, R_PICTO_FOCUS_BORDER_TOPLEFT_Y << 2,
(R_PICTO_FOCUS_BORDER_TOPLEFT_X << 2) + (16 << 2),
(R_PICTO_FOCUS_BORDER_TOPLEFT_Y << 2) + (16 << 2), G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
gSPTextureRectangle(OVERLAY_DISP++, R_PICTO_FOCUS_BORDER_TOPRIGHT_X << 2, R_PICTO_FOCUS_BORDER_TOPRIGHT_Y << 2,
(R_PICTO_FOCUS_BORDER_TOPRIGHT_X << 2) + (16 << 2),
(R_PICTO_FOCUS_BORDER_TOPRIGHT_Y << 2) + (16 << 2), G_TX_RENDERTILE, 512, 0, 1 << 10,
1 << 10);
gSPTextureRectangle(
OVERLAY_DISP++, R_PICTO_FOCUS_BORDER_BOTTOMLEFT_X << 2, R_PICTO_FOCUS_BORDER_BOTTOMLEFT_Y << 2,
(R_PICTO_FOCUS_BORDER_BOTTOMLEFT_X << 2) + (16 << 2), (R_PICTO_FOCUS_BORDER_BOTTOMLEFT_Y << 2) + (16 << 2),
G_TX_RENDERTILE, 0, 512, 1 << 10, 1 << 10);
gSPTextureRectangle(
OVERLAY_DISP++, R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_X << 2, R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_Y << 2,
(R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_X << 2) + (16 << 2),
(R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_Y << 2) + (16 << 2), G_TX_RENDERTILE, 512, 512, 1 << 10, 1 << 10);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, gPictoBoxFocusIconTex, G_IM_FMT_I, 32, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(OVERLAY_DISP++, YREG(40) << 2, YREG(41) << 2, (YREG(40) << 2) + 0x80,
(YREG(41) << 2) + (16 << 2), G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
gSPTextureRectangle(OVERLAY_DISP++, R_PICTO_FOCUS_ICON_X << 2, R_PICTO_FOCUS_ICON_Y << 2,
(R_PICTO_FOCUS_ICON_X << 2) + 0x80, (R_PICTO_FOCUS_ICON_Y << 2) + (16 << 2),
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, gPictoBoxFocusTextTex, G_IM_FMT_I, 32, 8, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(OVERLAY_DISP++, YREG(42) << 2, YREG(43) << 2, (YREG(42) << 2) + 0x80,
(YREG(43) << 2) + 0x20, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
gSPTextureRectangle(OVERLAY_DISP++, R_PICTO_FOCUS_TEXT_X << 2, R_PICTO_FOCUS_TEXT_Y << 2,
(R_PICTO_FOCUS_TEXT_X << 2) + 0x80, (R_PICTO_FOCUS_TEXT_Y << 2) + 0x20, G_TX_RENDERTILE, 0,
0, 1 << 10, 1 << 10);
}
// Draw pictograph photo
@@ -6437,6 +6448,7 @@ void Interface_Draw(PlayState* play) {
Interface_SetHudVisibility(HUD_VISIBILITY_ALL);
} else {
s16 pictoRectTop;
s16 pictoRectLeft;
if (sPictographState == PICTOGRAPH_STATE_SETUP_PHOTO) {
sPictographState = PICTOGRAPH_STATE_PHOTO;
@@ -6457,16 +6469,17 @@ void Interface_Draw(PlayState* play) {
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEI_PRIM, G_CC_MODULATEI_PRIM);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 250, 160, 160, 255);
pictoRectTop = PICTO_POS_Y;
pictoRectTop = PICTO_TOPLEFT_Y;
for (sp2CC = 0; sp2CC < (PICTO_RESOLUTION_Y / 8); sp2CC++, pictoRectTop += 8) {
pictoRectLeft = PICTO_TOPLEFT_X;
gDPLoadTextureBlock(OVERLAY_DISP++,
(u8*)((play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90) +
(0x500 * sp2CC),
G_IM_FMT_I, G_IM_SIZ_8b, PICTO_RESOLUTION_X, 8, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(OVERLAY_DISP++, PICTO_POS_X << 2, pictoRectTop << 2,
(PICTO_POS_X + PICTO_RESOLUTION_X) << 2, (pictoRectTop << 2) + (8 << 2),
gSPTextureRectangle(OVERLAY_DISP++, pictoRectLeft << 2, pictoRectTop << 2,
(pictoRectLeft + PICTO_RESOLUTION_X) << 2, (pictoRectTop << 2) + (8 << 2),
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}
}
@@ -6780,9 +6793,9 @@ void Interface_Update(PlayState* play) {
interfaceCtx->aButtonState = A_BTN_STATE_2;
if ((msgCtx->msgMode != 0) && (msgCtx->unk12006 == 0x26)) {
XREG(31) = -14;
R_A_BTN_Y_OFFSET = -14;
} else {
XREG(31) = 0;
R_A_BTN_Y_OFFSET = 0;
}
}
break;