diff --git a/asm/rom_81D1C44.s b/asm/ereader.s similarity index 64% rename from asm/rom_81D1C44.s rename to asm/ereader.s index 001ac1b68..81264aca2 100644 --- a/asm/rom_81D1C44.s +++ b/asm/ereader.s @@ -6,1183 +6,6 @@ .text - thumb_func_start sub_81D38D4 -sub_81D38D4: @ 81D38D4 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d6d - adds r0, r1 - ldrb r1, [r0] - adds r2, r1, 0x1 - adds r0, r2, 0 - asrs r0, 8 - lsls r0, 8 - subs r0, r2, r0 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D38D4 - - thumb_func_start sub_81D38FC -sub_81D38FC: @ 81D38FC - push {r4,r5,lr} - adds r4, r0, 0 - movs r5, 0x9C - lsls r5, 2 - adds r1, r5, 0 - bl CalcByteArraySum - adds r4, r5 - ldr r1, [r4] - cmp r0, r1 - bne _081D3916 - movs r0, 0x1 - b _081D3918 -_081D3916: - movs r0, 0 -_081D3918: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D38FC - - thumb_func_start sub_81D3920 -sub_81D3920: @ 81D3920 - push {r4-r7,lr} - adds r7, r0, 0 - ldrb r6, [r7] - subs r0, r6, 0x1 - cmp r0, 0x7 - bhi _081D3964 - movs r5, 0 - cmp r5, r6 - bcs _081D394C - adds r4, r7, 0 - adds r4, 0x8 -_081D3936: - adds r0, r4, 0 - bl sub_81D38FC - cmp r0, 0 - beq _081D3964 - movs r0, 0x9D - lsls r0, 2 - adds r4, r0 - adds r5, 0x1 - cmp r5, r6 - bcc _081D3936 -_081D394C: - adds r0, r7, 0 - adds r0, 0x8 - movs r1, 0x9D - lsls r1, 2 - muls r1, r6 - bl CalcByteArraySum - ldr r1, [r7, 0x4] - cmp r0, r1 - bne _081D3964 - movs r0, 0x1 - b _081D3966 -_081D3964: - movs r0, 0 -_081D3966: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81D3920 - - thumb_func_start sub_81D396C -sub_81D396C: @ 81D396C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - subs r0, 0x1 - cmp r0, 0x7 - bhi _081D398E - adds r0, r4, 0 - adds r0, 0x8 - movs r1, 0xEE - lsls r1, 4 - bl CalcByteArraySum - ldr r1, [r4, 0x4] - cmp r0, r1 - bne _081D398E - movs r0, 0x1 - b _081D3990 -_081D398E: - movs r0, 0 -_081D3990: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81D396C - - thumb_func_start sub_81D3998 -sub_81D3998: @ 81D3998 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r0, 0 - mov r8, r1 - movs r2, 0x80 - lsls r2, 5 - mov r0, r8 - movs r1, 0 - bl memset - ldrb r0, [r7] - mov r1, r8 - strb r0, [r1] - bl sub_81D38D4 - mov r2, r8 - strb r0, [r2, 0x1] - ldrb r0, [r7] - adds r0, 0x1 - asrs r0, 1 - strb r0, [r2, 0x2] - movs r6, 0 - b _081D3A42 -_081D39C8: - movs r0, 0x1 - ands r0, r6 - cmp r0, 0 - bne _081D3A14 - lsrs r0, r6, 31 - adds r0, r6, r0 - asrs r0, 1 - lsls r4, r0, 4 - subs r4, r0 - lsls r4, 3 - subs r4, r0 - lsls r4, 3 - add r4, r8 - movs r0, 0x9D - lsls r0, 2 - adds r5, r6, 0 - muls r5, r0 - adds r5, r7, r5 - ldrb r0, [r5, 0x8] - strb r0, [r4, 0x8] - movs r1, 0xA7 - lsls r1, 2 - adds r0, r4, r1 - movs r2, 0xAA - lsls r2, 1 - adds r1, r5, r2 - subs r2, 0x30 - bl memcpy - adds r4, 0xC - adds r5, 0xC - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0xA4 - lsls r2, 1 - bl memcpy - b _081D3A40 -_081D3A14: - lsrs r1, r6, 31 - adds r1, r6, r1 - asrs r1, 1 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 3 - subs r0, r1 - lsls r0, 3 - add r0, r8 - movs r1, 0x9D - lsls r1, 2 - muls r1, r6 - adds r1, r7, r1 - ldrb r2, [r1, 0x8] - strb r2, [r0, 0x9] - movs r2, 0xAA - lsls r2, 1 - adds r0, r2 - adds r1, 0xC - subs r2, 0xC - bl memcpy -_081D3A40: - adds r6, 0x1 -_081D3A42: - ldrb r0, [r7] - cmp r6, r0 - blt _081D39C8 - movs r0, 0x1 - ands r0, r6 - cmp r0, 0 - beq _081D3A7E - lsrs r2, r6, 31 - adds r2, r6, r2 - asrs r2, 1 - lsls r0, r2, 4 - subs r0, r2 - lsls r0, 3 - subs r0, r2 - lsls r0, 3 - add r0, r8 - movs r1, 0xAA - lsls r1, 1 - adds r0, r1 - ldr r3, =gUnknown_08625B6C - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r2 - lsls r1, 3 - adds r1, r3 - movs r2, 0xA4 - lsls r2, 1 - bl memcpy -_081D3A7E: - mov r0, r8 - adds r0, 0x8 - movs r1, 0xEE - lsls r1, 4 - bl CalcByteArraySum - mov r2, r8 - str r0, [r2, 0x4] - movs r0, 0x1E - mov r1, r8 - bl sub_8153634 - cmp r0, 0x1 - bne _081D3AA4 - movs r0, 0x1 - b _081D3AA6 - .pool -_081D3AA4: - movs r0, 0 -_081D3AA6: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81D3998 - - thumb_func_start sub_81D3AB0 -sub_81D3AB0: @ 81D3AB0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x80 - lsls r0, 5 - bl AllocZeroed - adds r5, r0, 0 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81D3998 - adds r4, r0, 0 - adds r0, r5, 0 - bl Free - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D3AB0 - - thumb_func_start sub_81D3AD8 -sub_81D3AD8: @ 81D3AD8 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - movs r0, 0x1E - bl TryCopySpecialSaveSection - cmp r0, 0x1 - bne _081D3B04 - ldr r2, =0x00000ee8 - adds r0, r5, 0 - adds r1, r4, 0 - bl memcpy - adds r0, r5, 0 - bl sub_81D396C - cmp r0, 0 - beq _081D3B04 - movs r0, 0x1 - b _081D3B06 - .pool -_081D3B04: - movs r0, 0 -_081D3B06: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D3AD8 - - thumb_func_start sub_81D3B0C -sub_81D3B0C: @ 81D3B0C - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x80 - lsls r0, 5 - bl AllocZeroed - adds r5, r0, 0 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81D3AD8 - adds r4, r0, 0 - adds r0, r5, 0 - bl Free - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D3B0C - - thumb_func_start sub_81D3B34 -sub_81D3B34: @ 81D3B34 - push {r4,r5,lr} - movs r0, 0x80 - lsls r0, 5 - bl AllocZeroed - adds r4, r0, 0 - bl sub_81D3B0C - adds r5, r0, 0 - adds r0, r4, 0 - bl Free - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D3B34 - - thumb_func_start sub_81D3B54 -sub_81D3B54: @ 81D3B54 - push {r4-r7,lr} - sub sp, 0x4 - adds r6, r0, 0 - adds r5, r1, 0 - bl sub_81D41A0 - movs r7, 0x2 - ldr r4, =gShouldAdvanceLinkState -_081D3B64: - bl sub_81D4170 - ldr r0, =gUnknown_030012E2 - ldrh r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081D3B76 - strb r7, [r4] -_081D3B76: - movs r0, 0x1 - adds r1, r6, 0 - adds r2, r5, 0 - movs r3, 0 - bl sub_81D3D70 - adds r1, r0, 0 - ldr r0, =gUnknown_030012E4 - strh r1, [r0] - movs r0, 0x13 - ands r0, r1 - cmp r0, 0x10 - bne _081D3BA0 - movs r4, 0 - b _081D3BC2 - .pool -_081D3BA0: - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _081D3BAC - movs r4, 0x1 - b _081D3BC2 -_081D3BAC: - movs r0, 0x4 - ands r0, r1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _081D3BC0 - strb r0, [r4] - bl VBlankIntrWait - b _081D3B64 -_081D3BC0: - movs r4, 0x2 -_081D3BC2: - movs r0, 0 - str r0, [sp] - ldr r1, =gUnknown_030012C8 - ldr r2, =0x05000006 - mov r0, sp - bl CpuSet - bl sub_81D41F4 - adds r0, r4, 0 - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D3B54 - - thumb_func_start sub_81D3BE8 -sub_81D3BE8: @ 81D3BE8 - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - bl sub_81D41A0 - movs r6, 0x2 - ldr r4, =gShouldAdvanceLinkState -_081D3BF6: - bl sub_81D4170 - ldr r0, =gUnknown_030012E2 - ldrh r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081D3C08 - strb r6, [r4] -_081D3C08: - movs r0, 0 - movs r1, 0 - movs r2, 0 - adds r3, r5, 0 - bl sub_81D3D70 - adds r1, r0, 0 - ldr r0, =gUnknown_030012E4 - strh r1, [r0] - movs r0, 0x13 - ands r0, r1 - cmp r0, 0x10 - bne _081D3C34 - movs r4, 0 - b _081D3C56 - .pool -_081D3C34: - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _081D3C40 - movs r4, 0x1 - b _081D3C56 -_081D3C40: - movs r0, 0x4 - ands r0, r1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _081D3C54 - strb r0, [r4] - bl VBlankIntrWait - b _081D3BF6 -_081D3C54: - movs r4, 0x2 -_081D3C56: - movs r0, 0 - str r0, [sp] - ldr r1, =gUnknown_030012C8 - ldr r2, =0x05000006 - mov r0, sp - bl CpuSet - bl sub_81D41F4 - adds r0, r4, 0 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D3BE8 - - thumb_func_start sub_81D3C7C -sub_81D3C7C: @ 81D3C7C - push {r4,lr} - ldr r4, =0x04000208 - movs r3, 0 - strh r3, [r4] - ldr r2, =0x04000200 - ldrh r1, [r2] - ldr r0, =0x0000ff3f - ands r0, r1 - strh r0, [r2] - movs r0, 0x1 - strh r0, [r4] - ldr r0, =0x04000128 - strh r3, [r0] - subs r0, 0x1A - strh r3, [r0] - ldr r1, =0x04000202 - movs r0, 0xC0 - strh r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3C7C - - thumb_func_start sub_81D3CBC -sub_81D3CBC: @ 81D3CBC - push {r4-r7,lr} - sub sp, 0x4 - ldr r5, =0x04000208 - movs r4, 0 - strh r4, [r5] - ldr r3, =0x04000200 - ldrh r1, [r3] - ldr r0, =0x0000ff3f - ands r0, r1 - strh r0, [r3] - movs r6, 0x1 - strh r6, [r5] - ldr r0, =0x04000134 - strh r4, [r0] - ldr r2, =0x04000128 - movs r1, 0x80 - lsls r1, 6 - adds r0, r1, 0 - strh r0, [r2] - ldrh r0, [r2] - ldr r7, =0x00004003 - adds r1, r7, 0 - orrs r0, r1 - strh r0, [r2] - strh r4, [r5] - ldrh r0, [r3] - movs r1, 0x80 - orrs r0, r1 - strh r0, [r3] - strh r6, [r5] - ldr r1, =gUnknown_030012C8 - ldrb r0, [r1, 0x1] - cmp r0, 0 - bne _081D3D0A - str r0, [sp] - ldr r2, =0x05000006 - mov r0, sp - bl CpuSet -_081D3D0A: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3CBC - - thumb_func_start sub_81D3D34 -sub_81D3D34: @ 81D3D34 - ldr r0, =0x04000134 - movs r3, 0 - strh r3, [r0] - ldr r2, =0x04000128 - movs r1, 0xA0 - lsls r1, 7 - adds r0, r1, 0 - strh r0, [r2] - ldrh r0, [r2] - movs r1, 0x8 - orrs r0, r1 - strh r0, [r2] - ldr r0, =gShouldAdvanceLinkState - strb r3, [r0] - ldr r0, =gUnknown_030012E6 - strh r3, [r0] - ldr r1, =gUnknown_030012E8 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_81D3D34 - - thumb_func_start sub_81D3D70 -sub_81D3D70: @ 81D3D70 - push {r4-r6,lr} - adds r4, r1, 0 - adds r5, r2, 0 - adds r6, r3, 0 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_030012C8 - ldrb r0, [r0, 0x1] - cmp r0, 0x6 - bls _081D3D86 - b _081D3ECC -_081D3D86: - lsls r0, 2 - ldr r1, =_081D3D98 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081D3D98: - .4byte _081D3DB4 - .4byte _081D3DC8 - .4byte _081D3DE8 - .4byte _081D3DFC - .4byte _081D3E74 - .4byte _081D3E84 - .4byte _081D3EBC -_081D3DB4: - bl sub_81D3CBC - ldr r1, =gUnknown_030012C8 - movs r0, 0x1 - strb r0, [r1, 0x2] - strb r0, [r1, 0x1] - b _081D3ECC - .pool -_081D3DC8: - adds r0, r2, 0 - bl sub_81D3EE8 - lsls r0, 16 - cmp r0, 0 - beq _081D3DD8 - bl sub_81D413C -_081D3DD8: - ldr r0, =gShouldAdvanceLinkState - ldrb r0, [r0] - cmp r0, 0x2 - beq _081D3DE2 - b _081D3ECC -_081D3DE2: - b _081D3E04 - .pool -_081D3DE8: - bl sub_81D3D34 - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r6, 0 - bl sub_81D3F1C - ldr r1, =gUnknown_030012C8 - movs r0, 0x3 - strb r0, [r1, 0x1] -_081D3DFC: - ldr r0, =gShouldAdvanceLinkState - ldrb r0, [r0] - cmp r0, 0x2 - bne _081D3E18 -_081D3E04: - ldr r1, =gUnknown_030012C8 - strb r0, [r1, 0x4] - movs r0, 0x6 - strb r0, [r1, 0x1] - b _081D3ECC - .pool -_081D3E18: - ldr r2, =gUnknown_030012E6 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - ldr r1, =gUnknown_030012E8 - ldr r0, [r1] - adds r3, r0, 0x1 - str r3, [r1] - ldr r1, =gUnknown_030012C8 - ldrb r0, [r1] - cmp r0, 0 - bne _081D3E3C - cmp r3, 0x3C - bls _081D3E3C - movs r0, 0x1 - strb r0, [r1, 0x4] - movs r0, 0x6 - strb r0, [r1, 0x1] -_081D3E3C: - ldr r4, =gUnknown_030012C8 - ldrb r0, [r4, 0x2] - cmp r0, 0x2 - beq _081D3ECC - ldrb r0, [r4] - cmp r0, 0 - beq _081D3E64 - ldrh r0, [r2] - cmp r0, 0x2 - bls _081D3E64 - bl sub_81D413C - movs r0, 0x2 - b _081D3ECA - .pool -_081D3E64: - bl sub_81D413C - ldr r1, =gUnknown_030012C8 - movs r0, 0x2 - strb r0, [r1, 0x2] - b _081D3ECC - .pool -_081D3E74: - bl sub_81D3CBC - ldr r1, =gUnknown_030012C8 - movs r0, 0x5 - strb r0, [r1, 0x1] - b _081D3ECC - .pool -_081D3E84: - ldr r0, =gUnknown_030012C8 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081D3E98 - ldr r0, =gUnknown_030012E6 - ldrh r0, [r0] - cmp r0, 0x2 - bls _081D3E98 - bl sub_81D413C -_081D3E98: - ldr r1, =gUnknown_030012E6 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x3C - bls _081D3ECC - ldr r0, =gUnknown_030012C8 - movs r1, 0x1 - strb r1, [r0, 0x4] - movs r1, 0x6 - strb r1, [r0, 0x1] - b _081D3ECC - .pool -_081D3EBC: - ldr r4, =gUnknown_030012C8 - ldrb r0, [r4, 0x2] - cmp r0, 0 - beq _081D3ECC - bl sub_81D3C7C - movs r0, 0 -_081D3ECA: - strb r0, [r4, 0x2] -_081D3ECC: - ldr r2, =gUnknown_030012C8 - ldrb r0, [r2, 0x2] - ldrb r1, [r2, 0x4] - lsls r1, 2 - orrs r0, r1 - ldrb r1, [r2, 0x3] - lsls r1, 4 - orrs r0, r1 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D3D70 - - thumb_func_start sub_81D3EE8 -sub_81D3EE8: @ 81D3EE8 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =0x04000128 - ldr r0, [r0] - movs r1, 0xC - ands r0, r1 - cmp r0, 0x8 - bne _081D3F0C - cmp r2, 0 - beq _081D3F0C - ldr r1, =gUnknown_030012C8 - movs r0, 0x1 - b _081D3F10 - .pool -_081D3F0C: - ldr r1, =gUnknown_030012C8 - movs r0, 0 -_081D3F10: - strb r0, [r1] - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D3EE8 - - thumb_func_start sub_81D3F1C -sub_81D3F1C: @ 81D3F1C - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldr r3, =gUnknown_030012C8 - ldrb r0, [r3] - cmp r0, 0 - beq _081D3F54 - ldr r2, =0x04000128 - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - str r5, [r3, 0x8] - ldr r0, =0x04000120 - str r4, [r0] - lsrs r0, r4, 2 - adds r0, 0x1 - str r0, [r3, 0x10] - bl sub_81D3F68 - b _081D3F5C - .pool -_081D3F54: - ldr r1, =0x04000128 - ldrh r0, [r1] - strh r0, [r1] - str r2, [r3, 0x8] -_081D3F5C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3F1C - - thumb_func_start sub_81D3F68 -sub_81D3F68: @ 81D3F68 - ldr r1, =0x0400010c - ldr r2, =0x0000fda7 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =0x0400010e - movs r2, 0x40 - strh r2, [r0] - ldr r3, =0x04000208 - movs r0, 0 - strh r0, [r3] - adds r1, 0xF4 - ldrh r0, [r1] - orrs r0, r2 - strh r0, [r1] - movs r0, 0x1 - strh r0, [r3] - bx lr - .pool - thumb_func_end sub_81D3F68 - - thumb_func_start sub_81D3F9C -sub_81D3F9C: @ 81D3F9C - push {lr} - bl sub_81D414C - bl sub_81D413C - pop {r0} - bx r0 - thumb_func_end sub_81D3F9C - - thumb_func_start sub_81D3FAC -sub_81D3FAC: @ 81D3FAC - push {r4-r6,lr} - sub sp, 0x8 - ldr r2, =gUnknown_030012C8 - ldrb r0, [r2, 0x1] - adds r3, r2, 0 - cmp r0, 0x3 - beq _081D4034 - cmp r0, 0x3 - bgt _081D3FC8 - cmp r0, 0x1 - beq _081D3FD0 - b _081D412A - .pool -_081D3FC8: - cmp r0, 0x5 - bne _081D3FCE - b _081D40FC -_081D3FCE: - b _081D412A -_081D3FD0: - ldr r1, =0x0400012a - ldr r2, =0x0000ccd0 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =0x04000120 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - movs r1, 0 - movs r2, 0 - movs r4, 0 - ldr r6, =0x0000ccd0 - ldr r5, =0x0000ffff -_081D3FEC: - lsls r0, r1, 1 - add r0, sp - ldrh r0, [r0] - cmp r0, r6 - bne _081D4010 - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - b _081D401A - .pool -_081D4010: - cmp r0, r5 - beq _081D401A - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 -_081D401A: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0x3 - bls _081D3FEC - cmp r2, 0x2 - beq _081D402A - b _081D412A -_081D402A: - cmp r4, 0 - beq _081D4030 - b _081D412A -_081D4030: - strb r2, [r3, 0x1] - b _081D412A -_081D4034: - ldr r0, =0x04000120 - ldr r4, [r0] - ldr r0, [r2, 0xC] - cmp r0, 0 - bne _081D404A - ldrb r0, [r2] - cmp r0, 0 - bne _081D404A - lsrs r0, r4, 2 - adds r0, 0x1 - str r0, [r2, 0x10] -_081D404A: - ldrb r0, [r3] - cmp r0, 0x1 - bne _081D4080 - ldr r1, [r3, 0xC] - ldr r0, [r3, 0x10] - cmp r1, r0 - bge _081D4074 - ldr r2, =0x04000120 - ldr r0, [r3, 0x8] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - str r0, [r2] - ldr r0, [r3, 0x14] - ldr r1, [r1] - adds r0, r1 - str r0, [r3, 0x14] - b _081D40BA - .pool -_081D4074: - ldr r1, =0x04000120 - ldr r0, [r3, 0x14] - b _081D40B8 - .pool -_081D4080: - ldr r1, [r3, 0xC] - cmp r1, 0 - ble _081D40A0 - ldr r0, [r3, 0x10] - adds r0, 0x1 - cmp r1, r0 - bge _081D40A0 - ldr r0, [r3, 0x8] - lsls r1, 2 - adds r1, r0 - subs r1, 0x4 - str r4, [r1] - ldr r0, [r3, 0x14] - adds r0, r4 - str r0, [r3, 0x14] - b _081D40B4 -_081D40A0: - ldr r0, [r3, 0xC] - cmp r0, 0 - beq _081D40B4 - ldr r0, [r3, 0x14] - cmp r0, r4 - bne _081D40B0 - movs r0, 0x1 - b _081D40B2 -_081D40B0: - movs r0, 0x2 -_081D40B2: - strb r0, [r3, 0x3] -_081D40B4: - ldr r1, =gUnknown_030012E8 - movs r0, 0 -_081D40B8: - str r0, [r1] -_081D40BA: - ldr r1, [r3, 0xC] - adds r1, 0x1 - str r1, [r3, 0xC] - ldr r0, [r3, 0x10] - adds r0, 0x2 - cmp r1, r0 - bge _081D40EA - ldrb r0, [r3] - cmp r0, 0 - beq _081D40E4 - ldr r0, =0x0400010e - ldrh r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strh r1, [r0] - b _081D412A - .pool -_081D40E4: - bl sub_81D413C - b _081D412A -_081D40EA: - movs r0, 0 - movs r1, 0x4 - strb r1, [r3, 0x1] - ldr r1, =gUnknown_030012E6 - strh r0, [r1] - b _081D412A - .pool -_081D40FC: - ldrb r3, [r2] - cmp r3, 0 - bne _081D4108 - ldr r1, =0x0400012a - ldrb r0, [r2, 0x3] - strh r0, [r1] -_081D4108: - ldr r0, =0x04000120 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - mov r0, sp - ldrh r1, [r0, 0x2] - subs r0, r1, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bhi _081D412A - cmp r3, 0x1 - bne _081D4126 - strb r1, [r2, 0x3] -_081D4126: - movs r0, 0x6 - strb r0, [r2, 0x1] -_081D412A: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3FAC - - thumb_func_start sub_81D413C -sub_81D413C: @ 81D413C - ldr r0, =0x04000128 - ldrh r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strh r1, [r0] - bx lr - .pool - thumb_func_end sub_81D413C - - thumb_func_start sub_81D414C -sub_81D414C: @ 81D414C - ldr r2, =0x0400010e - ldrh r1, [r2] - ldr r0, =0x0000ff7f - ands r0, r1 - strh r0, [r2] - ldr r1, =0x0400010c - ldr r2, =0x0000fda7 - adds r0, r2, 0 - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_81D414C - - thumb_func_start sub_81D4170 -sub_81D4170: @ 81D4170 - push {r4,lr} - ldr r0, =0x04000130 - ldrh r0, [r0] - ldr r2, =0x000003ff - adds r1, r2, 0 - eors r1, r0 - ldr r4, =gUnknown_030012E2 - ldr r3, =gUnknown_030012E0 - ldrh r2, [r3] - adds r0, r1, 0 - bics r0, r2 - strh r0, [r4] - strh r1, [r3] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D4170 - - thumb_func_start sub_81D41A0 -sub_81D41A0: @ 81D41A0 - ldr r1, =gUnknown_030012EC - ldr r0, =0x04000208 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_030012EE - ldr r0, =0x04000200 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_030012F0 - ldr r0, =0x0400010e - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_030012F2 - ldr r0, =0x04000128 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_030012F4 - ldr r0, =0x04000134 - ldrh r0, [r0] - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_81D41A0 - - thumb_func_start sub_81D41F4 -sub_81D41F4: @ 81D41F4 - ldr r1, =0x04000208 - ldr r0, =gUnknown_030012EC - ldrh r0, [r0] - strh r0, [r1] - subs r1, 0x8 - ldr r0, =gUnknown_030012EE - ldrh r0, [r0] - strh r0, [r1] - subs r1, 0xF2 - ldr r0, =gUnknown_030012F0 - ldrh r0, [r0] - strh r0, [r1] - adds r1, 0x1A - ldr r0, =gUnknown_030012F2 - ldrh r0, [r0] - strh r0, [r1] - adds r1, 0xC - ldr r0, =gUnknown_030012F4 - ldrh r0, [r0] - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_81D41F4 - - thumb_func_start sub_81D4238 -sub_81D4238: @ 81D4238 - push {lr} - sub sp, 0x4 - movs r0, 0 - str r0, [sp] - ldr r1, =gUnknown_030012C8 - ldr r2, =0x05000006 - mov r0, sp - bl CpuSet - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D4238 - - thumb_func_start sub_81D4258 -sub_81D4258: @ 81D4258 - push {lr} - sub sp, 0x4 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrb r1, [r0, 0x5] - ldrb r2, [r0, 0x4] - movs r0, 0x1 - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - mov r0, sp - ldrb r0, [r0] - add sp, 0x4 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D4258 - thumb_func_start sub_81D427C sub_81D427C: @ 81D427C push {r4-r7,lr} diff --git a/data/rom_81D1C44.s b/data/ereader.s similarity index 100% rename from data/rom_81D1C44.s rename to data/ereader.s diff --git a/include/ereader.h b/include/ereader.h new file mode 100755 index 000000000..da31c8212 --- /dev/null +++ b/include/ereader.h @@ -0,0 +1,9 @@ +#ifndef GUARD_EREADER_H +#define GUARD_EREADER_H + +bool32 sub_81D3B34(void); +u32 sub_81D427C(void); +bool8 sub_81D4A58(struct EventObject*); +bool8 EventObjectIsFarawayIslandMew(struct EventObject *); + +#endif // GUARD_EREADER_H diff --git a/include/pokenav.h b/include/pokenav.h index 55bfb366c..4e02461fe 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -3,9 +3,6 @@ #include "list_menu.h" bool8 sub_81D312C(void *arg0); -bool8 sub_81D4A58(struct EventObject*); -bool8 EventObjectIsFarawayIslandMew(struct EventObject *); -u32 sub_81D427C(void); void sub_81D4998(void); void CB2_InitPokeNav(void); diff --git a/ld_script.txt b/ld_script.txt index bd0bb7661..5a1442fa8 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -291,7 +291,8 @@ SECTIONS { src/pokenav_match_call.o(.text); src/menu_specialized.o(.text); asm/menu_specialized.o(.text); - asm/rom_81D1C44.o(.text); + src/ereader.o(.text); + asm/ereader.o(.text); src/trainer_hill.o(.text); src/rayquaza_scene.o(.text); src/walda_phrase.o(.text); @@ -596,7 +597,7 @@ SECTIONS { src/pokenav_match_call.o(.rodata); src/menu_specialized.o(.rodata); data/menu_specialized.o(.rodata); - data/rom_81D1C44.o(.rodata); + data/ereader.o(.rodata); src/trainer_hill.o(.rodata); src/rayquaza_scene.o(.rodata); src/walda_phrase.o(.rodata); diff --git a/src/ereader.c b/src/ereader.c new file mode 100755 index 000000000..053f82381 --- /dev/null +++ b/src/ereader.c @@ -0,0 +1,564 @@ +#include "global.h" +#include "alloc.h" +#include "event_object_movement.h" +#include "link.h" +#include "save.h" +#include "util.h" + +struct Unk81D38FC +{ + u8 unk0[0x270]; + int checksum; +}; + +struct Unknown030012C8 +{ + u8 unk0[8]; + u32 *unk8; + int unkC; + int unk10; + int unk14; +}; + +void sub_81D41A0(void); +static void sub_81D4170(void); +int sub_81D3D70(u8, u32, u32*, u32*); +void sub_81D41F4(void); +static u16 sub_81D3EE8(u8); +static void sub_81D413C(void); +static void sub_81D414C(void); +static void sub_81D3F1C(u32, u32*, u32*); +static void sub_81D3F68(void); + +extern struct Unknown030012C8 gUnknown_030012C8; +extern u16 gUnknown_030012E0; +extern u16 gUnknown_030012E2; +extern u16 gUnknown_030012E4; +extern u16 gUnknown_030012E6; +extern u32 gUnknown_030012E8; +extern u16 gUnknown_030012EC; +extern u16 gUnknown_030012EE; +extern u16 gUnknown_030012F0; +extern u16 gUnknown_030012F2; +extern u16 gUnknown_030012F4; + +extern const u8 gUnknown_08625B6C[]; + +static u8 sub_81D38D4(void) +{ + return (gSaveBlock1Ptr->trainerHill.unused + 1) % 256; +} + +static bool32 sub_81D38FC(struct Unk81D38FC *arg0) +{ + int checksum = CalcByteArraySum(arg0->unk0, 0x270); + if (checksum != arg0->checksum) + return FALSE; + + return TRUE; +} + +bool8 sub_81D3920(u8 *buffer) +{ + u32 i; + u32 checksum; + int var0 = buffer[0]; + if (var0 < 1 || var0 > 8) + return FALSE; + + for (i = 0; i < var0; i++) + { + struct Unk81D38FC *var1 = (struct Unk81D38FC *)(&buffer[i * (sizeof(struct Unk81D38FC)) + 8]); + if (!sub_81D38FC(var1)) + return FALSE; + } + + checksum = CalcByteArraySum(buffer + 8, var0 * 0x274); + if (checksum != ((int *)buffer)[1]) + return FALSE; + + return TRUE; +} + +static bool32 sub_81D396C(u8 *buffer) +{ + u32 checksum; + int var0 = buffer[0]; + if (var0 < 1 || var0 > 8) + return FALSE; + + checksum = CalcByteArraySum(buffer + 8, 0xEE0); + if (checksum != ((int *)buffer)[1]) + return FALSE; + + return TRUE; +} + +static bool32 sub_81D3998(struct Unk81D38FC *arg0, u8 *buffer2) +{ + int i; + const u8 *ereaderVals; + + memset(buffer2, 0, 0x1000); + buffer2[0] = arg0->unk0[0]; + buffer2[1] = sub_81D38D4(); + buffer2[2] = (arg0->unk0[0] + 1) / 2; + + for (i = 0; i < arg0->unk0[0]; i++) + { + if (!(i & 1)) + { + u8 *var0 = &buffer2[(i / 2) * 0x3B8]; + u8 *var1 = arg0[i].unk0; + var0[8] = var1[8]; + memcpy(&var0[0x29C], &var1[0x154], 0x124); + var0 += 0xC; + var1 += 0xC; + memcpy(var0, var1, 0x148); + } + else + { + u8 *var0 = &buffer2[(i / 2) * 0x3B8]; + u8 *var1 = arg0[i].unk0; + var0[9] = var1[8]; + memcpy(&var0[0x154], &var1[0xC], 0x148); + } + } + + if (i & 1) + { + u8 *var0 = &buffer2[(i / 2) * 0x3B8]; + var0 += 0x154; + + ereaderVals = gUnknown_08625B6C; + memcpy(var0, &ereaderVals[(i / 2) * 0x148], 0x148); + } + + ((int *)buffer2)[1] = CalcByteArraySum(buffer2 + 8, 0xEE0); + if (sub_8153634(SECTOR_ID_TRAINER_HILL, buffer2) != 1) + return FALSE; + + return TRUE; +} + +bool32 sub_81D3AB0(struct Unk81D38FC *arg0) +{ + u8 *var0 = AllocZeroed(0x1000); + bool32 result = sub_81D3998(arg0, var0); + Free(var0); + return result; +} + +static bool32 sub_81D3AD8(u8 *arg0, u8 *arg1) +{ + if (TryCopySpecialSaveSection(SECTOR_ID_TRAINER_HILL, arg1) != 1) + return FALSE; + + memcpy(arg0, arg1, 0xEE8); + if (!sub_81D396C(arg0)) + return FALSE; + + return TRUE; +} + +static bool32 sub_81D3B0C(u8 *arg0) +{ + u8 *var0 = AllocZeroed(0x1000); + bool32 result = sub_81D3AD8(arg0, var0); + Free(var0); + return result; +} + +bool32 sub_81D3B34(void) +{ + u8 *var0 = AllocZeroed(0x1000); + bool32 result = sub_81D3B0C(var0); + Free(var0); + return result; +} + +static int unref_sub_81D3B54(int arg0, u32 *arg1) +{ + int result; + u16 var0; + int var1; + + sub_81D41A0(); + while (1) + { + sub_81D4170(); + if (gUnknown_030012E2 & 2) + gShouldAdvanceLinkState = 2; + + var1 = sub_81D3D70(1, arg0, arg1, NULL); + gUnknown_030012E4 = var1; + if ((gUnknown_030012E4 & 0x13) == 0x10) + { + result = 0; + break; + } + + if (gUnknown_030012E4 & 0x8) + { + result = 1; + break; + } + + var0 = gUnknown_030012E4 & 0x4; + if (var0) + { + result = 2; + break; + } + + gShouldAdvanceLinkState = var0; + VBlankIntrWait(); + } + + CpuFill32(0, &gUnknown_030012C8, sizeof(struct Unknown030012C8)); + sub_81D41F4(); + return result; +} + +static int unref_sub_81D3BE8(u32 *arg0) +{ + int result; + u16 var0; + int var1; + + sub_81D41A0(); + while (1) + { + sub_81D4170(); + if (gUnknown_030012E2 & 2) + gShouldAdvanceLinkState = 2; + + var1 = sub_81D3D70(0, 0, NULL, arg0); + gUnknown_030012E4 = var1; + if ((gUnknown_030012E4 & 0x13) == 0x10) + { + result = 0; + break; + } + + if (gUnknown_030012E4 & 0x8) + { + result = 1; + break; + } + + var0 = gUnknown_030012E4 & 0x4; + if (var0) + { + result = 2; + break; + } + + gShouldAdvanceLinkState = var0; + VBlankIntrWait(); + } + + CpuFill32(0, &gUnknown_030012C8, sizeof(struct Unknown030012C8)); + sub_81D41F4(); + return result; +} + +static void sub_81D3C7C(void) +{ + REG_IME = 0; + REG_IE &= ~(INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL); + REG_IME = 1; + REG_SIOCNT = 0; + REG_TM3CNT_H = 0; + REG_IF = INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL; +} + +static void sub_81D3CBC(void) +{ + REG_IME = 0; + REG_IE &= ~(INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL); + REG_IME = 1; + REG_RCNT = 0; + REG_SIOCNT = SIO_MULTI_MODE; + REG_SIOCNT |= SIO_INTR_ENABLE | SIO_115200_BPS; + REG_IME = 0; + REG_IE |= INTR_FLAG_SERIAL; + REG_IME = 1; + + if (!gUnknown_030012C8.unk0[1]) + CpuFill32(0, &gUnknown_030012C8, sizeof(struct Unknown030012C8)); +} + +static void sub_81D3D34(void) +{ + REG_RCNT = 0; + REG_SIOCNT = SIO_32BIT_MODE | SIO_INTR_ENABLE; + REG_SIOCNT |= SIO_MULTI_SD; + gShouldAdvanceLinkState = 0; + gUnknown_030012E6 = 0; + gUnknown_030012E8 = 0; +} + +int sub_81D3D70(u8 arg0, u32 arg1, u32 *arg2, u32 *arg3) +{ + switch (gUnknown_030012C8.unk0[1]) + { + case 0: + sub_81D3CBC(); + gUnknown_030012C8.unk0[2] = 1; + gUnknown_030012C8.unk0[1] = 1; + break; + case 1: + if (sub_81D3EE8(arg0)) + sub_81D413C(); + + if (gShouldAdvanceLinkState == 2) + { + gUnknown_030012C8.unk0[4] = 2; + gUnknown_030012C8.unk0[1] = 6; + } + break; + case 2: + sub_81D3D34(); + sub_81D3F1C(arg1, arg2, arg3); + gUnknown_030012C8.unk0[1] = 3; + // fall through + case 3: + if (gShouldAdvanceLinkState == 2) + { + gUnknown_030012C8.unk0[4] = 2; + gUnknown_030012C8.unk0[1] = 6; + } + else + { + gUnknown_030012E6++; + gUnknown_030012E8++; + if (!gUnknown_030012C8.unk0[0] && gUnknown_030012E8 > 60) + { + gUnknown_030012C8.unk0[4] = 1; + gUnknown_030012C8.unk0[1] = 6; + } + + if (gUnknown_030012C8.unk0[2] != 2) + { + if (gUnknown_030012C8.unk0[0] && gUnknown_030012E6 > 2) + { + sub_81D413C(); + gUnknown_030012C8.unk0[2] = 2; + } + else + { + sub_81D413C(); + gUnknown_030012C8.unk0[2] = 2; + } + } + } + break; + case 4: + sub_81D3CBC(); + gUnknown_030012C8.unk0[1] = 5; + break; + case 5: + if (gUnknown_030012C8.unk0[0] == 1 && gUnknown_030012E6 > 2) + sub_81D413C(); + + if (++gUnknown_030012E6 > 60) + { + gUnknown_030012C8.unk0[4] = 1; + gUnknown_030012C8.unk0[1] = 6; + } + break; + case 6: + if (gUnknown_030012C8.unk0[2]) + { + sub_81D3C7C(); + gUnknown_030012C8.unk0[2] = 0; + } + break; + } + + return gUnknown_030012C8.unk0[2] | (gUnknown_030012C8.unk0[4] << 2) | (gUnknown_030012C8.unk0[3] << 4); +} + +static u16 sub_81D3EE8(u8 arg0) +{ + u16 terminal = (*(vu32 *)REG_ADDR_SIOCNT) & (SIO_MULTI_SI | SIO_MULTI_SD); + if (terminal == SIO_MULTI_SD && arg0) + { + gUnknown_030012C8.unk0[0] = 1; + return 1; + } + else + { + gUnknown_030012C8.unk0[0] = 0; + return 0; + } +} + +static void sub_81D3F1C(u32 arg0, u32 *arg1, u32 *arg2) +{ + if (gUnknown_030012C8.unk0[0]) + { + REG_SIOCNT |= SIO_38400_BPS; + gUnknown_030012C8.unk8 = arg1; + REG_SIODATA32 = arg0; + gUnknown_030012C8.unk10 = arg0 / 4 + 1; + sub_81D3F68(); + } + else + { + REG_SIOCNT = REG_SIOCNT; + gUnknown_030012C8.unk8 = arg2; + } +} + +static void sub_81D3F68(void) +{ + REG_TM3CNT_L = 0xFDA7; + REG_TM3CNT_H = TIMER_INTR_ENABLE; + REG_IME = 0; + REG_IE |= INTR_FLAG_TIMER3; + REG_IME = 1; +} + +void sub_81D3F9C(void) +{ + sub_81D414C(); + sub_81D413C(); +} + +void sub_81D3FAC(void) +{ + u16 i, playerCount, k; + u32 value; + u16 var0; + u16 recvBuffer[4]; + + switch (gUnknown_030012C8.unk0[1]) + { + case 1: + REG_SIOMLT_SEND = 0xCCD0; // Handshake id + *(u64 *)recvBuffer = REG_SIOMLT_RECV; + for (i = 0, playerCount = 0, k = 0; i < 4; i++) + { + if (recvBuffer[i] == 0xCCD0) + playerCount++; + else if (recvBuffer[i] != 0xFFFF) + k++; + } + + if (playerCount == 2 && k == 0) + gUnknown_030012C8.unk0[1] = 2; + break; + case 3: + value = REG_SIODATA32; + if (!gUnknown_030012C8.unkC && !gUnknown_030012C8.unk0[0]) + gUnknown_030012C8.unk10 = value / 4 + 1; + + if (gUnknown_030012C8.unk0[0] == 1) + { + if (gUnknown_030012C8.unkC < gUnknown_030012C8.unk10) + { + REG_SIODATA32 = gUnknown_030012C8.unk8[gUnknown_030012C8.unkC]; + gUnknown_030012C8.unk14 += gUnknown_030012C8.unk8[gUnknown_030012C8.unkC]; + } + else + { + REG_SIODATA32 = gUnknown_030012C8.unk14; + } + } + else + { + if (gUnknown_030012C8.unkC > 0 && gUnknown_030012C8.unkC < gUnknown_030012C8.unk10 + 1) + { + gUnknown_030012C8.unk8[gUnknown_030012C8.unkC - 1] = value; + gUnknown_030012C8.unk14 += value; + } + else if (gUnknown_030012C8.unkC) + { + if (gUnknown_030012C8.unk14 == value) + gUnknown_030012C8.unk0[3] = 1; + else + gUnknown_030012C8.unk0[3] = 2; + } + + gUnknown_030012E8 = 0; + } + + if (++gUnknown_030012C8.unkC < gUnknown_030012C8.unk10 + 2) + { + if (gUnknown_030012C8.unk0[0]) + REG_TM3CNT_H |= TIMER_ENABLE; + else + sub_81D413C(); + } + else + { + gUnknown_030012C8.unk0[1] = 4; + gUnknown_030012E6 = 0; + } + break; + case 5: + if (!gUnknown_030012C8.unk0[0]) + REG_SIOMLT_SEND = gUnknown_030012C8.unk0[3]; + + *(u64 *)recvBuffer = REG_SIOMLT_RECV; + var0 = recvBuffer[1] - 1; + if (var0 < 2) + { + if (gUnknown_030012C8.unk0[0] == 1) + gUnknown_030012C8.unk0[3] = recvBuffer[1]; + + gUnknown_030012C8.unk0[1] = 6; + } + break; + } +} + +static void sub_81D413C(void) +{ + REG_SIOCNT |= SIO_ENABLE; +} + +static void sub_81D414C(void) +{ + REG_TM3CNT_H &= ~TIMER_ENABLE; + REG_TM3CNT_L = 0xFDA7; +} + +static void sub_81D4170(void) +{ + int keysMask = REG_KEYINPUT ^ KEYS_MASK; + gUnknown_030012E2 = keysMask & ~gUnknown_030012E0; + gUnknown_030012E0 = keysMask; +} + +void sub_81D41A0(void) +{ + gUnknown_030012EC = REG_IME; + gUnknown_030012EE = REG_IE; + gUnknown_030012F0 = REG_TM3CNT_H; + gUnknown_030012F2 = REG_SIOCNT; + gUnknown_030012F4 = REG_RCNT; +} + +void sub_81D41F4(void) +{ + REG_IME = gUnknown_030012EC; + REG_IE = gUnknown_030012EE; + REG_TM3CNT_H = gUnknown_030012F0; + REG_SIOCNT = gUnknown_030012F2; + REG_RCNT = gUnknown_030012F4; +} + +void sub_81D4238(void) +{ + CpuFill32(0, &gUnknown_030012C8, sizeof(struct Unknown030012C8)); +} + +u8 sub_81D4258(void) +{ + u8 eventObjectId; + TryGetEventObjectIdByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &eventObjectId); + return eventObjectId; +} diff --git a/src/event_object_movement.c b/src/event_object_movement.c index ba62db10d..8ebdd883f 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -3,6 +3,7 @@ #include "battle_pyramid.h" #include "berry.h" #include "decoration.h" +#include "ereader.h" #include "event_data.h" #include "event_object_movement.h" #include "event_scripts.h" @@ -15,7 +16,6 @@ #include "metatile_behavior.h" #include "overworld.h" #include "palette.h" -#include "pokenav.h" #include "random.h" #include "sprite.h" #include "task.h" diff --git a/src/trainer_hill.c b/src/trainer_hill.c index 43b29e26e..7bb1b997a 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -3,6 +3,7 @@ #include "battle.h" #include "battle_tower.h" #include "battle_setup.h" +#include "ereader.h" #include "event_data.h" #include "event_scripts.h" #include "fieldmap.h" @@ -32,8 +33,6 @@ #include "constants/easy_chat.h" #include "constants/trainer_hill.h" -extern bool32 sub_81D3B34(void); - #define HILL_TAG_NORMAL 0 #define HILL_TAG_VARIETY 1 #define HILL_TAG_UNIQUE 2