From 24009ea941abb81068745926ca9960acf927dd4e Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 24 Nov 2017 19:49:03 -0500 Subject: [PATCH] through Cb2_StartWallClock and associated data --- asm/wallclock.s | 183 --------------------------------------------- data/wallclock.s | 15 ---- include/graphics.h | 1 + include/strings.h | 1 + src/wallclock.c | 134 ++++++++++++++++++++++++++++++++- 5 files changed, 135 insertions(+), 199 deletions(-) diff --git a/asm/wallclock.s b/asm/wallclock.s index da8e01f2e..0ca39b897 100644 --- a/asm/wallclock.s +++ b/asm/wallclock.s @@ -5,189 +5,6 @@ .text - thumb_func_start sub_813498C -sub_813498C: @ 813498C - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r0, 0x1 - bl EnableInterrupts - ldr r0, =sub_81347B4 - bl SetVBlankCallback - ldr r0, =sub_8134C9C - bl SetMainCallback2 - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_813498C - - thumb_func_start Cb2_StartWallClock -Cb2_StartWallClock: @ 81349F4 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - sub sp, 0xC - bl LoadWallClockGraphics - ldr r0, =gUnknown_08DCC648 - ldr r1, =0x06003800 - bl LZ77UnCompVram - ldr r0, =sub_8134CB8 - movs r1, 0 - bl CreateTask - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - mov r8, r1 - movs r1, 0xA - strh r1, [r0, 0xC] - mov r2, r8 - strh r2, [r0, 0xE] - strh r2, [r0, 0x10] - strh r2, [r0, 0x12] - strh r2, [r0, 0x14] - strh r2, [r0, 0x8] - movs r1, 0x96 - lsls r1, 1 - strh r1, [r0, 0xA] - ldr r0, =gUnknown_085B2250 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - mov r9, r1 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - add r1, r9 - strh r6, [r1, 0x2E] - ldrb r2, [r1, 0x1] - movs r5, 0x4 - negs r5, r5 - adds r0, r5, 0 - ands r0, r2 - movs r2, 0x1 - mov r10, r2 - mov r2, r10 - orrs r0, r2 - strb r0, [r1, 0x1] - ldrb r2, [r1, 0x3] - movs r4, 0x3F - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x3] - ldr r0, =gUnknown_085B2268 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - add r1, r9 - strh r6, [r1, 0x2E] - ldrb r0, [r1, 0x1] - ands r5, r0 - mov r0, r10 - orrs r5, r0 - strb r5, [r1, 0x1] - ldrb r0, [r1, 0x3] - ands r4, r0 - movs r0, 0x2 - orrs r4, r0 - strb r4, [r1, 0x3] - ldr r0, =gUnknown_085B22A0 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - add r1, r9 - strh r6, [r1, 0x2E] - movs r0, 0x2D - strh r0, [r1, 0x30] - ldr r0, =gUnknown_085B22B8 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - add r1, r9 - strh r6, [r1, 0x2E] - movs r0, 0x5A - strh r0, [r1, 0x30] - bl sub_813498C - ldr r2, =gText_Confirm3 - movs r0, 0x1 - str r0, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end Cb2_StartWallClock - thumb_func_start Cb2_ViewWallClock Cb2_ViewWallClock: @ 8134B44 push {r4-r7,lr} diff --git a/data/wallclock.s b/data/wallclock.s index 1faafff63..95f156847 100644 --- a/data/wallclock.s +++ b/data/wallclock.s @@ -5,20 +5,5 @@ .section .rodata -gUnknown_085B2230:: @ 85B2230 - .incbin "baserom.gba", 0x5b2230, 0x20 - -gUnknown_085B2250:: @ 85B2250 - .incbin "baserom.gba", 0x5b2250, 0x18 - -gUnknown_085B2268:: @ 85B2268 - .incbin "baserom.gba", 0x5b2268, 0x38 - -gUnknown_085B22A0:: @ 85B22A0 - .incbin "baserom.gba", 0x5b22a0, 0x18 - -gUnknown_085B22B8:: @ 85B22B8 - .incbin "baserom.gba", 0x5b22b8, 0x18 - gUnknown_085B22D0:: @ 85B22D0 .incbin "baserom.gba", 0x5b22d0, 0x2d0 diff --git a/include/graphics.h b/include/graphics.h index f3d4588ea..528b7f49f 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -94,5 +94,6 @@ extern const u8 gUnknown_08DBA12C[]; extern const u8 gUnknown_08DCC05C[]; extern const u16 gUnknown_08DCC01C[]; extern const u16 gUnknown_08DCC03C[]; +extern const u16 gUnknown_08DCC648[]; #endif //GUARD_GRAPHICS_H diff --git a/include/strings.h b/include/strings.h index 08e2b4bba..17ecdd565 100644 --- a/include/strings.h +++ b/include/strings.h @@ -82,5 +82,6 @@ extern const u8 gText_NoRegistry[]; extern const u8 gText_OkayToDeleteFromRegistry[]; extern const u8 gText_RegisteredDataDeleted[]; extern const u8 gUnknown_085EA79D[]; +extern const u8 gText_Confirm3[]; #endif //GUARD_STRINGS_H diff --git a/src/wallclock.c b/src/wallclock.c index 0c283e871..2676bbf53 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -14,12 +14,20 @@ #include "menu.h" #include "unknown_task.h" #include "task.h" +#include "strings.h" #include "decompress.h" // static types // static declarations +void sub_8134C9C(void); +void sub_8134CB8(u8 taskId); +void sub_81351AC(struct Sprite *sprite); +void sub_8135244(struct Sprite *sprite); +void sub_81352DC(struct Sprite *sprite); +void sub_8135380(struct Sprite *sprite); + // rodata const u8 gUnknown_085B1F58[] = INCBIN_U8("graphics/wallclock/graphics_85b1f58.4bpp.lz"); @@ -61,10 +69,84 @@ const struct SpritePalette gUnknown_085B2218[] = { { gUnknown_08DCC03C, 0x1001 }, {} }; +static const struct OamData Unknown_085B2230 = { + .y = 0xa0, + .size = 3, + .priority = 1 +}; +static const union AnimCmd Unknown_085B2238[] = { + ANIMCMD_FRAME(0, 30), + ANIMCMD_END +}; +static const union AnimCmd Unknown_085B2240[] = { + ANIMCMD_FRAME(64, 30), + ANIMCMD_END +}; +static const union AnimCmd *const gUnknown_085B2248[] = { + Unknown_085B2238 +}; +static const union AnimCmd *const gUnknown_085B224C[] = { + Unknown_085B2240 +}; +const struct SpriteTemplate gUnknown_085B2250 = { + 0x1000, + 0x1000, + &Unknown_085B2230, + gUnknown_085B2248, + NULL, + gDummySpriteAffineAnimTable, + sub_81351AC +}; +const struct SpriteTemplate gUnknown_085B2268 = { + 0x1000, + 0x1000, + &Unknown_085B2230, + gUnknown_085B224C, + NULL, + gDummySpriteAffineAnimTable, + sub_8135244 +}; +static const struct OamData Unknown_085B2280 = { + .y = 0xa0, + .size = 1, + .priority = 3 +}; +static const union AnimCmd Unknown_085B2288[] = { + ANIMCMD_FRAME(0x84, 30), + ANIMCMD_END +}; +static const union AnimCmd Unknown_085B2290[] = { + ANIMCMD_FRAME(0x80, 30), + ANIMCMD_END +}; +static const union AnimCmd *const gUnknown_085B2298[] = { + Unknown_085B2288 +}; +static const union AnimCmd *const gUnknown_085B229C[] = { + Unknown_085B2290 +}; +const struct SpriteTemplate gUnknown_085B22A0 = { + 0x1000, + 0x1000, + &Unknown_085B2280, + gUnknown_085B2298, + NULL, + gDummySpriteAffineAnimTable, + sub_81352DC +}; +const struct SpriteTemplate gUnknown_085B22B8 = { + 0x1000, + 0x1000, + &Unknown_085B2280, + gUnknown_085B229C, + NULL, + gDummySpriteAffineAnimTable, + sub_8135380 +}; // text -void sub_81347B4(void) +static void sub_81347B4(void) { LoadOam(); ProcessSpriteCopyRequests(); @@ -115,3 +197,53 @@ void LoadWallClockGraphics(void) LoadCompressedObjectPic(&gUnknown_085B2208); LoadSpritePalettes(gUnknown_085B2218); } + +void sub_813498C(void) +{ + BeginNormalPaletteFade(-1, 0, 16, 0, 0); + EnableInterrupts(INTR_FLAG_VBLANK); + SetVBlankCallback(sub_81347B4); + SetMainCallback2(sub_8134C9C); + SetGpuReg(REG_OFFSET_BLDCNT, 0x0000); + SetGpuReg(REG_OFFSET_BLDALPHA, 0x0000); + SetGpuReg(REG_OFFSET_BLDY, 0x0000); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + ShowBg(0); + ShowBg(2); + ShowBg(3); +} + +void Cb2_StartWallClock(void) +{ + u8 taskId; + u8 spriteId; + + LoadWallClockGraphics(); + LZ77UnCompVram(gUnknown_08DCC648, (u16 *)BG_SCREEN_ADDR(7)); + taskId = CreateTask(sub_8134CB8, 0); + gTasks[taskId].data[2] = 10; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + gTasks[taskId].data[5] = 0; + gTasks[taskId].data[6] = 0; + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0x12c; + spriteId = CreateSprite(&gUnknown_085B2250, 0x78, 0x50, 1); + gSprites[spriteId].data0 = taskId; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 0; + spriteId = CreateSprite(&gUnknown_085B2268, 0x78, 0x50, 0); + gSprites[spriteId].data0 = taskId; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 1; + spriteId = CreateSprite(&gUnknown_085B22A0, 0x78, 0x50, 2); + gSprites[spriteId].data0 = taskId; + gSprites[spriteId].data1 = 0x2d; + spriteId = CreateSprite(&gUnknown_085B22B8, 0x78, 0x50, 2); + gSprites[spriteId].data0 = taskId; + gSprites[spriteId].data1 = 0x5a; + sub_813498C(); + PrintTextOnWindow(1, 1, gText_Confirm3, 0, 1, 0, NULL); + PutWindowTilemap(1); + schedule_bg_copy_tilemap_to_vram(2); +}