More of title_screen.c

This commit is contained in:
Egor Ananyin 2020-05-16 20:58:52 +03:00
parent 0eef56ad59
commit f4d9497fd3
4 changed files with 102 additions and 343 deletions

View File

@ -5,346 +5,6 @@
.text
thumb_func_start sub_0814A178
sub_0814A178: @ 0x0814A178
push {r4, r5, r6, r7, lr}
adds r6, r0, #0
movs r1, #0x9a
lsls r1, r1, #1
adds r0, r6, r1
ldrh r4, [r0]
adds r4, #1
movs r7, #0
strh r4, [r0]
ldr r5, _0814A1C0 @ =gBldRegs
movs r1, #0
ldrsh r0, [r0, r1]
lsls r0, r0, #4
movs r1, #0xf
bl __divsi3
movs r1, #0x10
subs r1, r1, r0
strh r1, [r5, #4]
lsls r4, r4, #0x10
asrs r4, r4, #0x10
cmp r4, #0xe
ble _0814A1BA
strh r7, [r5, #4]
strh r7, [r5, #2]
strh r7, [r5]
movs r0, #1
str r0, [r6, #4]
movs r0, #0x98
lsls r0, r0, #1
adds r1, r6, r0
ldr r0, _0814A1C4 @ =sub_0814A420
str r0, [r1]
_0814A1BA:
pop {r4, r5, r6, r7}
pop {r0}
bx r0
.align 2, 0
_0814A1C0: .4byte gBldRegs
_0814A1C4: .4byte sub_0814A420
thumb_func_start sub_0814A1C8
sub_0814A1C8: @ 0x0814A1C8
push {r4, r5, r6, lr}
adds r2, r0, #0
ldrh r1, [r2, #0x12]
movs r0, #0x10
ands r0, r1
cmp r0, #0
beq _0814A1E2
ldrh r0, [r2, #6]
lsls r0, r0, #2
movs r1, #0x80
lsls r1, r1, #0x12
adds r0, r0, r1
b _0814A1EA
_0814A1E2:
ldrh r1, [r2, #6]
movs r0, #0xc0
lsls r0, r0, #0x12
adds r0, r1, r0
_0814A1EA:
adds r6, r0, #0
movs r5, #0
_0814A1EE:
lsls r0, r5, #2
adds r0, r0, r5
lsls r0, r0, #3
adds r0, #0x10
adds r4, r6, r0
ldr r0, [r4]
cmp r0, #0
beq _0814A206
bl sub_08157190
movs r0, #0
str r0, [r4]
_0814A206:
adds r0, r5, #1
lsls r0, r0, #0x18
lsrs r5, r0, #0x18
cmp r5, #6
bls _0814A1EE
pop {r4, r5, r6}
pop {r0}
bx r0
.align 2, 0
thumb_func_start sub_0814A218
sub_0814A218: @ 0x0814A218
push {lr}
sub sp, #4
adds r1, r0, #0
lsls r1, r1, #0x18
mov r2, sp
movs r0, #0
strh r0, [r2]
lsrs r1, r1, #0xa
movs r0, #0xc0
lsls r0, r0, #0x13
adds r1, r1, r0
ldr r2, _0814A23C @ =0x01002000
mov r0, sp
bl CpuSet
add sp, #4
pop {r0}
bx r0
.align 2, 0
_0814A23C: .4byte 0x01002000
thumb_func_start sub_0814A240
sub_0814A240: @ 0x0814A240
push {lr}
sub sp, #4
lsls r0, r0, #0x18
lsrs r0, r0, #0x18
mov r2, sp
ldr r3, _0814A26C @ =0x000001FF
adds r1, r3, #0
strh r1, [r2]
movs r1, #0x1f
subs r1, r1, r0
lsls r1, r1, #0xb
movs r0, #0xc0
lsls r0, r0, #0x13
adds r1, r1, r0
ldr r2, _0814A270 @ =0x01000400
mov r0, sp
bl CpuSet
add sp, #4
pop {r0}
bx r0
.align 2, 0
_0814A26C: .4byte 0x000001FF
_0814A270: .4byte 0x01000400
thumb_func_start sub_0814A274
sub_0814A274: @ 0x0814A274
push {r4, lr}
adds r4, r0, #0
movs r1, #0x9c
lsls r1, r1, #1
adds r0, r4, r1
ldr r2, _0814A2A4 @ =gUnk_08D626F0
ldr r1, _0814A2A8 @ =gUnk_08D60A80
ldrh r1, [r1]
lsls r1, r1, #3
adds r2, #4
adds r1, r1, r2
ldr r1, [r1]
ldr r1, [r1]
bl sub_0814F3C4
movs r0, #0xa2
lsls r0, r0, #1
adds r1, r4, r0
ldr r0, _0814A2AC @ =sub_0814A2B0
str r0, [r1]
pop {r4}
pop {r0}
bx r0
.align 2, 0
_0814A2A4: .4byte gUnk_08D626F0
_0814A2A8: .4byte gUnk_08D60A80
_0814A2AC: .4byte sub_0814A2B0
thumb_func_start sub_0814A2B0
sub_0814A2B0: @ 0x0814A2B0
push {lr}
adds r1, r0, #0
ldr r0, [r1, #4]
cmp r0, #1
bne _0814A2C4
movs r0, #0xa2
lsls r0, r0, #1
adds r1, r1, r0
ldr r0, _0814A2C8 @ =sub_0814A2CC
str r0, [r1]
_0814A2C4:
pop {r0}
bx r0
.align 2, 0
_0814A2C8: .4byte sub_0814A2CC
thumb_func_start sub_0814A2CC
sub_0814A2CC: @ 0x0814A2CC
push {r4, r5, lr}
adds r5, r0, #0
movs r0, #0x9c
lsls r0, r0, #1
adds r4, r5, r0
adds r0, r4, #0
bl sub_0814F274
cmp r0, #0
bne _0814A2FE
ldr r1, _0814A304 @ =gUnk_08D626F0
ldr r0, _0814A308 @ =gUnk_08D60A80
ldrh r0, [r0]
lsls r0, r0, #3
adds r0, r0, r1
ldr r0, [r0]
ldr r1, [r0]
adds r0, r4, #0
bl sub_0814F3C4
movs r0, #0xa2
lsls r0, r0, #1
adds r1, r5, r0
ldr r0, _0814A30C @ =sub_0814A310
str r0, [r1]
_0814A2FE:
pop {r4, r5}
pop {r0}
bx r0
.align 2, 0
_0814A304: .4byte gUnk_08D626F0
_0814A308: .4byte gUnk_08D60A80
_0814A30C: .4byte sub_0814A310
thumb_func_start sub_0814A310
sub_0814A310: @ 0x0814A310
push {r4, r5, lr}
adds r5, r0, #0
movs r0, #0x9c
lsls r0, r0, #1
adds r4, r5, r0
adds r0, r4, #0
bl sub_0814F274
cmp r0, #0
bne _0814A344
ldr r1, _0814A34C @ =gUnk_08D626F0
ldr r0, _0814A350 @ =gUnk_08D60A80
ldrh r0, [r0]
lsls r0, r0, #3
adds r1, #4
adds r0, r0, r1
ldr r0, [r0]
ldr r1, [r0]
adds r0, r4, #0
bl sub_0814F3C4
movs r0, #0xa2
lsls r0, r0, #1
adds r1, r5, r0
ldr r0, _0814A354 @ =sub_0814A358
str r0, [r1]
_0814A344:
pop {r4, r5}
pop {r0}
bx r0
.align 2, 0
_0814A34C: .4byte gUnk_08D626F0
_0814A350: .4byte gUnk_08D60A80
_0814A354: .4byte sub_0814A358
thumb_func_start sub_0814A358
sub_0814A358: @ 0x0814A358
push {r4, r5, lr}
adds r5, r0, #0
movs r0, #0x9c
lsls r0, r0, #1
adds r4, r5, r0
adds r0, r4, #0
bl sub_0814F274
cmp r0, #0
bne _0814A38A
ldr r1, _0814A390 @ =gUnk_08D626F0
ldr r0, _0814A394 @ =gUnk_08D60A80
ldrh r0, [r0]
lsls r0, r0, #3
adds r0, r0, r1
ldr r0, [r0]
ldr r1, [r0]
adds r0, r4, #0
bl sub_0814F3C4
movs r0, #0xa2
lsls r0, r0, #1
adds r1, r5, r0
ldr r0, _0814A398 @ =sub_0814A310
str r0, [r1]
_0814A38A:
pop {r4, r5}
pop {r0}
bx r0
.align 2, 0
_0814A390: .4byte gUnk_08D626F0
_0814A394: .4byte gUnk_08D60A80
_0814A398: .4byte sub_0814A310
thumb_func_start sub_0814A39C
sub_0814A39C: @ 0x0814A39C
push {r4, r5, r6, r7, lr}
mov r7, r8
push {r7}
mov r8, r0
movs r0, #0x94
lsls r0, r0, #1
add r0, r8
ldrb r7, [r0]
movs r6, #0
cmp r6, r7
bhs _0814A3F4
_0814A3B2:
ldr r0, _0814A400 @ =gUnk_08D6274A
adds r0, r6, r0
ldrb r0, [r0]
lsls r5, r0, #2
adds r5, r5, r0
lsls r5, r5, #3
adds r5, #0x10
add r5, r8
lsls r4, r6, #2
adds r4, r4, r6
lsls r4, r4, #2
adds r0, r6, #0
movs r1, #5
bl __udivsi3
lsls r0, r0, #0x18
lsrs r0, r0, #0x18
lsls r1, r0, #1
adds r1, r1, r0
lsls r1, r1, #2
adds r1, #0x18
adds r4, r4, r1
strh r4, [r5, #0x10]
movs r0, #0x7f
strh r0, [r5, #0x12]
adds r0, r5, #0
bl sub_0815604C
adds r0, r6, #1
lsls r0, r0, #0x18
lsrs r6, r0, #0x18
cmp r6, r7
blo _0814A3B2
_0814A3F4:
pop {r3}
mov r8, r3
pop {r4, r5, r6, r7}
pop {r0}
bx r0
.align 2, 0
_0814A400: .4byte gUnk_08D6274A
thumb_func_start sub_0814A404
sub_0814A404: @ 0x0814A404
push {lr}

View File

@ -20,8 +20,10 @@ void sub_08032E98(void);
void sub_08145B64(u16);
void sub_08149CE4(void);
u32 sub_0814F274(u16*);
void sub_0814F3C4(u16*, u32);
extern u32 sub_081570B0(u16);
u32 sub_081570B0(u16);
u32 sub_08153184(void);
u32 sub_0815436C(void);
@ -33,5 +35,6 @@ void Timer3Intr(void);
void nullsub_2(void);
void sub_08159074(void);
u32 sub_08159088(u16);
void sub_08157190(u32);
#endif

View File

@ -36,8 +36,10 @@ struct TitleStruct {
u8 filler129[3];
TitleFunc unk12C;
TitleFunc unk130;
u16 unk134;
u8 filler136[0xe];
s16 unk134;
u8 filler136[2];
u16 unk138;
u8 filler13A[0xa];
TitleFunc unk144;
};
@ -55,8 +57,10 @@ struct Unk_082D7850 {
extern const struct Unk_082D7850* const gUnk_082D7850[];
extern const u16 gUnk_08387D58[][4];
extern const u16 gUnk_08D60A80;
extern const u32* gUnk_08D626F0[][2];
extern const u16 gUnk_08D62720[7][3];
extern const u16* gUnk_08D62722;
extern const u8 gUnk_08D6274A[];
extern void sub_08149DC0(void);
extern void sub_08149F08(struct TitleStruct*);
@ -64,9 +68,14 @@ extern void sub_0814A178(struct TitleStruct*);
extern void sub_0814A1C8(struct GameState*);
extern void sub_0814A218(u8);
extern void sub_0814A240(u8);
extern void sub_0814A2B0(struct TitleStruct*);
extern void sub_0814A2CC(struct TitleStruct*);
extern void sub_0814A310(struct TitleStruct*);
extern void sub_0814A358(struct TitleStruct*);
extern void sub_0814A39C(struct TitleStruct*);
extern void sub_0814A404(struct TitleStruct*);
extern void sub_0814A410(struct TitleStruct*);
extern void sub_0814A420(struct TitleStruct*);
extern void sub_0814A518(struct TitleStruct*);
extern void sub_0814A6BC(struct TitleStruct*);
extern u32 sub_08155128(struct Unk10*);

View File

@ -128,6 +128,7 @@ static inline void LoadBg(u8 bg, u16 r0, void* dest) {
r1 = (gBgCntRegs[bg] >> 2) & 3;
r6 = (((gBgCntRegs[bg] >> 8) & 0x1f) << 0xb) + dest;
LZ77UnCompVram(r0_2, (r1 << 0xe) + (void*)VRAM);
for (j = 0; j < r5; j++) {
CpuCopy16(r7 + j * 60, r6 + j * 64, 0x3c);
}
@ -140,6 +141,7 @@ static inline void sub_08158334_wrapper(u16* a1, u8 a2, u16 a3) {
void sub_08149F8C(struct TitleStruct* arg0) {
u8 i;
u16 r0;
for (i = 0; i < 3; i++) {
sub_0814A218(i);
}
@ -152,6 +154,7 @@ void sub_08149F8C(struct TitleStruct* arg0) {
LoadBg(1, gUnk_08387D58[gUnk_08D60A80][0], (void*)VRAM);
LoadBg(2, gUnk_08387D58[gUnk_08D60A80][2], (void*)VRAM);
r0 = gUnk_08387D58[gUnk_08D60A80][0];
if (gUnk_03002440 & 0x10000) {
sub_08158334_wrapper(gUnk_082D7850[r0]->unk10, 0, 0x100);
}
@ -164,3 +167,87 @@ void sub_08149F8C(struct TitleStruct* arg0) {
arg0->unk134 = 0;
arg0->unk130 = sub_0814A178;
}
void sub_0814A178(struct TitleStruct* arg0) {
arg0->unk134++;
gBldRegs.bldY = 0x10 - ((arg0->unk134 << 4) / 0xf);
if (arg0->unk134 > 0xe) {
gBldRegs.bldY = 0;
gBldRegs.bldAlpha = 0;
gBldRegs.bldCnt = 0;
arg0->unk4 = 1;
arg0->unk130 = sub_0814A420;
}
}
void sub_0814A1C8(struct GameState* arg0) {
struct TitleStruct* r0, *r6;
u8 i;
if (arg0->unk12 & 0x10) {
r0 = (struct TitleStruct*)(EWRAM_START + (arg0->unk6 << 2));
}
else {
r0 = (struct TitleStruct*)(IWRAM_START + arg0->unk6);
}
r6 = r0;
for (i = 0; i <= 6; i++) {
struct Unk10* cur = &r6->unk10[i];
if (cur->unk0 != 0) {
sub_08157190(cur->unk0);
cur->unk0 = 0;
}
}
}
void sub_0814A218(u8 arg0) {
CpuFill16(0, (void*)VRAM + (arg0 << 0xe), 0x4000);
}
void sub_0814A240(u8 arg0) {
CpuFill16(0x1ff, (void*)VRAM + ((0x1f - arg0) << 0xb), 0x800);
}
void sub_0814A274(struct TitleStruct* arg0) {
sub_0814F3C4(&arg0->unk138, *gUnk_08D626F0[gUnk_08D60A80][1]);
arg0->unk144 = sub_0814A2B0;
}
void sub_0814A2B0(struct TitleStruct* arg0) {
if (arg0->unk4 == 1) {
arg0->unk144 = sub_0814A2CC;
}
}
void sub_0814A2CC(struct TitleStruct* arg0) {
if (sub_0814F274(&arg0->unk138) == 0) {
sub_0814F3C4(&arg0->unk138, *gUnk_08D626F0[gUnk_08D60A80][0]);
arg0->unk144 = sub_0814A310;
}
}
void sub_0814A310(struct TitleStruct* arg0) {
if (sub_0814F274(&arg0->unk138) == 0) {
sub_0814F3C4(&arg0->unk138, *gUnk_08D626F0[gUnk_08D60A80][1]);
arg0->unk144 = sub_0814A358;
}
}
void sub_0814A358(struct TitleStruct* arg0) {
if (sub_0814F274(&arg0->unk138) == 0) {
sub_0814F3C4(&arg0->unk138, *gUnk_08D626F0[gUnk_08D60A80][0]);
arg0->unk144 = sub_0814A310;
}
}
void sub_0814A39C(struct TitleStruct* arg0) {
u8 i, r7 = arg0->unk128;
for (i = 0; i < r7; i++) {
struct Unk10* cur = &arg0->unk10[gUnk_08D6274A[i]];
cur->unk10 = (i * 20) + (i / 5 * 12 + 24);
cur->unk12 = 0x7f;
sub_0815604C(cur);
}
}