From 9236084ad807cc1d2062d87217beb82a874119ec Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 6 Oct 2018 16:40:08 -0400 Subject: finish decompiling text.c --- asm/help_system.s | 4 +- asm/text.s | 1108 ----------------------------------------------------- data/text.s | 42 +- ld_script.txt | 1 - src/text.c | 433 ++++++++++++++++++++- 5 files changed, 454 insertions(+), 1134 deletions(-) delete mode 100644 asm/text.s diff --git a/asm/help_system.s b/asm/help_system.s index 9a447ebbe..21ae494aa 100644 --- a/asm/help_system.s +++ b/asm/help_system.s @@ -1322,7 +1322,7 @@ _0813C2D4: bl GetKeypadIconTileOffset lsls r0, 24 lsrs r0, 19 - ldr r1, _0813C344 @ =gUnknown_81EA700 + ldr r1, _0813C344 @ =gKeypadIconTiles adds r0, r1 str r0, [sp, 0x14] add r1, sp, 0x14 @@ -1365,7 +1365,7 @@ _0813C2D4: bl GetKeypadIconWidth b _0813C38E .align 2, 0 -_0813C344: .4byte gUnknown_81EA700 +_0813C344: .4byte gKeypadIconTiles _0813C348: mov r0, r9 ldrb r1, [r0] diff --git a/asm/text.s b/asm/text.s deleted file mode 100644 index 4c554ae88..000000000 --- a/asm/text.s +++ /dev/null @@ -1,1108 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_80062B0 -sub_80062B0: @ 80062B0 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x2E] - movs r3, 0x2E - ldrsh r2, [r1, r3] - cmp r2, 0 - beq _080062C4 - subs r0, 0x1 - strh r0, [r1, 0x2E] - b _080062FA -_080062C4: - movs r0, 0x8 - strh r0, [r1, 0x2E] - movs r3, 0x30 - ldrsh r0, [r1, r3] - cmp r0, 0x1 - beq _080062E8 - cmp r0, 0x1 - bgt _080062DA - cmp r0, 0 - beq _080062E4 - b _080062F4 -_080062DA: - cmp r0, 0x2 - beq _080062E8 - cmp r0, 0x3 - beq _080062EC - b _080062F4 -_080062E4: - strh r2, [r1, 0x26] - b _080062F4 -_080062E8: - strh r0, [r1, 0x26] - b _080062F4 -_080062EC: - movs r0, 0x1 - strh r0, [r1, 0x26] - strh r2, [r1, 0x30] - b _080062FA -_080062F4: - ldrh r0, [r1, 0x30] - adds r0, 0x1 - strh r0, [r1, 0x30] -_080062FA: - pop {r0} - bx r0 - thumb_func_end sub_80062B0 - - thumb_func_start sub_8006300 -sub_8006300: @ 8006300 - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r4, r1, 0 - adds r5, r2, 0 - adds r6, r3, 0 - ldr r1, [sp, 0x14] - lsls r0, 24 - lsrs r0, 24 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 24 - lsrs r6, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - movs r1, 0x1 - ands r0, r1 - lsls r0, 3 - ldr r1, _08006388 @ =gUnknown_81EA68C - adds r0, r1 - bl LoadSpriteSheet - ldr r0, _0800638C @ =gUnknown_81EA6A4 - bl LoadSpritePalette - ldr r0, _08006390 @ =gUnknown_81EA6B4 - adds r4, 0x3 - lsls r4, 16 - asrs r4, 16 - adds r5, 0x4 - lsls r5, 16 - asrs r5, 16 - adds r1, r4, 0 - adds r2, r5, 0 - mov r3, r8 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r1, _08006394 @ =gSprites - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r1 - movs r1, 0x3 - ands r6, r1 - lsls r6, 2 - ldrb r3, [r2, 0x5] - subs r1, 0x10 - ands r1, r3 - orrs r1, r6 - strb r1, [r2, 0x5] - ldrb r3, [r2, 0x3] - movs r1, 0x3F - negs r1, r1 - ands r1, r3 - strb r1, [r2, 0x3] - movs r1, 0x8 - strh r1, [r2, 0x2E] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r1} - bx r1 - .align 2, 0 -_08006388: .4byte gUnknown_81EA68C -_0800638C: .4byte gUnknown_81EA6A4 -_08006390: .4byte gUnknown_81EA6B4 -_08006394: .4byte gSprites - thumb_func_end sub_8006300 - - thumb_func_start sub_8006398 -sub_8006398: @ 8006398 - push {r4,lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, _080063C4 @ =gSprites - adds r0, r1 - bl DestroySprite - movs r4, 0x80 - lsls r4, 8 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_080063C4: .4byte gSprites - thumb_func_end sub_8006398 - - thumb_func_start DrawKeypadIcon -DrawKeypadIcon: @ 80063C8 - push {r4,r5,lr} - sub sp, 0x18 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - ldr r4, _08006410 @ =gUnknown_81EA6CC - lsrs r1, 22 - adds r1, r4 - ldrh r5, [r1] - lsls r5, 5 - ldr r4, _08006414 @ =gUnknown_81EA700 - adds r5, r4 - movs r4, 0x80 - str r4, [sp] - str r4, [sp, 0x4] - str r2, [sp, 0x8] - str r3, [sp, 0xC] - ldrb r4, [r1, 0x2] - str r4, [sp, 0x10] - ldrb r1, [r1, 0x3] - str r1, [sp, 0x14] - adds r1, r5, 0 - movs r2, 0 - movs r3, 0 - bl BlitBitmapRectToWindow - adds r0, r4, 0 - add sp, 0x18 - pop {r4,r5} - pop {r1} - bx r1 - .align 2, 0 -_08006410: .4byte gUnknown_81EA6CC -_08006414: .4byte gUnknown_81EA700 - thumb_func_end DrawKeypadIcon - - thumb_func_start GetKeypadIconTileOffset -GetKeypadIconTileOffset: @ 8006418 - lsls r0, 24 - ldr r1, _08006424 @ =gUnknown_81EA6CC - lsrs r0, 22 - adds r0, r1 - ldrb r0, [r0] - bx lr - .align 2, 0 -_08006424: .4byte gUnknown_81EA6CC - thumb_func_end GetKeypadIconTileOffset - - thumb_func_start GetKeypadIconWidth -GetKeypadIconWidth: @ 8006428 - lsls r0, 24 - ldr r1, _08006434 @ =gUnknown_81EA6CC - lsrs r0, 22 - adds r0, r1 - ldrb r0, [r0, 0x2] - bx lr - .align 2, 0 -_08006434: .4byte gUnknown_81EA6CC - thumb_func_end GetKeypadIconWidth - - thumb_func_start GetKeypadIconHeight -GetKeypadIconHeight: @ 8006438 - lsls r0, 24 - ldr r1, _08006444 @ =gUnknown_81EA6CC - lsrs r0, 22 - adds r0, r1 - ldrb r0, [r0, 0x3] - bx lr - .align 2, 0 -_08006444: .4byte gUnknown_81EA6CC - thumb_func_end GetKeypadIconHeight - - thumb_func_start DecompressGlyphFont0 -DecompressGlyphFont0: @ 8006448 - push {r4-r6,lr} - lsls r0, 16 - lsrs r6, r0, 16 - cmp r1, 0x1 - bne _08006490 - lsrs r2, r0, 20 - lsls r2, 9 - movs r0, 0xF - ands r0, r6 - lsls r0, 4 - ldr r1, _08006488 @ =gUnknown_81EF100 - adds r0, r1 - adds r5, r2, r0 - ldr r4, _0800648C @ =gGlyphInfo - adds r0, r5, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r5, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r1, r4, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r4, 0x81 - movs r0, 0xC - b _080064BC - .align 2, 0 -_08006488: .4byte gUnknown_81EF100 -_0800648C: .4byte gGlyphInfo -_08006490: - lsls r1, r6, 5 - ldr r0, _080064C4 @ =gUnknown_81EAF00 - adds r5, r1, r0 - ldr r4, _080064C8 @ =gGlyphInfo - adds r0, r5, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - adds r0, r5, 0 - adds r0, 0x10 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - ldr r0, _080064CC @ =gUnknown_81EEF00 - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0x80 - strb r1, [r0] - adds r4, 0x81 - movs r0, 0xD -_080064BC: - strb r0, [r4] - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_080064C4: .4byte gUnknown_81EAF00 -_080064C8: .4byte gGlyphInfo -_080064CC: .4byte gUnknown_81EEF00 - thumb_func_end DecompressGlyphFont0 - - thumb_func_start GetGlyphWidthFont0 -GetGlyphWidthFont0: @ 80064D0 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _080064E8 - ldr r0, _080064E4 @ =gUnknown_81EEF00 - adds r0, r2, r0 - ldrb r0, [r0] - b _080064EA - .align 2, 0 -_080064E4: .4byte gUnknown_81EEF00 -_080064E8: - movs r0, 0x8 -_080064EA: - pop {r1} - bx r1 - thumb_func_end GetGlyphWidthFont0 - - thumb_func_start DecompressGlyphFont1 -DecompressGlyphFont1: @ 80064F0 - push {r4-r6,lr} - lsls r0, 16 - lsrs r6, r0, 16 - cmp r1, 0x1 - bne _0800653C - lsrs r2, r0, 20 - lsls r2, 9 - movs r0, 0xF - ands r0, r6 - lsls r0, 4 - ldr r1, _08006534 @ =gUnknown_81FB300 - adds r0, r1 - adds r5, r2, r0 - ldr r4, _08006538 @ =gGlyphInfo - adds r0, r5, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r5, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r1, r4, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r4, 0x81 - movs r0, 0x10 - strb r0, [r4] - b _08006584 - .align 2, 0 -_08006534: .4byte gUnknown_81FB300 -_08006538: .4byte gGlyphInfo -_0800653C: - lsls r1, r6, 6 - ldr r0, _0800658C @ =gUnknown_81F3100 - adds r5, r1, r0 - ldr r4, _08006590 @ =gGlyphInfo - adds r0, r5, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - adds r0, r5, 0 - adds r0, 0x10 - adds r1, r4, 0 - adds r1, 0x20 - bl DecompressGlyphTile - adds r0, r5, 0 - adds r0, 0x20 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r0, r5, 0 - adds r0, 0x30 - adds r1, r4, 0 - adds r1, 0x60 - bl DecompressGlyphTile - ldr r0, _08006594 @ =gUnknown_81FB100 - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r4, 0 - adds r0, 0x80 - strb r1, [r0] - adds r1, r4, 0 - adds r1, 0x81 - movs r0, 0xE - strb r0, [r1] -_08006584: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_0800658C: .4byte gUnknown_81F3100 -_08006590: .4byte gGlyphInfo -_08006594: .4byte gUnknown_81FB100 - thumb_func_end DecompressGlyphFont1 - - thumb_func_start GetGlyphWidthFont1 -GetGlyphWidthFont1: @ 8006598 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _080065B0 - ldr r0, _080065AC @ =gUnknown_81FB100 - adds r0, r2, r0 - ldrb r0, [r0] - b _080065B2 - .align 2, 0 -_080065AC: .4byte gUnknown_81FB100 -_080065B0: - movs r0, 0x8 -_080065B2: - pop {r1} - bx r1 - thumb_func_end GetGlyphWidthFont1 - - thumb_func_start DecompressGlyphFont2 -DecompressGlyphFont2: @ 80065B8 - push {r4-r7,lr} - lsls r0, 16 - lsrs r6, r0, 16 - cmp r1, 0x1 - bne _0800665C - cmp r6, 0 - bne _080065F8 - movs r0, 0x2 - bl GetLastTextColor - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - ldr r3, _080065F4 @ =gGlyphInfo - lsls r2, r0, 4 - orrs r2, r0 - adds r7, r3, 0 - adds r7, 0x80 - movs r6, 0xA - adds r5, r3, 0 - adds r5, 0x81 - movs r4, 0xC -_080065E4: - adds r0, r1, r3 - strb r2, [r0] - strb r6, [r7] - strb r4, [r5] - adds r1, 0x1 - cmp r1, 0x7F - ble _080065E4 - b _080066E4 - .align 2, 0 -_080065F4: .4byte gGlyphInfo -_080065F8: - lsrs r2, r0, 19 - lsls r2, 9 - movs r0, 0x7 - ands r0, r6 - lsls r0, 5 - ldr r1, _08006650 @ =gUnknown_8207500 - adds r0, r1 - adds r4, r2, r0 - ldr r5, _08006654 @ =gGlyphInfo - adds r0, r4, 0 - adds r1, r5, 0 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x10 - adds r1, r5, 0 - adds r1, 0x20 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r4, r1 - adds r1, r5, 0 - adds r1, 0x40 - bl DecompressGlyphTile - movs r1, 0x88 - lsls r1, 1 - adds r0, r4, r1 - adds r1, r5, 0 - adds r1, 0x60 - bl DecompressGlyphTile - ldr r0, _08006658 @ =gUnknown_820F500 - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r5, 0 - adds r0, 0x80 - strb r1, [r0] - adds r1, r5, 0 - adds r1, 0x81 - movs r0, 0xC - b _080066E2 - .align 2, 0 -_08006650: .4byte gUnknown_8207500 -_08006654: .4byte gGlyphInfo -_08006658: .4byte gUnknown_820F500 -_0800665C: - cmp r6, 0 - bne _0800669C - movs r0, 0x2 - bl GetLastTextColor - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - ldr r3, _08006694 @ =gGlyphInfo - lsls r2, r0, 4 - orrs r2, r0 - ldr r0, _08006698 @ =gUnknown_8207300 - ldrb r4, [r0] - movs r0, 0x81 - adds r0, r3 - mov r12, r0 - adds r6, r3, 0 - adds r6, 0x80 - movs r5, 0xE -_08006682: - adds r0, r1, r3 - strb r2, [r0] - strb r4, [r6] - mov r0, r12 - strb r5, [r0] - adds r1, 0x1 - cmp r1, 0x7F - ble _08006682 - b _080066E4 - .align 2, 0 -_08006694: .4byte gGlyphInfo -_08006698: .4byte gUnknown_8207300 -_0800669C: - lsls r1, r6, 6 - ldr r0, _080066EC @ =gUnknown_81FF300 - adds r4, r1, r0 - ldr r5, _080066F0 @ =gGlyphInfo - adds r0, r4, 0 - adds r1, r5, 0 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x10 - adds r1, r5, 0 - adds r1, 0x20 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x20 - adds r1, r5, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x30 - adds r1, r5, 0 - adds r1, 0x60 - bl DecompressGlyphTile - ldr r0, _080066F4 @ =gUnknown_8207300 - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r5, 0 - adds r0, 0x80 - strb r1, [r0] - adds r1, r5, 0 - adds r1, 0x81 - movs r0, 0xE -_080066E2: - strb r0, [r1] -_080066E4: - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_080066EC: .4byte gUnknown_81FF300 -_080066F0: .4byte gGlyphInfo -_080066F4: .4byte gUnknown_8207300 - thumb_func_end DecompressGlyphFont2 - - thumb_func_start GetGlyphWidthFont2 -GetGlyphWidthFont2: @ 80066F8 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - bne _08006714 - cmp r2, 0 - bne _0800670A - movs r0, 0xA - b _0800671A -_0800670A: - ldr r0, _08006710 @ =gUnknown_820F500 - b _08006716 - .align 2, 0 -_08006710: .4byte gUnknown_820F500 -_08006714: - ldr r0, _08006720 @ =gUnknown_8207300 -_08006716: - adds r0, r2, r0 - ldrb r0, [r0] -_0800671A: - pop {r1} - bx r1 - .align 2, 0 -_08006720: .4byte gUnknown_8207300 - thumb_func_end GetGlyphWidthFont2 - - thumb_func_start DecompressGlyphFont3 -DecompressGlyphFont3: @ 8006724 - push {r4-r7,lr} - lsls r0, 16 - lsrs r3, r0, 16 - cmp r1, 0x1 - bne _080067C0 - cmp r3, 0 - bne _08006764 - movs r0, 0x2 - bl GetLastTextColor - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - ldr r3, _08006760 @ =gGlyphInfo - lsls r2, r0, 4 - orrs r2, r0 - adds r7, r3, 0 - adds r7, 0x80 - movs r6, 0xA - adds r5, r3, 0 - adds r5, 0x81 - movs r4, 0xC -_08006750: - adds r0, r1, r3 - strb r2, [r0] - strb r6, [r7] - strb r4, [r5] - adds r1, 0x1 - cmp r1, 0x7F - ble _08006750 - b _080067C6 - .align 2, 0 -_08006760: .4byte gGlyphInfo -_08006764: - lsrs r2, r0, 19 - lsls r2, 9 - movs r0, 0x7 - ands r0, r3 - lsls r0, 5 - ldr r1, _080067B8 @ =gUnknown_8207500 - adds r0, r1 - adds r5, r2, r0 - ldr r4, _080067BC @ =gGlyphInfo - adds r0, r5, 0 - adds r1, r4, 0 - bl DecompressGlyphTile - adds r0, r5, 0 - adds r0, 0x10 - adds r1, r4, 0 - adds r1, 0x20 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r5, r1 - adds r1, r4, 0 - adds r1, 0x40 - bl DecompressGlyphTile - movs r1, 0x88 - lsls r1, 1 - adds r0, r5, r1 - adds r1, r4, 0 - adds r1, 0x60 - bl DecompressGlyphTile - adds r1, r4, 0 - adds r1, 0x80 - movs r0, 0xA - strb r0, [r1] - adds r1, 0x1 - movs r0, 0xC - strb r0, [r1] - b _080067C6 - .align 2, 0 -_080067B8: .4byte gUnknown_8207500 -_080067BC: .4byte gGlyphInfo -_080067C0: - adds r0, r3, 0 - bl DecompressGlyphFont2 -_080067C6: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end DecompressGlyphFont3 - - thumb_func_start GetGlyphWidthFont3 -GetGlyphWidthFont3: @ 80067CC - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - beq _080067E4 - ldr r0, _080067E0 @ =gUnknown_8207300 - adds r0, r2, r0 - ldrb r0, [r0] - b _080067E6 - .align 2, 0 -_080067E0: .4byte gUnknown_8207300 -_080067E4: - movs r0, 0xA -_080067E6: - pop {r1} - bx r1 - thumb_func_end GetGlyphWidthFont3 - - thumb_func_start DecompressGlyphFont4 -DecompressGlyphFont4: @ 80067EC - push {r4-r7,lr} - lsls r0, 16 - lsrs r6, r0, 16 - cmp r1, 0x1 - bne _08006890 - cmp r6, 0 - bne _0800682C - movs r0, 0x2 - bl GetLastTextColor - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - ldr r3, _08006828 @ =gGlyphInfo - lsls r2, r0, 4 - orrs r2, r0 - adds r7, r3, 0 - adds r7, 0x80 - movs r6, 0xA - adds r5, r3, 0 - adds r5, 0x81 - movs r4, 0xC -_08006818: - adds r0, r1, r3 - strb r2, [r0] - strb r6, [r7] - strb r4, [r5] - adds r1, 0x1 - cmp r1, 0x7F - ble _08006818 - b _08006918 - .align 2, 0 -_08006828: .4byte gGlyphInfo -_0800682C: - lsrs r2, r0, 19 - lsls r2, 9 - movs r0, 0x7 - ands r0, r6 - lsls r0, 5 - ldr r1, _08006884 @ =gUnknown_8217818 - adds r0, r1 - adds r4, r2, r0 - ldr r5, _08006888 @ =gGlyphInfo - adds r0, r4, 0 - adds r1, r5, 0 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x10 - adds r1, r5, 0 - adds r1, 0x20 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r4, r1 - adds r1, r5, 0 - adds r1, 0x40 - bl DecompressGlyphTile - movs r1, 0x88 - lsls r1, 1 - adds r0, r4, r1 - adds r1, r5, 0 - adds r1, 0x60 - bl DecompressGlyphTile - ldr r0, _0800688C @ =gUnknown_821F818 - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r5, 0 - adds r0, 0x80 - strb r1, [r0] - adds r1, r5, 0 - adds r1, 0x81 - movs r0, 0xC - b _08006916 - .align 2, 0 -_08006884: .4byte gUnknown_8217818 -_08006888: .4byte gGlyphInfo -_0800688C: .4byte gUnknown_821F818 -_08006890: - cmp r6, 0 - bne _080068D0 - movs r0, 0x2 - bl GetLastTextColor - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - ldr r3, _080068C8 @ =gGlyphInfo - lsls r2, r0, 4 - orrs r2, r0 - ldr r0, _080068CC @ =gUnknown_8217618 - ldrb r4, [r0] - movs r0, 0x81 - adds r0, r3 - mov r12, r0 - adds r6, r3, 0 - adds r6, 0x80 - movs r5, 0xE -_080068B6: - adds r0, r1, r3 - strb r2, [r0] - strb r4, [r6] - mov r0, r12 - strb r5, [r0] - adds r1, 0x1 - cmp r1, 0x7F - ble _080068B6 - b _08006918 - .align 2, 0 -_080068C8: .4byte gGlyphInfo -_080068CC: .4byte gUnknown_8217618 -_080068D0: - lsls r1, r6, 6 - ldr r0, _08006920 @ =gUnknown_820F618 - adds r4, r1, r0 - ldr r5, _08006924 @ =gGlyphInfo - adds r0, r4, 0 - adds r1, r5, 0 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x10 - adds r1, r5, 0 - adds r1, 0x20 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x20 - adds r1, r5, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x30 - adds r1, r5, 0 - adds r1, 0x60 - bl DecompressGlyphTile - ldr r0, _08006928 @ =gUnknown_8217618 - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r5, 0 - adds r0, 0x80 - strb r1, [r0] - adds r1, r5, 0 - adds r1, 0x81 - movs r0, 0xE -_08006916: - strb r0, [r1] -_08006918: - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08006920: .4byte gUnknown_820F618 -_08006924: .4byte gGlyphInfo -_08006928: .4byte gUnknown_8217618 - thumb_func_end DecompressGlyphFont4 - - thumb_func_start GetGlyphWidthFont4 -GetGlyphWidthFont4: @ 800692C - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - bne _08006948 - cmp r2, 0 - bne _0800693E - movs r0, 0xA - b _0800694E -_0800693E: - ldr r0, _08006944 @ =gUnknown_821F818 - b _0800694A - .align 2, 0 -_08006944: .4byte gUnknown_821F818 -_08006948: - ldr r0, _08006954 @ =gUnknown_8217618 -_0800694A: - adds r0, r2, r0 - ldrb r0, [r0] -_0800694E: - pop {r1} - bx r1 - .align 2, 0 -_08006954: .4byte gUnknown_8217618 - thumb_func_end GetGlyphWidthFont4 - - thumb_func_start DecompressGlyphFont5 -DecompressGlyphFont5: @ 8006958 - push {r4-r7,lr} - lsls r0, 16 - lsrs r6, r0, 16 - cmp r1, 0x1 - bne _080069FC - cmp r6, 0 - bne _08006998 - movs r0, 0x2 - bl GetLastTextColor - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - ldr r3, _08006994 @ =gGlyphInfo - lsls r2, r0, 4 - orrs r2, r0 - adds r7, r3, 0 - adds r7, 0x80 - movs r6, 0xA - adds r5, r3, 0 - adds r5, 0x81 - movs r4, 0xC -_08006984: - adds r0, r1, r3 - strb r2, [r0] - strb r6, [r7] - strb r4, [r5] - adds r1, 0x1 - cmp r1, 0x7F - ble _08006984 - b _08006A84 - .align 2, 0 -_08006994: .4byte gGlyphInfo -_08006998: - lsrs r2, r0, 19 - lsls r2, 9 - movs r0, 0x7 - ands r0, r6 - lsls r0, 5 - ldr r1, _080069F0 @ =gUnknown_8227B30 - adds r0, r1 - adds r4, r2, r0 - ldr r5, _080069F4 @ =gGlyphInfo - adds r0, r4, 0 - adds r1, r5, 0 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x10 - adds r1, r5, 0 - adds r1, 0x20 - bl DecompressGlyphTile - movs r1, 0x80 - lsls r1, 1 - adds r0, r4, r1 - adds r1, r5, 0 - adds r1, 0x40 - bl DecompressGlyphTile - movs r1, 0x88 - lsls r1, 1 - adds r0, r4, r1 - adds r1, r5, 0 - adds r1, 0x60 - bl DecompressGlyphTile - ldr r0, _080069F8 @ =gUnknown_822FB30 - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r5, 0 - adds r0, 0x80 - strb r1, [r0] - adds r1, r5, 0 - adds r1, 0x81 - movs r0, 0xC - b _08006A82 - .align 2, 0 -_080069F0: .4byte gUnknown_8227B30 -_080069F4: .4byte gGlyphInfo -_080069F8: .4byte gUnknown_822FB30 -_080069FC: - cmp r6, 0 - bne _08006A3C - movs r0, 0x2 - bl GetLastTextColor - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - ldr r3, _08006A34 @ =gGlyphInfo - lsls r2, r0, 4 - orrs r2, r0 - ldr r0, _08006A38 @ =gUnknown_8227930 - ldrb r4, [r0] - movs r0, 0x81 - adds r0, r3 - mov r12, r0 - adds r6, r3, 0 - adds r6, 0x80 - movs r5, 0xE -_08006A22: - adds r0, r1, r3 - strb r2, [r0] - strb r4, [r6] - mov r0, r12 - strb r5, [r0] - adds r1, 0x1 - cmp r1, 0x7F - ble _08006A22 - b _08006A84 - .align 2, 0 -_08006A34: .4byte gGlyphInfo -_08006A38: .4byte gUnknown_8227930 -_08006A3C: - lsls r1, r6, 6 - ldr r0, _08006A8C @ =gUnknown_821F930 - adds r4, r1, r0 - ldr r5, _08006A90 @ =gGlyphInfo - adds r0, r4, 0 - adds r1, r5, 0 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x10 - adds r1, r5, 0 - adds r1, 0x20 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x20 - adds r1, r5, 0 - adds r1, 0x40 - bl DecompressGlyphTile - adds r0, r4, 0 - adds r0, 0x30 - adds r1, r5, 0 - adds r1, 0x60 - bl DecompressGlyphTile - ldr r0, _08006A94 @ =gUnknown_8227930 - adds r0, r6, r0 - ldrb r1, [r0] - adds r0, r5, 0 - adds r0, 0x80 - strb r1, [r0] - adds r1, r5, 0 - adds r1, 0x81 - movs r0, 0xE -_08006A82: - strb r0, [r1] -_08006A84: - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08006A8C: .4byte gUnknown_821F930 -_08006A90: .4byte gGlyphInfo -_08006A94: .4byte gUnknown_8227930 - thumb_func_end DecompressGlyphFont5 - - thumb_func_start GetGlyphWidthFont5 -GetGlyphWidthFont5: @ 8006A98 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - cmp r1, 0x1 - bne _08006AB4 - cmp r2, 0 - bne _08006AAA - movs r0, 0xA - b _08006ABA -_08006AAA: - ldr r0, _08006AB0 @ =gUnknown_822FB30 - b _08006AB6 - .align 2, 0 -_08006AB0: .4byte gUnknown_822FB30 -_08006AB4: - ldr r0, _08006AC0 @ =gUnknown_8227930 -_08006AB6: - adds r0, r2, r0 - ldrb r0, [r0] -_08006ABA: - pop {r1} - bx r1 - .align 2, 0 -_08006AC0: .4byte gUnknown_8227930 - thumb_func_end GetGlyphWidthFont5 - - thumb_func_start DecompressGlyphFont9 -DecompressGlyphFont9: @ 8006AC4 - push {r4,r5,lr} - lsls r0, 16 - lsrs r4, r0, 20 - lsls r4, 9 - movs r1, 0xF0 - lsls r1, 12 - ands r1, r0 - lsrs r1, 12 - ldr r0, _08006B08 @ =gUnknown_822FC48 - adds r1, r0 - adds r4, r1 - ldr r5, _08006B0C @ =gGlyphInfo - adds r0, r4, 0 - adds r1, r5, 0 - bl DecompressGlyphTile - movs r0, 0x80 - lsls r0, 1 - adds r4, r0 - adds r1, r5, 0 - adds r1, 0x40 - adds r0, r4, 0 - bl DecompressGlyphTile - adds r1, r5, 0 - adds r1, 0x80 - movs r0, 0x8 - strb r0, [r1] - adds r5, 0x81 - movs r0, 0xC - strb r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_08006B08: .4byte gUnknown_822FC48 -_08006B0C: .4byte gGlyphInfo - thumb_func_end DecompressGlyphFont9 - - .align 2, 0 @ Don't pad with nop. diff --git a/data/text.s b/data/text.s index c9948aef5..b44badaa2 100644 --- a/data/text.s +++ b/data/text.s @@ -24,65 +24,65 @@ gUnknown_81EA6A4:: @ 81EA6A4 gUnknown_81EA6B4:: @ 81EA6B4 .incbin "baserom.gba", 0x1EA6B4, 0x18 -gUnknown_81EA6CC:: @ 81EA6CC +gKeypadIcons:: @ 81EA6CC .incbin "baserom.gba", 0x1EA6CC, 0x34 -gUnknown_81EA700:: @ 81EA700 +gKeypadIconTiles:: @ 81EA700 .incbin "baserom.gba", 0x1EA700, 0x800 -gUnknown_81EAF00:: @ 81EAF00 +gFont0LatinGlyphs:: @ 81EAF00 .incbin "baserom.gba", 0x1EAF00, 0x4000 -gUnknown_81EEF00:: @ 81EEF00 +gFont0LatinGlyphWidths:: @ 81EEF00 .incbin "baserom.gba", 0x1EEF00, 0x200 -gUnknown_81EF100:: @ 81EF100 +gFont0JapaneseGlyphs:: @ 81EF100 .incbin "baserom.gba", 0x1EF100, 0x4000 -gUnknown_81F3100:: @ 81F3100 +gFont1LatinGlyphs:: @ 81F3100 .incbin "baserom.gba", 0x1F3100, 0x8000 -gUnknown_81FB100:: @ 81FB100 +gFont1LatinGlyphWidths:: @ 81FB100 .incbin "baserom.gba", 0x1FB100, 0x200 -gUnknown_81FB300:: @ 81FB300 +gFont1JapaneseGlyphs:: @ 81FB300 .incbin "baserom.gba", 0x1FB300, 0x4000 -gUnknown_81FF300:: @ 81FF300 +gFont2LatinGlyphs:: @ 81FF300 .incbin "baserom.gba", 0x1FF300, 0x8000 -gUnknown_8207300:: @ 8207300 +gFont2LatinGlyphWidths:: @ 8207300 .incbin "baserom.gba", 0x207300, 0x200 -gUnknown_8207500:: @ 8207500 +gFont2JapaneseGlyphs:: @ 8207500 .incbin "baserom.gba", 0x207500, 0x8000 -gUnknown_820F500:: @ 820F500 +gFont2JapaneseGlyphWidths:: @ 820F500 .incbin "baserom.gba", 0x20F500, 0x118 -gUnknown_820F618:: @ 820F618 +gFont4LatinGlyphs:: @ 820F618 .incbin "baserom.gba", 0x20F618, 0x8000 -gUnknown_8217618:: @ 8217618 +gFont4LatinGlyphWidths:: @ 8217618 .incbin "baserom.gba", 0x217618, 0x200 -gUnknown_8217818:: @ 8217818 +gFont4JapaneseGlyphs:: @ 8217818 .incbin "baserom.gba", 0x217818, 0x8000 -gUnknown_821F818:: @ 821F818 +gFont4JapaneseGlyphWidths:: @ 821F818 .incbin "baserom.gba", 0x21F818, 0x118 -gUnknown_821F930:: @ 821F930 +gFont5LatinGlyphs:: @ 821F930 .incbin "baserom.gba", 0x21F930, 0x8000 -gUnknown_8227930:: @ 8227930 +gFont5LatinGlyphWidths:: @ 8227930 .incbin "baserom.gba", 0x227930, 0x200 -gUnknown_8227B30:: @ 8227B30 +gFont5JapaneseGlyphs:: @ 8227B30 .incbin "baserom.gba", 0x227B30, 0x8000 -gUnknown_822FB30:: @ 822FB30 +gFont5JapaneseGlyphWidths:: @ 822FB30 .incbin "baserom.gba", 0x22FB30, 0x118 -gUnknown_822FC48:: @ 822FC48 +gFont9JapaneseGlyphs:: @ 822FC48 .incbin "baserom.gba", 0x22FC48, 0x2000 diff --git a/ld_script.txt b/ld_script.txt index 1e1d66fbb..cc38e017f 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -58,7 +58,6 @@ SECTIONS { asm/blit.o(.text); src/window_8bpp.o(.text); src/text.o(.text); - asm/text.o(.text); src/sprite.o(.text); src/string_util.o(.text); asm/link.o(.text); diff --git a/src/text.c b/src/text.c index 7832d86f3..bc5fd7a66 100644 --- a/src/text.c +++ b/src/text.c @@ -37,8 +37,6 @@ extern const struct FontInfo gFontInfos[]; extern const u8 gMenuCursorDimensions[][2]; -extern const u16 gFont9JapaneseGlyphs[]; - extern const u16 gFont8LatinGlyphs[]; extern const u8 gFont8LatinGlyphWidths[]; extern const u16 gFont0LatinGlyphs[]; @@ -53,6 +51,15 @@ extern const u16 gFont0JapaneseGlyphs[]; extern const u16 gFont1JapaneseGlyphs[]; extern const u16 gFont2JapaneseGlyphs[]; extern const u8 gFont2JapaneseGlyphWidths[]; +extern const u16 gFont4JapaneseGlyphs[]; +extern const u8 gFont4JapaneseGlyphWidths[]; +extern const u16 gFont4LatinGlyphs[]; +extern const u8 gFont4LatinGlyphWidths[]; +extern const u16 gFont5JapaneseGlyphs[]; +extern const u8 gFont5JapaneseGlyphWidths[]; +extern const u16 gFont5LatinGlyphs[]; +extern const u8 gFont5LatinGlyphWidths[]; +extern const u16 gFont9JapaneseGlyphs[]; u16 Font0Func(struct TextPrinter *textPrinter) { @@ -1438,3 +1445,425 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str) RestoreTextColors(&colorBackup[0], &colorBackup[1], &colorBackup[2]); return 1; } + +// TODO: What is this? +struct Unk80062B0 { + u8 filler0[0x26]; + u16 unk26; + u8 filler28[0x6]; + s16 unk2E; + s16 unk30; +}; + +void sub_80062B0(struct Unk80062B0 *unkStruct) +{ + if(unkStruct->unk2E) + { + unkStruct->unk2E--; + } + else + { + unkStruct->unk2E = 8; + switch(unkStruct->unk30) + { + case 0: + unkStruct->unk26 = 0; + break; + case 1: + unkStruct->unk26 = 1; + break; + case 2: + unkStruct->unk26 = 2; + break; + case 3: + unkStruct->unk26 = 1; + unkStruct->unk30 = 0; + return; + } + unkStruct->unk30++; + } +} + +extern const struct SpriteSheet gUnknown_81EA68C[]; +extern const struct SpritePalette gUnknown_81EA6A4; +extern const struct SpriteTemplate gUnknown_81EA6B4; + +u8 sub_8006300(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority) +{ + u8 spriteId; + LoadSpriteSheet(&gUnknown_81EA68C[sheetId & 1]); + LoadSpritePalette(&gUnknown_81EA6A4); + spriteId = CreateSprite(&gUnknown_81EA6B4, x + 3, y + 4, subpriority); + gSprites[spriteId].oam.priority = (priority & 3); + gSprites[spriteId].oam.matrixNum = 0; + gSprites[spriteId].data[0] = 8; + return spriteId; +} + +void sub_8006398(u8 spriteId) +{ + DestroySprite(&gSprites[spriteId]); + FreeSpriteTilesByTag(0x8000); + FreeSpritePaletteByTag(0x8000); +} + +u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y) +{ + BlitBitmapRectToWindow( + windowId, + gKeypadIconTiles + (gKeypadIcons[keypadIconId].tile_offset * 0x20), + 0, + 0, + 0x80, + 0x80, + x, + y, + gKeypadIcons[keypadIconId].width, + gKeypadIcons[keypadIconId].height); + return gKeypadIcons[keypadIconId].width; +} + +u8 GetKeypadIconTileOffset(u8 keypadIconId) +{ + return gKeypadIcons[keypadIconId].tile_offset; +} + +u8 GetKeypadIconWidth(u8 keypadIconId) +{ + return gKeypadIcons[keypadIconId].width; +} + +u8 GetKeypadIconHeight(u8 keypadIconId) +{ + return gKeypadIcons[keypadIconId].height; +} + +void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + + if (isJapanese == 1) + { + glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + gGlyphInfo[0x80] = 8; // gGlyphWidth + gGlyphInfo[0x81] = 12; // gGlyphHeight + } + else + { + glyphs = gFont0LatinGlyphs + (0x10 * glyphId); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x40)); + gGlyphInfo[0x80] = gFont0LatinGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 13; + } +} + +u32 GetGlyphWidthFont0(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + return 8; + else + return gFont0LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + + if (isJapanese == TRUE) + { + int eff; + glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FD0 + gGlyphInfo[0x80] = 8; // gGlyphWidth + gGlyphInfo[0x81] = 16; // gGlyphHeight + } + else + { + glyphs = gFont1LatinGlyphs + (0x20 * glyphId); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont1LatinGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 14; + } +} + +u32 GetGlyphWidthFont1(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + return 8; + else + return gFont1LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + int i; + u8 lastColor; + + if(isJapanese == TRUE) + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // Game Freak, please. writing the same values over and over... + gGlyphInfo[0x80] = 10; + gGlyphInfo[0x81] = 12; + } + } + else // _080065F8 + { + glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth + gGlyphInfo[0x81] = 12; // gGlyphHeight + } + } + else // _0800665C + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // but why + gGlyphInfo[0x80] = gFont2LatinGlyphWidths[0]; + gGlyphInfo[0x81] = 14; + } + } + else // _0800669C + { + glyphs = gFont2LatinGlyphs + (0x20 * glyphId); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont2LatinGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 14; + } + } +} + +u32 GetGlyphWidthFont2(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + { + if(glyphId == 0) + return 10; + + return gFont2JapaneseGlyphWidths[glyphId]; + } + else + { + return gFont2LatinGlyphWidths[glyphId]; + } +} + +void DecompressGlyphFont3(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + int i; + u8 lastColor; + + if(isJapanese == TRUE) + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // Game Freak, please. writing the same values over and over... + gGlyphInfo[0x80] = 10; + gGlyphInfo[0x81] = 12; + } + } + else + { + glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = 10; // gGlyphWidth + gGlyphInfo[0x81] = 12; // gGlyphHeight + } + } + else + DecompressGlyphFont2(glyphId, isJapanese); +} + +u32 GetGlyphWidthFont3(u16 glyphId, bool32 isJapanese) +{ + if(isJapanese == TRUE) + return 10; + else + return gFont2LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + int i; + u8 lastColor; + + if(isJapanese == TRUE) + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // Game Freak, please. writing the same values over and over... + gGlyphInfo[0x80] = 10; + gGlyphInfo[0x81] = 12; + } + } + else // _0800682C + { + glyphs = gFont4JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = gFont4JapaneseGlyphWidths[glyphId]; // gGlyphWidth + gGlyphInfo[0x81] = 12; // gGlyphHeight + } + } + else + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // but why + gGlyphInfo[0x80] = gFont4LatinGlyphWidths[0]; + gGlyphInfo[0x81] = 14; + } + } + else // _080068D0 + { + glyphs = gFont4LatinGlyphs + (0x20 * glyphId); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = gFont4LatinGlyphWidths[glyphId]; // gGlyphWidth + gGlyphInfo[0x81] = 14; // gGlyphHeight + } + } +} + +u32 GetGlyphWidthFont4(u16 glyphId, bool32 isJapanese) +{ + if(isJapanese == TRUE) + { + if(glyphId == 0) + return 10; + + return gFont4JapaneseGlyphWidths[glyphId]; + } + else + return gFont4LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont5(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + int i; + u8 lastColor; + + if(isJapanese == TRUE) + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // Game Freak, please. writing the same values over and over... + gGlyphInfo[0x80] = 10; + gGlyphInfo[0x81] = 12; + } + } + else // _08006998 + { + glyphs = gFont5JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = gFont5JapaneseGlyphWidths[glyphId]; // gGlyphWidth + gGlyphInfo[0x81] = 12; // gGlyphHeight + } + } + else + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // but why + gGlyphInfo[0x80] = gFont5LatinGlyphWidths[0]; + gGlyphInfo[0x81] = 14; + } + } + else + { + glyphs = gFont5LatinGlyphs + (0x20 * glyphId); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = gFont5LatinGlyphWidths[glyphId]; // gGlyphWidth + gGlyphInfo[0x81] = 14; // gGlyphHeight + } + } +} + +u32 GetGlyphWidthFont5(u16 glyphId, bool32 isJapanese) +{ + if(isJapanese == TRUE) + { + if(glyphId == 0) + return 10; + + return gFont5JapaneseGlyphWidths[glyphId]; + } + else + return gFont5LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont9(u16 glyphId) +{ + const u16* glyphs = gFont9JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FD0 + gGlyphInfo[0x80] = 8; + gGlyphInfo[0x81] = 12; +} -- cgit v1.2.3 From 4cd32e863617326cab9cb7347a55be8c6c6dc3ac Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 7 Oct 2018 00:14:45 -0400 Subject: migrate text rodata to C file --- Makefile | 2 + data/data.s | 5 +- data/graphics/fonts/down_arrow.png | Bin 0 -> 162 bytes data/graphics/fonts/down_arrow_2.png | Bin 0 -> 150 bytes data/graphics/fonts/down_arrow_3.png | Bin 0 -> 189 bytes data/graphics/fonts/down_arrow_RS.png | Bin 0 -> 163 bytes data/graphics/fonts/down_arrow_RS_2.png | Bin 0 -> 150 bytes data/graphics/fonts/font0_jap.png | Bin 0 -> 3073 bytes data/graphics/fonts/font0_latin.png | Bin 0 -> 3285 bytes data/graphics/fonts/font1_jap.png | Bin 0 -> 3135 bytes data/graphics/fonts/font1_latin.png | Bin 0 -> 3470 bytes data/graphics/fonts/font2_jap.png | Bin 0 -> 4532 bytes data/graphics/fonts/font2_latin.png | Bin 0 -> 3470 bytes data/graphics/fonts/font4_jap.png | Bin 0 -> 4480 bytes data/graphics/fonts/font4_latin.png | Bin 0 -> 3470 bytes data/graphics/fonts/font5_jap.png | Bin 0 -> 4507 bytes data/graphics/fonts/font5_latin.png | Bin 0 -> 3470 bytes data/graphics/fonts/font9_jap.png | Bin 0 -> 2281 bytes data/graphics/fonts/keypad_icons.png | Bin 0 -> 297 bytes data/text.s | 88 ------- graphics_file_rules.mk | 34 +++ include/text.h | 4 + ld_script.txt | 1 - src/text.c | 436 +++++++++++++++++++++++++++----- 24 files changed, 413 insertions(+), 157 deletions(-) create mode 100644 data/graphics/fonts/down_arrow.png create mode 100644 data/graphics/fonts/down_arrow_2.png create mode 100644 data/graphics/fonts/down_arrow_3.png create mode 100644 data/graphics/fonts/down_arrow_RS.png create mode 100644 data/graphics/fonts/down_arrow_RS_2.png create mode 100644 data/graphics/fonts/font0_jap.png create mode 100644 data/graphics/fonts/font0_latin.png create mode 100644 data/graphics/fonts/font1_jap.png create mode 100644 data/graphics/fonts/font1_latin.png create mode 100644 data/graphics/fonts/font2_jap.png create mode 100644 data/graphics/fonts/font2_latin.png create mode 100644 data/graphics/fonts/font4_jap.png create mode 100644 data/graphics/fonts/font4_latin.png create mode 100644 data/graphics/fonts/font5_jap.png create mode 100644 data/graphics/fonts/font5_latin.png create mode 100644 data/graphics/fonts/font9_jap.png create mode 100644 data/graphics/fonts/keypad_icons.png delete mode 100644 data/text.s create mode 100644 graphics_file_rules.mk diff --git a/Makefile b/Makefile index 04690e382..0b83cb5c5 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,8 @@ tidy: rm -f $(ROM) $(ELF) $(MAP) rm -r build/* +include graphics_file_rules.mk + %.s: ; %.png: ; %.pal: ; diff --git a/data/data.s b/data/data.s index d1598bfbc..7f2b474aa 100644 --- a/data/data.s +++ b/data/data.s @@ -1554,7 +1554,10 @@ gUnknown_83AC970:: @ 83AC970 .incbin "baserom.gba", 0x3AC970, 0x20 sFanfares:: @ 83AC990 - .incbin "baserom.gba", 0x3AC990, 0x278 + .incbin "baserom.gba", 0x3AC990, 0x40 + +gUnknown_83AC9D0:: @ 83AC9D0 + .incbin "baserom.gba", 0x3AC9D0, 0x238 gUnknown_83ACC08:: @ 83ACC08 .incbin "baserom.gba", 0x3ACC08, 0x440 diff --git a/data/graphics/fonts/down_arrow.png b/data/graphics/fonts/down_arrow.png new file mode 100644 index 000000000..e74ed47ef Binary files /dev/null and b/data/graphics/fonts/down_arrow.png differ diff --git a/data/graphics/fonts/down_arrow_2.png b/data/graphics/fonts/down_arrow_2.png new file mode 100644 index 000000000..aefcf4f08 Binary files /dev/null and b/data/graphics/fonts/down_arrow_2.png differ diff --git a/data/graphics/fonts/down_arrow_3.png b/data/graphics/fonts/down_arrow_3.png new file mode 100644 index 000000000..85a157564 Binary files /dev/null and b/data/graphics/fonts/down_arrow_3.png differ diff --git a/data/graphics/fonts/down_arrow_RS.png b/data/graphics/fonts/down_arrow_RS.png new file mode 100644 index 000000000..c0aae894f Binary files /dev/null and b/data/graphics/fonts/down_arrow_RS.png differ diff --git a/data/graphics/fonts/down_arrow_RS_2.png b/data/graphics/fonts/down_arrow_RS_2.png new file mode 100644 index 000000000..de9d9cf47 Binary files /dev/null and b/data/graphics/fonts/down_arrow_RS_2.png differ diff --git a/data/graphics/fonts/font0_jap.png b/data/graphics/fonts/font0_jap.png new file mode 100644 index 000000000..23903f343 Binary files /dev/null and b/data/graphics/fonts/font0_jap.png differ diff --git a/data/graphics/fonts/font0_latin.png b/data/graphics/fonts/font0_latin.png new file mode 100644 index 000000000..7a79f2389 Binary files /dev/null and b/data/graphics/fonts/font0_latin.png differ diff --git a/data/graphics/fonts/font1_jap.png b/data/graphics/fonts/font1_jap.png new file mode 100644 index 000000000..0041b477a Binary files /dev/null and b/data/graphics/fonts/font1_jap.png differ diff --git a/data/graphics/fonts/font1_latin.png b/data/graphics/fonts/font1_latin.png new file mode 100644 index 000000000..42e847faf Binary files /dev/null and b/data/graphics/fonts/font1_latin.png differ diff --git a/data/graphics/fonts/font2_jap.png b/data/graphics/fonts/font2_jap.png new file mode 100644 index 000000000..efdb4b77e Binary files /dev/null and b/data/graphics/fonts/font2_jap.png differ diff --git a/data/graphics/fonts/font2_latin.png b/data/graphics/fonts/font2_latin.png new file mode 100644 index 000000000..42e847faf Binary files /dev/null and b/data/graphics/fonts/font2_latin.png differ diff --git a/data/graphics/fonts/font4_jap.png b/data/graphics/fonts/font4_jap.png new file mode 100644 index 000000000..da4f2beac Binary files /dev/null and b/data/graphics/fonts/font4_jap.png differ diff --git a/data/graphics/fonts/font4_latin.png b/data/graphics/fonts/font4_latin.png new file mode 100644 index 000000000..42e847faf Binary files /dev/null and b/data/graphics/fonts/font4_latin.png differ diff --git a/data/graphics/fonts/font5_jap.png b/data/graphics/fonts/font5_jap.png new file mode 100644 index 000000000..7da59c0eb Binary files /dev/null and b/data/graphics/fonts/font5_jap.png differ diff --git a/data/graphics/fonts/font5_latin.png b/data/graphics/fonts/font5_latin.png new file mode 100644 index 000000000..42e847faf Binary files /dev/null and b/data/graphics/fonts/font5_latin.png differ diff --git a/data/graphics/fonts/font9_jap.png b/data/graphics/fonts/font9_jap.png new file mode 100644 index 000000000..14cf6c042 Binary files /dev/null and b/data/graphics/fonts/font9_jap.png differ diff --git a/data/graphics/fonts/keypad_icons.png b/data/graphics/fonts/keypad_icons.png new file mode 100644 index 000000000..f8c162bb9 Binary files /dev/null and b/data/graphics/fonts/keypad_icons.png differ diff --git a/data/text.s b/data/text.s deleted file mode 100644 index b44badaa2..000000000 --- a/data/text.s +++ /dev/null @@ -1,88 +0,0 @@ - .section .rodata - -gDownArrowTiles:: @ 81EA14C - .incbin "baserom.gba", 0x1EA14C, 0x100 - -gDarkDownArrowTiles:: @ 81EA24C - .incbin "baserom.gba", 0x1EA24C, 0x400 - -gDownArrowYCoords:: @ 81EA64C - .incbin "baserom.gba", 0x1EA64C, 0x4 - -gUnknown_81EA650:: @ 81EA650 - .incbin "baserom.gba", 0x1EA650, 0x4 - -gGlyphWidthFuncs:: @ 81EA654 - .incbin "baserom.gba", 0x1EA654, 0x38 - -gUnknown_81EA68C:: @ 81EA68C - .incbin "baserom.gba", 0x1EA68C, 0x18 - -gUnknown_81EA6A4:: @ 81EA6A4 - .incbin "baserom.gba", 0x1EA6A4, 0x10 - -gUnknown_81EA6B4:: @ 81EA6B4 - .incbin "baserom.gba", 0x1EA6B4, 0x18 - -gKeypadIcons:: @ 81EA6CC - .incbin "baserom.gba", 0x1EA6CC, 0x34 - -gKeypadIconTiles:: @ 81EA700 - .incbin "baserom.gba", 0x1EA700, 0x800 - -gFont0LatinGlyphs:: @ 81EAF00 - .incbin "baserom.gba", 0x1EAF00, 0x4000 - -gFont0LatinGlyphWidths:: @ 81EEF00 - .incbin "baserom.gba", 0x1EEF00, 0x200 - -gFont0JapaneseGlyphs:: @ 81EF100 - .incbin "baserom.gba", 0x1EF100, 0x4000 - -gFont1LatinGlyphs:: @ 81F3100 - .incbin "baserom.gba", 0x1F3100, 0x8000 - -gFont1LatinGlyphWidths:: @ 81FB100 - .incbin "baserom.gba", 0x1FB100, 0x200 - -gFont1JapaneseGlyphs:: @ 81FB300 - .incbin "baserom.gba", 0x1FB300, 0x4000 - -gFont2LatinGlyphs:: @ 81FF300 - .incbin "baserom.gba", 0x1FF300, 0x8000 - -gFont2LatinGlyphWidths:: @ 8207300 - .incbin "baserom.gba", 0x207300, 0x200 - -gFont2JapaneseGlyphs:: @ 8207500 - .incbin "baserom.gba", 0x207500, 0x8000 - -gFont2JapaneseGlyphWidths:: @ 820F500 - .incbin "baserom.gba", 0x20F500, 0x118 - -gFont4LatinGlyphs:: @ 820F618 - .incbin "baserom.gba", 0x20F618, 0x8000 - -gFont4LatinGlyphWidths:: @ 8217618 - .incbin "baserom.gba", 0x217618, 0x200 - -gFont4JapaneseGlyphs:: @ 8217818 - .incbin "baserom.gba", 0x217818, 0x8000 - -gFont4JapaneseGlyphWidths:: @ 821F818 - .incbin "baserom.gba", 0x21F818, 0x118 - -gFont5LatinGlyphs:: @ 821F930 - .incbin "baserom.gba", 0x21F930, 0x8000 - -gFont5LatinGlyphWidths:: @ 8227930 - .incbin "baserom.gba", 0x227930, 0x200 - -gFont5JapaneseGlyphs:: @ 8227B30 - .incbin "baserom.gba", 0x227B30, 0x8000 - -gFont5JapaneseGlyphWidths:: @ 822FB30 - .incbin "baserom.gba", 0x22FB30, 0x118 - -gFont9JapaneseGlyphs:: @ 822FC48 - .incbin "baserom.gba", 0x22FC48, 0x2000 diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk new file mode 100644 index 000000000..876262eb2 --- /dev/null +++ b/graphics_file_rules.mk @@ -0,0 +1,34 @@ +FONTGFXDIR := data/graphics/fonts + +$(FONTGFXDIR)/font0_latin.latfont: $(FONTGFXDIR)/font0_latin.png + $(GFX) $< $@ + +$(FONTGFXDIR)/font0_jap.fwjpnfont: $(FONTGFXDIR)/font0_jap.png + $(GFX) $< $@ + +$(FONTGFXDIR)/font1_latin.latfont: $(FONTGFXDIR)/font1_latin.png + $(GFX) $< $@ + +$(FONTGFXDIR)/font1_jap.fwjpnfont: $(FONTGFXDIR)/font1_jap.png + $(GFX) $< $@ + +$(FONTGFXDIR)/font2_latin.latfont: $(FONTGFXDIR)/font2_latin.png + $(GFX) $< $@ + +$(FONTGFXDIR)/font2_jap.fwjpnfont: $(FONTGFXDIR)/font2_jap.png + $(GFX) $< $@ + +$(FONTGFXDIR)/font4_latin.latfont: $(FONTGFXDIR)/font4_latin.png + $(GFX) $< $@ + +$(FONTGFXDIR)/font4_jap.fwjpnfont: $(FONTGFXDIR)/font4_jap.png + $(GFX) $< $@ + +$(FONTGFXDIR)/font5_latin.latfont: $(FONTGFXDIR)/font5_latin.png + $(GFX) $< $@ + +$(FONTGFXDIR)/font5_jap.fwjpnfont: $(FONTGFXDIR)/font5_jap.png + $(GFX) $< $@ + +$(FONTGFXDIR)/font9_jap.fwjpnfont: $(FONTGFXDIR)/font9_jap.png + $(GFX) $< $@ diff --git a/include/text.h b/include/text.h index 81e1d03f2..61ab8cecd 100644 --- a/include/text.h +++ b/include/text.h @@ -244,5 +244,9 @@ u32 GetGlyphWidthFont2(u16 glyphId, bool32 isJapanese); void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese); u32 GetGlyphWidthFont1(u16 glyphId, bool32 isJapanese); void DecompressGlyphFont9(u16 glyphId); +u32 GetGlyphWidthFont3(u16 glyphId, bool32 isJapanese); +u32 GetGlyphWidthFont4(u16 glyphId, bool32 isJapanese); +u32 GetGlyphWidthFont5(u16 glyphId, bool32 isJapanese); +void sub_80062B0(struct Sprite *sprite); #endif // GUARD_TEXT_H diff --git a/ld_script.txt b/ld_script.txt index cbe8f3193..bc27ac048 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -363,7 +363,6 @@ SECTIONS { src/text_printer.o(.rodata); src/window.o(.rodata); src/text.o(.rodata); - data/text.o(.rodata); src/sprite.o(.rodata); src/bg_regs.o(.rodata); src/string_util.o(.rodata); diff --git a/src/text.c b/src/text.c index bc5fd7a66..bb2f62f04 100644 --- a/src/text.c +++ b/src/text.c @@ -4,9 +4,12 @@ #include "string_util.h" #include "window.h" #include "text.h" +#include "sprite.h" extern u8 gGlyphInfo[0x90]; extern u8 gUnknown_203ADFA; +extern u16 gUnknown_841F408[]; +extern const struct OamData gUnknown_83AC9D0; extern void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); extern void FillWindowPixelRect(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height); @@ -20,46 +23,358 @@ extern u8* UnkTextUtil_GetPtrI(u8 a1); TextFlags gTextFlags; -extern const u8 gDownArrowTiles[]; -extern const u8 gDarkDownArrowTiles[]; -extern const u8 gUnusedFRLGBlankedDownArrow[]; -extern const u8 gUnusedFRLGDownArrow[]; -extern const u8 gDownArrowYCoords[]; -extern const u8 gWindowVerticalScrollSpeeds[]; - -extern const struct GlyphWidthFunc gGlyphWidthFuncs[]; - -extern const struct KeypadIcon gKeypadIcons[]; - -extern const u8 gKeypadIconTiles[]; - -extern const struct FontInfo gFontInfos[]; - -extern const u8 gMenuCursorDimensions[][2]; - -extern const u16 gFont8LatinGlyphs[]; -extern const u8 gFont8LatinGlyphWidths[]; -extern const u16 gFont0LatinGlyphs[]; -extern const u8 gFont0LatinGlyphWidths[]; -extern const u16 gFont7LatinGlyphs[]; -extern const u8 gFont7LatinGlyphWidths[]; -extern const u16 gFont2LatinGlyphs[]; -extern const u8 gFont2LatinGlyphWidths[]; -extern const u16 gFont1LatinGlyphs[]; -extern const u8 gFont1LatinGlyphWidths[]; -extern const u16 gFont0JapaneseGlyphs[]; -extern const u16 gFont1JapaneseGlyphs[]; -extern const u16 gFont2JapaneseGlyphs[]; -extern const u8 gFont2JapaneseGlyphWidths[]; -extern const u16 gFont4JapaneseGlyphs[]; -extern const u8 gFont4JapaneseGlyphWidths[]; -extern const u16 gFont4LatinGlyphs[]; -extern const u8 gFont4LatinGlyphWidths[]; -extern const u16 gFont5JapaneseGlyphs[]; -extern const u8 gFont5JapaneseGlyphWidths[]; -extern const u16 gFont5LatinGlyphs[]; -extern const u8 gFont5LatinGlyphWidths[]; -extern const u16 gFont9JapaneseGlyphs[]; +const u8 gDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow.4bpp"); +const u8 gDarkDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_RS.4bpp"); +const u8 gTinyArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_2.4bpp"); +const u8 gTinyDarkDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_RS_2.4bpp"); +const u8 gDoubleArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_3.4bpp"); + +const u8 gDownArrowYCoords[] = { 0x0, 0x10, 0x20, 0x10 }; +const u8 gWindowVerticalScrollSpeeds[] = { 0x1, 0x2 , 0x4 , 0x0 }; + +const struct GlyphWidthFunc gGlyphWidthFuncs[] = { + { 0x0, GetGlyphWidthFont0 }, + { 0x1, GetGlyphWidthFont1 }, + { 0x2, GetGlyphWidthFont2 }, + { 0x3, GetGlyphWidthFont3 }, + { 0x4, GetGlyphWidthFont4 }, + { 0x5, GetGlyphWidthFont5 }, + { 0x6, GetGlyphWidthFont6 } +}; + +const struct SpriteSheet gUnknown_81EA68C[] = +{ + {gDoubleArrowTiles, 0x0080, 0x8000}, + {gDoubleArrowTiles + 0x80, 0x0080, 0x8000}, + {NULL} +}; + +const struct SpritePalette gUnknown_81EA6A4[] = +{ + {gUnknown_841F408, 0x8000}, + {NULL} +}; + +const struct SpriteTemplate gUnknown_81EA6B4 = +{ + .tileTag = 0x8000, + .paletteTag = 0x8000, + .oam = &gUnknown_83AC9D0, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80062B0, +}; + +const struct KeypadIcon gKeypadIcons[] = { + { 0x0, 0x8, 0xC }, + { 0x1, 0x8, 0xC }, + { 0x2, 0x10, 0xC }, + { 0x4, 0x10, 0xC }, + { 0x6, 0x18, 0xC }, + { 0x9, 0x18, 0xC }, + { 0xC, 0x8, 0xC }, + { 0xD, 0x8, 0xC }, + { 0xE, 0x8, 0xC }, + { 0xF, 0x8, 0xC }, + { 0x20, 0x8, 0xC }, + { 0x21, 0x8, 0xC }, + { 0x22, 0x8, 0xC }, +}; + +const u8 gKeypadIconTiles[] = INCBIN_U8("data/graphics/fonts/keypad_icons.4bpp"); + +// Font 0 +const u16 gFont0LatinGlyphs[] = INCBIN_U16("data/graphics/fonts/font0_latin.latfont"); +const u8 gFont0LatinGlyphWidths[] = +{ + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x05, 0x04, 0x04, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x04, 0x05, 0x04, 0x04, 0x05, 0x05, 0x05, 0x06, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x08, 0x07, 0x08, 0x05, 0x05, 0x05, 0x05, 0x05, 0x08, 0x08, 0x07, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x07, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x08, 0x08, 0x08, 0x08, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x07, 0x07, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x08, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x08, 0x05, 0x08, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x05, 0x05, 0x05, + 0x05, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x08, 0x07, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x05 +}; +const u16 gFont0JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font0_jap.fwjpnfont"); + +// Font 1 +const u16 gFont1LatinGlyphs[] = INCBIN_U16("data/graphics/fonts/font1_latin.latfont"); +const u8 gFont1LatinGlyphWidths[] = +{ + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x09, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0A, 0x08, 0x05, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x06, 0x08, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x03, 0x03, 0x06, + 0x06, 0x08, 0x05, 0x09, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x04, 0x06, 0x05, + 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x08, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06 +}; +const u16 gFont1JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font1_jap.fwjpnfont"); + +// Font 2 +const u16 gFont2LatinGlyphs[] = INCBIN_U16("data/graphics/fonts/font2_latin.latfont"); +const u8 gFont2LatinGlyphWidths[] = +{ + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x09, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0A, 0x08, 0x05, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x06, 0x08, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x03, 0x03, 0x06, + 0x06, 0x08, 0x05, 0x09, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x04, 0x06, 0x05, + 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x08, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06 +}; +const u16 gFont2JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font2_jap.fwjpnfont"); +const u8 gFont2JapaneseGlyphWidths[] = +{ + 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x05, 0x09, 0x0A, 0x0A, 0x0A, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x08, + 0x08, 0x08, 0x0A, 0x0A, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x02, 0x04, 0x06, + 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x00 +}; + +// Font 4 +const u16 gFont4LatinGlyphs[] = INCBIN_U16("data/graphics/fonts/font4_latin.latfont"); +const u8 gFont4LatinGlyphWidths[] = +{ + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x09, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0A, 0x08, 0x05, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x06, 0x08, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x03, 0x03, 0x06, + 0x06, 0x08, 0x05, 0x09, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x04, 0x06, 0x05, + 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x08, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06 +}; +const u16 gFont4JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font4_jap.fwjpnfont"); +const u8 gFont4JapaneseGlyphWidths[] = +{ + 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x05, 0x09, 0x0A, 0x0A, 0x0A, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x08, + 0x08, 0x08, 0x0A, 0x0A, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x02, 0x04, 0x06, + 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x00 +}; + +// Font 5 +const u16 gFont5LatinGlyphs[] = INCBIN_U16("data/graphics/fonts/font5_latin.latfont"); +const u8 gFont5LatinGlyphWidths[] = +{ + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x09, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0A, 0x08, 0x05, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x06, 0x08, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x03, 0x03, 0x06, + 0x06, 0x08, 0x05, 0x09, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x04, 0x06, 0x05, + 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x08, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06 +}; +const u16 gFont5JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font5_jap.fwjpnfont"); +const u8 gFont5JapaneseGlyphWidths[] = +{ + 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x05, 0x09, 0x0A, 0x0A, 0x0A, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x08, + 0x08, 0x08, 0x0A, 0x0A, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x02, 0x04, 0x06, + 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x00 +}; + +// Font 9 +const u16 gFont9JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font9_jap.fwjpnfont"); u16 Font0Func(struct TextPrinter *textPrinter) { @@ -989,7 +1304,7 @@ _08005CD0:\n\ ldrb r2, [r6, 0x1F]\n\ cmp r2, 0\n\ beq _08005D40\n\ - ldr r4, _08005D04 @ =gUnknown_81EA650\n\ + ldr r4, _08005D04 @ =gWindowVerticalScrollSpeeds\n\ ldr r5, _08005D08 @ =gSaveBlock2Ptr\n\ ldr r0, [r5]\n\ ldrb r0, [r0, 0x14]\n\ @@ -1011,7 +1326,7 @@ _08005CD0:\n\ strb r0, [r6, 0x1F]\n\ b _08005D36\n\ .align 2, 0\n\ -_08005D04: .4byte gUnknown_81EA650\n\ +_08005D04: .4byte gWindowVerticalScrollSpeeds\n\ _08005D08: .4byte gSaveBlock2Ptr\n\ _08005D0C:\n\ ldrb r0, [r6, 0x4]\n\ @@ -1446,53 +1761,40 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str) return 1; } -// TODO: What is this? -struct Unk80062B0 { - u8 filler0[0x26]; - u16 unk26; - u8 filler28[0x6]; - s16 unk2E; - s16 unk30; -}; - -void sub_80062B0(struct Unk80062B0 *unkStruct) +void sub_80062B0(struct Sprite *sprite) { - if(unkStruct->unk2E) + if(sprite->data[0]) { - unkStruct->unk2E--; + sprite->data[0]--; } else { - unkStruct->unk2E = 8; - switch(unkStruct->unk30) + sprite->data[0] = 8; + switch(sprite->data[1]) { case 0: - unkStruct->unk26 = 0; + sprite->pos2.y = 0; break; case 1: - unkStruct->unk26 = 1; + sprite->pos2.y = 1; break; case 2: - unkStruct->unk26 = 2; + sprite->pos2.y = 2; break; case 3: - unkStruct->unk26 = 1; - unkStruct->unk30 = 0; + sprite->pos2.y = 1; + sprite->data[1] = 0; return; } - unkStruct->unk30++; + sprite->data[1]++; } } -extern const struct SpriteSheet gUnknown_81EA68C[]; -extern const struct SpritePalette gUnknown_81EA6A4; -extern const struct SpriteTemplate gUnknown_81EA6B4; - u8 sub_8006300(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority) { u8 spriteId; LoadSpriteSheet(&gUnknown_81EA68C[sheetId & 1]); - LoadSpritePalette(&gUnknown_81EA6A4); + LoadSpritePalette(gUnknown_81EA6A4); spriteId = CreateSprite(&gUnknown_81EA6B4, x + 3, y + 4, subpriority); gSprites[spriteId].oam.priority = (priority & 3); gSprites[spriteId].oam.matrixNum = 0; -- cgit v1.2.3 From 77f8b38417393b8639912efbcc18f7ac610549c1 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 7 Oct 2018 01:01:45 -0400 Subject: address comments --- data/graphics/fonts/down_arrow_3.png | Bin 189 -> 159 bytes data/graphics/fonts/down_arrow_4.png | Bin 0 -> 160 bytes src/text.c | 91 ++++++++++++++++++----------------- 3 files changed, 46 insertions(+), 45 deletions(-) create mode 100644 data/graphics/fonts/down_arrow_4.png diff --git a/data/graphics/fonts/down_arrow_3.png b/data/graphics/fonts/down_arrow_3.png index 85a157564..6345eacfb 100644 Binary files a/data/graphics/fonts/down_arrow_3.png and b/data/graphics/fonts/down_arrow_3.png differ diff --git a/data/graphics/fonts/down_arrow_4.png b/data/graphics/fonts/down_arrow_4.png new file mode 100644 index 000000000..b6cba25f3 Binary files /dev/null and b/data/graphics/fonts/down_arrow_4.png differ diff --git a/src/text.c b/src/text.c index bb2f62f04..7fb0ab034 100644 --- a/src/text.c +++ b/src/text.c @@ -27,7 +27,8 @@ const u8 gDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow.4 const u8 gDarkDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_RS.4bpp"); const u8 gTinyArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_2.4bpp"); const u8 gTinyDarkDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_RS_2.4bpp"); -const u8 gDoubleArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_3.4bpp"); +const u8 gDoubleArrowTiles1[] = INCBIN_U8("data/graphics/fonts/down_arrow_3.4bpp"); +const u8 gDoubleArrowTiles2[] = INCBIN_U8("data/graphics/fonts/down_arrow_4.4bpp"); const u8 gDownArrowYCoords[] = { 0x0, 0x10, 0x20, 0x10 }; const u8 gWindowVerticalScrollSpeeds[] = { 0x1, 0x2 , 0x4 , 0x0 }; @@ -44,8 +45,8 @@ const struct GlyphWidthFunc gGlyphWidthFuncs[] = { const struct SpriteSheet gUnknown_81EA68C[] = { - {gDoubleArrowTiles, 0x0080, 0x8000}, - {gDoubleArrowTiles + 0x80, 0x0080, 0x8000}, + {gDoubleArrowTiles1, sizeof(gDoubleArrowTiles1), 0x8000}, + {gDoubleArrowTiles2, sizeof(gDoubleArrowTiles2), 0x8000}, {NULL} }; @@ -1849,8 +1850,8 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese) glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); - gGlyphInfo[0x80] = 8; // gGlyphWidth - gGlyphInfo[0x81] = 12; // gGlyphHeight + gGlyphInfo[0x80] = 8; + gGlyphInfo[0x81] = 12; } else { @@ -1879,9 +1880,9 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese) int eff; glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FD0 - gGlyphInfo[0x80] = 8; // gGlyphWidth - gGlyphInfo[0x81] = 16; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + gGlyphInfo[0x80] = 8; + gGlyphInfo[0x81] = 16; } else { @@ -1923,18 +1924,18 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese) gGlyphInfo[0x81] = 12; } } - else // _080065F8 + else { glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth - gGlyphInfo[0x81] = 12; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont2JapaneseGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 12; } } - else // _0800665C + else { if(glyphId == 0) { @@ -1948,7 +1949,7 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese) gGlyphInfo[0x81] = 14; } } - else // _0800669C + else { glyphs = gFont2LatinGlyphs + (0x20 * glyphId); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); @@ -2000,11 +2001,11 @@ void DecompressGlyphFont3(u16 glyphId, bool32 isJapanese) { glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = 10; // gGlyphWidth - gGlyphInfo[0x81] = 12; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = 10; + gGlyphInfo[0x81] = 12; } } else @@ -2039,15 +2040,15 @@ void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese) gGlyphInfo[0x81] = 12; } } - else // _0800682C + else { glyphs = gFont4JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = gFont4JapaneseGlyphWidths[glyphId]; // gGlyphWidth - gGlyphInfo[0x81] = 12; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont4JapaneseGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 12; } } else @@ -2064,15 +2065,15 @@ void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese) gGlyphInfo[0x81] = 14; } } - else // _080068D0 + else { glyphs = gFont4LatinGlyphs + (0x20 * glyphId); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = gFont4LatinGlyphWidths[glyphId]; // gGlyphWidth - gGlyphInfo[0x81] = 14; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont4LatinGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 14; } } } @@ -2110,15 +2111,15 @@ void DecompressGlyphFont5(u16 glyphId, bool32 isJapanese) gGlyphInfo[0x81] = 12; } } - else // _08006998 + else { glyphs = gFont5JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = gFont5JapaneseGlyphWidths[glyphId]; // gGlyphWidth - gGlyphInfo[0x81] = 12; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont5JapaneseGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 12; } } else @@ -2139,11 +2140,11 @@ void DecompressGlyphFont5(u16 glyphId, bool32 isJapanese) { glyphs = gFont5LatinGlyphs + (0x20 * glyphId); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = gFont5LatinGlyphWidths[glyphId]; // gGlyphWidth - gGlyphInfo[0x81] = 14; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont5LatinGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 14; } } } @@ -2165,7 +2166,7 @@ void DecompressGlyphFont9(u16 glyphId) { const u16* glyphs = gFont9JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); gGlyphInfo[0x80] = 8; gGlyphInfo[0x81] = 12; } -- cgit v1.2.3 From 7040e8e9568a21ef8417c7de6e47fd636dcd7865 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 12:10:33 -0400 Subject: sub_8146C30 --- asm/menews_jisan.s | 47 ---------------------------------- include/global.h | 21 +++++++++++++++- include/mevent.h | 6 +++++ ld_script.txt | 1 + src/menews_jisan.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 101 insertions(+), 48 deletions(-) create mode 100644 include/mevent.h create mode 100644 src/menews_jisan.c diff --git a/asm/menews_jisan.s b/asm/menews_jisan.s index abd5e44f4..160d0e4c8 100644 --- a/asm/menews_jisan.s +++ b/asm/menews_jisan.s @@ -5,53 +5,6 @@ .text - thumb_func_start sub_8146C30 -sub_8146C30: @ 8146C30 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_8143D94 - adds r5, r0, 0 - movs r0, 0x3 - adds r1, r4, 0 - ands r1, r0 - ldrb r2, [r5] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5] - cmp r4, 0x2 - bhi _08146C56 - cmp r4, 0x1 - bcs _08146C5C - b _08146C80 -_08146C56: - cmp r4, 0x3 - beq _08146C6E - b _08146C80 -_08146C5C: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xF - bl __umodsi3 - adds r0, 0x10 - b _08146C7E -_08146C6E: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xF - bl __umodsi3 - adds r0, 0x1 -_08146C7E: - strb r0, [r5, 0x1] -_08146C80: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8146C30 - thumb_func_start sub_8146C88 sub_8146C88: @ 8146C88 push {lr} diff --git a/include/global.h b/include/global.h index 75911b9f2..2b35e303d 100644 --- a/include/global.h +++ b/include/global.h @@ -466,6 +466,14 @@ struct RecordMixingDayCareMail bool16 holdsItem[DAYCARE_MON_COUNT]; }; +struct MysteryEventStruct +{ + u8 unk_0_0:2; + u8 unk_0_2:6; + u8 unk_1; + u8 filler_2[0x1ba]; +}; + #define MAP_OBJECTS_COUNT 16 #define BERRY_TREES_COUNT 128 #define FLAGS_COUNT 300 @@ -476,7 +484,18 @@ struct SaveBlock1 { /*0x0000*/ u8 filler[0x4]; /*0x0004*/ struct WarpData location; - /*0x000C*/ u8 fillerC[0x3610]; + /*0x0C*/ struct WarpData warp1; + /*0x14*/ struct WarpData warp2; + /*0x1C*/ struct WarpData lastHealLocation; + /*0x24*/ struct WarpData warp4; + /*0x002C*/ u8 filler2C[0x60C]; + /*0x638*/ u8 trainerRematchStepCounter; + u8 filler_639; + /*0x63a*/ u8 trainerRematches[100]; + /*0x06A0*/ struct MapObject mapObjects[MAP_OBJECTS_COUNT]; + /*0x08E0*/ struct MapObjectTemplate mapObjectTemplates[64]; + /*0x0EE0*/ u8 fillerEE0[0x2580]; + /*0x3460*/ struct MysteryEventStruct unk_3460; /*0x361C*/ struct RamScript ramScript; /*0x3A08*/ u8 filler3A08[0x44]; /*0x3A4C*/ u8 rivalName[PLAYER_NAME_LENGTH]; diff --git a/include/mevent.h b/include/mevent.h new file mode 100644 index 000000000..b196d655b --- /dev/null +++ b/include/mevent.h @@ -0,0 +1,6 @@ +#ifndef GUARD_MEVENT_H +#define GUARD_MEVENT_H + +struct MysteryEventStruct * sub_8143D94(void); + +#endif //GUARD_MEVENT_H diff --git a/ld_script.txt b/ld_script.txt index bc27ac048..777735b7c 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -249,6 +249,7 @@ SECTIONS { asm/mevent.o(.text); asm/mevent_server.o(.text); asm/mevent_8145654.o(.text); + src/menews_jisan.o(.text); asm/menews_jisan.o(.text); asm/seagallop.o(.text); asm/unk_8147500.o(.text); diff --git a/src/menews_jisan.c b/src/menews_jisan.c new file mode 100644 index 000000000..afaef7cf9 --- /dev/null +++ b/src/menews_jisan.c @@ -0,0 +1,74 @@ +#include "global.h" +#include "mevent.h" +#include "random.h" + +#ifdef NONMATCHING +void sub_8146C30(u32 a0) +{ + struct MysteryEventStruct *r5 = sub_8143D94(); + + r5->unk_0_0 = a0; + asm_comment("The switch logic does not match. Specifically, the \"bhi\" is replaced with a \"bls\" and the comparisons with 1 and 3 are swapped chronologically."); + switch (a0) + { + case 0: + r5->unk_1 = (Random() % 15) + 16; + break; + case 1: + break; + case 2: + break; + case 3: + r5->unk_1 = (Random() % 15) + 1; + break; + } +} +#else +NAKED +void sub_8146C30(u32 a0) +{ + asm_unified("\tpush {r4,r5,lr}\n" + "\tadds r4, r0, 0\n" + "\tbl sub_8143D94\n" + "\tadds r5, r0, 0\n" + "\tmovs r0, 0x3\n" + "\tadds r1, r4, 0\n" + "\tands r1, r0\n" + "\tldrb r2, [r5]\n" + "\tmovs r0, 0x4\n" + "\tnegs r0, r0\n" + "\tands r0, r2\n" + "\torrs r0, r1\n" + "\tstrb r0, [r5]\n" + "\tcmp r4, 0x2\n" + "\tbhi _08146C56\n" + "\tcmp r4, 0x1\n" + "\tbcs _08146C5C\n" + "\tb _08146C80\n" + "_08146C56:\n" + "\tcmp r4, 0x3\n" + "\tbeq _08146C6E\n" + "\tb _08146C80\n" + "_08146C5C:\n" + "\tbl Random\n" + "\tlsls r0, 16\n" + "\tlsrs r0, 16\n" + "\tmovs r1, 0xF\n" + "\tbl __umodsi3\n" + "\tadds r0, 0x10\n" + "\tb _08146C7E\n" + "_08146C6E:\n" + "\tbl Random\n" + "\tlsls r0, 16\n" + "\tlsrs r0, 16\n" + "\tmovs r1, 0xF\n" + "\tbl __umodsi3\n" + "\tadds r0, 0x1\n" + "_08146C7E:\n" + "\tstrb r0, [r5, 0x1]\n" + "_08146C80:\n" + "\tpop {r4,r5}\n" + "\tpop {r0}\n" + "\tbx r0"); +} +#endif -- cgit v1.2.3 From 4dd5029fdc505636d8ac00add5425bb22fd082ba Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 14:24:44 -0400 Subject: sub_8146CA4 --- asm/menews_jisan.s | 50 -------------------------------------------------- include/event_data.h | 1 + include/global.h | 10 ++++++---- src/menews_jisan.c | 25 +++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 54 deletions(-) diff --git a/asm/menews_jisan.s b/asm/menews_jisan.s index 160d0e4c8..4661c1a50 100644 --- a/asm/menews_jisan.s +++ b/asm/menews_jisan.s @@ -5,56 +5,6 @@ .text - thumb_func_start sub_8146C88 -sub_8146C88: @ 8146C88 - push {lr} - bl sub_8143D94 - movs r1, 0 - strb r1, [r0] - strb r1, [r0, 0x1] - ldr r0, _08146CA0 @ =0x00004028 - bl VarSet - pop {r0} - bx r0 - .align 2, 0 -_08146CA0: .4byte 0x00004028 - thumb_func_end sub_8146C88 - - thumb_func_start sub_8146CA4 -sub_8146CA4: @ 8146CA4 - push {r4,lr} - ldr r0, _08146CE0 @ =0x00004028 - bl sub_806E454 - adds r4, r0, 0 - bl sub_8143D94 - adds r2, r0, 0 - ldr r0, [r2] - lsls r0, 24 - lsrs r0, 29 - cmp r0, 0x4 - bls _08146CD8 - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - lsls r0, 16 - ldr r1, _08146CE4 @ =0x01f30000 - cmp r0, r1 - bls _08146CD8 - ldrb r0, [r2] - movs r1, 0x1F - ands r1, r0 - strb r1, [r2] - movs r0, 0 - strh r0, [r4] -_08146CD8: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08146CE0: .4byte 0x00004028 -_08146CE4: .4byte 0x01f30000 - thumb_func_end sub_8146CA4 - thumb_func_start sub_8146CE8 sub_8146CE8: @ 8146CE8 push {r4-r6,lr} diff --git a/include/event_data.h b/include/event_data.h index f829d3b87..a5c9efe0d 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -29,6 +29,7 @@ u8 *GetFlagPointer(u16 id); u8 FlagSet(u16 id); u8 FlagClear(u16 id); bool8 FlagGet(u16 id); +u16 * sub_806E454(u16 id); extern u16 gSpecialVar_0x8000; extern u16 gSpecialVar_0x8001; diff --git a/include/global.h b/include/global.h index 2b35e303d..5a7cc134d 100644 --- a/include/global.h +++ b/include/global.h @@ -468,10 +468,11 @@ struct RecordMixingDayCareMail struct MysteryEventStruct { - u8 unk_0_0:2; - u8 unk_0_2:6; - u8 unk_1; - u8 filler_2[0x1ba]; + u32 unk_0_0:2; + u32 unk_0_2:3; + u32 unk_0_5:3; + u32 unk_1:8; + u32 unk_2:16; }; #define MAP_OBJECTS_COUNT 16 @@ -496,6 +497,7 @@ struct SaveBlock1 /*0x08E0*/ struct MapObjectTemplate mapObjectTemplates[64]; /*0x0EE0*/ u8 fillerEE0[0x2580]; /*0x3460*/ struct MysteryEventStruct unk_3460; + /*0x3464*/ u8 filler_3464[0x1b8]; /*0x361C*/ struct RamScript ramScript; /*0x3A08*/ u8 filler3A08[0x44]; /*0x3A4C*/ u8 rivalName[PLAYER_NAME_LENGTH]; diff --git a/src/menews_jisan.c b/src/menews_jisan.c index afaef7cf9..6e9be8318 100644 --- a/src/menews_jisan.c +++ b/src/menews_jisan.c @@ -1,6 +1,7 @@ #include "global.h" #include "mevent.h" #include "random.h" +#include "event_data.h" #ifdef NONMATCHING void sub_8146C30(u32 a0) @@ -72,3 +73,27 @@ void sub_8146C30(u32 a0) "\tbx r0"); } #endif + +void sub_8146C88(void) +{ + struct MysteryEventStruct *r5 = sub_8143D94(); + + r5->unk_0_0 = 0; + r5->unk_0_2 = 0; + r5->unk_0_5 = 0; + r5->unk_1 = 0; + VarSet(0x4028, 0); +} + +void sub_8146CA4(void) +{ + u16 *r4 = sub_806E454(0x4028); + struct MysteryEventStruct *r5 = sub_8143D94(); + struct MysteryEventStruct r0 = *r5; + + if ((u8)r0.unk_0_5 > 4 && ++(*r4) > 0x1f3) + { + r5->unk_0_5 = 0; + *r4 = 0; + } +} -- cgit v1.2.3 From 6b27e999f242f51a81bef70c40a378d5adbaf9e2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 14:40:46 -0400 Subject: through sub_8146D94 --- asm/menews_jisan.s | 95 ---------------------------------------------------- include/event_data.h | 1 + include/mevent.h | 1 + src/menews_jisan.c | 68 +++++++++++++++++++++++++++++++++++-- 4 files changed, 67 insertions(+), 98 deletions(-) diff --git a/asm/menews_jisan.s b/asm/menews_jisan.s index 4661c1a50..155ea3f28 100644 --- a/asm/menews_jisan.s +++ b/asm/menews_jisan.s @@ -5,101 +5,6 @@ .text - thumb_func_start sub_8146CE8 -sub_8146CE8: @ 8146CE8 - push {r4-r6,lr} - ldr r6, _08146D08 @ =gUnknown_20370D0 - bl sub_8143D94 - adds r4, r0, 0 - bl sub_806E2BC - cmp r0, 0 - beq _08146D02 - bl sub_8143E1C - cmp r0, 0 - bne _08146D0C -_08146D02: - movs r0, 0 - b _08146D6E - .align 2, 0 -_08146D08: .4byte gUnknown_20370D0 -_08146D0C: - adds r0, r4, 0 - bl sub_8146E0C - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x6 - bhi _08146D6C - lsls r0, r5, 2 - ldr r1, _08146D24 @ =_08146D28 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08146D24: .4byte _08146D28 - .align 2, 0 -_08146D28: - .4byte _08146D6C - .4byte _08146D44 - .4byte _08146D44 - .4byte _08146D6C - .4byte _08146D4E - .4byte _08146D5E - .4byte _08146D6C -_08146D44: - adds r0, r4, 0 - bl sub_8146D74 - strh r0, [r6] - b _08146D6C -_08146D4E: - adds r0, r4, 0 - bl sub_8146D74 - strh r0, [r6] - adds r0, r4, 0 - bl sub_8146DA0 - b _08146D6C -_08146D5E: - adds r0, r4, 0 - bl sub_8146D74 - strh r0, [r6] - adds r0, r4, 0 - bl sub_8146D94 -_08146D6C: - adds r0, r5, 0 -_08146D6E: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8146CE8 - - thumb_func_start sub_8146D74 -sub_8146D74: @ 8146D74 - push {r4,lr} - ldrb r2, [r0] - movs r1, 0x4 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldrb r4, [r0, 0x1] - adds r4, 0x84 - movs r1, 0 - strb r1, [r0, 0x1] - bl sub_8146DD8 - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8146D74 - - thumb_func_start sub_8146D94 -sub_8146D94: @ 8146D94 - ldrb r2, [r0] - movs r1, 0x1D - negs r1, r1 - ands r1, r2 - strb r1, [r0] - bx lr - thumb_func_end sub_8146D94 - thumb_func_start sub_8146DA0 sub_8146DA0: @ 8146DA0 push {r4,lr} diff --git a/include/event_data.h b/include/event_data.h index a5c9efe0d..914217588 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -30,6 +30,7 @@ u8 FlagSet(u16 id); u8 FlagClear(u16 id); bool8 FlagGet(u16 id); u16 * sub_806E454(u16 id); +bool32 sub_806E2BC(void); extern u16 gSpecialVar_0x8000; extern u16 gSpecialVar_0x8001; diff --git a/include/mevent.h b/include/mevent.h index b196d655b..a611a98a8 100644 --- a/include/mevent.h +++ b/include/mevent.h @@ -2,5 +2,6 @@ #define GUARD_MEVENT_H struct MysteryEventStruct * sub_8143D94(void); +bool32 sub_8143E1C(void); #endif //GUARD_MEVENT_H diff --git a/src/menews_jisan.c b/src/menews_jisan.c index 6e9be8318..93f98ab7a 100644 --- a/src/menews_jisan.c +++ b/src/menews_jisan.c @@ -3,6 +3,14 @@ #include "random.h" #include "event_data.h" +extern EWRAM_DATA u16 gUnknown_20370D0; + +u32 sub_8146D74(struct MysteryEventStruct *); +void sub_8146DD8(struct MysteryEventStruct *); +u16 sub_8146E0C(struct MysteryEventStruct *); +void sub_8146DA0(struct MysteryEventStruct *); +void sub_8146D94(struct MysteryEventStruct *); + #ifdef NONMATCHING void sub_8146C30(u32 a0) { @@ -88,12 +96,66 @@ void sub_8146C88(void) void sub_8146CA4(void) { u16 *r4 = sub_806E454(0x4028); - struct MysteryEventStruct *r5 = sub_8143D94(); - struct MysteryEventStruct r0 = *r5; + struct MysteryEventStruct *r2 = sub_8143D94(); + struct MysteryEventStruct r0 = *r2; if ((u8)r0.unk_0_5 > 4 && ++(*r4) > 0x1f3) { - r5->unk_0_5 = 0; + r2->unk_0_5 = 0; *r4 = 0; } } + +u16 sub_8146CE8(void) +{ + u16 *r6 = &gUnknown_20370D0; + struct MysteryEventStruct *r4 = sub_8143D94(); + u16 r5; + + if (!sub_806E2BC() || !sub_8143E1C()) + return 0; + + r5 = sub_8146E0C(r4); + + switch (r5) + { + case 0: + break; + case 1: + *r6 = sub_8146D74(r4); + break; + case 2: + *r6 = sub_8146D74(r4); + break; + case 3: + break; + case 4: + *r6 = sub_8146D74(r4); + sub_8146DA0(r4); + break; + case 5: + *r6 = sub_8146D74(r4); + sub_8146D94(r4); + break; + case 6: + break; + } + + return r5; +} + +u32 sub_8146D74(struct MysteryEventStruct *a0) +{ + u32 r4; + + a0->unk_0_0 = 0; + r4 = a0->unk_1 + 0x84; + a0->unk_1 = 0; + sub_8146DD8(a0); + return r4; +} + +void sub_8146D94(struct MysteryEventStruct *a0) +{ + a0->unk_0_2 = 0; +} -- cgit v1.2.3 From d348c44eb66a30d50a742d900760826a863c5759 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 14:58:51 -0400 Subject: Finish decompile of menews_jisan.s --- asm/menews_jisan.s | 134 ---------------------------------------------------- data/data_84827AC.s | 8 +--- include/global.h | 9 ++-- ld_script.txt | 3 +- src/menews_jisan.c | 41 +++++++++++++++- 5 files changed, 47 insertions(+), 148 deletions(-) delete mode 100644 asm/menews_jisan.s diff --git a/asm/menews_jisan.s b/asm/menews_jisan.s deleted file mode 100644 index 155ea3f28..000000000 --- a/asm/menews_jisan.s +++ /dev/null @@ -1,134 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8146DA0 -sub_8146DA0: @ 8146DA0 - push {r4,lr} - adds r3, r0, 0 - ldr r0, [r3] - lsls r0, 27 - lsrs r0, 29 - adds r0, 0x1 - movs r1, 0x7 - ands r0, r1 - lsls r0, 2 - ldrb r1, [r3] - movs r4, 0x1D - negs r4, r4 - adds r2, r4, 0 - ands r2, r1 - orrs r2, r0 - strb r2, [r3] - ldr r0, [r3] - lsls r0, 27 - lsrs r0, 29 - cmp r0, 0x4 - bls _08146DD2 - ands r2, r4 - movs r0, 0x10 - orrs r2, r0 - strb r2, [r3] -_08146DD2: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8146DA0 - - thumb_func_start sub_8146DD8 -sub_8146DD8: @ 8146DD8 - push {r4,lr} - adds r3, r0, 0 - ldr r0, [r3] - lsls r0, 24 - lsrs r0, 29 - adds r0, 0x1 - lsls r0, 5 - ldrb r1, [r3] - movs r4, 0x1F - adds r2, r4, 0 - ands r2, r1 - orrs r2, r0 - strb r2, [r3] - ldr r0, [r3] - lsls r0, 24 - lsrs r0, 29 - cmp r0, 0x5 - bls _08146E04 - ands r2, r4 - movs r0, 0xA0 - orrs r2, r0 - strb r2, [r3] -_08146E04: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8146DD8 - - thumb_func_start sub_8146E0C -sub_8146E0C: @ 8146E0C - push {lr} - adds r2, r0, 0 - ldrb r1, [r2] - movs r0, 0xE0 - ands r0, r1 - cmp r0, 0xA0 - bne _08146E1E - movs r0, 0x6 - b _08146E66 -_08146E1E: - ldr r1, [r2] - lsls r0, r1, 30 - lsrs r0, 30 - cmp r0, 0x1 - beq _08146E40 - cmp r0, 0x1 - bgt _08146E32 - cmp r0, 0 - beq _08146E3C - b _08146E58 -_08146E32: - cmp r0, 0x2 - beq _08146E44 - cmp r0, 0x3 - beq _08146E48 - b _08146E58 -_08146E3C: - movs r0, 0x3 - b _08146E66 -_08146E40: - movs r0, 0x1 - b _08146E66 -_08146E44: - movs r0, 0x2 - b _08146E66 -_08146E48: - lsls r0, r1, 27 - lsrs r0, 29 - cmp r0, 0x2 - bhi _08146E54 - movs r0, 0x4 - b _08146E66 -_08146E54: - movs r0, 0x5 - b _08146E66 -_08146E58: - ldr r0, _08146E6C @ =gUnknown_8468C5C "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/menews_jisan.c" - ldr r1, _08146E70 @ =0x0000017f - ldr r2, _08146E74 @ =gUnknown_8468C94 "0" - movs r3, 0x1 - bl AGBAssert - movs r0, 0 -_08146E66: - pop {r1} - bx r1 - .align 2, 0 -_08146E6C: .4byte gUnknown_8468C5C -_08146E70: .4byte 0x0000017f -_08146E74: .4byte gUnknown_8468C94 - thumb_func_end sub_8146E0C - - .align 2, 0 @ Don't pad with nop. diff --git a/data/data_84827AC.s b/data/data_84827AC.s index 2c69a76d7..565a6adf2 100644 --- a/data/data_84827AC.s +++ b/data/data_84827AC.s @@ -5014,13 +5014,7 @@ gUnknown_8468B6C:: @ 8468B6C gUnknown_8468BCC:: @ 8468BCC .incbin "baserom.gba", 0x468BCC, 0x90 - .align 2 -gUnknown_8468C5C:: @ 8468C5C - .asciz "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/menews_jisan.c" - - .align 2 -gUnknown_8468C94:: @ 8468C94 - .asciz "0" + .section .rodata.8468C98 .align 2 gUnknown_8468C98:: @ 8468C98 diff --git a/include/global.h b/include/global.h index 5a7cc134d..11a79ebe8 100644 --- a/include/global.h +++ b/include/global.h @@ -468,11 +468,10 @@ struct RecordMixingDayCareMail struct MysteryEventStruct { - u32 unk_0_0:2; - u32 unk_0_2:3; - u32 unk_0_5:3; - u32 unk_1:8; - u32 unk_2:16; + u8 unk_0_0:2; + u8 unk_0_2:3; + u8 unk_0_5:3; + u8 unk_1; }; #define MAP_OBJECTS_COUNT 16 diff --git a/ld_script.txt b/ld_script.txt index 777735b7c..70084ef0e 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -250,7 +250,6 @@ SECTIONS { asm/mevent_server.o(.text); asm/mevent_8145654.o(.text); src/menews_jisan.o(.text); - asm/menews_jisan.o(.text); asm/seagallop.o(.text); asm/unk_8147500.o(.text); asm/unk_8147AA8.o(.text); @@ -370,6 +369,8 @@ SECTIONS { data/data.o(.rodata); src/battle_ai_script_commands.o(.rodata); data/data_84827AC.o(.rodata); + src/menews_jisan.o(.rodata); + data/data_84827AC.o(.rodata.8468C98); src/m4a_tables.o(.rodata); data/sound_data.o(.rodata); } =0 diff --git a/src/menews_jisan.c b/src/menews_jisan.c index 93f98ab7a..6c3f669eb 100644 --- a/src/menews_jisan.c +++ b/src/menews_jisan.c @@ -7,7 +7,7 @@ extern EWRAM_DATA u16 gUnknown_20370D0; u32 sub_8146D74(struct MysteryEventStruct *); void sub_8146DD8(struct MysteryEventStruct *); -u16 sub_8146E0C(struct MysteryEventStruct *); +u32 sub_8146E0C(struct MysteryEventStruct *); void sub_8146DA0(struct MysteryEventStruct *); void sub_8146D94(struct MysteryEventStruct *); @@ -159,3 +159,42 @@ void sub_8146D94(struct MysteryEventStruct *a0) { a0->unk_0_2 = 0; } + +void sub_8146DA0(struct MysteryEventStruct *a0) +{ + a0->unk_0_2++; + if ((u8)a0->unk_0_2 > 4) + a0->unk_0_2 = 4; +} + +void sub_8146DD8(struct MysteryEventStruct *a0) +{ + a0->unk_0_5++; + if ((u8)a0->unk_0_5 > 5) + a0->unk_0_5 = 5; +} + +u32 sub_8146E0C(struct MysteryEventStruct *a0) +{ + struct MysteryEventStruct r0; + if ((u8)a0->unk_0_5 == 5) + return 6; + + r0 = *a0; + switch (r0.unk_0_0) + { + case 0: + return 3; + case 1: + return 1; + case 2: + return 2; + case 3: + if ((u8)r0.unk_0_2 < 3) + return 4; + return 5; + default: + AGBAssert("C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/menews_jisan.c", 383, "0", 1); + return 0; + } +} -- cgit v1.2.3 From eda4a9f9406aa2ef3fe91006e134f44b07035081 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 14:59:48 -0400 Subject: Use the macro ya dummy --- src/menews_jisan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menews_jisan.c b/src/menews_jisan.c index 6c3f669eb..dd1376c26 100644 --- a/src/menews_jisan.c +++ b/src/menews_jisan.c @@ -194,7 +194,7 @@ u32 sub_8146E0C(struct MysteryEventStruct *a0) return 4; return 5; default: - AGBAssert("C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/menews_jisan.c", 383, "0", 1); + AGB_ASSERT_EX(0, "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/menews_jisan.c", 383); return 0; } } -- cgit v1.2.3 From 1d50bcb0b95e52fb43c22a3348ac033b3534f860 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 16:02:11 -0400 Subject: Cleanup and create menews_jisan header --- include/event_data.h | 2 ++ include/gba/defines.h | 1 + include/menews_jisan.h | 8 ++++++++ src/menews_jisan.c | 23 +++++++++++------------ 4 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 include/menews_jisan.h diff --git a/include/event_data.h b/include/event_data.h index 914217588..f28ed4f75 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -51,4 +51,6 @@ extern u16 gSpecialVar_MonBoxId; extern u16 gSpecialVar_MonBoxPos; extern u16 gSpecialVar_0x8014; +extern u16 gUnknown_20370D0; + #endif // GUARD_EVENT_DATA_H diff --git a/include/gba/defines.h b/include/gba/defines.h index fe81770e3..a0ef506dd 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -69,5 +69,6 @@ #define WIN_RANGE(a, b) (((a) << 8) | (b)) #define NAKED __attribute__((naked)) +#define UNUSED __attribute__((unused)) #endif // GUARD_GBA_DEFINES diff --git a/include/menews_jisan.h b/include/menews_jisan.h new file mode 100644 index 000000000..8dc1d0a99 --- /dev/null +++ b/include/menews_jisan.h @@ -0,0 +1,8 @@ +#ifndef GUARD_MENEWS_JISAN_H +#define GUARD_MENEWS_JISAN_H + +void sub_8146C30(u32 a0); +void sub_8146C88(void); +void sub_8146CA4(void); + +#endif //GUARD_MENEWS_JISAN_H diff --git a/src/menews_jisan.c b/src/menews_jisan.c index dd1376c26..7dfcee939 100644 --- a/src/menews_jisan.c +++ b/src/menews_jisan.c @@ -2,14 +2,13 @@ #include "mevent.h" #include "random.h" #include "event_data.h" +#include "menews_jisan.h" -extern EWRAM_DATA u16 gUnknown_20370D0; - -u32 sub_8146D74(struct MysteryEventStruct *); -void sub_8146DD8(struct MysteryEventStruct *); -u32 sub_8146E0C(struct MysteryEventStruct *); -void sub_8146DA0(struct MysteryEventStruct *); -void sub_8146D94(struct MysteryEventStruct *); +static u32 sub_8146D74(struct MysteryEventStruct *); +static void sub_8146DD8(struct MysteryEventStruct *); +static u32 sub_8146E0C(struct MysteryEventStruct *); +static void sub_8146DA0(struct MysteryEventStruct *); +static void sub_8146D94(struct MysteryEventStruct *); #ifdef NONMATCHING void sub_8146C30(u32 a0) @@ -144,7 +143,7 @@ u16 sub_8146CE8(void) return r5; } -u32 sub_8146D74(struct MysteryEventStruct *a0) +static u32 sub_8146D74(struct MysteryEventStruct *a0) { u32 r4; @@ -155,26 +154,26 @@ u32 sub_8146D74(struct MysteryEventStruct *a0) return r4; } -void sub_8146D94(struct MysteryEventStruct *a0) +static void sub_8146D94(struct MysteryEventStruct *a0) { a0->unk_0_2 = 0; } -void sub_8146DA0(struct MysteryEventStruct *a0) +static void sub_8146DA0(struct MysteryEventStruct *a0) { a0->unk_0_2++; if ((u8)a0->unk_0_2 > 4) a0->unk_0_2 = 4; } -void sub_8146DD8(struct MysteryEventStruct *a0) +static void sub_8146DD8(struct MysteryEventStruct *a0) { a0->unk_0_5++; if ((u8)a0->unk_0_5 > 5) a0->unk_0_5 = 5; } -u32 sub_8146E0C(struct MysteryEventStruct *a0) +static u32 sub_8146E0C(struct MysteryEventStruct *a0) { struct MysteryEventStruct r0; if ((u8)a0->unk_0_5 == 5) -- cgit v1.2.3