Merge pull request #138 from Kermalis/kermalis-rescue_password_menu

Grossly complete rescue_password_menu
This commit is contained in:
Cheng Hann Gan 2023-07-17 02:29:06 -04:00 committed by GitHub
commit abeeecd21f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 108 deletions

View File

@ -1,70 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_8039174
sub_8039174:
push {r4,lr}
ldr r0, _080391D8
ldr r3, [r0]
movs r0, 0x82
lsls r0, 2
adds r3, r0
ldrh r1, [r3]
ldr r0, _080391DC
ands r0, r1
ldr r1, _080391E0
ands r0, r1
ldr r4, _080391E4
ands r0, r4
ldr r1, _080391E8
ands r0, r1
ldr r1, _080391EC
ands r0, r1
movs r2, 0x80
lsls r2, 7
ldr r1, _080391F0
ands r0, r1
orrs r0, r2
strh r0, [r3]
movs r2, 0xFC
lsls r2, 2
ldrh r1, [r3, 0x4]
movs r0, 0xFC
lsls r0, 8
ands r0, r1
orrs r0, r2
ands r0, r4
movs r2, 0xF
movs r4, 0xF0
lsls r4, 8
ldr r1, _080391F4
ands r0, r1
orrs r0, r4
strh r0, [r3, 0x4]
movs r0, 0
strh r0, [r3, 0x2]
movs r1, 0xC0
lsls r1, 4
ldrh r0, [r3, 0x6]
ands r2, r0
orrs r2, r1
strh r2, [r3, 0x6]
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080391D8: .4byte gRescuePasswordMenu
_080391DC: .4byte 0x0000feff
_080391E0: .4byte 0x0000fdff
_080391E4: .4byte 0x0000f3ff
_080391E8: .4byte 0x0000efff
_080391EC: .4byte 0x0000dfff
_080391F0: .4byte 0x00003fff
_080391F4: .4byte 0x00000fff
thumb_func_end sub_8039174
.align 2,0

View File

@ -5,12 +5,13 @@
struct unkSprite
{
u16 unk208;
u16 unk20A;
u16 unk20C;
u16 unk20E;
u16 unk0;
u16 unk2;
u16 unk4;
u16 unk6;
};
// Similar to unkStruct_203B360
struct RescuePasswordMenu
{
// size: 0x214

View File

@ -164,8 +164,6 @@ SECTIONS {
src/unk_menu_203B360.o(.text);
src/save_menu.o(.text);
src/rescue_password_menu.o(.text);
asm/rescue_password_menu.o(.text);
src/rescue_password_menu_1.o(.text);
src/load_screen.o(.text);
src/wonder_mail_main_menu.o(.text);
src/ds_menus.o(.text);

View File

@ -277,6 +277,9 @@ bool8 sub_8095298(s32);
bool8 sub_803D204(u8 *, struct unkStruct_203B480 *);
extern s32 GetDungeonFloorCount(u8);
extern void AddSprite(struct unkSprite *, u32, u32, u32);
extern void xxx_draw_string_80144C4(void);
void CreateRescuePasswordMenu(u32 currMenu)
{
@ -701,3 +704,71 @@ u32 sub_8039068(u32 mailMode, u8 *passwordBuffer, struct unkStruct_203B480 *para
return -1;
}
}
void sub_8039174(void)
{
u16 temp;
#ifndef NONMATCHING
register u32 r2 asm("r2");
#else
u32 r2; // r4 but should be r2
#endif //NONMATCHING
struct unkSprite* spr; // r2 but should be r3
u16 r4; // r3 but should be r4
spr = &gRescuePasswordMenu->unk208;
spr->unk0 &= ~0x100;
spr->unk0 &= ~0x200;
r4 = ~(0x800 | 0x400);
spr->unk0 &= r4;
spr->unk0 &= ~0x1000;
spr->unk0 &= ~0x2000;
r2 = 0x4000;
temp = 0x8000;
temp = ~(temp | 0x4000);
spr->unk0 &= temp;
spr->unk0 |= r2;
r2 = 0x200 | 0x100 | 0x80 | 0x40 | 0x20 | 0x10;
spr->unk4 &= ~(0x200 | 0x100 | 0x80 | 0x40 | 0x20 | 0x10 | 0x8 | 0x4 | 0x2 | 0x1);
spr->unk4 |= r2;
spr->unk4 &= r4;
r2 = 0x1 | 0x2 | 0x4 | 0x8;
r4 = 0x1000 | 0x2000 | 0x4000 | 0x8000;
temp = ~r4;
spr->unk4 &= temp;
spr->unk4 |= r4;
#ifndef NONMATCHING
while (0) ;
#endif //NONMATCHING
spr->unk2 = 0; // Without the while(0), this 0 is loaded super early and also into r3
temp = 0x800 | 0x400;
r2 &= spr->unk6;
r2 |= temp;
spr->unk6 = r2;
}
void sub_80391F8(void)
{
struct unkSprite *iVar2;
u32 temp;
u32 temp2;
iVar2 = &gRescuePasswordMenu->unk208;
temp = (iVar2->unk2 & 0xfe00);
iVar2->unk2 = temp | 0x70;
temp2 = 0x700;
temp = (iVar2->unk6 & 0xf);
iVar2->unk6 = temp | temp2;
if ((gRescuePasswordMenu->unk210 & 8) != 0) {
AddSprite(iVar2,0x100,0,0);
}
xxx_draw_string_80144C4();
gRescuePasswordMenu->unk210 += 1;
}

View File

@ -1,32 +0,0 @@
#include "global.h"
#include "memory.h"
#include "input.h"
#include "item.h"
#include "text.h"
#include "rescue_password_menu.h"
extern struct RescuePasswordMenu *gRescuePasswordMenu;
extern void AddSprite(struct unkSprite *, u32, u32, u32);
extern void xxx_draw_string_80144C4(void);
void sub_80391F8(void)
{
struct unkSprite *iVar2;
u32 temp;
u32 temp2;
iVar2 = &gRescuePasswordMenu->unk208;
temp = (iVar2->unk20A & 0xfe00);
iVar2->unk20A = temp | 0x70;
temp2 = 0x700;
temp = (iVar2->unk20E & 0xf);
iVar2->unk20E = temp | temp2;
if ((gRescuePasswordMenu->unk210 & 8) != 0) {
AddSprite(iVar2,0x100,0,0);
}
xxx_draw_string_80144C4();
gRescuePasswordMenu->unk210 += 1;
}

View File

@ -14,6 +14,7 @@ struct unkSprite
u16 unk6;
};
// Similar to RescuePasswordMenu
struct unkStruct_203B360
{
// size: 0x1b4