mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Decompile union_room_chat.c up to sub_801F5B8
This commit is contained in:
parent
af1baa89f1
commit
aebc676913
@ -5,746 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_801EFF8
|
||||
sub_801EFF8: @ 801EFF8
|
||||
push {r4-r6,lr}
|
||||
adds r6, r0, 0
|
||||
adds r5, r1, 0
|
||||
ldrb r0, [r5]
|
||||
adds r1, r0, 0
|
||||
adds r4, r5, 0x1
|
||||
adds r5, r4, 0
|
||||
adds r5, 0x8
|
||||
cmp r0, 0x2
|
||||
beq _0801F020
|
||||
cmp r0, 0x2
|
||||
bgt _0801F016
|
||||
cmp r0, 0x1
|
||||
beq _0801F044
|
||||
b _0801F0A8
|
||||
_0801F016:
|
||||
cmp r1, 0x3
|
||||
beq _0801F07A
|
||||
cmp r1, 0x5
|
||||
beq _0801F06E
|
||||
b _0801F0A8
|
||||
_0801F020:
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0, 0x13]
|
||||
ldrb r1, [r4, 0x8]
|
||||
cmp r0, r1
|
||||
beq _0801F0A8
|
||||
bl DynamicPlaceholderTextUtil_Reset
|
||||
movs r0, 0
|
||||
adds r1, r4, 0
|
||||
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
|
||||
ldr r1, =gText_F700JoinedChat
|
||||
b _0801F094
|
||||
.pool
|
||||
_0801F044:
|
||||
adds r0, r6, 0
|
||||
adds r1, r4, 0
|
||||
bl StringCopy
|
||||
movs r1, 0xFC
|
||||
strb r1, [r0]
|
||||
adds r0, 0x1
|
||||
movs r1, 0x13
|
||||
strb r1, [r0]
|
||||
adds r0, 0x1
|
||||
movs r1, 0x2A
|
||||
strb r1, [r0]
|
||||
adds r0, 0x1
|
||||
movs r1, 0xF0
|
||||
strb r1, [r0]
|
||||
adds r0, 0x1
|
||||
adds r1, r5, 0
|
||||
bl StringCopy
|
||||
movs r0, 0x1
|
||||
b _0801F0AA
|
||||
_0801F06E:
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x79
|
||||
adds r1, r4, 0
|
||||
bl StringCopy
|
||||
_0801F07A:
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0, 0x13]
|
||||
ldrb r5, [r5]
|
||||
cmp r0, r5
|
||||
beq _0801F0A8
|
||||
bl DynamicPlaceholderTextUtil_Reset
|
||||
movs r0, 0
|
||||
adds r1, r4, 0
|
||||
bl DynamicPlaceholderTextUtil_SetPlaceholderPtr
|
||||
ldr r1, =gText_F700LeftChat
|
||||
_0801F094:
|
||||
adds r0, r6, 0
|
||||
bl DynamicPlaceholderTextUtil_ExpandPlaceholders
|
||||
movs r0, 0x1
|
||||
b _0801F0AA
|
||||
.pool
|
||||
_0801F0A8:
|
||||
movs r0, 0
|
||||
_0801F0AA:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801EFF8
|
||||
|
||||
thumb_func_start sub_801F0B0
|
||||
sub_801F0B0: @ 801F0B0
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0, 0x10]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_801F0B0
|
||||
|
||||
thumb_func_start sub_801F0BC
|
||||
sub_801F0BC: @ 801F0BC
|
||||
ldr r2, =gUnknown_02022C84
|
||||
ldr r3, [r2]
|
||||
ldrb r2, [r3, 0x11]
|
||||
strb r2, [r0]
|
||||
ldrb r0, [r3, 0x12]
|
||||
strb r0, [r1]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_801F0BC
|
||||
|
||||
thumb_func_start sub_801F0D0
|
||||
sub_801F0D0: @ 801F0D0
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x1A
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_801F0D0
|
||||
|
||||
thumb_func_start sub_801F0DC
|
||||
sub_801F0DC: @ 801F0DC
|
||||
push {lr}
|
||||
bl sub_801F0D0
|
||||
bl StringLength_Multibyte
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801F0DC
|
||||
|
||||
thumb_func_start sub_801F0EC
|
||||
sub_801F0EC: @ 801F0EC
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
ldrb r3, [r0, 0x15]
|
||||
ldrb r2, [r0, 0x14]
|
||||
subs r0, r3, r2
|
||||
cmp r0, 0
|
||||
bge _0801F108
|
||||
negs r0, r0
|
||||
str r3, [r4]
|
||||
b _0801F10A
|
||||
.pool
|
||||
_0801F108:
|
||||
str r2, [r4]
|
||||
_0801F10A:
|
||||
str r0, [r1]
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_801F0EC
|
||||
|
||||
thumb_func_start sub_801F114
|
||||
sub_801F114: @ 801F114
|
||||
push {lr}
|
||||
bl sub_801EED8
|
||||
lsls r0, 16
|
||||
lsrs r2, r0, 16
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
adds r1, r0, 0
|
||||
adds r1, 0x1A
|
||||
cmp r2, 0
|
||||
beq _0801F13A
|
||||
_0801F12A:
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0xF9
|
||||
bne _0801F132
|
||||
adds r1, 0x1
|
||||
_0801F132:
|
||||
adds r1, 0x1
|
||||
subs r2, 0x1
|
||||
cmp r2, 0
|
||||
bne _0801F12A
|
||||
_0801F13A:
|
||||
adds r0, r1, 0
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_801F114
|
||||
|
||||
thumb_func_start sub_801F144
|
||||
sub_801F144: @ 801F144
|
||||
push {r4,lr}
|
||||
bl sub_801EED8
|
||||
lsls r0, 16
|
||||
lsrs r4, r0, 16
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
adds r1, r0, 0
|
||||
adds r1, 0x1A
|
||||
movs r2, 0
|
||||
movs r3, 0
|
||||
cmp r2, r4
|
||||
bcs _0801F174
|
||||
_0801F15E:
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0xF9
|
||||
bne _0801F166
|
||||
adds r1, 0x1
|
||||
_0801F166:
|
||||
adds r1, 0x1
|
||||
adds r0, r2, 0x1
|
||||
lsls r0, 16
|
||||
lsrs r2, r0, 16
|
||||
adds r3, 0x1
|
||||
cmp r3, r4
|
||||
bcc _0801F15E
|
||||
_0801F174:
|
||||
adds r0, r2, 0
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_801F144
|
||||
|
||||
thumb_func_start sub_801F180
|
||||
sub_801F180: @ 801F180
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x39
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_801F180
|
||||
|
||||
thumb_func_start sub_801F18C
|
||||
sub_801F18C: @ 801F18C
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0, 0x16]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_801F18C
|
||||
|
||||
thumb_func_start sub_801F198
|
||||
sub_801F198: @ 801F198
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0, 0x15]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_801F198
|
||||
|
||||
thumb_func_start sub_801F1A4
|
||||
sub_801F1A4: @ 801F1A4
|
||||
push {lr}
|
||||
bl sub_801EEA8
|
||||
ldrb r1, [r0]
|
||||
cmp r1, 0xFF
|
||||
bhi _0801F1BE
|
||||
ldr r0, =gUnknown_082F2AA8
|
||||
adds r0, r1, r0
|
||||
ldrb r0, [r0]
|
||||
cmp r0, r1
|
||||
beq _0801F1BE
|
||||
cmp r0, 0
|
||||
bne _0801F1C8
|
||||
_0801F1BE:
|
||||
movs r0, 0x3
|
||||
b _0801F1CA
|
||||
.pool
|
||||
_0801F1C8:
|
||||
movs r0, 0
|
||||
_0801F1CA:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801F1A4
|
||||
|
||||
thumb_func_start sub_801F1D0
|
||||
sub_801F1D0: @ 801F1D0
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x79
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_801F1D0
|
||||
|
||||
thumb_func_start copy_strings_to_sav1
|
||||
copy_strings_to_sav1: @ 801F1DC
|
||||
push {r4,lr}
|
||||
ldr r4, =gSaveBlock1Ptr
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003c88
|
||||
adds r0, r1
|
||||
ldr r1, =gText_Hello
|
||||
bl StringCopy
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003c9d
|
||||
adds r0, r1
|
||||
ldr r1, =gText_Pokemon2
|
||||
bl StringCopy
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003cb2
|
||||
adds r0, r1
|
||||
ldr r1, =gText_Trade
|
||||
bl StringCopy
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003cc7
|
||||
adds r0, r1
|
||||
ldr r1, =gText_Battle
|
||||
bl StringCopy
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003cdc
|
||||
adds r0, r1
|
||||
ldr r1, =gText_Lets
|
||||
bl StringCopy
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003cf1
|
||||
adds r0, r1
|
||||
ldr r1, =gText_Ok
|
||||
bl StringCopy
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003d06
|
||||
adds r0, r1
|
||||
ldr r1, =gText_Sorry
|
||||
bl StringCopy
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003d1b
|
||||
adds r0, r1
|
||||
ldr r1, =gText_YayUnkF9F9
|
||||
bl StringCopy
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003d30
|
||||
adds r0, r1
|
||||
ldr r1, =gText_ThankYou
|
||||
bl StringCopy
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x00003d45
|
||||
adds r0, r1
|
||||
ldr r1, =gText_ByeBye
|
||||
bl StringCopy
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end copy_strings_to_sav1
|
||||
|
||||
thumb_func_start sub_801F2B4
|
||||
sub_801F2B4: @ 801F2B4
|
||||
push {r4-r6,lr}
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
lsls r0, r5, 2
|
||||
adds r0, r5
|
||||
lsls r0, 3
|
||||
ldr r1, =gTasks + 0x8
|
||||
adds r4, r0, r1
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0x7
|
||||
bls _0801F2CE
|
||||
b _0801F4C4
|
||||
_0801F2CE:
|
||||
lsls r0, 2
|
||||
ldr r1, =_0801F2E0
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_0801F2E0:
|
||||
.4byte _0801F300
|
||||
.4byte _0801F30E
|
||||
.4byte _0801F4A8
|
||||
.4byte _0801F35C
|
||||
.4byte _0801F448
|
||||
.4byte _0801F480
|
||||
.4byte _0801F494
|
||||
.4byte _0801F438
|
||||
_0801F300:
|
||||
ldr r0, =gReceivedRemoteLinkPlayers
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _0801F30A
|
||||
b _0801F49C
|
||||
_0801F30A:
|
||||
movs r0, 0x1
|
||||
strh r0, [r4]
|
||||
_0801F30E:
|
||||
bl GetLinkPlayerCount
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r2, r0, 0
|
||||
strh r0, [r4, 0x8]
|
||||
ldr r3, =gUnknown_02022C84
|
||||
ldr r0, [r3]
|
||||
ldrb r1, [r0, 0xD]
|
||||
movs r5, 0x8
|
||||
ldrsh r0, [r4, r5]
|
||||
cmp r1, r0
|
||||
beq _0801F33C
|
||||
movs r0, 0x2
|
||||
strh r0, [r4]
|
||||
ldr r0, [r3]
|
||||
strb r2, [r0, 0xD]
|
||||
b _0801F4C4
|
||||
.pool
|
||||
_0801F33C:
|
||||
bl GetBlockReceivedStatus
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r4, 0x6]
|
||||
cmp r0, 0
|
||||
bne _0801F354
|
||||
bl sub_8011A9C
|
||||
cmp r0, 0
|
||||
beq _0801F354
|
||||
b _0801F4C4
|
||||
_0801F354:
|
||||
movs r0, 0
|
||||
strh r0, [r4, 0x2]
|
||||
movs r0, 0x3
|
||||
strh r0, [r4]
|
||||
_0801F35C:
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, 0x4
|
||||
bgt _0801F396
|
||||
movs r2, 0x6
|
||||
ldrsh r0, [r4, r2]
|
||||
movs r3, 0x2
|
||||
ldrsh r1, [r4, r3]
|
||||
asrs r0, r1
|
||||
movs r1, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0801F396
|
||||
movs r2, 0x1
|
||||
_0801F378:
|
||||
ldrh r0, [r4, 0x2]
|
||||
adds r0, 0x1
|
||||
strh r0, [r4, 0x2]
|
||||
lsls r0, 16
|
||||
asrs r0, 16
|
||||
cmp r0, 0x4
|
||||
bgt _0801F396
|
||||
movs r5, 0x6
|
||||
ldrsh r0, [r4, r5]
|
||||
movs r3, 0x2
|
||||
ldrsh r1, [r4, r3]
|
||||
asrs r0, r1
|
||||
ands r0, r2
|
||||
cmp r0, 0
|
||||
beq _0801F378
|
||||
_0801F396:
|
||||
ldrh r1, [r4, 0x2]
|
||||
movs r5, 0x2
|
||||
ldrsh r0, [r4, r5]
|
||||
cmp r0, 0x5
|
||||
bne _0801F3A2
|
||||
b _0801F4C0
|
||||
_0801F3A2:
|
||||
strh r1, [r4, 0x4]
|
||||
lsls r0, r1, 24
|
||||
lsrs r0, 24
|
||||
bl ResetBlockReceivedFlag
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r4, r1]
|
||||
lsls r0, 8
|
||||
ldr r1, =gBlockRecvBuffer
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
subs r0, 0x1
|
||||
cmp r0, 0x4
|
||||
bhi _0801F3E4
|
||||
lsls r0, 2
|
||||
ldr r1, =_0801F3D0
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_0801F3D0:
|
||||
.4byte _0801F3E4
|
||||
.4byte _0801F3E8
|
||||
.4byte _0801F3EC
|
||||
.4byte _0801F3F0
|
||||
.4byte _0801F3F4
|
||||
_0801F3E4:
|
||||
movs r0, 0x3
|
||||
b _0801F3F6
|
||||
_0801F3E8:
|
||||
movs r0, 0x3
|
||||
b _0801F3F6
|
||||
_0801F3EC:
|
||||
movs r0, 0x4
|
||||
b _0801F3F6
|
||||
_0801F3F0:
|
||||
movs r0, 0x5
|
||||
b _0801F3F6
|
||||
_0801F3F4:
|
||||
movs r0, 0x6
|
||||
_0801F3F6:
|
||||
strh r0, [r4, 0xA]
|
||||
ldr r5, =gUnknown_02022C84
|
||||
ldr r0, [r5]
|
||||
adds r0, 0x39
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
lsls r1, 8
|
||||
ldr r2, =gBlockRecvBuffer
|
||||
adds r1, r2
|
||||
bl sub_801EFF8
|
||||
cmp r0, 0
|
||||
beq _0801F42C
|
||||
ldr r0, [r5]
|
||||
ldrh r1, [r4, 0x2]
|
||||
strb r1, [r0, 0x16]
|
||||
movs r0, 0xC
|
||||
movs r1, 0x2
|
||||
bl sub_801F5EC
|
||||
movs r0, 0x7
|
||||
b _0801F42E
|
||||
.pool
|
||||
_0801F42C:
|
||||
ldrh r0, [r4, 0xA]
|
||||
_0801F42E:
|
||||
strh r0, [r4]
|
||||
ldrh r0, [r4, 0x2]
|
||||
adds r0, 0x1
|
||||
strh r0, [r4, 0x2]
|
||||
b _0801F4C4
|
||||
_0801F438:
|
||||
movs r0, 0x2
|
||||
bl sub_801F644
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0801F4C4
|
||||
ldrh r0, [r4, 0xA]
|
||||
b _0801F4C2
|
||||
_0801F448:
|
||||
ldr r6, =gUnknown_02022C84
|
||||
ldr r0, [r6]
|
||||
ldrb r0, [r0, 0x13]
|
||||
cmp r0, 0
|
||||
bne _0801F47C
|
||||
movs r3, 0x4
|
||||
ldrsh r0, [r4, r3]
|
||||
cmp r0, 0
|
||||
beq _0801F47C
|
||||
bl GetLinkPlayerCount
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x2
|
||||
bne _0801F474
|
||||
bl sub_80104B0
|
||||
ldr r1, [r6]
|
||||
movs r0, 0x1
|
||||
b _0801F49A
|
||||
.pool
|
||||
_0801F474:
|
||||
movs r5, 0x4
|
||||
ldrsh r0, [r4, r5]
|
||||
bl sub_8011DE0
|
||||
_0801F47C:
|
||||
movs r0, 0x3
|
||||
b _0801F4C2
|
||||
_0801F480:
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r1, [r0]
|
||||
ldrb r0, [r1, 0x13]
|
||||
cmp r0, 0
|
||||
beq _0801F49C
|
||||
movs r0, 0x2
|
||||
b _0801F49A
|
||||
.pool
|
||||
_0801F494:
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r1, [r0]
|
||||
movs r0, 0x3
|
||||
_0801F49A:
|
||||
strb r0, [r1, 0x17]
|
||||
_0801F49C:
|
||||
adds r0, r5, 0
|
||||
bl DestroyTask
|
||||
b _0801F4C4
|
||||
.pool
|
||||
_0801F4A8:
|
||||
bl sub_8011A9C
|
||||
cmp r0, 0
|
||||
bne _0801F4C4
|
||||
ldr r0, =gUnknown_02022C84
|
||||
ldr r1, [r0]
|
||||
ldrb r0, [r1, 0x13]
|
||||
cmp r0, 0
|
||||
bne _0801F4C0
|
||||
ldrb r0, [r1, 0xD]
|
||||
bl sub_80110B8
|
||||
_0801F4C0:
|
||||
movs r0, 0x1
|
||||
_0801F4C2:
|
||||
strh r0, [r4]
|
||||
_0801F4C4:
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_801F2B4
|
||||
|
||||
thumb_func_start sub_801F4D0
|
||||
sub_801F4D0: @ 801F4D0
|
||||
push {r4,lr}
|
||||
ldr r4, =gUnknown_02022C88
|
||||
ldr r0, =0x00002168
|
||||
bl Alloc
|
||||
str r0, [r4]
|
||||
cmp r0, 0
|
||||
beq _0801F52C
|
||||
bl sub_8020890
|
||||
cmp r0, 0
|
||||
beq _0801F52C
|
||||
movs r0, 0
|
||||
bl ResetBgsAndClearDma3BusyFlags
|
||||
ldr r1, =gUnknown_082F2C60
|
||||
movs r0, 0
|
||||
movs r2, 0x4
|
||||
bl InitBgsFromTemplates
|
||||
ldr r0, =gUnknown_082F2C70
|
||||
bl InitWindows
|
||||
bl reset_temp_tile_data_buffers
|
||||
bl sub_8020770
|
||||
ldr r0, [r4]
|
||||
bl sub_801F574
|
||||
bl sub_801F580
|
||||
movs r0, 0
|
||||
movs r1, 0
|
||||
bl sub_801F5EC
|
||||
movs r0, 0x1
|
||||
b _0801F52E
|
||||
.pool
|
||||
_0801F52C:
|
||||
movs r0, 0
|
||||
_0801F52E:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801F4D0
|
||||
|
||||
thumb_func_start sub_801F534
|
||||
sub_801F534: @ 801F534
|
||||
push {lr}
|
||||
movs r0, 0
|
||||
bl sub_801F644
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801F534
|
||||
|
||||
thumb_func_start sub_801F544
|
||||
sub_801F544: @ 801F544
|
||||
push {r4,lr}
|
||||
bl sub_80208D0
|
||||
ldr r4, =gUnknown_02022C88
|
||||
ldr r0, [r4]
|
||||
cmp r0, 0
|
||||
beq _0801F55A
|
||||
bl Free
|
||||
movs r0, 0
|
||||
str r0, [r4]
|
||||
_0801F55A:
|
||||
bl FreeAllWindowBuffers
|
||||
ldr r1, =gScanlineEffect
|
||||
movs r0, 0x3
|
||||
strb r0, [r1, 0x15]
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_801F544
|
||||
|
||||
thumb_func_start sub_801F574
|
||||
sub_801F574: @ 801F574
|
||||
movs r2, 0
|
||||
movs r1, 0xFF
|
||||
strh r1, [r0, 0x18]
|
||||
strh r1, [r0, 0x1E]
|
||||
strh r2, [r0, 0x1A]
|
||||
bx lr
|
||||
thumb_func_end sub_801F574
|
||||
|
||||
thumb_func_start sub_801F580
|
||||
sub_801F580: @ 801F580
|
||||
push {r4,r5,lr}
|
||||
ldr r1, =gUnknown_02022C88
|
||||
ldr r0, [r1]
|
||||
cmp r0, 0
|
||||
beq _0801F5A8
|
||||
movs r2, 0
|
||||
adds r4, r1, 0
|
||||
ldr r5, =sub_801FDD8
|
||||
movs r3, 0
|
||||
_0801F592:
|
||||
ldr r0, [r4]
|
||||
lsls r1, r2, 3
|
||||
adds r0, r1
|
||||
str r5, [r0]
|
||||
strb r3, [r0, 0x4]
|
||||
ldr r0, [r4]
|
||||
adds r0, r1
|
||||
strb r3, [r0, 0x5]
|
||||
adds r2, 0x1
|
||||
cmp r2, 0x2
|
||||
ble _0801F592
|
||||
_0801F5A8:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_801F580
|
||||
|
||||
thumb_func_start sub_801F5B8
|
||||
sub_801F5B8: @ 801F5B8
|
||||
push {r4-r6,lr}
|
||||
ldr r1, =gUnknown_02022C88
|
||||
ldr r0, [r1]
|
||||
cmp r0, 0
|
||||
beq _0801F5E0
|
||||
movs r5, 0
|
||||
adds r6, r1, 0
|
||||
_0801F5C6:
|
||||
ldr r1, [r6]
|
||||
lsls r4, r5, 3
|
||||
adds r1, r4
|
||||
adds r0, r1, 0x5
|
||||
ldr r1, [r1]
|
||||
bl _call_via_r1
|
||||
ldr r1, [r6]
|
||||
adds r1, r4
|
||||
strb r0, [r1, 0x4]
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x2
|
||||
ble _0801F5C6
|
||||
_0801F5E0:
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_801F5B8
|
||||
|
||||
thumb_func_start sub_801F5EC
|
||||
sub_801F5EC: @ 801F5EC
|
||||
push {r4-r7,lr}
|
||||
|
@ -287,5 +287,6 @@ void sub_8010198(void);
|
||||
bool32 sub_8011A9C(void);
|
||||
void sub_80104B0(void);
|
||||
void sub_8011A50(void);
|
||||
void sub_80110B8(u32 a0);
|
||||
|
||||
#endif //GUARD_LINK_RFU_H
|
||||
|
@ -2592,4 +2592,18 @@ extern const u8 gUnknown_085EE154[];
|
||||
// Berry Powder Menu
|
||||
extern const u8 gText_Powder[];
|
||||
|
||||
// Union Room Chat
|
||||
extern const u8 gText_F700JoinedChat[];
|
||||
extern const u8 gText_F700LeftChat[];
|
||||
extern const u8 gText_Hello[];
|
||||
extern const u8 gText_Pokemon2[];
|
||||
extern const u8 gText_Trade[];
|
||||
extern const u8 gText_Battle[];
|
||||
extern const u8 gText_Lets[];
|
||||
extern const u8 gText_Ok[];
|
||||
extern const u8 gText_Sorry[];
|
||||
extern const u8 gText_YayUnkF9F9[];
|
||||
extern const u8 gText_ThankYou[];
|
||||
extern const u8 gText_ByeBye[];
|
||||
|
||||
#endif // GUARD_STRINGS_H
|
||||
|
@ -99,6 +99,8 @@
|
||||
//
|
||||
#define EXT_CTRL_CODE_CLEAR 0x11
|
||||
//
|
||||
#define EXT_CTRL_CODE_CLEAR_TO 0x13
|
||||
//
|
||||
#define EXT_CTRL_CODE_JPN 0x15
|
||||
#define EXT_CTRL_CODE_ENG 0x16
|
||||
|
||||
|
@ -2,5 +2,6 @@
|
||||
#define GUARD_UNION_ROOM_CHAT_H
|
||||
|
||||
void sub_801DD98(void);
|
||||
void copy_strings_to_sav1(void);
|
||||
|
||||
#endif // GUARD_UNION_ROOM_CHAT_H
|
||||
|
@ -43,9 +43,8 @@
|
||||
#include "field_specials.h"
|
||||
#include "berry_powder.h"
|
||||
#include "mevent.h"
|
||||
#include "union_room_chat.h"
|
||||
|
||||
|
||||
extern void copy_strings_to_sav1(void);
|
||||
extern void ResetPokeJumpResults(void);
|
||||
|
||||
extern const u8 EventScript_ResetAllMapFlags[];
|
||||
|
@ -1601,7 +1601,7 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
textPrinter->printerTemplate.currentX = *textPrinter->printerTemplate.currentChar + textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 19:
|
||||
case EXT_CTRL_CODE_CLEAR_TO:
|
||||
{
|
||||
widthHelper = *textPrinter->printerTemplate.currentChar;
|
||||
widthHelper += textPrinter->printerTemplate.x;
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "alloc.h"
|
||||
#include "bg.h"
|
||||
#include "dynamic_placeholder_text_util.h"
|
||||
#include "link.h"
|
||||
#include "link_rfu.h"
|
||||
#include "load_save.h"
|
||||
@ -12,7 +14,9 @@
|
||||
#include "sound.h"
|
||||
#include "sprite.h"
|
||||
#include "string_util.h"
|
||||
#include "strings.h"
|
||||
#include "task.h"
|
||||
#include "window.h"
|
||||
#include "constants/rgb.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
@ -37,13 +41,32 @@ struct UnionRoomChat
|
||||
u8 unk17;
|
||||
u8 unk18;
|
||||
u8 unk19;
|
||||
u8 unk1A[0x9F];
|
||||
u8 unk1A[0x1F];
|
||||
u8 unk39[0x40];
|
||||
u8 unk79[0x40];
|
||||
u8 unkB9[10][21];
|
||||
u8 filler18B[0x5];
|
||||
u8 unk190[0x28];
|
||||
u16 unk1B8;
|
||||
};
|
||||
|
||||
struct UnionRoomChat2_Unk0
|
||||
{
|
||||
int (* unk0)(u8 *);
|
||||
u8 unk4;
|
||||
u8 unk5;
|
||||
};
|
||||
|
||||
struct UnionRoomChat2
|
||||
{
|
||||
struct UnionRoomChat2_Unk0 unk0[3];
|
||||
u16 unk18;
|
||||
u16 unk1A;
|
||||
u8 filler1C[0x2];
|
||||
u16 unk1E;
|
||||
u8 filler20[0x2148];
|
||||
};
|
||||
|
||||
static void sub_801DDD0(struct UnionRoomChat *);
|
||||
static void c2_081284E0(void);
|
||||
static void sub_801DF20(void);
|
||||
@ -77,19 +100,28 @@ static void sub_801EF7C(u8 *);
|
||||
static void sub_801EFA8(u8 *);
|
||||
static void sub_801EFD0(u8 *);
|
||||
u8 *sub_801F114(void);
|
||||
void sub_801F2B4(u8 taskId);
|
||||
bool8 sub_801F4D0(void);
|
||||
int sub_801F534(void);
|
||||
void sub_801F544(void);
|
||||
void sub_801F5B8(void);
|
||||
static void sub_801F2B4(u8 taskId);
|
||||
static bool8 sub_801F4D0(void);
|
||||
static bool32 sub_801F534(void);
|
||||
static void sub_801F544(void);
|
||||
static void sub_801F5B8(void);
|
||||
void sub_801F5EC(u16, u8);
|
||||
bool8 sub_801F644(u8);
|
||||
s8 sub_801FF08(void);
|
||||
bool32 sub_8020890(void);
|
||||
void sub_8020770(void);
|
||||
static void sub_801F574(struct UnionRoomChat2 *);
|
||||
static void sub_801F580(void);
|
||||
void sub_80208D0(void);
|
||||
int sub_801FDD8(u8 *);
|
||||
|
||||
extern struct UnionRoomChat *gUnknown_02022C84;
|
||||
extern struct UnionRoomChat2 *gUnknown_02022C88;
|
||||
|
||||
extern const u8 *const gUnknown_082F2BA8[][10];
|
||||
extern const u8 gUnknown_082F2AA8[];
|
||||
extern const struct BgTemplate gUnknown_082F2C60[4];
|
||||
extern const struct WindowTemplate gUnknown_082F2C70[];
|
||||
|
||||
|
||||
void sub_801DD98(void)
|
||||
@ -1070,3 +1102,344 @@ static void sub_801EFD0(u8 *arg0)
|
||||
StringCopy(&arg0[1], gSaveBlock2Ptr->playerName);
|
||||
arg0[1 + (PLAYER_NAME_LENGTH + 1)] = gUnknown_02022C84->unk13;
|
||||
}
|
||||
|
||||
bool32 sub_801EFF8(u8 *arg0, u8 *arg1)
|
||||
{
|
||||
u8 *tempStr;
|
||||
u8 var0 = *arg1;
|
||||
u8 *str = arg1 + 1;
|
||||
arg1 = str;
|
||||
arg1 += 8;
|
||||
|
||||
switch (var0)
|
||||
{
|
||||
case 2:
|
||||
if (gUnknown_02022C84->unk13 != str[8])
|
||||
{
|
||||
DynamicPlaceholderTextUtil_Reset();
|
||||
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, str);
|
||||
DynamicPlaceholderTextUtil_ExpandPlaceholders(arg0, gText_F700JoinedChat);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
tempStr = StringCopy(arg0, str);
|
||||
*(tempStr++) = EXT_CTRL_CODE_BEGIN;
|
||||
*(tempStr++) = EXT_CTRL_CODE_CLEAR_TO;
|
||||
*(tempStr++) = 42;
|
||||
*(tempStr++) = CHAR_COLON;
|
||||
StringCopy(tempStr, arg1);
|
||||
return TRUE;
|
||||
case 5:
|
||||
StringCopy(gUnknown_02022C84->unk79, str);
|
||||
// fall through
|
||||
case 3:
|
||||
if (gUnknown_02022C84->unk13 != *arg1)
|
||||
{
|
||||
DynamicPlaceholderTextUtil_Reset();
|
||||
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, str);
|
||||
DynamicPlaceholderTextUtil_ExpandPlaceholders(arg0, gText_F700LeftChat);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u8 sub_801F0B0(void)
|
||||
{
|
||||
return gUnknown_02022C84->unk10;
|
||||
}
|
||||
|
||||
void sub_801F0BC(u8 *arg0, u8 *arg1)
|
||||
{
|
||||
*arg0 = gUnknown_02022C84->unk11;
|
||||
*arg1 = gUnknown_02022C84->unk12;
|
||||
}
|
||||
|
||||
u8 *sub_801F0D0(void)
|
||||
{
|
||||
return gUnknown_02022C84->unk1A;
|
||||
}
|
||||
|
||||
int sub_801F0DC(void)
|
||||
{
|
||||
u8 *str = sub_801F0D0();
|
||||
return StringLength_Multibyte(str);
|
||||
}
|
||||
|
||||
void sub_801F0EC(int *arg0, int *arg1)
|
||||
{
|
||||
int diff = gUnknown_02022C84->unk15 - gUnknown_02022C84->unk14;
|
||||
if (diff < 0)
|
||||
{
|
||||
diff *= -1;
|
||||
*arg0 = gUnknown_02022C84->unk15;
|
||||
}
|
||||
else
|
||||
{
|
||||
*arg0 = gUnknown_02022C84->unk14;
|
||||
}
|
||||
|
||||
*arg1 = diff;
|
||||
}
|
||||
|
||||
u8 *sub_801F114(void)
|
||||
{
|
||||
int i;
|
||||
u16 numChars = sub_801EED8();
|
||||
u8 *str = gUnknown_02022C84->unk1A;
|
||||
for (i = 0; i < numChars; i++)
|
||||
{
|
||||
if (*str == CHAR_SPECIAL_F9)
|
||||
*str++;
|
||||
|
||||
str++;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
u16 sub_801F144(void)
|
||||
{
|
||||
u16 count;
|
||||
u32 i;
|
||||
u16 numChars = sub_801EED8();
|
||||
u8 *str = gUnknown_02022C84->unk1A;
|
||||
for (count = 0, i = 0; i < numChars; count++, i++)
|
||||
{
|
||||
if (*str == CHAR_SPECIAL_F9)
|
||||
str++;
|
||||
|
||||
str++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
u8 *sub_801F180(void)
|
||||
{
|
||||
return gUnknown_02022C84->unk39;
|
||||
}
|
||||
|
||||
u8 sub_801F18C(void)
|
||||
{
|
||||
return gUnknown_02022C84->unk16;
|
||||
}
|
||||
|
||||
int sub_801F198(void)
|
||||
{
|
||||
return gUnknown_02022C84->unk15;
|
||||
}
|
||||
|
||||
int sub_801F1A4(void)
|
||||
{
|
||||
u8 *str = sub_801EEA8();
|
||||
u32 character = *str;
|
||||
if (character > 0xFF || gUnknown_082F2AA8[character] == character || gUnknown_082F2AA8[character] == 0)
|
||||
return 3;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 *sub_801F1D0(void)
|
||||
{
|
||||
return gUnknown_02022C84->unk79;
|
||||
}
|
||||
|
||||
void copy_strings_to_sav1(void)
|
||||
{
|
||||
StringCopy(gSaveBlock1Ptr->unk3C88[0], gText_Hello);
|
||||
StringCopy(gSaveBlock1Ptr->unk3C88[1], gText_Pokemon2);
|
||||
StringCopy(gSaveBlock1Ptr->unk3C88[2], gText_Trade);
|
||||
StringCopy(gSaveBlock1Ptr->unk3C88[3], gText_Battle);
|
||||
StringCopy(gSaveBlock1Ptr->unk3C88[4], gText_Lets);
|
||||
StringCopy(gSaveBlock1Ptr->unk3C88[5], gText_Ok);
|
||||
StringCopy(gSaveBlock1Ptr->unk3C88[6], gText_Sorry);
|
||||
StringCopy(gSaveBlock1Ptr->unk3C88[7], gText_YayUnkF9F9);
|
||||
StringCopy(gSaveBlock1Ptr->unk3C88[8], gText_ThankYou);
|
||||
StringCopy(gSaveBlock1Ptr->unk3C88[9], gText_ByeBye);
|
||||
}
|
||||
|
||||
static void sub_801F2B4(u8 taskId)
|
||||
{
|
||||
u8 *buffer;
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
switch (data[0])
|
||||
{
|
||||
case 0:
|
||||
if (!gReceivedRemoteLinkPlayers)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
return;
|
||||
}
|
||||
|
||||
data[0] = 1;
|
||||
// fall through
|
||||
case 1:
|
||||
data[4] = GetLinkPlayerCount();
|
||||
if (gUnknown_02022C84->unkD != data[4])
|
||||
{
|
||||
data[0] = 2;
|
||||
gUnknown_02022C84->unkD = data[4];
|
||||
return;
|
||||
}
|
||||
|
||||
data[3] = GetBlockReceivedStatus();
|
||||
if (!data[3] && sub_8011A9C())
|
||||
return;
|
||||
|
||||
data[1] = 0;
|
||||
data[0] = 3;
|
||||
// fall through
|
||||
case 3:
|
||||
for (; data[1] < 5 && ((data[3] >> data[1]) & 1) == 0; data[1]++)
|
||||
;
|
||||
|
||||
if (data[1] == 5)
|
||||
{
|
||||
data[0] = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
data[2] = data[1];
|
||||
ResetBlockReceivedFlag(data[2]);
|
||||
buffer = (u8 *)gBlockRecvBuffer[data[1]];
|
||||
switch (buffer[0])
|
||||
{
|
||||
default:
|
||||
case 1: data[5] = 3; break;
|
||||
case 2: data[5] = 3; break;
|
||||
case 3: data[5] = 4; break;
|
||||
case 4: data[5] = 5; break;
|
||||
case 5: data[5] = 6; break;
|
||||
}
|
||||
|
||||
if (sub_801EFF8(gUnknown_02022C84->unk39, (u8 *)gBlockRecvBuffer[data[1]]))
|
||||
{
|
||||
gUnknown_02022C84->unk16 = data[1];
|
||||
sub_801F5EC(12, 2);
|
||||
data[0] = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
data[0] = data[5];
|
||||
}
|
||||
|
||||
data[1]++;
|
||||
break;
|
||||
case 7:
|
||||
if (!sub_801F644(2))
|
||||
data[0] = data[5];
|
||||
break;
|
||||
case 4:
|
||||
if (!gUnknown_02022C84->unk13 && data[2])
|
||||
{
|
||||
if (GetLinkPlayerCount() == 2)
|
||||
{
|
||||
sub_80104B0();
|
||||
gUnknown_02022C84->unk17 = 1;
|
||||
DestroyTask(taskId);
|
||||
return;
|
||||
}
|
||||
|
||||
sub_8011DE0(data[2]);
|
||||
}
|
||||
|
||||
data[0] = 3;
|
||||
break;
|
||||
case 5:
|
||||
if (gUnknown_02022C84->unk13)
|
||||
gUnknown_02022C84->unk17 = 2;
|
||||
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
case 6:
|
||||
gUnknown_02022C84->unk17 = 3;
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
case 2:
|
||||
if (!sub_8011A9C())
|
||||
{
|
||||
if (!gUnknown_02022C84->unk13)
|
||||
sub_80110B8(gUnknown_02022C84->unkD);
|
||||
|
||||
data[0] = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool8 sub_801F4D0(void)
|
||||
{
|
||||
gUnknown_02022C88 = Alloc(sizeof(*gUnknown_02022C88));
|
||||
if (gUnknown_02022C88 && sub_8020890())
|
||||
{
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
InitBgsFromTemplates(0, gUnknown_082F2C60, ARRAY_COUNT(gUnknown_082F2C60));
|
||||
InitWindows(gUnknown_082F2C70);
|
||||
reset_temp_tile_data_buffers();
|
||||
sub_8020770();
|
||||
sub_801F574(gUnknown_02022C88);
|
||||
sub_801F580();
|
||||
sub_801F5EC(0, 0);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static bool32 sub_801F534(void)
|
||||
{
|
||||
return sub_801F644(0);
|
||||
}
|
||||
|
||||
static void sub_801F544(void)
|
||||
{
|
||||
sub_80208D0();
|
||||
if (gUnknown_02022C88)
|
||||
FREE_AND_SET_NULL(gUnknown_02022C88);
|
||||
|
||||
FreeAllWindowBuffers();
|
||||
gScanlineEffect.state = 3;
|
||||
}
|
||||
|
||||
static void sub_801F574(struct UnionRoomChat2 *arg0)
|
||||
{
|
||||
arg0->unk18 = 0xFF;
|
||||
arg0->unk1E = 0xFF;
|
||||
arg0->unk1A = 0;
|
||||
}
|
||||
|
||||
static void sub_801F580(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!gUnknown_02022C88)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
gUnknown_02022C88->unk0[i].unk0 = sub_801FDD8;
|
||||
gUnknown_02022C88->unk0[i].unk4 = 0;
|
||||
gUnknown_02022C88->unk0[i].unk5 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_801F5B8(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!gUnknown_02022C88)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
gUnknown_02022C88->unk0[i].unk4 =
|
||||
gUnknown_02022C88->unk0[i].unk0(&gUnknown_02022C88->unk0[i].unk5);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user