From 954eae1e2fe568fd121f8ac100c8835baecc9d7b Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Mon, 9 Nov 2020 23:23:01 -0500 Subject: [PATCH] some pause stuff --- .../code_135EE0/pause_badges_draw_contents.s | 8 ++++---- .../code_135EE0/pause_badges_is_visible.s | 15 --------------- .../code_135EE0/pause_badges_load_badges.s | 8 ++++---- .../pause_badges_scroll_offset_y.s | 8 -------- .../code_135EE0/pause_badges_update.s | 8 ++++---- include/common_structs.h | 9 +++++++++ include/variables.h | 6 ++++++ src/code_135EE0.c | 19 +++++++++++++++++-- undefined_syms.txt | 5 +++++ 9 files changed, 49 insertions(+), 37 deletions(-) delete mode 100644 asm/nonmatchings/code_135EE0/pause_badges_is_visible.s delete mode 100644 asm/nonmatchings/code_135EE0/pause_badges_scroll_offset_y.s diff --git a/asm/nonmatchings/code_135EE0/pause_badges_draw_contents.s b/asm/nonmatchings/code_135EE0/pause_badges_draw_contents.s index 16a96ab4e8..c8057bab5d 100644 --- a/asm/nonmatchings/code_135EE0/pause_badges_draw_contents.s +++ b/asm/nonmatchings/code_135EE0/pause_badges_draw_contents.s @@ -1524,10 +1524,10 @@ glabel pause_badges_draw_contents /* 13BED8 80248B98 50400001 */ beql $v0, $zero, .L80248BA0 /* 13BEDC 80248B9C 24060070 */ addiu $a2, $zero, 0x70 .L80248BA0: -/* 13BEE0 80248BA0 3C038027 */ lui $v1, 0x8027 -/* 13BEE4 80248BA4 8C63038C */ lw $v1, 0x38c($v1) -/* 13BEE8 80248BA8 3C028027 */ lui $v0, 0x8027 -/* 13BEEC 80248BAC 8C420390 */ lw $v0, 0x390($v0) +/* 13BEE0 80248BA0 3C038027 */ lui $v1, %hi(gBadgeMenuCurrentScrollPos) +/* 13BEE4 80248BA4 8C63038C */ lw $v1, %lo(gBadgeMenuCurrentScrollPos)($v1) +/* 13BEE8 80248BA8 3C028027 */ lui $v0, %hi(gBadgeMenuTargetScrollPos) +/* 13BEEC 80248BAC 8C420390 */ lw $v0, %lo(gBadgeMenuTargetScrollPos)($v0) /* 13BEF0 80248BB0 1062000A */ beq $v1, $v0, .L80248BDC /* 13BEF4 80248BB4 24040020 */ addiu $a0, $zero, 0x20 /* 13BEF8 80248BB8 2605005D */ addiu $a1, $s0, 0x5d diff --git a/asm/nonmatchings/code_135EE0/pause_badges_is_visible.s b/asm/nonmatchings/code_135EE0/pause_badges_is_visible.s deleted file mode 100644 index 48aaffa8cb..0000000000 --- a/asm/nonmatchings/code_135EE0/pause_badges_is_visible.s +++ /dev/null @@ -1,15 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel pause_badges_is_visible -/* 13A5B0 80247270 3C038027 */ lui $v1, 0x8027 -/* 13A5B4 80247274 8C63038C */ lw $v1, 0x38c($v1) -/* 13A5B8 80247278 2462FFE0 */ addiu $v0, $v1, -0x20 -/* 13A5BC 8024727C 0082102A */ slt $v0, $a0, $v0 -/* 13A5C0 80247280 14400003 */ bnez $v0, .L80247290 -/* 13A5C4 80247284 24620080 */ addiu $v0, $v1, 0x80 -/* 13A5C8 80247288 03E00008 */ jr $ra -/* 13A5CC 8024728C 0082102A */ slt $v0, $a0, $v0 -.L80247290: -/* 13A5D0 80247290 03E00008 */ jr $ra -/* 13A5D4 80247294 0000102D */ daddu $v0, $zero, $zero diff --git a/asm/nonmatchings/code_135EE0/pause_badges_load_badges.s b/asm/nonmatchings/code_135EE0/pause_badges_load_badges.s index be4c72fa82..999381cb60 100644 --- a/asm/nonmatchings/code_135EE0/pause_badges_load_badges.s +++ b/asm/nonmatchings/code_135EE0/pause_badges_load_badges.s @@ -153,9 +153,9 @@ glabel pause_badges_load_badges /* 13C2DC 80248F9C 8FBF0018 */ lw $ra, 0x18($sp) /* 13C2E0 80248FA0 8FB10014 */ lw $s1, 0x14($sp) /* 13C2E4 80248FA4 8FB00010 */ lw $s0, 0x10($sp) -/* 13C2E8 80248FA8 3C018027 */ lui $at, 0x8027 -/* 13C2EC 80248FAC AC22038C */ sw $v0, 0x38c($at) -/* 13C2F0 80248FB0 3C018027 */ lui $at, 0x8027 -/* 13C2F4 80248FB4 AC220390 */ sw $v0, 0x390($at) +/* 13C2E8 80248FA8 3C018027 */ lui $at, %hi(gBadgeMenuCurrentScrollPos) +/* 13C2EC 80248FAC AC22038C */ sw $v0, %lo(gBadgeMenuCurrentScrollPos)($at) +/* 13C2F0 80248FB0 3C018027 */ lui $at, %hi(gBadgeMenuTargetScrollPos) +/* 13C2F4 80248FB4 AC220390 */ sw $v0, %lo(gBadgeMenuTargetScrollPos)($at) /* 13C2F8 80248FB8 03E00008 */ jr $ra /* 13C2FC 80248FBC 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/asm/nonmatchings/code_135EE0/pause_badges_scroll_offset_y.s b/asm/nonmatchings/code_135EE0/pause_badges_scroll_offset_y.s deleted file mode 100644 index dc29a67550..0000000000 --- a/asm/nonmatchings/code_135EE0/pause_badges_scroll_offset_y.s +++ /dev/null @@ -1,8 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel pause_badges_scroll_offset_y -/* 13A5D8 80247298 3C028027 */ lui $v0, 0x8027 -/* 13A5DC 8024729C 8C42038C */ lw $v0, 0x38c($v0) -/* 13A5E0 802472A0 03E00008 */ jr $ra -/* 13A5E4 802472A4 00821023 */ subu $v0, $a0, $v0 diff --git a/asm/nonmatchings/code_135EE0/pause_badges_update.s b/asm/nonmatchings/code_135EE0/pause_badges_update.s index e46f40219e..9b32fddcaf 100644 --- a/asm/nonmatchings/code_135EE0/pause_badges_update.s +++ b/asm/nonmatchings/code_135EE0/pause_badges_update.s @@ -74,11 +74,11 @@ glabel pause_badges_update /* 13CA54 80249714 00002812 */ mflo $a1 /* 13CA58 80249718 0C091C5A */ jal pause_badges_get_pos_y /* 13CA5C 8024971C 00000000 */ nop -/* 13CA60 80249720 3C108027 */ lui $s0, 0x8027 -/* 13CA64 80249724 2610038C */ addiu $s0, $s0, 0x38c +/* 13CA60 80249720 3C108027 */ lui $s0, %hi(gBadgeMenuCurrentScrollPos) +/* 13CA64 80249724 2610038C */ addiu $s0, $s0, %lo(gBadgeMenuCurrentScrollPos) /* 13CA68 80249728 8E040000 */ lw $a0, ($s0) -/* 13CA6C 8024972C 3C018027 */ lui $at, 0x8027 -/* 13CA70 80249730 AC220390 */ sw $v0, 0x390($at) +/* 13CA6C 8024972C 3C018027 */ lui $at, %hi(gBadgeMenuTargetScrollPos) +/* 13CA70 80249730 AC220390 */ sw $v0, %lo(gBadgeMenuTargetScrollPos)($at) /* 13CA74 80249734 0C090D1B */ jal pause_interp_vertical_scroll /* 13CA78 80249738 00442023 */ subu $a0, $v0, $a0 /* 13CA7C 8024973C 8E030000 */ lw $v1, ($s0) diff --git a/include/common_structs.h b/include/common_structs.h index 45d67fafd4..ca148061b6 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -1533,4 +1533,13 @@ typedef struct { /* 0x18 */ s32 easingType; } Path; // size = 0x1C +typedef struct { + /* 0x00 */ s8 enabled; + /* 0x01 */ s8 listStart; + /* 0x02 */ s8 numCols; + /* 0x03 */ s8 numRows; + /* 0x04 */ s32 startIndex; + /* 0x08 */ s32 count; +} PauseItemPage; // size = 0xC + #endif diff --git a/include/variables.h b/include/variables.h index 5377a30a3a..02959ac219 100644 --- a/include/variables.h +++ b/include/variables.h @@ -120,9 +120,15 @@ extern s32 D_800A0960; extern s32 D_800A0964; // Pause +extern PauseItemPage gItemMenuPages[20]; extern s32 gPauseMenuStrings[348]; extern s32 gPauseMenuCursorTargetOpacity; +// Badges +extern PauseItemPage gBadgeMenuPages[20]; +extern s32 gBadgeMenuCurrentScrollPos; +extern s32 gBadgeMenuTargetScrollPos; + extern s32 gGameState; extern s32 D_8009A650[1]; extern u16 D_8009A6A0; diff --git a/src/code_135EE0.c b/src/code_135EE0.c index 3ce4094fd3..91b568609f 100644 --- a/src/code_135EE0.c +++ b/src/code_135EE0.c @@ -1,6 +1,13 @@ #include "common.h" +// Need data segment and vars declared above +#ifdef NON_MATCHING +void pause_set_cursor_opacity(s32 val) { + gPauseMenuCursorTargetOpacity = val; +} +#else INCLUDE_ASM(s32, "code_135EE0", pause_set_cursor_opacity); +#endif INCLUDE_ASM(s32, "code_135EE0", func_80242BAC); @@ -100,9 +107,17 @@ INCLUDE_ASM(s32, "code_135EE0", pause_badges_get_column); INCLUDE_ASM(s32, "code_135EE0", pause_badges_get_row); -INCLUDE_ASM(s32, "code_135EE0", pause_badges_is_visible); +s32 pause_badges_is_visible(s32 y) { + if (y < gBadgeMenuCurrentScrollPos - 32) { + return FALSE; + } else { + return y < gBadgeMenuCurrentScrollPos + 128; + } +} -INCLUDE_ASM(s32, "code_135EE0", pause_badges_scroll_offset_y); +s32 pause_badges_scroll_offset_y(s32 offset) { + return offset - gBadgeMenuCurrentScrollPos; +} s32 pause_badges_scroll_offset_x(s32 x) { return x; diff --git a/undefined_syms.txt b/undefined_syms.txt index b1a9e4e7f7..50bcdba354 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -148,6 +148,11 @@ gBackgroundImage = 0x80200000; gPauseMenuCursorTargetOpacity = 0x8024EFB0; +gBadgeMenuPages = 0x80270288; +gBadgeMenuCurrentScrollPos = 0x8027038C; +gBadgeMenuTargetScrollPos = 0x80270390; +gPauseItemPages = 0x802704D0; + D_802C3000 = 0x802C3000; D_802DBD40 = 0x802DBD40; gCurrentPrintContext = 0x802DB260;