mirror of
https://github.com/pret/pokeheartgold.git
synced 2024-12-12 15:16:55 +00:00
Decompile unk_02090C94
This commit is contained in:
parent
1a9c0fcc69
commit
18c8125207
@ -1,702 +0,0 @@
|
||||
#include "constants/items.h"
|
||||
#include "constants/moves.h"
|
||||
#include "constants/species.h"
|
||||
#include "constants/maps.h"
|
||||
.include "asm/macros.inc"
|
||||
.include "global.inc"
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_02090C94
|
||||
sub_02090C94: ; 0x02090C94
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r5, r0, #0
|
||||
add r7, r1, #0
|
||||
ldr r0, [sp, #0x18]
|
||||
mov r1, #0x28
|
||||
add r6, r2, #0
|
||||
str r3, [sp]
|
||||
bl AllocFromHeap
|
||||
add r4, r0, #0
|
||||
strb r5, [r4]
|
||||
strb r7, [r4, #1]
|
||||
add r0, r6, #0
|
||||
bl Sav2_Pokedex_get
|
||||
str r0, [r4, #0xc]
|
||||
add r0, r6, #0
|
||||
bl SaveData_EasyChat_get
|
||||
str r0, [r4, #0x10]
|
||||
add r0, r6, #0
|
||||
bl SavArray_Flags_get
|
||||
bl CheckGameClearFlag
|
||||
strb r0, [r4, #4]
|
||||
mov r1, #0
|
||||
strb r1, [r4, #5]
|
||||
mov r0, #1
|
||||
strb r0, [r4, #2]
|
||||
strb r1, [r4, #3]
|
||||
add r0, r6, #0
|
||||
bl Sav2_PlayerData_GetOptionsAddr
|
||||
bl Options_GetFrame
|
||||
str r0, [r4, #8]
|
||||
ldr r0, [sp]
|
||||
cmp r5, #2
|
||||
str r0, [r4, #0x24]
|
||||
bne _02090CF2
|
||||
add r0, r4, #0
|
||||
add r0, #0x14
|
||||
mov r1, #3
|
||||
bl MailMsg_init_withBank
|
||||
b _02090D02
|
||||
_02090CF2:
|
||||
ldr r0, _02090D08 ; =0x0000FFFF
|
||||
mov r1, #0
|
||||
add r2, r4, #0
|
||||
_02090CF8:
|
||||
add r1, r1, #1
|
||||
strh r0, [r2, #0x1c]
|
||||
add r2, r2, #2
|
||||
cmp r1, #2
|
||||
blt _02090CF8
|
||||
_02090D02:
|
||||
add r0, r4, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
nop
|
||||
_02090D08: .word 0x0000FFFF
|
||||
thumb_func_end sub_02090C94
|
||||
|
||||
thumb_func_start sub_02090D0C
|
||||
sub_02090D0C: ; 0x02090D0C
|
||||
ldr r3, _02090D10 ; =FreeToHeap
|
||||
bx r3
|
||||
.balign 4, 0
|
||||
_02090D10: .word FreeToHeap
|
||||
thumb_func_end sub_02090D0C
|
||||
|
||||
thumb_func_start sub_02090D14
|
||||
sub_02090D14: ; 0x02090D14
|
||||
strh r1, [r0, #0x1c]
|
||||
bx lr
|
||||
thumb_func_end sub_02090D14
|
||||
|
||||
thumb_func_start sub_02090D18
|
||||
sub_02090D18: ; 0x02090D18
|
||||
strh r1, [r0, #0x1c]
|
||||
strh r2, [r0, #0x1e]
|
||||
bx lr
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090D18
|
||||
|
||||
thumb_func_start sub_02090D20
|
||||
sub_02090D20: ; 0x02090D20
|
||||
ldrh r2, [r1]
|
||||
strh r2, [r0, #0x14]
|
||||
ldrh r2, [r1, #2]
|
||||
strh r2, [r0, #0x16]
|
||||
ldrh r2, [r1, #4]
|
||||
strh r2, [r0, #0x18]
|
||||
ldrh r1, [r1, #6]
|
||||
strh r1, [r0, #0x1a]
|
||||
bx lr
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090D20
|
||||
|
||||
thumb_func_start sub_02090D34
|
||||
sub_02090D34: ; 0x02090D34
|
||||
mov r1, #1
|
||||
strb r1, [r0, #2]
|
||||
mov r1, #0
|
||||
strb r1, [r0, #3]
|
||||
bx lr
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090D34
|
||||
|
||||
thumb_func_start sub_02090D40
|
||||
sub_02090D40: ; 0x02090D40
|
||||
mov r1, #1
|
||||
strb r1, [r0, #5]
|
||||
bx lr
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090D40
|
||||
|
||||
thumb_func_start sub_02090D48
|
||||
sub_02090D48: ; 0x02090D48
|
||||
ldrb r0, [r0, #2]
|
||||
bx lr
|
||||
thumb_func_end sub_02090D48
|
||||
|
||||
thumb_func_start sub_02090D4C
|
||||
sub_02090D4C: ; 0x02090D4C
|
||||
ldrb r0, [r0, #3]
|
||||
bx lr
|
||||
thumb_func_end sub_02090D4C
|
||||
|
||||
thumb_func_start sub_02090D50
|
||||
sub_02090D50: ; 0x02090D50
|
||||
ldrh r0, [r0, #0x1c]
|
||||
bx lr
|
||||
thumb_func_end sub_02090D50
|
||||
|
||||
thumb_func_start sub_02090D54
|
||||
sub_02090D54: ; 0x02090D54
|
||||
ldrh r2, [r0, #0x1c]
|
||||
strh r2, [r1]
|
||||
ldrh r0, [r0, #0x1e]
|
||||
strh r0, [r1, #2]
|
||||
bx lr
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090D54
|
||||
|
||||
thumb_func_start sub_02090D60
|
||||
sub_02090D60: ; 0x02090D60
|
||||
add r2, r0, #0
|
||||
ldr r3, _02090D6C ; =MailMsg_copy
|
||||
add r2, #0x14
|
||||
add r0, r1, #0
|
||||
add r1, r2, #0
|
||||
bx r3
|
||||
.balign 4, 0
|
||||
_02090D6C: .word MailMsg_copy
|
||||
thumb_func_end sub_02090D60
|
||||
|
||||
thumb_func_start sub_02090D70
|
||||
sub_02090D70: ; 0x02090D70
|
||||
ldrb r0, [r0]
|
||||
bx lr
|
||||
thumb_func_end sub_02090D70
|
||||
|
||||
thumb_func_start sub_02090D74
|
||||
sub_02090D74: ; 0x02090D74
|
||||
ldrb r0, [r0, #1]
|
||||
bx lr
|
||||
thumb_func_end sub_02090D74
|
||||
|
||||
thumb_func_start sub_02090D78
|
||||
sub_02090D78: ; 0x02090D78
|
||||
ldr r0, [r0, #8]
|
||||
bx lr
|
||||
thumb_func_end sub_02090D78
|
||||
|
||||
thumb_func_start sub_02090D7C
|
||||
sub_02090D7C: ; 0x02090D7C
|
||||
ldr r0, [r0, #0xc]
|
||||
bx lr
|
||||
thumb_func_end sub_02090D7C
|
||||
|
||||
thumb_func_start sub_02090D80
|
||||
sub_02090D80: ; 0x02090D80
|
||||
ldr r0, [r0, #0x10]
|
||||
bx lr
|
||||
thumb_func_end sub_02090D80
|
||||
|
||||
thumb_func_start sub_02090D84
|
||||
sub_02090D84: ; 0x02090D84
|
||||
ldrb r0, [r0, #4]
|
||||
bx lr
|
||||
thumb_func_end sub_02090D84
|
||||
|
||||
thumb_func_start sub_02090D88
|
||||
sub_02090D88: ; 0x02090D88
|
||||
ldrb r0, [r0, #5]
|
||||
bx lr
|
||||
thumb_func_end sub_02090D88
|
||||
|
||||
thumb_func_start sub_02090D8C
|
||||
sub_02090D8C: ; 0x02090D8C
|
||||
ldrb r3, [r0]
|
||||
cmp r3, #0
|
||||
beq _02090D9C
|
||||
cmp r3, #1
|
||||
beq _02090DA2
|
||||
cmp r3, #2
|
||||
beq _02090DAC
|
||||
bx lr
|
||||
_02090D9C:
|
||||
ldrh r0, [r0, #0x1c]
|
||||
strh r0, [r1]
|
||||
bx lr
|
||||
_02090DA2:
|
||||
ldrh r2, [r0, #0x1c]
|
||||
strh r2, [r1]
|
||||
ldrh r0, [r0, #0x1e]
|
||||
strh r0, [r1, #2]
|
||||
bx lr
|
||||
_02090DAC:
|
||||
ldrh r1, [r0, #0x14]
|
||||
strh r1, [r2]
|
||||
ldrh r1, [r0, #0x16]
|
||||
strh r1, [r2, #2]
|
||||
ldrh r1, [r0, #0x18]
|
||||
strh r1, [r2, #4]
|
||||
ldrh r0, [r0, #0x1a]
|
||||
strh r0, [r2, #6]
|
||||
bx lr
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090D8C
|
||||
|
||||
thumb_func_start sub_02090DC0
|
||||
sub_02090DC0: ; 0x02090DC0
|
||||
push {r3, lr}
|
||||
ldrb r3, [r0]
|
||||
cmp r3, #0
|
||||
beq _02090DD0
|
||||
cmp r3, #1
|
||||
beq _02090DE0
|
||||
cmp r3, #2
|
||||
b _02090DF8
|
||||
_02090DD0:
|
||||
ldrh r1, [r1]
|
||||
ldrh r0, [r0, #0x1c]
|
||||
cmp r1, r0
|
||||
bne _02090DDC
|
||||
mov r0, #1
|
||||
pop {r3, pc}
|
||||
_02090DDC:
|
||||
mov r0, #0
|
||||
pop {r3, pc}
|
||||
_02090DE0:
|
||||
ldrh r3, [r1]
|
||||
ldrh r2, [r0, #0x1c]
|
||||
cmp r3, r2
|
||||
bne _02090DF4
|
||||
ldrh r1, [r1, #2]
|
||||
ldrh r0, [r0, #0x1e]
|
||||
cmp r1, r0
|
||||
bne _02090DF4
|
||||
mov r0, #1
|
||||
pop {r3, pc}
|
||||
_02090DF4:
|
||||
mov r0, #0
|
||||
pop {r3, pc}
|
||||
_02090DF8:
|
||||
add r0, #0x14
|
||||
add r1, r2, #0
|
||||
bl MailMsg_compare
|
||||
pop {r3, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090DC0
|
||||
|
||||
thumb_func_start sub_02090E04
|
||||
sub_02090E04: ; 0x02090E04
|
||||
push {r4, r5, r6, lr}
|
||||
add r5, r0, #0
|
||||
add r4, r1, #0
|
||||
add r6, r2, #0
|
||||
bl sub_02090DC0
|
||||
cmp r0, #0
|
||||
bne _02090E18
|
||||
mov r0, #1
|
||||
b _02090E1A
|
||||
_02090E18:
|
||||
mov r0, #0
|
||||
_02090E1A:
|
||||
strb r0, [r5, #3]
|
||||
mov r1, #0
|
||||
strb r1, [r5, #2]
|
||||
add r2, r5, #0
|
||||
_02090E22:
|
||||
ldrh r0, [r4]
|
||||
add r1, r1, #1
|
||||
add r4, r4, #2
|
||||
strh r0, [r2, #0x1c]
|
||||
add r2, r2, #2
|
||||
cmp r1, #2
|
||||
blt _02090E22
|
||||
ldrh r0, [r6]
|
||||
strh r0, [r5, #0x14]
|
||||
ldrh r0, [r6, #2]
|
||||
strh r0, [r5, #0x16]
|
||||
ldrh r0, [r6, #4]
|
||||
strh r0, [r5, #0x18]
|
||||
ldrh r0, [r6, #6]
|
||||
strh r0, [r5, #0x1a]
|
||||
pop {r4, r5, r6, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090E04
|
||||
|
||||
thumb_func_start sub_02090E44
|
||||
sub_02090E44: ; 0x02090E44
|
||||
push {r3, lr}
|
||||
cmp r0, #0
|
||||
beq _02090E50
|
||||
ldr r0, [r0, #0x24]
|
||||
cmp r0, #0
|
||||
bne _02090E54
|
||||
_02090E50:
|
||||
mov r0, #0
|
||||
pop {r3, pc}
|
||||
_02090E54:
|
||||
bl sub_020183F0
|
||||
pop {r3, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090E44
|
||||
|
||||
thumb_func_start sub_02090E5C
|
||||
sub_02090E5C: ; 0x02090E5C
|
||||
ldr r3, _02090E64 ; =sub_02018410
|
||||
ldr r0, [r0, #0x24]
|
||||
bx r3
|
||||
nop
|
||||
_02090E64: .word sub_02018410
|
||||
thumb_func_end sub_02090E5C
|
||||
|
||||
thumb_func_start sub_02090E68
|
||||
sub_02090E68: ; 0x02090E68
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
sub sp, #8
|
||||
add r5, r0, #0
|
||||
add r7, r1, #0
|
||||
add r6, r2, #0
|
||||
str r3, [sp]
|
||||
bl Sav2_Mailbox_get
|
||||
str r0, [sp, #4]
|
||||
ldr r0, [sp, #0x20]
|
||||
mov r1, #0x20
|
||||
bl AllocFromHeapAtEnd
|
||||
mov r1, #0
|
||||
mov r2, #0x20
|
||||
add r4, r0, #0
|
||||
bl MI_CpuFill8
|
||||
ldr r0, [sp]
|
||||
strb r0, [r4, #0xf]
|
||||
ldr r0, [sp, #4]
|
||||
strb r6, [r4, #0xe]
|
||||
str r0, [r4, #0x18]
|
||||
mov r0, #1
|
||||
strh r0, [r4]
|
||||
str r7, [r4, #8]
|
||||
mov r0, #0
|
||||
strh r0, [r4, #0xc]
|
||||
ldr r0, [sp, #0x20]
|
||||
str r5, [r4, #0x10]
|
||||
bl Mail_new
|
||||
str r0, [r4, #0x14]
|
||||
bl Mail_init
|
||||
ldr r0, [r4, #0x14]
|
||||
mov r1, #0xff
|
||||
add r2, r6, #0
|
||||
add r3, r5, #0
|
||||
bl Mail_SetNewMessageDetails
|
||||
add r0, r4, #0
|
||||
add sp, #8
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
thumb_func_end sub_02090E68
|
||||
|
||||
thumb_func_start sub_02090EC0
|
||||
sub_02090EC0: ; 0x02090EC0
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r7, r0, #0
|
||||
add r5, r1, #0
|
||||
add r0, r3, #0
|
||||
mov r1, #0x20
|
||||
add r6, r2, #0
|
||||
str r3, [sp]
|
||||
bl AllocFromHeapAtEnd
|
||||
mov r1, #0
|
||||
mov r2, #0x20
|
||||
add r4, r0, #0
|
||||
bl MI_CpuFill8
|
||||
mov r0, #0
|
||||
strh r0, [r4]
|
||||
str r5, [r4, #8]
|
||||
strh r6, [r4, #0xc]
|
||||
add r0, r7, #0
|
||||
str r7, [r4, #0x10]
|
||||
bl Sav2_Mailbox_get
|
||||
ldr r3, [sp]
|
||||
add r1, r5, #0
|
||||
add r2, r6, #0
|
||||
str r0, [r4, #0x18]
|
||||
bl Mailbox_AllocAndFetchMailI
|
||||
str r0, [r4, #0x14]
|
||||
add r0, r4, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090EC0
|
||||
|
||||
thumb_func_start sub_02090F00
|
||||
sub_02090F00: ; 0x02090F00
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r7, r2, #0
|
||||
add r5, r0, #0
|
||||
add r6, r1, #0
|
||||
add r0, r7, #0
|
||||
mov r1, #0x20
|
||||
bl AllocFromHeapAtEnd
|
||||
mov r1, #0
|
||||
mov r2, #0x20
|
||||
add r4, r0, #0
|
||||
bl MI_CpuFill8
|
||||
mov r0, #0
|
||||
strh r0, [r4]
|
||||
str r5, [r4, #0x10]
|
||||
add r0, r7, #0
|
||||
bl Mail_new
|
||||
str r0, [r4, #0x14]
|
||||
ldr r2, [r4, #0x14]
|
||||
add r0, r6, #0
|
||||
mov r1, #0xaa
|
||||
bl GetMonData
|
||||
add r0, r4, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090F00
|
||||
|
||||
thumb_func_start sub_02090F38
|
||||
sub_02090F38: ; 0x02090F38
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r7, r2, #0
|
||||
add r5, r0, #0
|
||||
add r6, r1, #0
|
||||
add r0, r7, #0
|
||||
mov r1, #0x20
|
||||
bl AllocFromHeapAtEnd
|
||||
mov r1, #0
|
||||
mov r2, #0x20
|
||||
add r4, r0, #0
|
||||
bl MI_CpuFill8
|
||||
mov r0, #0
|
||||
strh r0, [r4]
|
||||
add r0, r7, #0
|
||||
str r5, [r4, #0x10]
|
||||
bl Mail_new
|
||||
add r1, r6, #0
|
||||
str r0, [r4, #0x14]
|
||||
bl Mail_SetType
|
||||
add r0, r4, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090F38
|
||||
|
||||
thumb_func_start sub_02090F6C
|
||||
sub_02090F6C: ; 0x02090F6C
|
||||
ldr r0, [r0, #4]
|
||||
bx lr
|
||||
thumb_func_end sub_02090F6C
|
||||
|
||||
thumb_func_start sub_02090F70
|
||||
sub_02090F70: ; 0x02090F70
|
||||
push {r3, r4, r5, lr}
|
||||
add r5, r0, #0
|
||||
add r4, r1, #0
|
||||
bl sub_02090F6C
|
||||
cmp r0, #0
|
||||
bne _02090F82
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, pc}
|
||||
_02090F82:
|
||||
ldr r2, [r5, #0x14]
|
||||
add r0, r4, #0
|
||||
mov r1, #0xaa
|
||||
bl SetMonData
|
||||
mov r0, #1
|
||||
pop {r3, r4, r5, pc}
|
||||
thumb_func_end sub_02090F70
|
||||
|
||||
thumb_func_start sub_02090F90
|
||||
sub_02090F90: ; 0x02090F90
|
||||
push {r4, lr}
|
||||
add r4, r0, #0
|
||||
ldr r0, [r4, #0x14]
|
||||
cmp r0, #0
|
||||
beq _02090F9E
|
||||
bl FreeToHeap
|
||||
_02090F9E:
|
||||
add r0, r4, #0
|
||||
bl FreeToHeap
|
||||
pop {r4, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02090F90
|
||||
|
||||
thumb_func_start sub_02090FA8
|
||||
sub_02090FA8: ; 0x02090FA8
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r5, r1, #0
|
||||
mov r1, #0
|
||||
add r7, r0, #0
|
||||
add r4, r2, #0
|
||||
str r1, [sp]
|
||||
bl Mailbox_GetFirstEmptySlotIdx
|
||||
add r6, r0, #0
|
||||
mov r0, #0
|
||||
mvn r0, r0
|
||||
cmp r6, r0
|
||||
beq _02091002
|
||||
add r0, r4, #0
|
||||
bl Mail_new
|
||||
add r4, r0, #0
|
||||
add r0, r5, #0
|
||||
mov r1, #0xaa
|
||||
add r2, r4, #0
|
||||
bl GetMonData
|
||||
add r0, r7, #0
|
||||
mov r1, #0
|
||||
add r2, r6, #0
|
||||
add r3, r4, #0
|
||||
bl Mailbox_CopyMailToSlotI
|
||||
add r0, r4, #0
|
||||
bl Mail_init
|
||||
add r0, r5, #0
|
||||
mov r1, #0xaa
|
||||
add r2, r4, #0
|
||||
bl SetMonData
|
||||
add r0, r5, #0
|
||||
mov r1, #6
|
||||
add r2, sp, #0
|
||||
bl SetMonData
|
||||
add r0, r4, #0
|
||||
bl FreeToHeap
|
||||
add r0, r6, #0
|
||||
_02091002:
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
thumb_func_end sub_02090FA8
|
||||
|
||||
thumb_func_start sub_02091004
|
||||
sub_02091004: ; 0x02091004
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r5, r1, #0
|
||||
add r4, r2, #0
|
||||
mov r1, #0
|
||||
add r2, r5, #0
|
||||
add r7, r0, #0
|
||||
str r1, [sp]
|
||||
bl Mailbox_AllocAndFetchMailI
|
||||
add r6, r0, #0
|
||||
bne _02091020
|
||||
mov r0, #0
|
||||
mvn r0, r0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_02091020:
|
||||
bl Mail_GetType
|
||||
bl MailToItemId
|
||||
str r0, [sp]
|
||||
add r0, r4, #0
|
||||
mov r1, #0xaa
|
||||
add r2, r6, #0
|
||||
bl SetMonData
|
||||
add r0, r4, #0
|
||||
mov r1, #6
|
||||
add r2, sp, #0
|
||||
bl SetMonData
|
||||
add r0, r7, #0
|
||||
mov r1, #0
|
||||
add r2, r5, #0
|
||||
bl Mailbox_DeleteSlotI
|
||||
add r0, r6, #0
|
||||
bl FreeToHeap
|
||||
add r0, r5, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02091004
|
||||
|
||||
thumb_func_start sub_02091054
|
||||
sub_02091054: ; 0x02091054
|
||||
push {r4, lr}
|
||||
add r4, r0, #0
|
||||
cmp r4, #0x51
|
||||
blo _02091060
|
||||
bl GF_AssertFail
|
||||
_02091060:
|
||||
ldr r0, _02091068 ; =_02105F04
|
||||
lsl r1, r4, #2
|
||||
ldrb r0, [r0, r1]
|
||||
pop {r4, pc}
|
||||
.balign 4, 0
|
||||
_02091068: .word _02105F04
|
||||
thumb_func_end sub_02091054
|
||||
|
||||
thumb_func_start sub_0209106C
|
||||
sub_0209106C: ; 0x0209106C
|
||||
push {r4, lr}
|
||||
add r4, r0, #0
|
||||
cmp r4, #0x51
|
||||
blo _02091078
|
||||
bl GF_AssertFail
|
||||
_02091078:
|
||||
ldr r0, _02091080 ; =_02105F04 + 1
|
||||
lsl r1, r4, #2
|
||||
ldrb r0, [r0, r1]
|
||||
pop {r4, pc}
|
||||
.balign 4, 0
|
||||
_02091080: .word _02105F04 + 1
|
||||
thumb_func_end sub_0209106C
|
||||
|
||||
thumb_func_start sub_02091084
|
||||
sub_02091084: ; 0x02091084
|
||||
push {r4, lr}
|
||||
add r4, r0, #0
|
||||
cmp r4, #0x51
|
||||
blo _02091090
|
||||
bl GF_AssertFail
|
||||
_02091090:
|
||||
ldr r0, _02091098 ; =_02105F04 + 2
|
||||
lsl r1, r4, #2
|
||||
ldrb r0, [r0, r1]
|
||||
pop {r4, pc}
|
||||
.balign 4, 0
|
||||
_02091098: .word _02105F04 + 2
|
||||
thumb_func_end sub_02091084
|
||||
|
||||
thumb_func_start sub_0209109C
|
||||
sub_0209109C: ; 0x0209109C
|
||||
push {r4, lr}
|
||||
add r4, r0, #0
|
||||
cmp r4, #0x51
|
||||
blo _020910A8
|
||||
bl GF_AssertFail
|
||||
_020910A8:
|
||||
cmp r4, #0x32
|
||||
blo _020910B0
|
||||
cmp r4, #0x4d
|
||||
bls _020910B4
|
||||
_020910B0:
|
||||
mov r0, #0
|
||||
pop {r4, pc}
|
||||
_020910B4:
|
||||
mov r0, #1
|
||||
pop {r4, pc}
|
||||
thumb_func_end sub_0209109C
|
||||
|
||||
thumb_func_start sub_020910B8
|
||||
sub_020910B8: ; 0x020910B8
|
||||
push {r4, lr}
|
||||
add r4, r0, #0
|
||||
cmp r4, #0x51
|
||||
blo _020910C4
|
||||
bl GF_AssertFail
|
||||
_020910C4:
|
||||
ldr r0, _020910D4 ; =_02105F04
|
||||
lsl r1, r4, #2
|
||||
add r0, r0, r1
|
||||
ldrb r0, [r0, #3]
|
||||
lsl r0, r0, #0x18
|
||||
lsr r0, r0, #0x1a
|
||||
pop {r4, pc}
|
||||
nop
|
||||
_020910D4: .word _02105F04
|
||||
thumb_func_end sub_020910B8
|
||||
|
||||
.rodata
|
||||
|
||||
_02105F04:
|
||||
.byte 0x27, 0x00, 0x35, 0x01, 0x28, 0x01, 0x35, 0x01, 0x29, 0x02, 0x36, 0x05
|
||||
.byte 0x2A, 0x03, 0x37, 0x09, 0x2B, 0x04, 0x38, 0x0D, 0x2C, 0x05, 0x39, 0x12, 0x2D, 0x06, 0x3A, 0x16
|
||||
.byte 0x2F, 0x07, 0x3B, 0x19, 0x2E, 0x08, 0x3C, 0x1D, 0x31, 0x09, 0x3D, 0x21, 0x30, 0x0A, 0x3E, 0x25
|
||||
.byte 0x33, 0x0B, 0x3F, 0x2A, 0x32, 0x0C, 0x40, 0x2E, 0x34, 0x0D, 0x41, 0x32, 0x35, 0x0E, 0x42, 0x36
|
||||
.byte 0x36, 0x0F, 0x43, 0x3A, 0x37, 0x10, 0x44, 0x3E, 0x38, 0x11, 0x49, 0x42, 0x39, 0x12, 0x4A, 0x46
|
||||
.byte 0x3A, 0x13, 0x4B, 0x4A, 0x3B, 0x14, 0x4C, 0x4E, 0x3C, 0x15, 0x45, 0x52, 0x3D, 0x16, 0x46, 0x56
|
||||
.byte 0x3E, 0x17, 0x47, 0x5A, 0x3F, 0x18, 0x48, 0x5E, 0x40, 0x19, 0x4D, 0x61, 0x41, 0x1A, 0x4E, 0x65
|
||||
.byte 0x42, 0x1B, 0x4F, 0x69, 0x43, 0x1C, 0x50, 0x6D, 0x44, 0x1D, 0x51, 0x71, 0x45, 0x1E, 0x52, 0x75
|
||||
.byte 0x46, 0x1F, 0x53, 0x79, 0x47, 0x20, 0x54, 0x7D, 0x48, 0x21, 0x55, 0x81, 0x49, 0x22, 0x56, 0x85
|
||||
.byte 0x4A, 0x23, 0x57, 0x8A, 0x4B, 0x24, 0x58, 0x8E, 0x4C, 0x25, 0x59, 0x91, 0x4D, 0x26, 0x5A, 0x95
|
||||
.byte 0x4E, 0x27, 0x5B, 0x99, 0x4F, 0x28, 0x5C, 0x9D, 0x50, 0x29, 0x5D, 0xA1, 0x51, 0x2A, 0x5E, 0xA5
|
||||
.byte 0x52, 0x2B, 0x5F, 0xA9, 0x53, 0x2C, 0x60, 0xAD, 0x54, 0x2D, 0x61, 0xB1, 0x55, 0x2E, 0x62, 0xB5
|
||||
.byte 0x56, 0x2F, 0x63, 0xB9, 0x57, 0x30, 0x64, 0xBD, 0x58, 0x31, 0x65, 0xC1, 0x59, 0x32, 0x66, 0x00
|
||||
.byte 0x5A, 0x33, 0x67, 0x00, 0x5B, 0x34, 0x68, 0x00, 0x5C, 0x35, 0x69, 0x00, 0x5D, 0x36, 0x6A, 0x00
|
||||
.byte 0x5E, 0x37, 0x6B, 0x00, 0x5F, 0x38, 0x6C, 0x00, 0x60, 0x39, 0x6D, 0x00, 0x61, 0x3A, 0x6E, 0x00
|
||||
.byte 0x62, 0x3B, 0x6F, 0x00, 0x63, 0x3C, 0x70, 0x00, 0x64, 0x3D, 0x71, 0x00, 0x65, 0x3E, 0x72, 0x00
|
||||
.byte 0x66, 0x3F, 0x73, 0x00, 0x67, 0x40, 0x74, 0x00, 0x68, 0x41, 0x75, 0x00, 0x69, 0x42, 0x76, 0x00
|
||||
.byte 0x6A, 0x43, 0x77, 0x00, 0x6B, 0x44, 0x78, 0x00, 0x6C, 0x45, 0x79, 0x00, 0x6D, 0x46, 0x7A, 0x00
|
||||
.byte 0x6E, 0x47, 0x7B, 0x00, 0x6F, 0x48, 0x7C, 0x00, 0x70, 0x49, 0x7D, 0x00, 0x71, 0x4A, 0x7E, 0x00
|
||||
.byte 0x72, 0x4B, 0x7F, 0x00, 0x73, 0x4C, 0x80, 0x00, 0x74, 0x4D, 0x81, 0x00, 0x75, 0x4E, 0x82, 0xC4
|
||||
.byte 0x76, 0x4F, 0x83, 0xC8, 0x77, 0x50, 0x84, 0xCC
|
88
asm/unk_data_02105F04.s
Normal file
88
asm/unk_data_02105F04.s
Normal file
@ -0,0 +1,88 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "global.inc"
|
||||
|
||||
.rodata
|
||||
|
||||
.public _02105F04
|
||||
_02105F04:
|
||||
.byte 0x27, 0x00, 0x35, 0x01
|
||||
.byte 0x28, 0x01, 0x35, 0x01
|
||||
.byte 0x29, 0x02, 0x36, 0x05
|
||||
.byte 0x2A, 0x03, 0x37, 0x09
|
||||
.byte 0x2B, 0x04, 0x38, 0x0D
|
||||
.byte 0x2C, 0x05, 0x39, 0x12
|
||||
.byte 0x2D, 0x06, 0x3A, 0x16
|
||||
.byte 0x2F, 0x07, 0x3B, 0x19
|
||||
.byte 0x2E, 0x08, 0x3C, 0x1D
|
||||
.byte 0x31, 0x09, 0x3D, 0x21
|
||||
.byte 0x30, 0x0A, 0x3E, 0x25
|
||||
.byte 0x33, 0x0B, 0x3F, 0x2A
|
||||
.byte 0x32, 0x0C, 0x40, 0x2E
|
||||
.byte 0x34, 0x0D, 0x41, 0x32
|
||||
.byte 0x35, 0x0E, 0x42, 0x36
|
||||
.byte 0x36, 0x0F, 0x43, 0x3A
|
||||
.byte 0x37, 0x10, 0x44, 0x3E
|
||||
.byte 0x38, 0x11, 0x49, 0x42
|
||||
.byte 0x39, 0x12, 0x4A, 0x46
|
||||
.byte 0x3A, 0x13, 0x4B, 0x4A
|
||||
.byte 0x3B, 0x14, 0x4C, 0x4E
|
||||
.byte 0x3C, 0x15, 0x45, 0x52
|
||||
.byte 0x3D, 0x16, 0x46, 0x56
|
||||
.byte 0x3E, 0x17, 0x47, 0x5A
|
||||
.byte 0x3F, 0x18, 0x48, 0x5E
|
||||
.byte 0x40, 0x19, 0x4D, 0x61
|
||||
.byte 0x41, 0x1A, 0x4E, 0x65
|
||||
.byte 0x42, 0x1B, 0x4F, 0x69
|
||||
.byte 0x43, 0x1C, 0x50, 0x6D
|
||||
.byte 0x44, 0x1D, 0x51, 0x71
|
||||
.byte 0x45, 0x1E, 0x52, 0x75
|
||||
.byte 0x46, 0x1F, 0x53, 0x79
|
||||
.byte 0x47, 0x20, 0x54, 0x7D
|
||||
.byte 0x48, 0x21, 0x55, 0x81
|
||||
.byte 0x49, 0x22, 0x56, 0x85
|
||||
.byte 0x4A, 0x23, 0x57, 0x8A
|
||||
.byte 0x4B, 0x24, 0x58, 0x8E
|
||||
.byte 0x4C, 0x25, 0x59, 0x91
|
||||
.byte 0x4D, 0x26, 0x5A, 0x95
|
||||
.byte 0x4E, 0x27, 0x5B, 0x99
|
||||
.byte 0x4F, 0x28, 0x5C, 0x9D
|
||||
.byte 0x50, 0x29, 0x5D, 0xA1
|
||||
.byte 0x51, 0x2A, 0x5E, 0xA5
|
||||
.byte 0x52, 0x2B, 0x5F, 0xA9
|
||||
.byte 0x53, 0x2C, 0x60, 0xAD
|
||||
.byte 0x54, 0x2D, 0x61, 0xB1
|
||||
.byte 0x55, 0x2E, 0x62, 0xB5
|
||||
.byte 0x56, 0x2F, 0x63, 0xB9
|
||||
.byte 0x57, 0x30, 0x64, 0xBD
|
||||
.byte 0x58, 0x31, 0x65, 0xC1
|
||||
.byte 0x59, 0x32, 0x66, 0x00
|
||||
.byte 0x5A, 0x33, 0x67, 0x00
|
||||
.byte 0x5B, 0x34, 0x68, 0x00
|
||||
.byte 0x5C, 0x35, 0x69, 0x00
|
||||
.byte 0x5D, 0x36, 0x6A, 0x00
|
||||
.byte 0x5E, 0x37, 0x6B, 0x00
|
||||
.byte 0x5F, 0x38, 0x6C, 0x00
|
||||
.byte 0x60, 0x39, 0x6D, 0x00
|
||||
.byte 0x61, 0x3A, 0x6E, 0x00
|
||||
.byte 0x62, 0x3B, 0x6F, 0x00
|
||||
.byte 0x63, 0x3C, 0x70, 0x00
|
||||
.byte 0x64, 0x3D, 0x71, 0x00
|
||||
.byte 0x65, 0x3E, 0x72, 0x00
|
||||
.byte 0x66, 0x3F, 0x73, 0x00
|
||||
.byte 0x67, 0x40, 0x74, 0x00
|
||||
.byte 0x68, 0x41, 0x75, 0x00
|
||||
.byte 0x69, 0x42, 0x76, 0x00
|
||||
.byte 0x6A, 0x43, 0x77, 0x00
|
||||
.byte 0x6B, 0x44, 0x78, 0x00
|
||||
.byte 0x6C, 0x45, 0x79, 0x00
|
||||
.byte 0x6D, 0x46, 0x7A, 0x00
|
||||
.byte 0x6E, 0x47, 0x7B, 0x00
|
||||
.byte 0x6F, 0x48, 0x7C, 0x00
|
||||
.byte 0x70, 0x49, 0x7D, 0x00
|
||||
.byte 0x71, 0x4A, 0x7E, 0x00
|
||||
.byte 0x72, 0x4B, 0x7F, 0x00
|
||||
.byte 0x73, 0x4C, 0x80, 0x00
|
||||
.byte 0x74, 0x4D, 0x81, 0x00
|
||||
.byte 0x75, 0x4E, 0x82, 0xC4
|
||||
.byte 0x76, 0x4F, 0x83, 0xC8
|
||||
.byte 0x77, 0x50, 0x84, 0xCC
|
@ -3976,6 +3976,7 @@
|
||||
.public _02102620
|
||||
.public _02102830
|
||||
.public _02103A1C
|
||||
.public _02105F04
|
||||
.public _02108584
|
||||
.public _02108FC0
|
||||
.public _02108FC8
|
||||
|
@ -31,6 +31,7 @@ void Mail_SetMessage(MAIL *mail, const MAIL_MESSAGE *src, int i);
|
||||
MAILBOX *Sav2_Mailbox_get(SAVEDATA *saveData);
|
||||
u32 Sav2_Mailbox_sizeof(void);
|
||||
void Sav2_Mailbox_init(MAILBOX *mailbox);
|
||||
MAIL *Mailbox_AllocAndFetchMailI(MAIL *msgs, int n, int i, HeapID heapId);
|
||||
int Mailbox_GetFirstEmptySlotIdx(MAILBOX *mailbox);
|
||||
void Mailbox_DeleteSlotI(MAIL *msgs, int n, int i);
|
||||
void Mailbox_CopyMailToSlotI(MAIL *msgs, int n, int i, const MAIL *src);
|
||||
|
74
include/mail_misc.h
Normal file
74
include/mail_misc.h
Normal file
@ -0,0 +1,74 @@
|
||||
#ifndef POKEHEARTGOLD_MAIL_MISC_H
|
||||
#define POKEHEARTGOLD_MAIL_MISC_H
|
||||
|
||||
#include "easy_chat.h"
|
||||
#include "heap.h"
|
||||
#include "mail_message.h"
|
||||
#include "pokedex.h"
|
||||
#include "pokemon.h"
|
||||
#include "save.h"
|
||||
|
||||
typedef struct {
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
u8 gameCleared; // TODO: bool8
|
||||
u8 unk5;
|
||||
u8 unk6[0x2];
|
||||
u32 frame;
|
||||
POKEDEX *pokedex;
|
||||
SAVE_EASY_CHAT_T *easyChat;
|
||||
MAIL_MESSAGE mailMessage;
|
||||
u16 unk1C[0x4];
|
||||
u32 unk24;
|
||||
} Unk02090C94;
|
||||
|
||||
typedef struct {
|
||||
u16 unk0[0x2];
|
||||
u32 unk4;
|
||||
u32 unk8;
|
||||
u16 unkC;
|
||||
u8 partyIdx;
|
||||
u8 unkF;
|
||||
SAVEDATA *saveData;
|
||||
MAIL *mail;
|
||||
MAILBOX *mailbox;
|
||||
u8 unk1C[0x4];
|
||||
} Unk02090E68;
|
||||
|
||||
Unk02090C94 *sub_02090C94(u8 a0, u8 a1, SAVEDATA *saveData, u32 a3, HeapID heapId);
|
||||
void sub_02090D0C(Unk02090C94 *a0);
|
||||
void sub_02090D14(Unk02090C94 *a0, u16 a1);
|
||||
void sub_02090D18(Unk02090C94 *a0, u16 a1, u16 a2);
|
||||
void sub_02090D20(Unk02090C94 *a0, MAIL_MESSAGE *mailMessage);
|
||||
void sub_02090D34(Unk02090C94 *a0);
|
||||
void sub_02090D40(Unk02090C94 *a0);
|
||||
BOOL sub_02090D48(Unk02090C94 *a0);
|
||||
BOOL sub_02090D4C(Unk02090C94 *a0);
|
||||
u16 sub_02090D50(Unk02090C94 *a0);
|
||||
void sub_02090D54(Unk02090C94 *a0, MAIL_MESSAGE *mailMessage);
|
||||
void sub_02090D60(Unk02090C94 *a0, MAIL_MESSAGE *mailMessage);
|
||||
u8 sub_02090D70(Unk02090C94 *a0);
|
||||
u8 sub_02090D74(Unk02090C94 *a0);
|
||||
u32 sub_02090D78(Unk02090C94 *a0);
|
||||
POKEDEX *sub_02090D7C(Unk02090C94 *a0);
|
||||
SAVE_EASY_CHAT_T *sub_02090D80(Unk02090C94 *a0);
|
||||
u8 sub_02090D84(Unk02090C94 *a0);
|
||||
u8 sub_02090D88(Unk02090C94 *a0);
|
||||
void sub_02090D8C(Unk02090C94 *a0, MAIL_MESSAGE *msg1, MAIL_MESSAGE *msg2);
|
||||
BOOL sub_02090DC0(Unk02090C94 *a0, MAIL_MESSAGE *msg1, MAIL_MESSAGE *msg2);
|
||||
void sub_02090E04(Unk02090C94 *a0, MAIL_MESSAGE *msg1, MAIL_MESSAGE *msg2);
|
||||
int sub_02090E44(Unk02090C94 *a0);
|
||||
void sub_02090E5C(Unk02090C94 *a0);
|
||||
Unk02090E68 *sub_02090E68(SAVEDATA *saveData, u16 a1, u8 partyIdx, u8 a3, HeapID heapId);
|
||||
Unk02090E68 *sub_02090EC0(SAVEDATA *saveData, int n, u16 i, HeapID heapId);
|
||||
Unk02090E68 *sub_02090F00(SAVEDATA *saveData, POKEMON *pokemon, HeapID heapId);
|
||||
Unk02090E68 *sub_02090F38(SAVEDATA *saveData, u8 mailType, HeapID heapId);
|
||||
u32 sub_02090F6C(Unk02090E68 *a0);
|
||||
BOOL sub_02090F70(Unk02090E68 *a0, POKEMON *pokemon);
|
||||
void sub_02090F90(Unk02090E68 *a0);
|
||||
int sub_02090FA8(MAILBOX *mailbox, POKEMON *pokemon, HeapID heapId);
|
||||
int sub_02091004(MAIL *msgs, int i, POKEMON *pokemon, HeapID heapId);
|
||||
|
||||
#endif //POKEHEARTGOLD_MAIL_MISC_H
|
10
include/unk_02091054.h
Normal file
10
include/unk_02091054.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef POKEHEARTGOLD_UNK_02091054_H
|
||||
#define POKEHEARTGOLD_UNK_02091054_H
|
||||
|
||||
u8 sub_02091054(u32 idx);
|
||||
u8 sub_0209106C(u32 idx);
|
||||
u8 sub_02091084(u32 idx);
|
||||
BOOL sub_0209109C(u32 idx);
|
||||
u32 sub_020910B8(u32 idx);
|
||||
|
||||
#endif //POKEHEARTGOLD_UNK_02091054_H
|
4
main.lsf
4
main.lsf
@ -285,7 +285,9 @@ Static main
|
||||
Object asm/unk_0208F814.o
|
||||
Object asm/unk_0208FB64.o
|
||||
Object src/use_item_on_mon.o
|
||||
Object asm/unk_02090C94.o
|
||||
Object src/mail_misc.o
|
||||
Object src/unk_02091054.o
|
||||
Object asm/unk_data_02105F04.o
|
||||
Object asm/unk_020910D8.o
|
||||
Object asm/unk_02091278.o
|
||||
Object asm/unk_020912AC.o
|
||||
|
284
src/mail_misc.c
Normal file
284
src/mail_misc.c
Normal file
@ -0,0 +1,284 @@
|
||||
#include "event_data.h"
|
||||
#include "item.h"
|
||||
#include "mail.h"
|
||||
#include "mail_misc.h"
|
||||
#include "options.h"
|
||||
#include "player_data.h"
|
||||
#include "sys_flags.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/pokemon.h"
|
||||
|
||||
Unk02090C94 *sub_02090C94(u8 a0, u8 a1, SAVEDATA *saveData, u32 a3, HeapID heapId) {
|
||||
Unk02090C94 *ptr = AllocFromHeap(heapId, sizeof(Unk02090C94));
|
||||
ptr->unk0 = a0;
|
||||
ptr->unk1 = a1;
|
||||
ptr->pokedex = Sav2_Pokedex_get(saveData);
|
||||
ptr->easyChat = SaveData_EasyChat_get(saveData);
|
||||
ptr->gameCleared = CheckGameClearFlag(SavArray_Flags_get(saveData));
|
||||
ptr->unk5 = 0;
|
||||
ptr->unk2 = 1;
|
||||
ptr->unk3 = 0;
|
||||
ptr->frame = Options_GetFrame(Sav2_PlayerData_GetOptionsAddr(saveData));
|
||||
ptr->unk24 = a3;
|
||||
|
||||
if (a0 == 2) {
|
||||
MailMsg_init_withBank(&ptr->mailMessage, 3);
|
||||
} else {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
ptr->unk1C[i] = -1;
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void sub_02090D0C(Unk02090C94 *a0) {
|
||||
FreeToHeap(a0);
|
||||
}
|
||||
|
||||
void sub_02090D14(Unk02090C94 *a0, u16 a1) {
|
||||
a0->unk1C[0] = a1;
|
||||
}
|
||||
|
||||
void sub_02090D18(Unk02090C94 *a0, u16 a1, u16 a2) {
|
||||
a0->unk1C[0] = a1;
|
||||
a0->unk1C[1] = a2;
|
||||
}
|
||||
|
||||
void sub_02090D20(Unk02090C94 *a0, MAIL_MESSAGE *mailMessage) {
|
||||
a0->mailMessage.msg_bank = mailMessage->msg_bank;
|
||||
a0->mailMessage.msg_no = mailMessage->msg_no;
|
||||
a0->mailMessage.fields[0] = mailMessage->fields[0];
|
||||
a0->mailMessage.fields[1] = mailMessage->fields[1];
|
||||
}
|
||||
|
||||
void sub_02090D34(Unk02090C94 *a0) {
|
||||
a0->unk2 = 1;
|
||||
a0->unk3 = 0;
|
||||
}
|
||||
|
||||
void sub_02090D40(Unk02090C94 *a0) {
|
||||
a0->unk5 = 1;
|
||||
}
|
||||
|
||||
BOOL sub_02090D48(Unk02090C94 *a0) {
|
||||
return a0->unk2;
|
||||
}
|
||||
|
||||
BOOL sub_02090D4C(Unk02090C94 *a0) {
|
||||
return a0->unk3;
|
||||
}
|
||||
|
||||
u16 sub_02090D50(Unk02090C94 *a0) {
|
||||
return a0->unk1C[0];
|
||||
}
|
||||
|
||||
void sub_02090D54(Unk02090C94 *a0, MAIL_MESSAGE *mailMessage) {
|
||||
mailMessage->msg_bank = a0->unk1C[0];
|
||||
mailMessage->msg_no = a0->unk1C[1];
|
||||
}
|
||||
|
||||
void sub_02090D60(Unk02090C94 *a0, MAIL_MESSAGE *mailMessage) {
|
||||
MailMsg_copy(mailMessage, &a0->mailMessage);
|
||||
}
|
||||
|
||||
u8 sub_02090D70(Unk02090C94 *a0) {
|
||||
return a0->unk0;
|
||||
}
|
||||
|
||||
u8 sub_02090D74(Unk02090C94 *a0) {
|
||||
return a0->unk1;
|
||||
}
|
||||
|
||||
u32 sub_02090D78(Unk02090C94 *a0) {
|
||||
return a0->frame;
|
||||
}
|
||||
|
||||
POKEDEX *sub_02090D7C(Unk02090C94 *a0) {
|
||||
return a0->pokedex;
|
||||
}
|
||||
|
||||
SAVE_EASY_CHAT_T *sub_02090D80(Unk02090C94 *a0) {
|
||||
return a0->easyChat;
|
||||
}
|
||||
|
||||
u8 sub_02090D84(Unk02090C94 *a0) {
|
||||
return a0->gameCleared;
|
||||
}
|
||||
|
||||
u8 sub_02090D88(Unk02090C94 *a0) {
|
||||
return a0->unk5;
|
||||
}
|
||||
|
||||
void sub_02090D8C(Unk02090C94 *a0, MAIL_MESSAGE *msg1, MAIL_MESSAGE *msg2) {
|
||||
switch (a0->unk0) {
|
||||
case 0:
|
||||
msg1->msg_bank = a0->unk1C[0];
|
||||
return;
|
||||
case 1:
|
||||
msg1->msg_bank = a0->unk1C[0];
|
||||
msg1->msg_no = a0->unk1C[1];
|
||||
return;
|
||||
case 2:
|
||||
msg2->msg_bank = a0->mailMessage.msg_bank;
|
||||
msg2->msg_no = a0->mailMessage.msg_no;
|
||||
msg2->fields[0] = a0->mailMessage.fields[0];
|
||||
msg2->fields[1] = a0->mailMessage.fields[1];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL sub_02090DC0(Unk02090C94 *a0, MAIL_MESSAGE *msg1, MAIL_MESSAGE *msg2) {
|
||||
switch (a0->unk0) {
|
||||
case 0:
|
||||
return msg1->msg_bank == a0->unk1C[0];
|
||||
case 1:
|
||||
return msg1->msg_bank == a0->unk1C[0] && msg1->msg_no == a0->unk1C[1];
|
||||
case 2:
|
||||
default:
|
||||
return MailMsg_compare(&a0->mailMessage, msg2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_02090E04(Unk02090C94 *a0, MAIL_MESSAGE *msg1, MAIL_MESSAGE *msg2) {
|
||||
a0->unk3 = !sub_02090DC0(a0, msg1, msg2);
|
||||
a0->unk2 = 0;
|
||||
|
||||
u16 *src = (u16 *)&msg1->msg_bank;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
a0->unk1C[i] = src[i];
|
||||
}
|
||||
|
||||
a0->mailMessage.msg_bank = msg2->msg_bank;
|
||||
a0->mailMessage.msg_no = msg2->msg_no;
|
||||
a0->mailMessage.fields[0] = msg2->fields[0];
|
||||
a0->mailMessage.fields[1] = msg2->fields[1];
|
||||
}
|
||||
|
||||
int sub_02090E44(Unk02090C94 *a0) {
|
||||
if (a0 == NULL || a0->unk24 == 0) return 0;
|
||||
|
||||
return sub_020183F0(a0->unk24);
|
||||
}
|
||||
|
||||
void sub_02090E5C(Unk02090C94 *a0) {
|
||||
sub_02018410(a0->unk24);
|
||||
}
|
||||
|
||||
Unk02090E68 *sub_02090E68(SAVEDATA *saveData, u16 a1, u8 partyIdx, u8 a3, HeapID heapId) {
|
||||
MAILBOX *mailbox = Sav2_Mailbox_get(saveData);
|
||||
Unk02090E68 *ptr = AllocFromHeapAtEnd(heapId, sizeof(Unk02090E68));
|
||||
MI_CpuFill8(ptr, 0, sizeof(Unk02090E68));
|
||||
|
||||
ptr->unkF = a3;
|
||||
ptr->partyIdx = partyIdx;
|
||||
ptr->mailbox = mailbox;
|
||||
ptr->unk0[0] = 1;
|
||||
ptr->unk8 = a1;
|
||||
ptr->unkC = 0;
|
||||
ptr->saveData = saveData;
|
||||
|
||||
MAIL *mail = Mail_new(heapId);
|
||||
ptr->mail = mail;
|
||||
Mail_init(mail);
|
||||
Mail_SetNewMessageDetails(ptr->mail, -1, partyIdx, saveData);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Unk02090E68 *sub_02090EC0(SAVEDATA *saveData, int n, u16 i, HeapID heapId) {
|
||||
Unk02090E68 *ptr = AllocFromHeapAtEnd(heapId, sizeof(Unk02090E68));
|
||||
MI_CpuFill8(ptr, 0, sizeof(Unk02090E68));
|
||||
|
||||
ptr->unk0[0] = 0;
|
||||
ptr->unk8 = n;
|
||||
ptr->unkC = i;
|
||||
ptr->saveData = saveData;
|
||||
|
||||
MAILBOX *mailbox = Sav2_Mailbox_get(saveData);
|
||||
ptr->mailbox = mailbox;
|
||||
ptr->mail = Mailbox_AllocAndFetchMailI(&mailbox->msgs[0], n, i, heapId);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Unk02090E68 *sub_02090F00(SAVEDATA *saveData, POKEMON *pokemon, HeapID heapId) {
|
||||
Unk02090E68 *ptr = AllocFromHeapAtEnd(heapId, sizeof(Unk02090E68));
|
||||
MI_CpuFill8(ptr, 0, sizeof(Unk02090E68));
|
||||
|
||||
ptr->unk0[0] = 0;
|
||||
ptr->saveData = saveData;
|
||||
|
||||
MAIL *mail = Mail_new(heapId);
|
||||
ptr->mail = mail;
|
||||
GetMonData(pokemon, MON_DATA_MAIL_STRUCT, ptr->mail);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Unk02090E68 *sub_02090F38(SAVEDATA *saveData, u8 mailType, HeapID heapId) {
|
||||
Unk02090E68 *ptr = AllocFromHeapAtEnd(heapId, sizeof(Unk02090E68));
|
||||
MI_CpuFill8(ptr, 0, sizeof(Unk02090E68));
|
||||
|
||||
ptr->unk0[0] = 0;
|
||||
ptr->saveData = saveData;
|
||||
|
||||
MAIL *mail = Mail_new(heapId);
|
||||
ptr->mail = mail;
|
||||
Mail_SetType(mail, mailType);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
u32 sub_02090F6C(Unk02090E68 *a0) {
|
||||
return a0->unk4;
|
||||
}
|
||||
|
||||
BOOL sub_02090F70(Unk02090E68 *a0, POKEMON *pokemon) {
|
||||
if (sub_02090F6C(a0) == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
SetMonData(pokemon, MON_DATA_MAIL_STRUCT, a0->mail);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_02090F90(Unk02090E68 *a0) {
|
||||
if (a0->mail != NULL) {
|
||||
FreeToHeap(a0->mail);
|
||||
}
|
||||
FreeToHeap(a0);
|
||||
}
|
||||
|
||||
int sub_02090FA8(MAILBOX *mailbox, POKEMON *pokemon, HeapID heapId) {
|
||||
int item = ITEM_NONE;
|
||||
int idx = Mailbox_GetFirstEmptySlotIdx(mailbox);
|
||||
|
||||
if (idx != -1) {
|
||||
MAIL *mail = Mail_new(heapId);
|
||||
|
||||
GetMonData(pokemon, MON_DATA_MAIL_STRUCT, mail);
|
||||
Mailbox_CopyMailToSlotI(&mailbox->msgs[0], 0, idx, mail);
|
||||
Mail_init(mail);
|
||||
SetMonData(pokemon, MON_DATA_MAIL_STRUCT, mail);
|
||||
SetMonData(pokemon, MON_DATA_HELD_ITEM, &item);
|
||||
FreeToHeap(mail);
|
||||
return idx;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int sub_02091004(MAIL *msgs, int i, POKEMON *pokemon, HeapID heapId) {
|
||||
int item = ITEM_NONE;
|
||||
|
||||
MAIL *mail = Mailbox_AllocAndFetchMailI(msgs, 0, i, heapId);
|
||||
if (mail == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
item = MailToItemId(Mail_GetType(mail));
|
||||
SetMonData(pokemon, MON_DATA_MAIL_STRUCT, mail);
|
||||
SetMonData(pokemon, MON_DATA_HELD_ITEM, &item);
|
||||
Mailbox_DeleteSlotI(msgs, 0, i);
|
||||
FreeToHeap(mail);
|
||||
|
||||
return i;
|
||||
}
|
39
src/unk_02091054.c
Normal file
39
src/unk_02091054.c
Normal file
@ -0,0 +1,39 @@
|
||||
#include "unk_02091054.h"
|
||||
|
||||
typedef struct {
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
} Unk02091054;
|
||||
|
||||
extern Unk02091054 _02105F04[81];
|
||||
|
||||
// Has something to do with seals...
|
||||
u8 sub_02091054(u32 idx) {
|
||||
GF_ASSERT(idx < NELEMS(_02105F04));
|
||||
return _02105F04[idx].unk0;
|
||||
}
|
||||
|
||||
u8 sub_0209106C(u32 idx) {
|
||||
GF_ASSERT(idx < NELEMS(_02105F04));
|
||||
return _02105F04[idx].unk1;
|
||||
}
|
||||
|
||||
u8 sub_02091084(u32 idx) {
|
||||
GF_ASSERT(idx < NELEMS(_02105F04));
|
||||
return _02105F04[idx].unk2;
|
||||
}
|
||||
|
||||
BOOL sub_0209109C(u32 idx) {
|
||||
GF_ASSERT(idx < NELEMS(_02105F04));
|
||||
if (idx < 0x32 || idx > 0x4d) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u32 sub_020910B8(u32 idx) {
|
||||
GF_ASSERT(idx < NELEMS(_02105F04));
|
||||
Unk02091054 *ptr = &_02105F04[idx];
|
||||
return ((u32)(ptr->unk3 << 0x18) >> 0x1a);
|
||||
}
|
Loading…
Reference in New Issue
Block a user