diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index 7f0a54c82..c24b46a34 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -904,8 +904,8 @@ Overlay OVERLAY_24 { ##Memo Pad## After OVERLAY_20 - Object overlay_24_sinit.o - Object overlay_24.o + Object ov24_02254840.o + Object ov24_02254CA0.o } Overlay OVERLAY_25 diff --git a/arm9/global.inc b/arm9/global.inc index 84a5336b2..e4e9d1d2e 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -7960,9 +7960,9 @@ .extern ov20_022529A0 .extern ov20_022529B4 .extern ov20_02252B1C -.extern ov20_02252B28 +.extern Poketch_PlaySoundEffect .extern ov20_02252B48 -.extern ov20_02252B68 +.extern TouchScreen_GetTapState .extern ov20_02252BB8 .extern ov20_02252C08 .extern ov20_02252C14 @@ -8030,6 +8030,20 @@ .extern ov21_02254B10 .extern ov21_02254B34 .extern ov21_02254B40 +.extern ov24_02254854 +.extern ov24_022548F4 +.extern ov24_02254998 +.extern ov24_022549AC +.extern ov24_022549F8 +.extern ov24_02254C64 +.extern ov24_02254D00 +.extern ov24_02254DC8 +.extern ov24_02254DDC +.extern ov24_02254EE0 +.extern ov24_02254F28 +.extern ov24_02254F40 +.extern ov24_02255038 +.extern ov24_02255050 .extern ov26_02254BD4 .extern ov26_02254C04 .extern ov26_02254C10 diff --git a/arm9/overlays/19/src/overlay_19.c b/arm9/overlays/19/src/overlay_19.c index eeafb68d6..2f3d48fa2 100644 --- a/arm9/overlays/19/src/overlay_19.c +++ b/arm9/overlays/19/src/overlay_19.c @@ -28,9 +28,9 @@ void ov19_02252440(struct BgConfig * bgConfig) GX_SetBankForSubOBJ(0x100); GXS_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); InitBgFromTemplate(bgConfig, GF_BG_LYR_SUB_0, &ov19_02252508, GF_BG_TYPE_TEXT); - GfGfxLoader_LoadCharData(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0010_NCGR_lz, bgConfig, GF_BG_LYR_SUB_0, 0, 0, TRUE, HEAP_ID_8); - GfGfxLoader_LoadScrnData(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0011_NSCR_lz, bgConfig, GF_BG_LYR_SUB_0, 0, 0, TRUE, HEAP_ID_8); - GfGfxLoader_GXLoadPal(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0012_NCLR, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_0_OFFSET, 0x20, HEAP_ID_8); + GfGfxLoader_LoadCharData(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0010_NCGR_lz, bgConfig, GF_BG_LYR_SUB_0, 0, 0, TRUE, HEAP_ID_POKETCH_APP); + GfGfxLoader_LoadScrnData(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0011_NSCR_lz, bgConfig, GF_BG_LYR_SUB_0, 0, 0, TRUE, HEAP_ID_POKETCH_APP); + GfGfxLoader_GXLoadPal(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0012_NCLR, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_0_OFFSET, 0x20, HEAP_ID_POKETCH_APP); GXS_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisiblePlane(GX_PLANEMASK_BG0); } @@ -38,7 +38,7 @@ void ov19_02252440(struct BgConfig * bgConfig) void ov19_022524F4(struct BgConfig * bgConfig) { FreeBgTilemapBuffer(bgConfig, GF_BG_LYR_SUB_0); - DestroyHeap(HEAP_ID_8); + DestroyHeap(HEAP_ID_POKETCH_APP); } BOOL ov19_02252504(struct BgConfig * bgConfig) diff --git a/arm9/overlays/20/asm/ov20_02252440.s b/arm9/overlays/20/asm/ov20_02252440.s index d584f9826..4a1905fa5 100644 --- a/arm9/overlays/20/asm/ov20_02252440.s +++ b/arm9/overlays/20/asm/ov20_02252440.s @@ -1004,8 +1004,8 @@ ov20_02252B1C: ; 0x02252B1C .align 2, 0 thumb_func_end ov20_02252B1C - thumb_func_start ov20_02252B28 -ov20_02252B28: ; 0x02252B28 + thumb_func_start Poketch_PlaySoundEffect +Poketch_PlaySoundEffect: ; 0x02252B28 push {r4, lr} add r4, r0, #0 bl ov20_02252440 @@ -1020,7 +1020,7 @@ ov20_02252B28: ; 0x02252B28 bl PlaySE _02252B46: pop {r4, pc} - thumb_func_end ov20_02252B28 + thumb_func_end Poketch_PlaySoundEffect thumb_func_start ov20_02252B48 ov20_02252B48: ; 0x02252B48 @@ -1040,8 +1040,8 @@ _02252B66: pop {r4, pc} thumb_func_end ov20_02252B48 - thumb_func_start ov20_02252B68 -ov20_02252B68: ; 0x02252B68 + thumb_func_start TouchScreen_GetTapState +TouchScreen_GetTapState: ; 0x02252B68 push {r3, r4, r5, lr} add r5, r0, #0 add r4, r1, #0 @@ -1085,7 +1085,7 @@ _02252BB0: _02252BB4: mov r0, #0 pop {r3, r4, r5, pc} - thumb_func_end ov20_02252B68 + thumb_func_end TouchScreen_GetTapState thumb_func_start ov20_02252BB8 ov20_02252BB8: ; 0x02252BB8 diff --git a/arm9/overlays/21/src/ov21_02254854.c b/arm9/overlays/21/src/ov21_02254854.c index 30f7cc3b5..37d8d26c8 100644 --- a/arm9/overlays/21/src/ov21_02254854.c +++ b/arm9/overlays/21/src/ov21_02254854.c @@ -26,7 +26,7 @@ static void ov21_02254840(void) BOOL ov21_02254854(UnkStruct02254854 **param0, u32 param1, u32 param2, u32 param3) { - UnkStruct02254854 *alloced = (UnkStruct02254854 *)AllocFromHeap(HEAP_ID_8, sizeof(UnkStruct02254854)); + UnkStruct02254854 *alloced = (UnkStruct02254854 *)AllocFromHeap(HEAP_ID_POKETCH_APP, sizeof(UnkStruct02254854)); if (alloced != NULL) { if (ov21_0225489C(alloced, param1, param2, param3) && SysTask_CreateOnMainQueue((SysTaskFunc)ov21_02254930, (void *)alloced, 1)) diff --git a/arm9/overlays/21/src/ov21_02254A6C.c b/arm9/overlays/21/src/ov21_02254A6C.c index be68521cc..0de0f5715 100644 --- a/arm9/overlays/21/src/ov21_02254A6C.c +++ b/arm9/overlays/21/src/ov21_02254A6C.c @@ -40,7 +40,7 @@ extern void ov11_02252DB4(u32 param0, u32 param1); BOOL ov21_02254A6C(UnkStruct02254A6C *param0, void *param1) { - UnkStruct02254A6C *strct = (UnkStruct02254A6C *)AllocFromHeap(HEAP_ID_8, 3 << 8); + UnkStruct02254A6C *strct = (UnkStruct02254A6C *)AllocFromHeap(HEAP_ID_POKETCH_APP, 3 << 8); u32 sp4; if (strct != NULL) { diff --git a/arm9/overlays/22/asm/overlay_22.s b/arm9/overlays/22/asm/overlay_22.s index 457edf4df..aa16e762a 100644 --- a/arm9/overlays/22/asm/overlay_22.s +++ b/arm9/overlays/22/asm/overlay_22.s @@ -1386,7 +1386,7 @@ ov22_02255268: ; 0x02255268 mov r1, #6 bl BgCommitTilemapBufferToVram ldr r0, _022552A8 ; =0x00000669 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r5, #0 bl ov22_02255084 pop {r3, r4, r5, pc} @@ -1482,7 +1482,7 @@ _02255358: cmp r0, #0 beq _0225537A ldr r0, _0225537C ; =0x00000669 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldrb r1, [r5, #3] ldr r0, [r4, #4] bl ov22_02255544 @@ -1543,7 +1543,7 @@ _022553D8: cmp r0, #0 beq _022553FA ldr r0, _022553FC ; =0x00000669 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldrb r1, [r5, #3] ldr r0, [r4, #4] bl ov22_02255544 @@ -1599,7 +1599,7 @@ _0225543A: mov r1, #6 bl BgCommitTilemapBufferToVram ldr r0, _02255498 ; =0x00000666 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r6, #0 bl ov20_022538B0 _02255468: diff --git a/arm9/overlays/23/asm/overlay_23.s b/arm9/overlays/23/asm/overlay_23.s index c88dd22d6..93bdf8316 100644 --- a/arm9/overlays/23/asm/overlay_23.s +++ b/arm9/overlays/23/asm/overlay_23.s @@ -1293,7 +1293,7 @@ ov23_022551A4: ; 0x022551A4 add r4, r0, #0 ldrh r5, [r5] ldr r0, _022551F8 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect lsl r3, r5, #2 ldr r0, _022551FC ; =ov23_02255FB9 ldr r2, _02255200 ; =ov23_02255FFC diff --git a/arm9/overlays/24/asm/overlay_24.s b/arm9/overlays/24/asm/overlay_24.s deleted file mode 100644 index 463690f2d..000000000 --- a/arm9/overlays/24/asm/overlay_24.s +++ /dev/null @@ -1,1209 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - .section .text - .balign 4, 0 - - thumb_func_start ov24_02254854 -ov24_02254854: ; 0x02254854 - push {r3, r4, r5, r6, r7, lr} - add r6, r1, #0 - mov r1, #0x17 - add r5, r0, #0 - mov r0, #8 - lsl r1, r1, #8 - add r7, r2, #0 - str r3, [sp] - bl AllocFromHeap - add r4, r0, #0 - beq _02254894 - ldr r3, [sp] - add r1, r6, #0 - add r2, r7, #0 - bl ov24_0225489C - cmp r0, #0 - beq _0225488E - ldr r0, _02254898 ; =ov24_02254918 - add r1, r4, #0 - mov r2, #1 - bl SysTask_CreateOnMainQueue - cmp r0, #0 - beq _0225488E - str r4, [r5] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_0225488E: - add r0, r4, #0 - bl FreeToHeap -_02254894: - mov r0, #0 - pop {r3, r4, r5, r6, r7, pc} - .align 2, 0 -_02254898: .word ov24_02254918 - thumb_func_end ov24_02254854 - - thumb_func_start ov24_0225489C -ov24_0225489C: ; 0x0225489C - push {r3, r4, r5, lr} - add r5, r0, #0 - ldr r0, _022548E4 ; =0x000016F0 - add r4, r1, #0 - str r3, [r5, r0] - mov r1, #1 - str r1, [r5, #8] - add r0, r0, #4 - add r1, r5, #0 - add r0, r5, r0 - add r1, #8 - bl ov24_02254CA0 - cmp r0, #0 - beq _022548E0 - mov r0, #0 - strb r0, [r5] - strb r0, [r5, #1] - strb r0, [r5, #2] - strb r0, [r5, #3] - mov r0, #8 - str r0, [sp] - ldr r0, _022548E8 ; =0x022550F8 - ldr r2, _022548EC ; =ov24_02254960 - mov r1, #2 - add r3, r5, #0 - bl ov20_02254130 - ldr r1, _022548F0 ; =0x000016FC - str r0, [r5, r1] - sub r0, r1, #4 - str r4, [r5, r0] - mov r0, #1 - pop {r3, r4, r5, pc} -_022548E0: - mov r0, #0 - pop {r3, r4, r5, pc} - .align 2, 0 -_022548E4: .word 0x000016F0 -_022548E8: .word ov24_022550F8 -_022548EC: .word ov24_02254960 -_022548F0: .word 0x000016FC - thumb_func_end ov24_0225489C - - thumb_func_start ov24_022548F4 -ov24_022548F4: ; 0x022548F4 - push {r4, lr} - add r4, r0, #0 - ldr r0, _02254910 ; =0x000016FC - ldr r0, [r4, r0] - bl ov20_02254198 - ldr r0, _02254914 ; =0x000016F4 - ldr r0, [r4, r0] - bl ov24_02254D48 - add r0, r4, #0 - bl FreeToHeap - pop {r4, pc} - .align 2, 0 -_02254910: .word 0x000016FC -_02254914: .word 0x000016F4 - thumb_func_end ov24_022548F4 - - thumb_func_start ov24_02254918 -ov24_02254918: ; 0x02254918 - push {r3, r4, r5, lr} - add r4, r1, #0 - add r5, r0, #0 - ldrb r0, [r4] - cmp r0, #3 - bhs _02254954 - ldr r1, _02254958 ; =0x000016F8 - ldr r0, [r4, r1] - add r1, r1, #4 - ldr r1, [r4, r1] - bl ov20_02252C14 - ldrb r1, [r4] - add r0, r4, #0 - lsl r2, r1, #2 - ldr r1, _0225495C ; =ov24_02255100 - ldr r1, [r1, r2] - blx r1 - cmp r0, #0 - beq _02254954 - add r0, r4, #0 - bl ov24_022548F4 - add r0, r5, #0 - bl sub_0200CAB4 - ldr r0, _02254958 ; =0x000016F8 - ldr r0, [r4, r0] - bl ov20_022529A0 -_02254954: - pop {r3, r4, r5, pc} - nop -_02254958: .word 0x000016F8 -_0225495C: .word ov24_02255100 - thumb_func_end ov24_02254918 - - thumb_func_start ov24_02254960 -ov24_02254960: ; 0x02254960 - push {r3, lr} - cmp r2, #1 - bne _02254988 - ldr r1, [r3, #8] - cmp r1, #1 - bne _02254970 - cmp r0, #0 - beq _02254978 -_02254970: - cmp r1, #0 - bne _02254988 - cmp r0, #1 - bne _02254988 -_02254978: - ldr r0, [r3, #8] - mov r1, #1 - eor r0, r1 - str r0, [r3, #8] - ldr r0, _0225498C ; =0x000016F4 - ldr r0, [r3, r0] - bl ov24_02254D8C -_02254988: - pop {r3, pc} - nop -_0225498C: .word 0x000016F4 - thumb_func_end ov24_02254960 - - thumb_func_start ov24_02254990 -ov24_02254990: ; 0x02254990 - mov r1, #1 - strb r1, [r0, #2] - bx lr - .align 2, 0 - thumb_func_end ov24_02254990 - - thumb_func_start ov24_02254998 -ov24_02254998: ; 0x02254998 - ldrb r2, [r0, #2] - cmp r2, #0 - bne _022549A0 - b _022549A2 -_022549A0: - mov r1, #2 -_022549A2: - strb r1, [r0] - mov r1, #0 - strb r1, [r0, #1] - bx lr - .align 2, 0 - thumb_func_end ov24_02254998 - - thumb_func_start ov24_022549AC -ov24_022549AC: ; 0x022549AC - push {r4, lr} - add r4, r0, #0 - ldrb r0, [r4, #1] - cmp r0, #0 - beq _022549BC - cmp r0, #1 - beq _022549CE - b _022549EC -_022549BC: - ldr r0, _022549F0 ; =0x000016F4 - mov r1, #0 - ldr r0, [r4, r0] - bl ov24_02254D8C - ldrb r0, [r4, #1] - add r0, r0, #1 - strb r0, [r4, #1] - b _022549EC -_022549CE: - ldr r0, _022549F0 ; =0x000016F4 - mov r1, #0 - ldr r0, [r4, r0] - bl ov24_02254DB0 - cmp r0, #0 - beq _022549EC - ldr r0, _022549F4 ; =0x000016F8 - ldr r0, [r4, r0] - bl ov20_0225298C - add r0, r4, #0 - mov r1, #1 - bl ov24_02254998 -_022549EC: - mov r0, #0 - pop {r4, pc} - .align 2, 0 -_022549F0: .word 0x000016F4 -_022549F4: .word 0x000016F8 - thumb_func_end ov24_022549AC - - thumb_func_start ov24_022549F8 -ov24_022549F8: ; 0x022549F8 - push {r3, r4, r5, r6, lr} - sub sp, #4 - add r5, r0, #0 - ldrb r1, [r5, #2] - cmp r1, #0 - beq _02254A0A - mov r1, #2 - bl ov24_02254998 -_02254A0A: - ldrb r0, [r5, #1] - cmp r0, #0 - bne _02254A60 - ldr r0, _02254A68 ; =0x000016F8 - ldr r0, [r5, r0] - bl ov20_02252C08 - cmp r0, #0 - bne _02254A60 - ldrb r0, [r5, #3] - cmp r0, #0 - beq _02254A48 - add r0, r5, #0 - ldr r6, [r5, #0xc] - ldr r4, [r5, #0x10] - bl ov24_02254AD4 - cmp r0, #0 - beq _02254A42 - ldr r0, [r5, #0x10] - add r1, r6, #0 - str r0, [sp] - ldr r3, [r5, #0xc] - add r0, r5, #0 - add r2, r4, #0 - bl ov24_02254B20 - b _02254A60 -_02254A42: - mov r0, #0 - strb r0, [r5, #3] - b _02254A60 -_02254A48: - add r0, r5, #0 - bl ov24_02254A70 - cmp r0, #0 - beq _02254A60 - ldr r0, _02254A6C ; =0x000016F4 - mov r1, #3 - ldr r0, [r5, r0] - bl ov24_02254D8C - mov r0, #1 - strb r0, [r5, #3] -_02254A60: - mov r0, #0 - add sp, #4 - pop {r3, r4, r5, r6, pc} - nop -_02254A68: .word 0x000016F8 -_02254A6C: .word 0x000016F4 - thumb_func_end ov24_022549F8 - - thumb_func_start ov24_02254A70 -ov24_02254A70: ; 0x02254A70 - push {r4, lr} - sub sp, #8 - add r4, r0, #0 - add r0, sp, #4 - add r1, sp, #0 - bl ov20_02252B68 - cmp r0, #0 - beq _02254ACC - ldr r1, [sp, #4] - ldr r2, [sp] - sub r1, #0x10 - sub r2, #0x10 - cmp r1, #0x9c - bhs _02254A92 - mov r0, #1 - b _02254A94 -_02254A92: - mov r0, #0 -_02254A94: - cmp r2, #0x96 - bhs _02254A9C - mov r3, #1 - b _02254A9E -_02254A9C: - mov r3, #0 -_02254A9E: - tst r0, r3 - beq _02254ACC - lsr r3, r1, #1 - lsr r0, r2, #1 - add r2, r4, #0 - mov r1, #0x4b - add r2, #0x14 - mul r1, r3 - str r3, [sp, #4] - str r0, [sp] - add r3, r2, r1 - ldrb r1, [r3, r0] - ldr r2, [r4, #8] - cmp r2, r1 - beq _02254ACC - strb r2, [r3, r0] - ldr r0, [sp, #4] - str r0, [r4, #0xc] - ldr r0, [sp] - add sp, #8 - str r0, [r4, #0x10] - mov r0, #1 - pop {r4, pc} -_02254ACC: - mov r0, #0 - add sp, #8 - pop {r4, pc} - .align 2, 0 - thumb_func_end ov24_02254A70 - - thumb_func_start ov24_02254AD4 -ov24_02254AD4: ; 0x02254AD4 - push {r4, lr} - sub sp, #8 - add r4, r0, #0 - add r0, sp, #4 - add r1, sp, #0 - bl ov20_02252B68 - cmp r0, #0 - beq _02254B1A - ldr r1, [sp, #4] - ldr r2, [sp] - sub r1, #0x10 - sub r2, #0x10 - cmp r1, #0x9c - bhs _02254AF6 - mov r0, #1 - b _02254AF8 -_02254AF6: - mov r0, #0 -_02254AF8: - cmp r2, #0x96 - bhs _02254B00 - mov r3, #1 - b _02254B02 -_02254B00: - mov r3, #0 -_02254B02: - tst r0, r3 - beq _02254B1A - lsr r1, r1, #1 - lsr r0, r2, #1 - str r1, [sp, #4] - str r0, [sp] - str r1, [r4, #0xc] - ldr r0, [sp] - add sp, #8 - str r0, [r4, #0x10] - mov r0, #1 - pop {r4, pc} -_02254B1A: - mov r0, #0 - add sp, #8 - pop {r4, pc} - thumb_func_end ov24_02254AD4 - - thumb_func_start ov24_02254B20 -ov24_02254B20: ; 0x02254B20 - push {r4, r5, r6, r7, lr} - sub sp, #0x14 - add r5, r0, #0 - ldr r0, [sp, #0x28] - add r4, r2, #0 - add r6, r1, #0 - str r3, [sp] - str r0, [sp, #0x28] - cmp r4, r0 - bne _02254B3C - add r0, r3, #0 - cmp r6, r0 - bne _02254B3C - b _02254C5C -_02254B3C: - ldr r0, [sp] - cmp r0, r6 - bls _02254B46 - sub r1, r0, r6 - b _02254B48 -_02254B46: - sub r1, r6, r0 -_02254B48: - ldr r0, [sp, #0x28] - cmp r0, r4 - bls _02254B52 - sub r2, r0, r4 - b _02254B54 -_02254B52: - sub r2, r4, r0 -_02254B54: - cmp r1, r2 - bls _02254BD6 - ldr r0, [sp] - cmp r0, r6 - bls _02254B64 - mov r0, #1 - str r0, [sp, #4] - b _02254B6A -_02254B64: - mov r0, #0 - mvn r0, r0 - str r0, [sp, #4] -_02254B6A: - cmp r1, #0 - beq _02254B7C - ldr r0, [sp, #0x28] - sub r0, r0, r4 - lsl r0, r0, #0xc - bl _s32_div_f - str r0, [sp, #0x10] - b _02254B80 -_02254B7C: - mov r0, #0 - str r0, [sp, #0x10] -_02254B80: - ldr r0, [sp, #0x10] - lsl r1, r4, #0xc - add r7, r1, r0 - ldr r0, [sp, #4] - add r6, r6, r0 - ldr r0, [sp] - cmp r6, r0 - beq _02254C40 - mov r1, #0x4b - add r0, r6, #0 - mul r0, r1 - add r4, r5, r0 - ldr r0, [sp, #4] - mul r1, r0 - str r1, [sp, #0xc] -_02254B9E: - asr r2, r7, #0xc - cmp r6, #0x4e - bhs _02254BC2 - cmp r2, #0x4b - bhs _02254BC2 - add r1, r4, r2 - ldrb r0, [r1, #0x14] - ldr r3, [r5, #8] - cmp r3, r0 - beq _02254BC2 - strb r3, [r1, #0x14] - str r6, [r5, #0xc] - ldr r0, _02254C60 ; =0x000016F4 - str r2, [r5, #0x10] - ldr r0, [r5, r0] - mov r1, #3 - bl ov24_02254D8C -_02254BC2: - ldr r0, [sp, #0xc] - add r4, r4, r0 - ldr r0, [sp, #4] - add r6, r6, r0 - ldr r0, [sp, #0x10] - add r7, r7, r0 - ldr r0, [sp] - cmp r6, r0 - bne _02254B9E - b _02254C40 -_02254BD6: - ldr r0, [sp, #0x28] - cmp r0, r4 - bls _02254BE0 - mov r7, #1 - b _02254BE4 -_02254BE0: - mov r7, #0 - mvn r7, r7 -_02254BE4: - cmp r2, #0 - beq _02254BF8 - ldr r0, [sp] - add r1, r2, #0 - sub r0, r0, r6 - lsl r0, r0, #0xc - bl _s32_div_f - str r0, [sp, #8] - b _02254BFC -_02254BF8: - mov r0, #0 - str r0, [sp, #8] -_02254BFC: - ldr r0, [sp, #8] - lsl r1, r6, #0xc - add r6, r1, r0 - ldr r0, [sp, #0x28] - add r4, r4, r7 - cmp r4, r0 - beq _02254C40 -_02254C0A: - asr r3, r6, #0xc - cmp r4, #0x4b - bhs _02254C34 - cmp r3, #0x4e - bhs _02254C34 - mov r0, #0x4b - mul r0, r3 - add r0, r5, r0 - add r2, r0, r4 - ldrb r0, [r2, #0x14] - ldr r1, [r5, #8] - cmp r1, r0 - beq _02254C34 - strb r1, [r2, #0x14] - str r3, [r5, #0xc] - ldr r0, _02254C60 ; =0x000016F4 - str r4, [r5, #0x10] - ldr r0, [r5, r0] - mov r1, #3 - bl ov24_02254D8C -_02254C34: - ldr r0, [sp, #8] - add r4, r4, r7 - add r6, r6, r0 - ldr r0, [sp, #0x28] - cmp r4, r0 - bne _02254C0A -_02254C40: - ldr r0, [sp, #0x28] - cmp r0, #0x4b - bhs _02254C5C - ldr r0, [sp] - cmp r0, #0x4e - bhs _02254C5C - str r0, [r5, #0xc] - ldr r0, [sp, #0x28] - mov r1, #3 - str r0, [r5, #0x10] - ldr r0, _02254C60 ; =0x000016F4 - ldr r0, [r5, r0] - bl ov24_02254D8C -_02254C5C: - add sp, #0x14 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_02254C60: .word 0x000016F4 - thumb_func_end ov24_02254B20 - - thumb_func_start ov24_02254C64 -ov24_02254C64: ; 0x02254C64 - push {r4, lr} - add r4, r0, #0 - ldrb r0, [r4, #1] - cmp r0, #0 - beq _02254C74 - cmp r0, #1 - beq _02254C86 - b _02254C96 -_02254C74: - ldr r0, _02254C9C ; =0x000016F4 - mov r1, #5 - ldr r0, [r4, r0] - bl ov24_02254D8C - ldrb r0, [r4, #1] - add r0, r0, #1 - strb r0, [r4, #1] - b _02254C96 -_02254C86: - ldr r0, _02254C9C ; =0x000016F4 - ldr r0, [r4, r0] - bl ov24_02254DBC - cmp r0, #0 - beq _02254C96 - mov r0, #1 - pop {r4, pc} -_02254C96: - mov r0, #0 - pop {r4, pc} - nop -_02254C9C: .word 0x000016F4 - thumb_func_end ov24_02254C64 - - thumb_func_start ov24_02254CA0 -ov24_02254CA0: ; 0x02254CA0 - push {r4, r5, r6, lr} - add r5, r0, #0 - add r6, r1, #0 - mov r0, #8 - mov r1, #0x74 - bl AllocFromHeap - add r4, r0, #0 - beq _02254CFA - mov r0, #7 - bl GF_heap_c_dummy_return_true - cmp r0, #0 - bne _02254CC0 - bl GF_AssertFail -_02254CC0: - add r0, r4, #0 - add r0, #8 - mov r1, #0x10 - bl ov20_022536F4 - mov r0, #7 - bl GF_heap_c_dummy_return_true - cmp r0, #0 - bne _02254CD8 - bl GF_AssertFail -_02254CD8: - str r6, [r4] - bl ov20_02252D34 - str r0, [r4, #4] - bl ov20_02252D24 - str r0, [r4, #0x50] - mov r0, #7 - bl GF_heap_c_dummy_return_true - cmp r0, #0 - bne _02254CF4 - bl GF_AssertFail -_02254CF4: - str r4, [r5] - mov r0, #1 - pop {r4, r5, r6, pc} -_02254CFA: - mov r0, #0 - pop {r4, r5, r6, pc} - .align 2, 0 - thumb_func_end ov24_02254CA0 - - thumb_func_start ov24_02254D00 -ov24_02254D00: ; 0x02254D00 - push {r4, lr} - add r4, r0, #0 - mov r0, #8 - mov r1, #1 - bl AllocWindows - str r0, [r4, #0x70] - add r1, r0, #0 - beq _02254D3C - ldr r0, [r4, #4] - ldr r2, _02254D40 ; =ov24_0225510C - bl AddWindow - mov r2, #0xbe - ldr r1, [r4] - ldr r0, _02254D44 ; =0x000016E8 - lsl r2, r2, #6 - ldr r0, [r1, r0] - ldr r1, [r4, #0x70] - ldr r1, [r1, #0xc] - bl sub_0208946C - cmp r0, #0 - bne _02254D38 - ldr r0, [r4, #0x70] - mov r1, #4 - bl FillWindowPixelBuffer -_02254D38: - mov r0, #1 - pop {r4, pc} -_02254D3C: - mov r0, #0 - pop {r4, pc} - .align 2, 0 -_02254D40: .word ov24_0225510C -_02254D44: .word 0x000016E8 - thumb_func_end ov24_02254D00 - - thumb_func_start ov24_02254D48 -ov24_02254D48: ; 0x02254D48 - push {r4, lr} - add r4, r0, #0 - beq _02254D84 - mov r0, #7 - bl GF_heap_c_dummy_return_true - cmp r0, #0 - bne _02254D5C - bl GF_AssertFail -_02254D5C: - ldr r2, [r4, #0x70] - cmp r2, #0 - beq _02254D7E - ldr r1, [r4] - ldr r0, _02254D88 ; =0x000016E8 - ldr r0, [r1, r0] - ldr r1, [r2, #0xc] - mov r2, #0xbe - lsl r2, r2, #6 - bl sub_02089444 - ldr r0, [r4, #0x70] - bl RemoveWindow - ldr r0, [r4, #0x70] - bl FreeToHeap -_02254D7E: - add r0, r4, #0 - bl FreeToHeap -_02254D84: - pop {r4, pc} - nop -_02254D88: .word 0x000016E8 - thumb_func_end ov24_02254D48 - - thumb_func_start ov24_02254D8C -ov24_02254D8C: ; 0x02254D8C - push {lr} - sub sp, #0xc - add r2, r0, #0 - add r0, #8 - str r0, [sp] - mov r0, #2 - str r0, [sp, #4] - mov r0, #8 - str r0, [sp, #8] - ldr r0, _02254DAC ; =ov24_0225516C - ldr r3, [r2] - bl ov20_022537E0 - add sp, #0xc - pop {pc} - nop -_02254DAC: .word ov24_0225516C - thumb_func_end ov24_02254D8C - - thumb_func_start ov24_02254DB0 -ov24_02254DB0: ; 0x02254DB0 - ldr r3, _02254DB8 ; =ov20_02253794 - add r0, #8 - bx r3 - nop -_02254DB8: .word ov20_02253794 - thumb_func_end ov24_02254DB0 - - thumb_func_start ov24_02254DBC -ov24_02254DBC: ; 0x02254DBC - ldr r3, _02254DC4 ; =ov20_022537B8 - add r0, #8 - bx r3 - nop -_02254DC4: .word ov20_022537B8 - thumb_func_end ov24_02254DBC - - thumb_func_start ov24_02254DC8 -ov24_02254DC8: ; 0x02254DC8 - push {r4, lr} - add r4, r0, #0 - bl ov20_022538A0 - add r0, #8 - add r1, r4, #0 - bl ov20_02253888 - pop {r4, pc} - .align 2, 0 - thumb_func_end ov24_02254DC8 - - thumb_func_start ov24_02254DDC -ov24_02254DDC: ; 0x02254DDC - push {r4, r5, lr} - sub sp, #0x14 - mov r0, #8 - add r4, r1, #0 - bl GF_heap_c_dummy_return_true - cmp r0, #0 - bne _02254DF0 - bl GF_AssertFail -_02254DF0: - add r0, r4, #0 - bl ov20_022538A0 - add r5, r0, #0 - ldr r0, [r5, #4] - ldr r2, _02254ED0 ; =ov24_02255114 - mov r1, #6 - mov r3, #0 - bl InitBgFromTemplate - ldr r0, [r5, #4] - ldr r2, _02254ED4 ; =ov24_02255130 - mov r1, #7 - mov r3, #0 - bl InitBgFromTemplate - mov r0, #8 - bl GF_heap_c_dummy_return_true - cmp r0, #0 - bne _02254E1E - bl GF_AssertFail -_02254E1E: - mov r0, #0 - str r0, [sp] - str r0, [sp, #4] - mov r0, #1 - str r0, [sp, #8] - mov r0, #8 - str r0, [sp, #0xc] - ldr r2, [r5, #4] - mov r0, #0xc - mov r1, #0x1e - mov r3, #6 - bl GfGfxLoader_LoadCharData - mov r0, #0 - str r0, [sp] - str r0, [sp, #4] - mov r0, #1 - str r0, [sp, #8] - mov r0, #8 - str r0, [sp, #0xc] - ldr r2, [r5, #4] - mov r0, #0xc - mov r1, #0x1f - mov r3, #6 - bl GfGfxLoader_LoadScrnData - mov r0, #0 - add r1, r0, #0 - bl ov20_02252D7C - mov r0, #8 - bl GF_heap_c_dummy_return_true - cmp r0, #0 - bne _02254E68 - bl GF_AssertFail -_02254E68: - add r0, r5, #0 - bl ov24_02254D00 - ldr r0, [r5, #0x70] - bl CopyWindowToVram - mov r0, #8 - bl GF_heap_c_dummy_return_true - cmp r0, #0 - bne _02254E82 - bl GF_AssertFail -_02254E82: - add r0, r5, #0 - bl ov24_02255078 - mov r0, #8 - bl GF_heap_c_dummy_return_true - cmp r0, #0 - bne _02254E96 - bl GF_AssertFail -_02254E96: - ldr r0, [r5, #4] - mov r1, #7 - bl BgCommitTilemapBufferToVram - ldr r1, _02254ED8 ; =0x04001000 - ldr r0, _02254EDC ; =0xFFFFE0FF - ldr r3, [r1] - ldr r2, [r1] - str r3, [sp, #0x10] - and r0, r2 - lsl r2, r3, #0x13 - lsr r3, r2, #0x1b - mov r2, #0x14 - orr r2, r3 - lsl r2, r2, #8 - orr r0, r2 - str r0, [r1] - add r0, r4, #0 - bl ov24_02254DC8 - mov r0, #8 - bl GF_heap_c_dummy_return_true - cmp r0, #0 - bne _02254ECC - bl GF_AssertFail -_02254ECC: - add sp, #0x14 - pop {r4, r5, pc} - .align 2, 0 -_02254ED0: .word ov24_02255114 -_02254ED4: .word ov24_02255130 -_02254ED8: .word 0x04001000 -_02254EDC: .word 0xFFFFE0FF - thumb_func_end ov24_02254DDC - - thumb_func_start ov24_02254EE0 -ov24_02254EE0: ; 0x02254EE0 - push {r3, r4, r5, lr} - add r5, r1, #0 - add r0, r5, #0 - bl ov20_022538A0 - add r4, r0, #0 - ldr r0, [r4] - ldr r0, [r0] - cmp r0, #1 - ldr r0, [r4, #0x68] - bne _02254F06 - mov r1, #0 - bl ov20_02253F28 - ldr r0, [r4, #0x6c] - mov r1, #3 - bl ov20_02253F28 - b _02254F14 -_02254F06: - mov r1, #1 - bl ov20_02253F28 - ldr r0, [r4, #0x6c] - mov r1, #2 - bl ov20_02253F28 -_02254F14: - ldr r0, _02254F24 ; =0x00000663 - bl ov20_02252B28 - add r0, r5, #0 - bl ov24_02254DC8 - pop {r3, r4, r5, pc} - nop -_02254F24: .word 0x00000663 - thumb_func_end ov24_02254EE0 - - thumb_func_start ov24_02254F28 -ov24_02254F28: ; 0x02254F28 - push {r4, lr} - add r4, r1, #0 - add r0, r4, #0 - bl ov20_022538A0 - ldr r0, [r0, #0x70] - bl CopyWindowPixelsToVram_TextMode - add r0, r4, #0 - bl ov24_02254DC8 - pop {r4, pc} - thumb_func_end ov24_02254F28 - - thumb_func_start ov24_02254F40 -ov24_02254F40: ; 0x02254F40 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x18 - add r0, r1, #0 - str r1, [sp, #8] - bl ov20_022538A0 - add r7, r0, #0 - ldr r0, [r7] - ldr r1, [r0] - cmp r1, #0 - bne _02254FF2 - mov r1, #8 - str r1, [sp, #0x10] - str r1, [sp, #0x14] - ldr r1, [r0, #4] - ldr r0, [r0, #8] - lsl r1, r1, #1 - lsl r0, r0, #1 - sub r6, r1, #4 - sub r5, r0, #4 - cmp r6, #0 - bge _02254F74 - ldr r0, [sp, #0x10] - add r0, r0, r6 - str r0, [sp, #0x14] - mov r6, #0 -_02254F74: - cmp r5, #0 - bge _02254F80 - ldr r0, [sp, #0x10] - add r0, r0, r5 - str r0, [sp, #0x10] - mov r5, #0 -_02254F80: - ldr r0, [sp, #0x14] - lsl r2, r6, #0x10 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - str r0, [sp] - ldr r0, [sp, #0x10] - lsl r3, r5, #0x10 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - str r0, [sp, #4] - ldr r0, [r7, #0x70] - mov r1, #4 - lsr r2, r2, #0x10 - lsr r3, r3, #0x10 - bl FillWindowPixelRect - asr r1, r5, #3 - mov r2, #0x14 - asr r0, r6, #3 - mul r2, r1 - add r4, r0, r2 - ldr r2, [sp, #0x14] - add r2, r6, r2 - sub r2, r2, #1 - asr r2, r2, #3 - sub r0, r2, r0 - ldr r2, [sp, #0x10] - add r0, r0, #1 - add r2, r5, r2 - sub r2, r2, #1 - asr r2, r2, #3 - sub r1, r2, r1 - add r1, r1, #1 - sub r6, r1, #1 - cmp r1, #0 - beq _0225502C - lsl r0, r0, #5 - lsl r5, r4, #5 - str r0, [sp, #0xc] -_02254FCE: - ldr r0, [r7, #0x70] - add r1, r4, #0 - ldr r0, [r0, #0xc] - add r1, #0xc - ldr r2, [sp, #0xc] - add r0, r0, r5 - lsl r1, r1, #5 - bl GXS_LoadBG3Char - mov r0, #0xa - lsl r0, r0, #6 - add r5, r5, r0 - add r0, r6, #0 - add r4, #0x14 - sub r6, r6, #1 - cmp r0, #0 - bne _02254FCE - b _0225502C -_02254FF2: - ldr r1, [r0, #4] - ldr r0, [r0, #8] - lsl r2, r1, #1 - lsl r3, r0, #1 - asr r1, r3, #3 - mov r0, #0x14 - asr r4, r2, #3 - mul r0, r1 - add r4, r4, r0 - mov r0, #2 - str r0, [sp] - str r0, [sp, #4] - lsl r2, r2, #0x10 - lsl r3, r3, #0x10 - ldr r0, [r7, #0x70] - mov r1, #1 - lsr r2, r2, #0x10 - lsr r3, r3, #0x10 - bl FillWindowPixelRect - ldr r0, [r7, #0x70] - mov r2, #0x20 - ldr r1, [r0, #0xc] - lsl r0, r4, #5 - add r4, #0xc - add r0, r1, r0 - lsl r1, r4, #5 - bl GXS_LoadBG3Char -_0225502C: - ldr r0, [sp, #8] - bl ov24_02254DC8 - add sp, #0x18 - pop {r3, r4, r5, r6, r7, pc} - .align 2, 0 - thumb_func_end ov24_02254F40 - - thumb_func_start ov24_02255038 -ov24_02255038: ; 0x02255038 - push {r4, lr} - add r4, r1, #0 - add r0, r4, #0 - bl ov20_022538A0 - ldr r0, [r0, #0x70] - bl CopyWindowPixelsToVram_TextMode - add r0, r4, #0 - bl ov24_02254DC8 - pop {r4, pc} - thumb_func_end ov24_02255038 - - thumb_func_start ov24_02255050 -ov24_02255050: ; 0x02255050 - push {r3, r4, r5, lr} - add r5, r1, #0 - add r0, r5, #0 - bl ov20_022538A0 - add r4, r0, #0 - bl ov24_022550D4 - ldr r0, [r4, #4] - mov r1, #6 - bl FreeBgTilemapBuffer - ldr r0, [r4, #4] - mov r1, #7 - bl FreeBgTilemapBuffer - add r0, r5, #0 - bl ov24_02254DC8 - pop {r3, r4, r5, pc} - thumb_func_end ov24_02255050 - - thumb_func_start ov24_02255078 -ov24_02255078: ; 0x02255078 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x10 - mov r3, #0 - str r3, [sp] - mov r2, #1 - add r7, r0, #0 - str r2, [sp, #4] - mov r0, #8 - str r0, [sp, #8] - mov r0, #0xc - mov r1, #0x20 - bl GfGfxLoader_LoadWholePalette - mov r0, #8 - str r0, [sp] - add r0, r7, #0 - add r0, #0x54 - mov r1, #0xc - mov r2, #0x21 - mov r3, #0x22 - bl ov20_02253FBC - cmp r0, #0 - beq _022550CC - add r0, r7, #0 - str r0, [sp, #0xc] - add r0, #0x54 - ldr r4, _022550D0 ; =ov24_0225514C - mov r6, #0 - add r5, r7, #0 - str r0, [sp, #0xc] -_022550B6: - ldr r0, [r7, #0x50] - ldr r2, [sp, #0xc] - add r1, r4, #0 - bl ov20_02253E74 - str r0, [r5, #0x68] - add r6, r6, #1 - add r4, #0x10 - add r5, r5, #4 - cmp r6, #2 - blt _022550B6 -_022550CC: - add sp, #0x10 - pop {r3, r4, r5, r6, r7, pc} - .align 2, 0 -_022550D0: .word ov24_0225514C - thumb_func_end ov24_02255078 - - thumb_func_start ov24_022550D4 -ov24_022550D4: ; 0x022550D4 - push {r4, r5, r6, lr} - add r6, r0, #0 - mov r4, #0 - add r5, r6, #0 -_022550DC: - ldr r0, [r6, #0x50] - ldr r1, [r5, #0x68] - bl ov20_02253F14 - add r4, r4, #1 - add r5, r5, #4 - cmp r4, #2 - blo _022550DC - add r6, #0x54 - add r0, r6, #0 - bl ov20_02254014 - pop {r4, r5, r6, pc} - .align 2, 0 - thumb_func_end ov24_022550D4 - - .section .rodata - .global ov24_022550F8 -ov24_022550F8: ; 0x022550F8 - .byte 0x18, 0x58, 0xB4, 0xCC, 0x68, 0xA8, 0xB4, 0xCC - - .global ov24_02255100 -ov24_02255100: ; 0x02255100 - .word ov24_022549AC, ov24_022549F8, ov24_02254C64 - - .global ov24_0225510C -ov24_0225510C: ; 0x0225510C - .byte 0x07, 0x02, 0x02, 0x14, 0x13, 0x00, 0x0C, 0x00 - - .global ov24_02255114 -ov24_02255114: ; 0x02255114 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0E, 0x00 - .byte 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .global ov24_02255130 -ov24_02255130: ; 0x02255130 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0F, 0x00, 0x00, 0x03, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global ov24_0225514C -ov24_0225514C: ; 0x0225514C - .byte 0x00, 0x00, 0x0C, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x02 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x80, 0x08, 0x00, 0x03, 0x00, 0x00, 0x02 - .byte 0x00, 0x00, 0x00, 0x00 - - .global ov24_0225516C -ov24_0225516C: ; 0x0225516C - .word 0x00, ov24_02254DDC, 0x00 - .word 0x01, ov24_02254EE0, 0x00 - .word 0x02, ov24_02254F28, 0x00 - .word 0x03, ov24_02254F40, 0x00 - .word 0x04, ov24_02255038, 0x00 - .word 0x05, ov24_02255050, 0x00 - .word 0x00, 0x00000000, 0x00 diff --git a/arm9/overlays/24/include/overlay_24.h b/arm9/overlays/24/include/overlay_24.h new file mode 100644 index 000000000..355b87bc0 --- /dev/null +++ b/arm9/overlays/24/include/overlay_24.h @@ -0,0 +1,78 @@ +#ifndef POKEDIAMOND_OVERLAY_24_H +#define POKEDIAMOND_OVERLAY_24_H + +typedef enum { + TOUCH_TYPE_ERASE = 0, + TOUCH_TYPE_DRAW = 1, +} TouchType; + +typedef enum { + MEMO_PAD_PIXEL_TYPE_FILLED = 1, + MEMO_PAD_PIXEL_TYPE_EMPTY = 4, +} MemoPadPixelType; + +typedef struct MemoPadDrawState +{ + TouchType touchType; + u32 lastModifiedX; + u32 lastModifiedY; + u8 pixelData[78][75]; + u16 padding; + u32 unk16E8; +} MemoPadDrawState; + +typedef struct MemoPadDisplayHandler +{ + MemoPadDrawState *drawState; + BgConfig *config; + u32 unk8; + u8 unkC[0x44]; + u32 unk50; + u8 unk54[0x14]; + u32 *unk68[2]; + Window *window; +} MemoPadDisplayHandler; + +typedef struct MemoPadAppHandler +{ + u8 unk0; + u8 unk1; + u8 unk2; + u8 touchHeld; + u32 unk4; + MemoPadDrawState drawState; + MemoPadDisplayHandler *displayHandler; + u32 unk16F8; + u32 unk16FC; +} MemoPadAppHandler; + +BOOL ov24_02254854(MemoPadAppHandler **appHandlerOut, s32 arg1, s32 arg2, s32 arg3); +BOOL ov24_0225489C(MemoPadAppHandler *appHandler, u32 arg1, u32 arg2, u32 arg3); +void ov24_022548F4(MemoPadAppHandler *appHandler); +void ov24_02254918(void *arg0, MemoPadAppHandler *appHandler); +void ov24_02254960(s32 arg0, s32 arg1, s32 arg2, MemoPadAppHandler *appHandler); +void ov24_02254990(MemoPadAppHandler *appHandler); +void ov24_02254998(MemoPadAppHandler *appHandler, u8 arg1); +BOOL ov24_022549AC(MemoPadAppHandler *appHandler); +BOOL ov24_022549F8(MemoPadAppHandler *appHandler); +BOOL ov24_02254A70(MemoPadAppHandler *appHandler); +BOOL ov24_02254AD4(MemoPadAppHandler *appHandler); +void ov24_02254B20(MemoPadAppHandler *appHandler, u32 arg1, u32 arg2, u32 arg3, u32 arg4); +BOOL ov24_02254C64(MemoPadAppHandler *appHandler); +BOOL ov24_02254CA0(MemoPadDisplayHandler **displayHandlerOut, MemoPadDrawState *drawState); +BOOL ov24_02254D00(MemoPadDisplayHandler *displayHandler); +void ov24_02254D48(MemoPadDisplayHandler *displayHandler); +void ov24_02254D8C(MemoPadDisplayHandler *displayHandler, u32 arg1); +BOOL ov24_02254DB0(MemoPadDisplayHandler *displayHandler, u8 arg1); +BOOL ov24_02254DBC(MemoPadDisplayHandler *displayHandler); +void ov24_02254DC8(void *arg0); +void ov24_02254DDC(void *arg0, void *arg1); +void ov24_02254EE0(u32 arg0, void *arg1); +void ov24_02254F28(s32 arg0, void *arg1); +void ov24_02254F40(u32 arg0, void *arg1); +void ov24_02255038(u32 arg0, void *arg1); +void ov24_02255050(u32 arg0, void *arg1); +void ov24_02255078(MemoPadDisplayHandler *displayHandler); +void ov24_022550D4(MemoPadDisplayHandler *displayHandler); + +#endif //POKEDIAMOND_OVERLAY_24_H diff --git a/arm9/overlays/24/src/ov24_02254840.c b/arm9/overlays/24/src/ov24_02254840.c new file mode 100644 index 000000000..f7ed16891 --- /dev/null +++ b/arm9/overlays/24/src/ov24_02254840.c @@ -0,0 +1,254 @@ +#include "global.h" +#include "bg_window.h" +#include "unk_0200CA44.h" +#include "gf_gfx_loader.h" +#include "overlay_24.h" + +extern void Poketch_InitApp(void *func1, void *func2); +extern u32 ov20_02254130(void *arg0, u32 arg1, void *arg2, void *arg3, u32 arg4); +extern void ov20_02254198(u32 arg0); +extern void ov20_02252C14(u32 arg0, u32 arg1); +extern void ov20_022529A0(u32 arg0); +extern void ov20_0225298C(u32 arg0); +extern BOOL ov20_02252C08(u32 arg0); +extern BOOL TouchScreen_GetTapState(u32 *arg0, u32 *arg1); + +static void ov24_02254840(void) +{ + Poketch_InitApp(ov24_02254854, ov24_02254990); +} + +#define NitroStaticInit ov24_02254840 +#include "sinit.h" + +BOOL ov24_02254854(MemoPadAppHandler **appHandlerOut, s32 arg1, s32 arg2, s32 arg3) { + MemoPadAppHandler *appHandler = AllocFromHeap(HEAP_ID_POKETCH_APP, sizeof(MemoPadAppHandler)); + if (appHandler != NULL) { + if (ov24_0225489C(appHandler, arg1, arg2, arg3)) { + if (SysTask_CreateOnMainQueue((SysTaskFunc)ov24_02254918, appHandler, 1) != NULL) { + *appHandlerOut = appHandler; + return TRUE; + } + } + FreeToHeap(appHandler); + } + return FALSE; +} + +BOOL ov24_0225489C(MemoPadAppHandler *appHandler, u32 arg1, u32 arg2, u32 arg3) { + static const u8 ov24_022550F8[] = { + 0x18, 0x58, 0xB4, 0xCC, 0x68, 0xA8, 0xB4, 0xCC + }; + appHandler->drawState.unk16E8 = arg3; + appHandler->drawState.touchType = TOUCH_TYPE_DRAW; + if (ov24_02254CA0(&(appHandler->displayHandler), &(appHandler->drawState))) { + appHandler->unk0 = 0; + appHandler->unk1 = 0; + appHandler->unk2 = 0; + appHandler->touchHeld = FALSE; + appHandler->unk16FC = ov20_02254130(ov24_022550F8, 2, ov24_02254960, appHandler, 8); + appHandler->unk16F8 = arg1; + return TRUE; + } + return FALSE; +} + +void ov24_022548F4(MemoPadAppHandler *appHandler) { + ov20_02254198(appHandler->unk16FC); + ov24_02254D48(appHandler->displayHandler); + FreeToHeap(appHandler); +} + +void ov24_02254918(void *arg0, MemoPadAppHandler *appHandler) { + static BOOL (*const ov24_02255100[3])(MemoPadAppHandler*) = { + ov24_022549AC, ov24_022549F8, ov24_02254C64 + }; + if (appHandler->unk0 < 3) { + ov20_02252C14(appHandler->unk16F8, appHandler->unk16FC); + if (ov24_02255100[appHandler->unk0](appHandler)) { + ov24_022548F4(appHandler); + sub_0200CAB4((s32)arg0); + ov20_022529A0(appHandler->unk16F8); + } + } +} + +void ov24_02254960(s32 arg0, s32 arg1, s32 arg2, MemoPadAppHandler *appHandler) { + if (arg2 == 1) { + if ( + (appHandler->drawState.touchType == TOUCH_TYPE_DRAW && arg0 == 0) + || (appHandler->drawState.touchType == TOUCH_TYPE_ERASE && arg0 == 1) + ) { + appHandler->drawState.touchType ^= 1; + ov24_02254D8C(appHandler->displayHandler, 1); + } + } +} + +void ov24_02254990(MemoPadAppHandler *appHandler) { + appHandler->unk2 = 1; +} + +void ov24_02254998(MemoPadAppHandler *appHandler, u8 arg1) { + if (appHandler->unk2 == 0) { + appHandler->unk0 = arg1; + } + else { + appHandler->unk0 = 2; + } + appHandler->unk1 = 0; +} + +BOOL ov24_022549AC(MemoPadAppHandler *appHandler) { + switch (appHandler->unk1) { + case 0: + ov24_02254D8C(appHandler->displayHandler, 0); + appHandler->unk1++; + break; + case 1: + if (ov24_02254DB0(appHandler->displayHandler, 0)) { + ov20_0225298C(appHandler->unk16F8); + ov24_02254998(appHandler, 1); + } + break; + default: + break; + } + return FALSE; +} + +BOOL ov24_022549F8(MemoPadAppHandler *appHandler) { + if (appHandler->unk2 != 0) { + ov24_02254998(appHandler, 2); + } + switch (appHandler->unk1) { + case 0: + if (ov20_02252C08(appHandler->unk16F8)) { + break; + } + if (appHandler->touchHeld) { + u32 x = appHandler->drawState.lastModifiedX; + u32 y = appHandler->drawState.lastModifiedY; + if (ov24_02254AD4(appHandler)) { + ov24_02254B20(appHandler, x, y, appHandler->drawState.lastModifiedX, appHandler->drawState.lastModifiedY); + } else { + appHandler->touchHeld = FALSE; + } + } else { + if (ov24_02254A70(appHandler)) { + ov24_02254D8C(appHandler->displayHandler, 3); + appHandler->touchHeld = TRUE; + } + } + break; + } + return FALSE; +} + +BOOL ov24_02254A70(MemoPadAppHandler *appHandler) { + u32 x, y; + if (TouchScreen_GetTapState(&x, &y)) { + if (((x - 16) < 156) & ((y - 16) < 150)) { + x = (x - 16) >> 1; + y = (y - 16) >> 1; + if (appHandler->drawState.pixelData[x][y] != appHandler->drawState.touchType) { + appHandler->drawState.pixelData[x][y] = appHandler->drawState.touchType; + appHandler->drawState.lastModifiedX = x; + appHandler->drawState.lastModifiedY = y; + return TRUE; + } + } + } + return FALSE; +} + +BOOL ov24_02254AD4(MemoPadAppHandler *appHandler) { + u32 x, y; + if (TouchScreen_GetTapState(&x, &y)) { + if (((x - 16) < 156) & ((y - 16) < 150)) { + x = (x - 16) >> 1; + y = (y - 16) >> 1; + appHandler->drawState.lastModifiedX = x; + appHandler->drawState.lastModifiedY = y; + return TRUE; + } + } + return FALSE; +} + +void ov24_02254B20(MemoPadAppHandler *appHandler, u32 x0, u32 y0, u32 x1, u32 y1) { + if (y0 == y1 && x0 == x1) { + return; + } + u32 dx = x1 > x0 ? x1 - x0 : x0 - x1; + u32 dy = y1 > y0 ? y1 - y0 : y0 - y1; + s32 direction, offset; + fx32 f, g; + if (dx > dy) { + direction = (x1 > x0) ? 1 : -1; + if (dx != 0) { + f = ((y1 - y0) * 0x1000); + f /= (s32)dx; + } else { + f = 0; + } + g = (y0 << 12) + f; + x0 += direction; + while (x0 != x1) { + offset = g >> 12; + if ((x0 < 0x4e) && ((u32)offset < 0x4b)) { + if (appHandler->drawState.touchType != appHandler->drawState.pixelData[x0][offset]) { + appHandler->drawState.pixelData[x0][offset] = appHandler->drawState.touchType; + appHandler->drawState.lastModifiedX = x0; + appHandler->drawState.lastModifiedY = offset; + ov24_02254D8C(appHandler->displayHandler, 3); + } + } + x0 += direction; + g += f; + } + } else { + direction = (y1 > y0) ? 1 : -1; + if (dy != 0) { + f = ((x1 - x0) * 0x1000); + f /= (s32)dy; + } else { + f = 0; + } + g = (x0 << 12) + f; + y0 += direction; + while (y0 != y1) { + offset = g >> 12; + if ((y0 < 0x4b) && ((u32)offset < 0x4e)) { + if (appHandler->drawState.touchType != appHandler->drawState.pixelData[offset][y0]) { + appHandler->drawState.pixelData[offset][y0] = appHandler->drawState.touchType; + appHandler->drawState.lastModifiedX = offset; + appHandler->drawState.lastModifiedY = y0; + ov24_02254D8C(appHandler->displayHandler, 3); + } + } + y0 += direction; + g += f; + } + } + if ((y1 < 75) && (x1 < 78)) { + appHandler->drawState.lastModifiedX = x1; + appHandler->drawState.lastModifiedY = y1; + ov24_02254D8C(appHandler->displayHandler, 3); + } +} + +BOOL ov24_02254C64(MemoPadAppHandler *appHandler) { + switch (appHandler->unk1) { + case 0: + ov24_02254D8C(appHandler->displayHandler, 5); + appHandler->unk1++; + break; + case 1: + if (ov24_02254DBC(appHandler->displayHandler)) { + return TRUE; + } + break; + } + return FALSE; +} diff --git a/arm9/overlays/24/src/ov24_02254CA0.c b/arm9/overlays/24/src/ov24_02254CA0.c new file mode 100644 index 000000000..a3aedc5c8 --- /dev/null +++ b/arm9/overlays/24/src/ov24_02254CA0.c @@ -0,0 +1,248 @@ +#include "global.h" +#include "bg_window.h" +#include "unk_0200CA44.h" +#include "gf_gfx_loader.h" +#include "overlay_24.h" +#include "SPI_pm.h" +#include "constants/sndseq.h" +#include "graphic/poketch.naix" + +extern BOOL sub_0208946C(u32 arg0, void *arg1, u32 arg2); +extern void sub_02089444(u32 arg0, void *arg1, u32 arg2); +extern void ov20_02252D7C(u32 arg0, u32 arg1); +extern void ov20_02253F28(u32 *arg0, u32 arg1); +extern void Poketch_PlaySoundEffect(u32 arg0); +extern void *ov20_022538A0(void *arg0); +extern void ov20_02253888(u32 *arg0, void *arg1); +extern BOOL ov20_022537B8(void *arg0); +extern BOOL ov20_02253794(void *arg0, u8 arg1); +extern void ov20_022537E0(const u32 *arg0, u32 arg1, void *arg2, void *arg3, void *arg4, u32 arg5, u32 arg6); +extern BOOL ov20_02253FBC(void *arg0, NarcId arg1, u32 arg2, u32 arg3, HeapID arg4); +extern u32 *ov20_02253E74(u32 arg0, void *arg1, void *arg2); +extern void ov20_02254014(void *arg0); +extern void ov20_02253F14(u32 arg0, void *arg1); +extern void ov20_022536F4(void *arg0, u32 arg1); +extern BgConfig *ov20_02252D34(); +extern u32 ov20_02252D24(); + +BOOL ov24_02254CA0(MemoPadDisplayHandler **displayHandlerOut, MemoPadDrawState *drawState) { + MemoPadDisplayHandler *displayHandler = AllocFromHeap(HEAP_ID_POKETCH_APP, sizeof(MemoPadDisplayHandler)); + if (displayHandler != NULL) { + GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_MAIN)); + ov20_022536F4(&(displayHandler->unk8), 0x10); + GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_MAIN)); + displayHandler->drawState = drawState; + displayHandler->config = ov20_02252D34(); + displayHandler->unk50 = ov20_02252D24(); + GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_MAIN)); + *displayHandlerOut = displayHandler; + return TRUE; + } + return FALSE; +} + +BOOL ov24_02254D00(MemoPadDisplayHandler *displayHandler) { + static const WindowTemplate template = { + .bgId = GF_BG_LYR_SUB_3, + .left = 2, + .top = 2, + .width = 20, + .height = 19, + .palette = 0, + .baseTile = 12, + }; + displayHandler->window = AllocWindows(HEAP_ID_POKETCH_APP, 1); + if (displayHandler->window != NULL) { + AddWindow(displayHandler->config, displayHandler->window, &template); + if (sub_0208946C(displayHandler->drawState->unk16E8, displayHandler->window->pixelBuffer, 0x2f80) == 0) { + FillWindowPixelBuffer(displayHandler->window, MEMO_PAD_PIXEL_TYPE_EMPTY); + } + return TRUE; + } + return FALSE; +} + +void ov24_02254D48(MemoPadDisplayHandler *displayHandler) { + if (displayHandler != NULL) { + GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_MAIN)); + if (displayHandler->window != NULL) { + sub_02089444(displayHandler->drawState->unk16E8, displayHandler->window->pixelBuffer, 0x2f80); + RemoveWindow(displayHandler->window); + FreeToHeap(displayHandler->window); + } + FreeToHeap(displayHandler); + } +} + +void ov24_02254D8C(MemoPadDisplayHandler *displayHandler, u32 arg1) { + // TODO: types + static const u32 ov24_0225516C[] = { + 0x00, (u32)ov24_02254DDC, 0x00, + 0x01, (u32)ov24_02254EE0, 0x00, + 0x02, (u32)ov24_02254F28, 0x00, + 0x03, (u32)ov24_02254F40, 0x00, + 0x04, (u32)ov24_02255038, 0x00, + 0x05, (u32)ov24_02255050, 0x00, + 0x00, 0x00000000, 0x00, + }; + ov20_022537E0(ov24_0225516C, arg1, displayHandler, displayHandler->drawState, &(displayHandler->unk8), 2, 8); +} + +BOOL ov24_02254DB0(MemoPadDisplayHandler *displayHandler, u8 arg1) { + return ov20_02253794(&(displayHandler->unk8), arg1); +} + +BOOL ov24_02254DBC(MemoPadDisplayHandler *displayHandler) { + return ov20_022537B8(&(displayHandler->unk8)); +} + +void ov24_02254DC8(void *arg0) { + ov20_02253888(&(((MemoPadDisplayHandler*)ov20_022538A0(arg0))->unk8), arg0); +} + +void ov24_02254DDC(void *arg0, void *arg1) { + static const BgTemplate template_7000 = { + .x = 0, + .y = 0, + .bufferSize = 0, + .baseTile = 0, + .size = 1, + .colorMode = 0, + .screenBase = GX_BG_SCRBASE_0x7000, + .charBase = GX_BG_CHARBASE_0x00000, + .bgExtPltt = 0, + .priority = 2, + .areaOver = 0, + .dummy = 0, + .mosaic = 0, + }; + static const BgTemplate template_7800 = { + .x = 0, + .y = 0, + .bufferSize = 0x800, + .baseTile = 0, + .size = 1, + .colorMode = 0, + .screenBase = GX_BG_SCRBASE_0x7800, + .charBase = GX_BG_CHARBASE_0x00000, + .bgExtPltt = 0, + .priority = 3, + .areaOver = 0, + .dummy = 0, + .mosaic = 0, + }; + GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_APP)); + GXSDispCnt dispcnt; + MemoPadDisplayHandler *displayHandler = ov20_022538A0(arg1); + InitBgFromTemplate(displayHandler->config, GF_BG_LYR_SUB_2, &template_7000, 0); + InitBgFromTemplate(displayHandler->config, GF_BG_LYR_SUB_3, &template_7800, 0); + GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_APP)); + GfGfxLoader_LoadCharData(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0030_bin, displayHandler->config, GF_BG_LYR_SUB_2, 0, 0, TRUE, HEAP_ID_POKETCH_APP); + GfGfxLoader_LoadScrnData(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0031_NSCR, displayHandler->config, GF_BG_LYR_SUB_2, 0, 0, TRUE, HEAP_ID_POKETCH_APP); + ov20_02252D7C(0,0); + GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_APP)); + ov24_02254D00(displayHandler); + CopyWindowToVram(displayHandler->window); + GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_APP)); + ov24_02255078(displayHandler); + GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_APP)); + BgCommitTilemapBufferToVram(displayHandler->config, GF_BG_LYR_SUB_3); + dispcnt.raw = reg_GXS_DB_DISPCNT; + GXS_SetVisiblePlane(dispcnt.visiblePlane | GX_PLANEMASK_BG2 | GX_PLANEMASK_OBJ); + ov24_02254DC8(arg1); + GF_ASSERT(GF_heap_c_dummy_return_true(HEAP_ID_POKETCH_APP)); +} + +void ov24_02254EE0(u32 arg0, void *arg1) { + MemoPadDisplayHandler *displayHandler = ov20_022538A0(arg1); + if (displayHandler->drawState->touchType == TOUCH_TYPE_DRAW) { + ov20_02253F28(displayHandler->unk68[0], 0); + ov20_02253F28(displayHandler->unk68[1], 3); + } else { + ov20_02253F28(displayHandler->unk68[0], 1); + ov20_02253F28(displayHandler->unk68[1], 2); + } + Poketch_PlaySoundEffect(SEQ_SE_DP_POKETCH_003); + ov24_02254DC8(arg1); +} + +void ov24_02254F28(s32 arg0, void *arg1) { + MemoPadDisplayHandler *displayHandler = ov20_022538A0(arg1); + CopyWindowPixelsToVram_TextMode(displayHandler->window); + ov24_02254DC8(arg1); +} + +void ov24_02254F40(u32 arg0, void *arg1) { + MemoPadDisplayHandler *displayHandler = ov20_022538A0(arg1); + MemoPadDrawState *drawState = displayHandler->drawState; + if (drawState->touchType == TOUCH_TYPE_ERASE) { + s32 width, height; + width = height = 8; + s32 x = drawState->lastModifiedX * 2 - 4; + s32 y = drawState->lastModifiedY * 2 - 4; + if (x < 0) { + width += x; + x = 0; + } + if (y < 0) { + height += y; + y = 0; + } + FillWindowPixelRect(displayHandler->window, MEMO_PAD_PIXEL_TYPE_EMPTY, x, y, width, height); + s32 a = (x >> 3) + (y >> 3) * 0x14; + s32 e = ((x + width - 1) >> 3) - (x >> 3) + 1; + s32 b = ((y + height - 1) >> 3) - (y >> 3) + 1; + while (b--) { + GXS_LoadBG3Char((u8*)(displayHandler->window->pixelBuffer) + (a * 0x20), (a + 0xc) * 0x20, e * 0x20); + a += 0x14; + } + } else { + s32 height = 2; + s32 width = 2; + s32 x = drawState->lastModifiedX * 2; + s32 y = drawState->lastModifiedY * 2; + s32 a = (x >> 3) + ((y >> 3) * 0x14); + FillWindowPixelRect(displayHandler->window, MEMO_PAD_PIXEL_TYPE_FILLED, x, y, width, height); + GXS_LoadBG3Char((u8*)(displayHandler->window->pixelBuffer) + a * 0x20, (a + 0xc) * 0x20, 0x20); + } + ov24_02254DC8(arg1); +} + +void ov24_02255038(u32 arg0, void *arg1) { + MemoPadDisplayHandler *displayHandler = ov20_022538A0(arg1); + CopyWindowPixelsToVram_TextMode(displayHandler->window); + ov24_02254DC8(arg1); +} + +void ov24_02255050(u32 arg0, void *arg1) { + MemoPadDisplayHandler *displayHandler = ov20_022538A0(arg1); + ov24_022550D4(displayHandler); + FreeBgTilemapBuffer(displayHandler->config, GF_BG_LYR_SUB_2); + FreeBgTilemapBuffer(displayHandler->config, GF_BG_LYR_SUB_3); + ov24_02254DC8(arg1); +} + +void ov24_02255078(MemoPadDisplayHandler *displayHandler) { + // TODO: types + static const u32 ov24_0225514C[2][4] = { + { + 0xC0000, 0x38000, 0x2000000, 0x0 + }, + { + 0xC0000, 0x88000, 0x2000003, 0x0 + } + }; + GfGfxLoader_LoadWholePalette(NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0032_bin, PM_LCD_BOTTOM, 0, 0, TRUE, HEAP_ID_POKETCH_APP); + if (ov20_02253FBC(&(displayHandler->unk54), NARC_GRAPHIC_POKETCH, NARC_poketch_narc_0033_NCER, NARC_poketch_narc_0034_NANR, HEAP_ID_POKETCH_APP)) { + for (s32 i = 0; i < 2; i++) { + displayHandler->unk68[i] = ov20_02253E74(displayHandler->unk50, &(ov24_0225514C[i]), &(displayHandler->unk54)); + } + } +} + +void ov24_022550D4(MemoPadDisplayHandler *displayHandler) { + for (u32 i = 0; i < 2; i++) { + ov20_02253F14(displayHandler->unk50, displayHandler->unk68[i]); + } + ov20_02254014(&(displayHandler->unk54)); +} diff --git a/arm9/overlays/24/src/overlay_24_sinit.c b/arm9/overlays/24/src/overlay_24_sinit.c deleted file mode 100644 index f609bfbfd..000000000 --- a/arm9/overlays/24/src/overlay_24_sinit.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "global.h" - -extern void Poketch_InitApp(void *func1, void *func2); -extern void ov24_02254854(); -extern void ov24_02254990(); - -static void ov24_02254840(void) -{ - Poketch_InitApp(ov24_02254854, ov24_02254990); -} - -#define NitroStaticInit ov24_02254840 -#include "sinit.h" diff --git a/arm9/overlays/26/asm/ov26_02254854.s b/arm9/overlays/26/asm/ov26_02254854.s index 31035b452..3245e108e 100644 --- a/arm9/overlays/26/asm/ov26_02254854.s +++ b/arm9/overlays/26/asm/ov26_02254854.s @@ -392,7 +392,7 @@ _02254B04: beq _02254B90 add r0, sp, #4 add r1, sp, #0 - bl ov20_02252B68 + bl TouchScreen_GetTapState cmp r0, #0 beq _02254B90 ldr r1, [sp, #4] diff --git a/arm9/overlays/27/asm/overlay_27.s b/arm9/overlays/27/asm/overlay_27.s index 96e31266a..102a3b056 100644 --- a/arm9/overlays/27/asm/overlay_27.s +++ b/arm9/overlays/27/asm/overlay_27.s @@ -196,7 +196,7 @@ _0225499C: add r1, r4, #0 add r0, #0x6c add r1, #0x70 - bl ov20_02252B68 + bl TouchScreen_GetTapState add r1, r4, #0 add r1, #0x68 strh r0, [r1] @@ -1427,7 +1427,7 @@ ov27_022552D0: ; 0x022552D0 mov r1, #6 bl BgCommitTilemapBufferToVram ldr r0, _02255338 ; =0x00000669 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r6, #0 bl ov27_02254BF4 add sp, #0x10 diff --git a/arm9/overlays/28/asm/overlay_28.s b/arm9/overlays/28/asm/overlay_28.s index f61281ce6..d327061f2 100644 --- a/arm9/overlays/28/asm/overlay_28.s +++ b/arm9/overlays/28/asm/overlay_28.s @@ -296,7 +296,7 @@ _02254A64: add r1, r4, #0 add r0, #0x54 add r1, #0x58 - bl ov20_02252B68 + bl TouchScreen_GetTapState add r1, r4, #0 add r1, #0x50 strh r0, [r1] @@ -2153,7 +2153,7 @@ _02255836: add r1, r6, #0 bl ov28_02255318 ldr r0, _0225591C ; =0x00000669 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r4, #0 add r0, #0x34 ldrb r0, [r0] diff --git a/arm9/overlays/29/asm/overlay_29.s b/arm9/overlays/29/asm/overlay_29.s index 140064d57..fd56387c1 100644 --- a/arm9/overlays/29/asm/overlay_29.s +++ b/arm9/overlays/29/asm/overlay_29.s @@ -208,7 +208,7 @@ _022549AA: add r0, r4, #0 bl ov29_02254AA8 ldr r0, _02254A60 ; =0x00000668 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldr r0, [r4, #0x48] mov r1, #2 bl ov29_02254CC0 @@ -271,7 +271,7 @@ _02254A3C: cmp r0, #0 beq _02254A5A ldr r0, _02254A60 ; =0x00000668 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldr r0, [r4, #0x48] mov r1, #2 bl ov29_02254CC0 diff --git a/arm9/overlays/30/asm/overlay_30.s b/arm9/overlays/30/asm/overlay_30.s index e38a9b622..38ed73a93 100644 --- a/arm9/overlays/30/asm/overlay_30.s +++ b/arm9/overlays/30/asm/overlay_30.s @@ -621,7 +621,7 @@ ov30_02254CC4: ; 0x02254CC4 b _02254CF6 _02254CDE: ldr r0, _02254D00 ; =0x00000669 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldr r0, [r4, #0x24] mov r1, #1 bl ov20_02253F28 diff --git a/arm9/overlays/31/asm/overlay_31.s b/arm9/overlays/31/asm/overlay_31.s index 3d1675199..a31085acd 100644 --- a/arm9/overlays/31/asm/overlay_31.s +++ b/arm9/overlays/31/asm/overlay_31.s @@ -611,7 +611,7 @@ ov31_02254CB8: ; 0x02254CB8 b _02254CEA _02254CD2: ldr r0, _02254CF4 ; =0x00000669 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldr r0, [r4, #0x24] mov r1, #1 bl ov20_02253F28 diff --git a/arm9/overlays/32/asm/overlay_32.s b/arm9/overlays/32/asm/overlay_32.s index 07445ac63..94e580cba 100644 --- a/arm9/overlays/32/asm/overlay_32.s +++ b/arm9/overlays/32/asm/overlay_32.s @@ -534,7 +534,7 @@ ov32_02254C08: ; 0x02254C08 bl ov20_022538A4 add r4, r0, #0 ldr r0, _02254C50 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldr r0, [r4] cmp r0, #0 ldr r0, [r5, #0x24] diff --git a/arm9/overlays/34/asm/overlay_34.s b/arm9/overlays/34/asm/overlay_34.s index d2fedaaee..68ff3593b 100644 --- a/arm9/overlays/34/asm/overlay_34.s +++ b/arm9/overlays/34/asm/overlay_34.s @@ -228,14 +228,14 @@ _022549C4: mov r1, #2 bl ov34_02254A98 ldr r0, _02254A20 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldrb r0, [r4, #1] add r0, r0, #1 strb r0, [r4, #1] b _02254A1A _022549EE: ldr r0, _02254A24 ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect b _02254A1A _022549F6: ldr r0, [r4, #0x30] diff --git a/arm9/overlays/35/asm/overlay_35.s b/arm9/overlays/35/asm/overlay_35.s index e407fe386..f4a3e1e74 100644 --- a/arm9/overlays/35/asm/overlay_35.s +++ b/arm9/overlays/35/asm/overlay_35.s @@ -735,7 +735,7 @@ _02254DB6: add r0, r4, #0 bl ov35_02254E58 ldr r0, _02254E54 ; =0x00000678 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r5, #0 bl ov20_022538B0 pop {r4, r5, r6, pc} diff --git a/arm9/overlays/36/asm/overlay_36.s b/arm9/overlays/36/asm/overlay_36.s index 9a2b4213a..d6c1fcf1f 100644 --- a/arm9/overlays/36/asm/overlay_36.s +++ b/arm9/overlays/36/asm/overlay_36.s @@ -293,13 +293,13 @@ _02254A4C: ldr r0, [r4, r0] bl ov36_02254F0C ldr r0, _02254BD8 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect mov r0, #1 strb r0, [r4, #1] b _02254AA6 _02254A82: ldr r0, _02254BDC ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect b _02254AA6 _02254A8A: add r0, r1, #0 @@ -311,7 +311,7 @@ _02254A8A: mov r1, #5 bl ov36_02254F0C ldr r0, _02254BD8 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect mov r0, #3 strb r0, [r4, #1] _02254AA6: @@ -368,7 +368,7 @@ _02254AF4: bne _02254B46 _02254B0C: ldr r0, _02254BDC ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect b _02254B46 _02254B14: add r0, r1, #0 @@ -390,7 +390,7 @@ _02254B14: ldr r0, [r4, r0] bl ov36_02254F0C ldr r0, _02254BD8 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect mov r0, #2 strb r0, [r4, #1] _02254B46: @@ -474,7 +474,7 @@ ov36_02254BE4: ; 0x02254BE4 add r4, r0, #0 add r0, sp, #4 add r1, sp, #0 - bl ov20_02252B68 + bl TouchScreen_GetTapState cmp r0, #0 beq _02254C3E ldr r1, [sp, #4] @@ -530,7 +530,7 @@ ov36_02254C44: ; 0x02254C44 add r4, r0, #0 add r0, sp, #4 add r1, sp, #0 - bl ov20_02252B68 + bl TouchScreen_GetTapState cmp r0, #0 beq _02254C8A ldr r1, [sp, #4] @@ -1537,7 +1537,7 @@ _022553CA: cmp r0, #0 beq _022553E2 ldr r0, _022553E4 ; =0x0000066A - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r5, #0 bl ov36_02254F48 _022553E2: diff --git a/arm9/overlays/37/asm/overlay_37.s b/arm9/overlays/37/asm/overlay_37.s index bcb0ba845..565d59686 100644 --- a/arm9/overlays/37/asm/overlay_37.s +++ b/arm9/overlays/37/asm/overlay_37.s @@ -569,7 +569,7 @@ ov37_02254C44: ; 0x02254C44 pop {r4, r5, r6, pc} _02254C6C: ldr r0, _02254D18 ; =0x00000675 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldr r0, [r4, #0x24] mov r1, #0 bl ov20_02253F28 @@ -617,13 +617,13 @@ _02254C9E: cmp r1, r0 ldr r0, _02254D24 ; =0x00000676 bge _02254CE0 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect mov r0, #9 lsl r0, r0, #0x10 str r0, [r4, #0x3c] b _02254D02 _02254CE0: - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldr r0, [r6] cmp r0, #0 beq _02254CEE diff --git a/arm9/overlays/38/asm/overlay_38.s b/arm9/overlays/38/asm/overlay_38.s index 2032079eb..0ead006ca 100644 --- a/arm9/overlays/38/asm/overlay_38.s +++ b/arm9/overlays/38/asm/overlay_38.s @@ -952,7 +952,7 @@ _02254F56: ldr r0, [r0, #0x34] bl ov20_02253F28 ldr r0, _02254F70 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r5, #0 bl ov38_02254D70 pop {r3, r4, r5, pc} diff --git a/arm9/overlays/39/asm/overlay_39.s b/arm9/overlays/39/asm/overlay_39.s index dd67f2043..a17fb49b3 100644 --- a/arm9/overlays/39/asm/overlay_39.s +++ b/arm9/overlays/39/asm/overlay_39.s @@ -333,7 +333,7 @@ _02254AA8: b _02254AC4 _02254ABE: ldr r0, _02254B4C ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect _02254AC4: mov r0, #0 add r4, #0x46 @@ -887,7 +887,7 @@ ov39_02254ECC: ; 0x02254ECC add r0, r5, #0 bl ov20_022538A4 ldr r0, _02254EF4 ; =0x00000669 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldr r0, [r4, #0x24] mov r1, #0xa bl ov20_02253F28 @@ -929,7 +929,7 @@ ov39_02254F1C: ; 0x02254F1C add r0, #0x32 ldrb r5, [r0] ldr r0, _02254F5C ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect lsl r0, r5, #1 add r3, r7, r0 ldrh r0, [r3, #0x24] @@ -961,7 +961,7 @@ ov39_02254F60: ; 0x02254F60 add r0, #0x33 ldrb r5, [r0] ldr r0, _02254FA0 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect lsl r0, r5, #1 add r3, r7, r0 ldrh r0, [r3, #0x24] @@ -1326,7 +1326,7 @@ _0225522C: ldr r0, [r4, #0x6c] lsl r1, r1, #2 ldr r0, [r0, r1] - bl ov20_02252B28 + bl Poketch_PlaySoundEffect b _02255276 _02255240: ldr r0, [r4, #0x2c] diff --git a/arm9/overlays/40/asm/overlay_40.s b/arm9/overlays/40/asm/overlay_40.s index c5128398e..8b939e886 100644 --- a/arm9/overlays/40/asm/overlay_40.s +++ b/arm9/overlays/40/asm/overlay_40.s @@ -319,7 +319,7 @@ _02254A9A: mov r0, #0 str r0, [r4, #0x1c] ldr r0, _02254B4C ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect b _02254B46 _02254AB0: cmp r1, #1 @@ -465,7 +465,7 @@ _02254BB2: cmp r0, #0 bne _02254BC4 ldr r0, _02254C18 ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect b _02254C12 _02254BC4: add r0, r4, #0 @@ -1139,7 +1139,7 @@ ov40_022550C0: ; 0x022550C0 bl ov20_022538A4 add r4, r0, #0 ldr r0, _02255138 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldr r0, [r5, #0x34] mov r1, #3 bl ov20_02253F28 @@ -1191,7 +1191,7 @@ ov40_0225513C: ; 0x0225513C bl ov20_022538A4 add r4, r0, #0 ldr r0, _022551B4 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldr r0, [r5, #0x34] mov r1, #2 bl ov20_02253F28 @@ -1299,7 +1299,7 @@ _0225521A: mov r1, #1 bl ov20_02253F28 ldr r0, _02255304 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect ldr r0, _02255308 ; =0x00000126 bl ov20_02252B48 add r0, r4, #0 diff --git a/arm9/overlays/41/asm/overlay_41.s b/arm9/overlays/41/asm/overlay_41.s index 3c5e2d61b..eff687522 100644 --- a/arm9/overlays/41/asm/overlay_41.s +++ b/arm9/overlays/41/asm/overlay_41.s @@ -501,11 +501,11 @@ _02254BBA: mov r1, #5 bl ov41_022553A4 ldr r0, _02254D18 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect b _02254C32 _02254BEE: ldr r0, _02254D18 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r4, #0 bl ov41_0225504C mov r3, #0 @@ -531,7 +531,7 @@ _02254BEE: b _02254C32 _02254C2C: ldr r0, _02254D1C ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect _02254C32: mov r0, #0 pop {r4, pc} @@ -714,11 +714,11 @@ _02254D6C: b _02254E00 _02254D86: ldr r0, _02254E04 ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect b _02254E00 _02254D8E: ldr r0, _02254E08 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r4, #0 mov r1, #1 mov r2, #0 @@ -738,7 +738,7 @@ _02254D8E: b _02254E00 _02254DC0: ldr r0, _02254E08 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r4, #0 mov r1, #0 mov r2, #1 @@ -796,7 +796,7 @@ _02254E20: b _02254EAC _02254E3A: ldr r0, _02254EB0 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect mov r1, #1 add r0, r4, #0 add r2, r1, #0 @@ -813,11 +813,11 @@ _02254E3A: b _02254EAC _02254E64: ldr r0, _02254EB4 ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect b _02254EAC _02254E6C: ldr r0, _02254EB0 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r4, #0 mov r1, #0 mov r2, #1 @@ -875,11 +875,11 @@ _02254ECC: b _02254F52 _02254EE6: ldr r0, _02254F58 ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect b _02254F52 _02254EEE: ldr r0, _02254F5C ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r4, #0 mov r1, #0 mov r2, #1 @@ -900,7 +900,7 @@ _02254EEE: b _02254F52 _02254F20: ldr r0, _02254F5C ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r4, #0 mov r1, #0 mov r2, #1 @@ -953,7 +953,7 @@ _02254F74: b _0225500A _02254F8E: ldr r0, _02255010 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect mov r1, #0 add r0, r4, #0 add r2, r1, #0 @@ -971,11 +971,11 @@ _02254F8E: b _0225500A _02254FBA: ldr r0, _02255014 ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect b _0225500A _02254FC2: ldr r0, _02255010 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r4, #0 mov r1, #0 mov r2, #1 @@ -1859,7 +1859,7 @@ _02255670: bl ov20_02253F28 _0225567E: ldr r0, _0225568C ; =0x00000677 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect mov r0, #0 add r4, #0xa4 str r0, [r4] diff --git a/arm9/overlays/42/asm/overlay_42.s b/arm9/overlays/42/asm/overlay_42.s index 79771c4c6..02cde9a1e 100644 --- a/arm9/overlays/42/asm/overlay_42.s +++ b/arm9/overlays/42/asm/overlay_42.s @@ -399,7 +399,7 @@ _02254B40: str r0, [r4, #0xc] add r0, sp, #4 add r1, sp, #0 - bl ov20_02252B68 + bl TouchScreen_GetTapState cmp r0, #0 beq _02254B68 ldr r0, [r4, #0x28] diff --git a/arm9/overlays/43/asm/overlay_43.s b/arm9/overlays/43/asm/overlay_43.s index 7da079f94..4cda63682 100644 --- a/arm9/overlays/43/asm/overlay_43.s +++ b/arm9/overlays/43/asm/overlay_43.s @@ -765,7 +765,7 @@ _02254DCE: orr r0, r1 strb r0, [r2, #1] ldr r0, _02254E74 ; =0x00000678 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r5, #0 bl ov20_022538B0 pop {r3, r4, r5, pc} diff --git a/arm9/overlays/44/asm/ov44_02254A54.s b/arm9/overlays/44/asm/ov44_02254A54.s index 07f4c4a6a..42d1a1aa7 100644 --- a/arm9/overlays/44/asm/ov44_02254A54.s +++ b/arm9/overlays/44/asm/ov44_02254A54.s @@ -249,7 +249,7 @@ ov44_02254C14: ; 0x02254C14 bl ov20_022538A4 add r4, r0, #0 ldr r0, _02254C50 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect mov r0, #0 add r1, r0, #0 bl ov20_02252D7C diff --git a/arm9/overlays/47/asm/overlay_47.s b/arm9/overlays/47/asm/overlay_47.s index 1b4d8e03c..ce06dd9f4 100644 --- a/arm9/overlays/47/asm/overlay_47.s +++ b/arm9/overlays/47/asm/overlay_47.s @@ -213,7 +213,7 @@ _022549CA: b _022549DA _022549D4: ldr r0, _022549E0 ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect _022549DA: mov r0, #0 pop {r3, r4, r5, pc} @@ -993,7 +993,7 @@ ov47_02254F58: ; 0x02254F58 add r0, r4, #0 bl ov47_022550FC ldr r0, _02254F98 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r5, #0 bl ov47_02254E60 pop {r3, r4, r5, pc} @@ -1026,7 +1026,7 @@ ov47_02254F9C: ; 0x02254F9C add r0, r4, #0 bl ov47_02255184 ldr r0, _02254FE4 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r5, #0 bl ov47_02254E60 pop {r3, r4, r5, pc} @@ -1059,7 +1059,7 @@ ov47_02254FE8: ; 0x02254FE8 add r0, r4, #0 bl ov47_022551D8 ldr r0, _02255030 ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r5, #0 bl ov47_02254E60 pop {r3, r4, r5, pc} @@ -1092,7 +1092,7 @@ ov47_02255034: ; 0x02255034 add r0, r4, #0 bl ov47_02255250 ldr r0, _0225507C ; =0x0000066E - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r5, #0 bl ov47_02254E60 pop {r3, r4, r5, pc} @@ -1129,7 +1129,7 @@ ov47_02255080: ; 0x02255080 add r1, r6, #0 bl ov47_022552D8 ldr r0, _022550D4 ; =0x00000663 - bl ov20_02252B28 + bl Poketch_PlaySoundEffect add r0, r5, #0 bl ov47_02254E60 pop {r4, r5, r6, pc} diff --git a/include/heap.h b/include/heap.h index 81206cd40..41f74e891 100644 --- a/include/heap.h +++ b/include/heap.h @@ -12,7 +12,8 @@ typedef enum HeapID { HEAP_ID_2, HEAP_ID_MAIN, HEAP_ID_4, - HEAP_ID_8 = 8, + HEAP_ID_POKETCH_MAIN = 7, + HEAP_ID_POKETCH_APP, HEAP_ID_FIELD = 11, HEAP_ID_15 = 15, HEAP_ID_32 = 32,