Miscellaneous Work (Again) (#30)

* work on debug menu and document that and main menu

* split, decomp, label more funcs

* split exclusive pokemon data out into C

* macro-ize exlusive pokemon data

* decomp 2 more funcs

* decomp a few more

* finally match PromptNewQuestion

* woot 7% aka more debug menu stuff
This commit is contained in:
Seth Barberee 2021-03-12 15:39:07 -06:00 committed by GitHub
parent d72e17b5f5
commit 7b142311a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 19687 additions and 20234 deletions

View File

@ -605,7 +605,7 @@ _08013018:
cmp r7, r0
beq _08013094
movs r0, 0x3
bl sub_80119D4
bl PlayMenuSoundEffect
b _08013094
_08013028:
adds r0, r5, 0
@ -642,11 +642,11 @@ _0801304C:
bne _08013070
_08013068:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _08013094
_08013070:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
b _08013094
_08013078:
movs r1, 0x2E
@ -661,7 +661,7 @@ _08013078:
movs r0, 0
strb r0, [r6]
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
_08013094:
adds r0, r4, 0
bl sub_8012EBC
@ -702,7 +702,7 @@ _080130CA:
movs r0, 0
strb r0, [r6]
strh r0, [r4, 0x38]
bl sub_80119D4
bl PlayMenuSoundEffect
b _08013100
_080130E6:
movs r1, 0x2E
@ -716,7 +716,7 @@ _080130E6:
str r0, [r4, 0x48]
movs r0, 0
strb r0, [r6]
bl sub_80119D4
bl PlayMenuSoundEffect
_08013100:
adds r0, r4, 0
bl sub_8012EBC
@ -1798,7 +1798,7 @@ _080138FE:
cmp r6, r0
beq _0801391C
movs r0, 0x3
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801391C
_0801390E:
adds r0, r5, 0
@ -1816,7 +1816,7 @@ _0801391C:
b _08013930
_08013928:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x1
_08013930:
pop {r4-r7}
@ -1858,7 +1858,7 @@ _0801396A:
b _0801397E
_08013976:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x1
_0801397E:
pop {r4,r5}
@ -2237,12 +2237,12 @@ _08013C40:
cmp r0, 0x2
bne _08013C60
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _08013C62
_08013C56:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _08013C62
_08013C60:
@ -2402,7 +2402,7 @@ _08013D62:
beq _08013D7C
strb r5, [r4]
movs r0, 0x3
bl sub_80119D4
bl PlayMenuSoundEffect
adds r1, r6, 0
adds r1, 0x26
movs r0, 0x8
@ -2475,7 +2475,7 @@ _08013DE4:
ldr r0, [r0]
adds r5, r2, r0
movs r0, 0x3
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, [r4, 0xC]
cmp r5, r0
bgt _08013E3E
@ -2489,7 +2489,7 @@ _08013E10:
bne _08013E22
_08013E18:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0
b _08013E4C
_08013E22:
@ -2502,7 +2502,7 @@ _08013E22:
ldr r0, [r0]
subs r5, r2, r0
movs r0, 0x3
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, [r4, 0x8]
cmp r5, r0
bge _08013E48
@ -5434,13 +5434,13 @@ _0801558C:
_080155A8:
strb r0, [r1, 0x1C]
movs r0, 0x3
bl sub_80119D4
bl PlayMenuSoundEffect
b _080155E2
.align 2, 0
_080155B4: .4byte gUnknown_203B1FC
_080155B8:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _080155E2
_080155C0:
bl sub_801560C
@ -5454,7 +5454,7 @@ _080155C6:
b _080155E4
_080155D4:
movs r0, 0x3
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, _080155EC
ldr r1, [r0]
movs r0, 0x5
@ -5529,7 +5529,7 @@ _08015648:
_08015658:
strb r1, [r5, 0x18]
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0
bl sub_8015A08
b _0801573E
@ -5557,7 +5557,7 @@ _0801567A:
bne _080156D4
_08015696:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, _080156B8
ldr r2, [r0]
movs r1, 0x9A
@ -5587,7 +5587,7 @@ _080156BC:
bne _080156DC
_080156D4:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801573E
_080156DC:
ldr r0, _08015728
@ -5637,7 +5637,7 @@ _0801572C:
strb r0, [r1, 0x1A]
_08015730:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
bl sub_8015C1C
bl sub_8015F84
_0801573E:
@ -5664,7 +5664,7 @@ sub_8015748:
cmp r1, 0
bne _08015770
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x1
b _080157CE
.align 2, 0
@ -5679,7 +5679,7 @@ _08015770:
adds r0, r1
strb r3, [r0]
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
bl sub_8015C1C
bl sub_8015F84
b _080157CC
@ -5709,7 +5709,7 @@ _080157B0:
movs r1, 0
strb r1, [r0]
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
bl sub_8015C1C
bl sub_8015F84
_080157CC:
@ -5947,7 +5947,7 @@ _08015988:
beq _080159A0
strb r0, [r1, 0x1A]
movs r0, 0x3
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r1, [r4]
movs r0, 0x8
strb r0, [r1, 0x17]
@ -14650,7 +14650,7 @@ _08019F14:
b _08019F88
_08019F1A:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _08019FAA
_08019F24:
@ -14682,7 +14682,7 @@ _08019F24:
cmp r0, r1
ble _08019F74
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _08019F7A
.align 2, 0
_08019F68: .4byte 0xff00ffff
@ -14690,13 +14690,13 @@ _08019F6C: .4byte 0xffff00ff
_08019F70: .4byte gUnknown_203B460
_08019F74:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
_08019F7A:
movs r0, 0x3
b _08019FAA
_08019F7E:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x4
b _08019FAA
_08019F88:
@ -15118,7 +15118,7 @@ _0801A2E0:
b _0801A354
_0801A2E6:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0801A376
_0801A2F0:
@ -15150,7 +15150,7 @@ _0801A2F0:
cmp r0, r1
ble _0801A340
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801A346
.align 2, 0
_0801A334: .4byte 0xff00ffff
@ -15158,13 +15158,13 @@ _0801A338: .4byte 0xffff00ff
_0801A33C: .4byte gUnknown_203B460
_0801A340:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
_0801A346:
movs r0, 0x3
b _0801A376
_0801A34A:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x4
b _0801A376
_0801A354:
@ -15651,7 +15651,7 @@ _0801A728:
.4byte _0801A810
_0801A740:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0801A8A2
_0801A74A:
@ -15724,24 +15724,24 @@ _0801A7AC:
bgt _0801A7F4
_0801A7E2:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801A802
.align 2, 0
_0801A7EC: .4byte gUnknown_203B460
_0801A7F0: .4byte 0x0001869f
_0801A7F4:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801A802
_0801A7FC:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
_0801A802:
movs r0, 0x3
b _0801A8A2
_0801A806:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x4
b _0801A8A2
_0801A810:
@ -15766,7 +15766,7 @@ _0801A810:
beq _0801A85C
_0801A83A:
movs r0, 0x6
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, [r4]
adds r2, r0, 0x4
adds r2, r5
@ -15782,7 +15782,7 @@ _0801A83A:
_0801A858: .4byte gUnknown_203B224
_0801A85C:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801A87C
_0801A864:
ldr r0, _0801A894
@ -15791,7 +15791,7 @@ _0801A864:
cmp r0, 0x2
beq _0801A87C
movs r0, 0x5
bl sub_80119D4
bl PlayMenuSoundEffect
bl sub_801AEF8
bl sub_801A9E0
_0801A87C:
@ -17462,7 +17462,7 @@ _0801B540:
_0801B558: .4byte gUnknown_203B230
_0801B55C:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r1, [r4]
ldr r0, [r1, 0xC]
cmp r0, 0
@ -17478,7 +17478,7 @@ _0801B576:
b _0801B58A
_0801B57E:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
bl sub_801B46C
_0801B58A:
@ -17524,7 +17524,7 @@ _0801B5B8:
_0801B5D0: .4byte gUnknown_203B230
_0801B5D4:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, [r4]
ldr r1, [r0, 0x8]
adds r1, 0x1
@ -17541,7 +17541,7 @@ _0801B5F0:
b _0801B604
_0801B5F8:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
bl sub_801B46C
_0801B604:
@ -19205,17 +19205,17 @@ _0801C340:
b _0801C364
_0801C346:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0801C38A
_0801C350:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _0801C38A
_0801C35A:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x4
b _0801C38A
_0801C364:
@ -19815,7 +19815,7 @@ _0801C7F8:
_0801C810: .4byte gUnknown_203B240
_0801C814:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r1, [r4]
ldr r0, [r1, 0xC]
cmp r0, 0
@ -19831,7 +19831,7 @@ _0801C82E:
b _0801C842
_0801C836:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
bl sub_801C6D0
_0801C842:
@ -19877,7 +19877,7 @@ _0801C870:
_0801C888: .4byte gUnknown_203B240
_0801C88C:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, [r4]
ldr r1, [r0, 0x8]
adds r1, 0x1
@ -19894,7 +19894,7 @@ _0801C8A8:
b _0801C8BC
_0801C8B0:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
bl sub_801C6D0
_0801C8BC:
@ -20096,12 +20096,12 @@ _0801CA50:
.4byte _0801CA7C
_0801CA68:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0801CB1E
_0801CA72:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _0801CB1E
_0801CA7C:
@ -20130,7 +20130,7 @@ _0801CAAC:
beq _0801CAE0
_0801CAB0:
movs r0, 0x6
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, _0801CAD8
ldr r0, [r0]
lsls r1, r5, 2
@ -20151,11 +20151,11 @@ _0801CAD8: .4byte gUnknown_203B244
_0801CADC: .4byte 0x000004b4
_0801CAE0:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801CAF2
_0801CAE8:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x4
b _0801CB1E
_0801CAF2:
@ -21649,108 +21649,4 @@ _0801D67A:
bx r0
thumb_func_end sub_801D4C0
thumb_func_start sub_801D680
sub_801D680:
push {r4,lr}
sub sp, 0x4
movs r0, 0
str r0, [sp]
ldr r4, _0801D6C0
ldr r0, [r4]
adds r0, 0x18
bl sub_8012FD8
lsls r0, 24
cmp r0, 0
bne _0801D6AC
ldr r0, [r4]
adds r0, 0x18
mov r1, sp
bl sub_8013114
ldr r1, [sp]
cmp r1, 0x1
beq _0801D6AC
ldr r0, [r4]
str r1, [r0, 0x14]
_0801D6AC:
ldr r0, [sp]
subs r0, 0x1
cmp r0, 0xA
bhi _0801D756
lsls r0, 2
ldr r1, _0801D6C4
adds r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_0801D6C0: .4byte gUnknown_203B250
_0801D6C4: .4byte _0801D6C8
.align 2, 0
_0801D6C8:
.4byte _0801D750
.4byte _0801D6F4
.4byte _0801D704
.4byte _0801D6FC
.4byte _0801D70C
.4byte _0801D714
.4byte _0801D71C
.4byte _0801D724
.4byte _0801D72C
.4byte _0801D734
.4byte _0801D748
_0801D6F4:
movs r0, 0x3
bl sub_801D208
b _0801D756
_0801D6FC:
movs r0, 0x6
bl sub_801D208
b _0801D756
_0801D704:
movs r0, 0x4
bl sub_801D208
b _0801D756
_0801D70C:
movs r0, 0x7
bl sub_801D208
b _0801D756
_0801D714:
movs r0, 0x8
bl sub_801D208
b _0801D756
_0801D71C:
movs r0, 0x9
bl sub_801D208
b _0801D756
_0801D724:
movs r0, 0xA
bl sub_801D208
b _0801D756
_0801D72C:
movs r0, 0xB
bl sub_801D208
b _0801D756
_0801D734:
ldr r0, _0801D744
ldr r1, [r0]
movs r0, 0x1
strb r0, [r1, 0x9]
movs r0, 0x2
bl sub_801D208
b _0801D756
.align 2, 0
_0801D744: .4byte gUnknown_203B250
_0801D748:
movs r0, 0xC
bl sub_801D208
b _0801D756
_0801D750:
movs r0, 0x2
bl sub_801D208
_0801D756:
add sp, 0x4
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_801D680
.align 2, 0 @ Don't pad with nop.

View File

@ -237,7 +237,7 @@ sub_801DA78:
cmp r0, 0x2
bne _0801DA9C
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0801DAB8
.align 2, 0
@ -1219,12 +1219,12 @@ _0801E22E:
b _0801E294
_0801E238:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0801E2BE
_0801E242:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _0801E2BE
_0801E24C:
@ -1266,7 +1266,7 @@ _0801E28A:
strb r0, [r1, 0x8]
_0801E28C:
movs r0, 0x3
bl sub_80119D4
bl PlayMenuSoundEffect
movs r4, 0x1
_0801E294:
ldr r0, _0801E2B8
@ -1537,17 +1537,17 @@ _0801E4A8:
b _0801E4CC
_0801E4AE:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0801E4EE
_0801E4B8:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _0801E4EE
_0801E4C2:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x4
b _0801E4EE
_0801E4CC:
@ -1814,14 +1814,14 @@ sub_801E6CC:
cmp r0, 0x2
bne _0801E6F6
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0801E70C
.align 2, 0
_0801E6E8: .4byte gUnknown_203B268
_0801E6EC:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _0801E70C
_0801E6F6:
@ -2940,17 +2940,17 @@ _0801EF78:
.4byte _0801F018
_0801EFAC:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0801F18E
_0801EFB6:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _0801F18E
_0801EFC0:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x4
b _0801F18E
_0801EFCA:
@ -2988,7 +2988,7 @@ _0801EFF8:
b _0801F12E
_0801F00C:
movs r0, 0x3
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801F12E
.align 2, 0
_0801F014: .4byte gUnknown_203B270
@ -3014,7 +3014,7 @@ _0801F032:
cmp r4, r0
beq _0801F06C
movs r0, 0x3
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801F182
.align 2, 0
_0801F048: .4byte gUnknown_203B270
@ -3035,7 +3035,7 @@ _0801F04C:
_0801F068: .4byte gUnknown_203B270
_0801F06C:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801F182
_0801F074:
ldr r0, _0801F0C8
@ -3065,7 +3065,7 @@ _0801F074:
ldr r1, [r1, 0x10]
bl sub_8093400
movs r0, 0x6
bl sub_80119D4
bl PlayMenuSoundEffect
movs r7, 0x1
ldr r1, [r5]
ldrb r0, [r1, 0x4]
@ -3107,7 +3107,7 @@ _0801F0FE:
cmp r0, 0
bne _0801F120
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801F12E
.align 2, 0
_0801F10C: .4byte gUnknown_203B270
@ -3121,11 +3121,11 @@ _0801F110:
beq _0801F128
_0801F120:
movs r0, 0x6
bl sub_80119D4
bl PlayMenuSoundEffect
b _0801F182
_0801F128:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
_0801F12E:
cmp r7, 0
bne _0801F182
@ -3673,17 +3673,17 @@ _0801F560:
b _0801F584
_0801F566:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0801F5AE
_0801F570:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _0801F5AE
_0801F57A:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x4
b _0801F5AE
_0801F584:
@ -4348,7 +4348,7 @@ _0801FA7C:
_0801FAA4: .4byte gUnknown_203B278
_0801FAA8:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r1, [r4]
ldr r0, [r1, 0x10]
cmp r0, 0
@ -4362,7 +4362,7 @@ _0801FABE:
b _0801FACA
_0801FAC2:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
_0801FACA:
bl sub_801F918
@ -4409,7 +4409,7 @@ _0801FAFC:
_0801FB14: .4byte gUnknown_203B278
_0801FB18:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, [r4]
ldr r1, [r0, 0xC]
adds r1, 0x1
@ -4426,7 +4426,7 @@ _0801FB34:
b _0801FB48
_0801FB3C:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
bl sub_801F918
_0801FB48:
@ -6909,7 +6909,7 @@ _08020F60: .4byte gUnknown_203B27C
_08020F64: .4byte 0x00000133
_08020F68:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _08021068
_08020F70:
ldr r0, _08020F84
@ -6940,7 +6940,7 @@ _08020FA8: .4byte gUnknown_203B27C
_08020FAC: .4byte 0x00000133
_08020FB0:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _08021068
_08020FB8:
ldr r0, _08020FD8
@ -6952,7 +6952,7 @@ _08020FB8:
cmp r0, 0x95
bgt _08020FDC
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
bl sub_801FDA8
b _080210BE
@ -6968,7 +6968,7 @@ _08020FDC:
cmp r0, 0
bne _08021000
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x4
bl sub_801FDA8
b _080210BE
@ -7008,7 +7008,7 @@ _08021034:
cmp r0, 0
bne _08021058
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x5
bl sub_801FDA8
b _080210BE
@ -7037,7 +7037,7 @@ _08021074:
cmp r0, 0
bne _08021098
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x6
bl sub_801FDA8
b _080210BE
@ -7319,7 +7319,7 @@ _080212AC:
b _08021300
_080212B2:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _08021326
_080212BC:
@ -7340,19 +7340,19 @@ _080212BC:
cmp r0, r1
ble _080212EC
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _080212F2
.align 2, 0
_080212E8: .4byte gUnknown_203B460
_080212EC:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
_080212F2:
movs r0, 0x3
b _08021326
_080212F6:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x4
b _08021326
_08021300:
@ -8001,14 +8001,14 @@ sub_80217EC:
cmp r0, 0x2
bne _0802181A
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0802181C
.align 2, 0
_0802180C: .4byte gUnknown_203B28C
_08021810:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _0802181C
_0802181A:
@ -11339,17 +11339,17 @@ _080232B8:
b _080232EC
_080232BE:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _08023316
_080232C8:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _08023316
_080232D2:
movs r0, 0x5
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, [r4]
ldr r1, [r0, 0x4]
movs r2, 0x1
@ -12367,22 +12367,22 @@ _08023AD4:
b _08023B16
_08023ADE:
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _08023B3E
_08023AE8:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x4
b _08023B3E
_08023AF2:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _08023B3E
_08023AFC:
movs r0, 0x5
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, [r4]
ldr r1, [r0, 0x4]
movs r2, 0x1
@ -13710,14 +13710,14 @@ sub_80244E4:
cmp r0, 0x2
bne _0802450E
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _08024524
.align 2, 0
_08024500: .4byte gUnknown_203B2AC
_08024504:
movs r0, 0
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x3
b _08024524
_0802450E:
@ -15148,7 +15148,7 @@ _080250A0: .4byte gUnknown_203B2B0
_080250A4: .4byte gUnknown_203B460
_080250A8:
movs r0, 0x2
bl sub_80119D4
bl PlayMenuSoundEffect
b _080250E6
_080250B0:
bl sub_801A8AC

View File

@ -118,7 +118,7 @@ sub_803B120:
cmp r0, 0x2
bne _0803B144
movs r0, 0x1
bl sub_80119D4
bl PlayMenuSoundEffect
movs r0, 0x2
b _0803B160
.align 2, 0
@ -1206,8 +1206,8 @@ _0803B968:
bx r0
thumb_func_end sub_803B6D4
thumb_func_start sub_803B98C
sub_803B98C:
thumb_func_start CreateRescueDescription
CreateRescueDescription:
push {r4-r7,lr}
mov r7, r9
mov r6, r8
@ -2055,7 +2055,7 @@ _0803C0C6:
.align 2, 0
_0803C0D4: .4byte gUnknown_80E8C48
_0803C0D8: .4byte gUnknown_80E8B7C
thumb_func_end sub_803B98C
thumb_func_end CreateRescueDescription
thumb_func_start sub_803C0DC
sub_803C0DC:

View File

@ -5,204 +5,6 @@
.text
thumb_func_start sub_808EBA8
sub_808EBA8:
push {r4-r7,lr}
mov r7, r8
push {r7}
adds r7, r0, 0
mov r8, r1
movs r6, 0
movs r5, 0x1
_0808EBB6:
lsls r0, r5, 24
lsrs r4, r0, 24
mov r0, r8
adds r1, r4, 0
bl sub_808EB7C
lsls r0, 24
cmp r0, 0
beq _0808EBCE
adds r0, r7, r6
strb r4, [r0]
adds r6, 0x1
_0808EBCE:
adds r5, 0x1
cmp r5, 0x17
ble _0808EBB6
adds r1, r6, 0
cmp r6, 0x17
bgt _0808EBE6
movs r2, 0
_0808EBDC:
adds r0, r7, r1
strb r2, [r0]
adds r1, 0x1
cmp r1, 0x17
ble _0808EBDC
_0808EBE6:
adds r0, r6, 0
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_808EBA8
thumb_func_start sub_808EBF4
sub_808EBF4:
push {r4-r6,lr}
adds r4, r0, 0
adds r6, r1, 0
movs r5, 0x1
lsls r5, r6
adds r1, r5, 0
bl sub_808ECD0
lsls r0, 24
cmp r0, 0
beq _0808EC22
ldrb r0, [r4]
bics r0, r5
strb r0, [r4]
asrs r1, r5, 8
ldrb r0, [r4, 0x1]
bics r0, r1
strb r0, [r4, 0x1]
asrs r1, r5, 16
ldrb r0, [r4, 0x2]
bics r0, r1
strb r0, [r4, 0x2]
b _0808EC2A
_0808EC22:
adds r0, r4, 0
adds r1, r6, 0
bl sub_808EC30
_0808EC2A:
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_808EBF4
thumb_func_start sub_808EC30
sub_808EC30:
push {r4-r7,lr}
adds r3, r0, 0
adds r7, r1, 0
movs r4, 0
ldr r1, _0808EC90
lsls r0, r7, 2
adds r0, r1
ldr r6, [r0]
adds r5, r1, 0
movs r0, 0x1
mov r12, r0
_0808EC46:
ldr r0, [r5]
cmp r6, r0
bne _0808EC66
mov r1, r12
lsls r1, r4
ldrb r0, [r3]
bics r0, r1
strb r0, [r3]
asrs r2, r1, 8
ldrb r0, [r3, 0x1]
bics r0, r2
strb r0, [r3, 0x1]
asrs r1, 16
ldrb r0, [r3, 0x2]
bics r0, r1
strb r0, [r3, 0x2]
_0808EC66:
adds r5, 0x4
adds r4, 0x1
cmp r4, 0x17
ble _0808EC46
movs r1, 0x1
lsls r1, r7
ldrb r2, [r3]
adds r0, r1, 0
orrs r0, r2
strb r0, [r3]
asrs r0, r1, 8
ldrb r2, [r3, 0x1]
orrs r0, r2
strb r0, [r3, 0x1]
asrs r1, 16
ldrb r0, [r3, 0x2]
orrs r1, r0
strb r1, [r3, 0x2]
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_0808EC90: .4byte gUnknown_81076E4
thumb_func_end sub_808EC30
thumb_func_start sub_808EC94
sub_808EC94:
push {r4,r5,lr}
adds r5, r0, 0
lsls r4, r1, 24
lsrs r4, 24
movs r0, 0
strb r0, [r5]
strb r0, [r5, 0x1]
strb r0, [r5, 0x2]
adds r0, r5, 0
movs r1, 0x2
bl sub_808EC30
adds r0, r5, 0
movs r1, 0x3
bl sub_808EC30
adds r0, r5, 0
movs r1, 0x16
bl sub_808EC30
cmp r4, 0
beq _0808ECC8
adds r0, r5, 0
movs r1, 0x12
bl sub_808EC30
_0808ECC8:
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_808EC94
thumb_func_start sub_808ECD0
sub_808ECD0:
push {lr}
adds r2, r0, 0
adds r3, r1, 0
ldrb r0, [r2]
ands r0, r3
cmp r0, 0
bne _0808ECF6
ldrb r0, [r2, 0x1]
lsrs r1, r3, 8
ands r0, r1
cmp r0, 0
bne _0808ECF6
ldrb r0, [r2, 0x2]
lsrs r1, r3, 16
ands r0, r1
cmp r0, 0
bne _0808ECF6
movs r0, 0
b _0808ECF8
_0808ECF6:
movs r0, 0x1
_0808ECF8:
pop {r1}
bx r1
thumb_func_end sub_808ECD0
thumb_func_start sub_808ECFC
sub_808ECFC:
movs r0, 0
bx lr
thumb_func_end sub_808ECFC
thumb_func_start sub_808ED00
sub_808ED00:
push {r4-r7,lr}

View File

@ -1077,8 +1077,8 @@ _0809098C:
_08090994: .4byte gUnknown_810A350
thumb_func_end sub_809095C
thumb_func_start sub_8090998
sub_8090998:
thumb_func_start LoadItemParameters
LoadItemParameters:
push {lr}
ldr r1, _080909B8
ldr r0, _080909BC
@ -1100,7 +1100,7 @@ _080909C0: .4byte gUnknown_8109764
_080909C4: .4byte gSystemFileArchive
_080909C8: .4byte gItemParametersFile
_080909CC: .4byte gItemParametersFile + 4
thumb_func_end sub_8090998
thumb_func_end LoadItemParameters
thumb_func_start sub_80909D0
sub_80909D0:
@ -4238,467 +4238,4 @@ _08092038: .4byte gUnknown_203B460
_0809203C: .4byte gUnknown_203B45C
thumb_func_end sub_8091FB4
thumb_func_start sub_8092040
sub_8092040:
push {r4,lr}
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0xEF
bls _0809204E
_0809204A:
movs r0, 0x1
b _08092070
_0809204E:
movs r2, 0
ldr r0, _08092078
ldrb r1, [r0]
adds r4, r0, 0
cmp r1, 0xF0
beq _0809206E
adds r1, r4, 0
_0809205C:
adds r0, r2, r1
ldrb r0, [r0]
cmp r0, r3
beq _0809204A
adds r2, 0x1
adds r0, r2, r4
ldrb r0, [r0]
cmp r0, 0xF0
bne _0809205C
_0809206E:
movs r0, 0
_08092070:
pop {r4}
pop {r1}
bx r1
.align 2, 0
_08092078: .4byte gUnknown_810A35B
thumb_func_end sub_8092040
thumb_func_start sub_809207C
sub_809207C:
ldr r1, _08092084
ldr r0, _08092088
str r0, [r1]
bx lr
.align 2, 0
_08092084: .4byte gUnknown_203B464
_08092088: .4byte gUnknown_2038C10
thumb_func_end sub_809207C
thumb_func_start sub_809208C
sub_809208C:
ldr r0, _08092090
bx lr
.align 2, 0
_08092090: .4byte gUnknown_2038C10
thumb_func_end sub_809208C
thumb_func_start sub_8092094
sub_8092094:
push {r4,lr}
ldr r4, _080920B0
ldr r0, [r4]
ldr r1, _080920B4
movs r2, 0xA
bl BoundedCopyStringtoBuffer
ldr r1, [r4]
movs r0, 0
str r0, [r1, 0xC]
strb r0, [r1, 0x10]
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080920B0: .4byte gUnknown_203B464
_080920B4: .4byte gUnknown_810982C
thumb_func_end sub_8092094
thumb_func_start sub_80920B8
sub_80920B8:
push {lr}
adds r2, r0, 0
movs r1, 0
ldr r0, _080920D4
ldr r3, [r0]
_080920C2:
adds r0, r3, r1
ldrb r0, [r0]
strb r0, [r2]
adds r2, 0x1
adds r1, 0x1
cmp r1, 0x9
ble _080920C2
pop {r0}
bx r0
.align 2, 0
_080920D4: .4byte gUnknown_203B464
thumb_func_end sub_80920B8
thumb_func_start sub_80920D8
sub_80920D8:
push {lr}
ldr r1, _080920E8
ldr r1, [r1]
movs r2, 0xA
bl sub_80922B4
pop {r0}
bx r0
.align 2, 0
_080920E8: .4byte gUnknown_203B464
thumb_func_end sub_80920D8
thumb_func_start sub_80920EC
sub_80920EC:
push {r4,lr}
adds r3, r0, 0
movs r2, 0
ldr r4, _0809210C
_080920F4:
ldr r0, [r4]
adds r0, r2
ldrb r1, [r3]
strb r1, [r0]
adds r3, 0x1
adds r2, 0x1
cmp r2, 0x9
ble _080920F4
pop {r4}
pop {r0}
bx r0
.align 2, 0
_0809210C: .4byte gUnknown_203B464
thumb_func_end sub_80920EC
thumb_func_start sub_8092110
sub_8092110:
ldr r0, _08092118
ldr r0, [r0]
ldr r0, [r0, 0xC]
bx lr
.align 2, 0
_08092118: .4byte gUnknown_203B464
thumb_func_end sub_8092110
thumb_func_start sub_809211C
sub_809211C:
push {lr}
bl sub_8092178
lsls r0, 24
lsrs r0, 24
cmp r0, 0x6
beq _08092144
ldr r1, _0809213C
lsls r0, 2
adds r0, r1
ldr r1, _08092140
ldr r1, [r1]
ldr r0, [r0]
ldr r1, [r1, 0xC]
subs r0, r1
b _08092146
.align 2, 0
_0809213C: .4byte gUnknown_8109810
_08092140: .4byte gUnknown_203B464
_08092144:
movs r0, 0
_08092146:
pop {r1}
bx r1
thumb_func_end sub_809211C
thumb_func_start sub_809214C
sub_809214C:
ldr r1, _08092154
ldr r1, [r1]
str r0, [r1, 0xC]
bx lr
.align 2, 0
_08092154: .4byte gUnknown_203B464
thumb_func_end sub_809214C
thumb_func_start sub_8092158
sub_8092158:
push {lr}
ldr r1, _08092170
ldr r2, [r1]
ldr r1, [r2, 0xC]
adds r1, r0
str r1, [r2, 0xC]
ldr r0, _08092174
cmp r1, r0
ble _0809216C
str r0, [r2, 0xC]
_0809216C:
pop {r0}
bx r0
.align 2, 0
_08092170: .4byte gUnknown_203B464
_08092174: .4byte 0x05f5e0ff
thumb_func_end sub_8092158
thumb_func_start sub_8092178
sub_8092178:
push {lr}
movs r1, 0
ldr r0, _08092190
ldr r0, [r0]
ldr r3, [r0, 0xC]
ldr r2, _08092194
_08092184:
ldr r0, [r2]
cmp r3, r0
bge _08092198
lsls r0, r1, 24
lsrs r0, 24
b _080921A2
.align 2, 0
_08092190: .4byte gUnknown_203B464
_08092194: .4byte gUnknown_8109810
_08092198:
adds r2, 0x4
adds r1, 0x1
cmp r1, 0x6
ble _08092184
movs r0, 0x6
_080921A2:
pop {r1}
bx r1
thumb_func_end sub_8092178
thumb_func_start GetTeamRankString
GetTeamRankString:
lsls r0, 24
ldr r1, _080921B4
lsrs r0, 22
adds r0, r1
ldr r0, [r0]
bx lr
.align 2, 0
_080921B4: .4byte gRescueTeamRanks
thumb_func_end GetTeamRankString
thumb_func_start sub_80921B8
sub_80921B8:
ldr r0, _080921C0
ldr r0, [r0]
ldrb r0, [r0, 0x10]
bx lr
.align 2, 0
_080921C0: .4byte gUnknown_203B464
thumb_func_end sub_80921B8
thumb_func_start sub_80921C4
sub_80921C4:
push {r4-r6,lr}
sub sp, 0x14
adds r3, r0, 0
adds r2, r1, 0
add r6, sp, 0x10
movs r0, 0xFF
strb r0, [r6]
mov r5, sp
adds r5, 0x11
movs r0, 0
strb r0, [r5]
mov r0, sp
adds r1, r3, 0
bl sub_809486C
ldr r4, _08092228
ldr r1, [r4]
mov r0, sp
movs r2, 0x58
bl sub_809488C
ldr r1, [r4]
adds r1, 0xC
mov r0, sp
movs r2, 0x20
bl sub_809488C
movs r0, 0
bl sub_80023E4
ldr r1, [r4]
strb r0, [r1, 0x10]
ldr r0, [r4]
ldrb r0, [r0, 0x10]
adds r1, r5, 0
cmp r0, 0
beq _08092210
adds r1, r6, 0
_08092210:
mov r0, sp
movs r2, 0x1
bl sub_809488C
mov r0, sp
bl nullsub_102
ldr r0, [sp, 0x8]
add sp, 0x14
pop {r4-r6}
pop {r1}
bx r1
.align 2, 0
_08092228: .4byte gUnknown_203B464
thumb_func_end sub_80921C4
thumb_func_start sub_809222C
sub_809222C:
push {r4,r5,lr}
sub sp, 0x14
adds r3, r0, 0
adds r2, r1, 0
mov r0, sp
adds r1, r3, 0
bl sub_809485C
ldr r5, _0809227C
ldr r1, [r5]
mov r0, sp
movs r2, 0x58
bl sub_8094924
ldr r1, [r5]
adds r1, 0xC
mov r0, sp
movs r2, 0x20
bl sub_8094924
add r4, sp, 0x10
mov r0, sp
adds r1, r4, 0
movs r2, 0x1
bl sub_8094924
ldr r2, [r5]
ldrb r1, [r4]
movs r0, 0x1
ands r0, r1
strb r0, [r2, 0x10]
mov r0, sp
bl nullsub_102
ldr r0, [sp, 0x8]
add sp, 0x14
pop {r4,r5}
pop {r1}
bx r1
.align 2, 0
_0809227C: .4byte gUnknown_203B464
thumb_func_end sub_809222C
thumb_func_start ReturnIntFromChar
ReturnIntFromChar:
lsls r0, 24
lsrs r0, 24
bx lr
thumb_func_end ReturnIntFromChar
thumb_func_start ReturnIntFromChar2
ReturnIntFromChar2:
lsls r0, 24
lsrs r0, 24
bx lr
thumb_func_end ReturnIntFromChar2
thumb_func_start sub_8092290
sub_8092290:
push {r4,r5,lr}
adds r5, r0, 0
adds r4, r1, 0
b _080922A4
_08092298:
ldrb r0, [r4]
adds r4, 0x1
bl ReturnIntFromChar2
strb r0, [r5]
adds r5, 0x1
_080922A4:
ldrb r0, [r4]
cmp r0, 0
bne _08092298
movs r0, 0
strb r0, [r5]
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_8092290
thumb_func_start sub_80922B4
sub_80922B4:
push {r4-r6,lr}
adds r6, r0, 0
adds r4, r1, 0
adds r5, r2, 0
b _080922CA
_080922BE:
ldrb r0, [r4]
adds r4, 0x1
bl ReturnIntFromChar2
strb r0, [r6]
adds r6, 0x1
_080922CA:
adds r0, r5, 0
subs r5, 0x1
cmp r0, 0
ble _080922D8
ldrb r0, [r4]
cmp r0, 0
bne _080922BE
_080922D8:
movs r0, 0
strb r0, [r6]
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_80922B4
thumb_func_start sub_80922E4
sub_80922E4:
ldr r1, _080922F0
lsls r0, 2
adds r0, r1
ldr r0, [r0]
bx lr
.align 2, 0
_080922F0: .4byte gUnknown_810983C
thumb_func_end sub_80922E4
thumb_func_start CopyStringtoBuffer
CopyStringtoBuffer:
push {lr}
adds r2, r0, 0
b _08092300
_080922FA:
strb r0, [r2]
adds r1, 0x1
adds r2, 0x1
_08092300:
ldrb r0, [r1]
cmp r0, 0
bne _080922FA
movs r0, 0
strb r0, [r2]
pop {r0}
bx r0
thumb_func_end CopyStringtoBuffer
thumb_func_start BoundedCopyStringtoBuffer
BoundedCopyStringtoBuffer:
push {r4,lr}
adds r4, r0, 0
b _0809231C
_08092316:
strb r0, [r4]
adds r4, 0x1
adds r1, 0x1
_0809231C:
adds r0, r2, 0
subs r2, 0x1
cmp r0, 0
ble _0809232E
ldrb r0, [r1]
adds r3, r0, 0
cmp r3, 0
bne _08092316
strb r3, [r4]
_0809232E:
pop {r4}
pop {r0}
bx r0
thumb_func_end BoundedCopyStringtoBuffer
.align 2, 0 @ Don't pad with nop.

63
asm/code_80983D8.s Normal file
View File

@ -0,0 +1,63 @@
.include "constants/gba_constants.inc"
.include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_80983D8
sub_80983D8:
push {r4,lr}
movs r2, 0
ldrsh r3, [r1, r2]
movs r4, 0
ldrsh r2, [r0, r4]
subs r2, r3, r2
movs r3, 0x2
ldrsh r1, [r1, r3]
movs r4, 0x2
ldrsh r0, [r0, r4]
subs r1, r0
cmp r2, 0
bne _080983FA
cmp r1, 0
bne _080983FA
movs r0, 0
b _08098428
_080983FA:
cmp r2, 0
ble _08098400
movs r2, 0x1
_08098400:
cmp r1, 0
ble _08098406
movs r1, 0x1
_08098406:
movs r0, 0x1
negs r0, r0
cmp r2, r0
bgt _08098410
adds r2, r0, 0
_08098410:
cmp r1, r0
bgt _08098416
adds r1, r0, 0
_08098416:
ldr r3, _08098430
adds r2, 0x1
adds r1, 0x1
lsls r0, r1, 1
adds r0, r1
adds r0, r2
lsls r0, 2
adds r0, r3
ldr r0, [r0]
_08098428:
pop {r4}
pop {r1}
bx r1
.align 2, 0
_08098430: .4byte gUnknown_8115E94
thumb_func_end sub_80983D8
.align 2,0

View File

@ -5351,7 +5351,7 @@ _0809B91C:
_0809B932:
str r1, [r0]
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
b _0809B784
.align 2, 0
_0809B93C: .4byte 0x0000042c
@ -5392,7 +5392,7 @@ _0809B988: .4byte 0x0000042c
_0809B98C: .4byte gUnknown_811610C
_0809B990:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
b _0809B784
_0809B998:
bl sub_801516C
@ -5451,7 +5451,7 @@ _0809BA0C: .4byte 0x0000042c
_0809BA10: .4byte gUnknown_811612C
_0809BA14:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
b _0809B784
_0809BA1C:
bl sub_801516C
@ -5487,7 +5487,7 @@ _0809BA2A:
_0809BA5C: .4byte 0x00000424
_0809BA60:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
b _0809B784
_0809BA68:
movs r0, 0x1
@ -5564,7 +5564,7 @@ _0809BAEA:
bl sub_80018D8
_0809BB08:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
b _0809B784
_0809BB10:
movs r0, 0x1
@ -5627,7 +5627,7 @@ _0809BB66:
b _0809B978
_0809BB92:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
b _0809B784
_0809BB9A:
movs r0, 0x1
@ -5990,7 +5990,7 @@ _0809BE94: .4byte gUnknown_3001B64
_0809BE98: .4byte gUnknown_8116258
_0809BE9C:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, _0809BEB0
ldr r0, [r0]
movs r2, 0x83
@ -6003,7 +6003,7 @@ _0809BEB0: .4byte gUnknown_3001B64
_0809BEB4: .4byte gUnknown_8116268
_0809BEB8:
movs r0, 0x4
bl sub_80119D4
bl PlayMenuSoundEffect
ldr r0, _0809BECC
ldr r0, [r0]
movs r3, 0x83

View File

@ -5,230 +5,6 @@
.text
thumb_func_start CreateDebugMenu
CreateDebugMenu:
push {r4-r7,lr}
mov r7, r8
push {r7}
ldr r5, _0803A270
ldr r0, [r5]
cmp r0, 0
bne _0803A224
movs r4, 0xD2
lsls r4, 1
adds r0, r4, 0
movs r1, 0x8
bl MemoryAlloc
str r0, [r5]
movs r1, 0
adds r2, r4, 0
bl MemoryFill8
_0803A224:
mov r12, r5
movs r0, 0xA0
lsls r0, 1
mov r8, r0
ldr r4, _0803A274
movs r3, 0
movs r2, 0x3
_0803A232:
mov r5, r12
ldr r1, [r5]
adds r1, r3
add r1, r8
adds r0, r4, 0
ldm r0!, {r5-r7}
stm r1!, {r5-r7}
ldm r0!, {r5-r7}
stm r1!, {r5-r7}
adds r3, 0x18
subs r2, 0x1
cmp r2, 0
bge _0803A232
bl ResetUnusedInputStruct
ldr r0, _0803A270
ldr r0, [r0]
movs r6, 0xA0
lsls r6, 1
adds r0, r6
movs r1, 0x1
movs r2, 0x1
bl sub_800641C
bl SetDebugMenuItems
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_0803A270: .4byte gUnknown_203B3EC
_0803A274: .4byte gUnknown_80E7D40
thumb_func_end CreateDebugMenu
thumb_func_start DeleteDebugMenu
DeleteDebugMenu:
push {r4,lr}
bl ResetUnusedInputStruct
movs r0, 0
movs r1, 0x1
movs r2, 0x1
bl sub_800641C
ldr r4, _0803A2A0
ldr r0, [r4]
cmp r0, 0
beq _0803A298
bl MemoryFree
movs r0, 0
str r0, [r4]
_0803A298:
pop {r4}
pop {r0}
bx r0
.align 2, 0
_0803A2A0: .4byte gUnknown_203B3EC
thumb_func_end DeleteDebugMenu
thumb_func_start sub_803A2A4
sub_803A2A4:
push {r4,r5,lr}
sub sp, 0x4
ldr r4, _0803A2D4
movs r0, 0xB
str r0, [sp]
ldr r5, _0803A2D8
ldr r0, [r5]
bl sub_8012FD8
lsls r0, 24
cmp r0, 0
bne _0803A2C4
ldr r0, [r5]
mov r1, sp
bl sub_8013114
_0803A2C4:
ldr r0, [sp]
cmp r0, 0xB
bhi _0803A34E
lsls r0, 2
ldr r1, _0803A2DC
adds r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_0803A2D4: .4byte 0x0000ffdc
_0803A2D8: .4byte gUnknown_203B3EC
_0803A2DC: .4byte _0803A2E0
.align 2, 0
_0803A2E0:
.4byte _0803A310
.4byte _0803A314
.4byte _0803A318
.4byte _0803A31C
.4byte _0803A320
.4byte _0803A324
.4byte _0803A328
.4byte _0803A34E
.4byte _0803A34E
.4byte _0803A330
.4byte _0803A344
.4byte _0803A34C
_0803A310:
movs r4, 0x2F
b _0803A34E
_0803A314:
movs r4, 0x30
b _0803A34E
_0803A318:
movs r4, 0x31
b _0803A34E
_0803A31C:
movs r4, 0x32
b _0803A34E
_0803A320:
movs r4, 0x33
b _0803A34E
_0803A324:
movs r4, 0x34
b _0803A34E
_0803A328:
bl sub_803A3BC
movs r4, 0x1
b _0803A34E
_0803A330:
movs r4, 0
_0803A332:
lsls r0, r4, 24
lsrs r0, 24
bl sub_80976F8
adds r4, 0x1
cmp r4, 0x1F
ble _0803A332
movs r4, 0x1
b _0803A34E
_0803A344:
bl sub_803A3A0
movs r4, 0x1
b _0803A34E
_0803A34C:
ldr r4, _0803A358
_0803A34E:
adds r0, r4, 0
add sp, 0x4
pop {r4,r5}
pop {r1}
bx r1
.align 2, 0
_0803A358: .4byte 0x0000ffdc
thumb_func_end sub_803A2A4
thumb_func_start SetDebugMenuItems
SetDebugMenuItems:
push {r4,lr}
sub sp, 0x10
ldr r4, _0803A394
ldr r0, [r4]
movs r2, 0xA0
lsls r2, 1
adds r1, r0, r2
ldr r3, _0803A398
ldr r2, _0803A39C
str r2, [sp]
movs r2, 0x1
str r2, [sp, 0x4]
movs r2, 0xD
str r2, [sp, 0x8]
movs r2, 0
str r2, [sp, 0xC]
bl SetMenuItems
ldr r0, [r4]
movs r1, 0
movs r2, 0x1
bl sub_8035CF4
add sp, 0x10
pop {r4}
pop {r0}
bx r0
.align 2, 0
_0803A394: .4byte gUnknown_203B3EC
_0803A398: .4byte gUnknown_80E7D58
_0803A39C: .4byte gDebugMenuItems
thumb_func_end SetDebugMenuItems
thumb_func_start sub_803A3A0
sub_803A3A0:
push {lr}
ldr r0, _0803A3B8
ldr r0, [r0]
movs r1, 0xA0
lsls r1, 1
adds r0, r1
movs r1, 0
bl sub_8035CC0
pop {r0}
bx r0
.align 2, 0
_0803A3B8: .4byte gUnknown_203B3EC
thumb_func_end sub_803A3A0
thumb_func_start sub_803A3BC
sub_803A3BC:
push {r4-r7,lr}
@ -1734,111 +1510,4 @@ _0803AF82:
bx r0
thumb_func_end sub_803AF38
thumb_func_start sub_803AF88
sub_803AF88:
push {r4,lr}
sub sp, 0x4
movs r0, 0
str r0, [sp]
bl sub_8023A94
ldr r4, _0803AFC0
ldr r0, [r4]
adds r0, 0x10
bl sub_8012FD8
lsls r0, 24
cmp r0, 0
bne _0803AFAE
ldr r0, [r4]
adds r0, 0x10
mov r1, sp
bl sub_8013114
_0803AFAE:
ldr r0, [sp]
cmp r0, 0x4
beq _0803AFCA
cmp r0, 0x4
bgt _0803AFC4
cmp r0, 0x1
beq _0803AFDA
b _0803AFE0
.align 2, 0
_0803AFC0: .4byte gUnknown_203B3F8
_0803AFC4:
cmp r0, 0x5
beq _0803AFD2
b _0803AFE0
_0803AFCA:
movs r0, 0x5
bl sub_803ACD0
b _0803AFE0
_0803AFD2:
movs r0, 0x6
bl sub_803ACD0
b _0803AFE0
_0803AFDA:
movs r0, 0x2
bl sub_803ACD0
_0803AFE0:
add sp, 0x4
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_803AF88
thumb_func_start sub_803AFE8
sub_803AFE8:
push {r4,lr}
movs r0, 0
bl sub_8023A94
ldr r4, _0803B010
ldr r0, [r4]
adds r0, 0x10
bl sub_8012FD8
ldr r0, [r4]
adds r0, 0x60
bl sub_8013BBC
cmp r0, 0x2
beq _0803B020
cmp r0, 0x2
bhi _0803B014
cmp r0, 0x1
beq _0803B028
b _0803B02C
.align 2, 0
_0803B010: .4byte gUnknown_203B3F8
_0803B014:
cmp r0, 0x3
bne _0803B02C
ldr r0, [r4]
ldr r1, [r0, 0x8]
ldr r0, [r0, 0x60]
strb r0, [r1, 0x3]
_0803B020:
movs r0, 0x2
bl sub_803ACD0
b _0803B02C
_0803B028:
bl sub_803AE58
_0803B02C:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_803AFE8
thumb_func_start sub_803B034
sub_803B034:
push {lr}
bl sub_8016080
cmp r0, 0x3
bhi _0803B04C
cmp r0, 0x2
bcc _0803B04C
bl sub_80160D8
movs r0, 0x2
bl sub_803ACD0
_0803B04C:
pop {r0}
bx r0
thumb_func_end sub_803B034
.align 2,0

View File

@ -2453,40 +2453,4 @@ _0800268E:
bx r1
thumb_func_end sub_8002658
thumb_func_start sub_8002694
sub_8002694:
push {r4,lr}
lsls r0, 24
lsrs r3, r0, 24
ldr r1, _080026B4
movs r2, 0
ldrsh r0, [r1, r2]
movs r2, 0x1
negs r2, r2
cmp r0, r2
beq _080026C2
_080026A8:
ldrb r0, [r1, 0x2]
cmp r0, r3
bne _080026B8
movs r4, 0
ldrsh r0, [r1, r4]
b _080026C6
.align 2, 0
_080026B4: .4byte gUnknown_80B71E4
_080026B8:
adds r1, 0x4
movs r4, 0
ldrsh r0, [r1, r4]
cmp r0, r2
bne _080026A8
_080026C2:
movs r0, 0x1
negs r0, r0
_080026C6:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8002694
.align 2, 0 @ Don't pad with nop.

View File

@ -602,91 +602,5 @@ _080983D0: .4byte gUnknown_203B498
_080983D4: .4byte 0x000001a7
thumb_func_end sub_8098308
thumb_func_start sub_80983D8
sub_80983D8:
push {r4,lr}
movs r2, 0
ldrsh r3, [r1, r2]
movs r4, 0
ldrsh r2, [r0, r4]
subs r2, r3, r2
movs r3, 0x2
ldrsh r1, [r1, r3]
movs r4, 0x2
ldrsh r0, [r0, r4]
subs r1, r0
cmp r2, 0
bne _080983FA
cmp r1, 0
bne _080983FA
movs r0, 0
b _08098428
_080983FA:
cmp r2, 0
ble _08098400
movs r2, 0x1
_08098400:
cmp r1, 0
ble _08098406
movs r1, 0x1
_08098406:
movs r0, 0x1
negs r0, r0
cmp r2, r0
bgt _08098410
adds r2, r0, 0
_08098410:
cmp r1, r0
bgt _08098416
adds r1, r0, 0
_08098416:
ldr r3, _08098430
adds r2, 0x1
adds r1, 0x1
lsls r0, r1, 1
adds r0, r1
adds r0, r2
lsls r0, 2
adds r0, r3
ldr r0, [r0]
_08098428:
pop {r4}
pop {r1}
bx r1
.align 2, 0
_08098430: .4byte gUnknown_8115E94
thumb_func_end sub_80983D8
thumb_func_start sub_8098434
sub_8098434:
push {r4,lr}
adds r3, r0, 0
adds r4, r1, 0
movs r0, 0
ldrsh r1, [r3, r0]
movs r2, 0
ldrsh r0, [r4, r2]
subs r2, r1, r0
cmp r2, 0
bge _0809844A
negs r2, r2
_0809844A:
movs r0, 0x2
ldrsh r1, [r3, r0]
movs r3, 0x2
ldrsh r0, [r4, r3]
subs r0, r1, r0
cmp r0, 0
bge _0809845A
negs r0, r0
_0809845A:
cmp r0, r2
bge _08098460
adds r0, r2, 0
_08098460:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8098434
.align 2,0

5206
asm/friend_rescue.s Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

7318
asm/main_menu_1.s Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1163
asm/wonder_mail_main_menu.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2691,7 +2691,19 @@ gUnknown_80DD704: @ 80DD704
.global gUnknown_80DD71C
gUnknown_80DD71C: @ 80DD71C
.incbin "baserom.gba", 0xDD71C, 0x30
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x14, 0x00, 0x04, 0x00
.byte 0x06, 0x00, 0x03, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x16, 0x00, 0x04, 0x00
.byte 0x06, 0x00, 0x03, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_80DD74C
gUnknown_80DD74C: @ 80DD74C
@ -2910,15 +2922,52 @@ gUnknown_80DDACC: @ 80DDACC
.global gUnknown_80DDAE4
gUnknown_80DDAE4: @ 80DDAE4
.incbin "baserom.gba", 0xDDAE4, 0x18
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x16, 0x00, 0x06, 0x00
.byte 0x06, 0x00, 0x04, 0x00
.byte 0x04, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_80DDAFC
gUnknown_80DDAFC: @ 80DDAFC
.incbin "baserom.gba", 0xDDAFC, 0x28
.4byte Confirm_80DDB1C
.byte 0xB, 0x00, 0x00, 0x00
.4byte Info_80DDB14
.byte 0xC, 0x00, 0x00, 0x00
.byte 0x0, 0x00, 0x00, 0x00
.byte 0xA, 0x00, 0x00, 0x00
.global Info_80DDB14
Info_80DDB14:
.string "Info\0"
.align 2,0
.global Confirm_80DDB1C
Confirm_80DDB1C:
.string "Confirm\0"
.align 2,0
.global gUnknown_80DDB24
gUnknown_80DDB24: @ 80DDB24
.incbin "baserom.gba", 0xDDB24, 0x3C
.4byte GameLinkCable_80DDB50
.byte 0xD, 0x00, 0x00, 0x00
.4byte Password_80DDB44
.byte 0xF, 0x00, 0x00, 0x00
.4byte gWonderMailCancel
.byte 0xA, 0x00, 0x00, 0x00
.byte 0x0, 0x00, 0x00, 0x00
.byte 0xA, 0x00, 0x00, 0x00
.global Password_80DDB44
Password_80DDB44:
.string "Password\0"
.align 2,0
.global GameLinkCable_80DDB50
GameLinkCable_80DDB50:
.string "Game Link cable\0"
.align 2,0
.global gUnknown_80DDB60
gUnknown_80DDB60: @ 80DDB60

File diff suppressed because it is too large Load Diff

3823
data/data_810AE24.s Normal file

File diff suppressed because it is too large Load Diff

22
include/debug_menu.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef GUARD_DEBUG_MENU_H
#define GUARD_DEBUG_MENU_H
enum DebugMenuOptions
{
MENU_DEBUG_MENU_DUNGEONS = 0,
MENU_DEBUG_MENU_FIELD,
MENU_DEBUG_MENU_FIELD_MAP,
MENU_DEBUG_MENU_FIELD_SCRIPT,
MENU_DEBUG_MENU_DEBUG_MENU,
MENU_DEBUG_MENU_UNKNOWN_1,
MENU_DEBUG_MENU_STORAGE,
MENU_DEBUG_MENU_H_OPEN = 9,
};
void CreateDebugMenu(void);
void DeleteDebugMenu(void);
u32 UpdateDebugMenu(void);
void SetDebugMenuItems(void);
void sub_803A3A0(void);
#endif

35
include/friend_rescue.h Normal file
View File

@ -0,0 +1,35 @@
struct WonderMailStruct_203B33C
{
// size: 0x568
u32 unk0;
u32 unk4;
u8 unk8[0x36];
u32 unk40;
u32 unk44;
u16 unk48[232];
u8 unk218;
u8 padding7[3];
u32 unk21C;
u8 padding[0x7C];
u32 unk29C;
u8 padding6[0x6C];
u32 unk30C;
u8 padding8[0x4C];
u32 unk35C;
u8 padding5[0x5C];
u32 unk3BC;
u8 padding4[0x60];
u32 unk420; // Is this supposed to be a File like 203B2C4?
u8 fill424[0x52C - 0x424];
u8 unk52C;
u8 unk52D;
u8 fill52E;
u32 unk530;
u32 unk534;
u16 unk538; // A7 << 3
u32 unk53C;
u32 unk540; // A8 << 4
s16 unk544;
u8 filler546[0x564 - 0x546];
s32 unk564;
};

51
include/main_menu.h Normal file
View File

@ -0,0 +1,51 @@
#ifndef GUARD_MAIN_MENU_H
#define GUARD_MAIN_MENU_H
enum MainMenuScreens
{
MENU_MAIN_SCREEN = 1,
MENU_CONTINUE = 7,
MENU_DELETE_SAVE_PROMPT,
MENU_ADVENTURE_LOG = 10,
MENU_FRIEND_RESCUE,
MENU_TRADE_ITEMS,
MENU_WONDER_MAIL,
MENU_DEBUG = 16,
MENU_COMMUNICATION_1 = 19,
MENU_COMMUNICATION_2,
MENU_DISPLAY_RESCUE_PASSWORD = 33,
MENU_RESCUE_PASSWORD_ENTRY,
MENU_DELETE_SAVE = 46,
MENU_DEBUG_DUNGEON,
MENU_DEBUG_FIELD,
MENU_DEBUG_FIELD_MAP,
MENU_DEBUG_FIELD_SCRIPT,
MENU_DEBUG_DEBUG_MENU,
MENU_DEBUG_UNKNOWN_1,
MENU_NO_SCREEN_CHANGE = 0xffdc
};
struct MainMenuSub
{
u8 unk2C;
u8 unk2D;
u8 unk2E;
};
struct MainMenu
{
/* 0x0 */ s32 currMenu;
/* 0x4 */ s32 nextMenu;
/* 0x8 */ s32 lastMenu;
u8 padding[0x20];
/* 0x2C */ struct MainMenuSub sub;
u32 unk30;
u32 unk34;
s16 unk38;
u8 unk3A;
u8 unk3B;
s32 unk3C;
};
#endif // GUARD_MAIN_MENU_H

View File

@ -13,6 +13,10 @@ bool8 sub_800CAF0(u16 songIndex);
void StartNewBGM(u16 songIndex);
void FadeInNewBGM(u16 SongIndex, u16 speed);
u16 GetCurrentBGSong(void);
void sub_800BF48(u16 SongIndex);
void sub_800BF80(void);
void sub_800BFD0(u16 speed);
void sub_800C074(u16 SongIndex, u16 param_2);
void nullsub_19(void);
void nullsub_20(u16 songIndex);

View File

@ -12,19 +12,17 @@ extern const struct unkData gUnknown_80F4244;
struct PersonalityStruct_203B400
{
s32 FrameCounter;
u32 unk4;
/* 0x0 */ s32 FrameCounter;
/* 0x4 */ u32 unk4;
/* 0x8 */ s16 StarterID;
/* 0xA */ s16 PartnerID;
u8 padding[0x20 - 0xC];
s32 unk20; // Buffer to store partner name?
u8 padding2[0x34 - 0x24];
/* 0x20 */ char PartnerNick[0x14];
/* 0x34 */ u32 TestState;
/* 0x38 */ s32 QuestionCounter;
/* 0x3C */ u32 currQuestionIndex;
/* 0x40 */ u8 playerNature;
u8 padding3[3];
/* 0x44 */ s32 NatureTotals[13];
/* 0x44 */ s32 NatureTotals[NUM_PERSONALITIES];
/* 0x78 */ u8 QuestionTracker[NUM_QUIZ_QUESTIONS];
/* 0xB0 */ u32 playerGender; // 1 = Female, 0 = Male
u32 unkb4;

View File

@ -34,7 +34,7 @@ struct UnkStruct_203B184 {
/* 0x18 */ u32 unk18;
/* 0x1C */ u32 unk1C;
/* 0x20 */ u32 unk20;
/* 0x24 */ u8 *unk24;
/* 0x24 */ u8 *ExclusivePokemon;
/* 0x28 */ u8 *BoughtFriendAreas;
/* 0x2C */ u32 unk2C;
/* 0x30 */ struct PlayTimeStruct *playTime;

View File

@ -92,12 +92,20 @@ SECTIONS {
src/wonder_mail.o(.text);
src/wonder_mail_mid.o(.text);
asm/wonder_mail.o(.text);
src/wonder_mail_1.o(.text);
src/friend_rescue.o(.text);
asm/friend_rescue.o(.text);
src/friend_rescue_1.o(.text);
asm/credits.o(.text);
src/credits.o(.text);
src/main_menu.o(.text);
asm/main_menu.o(.text);
src/main_menu_mid.o(.text);
asm/main_menu_1.o(.text);
asm/wonder_mail_main_menu.o(.text);
src/wonder_mail_main_menu.o(.text);
src/debug_menu.o(.text);
asm/debug_menu.o(.text);
src/debug_menu_1.o(.text);
asm/code_803B050.o(.text);
src/pokemon_mail.o(.text);
src/code_803C1B4.o(.text);
@ -136,7 +144,10 @@ SECTIONS {
src/code_809747C.o(.text);
asm/code_809747C.o(.text);
src/code_8097F40.o(.text);
asm/code_8097F40.o(.text);
src/exclusive_pokemon.o(.text);
asm/exclusive_pokemon.o(.text);
asm/code_80983D8.o(.text);
src/code_80983D8.o(.text);
asm/code_8098468.o(.text);
src/code_8098BDC.o(.text);
asm/code_8098BDC.o(.text);
@ -220,6 +231,8 @@ SECTIONS {
src/personality_test_pre.o(.rodata);
src/personality_test.o(.rodata);
data/data_80F4278.o(.rodata);
src/exclusive_pokemon.o(.rodata);
data/data_810AE24.o(.rodata);
data/friend_area_dialogue.o(.rodata);
src/m4a_tables.o(.rodata);
src/agb_flash.o(.rodata);

View File

@ -17,8 +17,8 @@ extern void LoadMonsterParameters(void);
extern void sub_8097670(void);
extern void sub_8094980(void);
extern void sub_8094C14(void);
extern void sub_8097F5C(void);
extern void sub_8090998(void);
extern void LoadExclusivePokemon(void);
extern void LoadItemParameters(void);
extern void sub_809207C(void);
extern void LoadWazaParameters(void);
extern void sub_80950BC(void);
@ -81,7 +81,7 @@ void GameLoop(void)
{
u32 tmp;
u8 tmp3 = 1;
u32 tmp4;
u32 nextMenu;
u32 flag;
InitHeap();
@ -94,9 +94,9 @@ void GameLoop(void)
InitializePlayTime();
sub_8094980();
sub_8094C14();
sub_8097F5C();
LoadExclusivePokemon();
LoadFriendAreas();
sub_8090998();
LoadItemParameters();
sub_809207C();
LoadWazaParameters();
sub_80950BC();
@ -164,11 +164,11 @@ void GameLoop(void)
}
SetUpMenu();
xxx_update_stuff(0);
tmp4 = UpdateMenu();
nextMenu = UpdateMenu();
CleanUpMenu();
if (tmp4 == 2) break;
if (tmp4 == 4) break;
if (tmp4 == 3) break;
if (nextMenu == 2) break;
if (nextMenu == 4) break;
if (nextMenu == 3) break;
}
DeleteMainMenu();
while (gUnknown_2000A80 > 0) {
@ -179,7 +179,7 @@ void GameLoop(void)
xxx_update_stuff(0);
}
CloseFile(gTitlePaletteFile);
switch (tmp4) {
switch (nextMenu) {
case 2: {
s32 tmp5 = sub_80953D4(7);
if (tmp5 != -1) {

View File

@ -12,12 +12,8 @@
void sub_8011924(void);
extern u8 sub_80023E4(u8);
extern void sub_800BF48(u16 r0);
extern void sub_800BF80(void);
extern void sub_800BFD0(u16 r0);
extern void sub_800C3F8(u16 r0, u16 r1);
extern void sub_801199C(u16 r0);
extern void sub_800C074(u16 r0, u16 r1);
extern void sub_800C298(u16 r0);
extern u8 sub_800C5D0(u16 r0);
@ -121,9 +117,10 @@ void sub_80117C4(void)
sub_800BFD0(0x1E);
}
// Some sound effect
void sub_80117D0(void)
{
sub_800C074(0x97 << 1, 256);
sub_800C074(302, 256);
}
// Some sound effect
@ -199,9 +196,9 @@ void xxx_call_fade_in_new_bgm(u16 songIndex, u16 speed)
FadeInNewBGM(songIndex, speed);
}
void sub_8011914(u16 r0)
void sub_8011914(u16 songIndex)
{
sub_800BF48(r0);
sub_800BF48(songIndex);
}
void sub_8011924()
@ -209,9 +206,9 @@ void sub_8011924()
sub_800BF80();
}
void sub_8011930(u16 r0)
void sub_8011930(u16 speed)
{
sub_800BFD0(r0);
sub_800BFD0(speed);
}
u32 IsEqualtoBGTrack(u16 songIndex)
@ -232,7 +229,7 @@ void sub_8011974(u16 songIndex, u16 r1)
void sub_8011988(u16 songIndex)
{
sub_800C074(songIndex, 0x80 << 1);
sub_800C074(songIndex, 256);
}
void sub_801199C(u16 songIndex)
@ -250,11 +247,11 @@ u8 sub_80119C0(u16 songIndex)
return sub_800C5D0(songIndex);
}
void sub_80119D4(u32 r0)
void PlayMenuSoundEffect(u32 r0)
{
if(gUnknown_202DE20 > 0)
return;
sub_800C074(gUnknown_80D4144[r0], 0x80 << 1);
sub_800C074(gUnknown_80D4144[r0], 256);
gUnknown_202DE20 = 4;
}
@ -263,7 +260,7 @@ void sub_8011A04(void)
if(gUnknown_202DE22 > 0)
return;
gUnknown_202DE22 = 3;
sub_800C074(0x131, 0x80 << 1);
sub_800C074(0x131, 256);
}
void sub_8011A2C(u32 r0)

View File

@ -22,19 +22,70 @@ extern u32 sub_80270A4();
extern u32 sub_802C898(void);
extern void sub_802C8F4(void);
extern u8 sub_8012FD8(u32 *);
extern void sub_8013114(u32 *, s32 *);
struct unk_203B250
{
u32 unk0;
u16 unk4;
u8 unk6;
u8 unk7;
u32 padding[3];
u8 unk8;
u8 unk9;
u8 fillA[0x14 - 0xA];
u32 unk14;
u32 unk18;
u32 unk18; // an input struct??
};
struct unk_203B250 *gUnknown_203B250;
void sub_801D680(void)
{
int local_c;
local_c = 0;
if ((sub_8012FD8(&gUnknown_203B250->unk18) == '\0') && (sub_8013114(&gUnknown_203B250->unk18,&local_c), local_c != 1)) {
gUnknown_203B250->unk14 = local_c;
}
switch(local_c) {
case 2:
sub_801D208(3);
break;
case 4:
sub_801D208(6);
break;
case 3:
sub_801D208(4);
break;
case 5:
sub_801D208(7);
break;
case 6:
sub_801D208(8);
break;
case 7:
sub_801D208(9);
break;
case 8:
sub_801D208(10);
break;
case 9:
sub_801D208(0xb);
break;
case 10:
gUnknown_203B250->unk9 = 1;
sub_801D208(2);
break;
case 11:
sub_801D208(0xc);
break;
case 1:
sub_801D208(2);
break;
}
}
void sub_801D760()
{
u32 temp;

View File

@ -8,6 +8,10 @@ extern u8 gUnknown_810A36B[];
extern s16 gUnknown_810A378[];
extern s32 gUnknown_810A390[];
extern u32 gUnknown_81076E4[];
extern bool8 sub_808ECD0(u8 *, u32);
extern void sub_808EC30(u8 *, u32);
u32 sub_808EAB0(u8 r0)
{
@ -87,3 +91,103 @@ bool8 sub_808EB7C(s32 r0, u8 r1)
return gUnknown_810A390[r1] <= r0;
}
s32 sub_808EBA8(u8 param_1[], s32 param_2)
{
s32 counter_2;
s32 counter_1;
u8 cast_u8;
s32 index;
index = 0;
for(counter_1 = 1; counter_1 < 0x18; counter_1++) {
cast_u8 = counter_1; // force this cast to be in a reg
if (sub_808EB7C(param_2, cast_u8)) {
param_1[index] = cast_u8;
index++;
}
}
counter_2 = index; // set counter to where the first loop ended
while (counter_2 < 0x18) {
param_1[counter_2] = 0;
counter_2++;
}
return index;
}
void sub_808EBF4(u8 *param_1, u32 param_2)
{
int iVar2; // a mask?
iVar2 = 1 << (param_2);
if (sub_808ECD0(param_1,iVar2)) {
param_1[0] = param_1[0] & ~iVar2;
param_1[1] = param_1[1] & ~(iVar2 >> 8);
param_1[2] = param_1[2] & ~(iVar2 >> 0x10);
}
else
{
sub_808EC30(param_1,param_2);
}
}
void sub_808EC30(u8 *param_1, u32 param_2)
{
s32 iVar1;
s32 counter;
s32 iVar4;
s32 iVar5;
counter = 0;
iVar4 = gUnknown_81076E4[param_2];
do {
if (iVar4 == gUnknown_81076E4[counter]) {
iVar1 = 1 << (counter);
param_1[0] = param_1[0] & ~iVar1;
param_1[1] = param_1[1] & ~(iVar1 >> 8);
param_1[2] = param_1[2] & ~(iVar1 >> 0x10);
}
counter++;
} while (counter < 0x18);
iVar5 = 1 << (param_2);
param_1[0] = iVar5 | param_1[0];
param_1[1] = (iVar5 >> 8) | param_1[1];
param_1[2] = (iVar5 >> 0x10) | param_1[2];
}
void sub_808EC94(u8 *param_1, u8 param_2)
{
param_1[0] = 0;
param_1[1] = 0;
param_1[2] = 0;
sub_808EC30(param_1, 2);
sub_808EC30(param_1, 3);
sub_808EC30(param_1, 0x16);
if (param_2 != 0) {
sub_808EC30(param_1, 0x12);
}
}
bool8 sub_808ECD0(u8 *param_1, u32 param_2)
{
if ((((param_1[0] & param_2) == 0) &&
((param_1[1] & param_2 >> 8) == 0)) &&
((param_1[2] & param_2 >> 0x10) == 0))
{
return 0;
}
else {
return 1;
}
}
u32 sub_808ECFC(void)
{
return 0;
}

View File

@ -9,6 +9,286 @@ extern u8 gUnknown_810AC6A[];
extern u8 *gAbilityNames[];
extern u8 *AbilityDescriptions[];
extern u32 gUnknown_810983C[26]; // TODO: verify size later
struct unkStruct_203B464
{
u8 unk0[0xA]; // some string of sorts
s32 unkC;
u8 unk10;
};
extern struct unkStruct_203B464 *gUnknown_203B464;
extern struct unkStruct_203B464 gUnknown_2038C10;
extern void sub_809485C(u32 *r0, u8 *r1, u32 r2);
extern void sub_809486C(u32 *r0, u8 *r1, u32 r2);
extern void sub_809488C(u32 *r0, u8 *r1, u32 r2);
extern void sub_8094924(u32 *r0, u8 *r1, u32);
extern void nullsub_102(u32 *r0);
extern u8 sub_80023E4(u32);
extern const char *gRescueTeamRanks[];
extern s32 gUnknown_8109810[7];
extern u8 gUnknown_810982C[0x8]; // Pokemon
extern u8 gUnknown_810A35B[0x10];
// Forward declaration
void sub_80922B4(u8 *buffer, u8 *string, s32 size);
void BoundedCopyStringtoBuffer(u8 *buffer, u8 *string, s32 size);
bool32 sub_8092040(u8 param_1)
{
s32 index;
if (param_1 >= 0xF0)
return TRUE;
else {
index = 0;
while (gUnknown_810A35B[index] != 0xF0){
if (gUnknown_810A35B[index] == param_1)
return TRUE;
index++;
};
return FALSE;
}
}
void sub_809207C(void)
{
gUnknown_203B464 = &gUnknown_2038C10;
}
struct unkStruct_203B464 *sub_809208C(void)
{
return &gUnknown_2038C10;
}
void sub_8092094(void)
{
BoundedCopyStringtoBuffer(gUnknown_203B464->unk0, gUnknown_810982C, 0xA);
gUnknown_203B464->unkC = 0;
gUnknown_203B464->unk10 = 0;
}
void sub_80920B8(u8 *buffer)
{
s32 counter;
for(counter = 0; counter < 0xA; counter++)
{
*buffer++ = gUnknown_203B464->unk0[counter];
}
}
void sub_80920D8(u8 *buffer)
{
sub_80922B4(buffer, gUnknown_203B464->unk0, 0xA);
}
void sub_80920EC(u8 *r0)
{
s32 counter;
for(counter = 0; counter < 0xA; counter++)
{
gUnknown_203B464->unk0[counter] = *r0++;
}
}
s32 sub_8092110(void)
{
return gUnknown_203B464->unkC;
}
#ifdef NONMATCHING
s32 sub_809211C(void)
{
u8 uVar1;
s32 iVar2;
uVar1 = sub_8092178();
if (uVar1 != 6) {
// Goes to R2 instead of R1 but matches aside from that
iVar2 = gUnknown_8109810[uVar1] - gUnknown_203B464->unkC;
}
else
{
iVar2 = 0;
}
return iVar2;
}
#else
NAKED
s32 sub_809211C(void)
{
asm_unified(
"\tpush {lr}\n"
"\tbl sub_8092178\n"
"\tlsls r0, 24\n"
"\tlsrs r0, 24\n"
"\tcmp r0, 0x6\n"
"\tbeq _08092144\n"
"\tldr r1, _0809213C\n"
"\tlsls r0, 2\n"
"\tadds r0, r1\n"
"\tldr r1, _08092140\n"
"\tldr r1, [r1]\n"
"\tldr r0, [r0]\n"
"\tldr r1, [r1, 0xC]\n"
"\tsubs r0, r1\n"
"\tb _08092146\n"
"\t.align 2, 0\n"
"_0809213C: .4byte gUnknown_8109810\n"
"_08092140: .4byte gUnknown_203B464\n"
"_08092144:\n"
"\tmovs r0, 0\n"
"_08092146:\n"
"\tpop {r1}\n"
"\tbx r1");
}
#endif
// Unused
void sub_809214C(s32 param_1)
{
gUnknown_203B464->unkC = param_1;
}
void sub_8092158(s32 param_1)
{
gUnknown_203B464->unkC += param_1;
if (gUnknown_203B464->unkC > 99999999) {
gUnknown_203B464->unkC = 99999999;
}
}
u8 sub_8092178(void)
{
s32 index;
for(index = 0; index < 7; index++){
if (gUnknown_203B464->unkC < gUnknown_8109810[index]) {
return index;
}
}
return 6;
}
const char *GetTeamRankString(u8 index)
{
return gRescueTeamRanks[index];
}
// Unused
u8 sub_80921B8(void)
{
return gUnknown_203B464->unk10;
}
u32 sub_80921C4(u8 *param_1,u32 param_2)
{
u32 auStack36[4];
u8 neg1;
u8 zero;
u8 *puVar2;
neg1 = -1;
zero = 0;
sub_809486C(auStack36, param_1, param_2);
sub_809488C(auStack36, gUnknown_203B464->unk0, 0x58);
sub_809488C(auStack36, (u8 *)&gUnknown_203B464->unkC, 0x20);
gUnknown_203B464->unk10 = sub_80023E4(0);
if (gUnknown_203B464->unk10 != 0)
{
puVar2 = &neg1;
}
else
{
puVar2 = &zero;
}
sub_809488C(auStack36,puVar2,1);
nullsub_102(auStack36);
return auStack36[2];
}
u32 sub_809222C(u8 *param_1, u32 param_2)
{
u32 auStack32 [4];
u8 byteArray[4];
sub_809485C(auStack32, param_1, param_2);
sub_8094924(auStack32, gUnknown_203B464->unk0, 0x58);
sub_8094924(auStack32, (u8 *)&gUnknown_203B464->unkC, 0x20);
sub_8094924(auStack32, byteArray, 1);
gUnknown_203B464->unk10 = byteArray[0] & 1;
nullsub_102(auStack32);
return auStack32[2];
}
u32 ReturnIntFromChar(u8 r0)
{
return r0;
}
u32 ReturnIntFromChar2(u8 r0)
{
return r0;
}
// Unused
void sub_8092290(u8 *buffer, u8 *string)
{
while( *string != '\0' ) {
*buffer++ = ReturnIntFromChar2(*string++);
}
*buffer = 0; // append a 0
}
void sub_80922B4(u8 *buffer, u8 *string, s32 size)
{
while(1)
{
if(size-- < 1 || *string == '\0')
{
break;
}
*buffer++ = ReturnIntFromChar2(*string++);
}
*buffer = 0; // append a 0
}
u32 sub_80922E4(u32 r0)
{
return gUnknown_810983C[r0];
}
void CopyStringtoBuffer(u8 *buffer, u8 *string)
{
while( *string != '\0' ) {
*buffer++ = *string++;
}
*buffer = 0; // append a 0
}
void BoundedCopyStringtoBuffer(u8 *buffer, u8 *string, s32 size)
{
while( 1 ) {
if (size-- < 1) {
break;
}
if (*string == '\0') {
*buffer = 0; // append a 0 and break
break;
}
// NOTE: *buffer++ = *string++ cases register flip
*buffer = *string;
buffer++;
string++;
}
}
u32 GetUnformattedTypeString(u8 type)
{
@ -30,9 +310,9 @@ u8 sub_8092364(u8 index)
return gUnknown_810AC6A[index];
}
void sub_8092374(char *r0, u8 index)
void sub_8092374(char *buffer, u8 index)
{
strncpy(r0, gAbilityNames[index], 0x50);
strncpy(buffer, gAbilityNames[index], 0x50);
}
u8 *GetAbilityDescription(u8 index)

View File

@ -14,8 +14,8 @@ extern u32 *gUnknown_203B488;
extern u32 *gUnknown_203B48C;
extern void sub_809488C(u32 *r0, u32 *r1, u32);
extern void sub_8094924(u32 *r0, u32 *r1, u32);
extern void sub_809488C(u8 *r0, u8 *r1, u32);
extern void sub_8094924(u8 *r0, u8 *r1, u32);
void InitializePlayTime(void)
@ -87,20 +87,20 @@ void DeconstructPlayTime(struct PlayTimeStruct *r0, u32 *outHours, u32 *outMinut
}
}
void sub_8095044(u32 *r0)
void sub_8095044(u8 *r0)
{
sub_809488C(r0, (u32 *)(&(gPlayTimeRef->frames)), 6);
sub_809488C(r0, (u32 *)(&(gPlayTimeRef->seconds)), 6);
sub_809488C(r0, (u32 *)(&(gPlayTimeRef->minutes)), 6);
sub_809488C(r0, (u32 *)(&(gPlayTimeRef->hours)), 14);
sub_809488C(r0, (&(gPlayTimeRef->frames)), 6);
sub_809488C(r0, (&(gPlayTimeRef->seconds)), 6);
sub_809488C(r0, (&(gPlayTimeRef->minutes)), 6);
sub_809488C(r0, (u8 *)(&(gPlayTimeRef->hours)), 14);
}
void sub_8095080(u32 *r0)
void sub_8095080(u8 *r0)
{
sub_8094924(r0, (u32 *)(&(gPlayTimeRef->frames)), 6);
sub_8094924(r0, (u32 *)(&(gPlayTimeRef->seconds)), 6);
sub_8094924(r0, (u32 *)(&(gPlayTimeRef->minutes)), 6);
sub_8094924(r0, (u32 *)(&(gPlayTimeRef->hours)), 14);
sub_8094924(r0, (&(gPlayTimeRef->frames)), 6);
sub_8094924(r0, (&(gPlayTimeRef->seconds)), 6);
sub_8094924(r0, (&(gPlayTimeRef->minutes)), 6);
sub_8094924(r0, (u8 *)(&(gPlayTimeRef->hours)), 14);
}
void sub_80950BC(void)

View File

@ -15,7 +15,7 @@ const u8 *sub_809747C(s16 r0)
}
else
{
return GetDungeonName1(sub_80A270C());
return GetDungeonName1(sub_80A270C(r0));
}
}
@ -27,14 +27,14 @@ const u8 *sub_80974A0(s16 r0)
}
else
{
return GetDungeonName1(sub_80A270C());
return GetDungeonName1(sub_80A270C(r0));
}
}
#ifndef NONMATCHING
NAKED
#endif
u32 *sub_80974C4(s16 r0)
u32 *GetCurrentMissionText(s16 r0)
{
#ifdef NONMATCHING
// TODO fix regswap memes of r0/r1

View File

@ -1,72 +1,8 @@
#include "global.h"
#define NUM_EXCLUSIVE_POKEMON 12
struct ExclusivePokemon
{
u16 poke_id;
bool8 in_rrt; // red rescue team
bool8 in_brt; // blue rescue team
};
extern struct ExclusivePokemon gExclusivePokemon[];
extern u8 gUnknown_810ACC0[];
extern u8 *gUnknown_203B498;
extern u8 gUnknown_2039840;
bool8 sub_8097F40(u32 r0)
{
return gUnknown_810ACC0[r0] == 2;
}
void sub_8097F5C(void)
{
gUnknown_203B498 = &gUnknown_2039840;
}
u8 *sub_8097F6C(void)
{
return &gUnknown_2039840;
}
#ifdef NONMATCHING
void sub_8097F74(void)
{
s32 counter;
memset(gUnknown_203B498, 0, 0x64);
for(counter = 0; counter < NUM_EXCLUSIVE_POKEMON; counter++)
{
// TODO fix switching of addition statements (when it figures out the index)
gUnknown_203B498[counter + 0x58] = gExclusivePokemon[counter].in_rrt;
}
}
#else
NAKED
void sub_8097F74(void)
{
asm_unified("\tpush {r4,lr}\n"
"\tldr r4, _08097FA0\n"
"\tldr r0, [r4]\n"
"\tmovs r1, 0\n"
"\tmovs r2, 0x64\n"
"\tbl memset\n"
"\tmovs r2, 0\n"
"\tldr r3, _08097FA4\n"
"_08097F86:\n"
"\tldr r0, [r4]\n"
"\tadds r0, 0x58\n"
"\tadds r0, r2\n"
"\tldrb r1, [r3, 0x2]\n"
"\tstrb r1, [r0]\n"
"\tadds r3, 0x4\n"
"\tadds r2, 0x1\n"
"\tcmp r2, 0xB\n"
"\tble _08097F86\n"
"\tpop {r4}\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.align 2, 0\n"
"_08097FA0: .4byte gUnknown_203B498\n"
"_08097FA4: .4byte gExclusivePokemon");
}
#endif

20
src/code_80983D8.c Normal file
View File

@ -0,0 +1,20 @@
#include "global.h"
s32 sub_8098434(short param_1[],short param_2[])
{
s32 diff_index1;
s32 diff_index0;
diff_index0 = param_1[0] - param_2[0];
if (diff_index0 < 0) {
diff_index0 = -diff_index0;
}
diff_index1 = param_1[1] - param_2[1];
if (diff_index1 < 0) {
diff_index1 = -diff_index1;
}
if (diff_index1 < diff_index0) {
diff_index1 = diff_index0;
}
return diff_index1;
}

135
src/debug_menu.c Normal file
View File

@ -0,0 +1,135 @@
#include "global.h"
#include "debug_menu.h"
#include "main_menu.h"
struct unkData
{
u8 unk0[24];
};
struct DebugMenu
{
// size: 0x1A4
u8 fill0[0x140];
/* 0x140 */ struct unkData unk140[4];
};
extern struct DebugMenu *gUnknown_203B3EC;
extern struct unkData gUnknown_80E7D40;
struct MenuItem
{
const char *text;
u32 menuAction; // action??
};
extern struct MenuItem gDebugMenuItems[8];
extern u32 gUnknown_80E7D58[6];
extern void *MemoryAlloc(u32, u32);
extern void MemoryFree(void *);
extern void MemoryFill8(u8 *, u8, u32);
extern void sub_800641C(void *, u32, u32);
extern void ResetUnusedInputStruct(void);
extern u8 sub_8012FD8(struct DebugMenu *);
extern void sub_8013114(struct DebugMenu *, s32 *);
extern void sub_80976F8(u8);
extern void sub_803A3BC(void);
extern void sub_803A3A0(void);
extern void SetMenuItems(void *menu, void *, u32, u32 *, struct MenuItem *entries, u32, u32, u32);
extern void sub_8035CF4(struct DebugMenu *, u32, u32);
extern void sub_8035CC0(struct unkData *, u32);
void CreateDebugMenu(void)
{
int iVar2;
if (gUnknown_203B3EC == NULL) {
gUnknown_203B3EC = MemoryAlloc(0x1a4, 8);
MemoryFill8((u8 *)gUnknown_203B3EC, 0, 0x1a4);
}
for(iVar2 = 0; iVar2 < 4; iVar2++){
gUnknown_203B3EC->unk140[iVar2] = gUnknown_80E7D40;
}
ResetUnusedInputStruct();
sub_800641C(&gUnknown_203B3EC->unk140, 1, 1);
SetDebugMenuItems();
}
void DeleteDebugMenu(void)
{
ResetUnusedInputStruct();
sub_800641C(NULL, 1, 1);
if(gUnknown_203B3EC != NULL)
{
MemoryFree(gUnknown_203B3EC);
gUnknown_203B3EC = NULL;
}
}
u32 UpdateDebugMenu(void)
{
u32 nextMenu;
s32 counter;
s32 debugMenuAction;
nextMenu = MENU_NO_SCREEN_CHANGE;
debugMenuAction = 11;
if (sub_8012FD8(gUnknown_203B3EC) == 0) {
sub_8013114(gUnknown_203B3EC, &debugMenuAction);
}
switch(debugMenuAction) {
case MENU_DEBUG_MENU_DUNGEONS:
nextMenu = MENU_DEBUG_DUNGEON;
break;
case MENU_DEBUG_MENU_FIELD:
nextMenu = MENU_DEBUG_FIELD;
break;
case MENU_DEBUG_MENU_FIELD_MAP:
nextMenu = MENU_DEBUG_FIELD_MAP;
break;
case MENU_DEBUG_MENU_FIELD_SCRIPT:
nextMenu = MENU_DEBUG_FIELD_SCRIPT;
break;
case MENU_DEBUG_MENU_DEBUG_MENU:
nextMenu = MENU_DEBUG_DEBUG_MENU;
break;
case MENU_DEBUG_MENU_UNKNOWN_1: // No option that correponds to this one
nextMenu = MENU_DEBUG_UNKNOWN_1;
break;
case MENU_DEBUG_MENU_STORAGE:
sub_803A3BC();
nextMenu = MENU_MAIN_SCREEN;
break;
case MENU_DEBUG_MENU_H_OPEN:
for(counter = 0; counter < 0x20; counter++){
sub_80976F8(counter);
}
nextMenu = MENU_MAIN_SCREEN;
break;
case 10:
sub_803A3A0();
nextMenu = MENU_MAIN_SCREEN;
break;
case 11:
nextMenu = MENU_NO_SCREEN_CHANGE;
}
return nextMenu;
}
void SetDebugMenuItems(void)
{
SetMenuItems(gUnknown_203B3EC, gUnknown_203B3EC->unk140, 0, gUnknown_80E7D58, gDebugMenuItems, 1, 0xd, 0);
sub_8035CF4(gUnknown_203B3EC,0,1);
}
void sub_803A3A0(void)
{
sub_8035CC0(gUnknown_203B3EC->unk140, 0);
}

85
src/debug_menu_1.c Normal file
View File

@ -0,0 +1,85 @@
#include "global.h"
struct subStruct
{
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
};
struct unkStruct_203B3F8
{
u8 fill0[8];
struct subStruct *unk8;
u8 fill4[4];
u32 unk10;
u8 fill14[0x60 - 0x14];
u32 unk60;
};
extern struct unkStruct_203B3F8 *gUnknown_203B3F8;
extern u32 sub_8013BBC(u32 *);
extern void sub_8023A94(u32);
extern u8 sub_8012FD8(u32 *);
extern void sub_803AE58(void);
extern u32 sub_8016080(void);
extern void sub_803ACD0(u32);
extern void sub_80160D8(void);
extern void sub_8013114(u32 *, s32 *);
void sub_803AF88(void)
{
s32 local_c;
local_c = 0;
sub_8023A94(local_c);
if (sub_8012FD8(&gUnknown_203B3F8->unk10) == 0) {
sub_8013114(&gUnknown_203B3F8->unk10, &local_c);
}
switch(local_c)
{
case 4:
sub_803ACD0(5);
break;
case 5:
sub_803ACD0(6);
break;
case 1:
sub_803ACD0(2);
break;
default:
break;
}
}
void sub_803AFE8(void)
{
sub_8023A94(0);
sub_8012FD8(&gUnknown_203B3F8->unk10);
switch(sub_8013BBC(&gUnknown_203B3F8->unk60))
{
default:
break;
case 3:
gUnknown_203B3F8->unk8->unk3 = gUnknown_203B3F8->unk60;
// Fallthrough is needed to match
case 2:
sub_803ACD0(2);
break;
case 1:
sub_803AE58();
break;
}
}
void sub_803B034(void)
{
switch(sub_8016080())
{
case 2:
case 3:
sub_80160D8();
sub_803ACD0(2);
break;
}
}

View File

@ -5,10 +5,33 @@
extern void sub_800226C(u8 r0, u8 r1, u32* r2, u8 u3);
extern void sub_800160C(struct UnkEventStruct *r0, u32 r1, u32 r2);
extern u8 sub_8002658(s32);
extern u8 sub_8002658(s16);
struct unkEventStruct
{
s16 unk0;
u8 unk2; // Seems like friend area number
};
struct unkEventStruct gUnknown_80B71E4[100]; // TODO figure out size of this
extern u8 gUnknown_2000A88[0x400];
s16 sub_8002694(u8 param_1)
{
struct unkEventStruct *puVar2 = gUnknown_80B71E4;
while (puVar2->unk0 != -1) {
if (puVar2->unk2 == param_1) {
return puVar2->unk0;
}
puVar2++;
}
return -1;
}
bool8 sub_80026CC(s16 r0)
{
return GetFriendAreaStatus(sub_8002658(r0));

80
src/exclusive_pokemon.c Normal file
View File

@ -0,0 +1,80 @@
#include "global.h"
#include "constants/species.h"
#define NUM_EXCLUSIVE_POKEMON 12
#define RED_EXCLUSIVE(species) \
{ \
.poke_id = species, \
.in_rrt = TRUE, \
.in_brt = FALSE, \
}
#define BLUE_EXCLUSIVE(species) \
{ \
.poke_id = species, \
.in_rrt = FALSE, \
.in_brt = TRUE, \
}
struct ExclusivePokemon
{
u16 poke_id;
bool8 in_rrt; // red rescue team
bool8 in_brt; // blue rescue team
};
const struct ExclusivePokemon gExclusivePokemon[NUM_EXCLUSIVE_POKEMON] = {
RED_EXCLUSIVE(SPECIES_PORYGON),
BLUE_EXCLUSIVE(SPECIES_PORYGON2),
BLUE_EXCLUSIVE(SPECIES_MAGIKARP),
BLUE_EXCLUSIVE(SPECIES_GYARADOS),
RED_EXCLUSIVE(SPECIES_FEEBAS),
RED_EXCLUSIVE(SPECIES_MILOTIC),
RED_EXCLUSIVE(SPECIES_PLUSLE),
BLUE_EXCLUSIVE(SPECIES_MINUN),
BLUE_EXCLUSIVE(SPECIES_LAPRAS),
RED_EXCLUSIVE(SPECIES_MANTINE),
RED_EXCLUSIVE(SPECIES_ROSELIA),
BLUE_EXCLUSIVE(SPECIES_AIPOM),
};
const u8 filler_ex0[8] =
{
'p', 'k', 's', 'd', 'i', 'r', '0', 0
};
const u8 filler_ex1[8] =
{
'p', 'k', 's', 'd', 'i', 'r', '0', 0
};
struct unkStruct_203B498
{
u8 fill0[0x58];
bool8 Exclusives[NUM_EXCLUSIVE_POKEMON];
};
extern struct unkStruct_203B498 *gUnknown_203B498;
extern struct unkStruct_203B498 gUnknown_2039840;
void LoadExclusivePokemon(void)
{
gUnknown_203B498 = &gUnknown_2039840;
}
struct unkStruct_203B498 *GetExclusivePokemon(void)
{
return &gUnknown_2039840;
}
void InitializeExclusivePokemon(void)
{
s32 counter;
memset(gUnknown_203B498, 0, sizeof(struct unkStruct_203B498));
for(counter = 0; counter < NUM_EXCLUSIVE_POKEMON; counter++)
{
gUnknown_203B498->Exclusives[counter] = gExclusivePokemon[counter].in_rrt;
}
}

View File

@ -2,14 +2,13 @@
#include "constants/friend_area.h"
extern bool8 *gFriendAreas;
extern void sub_809485C(u32 *r0, u32 r1, u32 r2);
extern void sub_809485C(u32 *r0, u8 *r1, u32 r2);
extern void sub_8094924(u32 *r0, u32 *r1, u32);
extern void nullsub_102(u32 *r0);
extern void sub_809488C(u32 *r0, u32 *r1, u32 r2);
extern void sub_809486C(u32 *r0, u32 r1, u32 r2);
extern void sub_809486C(u32 *r0, u8 *r1, u32 r2);
#ifdef NONMATCHING
u32 sub_80927A8(u32 r0, u32 r1)
u32 sub_80927A8(u8 *r0, u32 r1)
{
u32 temp[5];
s32 counter;
@ -17,57 +16,17 @@ u32 sub_80927A8(u32 r0, u32 r1)
sub_809486C(temp, r0, r1);
for(counter = 0; counter < NUM_FRIEND_AREAS; counter++)
{
// TODO fix one line diff of storing into temp[4]
if(gFriendAreas[counter])
if(gFriendAreas[counter] != 0)
temp[4] = -1;
else
temp[4] = 0;
sub_809488C(temp, &(temp[4]), 1);
}
nullsub_102(temp);
return temp[2];
}
#else
NAKED u32 sub_80927A8(u32 r0, u32 r1)
{
asm_unified("\tpush {r4,r5,lr}\n"
"\tsub sp, 0x14\n"
"\tadds r3, r0, 0\n"
"\tadds r2, r1, 0\n"
"\tmov r0, sp\n"
"\tadds r1, r3, 0\n"
"\tbl sub_809486C\n"
"\tmovs r4, 0\n"
"\tadd r5, sp, 0x10\n"
"_080927BC:\n"
"\tldr r0, _080927F0\n"
"\tldr r0, [r0]\n"
"\tadds r0, r4\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0\n"
"\tbeq _080927CC\n"
"\tmovs r0, 0x1\n"
"\tnegs r0, r0\n"
"_080927CC:\n"
"\tstr r0, [sp, 0x10]\n"
"\tmov r0, sp\n"
"\tadds r1, r5, 0\n"
"\tmovs r2, 0x1\n"
"\tbl sub_809488C\n"
"\tadds r4, 0x1\n"
"\tcmp r4, 0x39\n"
"\tble _080927BC\n"
"\tmov r0, sp\n"
"\tbl nullsub_102\n"
"\tldr r0, [sp, 0x8]\n"
"\tadd sp, 0x14\n"
"\tpop {r4,r5}\n"
"\tpop {r1}\n"
"\tbx r1\n"
"\t.align 2, 0\n"
"_080927F0: .4byte gFriendAreas");
}
#endif
u32 sub_80927F4(u32 r0, u32 r1)
u32 sub_80927F4(u8 *r0, u32 r1)
{
u32 temp[5];
s32 counter;

508
src/friend_rescue.c Normal file
View File

@ -0,0 +1,508 @@
#include "global.h"
#include "friend_rescue.h"
#include "constants/species.h"
extern void sub_80338C4(u32);
extern s32 sub_80144A4(s32 *);
extern void sub_802F2C0();
extern void sub_808D8E0(u8 *, u32);
extern char * GetMonSpecies(u32);
extern u8 sub_809539C(u32, u32);
extern void sub_8095240(u8);
extern u32 sub_802F298();
extern char gUnknown_202E5D8[0x50];
extern char gAvailablePokemonNames[0x50];
extern struct WonderMailStruct_203B33C *gUnknown_203B33C;
extern u8 sub_8039880(void);
void MemoryFill8(u8 *dest, u8 value, s32 size);
void *MemoryAlloc(u32, u32);
void ResetUnusedInputStruct(void);
void sub_800641C(void *, u32, u32);
extern void sub_8035300(void);
extern void sub_8035404(u32);
extern void nullsub_41(void);
extern void nullsub_42(void);
extern void nullsub_43(void);
extern void nullsub_44(void);
extern void nullsub_45(void);
extern void nullsub_46(void);
extern void nullsub_47(void);
extern void nullsub_48(void);
extern void nullsub_49(void);
extern void nullsub_50(void);
extern void nullsub_51(void);
extern void sub_8035374(void);
extern void sub_80353BC(void);
extern void sub_8033A2C(void);
extern void sub_803477C(void);
extern void sub_80347AC(void);
extern void sub_80347C8(void);
extern void sub_80347E4(void);
extern void sub_8034804(void);
extern void sub_80344C0(void);
extern void sub_8034478(void);
extern void sub_80344A0(void);
extern void sub_803418C(void);
extern void sub_8034254(void);
extern void sub_8034310(void);
extern void sub_8034378(void);
extern void sub_80343C4(void);
extern void sub_8034404(void);
extern void sub_8034500(void);
extern void sub_8034590(void);
extern void sub_803464C(void);
extern void sub_80346A8(void);
extern void sub_80346D8(void);
extern void sub_8034700(void);
extern void sub_8034720(void);
extern void sub_803473C(void);
extern void sub_8033FB4(void);
extern void sub_8034074(void);
extern void sub_8034130(void);
extern void sub_8033FE4(void);
extern void sub_8033D74(void);
extern void sub_8033D94(void);
extern void sub_8033DBC(void);
extern void sub_8033F64(void);
extern void sub_8033C54(void);
extern void sub_8033CAC(void);
extern void sub_8033D48(void);
extern void sub_8035424(void);
extern void sub_8034970(void);
extern void sub_80351E0(void);
extern void sub_8034D74(void);
extern void sub_8034EF0(void);
extern void sub_8034F38(void);
extern void sub_80352A4(void);
extern void sub_8034EC8(void);
extern void sub_8033B8C(void);
extern void sub_80339C8(void);
extern void sub_80348C4(void);
extern void sub_803482C(void);
extern void sub_80349B0(void);
extern void sub_8034A70(void);
extern void sub_8034B2C(void);
extern void sub_80349E0(void);
extern void sub_8034B88(void);
extern void sub_8034C98(void);
extern void sub_8034C38(void);
extern void sub_8034D54(void);
extern void sub_8034F18(void);
extern void sub_8034F58(void);
extern void sub_8034F88(void);
extern void sub_8035018(void);
extern void sub_8035038(void);
extern void sub_8035094(void);
extern void sub_80350F4(void);
extern void sub_803517C(void);
extern void sub_8035210(void);
extern void sub_8035430(void);
extern void sub_8034848(void);
extern void MemoryFree(void *);
extern void sub_803084C(void);
extern void sub_8031E10(void);
extern void sub_8023C60(void);
extern void sub_80155F0(void);
extern void sub_801CBB8(void);
extern void sub_802F2C0(void);
extern void sub_8030DE4(void);
extern void sub_802453C(void);
extern void sub_801B450(void);
u32 CreateFriendRescueMenu(void)
{
char *monName;
int counter;
ResetUnusedInputStruct();
sub_800641C(0, 1, 1);
gUnknown_203B33C = MemoryAlloc(sizeof(struct WonderMailStruct_203B33C), 8);
MemoryFill8((u8 *) gUnknown_203B33C, 0, sizeof(struct WonderMailStruct_203B33C));
gUnknown_203B33C->unk530 = 0;
gUnknown_203B33C->unk218 = -1;
gUnknown_203B33C->unk538 = -1;
sub_808D8E0(gUnknown_202E5D8, SPECIES_PELIPPER);
monName = GetMonSpecies(SPECIES_PELIPPER);
strcpy(gAvailablePokemonNames,monName);
for(counter = 0; counter < 0x36; counter++){
gUnknown_203B33C->unk8[counter] = 0;
}
gUnknown_203B33C->unk4 = 0x7E;
gUnknown_203B33C->unk52C = sub_8039880();
gUnknown_203B33C->unk52D = gUnknown_203B33C->unk52C;
sub_80338C4(0);
return 1;
}
u32 UpdateFriendRescueMenu(void)
{
switch(gUnknown_203B33C->unk0)
{
case 0x78:
sub_8035300();
break;
case 0x79:
sub_8035404(0x78);
break;
case 0x7A:
sub_8035374();
break;
case 0x7B:
sub_8035404(0x7a);
break;
case 0x7C:
sub_80353BC();
break;
case 0x7D:
sub_8035404(0x7c);
break;
case 3:
case 4:
sub_8033A2C();
break;
case 0x3D:
sub_803477C();
break;
case 0x3E:
sub_80347AC();
break;
case 0x3F:
sub_80347C8();
break;
case 0x40:
sub_80347E4();
break;
case 0x41:
sub_8034804();
break;
case 0x2D:
sub_8035404(0x2e);
break;
case 0x2E:
sub_80344C0();
break;
case 0x2A:
sub_8035404(0xd);
break;
case 0x2C:
sub_8034478();
break;
case 0x2B:
sub_80344A0();
break;
case 0x25:
sub_8035404(0x26);
break;
case 0x26:
sub_803418C();
break;
case 0x27:
sub_8034254();
break;
case 0x28:
sub_8034310();
break;
case 0x24:
sub_8034378();
break;
case 0x29:
sub_80343C4();
break;
case 0x23:
sub_8035404(0x21);
break;
case 0x21:
sub_8034404();
break;
case 0x31:
sub_8035404(0x32);
break;
case 0x32:
sub_8034500();
break;
case 0x33:
sub_8034590();
break;
case 0x34:
sub_803464C();
break;
case 0x35:
sub_80346A8();
break;
case 0x38:
sub_80346D8();
break;
case 0x37:
sub_8034700();
break;
case 0x39:
sub_8034720();
break;
case 0x3A:
sub_803473C();
break;
case 0x20:
sub_8033FB4();
break;
case 0x1C:
sub_8035404(0x1d);
break;
case 0x1E:
sub_8034074();
break;
case 0x1F:
sub_8034130();
break;
case 0x1D:
sub_8033FE4();
break;
case 0x11:
sub_8035404(0x12);
break;
case 0x12:
nullsub_42();
break;
case 0x13:
nullsub_43();
break;
case 0x14:
nullsub_44();
break;
case 0x15:
nullsub_45();
break;
case 0x16:
sub_8033D74();
break;
case 0x17:
sub_8033D94();
break;
case 0x19:
case 0x43:
sub_8035404(0x1a);
break;
case 0x1A:
sub_8033DBC();
break;
case 0x1B:
sub_8033F64();
break;
case 5:
sub_8033C54();
break;
case 6:
nullsub_41();
break;
case 7:
sub_8033CAC();
break;
case 8:
sub_8033D48();
break;
case 9:
sub_8035424();
break;
case 10:
nullsub_50();
break;
case 0xB:
case 0xC:
sub_8035404(6);
break;
case 0xD:
sub_8035404(7);
break;
case 0xE:
sub_8033B8C();
break;
case 0:
case 1:
sub_80339C8();
break;
case 2:
return 3;
case 0x6A:
sub_80348C4();
break;
case 0x6B:
sub_803482C();
break;
case 0x5A:
sub_80349B0();
break;
case 0x5B:
sub_8035404(0x5c);
break;
case 0x5D:
sub_8034A70();
break;
case 0x5E:
sub_8034B2C();
break;
case 0x5C:
sub_80349E0();
break;
case 0x5F:
sub_8034B88();
break;
case 0x60:
sub_8034C98();
break;
case 0x61:
sub_8034C38();
break;
case 0x68:
sub_8034D54();
break;
case 0x66:
sub_8035404(0x67);
break;
case 0x67:
sub_8034970();
break;
case 0x74:
sub_80351E0();
break;
case 0x72:
sub_8035404(0x73);
break;
case 0x73:
sub_8034D74();
break;
case 0x71:
sub_8034EF0();
break;
case 0x70:
sub_8034F38();
break;
case 0x50:
case 0x6D:
sub_8035404(0x6e);
break;
case 0x6E:
sub_80352A4();
break;
case 0x62:
sub_8035404(0x6a);
break;
case 0x65:
sub_8034EC8();
break;
case 0x64:
sub_8034F18();
break;
case 0x63:
case 0x6F:
sub_8035404(0x62);
break;
case 0x69:
sub_8034F58();
break;
case 0x58:
sub_8034F88();
break;
case 0x75:
sub_8035018();
break;
case 0x76:
sub_8035038();
break;
case 0x18:
case 0x2F:
case 0x3B:
case 0x42:
case 0x59:
case 0x6C:
case 0x77:
sub_8035404(2);
break;
case 0x57:
sub_8035404(0x5f);
break;
case 0x56:
sub_8035094();
break;
case 0x55:
sub_80350F4();
break;
case 0x53:
sub_8035404(0x54);
break;
case 0x54:
sub_803517C();
break;
case 0x52:
sub_8035210();
break;
case 0x46:
sub_8035404(0x47);
break;
case 0x47:
nullsub_46();
break;
case 0x48:
nullsub_47();
break;
case 0x49:
nullsub_48();
break;
case 0x4A:
nullsub_49();
break;
case 0x4B:
sub_8035430();
break;
case 0x4C:
nullsub_51();
break;
case 0x4D:
case 0x4E:
sub_8035404(0x4f);
break;
case 0x4F:
sub_8034848();
break;
case 0xF:
case 0x10:
case 0x22:
case 0x30:
case 0x3C:
case 0x44:
case 0x45:
sub_8035404(1);
break;
case 0x51:
sub_8035404(1);
break;
case 0x36:
break;
}
return 0;
}
void CleanFriendRescueMenu(void)
{
if (gUnknown_203B33C != NULL) {
MemoryFree(gUnknown_203B33C);
gUnknown_203B33C = NULL;
sub_803084C();
sub_8031E10();
sub_8023C60();
sub_80155F0();
sub_801CBB8();
sub_802F2C0();
sub_8030DE4();
sub_802453C();
sub_801B450();
}
}
void nullsub_40(void)
{
}

141
src/friend_rescue_1.c Normal file
View File

@ -0,0 +1,141 @@
#include "global.h"
#include "friend_rescue.h"
#include "constants/species.h"
extern void sub_80338C4(u32);
extern s32 sub_80144A4(s32 *);
extern void sub_802F2C0();
extern void sub_808D8E0(u8 *, u32);
extern char * GetMonSpecies(u32);
extern u8 sub_809539C(u32, u32);
extern void sub_8095240(u8);
extern u32 sub_802F298();
extern char gUnknown_202E5D8[0x50];
extern char gAvailablePokemonNames[0x50];
extern struct WonderMailStruct_203B33C *gUnknown_203B33C;
void nullsub_46(void)
{
}
void nullsub_47(void)
{
}
void nullsub_48(void)
{
}
void nullsub_49(void)
{
}
void sub_80352A4(void)
{
u8 uVar1;
char *monName;
if ( sub_802F298() == 3) {
sub_802F2C0();
sub_808D8E0(gUnknown_202E5D8, SPECIES_PELIPPER);
monName = GetMonSpecies(SPECIES_PELIPPER);
strcpy(gAvailablePokemonNames, monName);
uVar1 = sub_809539C(6, gUnknown_203B33C->unk420);
sub_8095240(uVar1);
sub_80338C4(0x70);
}
}
void sub_8035300(void)
{
s32 temp;
if(sub_80144A4(&temp) != 0)
return;
switch(temp)
{
case 0x19:
sub_80338C4(1);
break;
case 0x1B:
sub_80338C4(0x7A);
break;
case 0x1C:
sub_80338C4(0x7C);
break;
case 0x1A:
case 0x1D:
gUnknown_203B33C->unk564 = temp;
sub_80338C4(0x79);
break;
}
}
void sub_8035374(void)
{
s32 temp;
if(sub_80144A4(&temp) != 0)
return;
switch(temp)
{
case 0x19:
sub_80338C4(0x78);
break;
case 0x1E:
case 0x1F:
case 0x20:
case 0x21:
case 0x22:
gUnknown_203B33C->unk564 = temp;
sub_80338C4(0x7B);
break;
}
}
void sub_80353BC(void)
{
s32 temp;
if(sub_80144A4(&temp) != 0)
return;
switch(temp)
{
case 0x19:
sub_80338C4(0x78);
break;
case 0x23:
case 0x24:
case 0x25:
case 0x26:
gUnknown_203B33C->unk564 = temp;
sub_80338C4(0x7D);
break;
}
}
void sub_8035404(u32 param_1)
{
s32 iVar1;
if(sub_80144A4(&iVar1) == 0){
sub_80338C4(param_1);
}
}
void sub_8035424(void)
{
sub_80338C4(6);
}
void sub_8035430(void)
{
sub_80338C4(0x4F);
}
void nullsub_50(void)
{
}
void nullsub_51(void)
{
}

View File

@ -1,26 +1,20 @@
#include "global.h"
#include "debug_menu.h"
#include "main_menu.h"
struct MainMenuSub
{
u8 unk2C;
u8 unk2D;
u8 unk2E;
};
// NOTE: 0x13 and 0x14
// Communication Screen?
// Got Communication warning when I wrote them to the struct
// NOTE: 0x29, 0x2A, 0x2B, 0x2C
// Triggers a save
// NOTE: 0x2D
// Triggers a save and then goes to 0x13 (comms warning)
// NOTE: 0x2E
// Deletes the Save
struct MainMenu
{
s32 unk0;
s32 unk4;
s32 unk8;
u8 padding[0x20];
/* 0x2C */ struct MainMenuSub sub;
u32 unk30;
u32 unk34;
s16 unk38;
u8 unk3A;
u8 unk3B;
s32 unk3C;
};
extern struct MainMenu *gUnknown_203B348;
extern void* MemoryAlloc(u32 a, u32 b);
@ -31,44 +25,41 @@ extern void MemoryFree(void *);
extern void sub_8094C14(void);
extern void sub_8099690(u32);
extern void DrawMainMenu(void);
extern void CreateDebugMenu(void);
extern void sub_8036400(void);
extern void sub_8036FDC(void);
extern void CreateTradeItemsMenu(void);
extern void sub_8036FDC(s32);
extern void sub_803A1E4(void);
extern void sub_803225C(void);
extern void CreateFriendRescueMenu(void);
extern void sub_803A1D8(void);
extern void sub_80398AC(void);
extern void sub_80382A0(void);
extern void CreateWonderMailMenu(void);
extern void CreateAdventureLogMenu(void);
extern void CreateLoadScreen(u32);
extern void sub_8035DB4(u32);
extern void sub_8038900(u32);
extern s32 sub_8035DB4(u32);
extern void CreateRescuePasswordMenu(u32);
extern void sub_803850C(u32);
extern s32 sub_8035EEC(void);
extern s32 UpdateMainMenu(void);
extern s32 sub_803941C(void);
extern s32 sub_8036448(void);
extern s32 sub_8032318(void);
extern s32 sub_8039928(void);
extern s32 UpdateTradeItemsMenu(void);
extern s32 UpdateFriendRescueMenu(void);
extern s32 UpdateWonderMailMenu(void);
extern s32 sub_803A1DC(void);
extern s32 sub_803A1E8(void);
extern s32 sub_8038A90(void);
extern s32 sub_80382C0(void);
extern s32 UpdateRescuePasswordMenu(void);
extern s32 UpdateAdventureLogMenu(void);
extern s32 sub_80383D4(void);
extern s32 sub_8038630(void);
extern s32 sub_803A2A4(void);
extern void CleanMainMenu(void);
extern void CleanLoadScreen(void);
extern void sub_8036B04(void);
extern void CleanTradeItemsMenu(void);
extern void sub_80370D4(void);
extern void sub_80327E4(void);
extern void sub_80399E4(void);
extern void CleanFriendRescueMenu(void);
extern void CleanWonderMailMenu(void);
extern void nullsub_55(void);
extern void sub_803A1EC(void);
extern void sub_8038A5C(void);
extern void sub_80382AC(void);
extern void CleanRescuePasswordMenu(void);
extern void CleanAdventureLogMenu(void);
extern void sub_80383A8(void);
extern void sub_8038604(void);
extern void DeleteDebugMenu(void);
void InitMainMenu(void)
{
@ -76,9 +67,9 @@ void InitMainMenu(void)
gUnknown_203B348 = MemoryAlloc(sizeof(struct MainMenu),8);
MemoryFill8((u8 *)gUnknown_203B348, 0, sizeof(struct MainMenu));
}
gUnknown_203B348->unk0 = 0xffdc;
gUnknown_203B348->unk4 = 1;
gUnknown_203B348->unk8 = 1;
gUnknown_203B348->currMenu = 0xffdc;
gUnknown_203B348->nextMenu = MENU_MAIN_SCREEN;
gUnknown_203B348->lastMenu = MENU_MAIN_SCREEN;
gUnknown_203B348->unk38 = -1;
gUnknown_203B348->unk3C = -1;
gUnknown_203B348->sub.unk2E = 0;
@ -98,32 +89,31 @@ void DeleteMainMenu(void)
void SetUpMenu(void)
{
if (gUnknown_203B348->unk0 != gUnknown_203B348->unk4) {
switch(gUnknown_203B348->unk4) {
case 1:
if (gUnknown_203B348->currMenu != gUnknown_203B348->nextMenu) {
switch(gUnknown_203B348->nextMenu) {
case MENU_MAIN_SCREEN:
sub_8094C14();
sub_8099690(0);
DrawMainMenu();
break;
case 6:
case 7:
case 8:
case MENU_CONTINUE:
case MENU_DELETE_SAVE_PROMPT:
case 9:
CreateLoadScreen(gUnknown_203B348->unk4);
CreateLoadScreen(gUnknown_203B348->nextMenu);
break;
case 0xc:
sub_8036400();
case MENU_TRADE_ITEMS:
CreateTradeItemsMenu();
break;
case 0x13:
case 0x14:
sub_8035DB4(gUnknown_203B348->unk4);
sub_8036FDC();
case MENU_COMMUNICATION_1:
case MENU_COMMUNICATION_2:
sub_8036FDC(sub_8035DB4(gUnknown_203B348->nextMenu));
break;
case 0xb:
sub_803225C();
case MENU_FRIEND_RESCUE:
CreateFriendRescueMenu();
break;
case 0xd:
sub_80398AC();
case MENU_WONDER_MAIL:
CreateWonderMailMenu();
break;
case 0xe:
sub_803A1D8();
@ -131,12 +121,12 @@ void SetUpMenu(void)
case 0xf:
sub_803A1E4();
break;
case 0x21:
case 0x22:
sub_8038900(gUnknown_203B348->unk4);
case MENU_DISPLAY_RESCUE_PASSWORD:
case MENU_RESCUE_PASSWORD_ENTRY:
CreateRescuePasswordMenu(gUnknown_203B348->nextMenu);
break;
case 0xA:
sub_80382A0();
case MENU_ADVENTURE_LOG:
CreateAdventureLogMenu();
break;
case 0x29:
case 0x2a:
@ -144,80 +134,80 @@ void SetUpMenu(void)
case 0x2c:
case 0x2d:
case 0x2e:
sub_803850C(gUnknown_203B348->unk4);
sub_803850C(gUnknown_203B348->nextMenu);
break;
case 0x10:
case MENU_DEBUG:
CreateDebugMenu();
break;
}
gUnknown_203B348->unk0 = gUnknown_203B348->unk4;
gUnknown_203B348->currMenu = gUnknown_203B348->nextMenu;
}
}
s32 UpdateMenu(void)
{
s32 iVar1;
s32 iVar2;
s32 nextMenu;
iVar2 = 0xffdc;
switch(gUnknown_203B348->unk4) {
case 1:
iVar2 = sub_8035EEC();
nextMenu = MENU_NO_SCREEN_CHANGE;
switch(gUnknown_203B348->nextMenu) {
case MENU_MAIN_SCREEN:
nextMenu = UpdateMainMenu();
break;
case 6:
case 7:
case 8:
case MENU_CONTINUE:
case MENU_DELETE_SAVE_PROMPT:
case 9:
iVar2 = sub_803941C();
nextMenu = sub_803941C();
break;
case 0xc:
iVar1 = sub_8036448();
iVar2 = 1;
case MENU_TRADE_ITEMS:
iVar1 = UpdateTradeItemsMenu();
nextMenu = MENU_MAIN_SCREEN;
if (iVar1 != 3) {
iVar2 = 0xffdc;
nextMenu = MENU_NO_SCREEN_CHANGE;
}
break;
case 0xb:
iVar1 = sub_8032318();
iVar2 = 1;
case MENU_FRIEND_RESCUE:
iVar1 = UpdateFriendRescueMenu();
nextMenu = MENU_MAIN_SCREEN;
if (iVar1 != 3) {
iVar2 = 0xffdc;
nextMenu = MENU_NO_SCREEN_CHANGE;
}
break;
case 0xd:
iVar1 = sub_8039928();
iVar2 = 1;
case MENU_WONDER_MAIL:
iVar1 = UpdateWonderMailMenu();
nextMenu = MENU_MAIN_SCREEN;
if (iVar1 != 3) {
iVar2 = 0xffdc;
nextMenu = MENU_NO_SCREEN_CHANGE;
}
break;
case 0xe:
iVar1 = sub_803A1DC();
iVar2 = 1;
nextMenu = MENU_MAIN_SCREEN;
if (iVar1 != 3) {
iVar2 = 0xffdc;
nextMenu = MENU_NO_SCREEN_CHANGE;
}
break;
case 0xf:
iVar1 = sub_803A1E8();
iVar2 = 5;
if ((iVar1 != 3) && (iVar2 = 0xffdc, iVar1 == 2)) {
iVar2 = 1;
nextMenu = 5;
if ((iVar1 != 3) && (nextMenu = MENU_NO_SCREEN_CHANGE, iVar1 == 2)) {
nextMenu = MENU_MAIN_SCREEN;
}
break;
case 0x21:
case 0x22:
iVar2 = sub_8038A90();
case MENU_DISPLAY_RESCUE_PASSWORD:
case MENU_RESCUE_PASSWORD_ENTRY:
nextMenu = UpdateRescuePasswordMenu();
break;
case 10:
iVar2 = sub_80382C0();
case MENU_ADVENTURE_LOG:
nextMenu = UpdateAdventureLogMenu();
break;
case 0x24:
case 0x25:
case 0x26:
case 0x27:
case 0x28:
iVar2 = sub_80383D4();
nextMenu = sub_80383D4();
break;
case 0x29:
case 0x2a:
@ -225,43 +215,43 @@ s32 UpdateMenu(void)
case 0x2c:
case 0x2d:
case 0x2e:
iVar2 = sub_8038630();
nextMenu = sub_8038630();
break;
case 0x10:
iVar2 = sub_803A2A4();
case MENU_DEBUG:
nextMenu = UpdateDebugMenu();
break;
}
if (iVar2 != 0xffdc) {
gUnknown_203B348->unk4 = iVar2;
if (nextMenu != MENU_NO_SCREEN_CHANGE) {
gUnknown_203B348->nextMenu = nextMenu;
}
return iVar2;
return nextMenu;
}
void CleanUpMenu(void)
{
if (gUnknown_203B348->unk8 != gUnknown_203B348->unk4) {
switch(gUnknown_203B348->unk8) {
case 1:
if (gUnknown_203B348->lastMenu != gUnknown_203B348->nextMenu) {
switch(gUnknown_203B348->lastMenu) {
case MENU_MAIN_SCREEN:
CleanMainMenu();
break;
case 6:
case 7:
case 8:
case MENU_CONTINUE:
case MENU_DELETE_SAVE_PROMPT:
case 9:
CleanLoadScreen();
break;
case 0xc:
sub_8036B04();
case MENU_TRADE_ITEMS:
CleanTradeItemsMenu();
break;
case 0x13:
case 0x14:
case MENU_COMMUNICATION_1:
case MENU_COMMUNICATION_2:
sub_80370D4();
break;
case 0xb:
sub_80327E4();
case MENU_FRIEND_RESCUE:
CleanFriendRescueMenu();
break;
case 0xd:
sub_80399E4();
case MENU_WONDER_MAIL:
CleanWonderMailMenu();
break;
case 0xe:
nullsub_55();
@ -269,12 +259,12 @@ void CleanUpMenu(void)
case 0xf:
sub_803A1EC();
break;
case 0x21:
case 0x22:
sub_8038A5C();
case MENU_DISPLAY_RESCUE_PASSWORD:
case MENU_RESCUE_PASSWORD_ENTRY:
CleanRescuePasswordMenu();
break;
case 10:
sub_80382AC();
case MENU_ADVENTURE_LOG:
CleanAdventureLogMenu();
break;
case 0x24:
case 0x25:
@ -291,11 +281,11 @@ void CleanUpMenu(void)
case 0x2e:
sub_8038604();
break;
case 0x10:
case MENU_DEBUG:
DeleteDebugMenu();
break;
}
gUnknown_203B348->unk8 = gUnknown_203B348->unk4;
gUnknown_203B348->lastMenu = gUnknown_203B348->nextMenu;
}
}

80
src/main_menu_mid.c Normal file
View File

@ -0,0 +1,80 @@
#include "global.h"
#include "main_menu.h"
#include "input.h"
struct unkData
{
u8 unk0[24];
};
extern struct MainMenu *gUnknown_203B348;
extern struct unkData gUnknown_80E59A8;
extern void sub_8006518();
extern void sub_800641C(struct unkData *, u32, u32);
void sub_8035CC0(struct unkData *dataArray, u32 index)
{
sub_8006518();
dataArray[index] = gUnknown_80E59A8;
ResetUnusedInputStruct();
sub_800641C(dataArray, 1, 1);
}
NAKED
void sub_8035CF4(void * Menu, u32 index, u8 r2)
{
asm_unified("\tpush {lr}\n"
"\tadds r3, r0, 0\n"
"\tlsls r0, r1, 2\n"
"\tadds r0, r1\n"
"\tlsls r0, 4\n"
"\tadds r0, r3\n"
"\tadds r1, r0, 0\n"
"\tadds r1, 0x4C\n"
"\tstrb r2, [r1]\n"
"\tadds r2, r0, 0\n"
"\tadds r2, 0x4D\n"
"\tmovs r1, 0x1\n"
"\tstrb r1, [r2]\n"
"\tsubs r1, 0x2\n"
"\tstr r1, [r0, 0x48]\n"
"\tbl sub_8012EBC\n"
"\tpop {r0}\n"
"\tbx r0");
}
void sub_8035D1C(void)
{
gUnknown_203B348->unk38 = -1;
}
void sub_8035D30(s32 r0)
{
gUnknown_203B348->unk38 = r0;
}
s16 sub_8035D3C(void)
{
return gUnknown_203B348->unk38;
}
s32 *sub_8035D4C(void)
{
return &gUnknown_203B348->currMenu;
}
void sub_8035D58(void)
{
gUnknown_203B348->unk3C = -1;
}
void sub_8035D68(s32 r0)
{
gUnknown_203B348->unk3C = r0;
}
s32 sub_8035D74(void)
{
return gUnknown_203B348->unk3C;
}

View File

@ -600,7 +600,7 @@ u16 GetCurrentBGSong(void)
#ifdef NONMATCHING
// TODO fix reg allocation.. using one too many regs
void sub_800C074(u16 SongIndex,u16 param_2)
void sub_800C074(u16 SongIndex, u16 param_2)
{
bool8 interrupt_flag;
u16 msVar;

View File

@ -18,6 +18,21 @@ extern void sub_8001044(u32 *);
struct PersonalityAnswer
{
const char * text;
int effect;
};
struct PersonalityQuestion
{
const char * question;
const struct PersonalityAnswer * answers;
const u8 (*effects[16]);
};
extern struct PersonalityQuestion *gPersonalityQuestionPointerTable[NUM_QUIZ_QUESTIONS];
struct UnkSaveStruct1
{
/* 0x0 */ u32 unk0;
@ -51,8 +66,8 @@ extern u32 sub_80144A4(s32 *);
extern void sub_803CE6C(void);
extern char* GetMonSpecies(u32);
extern void CopyStringtoBuffer(s32 *r0, char *r1);
extern void sub_801602C(u32, s32 *r0);
extern void CopyStringtoBuffer(char *r0, char *r1);
extern void sub_801602C(u32, char *r0);
extern u32 sub_8016080(void);
extern void sub_80160D8(void);
@ -73,7 +88,7 @@ extern void sub_8013818(u32 *r0, s32, u32, u32);
extern u32 GetKeyPress(struct UnkInputStruct **r0);
extern u8 sub_80138B8(struct UnkInputStruct **r0, u32);
extern void sub_80119D4(u32);
extern void PlayMenuSoundEffect(u32);
extern void sub_8013984(struct UnkInputStruct **r0);
@ -503,13 +518,9 @@ void sub_803CB5C(void)
void sub_803CB7C(void)
{
char *monName;
s32 *iVar2;
iVar2 = &gUnknown_203B400->unk20;
monName = GetMonSpecies(gUnknown_203B400->PartnerID);
CopyStringtoBuffer(iVar2, monName);
sub_801602C(3, &gUnknown_203B400->unk20);
CopyStringtoBuffer(gUnknown_203B400->PartnerNick, GetMonSpecies(gUnknown_203B400->PartnerID));
sub_801602C(3, gUnknown_203B400->PartnerNick);
gUnknown_203B400->TestState = 13;
}
@ -531,38 +542,12 @@ void sub_803CBE4(void)
}
}
NAKED
void PromptNewQuestion(void)
{
asm_unified(
"\tpush {lr}\n"
"\tsub sp, 0x14\n"
"\tldr r1, _0803CC38\n"
"\tldr r0, _0803CC3C\n"
"\tldr r0, [r0]\n"
"\tldr r0, [r0, 0x3C]\n"
"\tlsls r0, 2\n"
"\tadds r0, r1\n"
"\tldr r1, [r0]\n"
"\tldr r0, [r1]\n"
"\tldr r3, [r1, 0x4]\n"
"\tmovs r2, 0\n"
"\tstr r2, [sp]\n"
"\tmovs r1, 0x3\n"
"\tstr r1, [sp, 0x4]\n"
"\tstr r2, [sp, 0x8]\n"
"\tstr r2, [sp, 0xC]\n"
"\tadds r1, 0xFE\n"
"\tstr r1, [sp, 0x10]\n"
"\tmovs r1, 0\n"
"\tbl sub_8014248\n"
"\tadd sp, 0x14\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.align 2, 0\n"
"_0803CC38: .4byte gPersonalityQuestionPointerTable\n"
"_0803CC3C: .4byte gUnknown_203B400"
);
sub_8014248(gPersonalityQuestionPointerTable[gUnknown_203B400->currQuestionIndex]->question,
0, 0,
(void *)gPersonalityQuestionPointerTable[gUnknown_203B400->currQuestionIndex]->answers,
0, 3, 0, 0, 0x101);
}
void PrintPersonalityTypeDescription(void)
@ -724,7 +709,7 @@ u16 HandlePartnerSelectionInput(void)
sVar1 = gUnknown_203B404->currPartnerSelection;
gUnknown_203B404->unk16 = 0;
if (GetKeyPress(&gUnknown_203B404->unk18) == A_BUTTON) {
sub_80119D4(0);
PlayMenuSoundEffect(0);
return gUnknown_203B404->PartnerArray[gUnknown_203B404->currPartnerSelection];
}
else {
@ -735,10 +720,10 @@ u16 HandlePartnerSelectionInput(void)
PersonalityTest_DisplayPartnerSprite();
}
if (gUnknown_203B404->unk16 != '\0') {
return 0xfffe;
return -2;
}
else {
return 0xffff;
return -1;
}
}
}

View File

@ -148,8 +148,8 @@ extern u32 sub_8097680(void);
extern u32 *sub_809769C(void);
extern void sub_80974E8(void);
extern void sub_8097748(void);
extern u8 *sub_8097F6C(void);
extern void sub_8097F74(void);
extern u8 *GetExclusivePokemon(void);
extern void InitializeExclusivePokemon(void);
extern void sub_80993D8(void);
extern struct PlayTimeStruct *gPlayTimeRef;
@ -587,7 +587,7 @@ void sub_8012300(void)
sub_8095900();
sub_80974E8();
sub_8094998(1);
sub_8097F74();
InitializeExclusivePokemon();
}
@ -611,10 +611,10 @@ void sub_8012334(struct UnkStruct_203B184 *r0)
gUnknown_203B490 = r0->unk18;
gUnknown_203B464 = r0->unk1C;
gUnknown_203B494 = r0->unk20;
gUnknown_203B498 = r0->unk24;
gUnknown_203B498 = r0->ExclusivePokemon;
gFriendAreas = r0->BoughtFriendAreas;
gUnknown_203B46C = r0->unk2C;
gPlayTimeRef = r0->playTime;
gPlayTimeRef = r0->playTime;
return;
}
gUnknown_203B460 = sub_80909D0();
@ -626,7 +626,7 @@ void sub_8012334(struct UnkStruct_203B184 *r0)
gUnknown_203B490 = sub_80958F8();
gUnknown_203B464 = sub_809208C();
gUnknown_203B494 = sub_8097680();
gUnknown_203B498 = sub_8097F6C();
gUnknown_203B498 = GetExclusivePokemon();
gFriendAreas = GetBoughtFriendAreas();
gUnknown_203B46C = sub_8094990();
gPlayTimeRef = GetPlayTime();

View File

@ -549,23 +549,16 @@ void sub_8028ED4()
{
return;
}
if(temp == 8)
{
sub_8028B04(11);
}
else
{
switch(temp){
case 8:
sub_8028B04(2);
break;
case 9:
case 10:
sub_8028B04(2);
break;
default:
break;
}
switch(temp){
case 8:
sub_8028B04(11);
break;
case 9:
case 10:
sub_8028B04(2);
break;
default:
break;
}
}

View File

@ -1,73 +0,0 @@
#include "global.h"
extern void sub_80338C4(u32);
extern u32 *gUnknown_203B33C;
extern s32 sub_80144A4(s32 *);
void sub_8035374(void)
{
s32 temp;
if(sub_80144A4(&temp) != 0)
return;
switch(temp)
{
case 0x19:
sub_80338C4(0x78);
break;
case 0x1E:
case 0x1F:
case 0x20:
case 0x21:
case 0x22:
gUnknown_203B33C[0x159] = temp;
sub_80338C4(0x7B);
break;
}
}
void sub_80353BC(void)
{
s32 temp;
if(sub_80144A4(&temp) != 0)
return;
switch(temp)
{
case 0x19:
sub_80338C4(0x78);
break;
case 0x23:
case 0x24:
case 0x25:
case 0x26:
gUnknown_203B33C[0x159] = temp;
sub_80338C4(0x7D);
break;
}
}
void sub_8035404(u32 param_1)
{
s32 iVar1;
if(sub_80144A4(&iVar1) == 0){
sub_80338C4(param_1);
}
}
void sub_8035424(void)
{
sub_80338C4(6);
}
void sub_8035430(void)
{
sub_80338C4(0x4F);
}
void nullsub_50(void)
{
}
void nullsub_51(void)
{
}

View File

@ -0,0 +1,44 @@
#include "global.h"
#include "input.h"
extern u8 *gUnknown_203B3E8;
extern void sub_800641C(void *, u32, u32);
extern void nullsub_54();
extern void sub_8039E18();
void sub_803A1C0(u8 r0)
{
*gUnknown_203B3E8 = r0;
nullsub_54();
sub_8039E18();
}
u32 sub_803A1D8(void)
{
return 1;
}
u32 sub_803A1DC(void)
{
return 0;
}
void nullsub_55()
{
}
u32 sub_803A1E4(void)
{
return 1;
}
u32 sub_803A1E8(void)
{
return 2;
}
void sub_803A1EC(void)
{
ResetUnusedInputStruct();
sub_800641C(NULL, 1, 1);
}