From 9eabe80048c1a64cdd5a9c978d0df59eac7f84fd Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Fri, 27 Nov 2015 18:50:30 -0800 Subject: [PATCH] name game's RTC functions --- asm/emerald.s | 336 +++++++++++++++++++++++++++----------------------- asm/main.s | 2 +- 2 files changed, 182 insertions(+), 156 deletions(-) diff --git a/asm/emerald.s b/asm/emerald.s index a9072dec90..94d6deb78f 100644 --- a/asm/emerald.s +++ b/asm/emerald.s @@ -75805,8 +75805,9 @@ sub_802EFFC: ; 802EFFC .pool thumb_func_end sub_802EFFC - thumb_func_start sub_802F0CC -sub_802F0CC: ; 802F0CC + thumb_func_start GameFreakRTC_ClearIME +; void GameFreakRTC_ClearIME() +GameFreakRTC_ClearIME: ; 802F0CC ldr r2, =0x03000dce ldr r1, =0x04000208 ldrh r0, [r1] @@ -75816,10 +75817,11 @@ sub_802F0CC: ; 802F0CC bx lr .align 2, 0 .pool - thumb_func_end sub_802F0CC + thumb_func_end GameFreakRTC_ClearIME - thumb_func_start sub_802F0E4 -sub_802F0E4: ; 802F0E4 + thumb_func_start GameFreakRTC_RestoreIME +; void GameFreakRTC_RestoreIME() +GameFreakRTC_RestoreIME: ; 802F0E4 ldr r0, =0x04000208 ldr r1, =0x03000dce ldrh r1, [r1] @@ -75827,10 +75829,11 @@ sub_802F0E4: ; 802F0E4 bx lr .align 2, 0 .pool - thumb_func_end sub_802F0E4 + thumb_func_end GameFreakRTC_RestoreIME - thumb_func_start sub_802F0F8 -sub_802F0F8: ; 802F0F8 + thumb_func_start GameFreakRTC_ConvertFromBCD +; u8 GameFreakRTC_ConvertFromBCD(u8 bcdByte) +GameFreakRTC_ConvertFromBCD: ; 802F0F8 push {lr} lsls r0, 24 lsrs r2, r0, 24 @@ -75854,10 +75857,11 @@ sub_802F0F8: ; 802F0F8 @0802F11C: pop {r1} bx r1 - thumb_func_end sub_802F0F8 + thumb_func_end GameFreakRTC_ConvertFromBCD - thumb_func_start sub_802F120 -sub_802F120: ; 802F120 + thumb_func_start GameFreakRTC_IsLeapYear +; BOOL GameFreakRTC_IsLeapYear(u32 year) +GameFreakRTC_IsLeapYear: ; 802F120 push {r4,lr} adds r4, r0, 0 movs r0, 0x3 @@ -75885,10 +75889,11 @@ sub_802F120: ; 802F120 pop {r4} pop {r1} bx r1 - thumb_func_end sub_802F120 + thumb_func_end GameFreakRTC_IsLeapYear - thumb_func_start sub_802F154 -sub_802F154: ; 802F154 + thumb_func_start GameFreakRTC_ConvertYearMonthDayToNumDays +; u16 GameFreakRTC_ConvertYearMonthDayToNumDays(u8 year, u8 month, u8 dayOfMonth) +GameFreakRTC_ConvertYearMonthDayToNumDays: ; 802F154 push {r4-r7,lr} mov r7, r8 push {r7} @@ -75909,7 +75914,7 @@ sub_802F154: ; 802F154 lsls r0, 16 lsrs r5, r0, 16 adds r0, r4, 0 - bl sub_802F120 + bl GameFreakRTC_IsLeapYear lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -75939,7 +75944,7 @@ sub_802F154: ; 802F154 cmp r6, 0x2 bls @0802F1C2 adds r0, r7, 0 - bl sub_802F120 + bl GameFreakRTC_IsLeapYear lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -75960,49 +75965,51 @@ sub_802F154: ; 802F154 bx r1 .align 2, 0 .pool - thumb_func_end sub_802F154 + thumb_func_end GameFreakRTC_ConvertYearMonthDayToNumDays - thumb_func_start sub_802F1E0 -sub_802F1E0: ; 802F1E0 + thumb_func_start GameFreakRTC_GetNumDaysInternal +; u16 GameFreakRTC_GetNumDaysInternal(struct RtcInfo *rtc) +GameFreakRTC_GetNumDaysInternal: ; 802F1E0 push {r4-r6,lr} adds r6, r0, 0 ldrb r0, [r6] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 ldrb r0, [r6, 0x1] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 ldrb r0, [r6, 0x2] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD adds r2, r0, 0 lsls r2, 24 lsrs r2, 24 adds r0, r5, 0 adds r1, r4, 0 - bl sub_802F154 + bl GameFreakRTC_ConvertYearMonthDayToNumDays lsls r0, 16 lsrs r0, 16 pop {r4-r6} pop {r1} bx r1 - thumb_func_end sub_802F1E0 + thumb_func_end GameFreakRTC_GetNumDaysInternal - thumb_func_start sub_802F21C -sub_802F21C: ; 802F21C + thumb_func_start GameFreakRTC_Init +; void GameFreakRTC_Init() +GameFreakRTC_Init: ; 802F21C push {r4,r5,lr} ldr r5, =0x03000db8 movs r0, 0 strh r0, [r5] - bl sub_802F0CC + bl GameFreakRTC_ClearIME bl RTC_SetReadWrite bl RTC_Init ldr r4, =0x03000dcc strb r0, [r4] - bl sub_802F0E4 + bl GameFreakRTC_RestoreIME ldrb r4, [r4] movs r0, 0xF ands r0, r4 @@ -76023,9 +76030,9 @@ sub_802F21C: ; 802F21C strh r0, [r5] ldr r4, =0x03000dc0 adds r0, r4, 0 - bl sub_802F2E8 + bl GameFreakRTC_GetControlRegAndRTCDateTime adds r0, r4, 0 - bl sub_802F2FC + bl GameFreakRTC_TestForErrors ldr r1, =0x03000db8 strh r0, [r1] @0802F26E: @@ -76034,19 +76041,21 @@ sub_802F21C: ; 802F21C bx r0 .align 2, 0 .pool - thumb_func_end sub_802F21C + thumb_func_end GameFreakRTC_Init - thumb_func_start sub_802F27C -sub_802F27C: ; 802F27C + thumb_func_start GameFreakRTC_GetErrorFlags +; u16 GameFreakRTC_GetErrorFlags() +GameFreakRTC_GetErrorFlags: ; 802F27C ldr r0, =0x03000db8 ldrh r0, [r0] bx lr .align 2, 0 .pool - thumb_func_end sub_802F27C + thumb_func_end GameFreakRTC_GetErrorFlags - thumb_func_start sub_802F288 -sub_802F288: ; 802F288 + thumb_func_start GameFreakRTC_GetRTCDateTime +; void GameFreakRTC_GetRTCDateTime(struct RtcInfo *rtc) +GameFreakRTC_GetRTCDateTime: ; 802F288 push {r4,lr} adds r2, r0, 0 ldr r0, =0x03000db8 @@ -76065,53 +76074,57 @@ sub_802F288: ; 802F288 .pool @0802F2AC: adds r0, r2, 0 - bl sub_802F2E8 + bl GameFreakRTC_GetControlRegAndRTCDateTime @0802F2B2: pop {r4} pop {r0} bx r0 - thumb_func_end sub_802F288 + thumb_func_end GameFreakRTC_GetRTCDateTime - thumb_func_start sub_802F2B8 -sub_802F2B8: ; 802F2B8 + thumb_func_start GameFreakRTC_GetRTCDateTimeInternal +; void GameFreakRTC_GetRTCDateTimeInternal(struct RtcInfo *rtc) +GameFreakRTC_GetRTCDateTimeInternal: ; 802F2B8 push {r4,lr} adds r4, r0, 0 - bl sub_802F0CC + bl GameFreakRTC_ClearIME adds r0, r4, 0 bl RTC_GetDateTime - bl sub_802F0E4 + bl GameFreakRTC_RestoreIME pop {r4} pop {r0} bx r0 - thumb_func_end sub_802F2B8 + thumb_func_end GameFreakRTC_GetRTCDateTimeInternal - thumb_func_start sub_802F2D0 -sub_802F2D0: ; 802F2D0 + thumb_func_start GameFreakRTC_GetControlReg +; void GameFreakRTC_GetControlReg(struct RtcInfo *rtc) +GameFreakRTC_GetControlReg: ; 802F2D0 push {r4,lr} adds r4, r0, 0 - bl sub_802F0CC + bl GameFreakRTC_ClearIME adds r0, r4, 0 bl RTC_GetControlReg - bl sub_802F0E4 + bl GameFreakRTC_RestoreIME pop {r4} pop {r0} bx r0 - thumb_func_end sub_802F2D0 + thumb_func_end GameFreakRTC_GetControlReg - thumb_func_start sub_802F2E8 -sub_802F2E8: ; 802F2E8 + thumb_func_start GameFreakRTC_GetControlRegAndRTCDateTime +; void GameFreakRTC_GetControlRegAndRTCDateTime(struct RtcInfo *rtc) +GameFreakRTC_GetControlRegAndRTCDateTime: ; 802F2E8 push {r4,lr} adds r4, r0, 0 - bl sub_802F2D0 + bl GameFreakRTC_GetControlReg adds r0, r4, 0 - bl sub_802F2B8 + bl GameFreakRTC_GetRTCDateTimeInternal pop {r4} pop {r0} bx r0 - thumb_func_end sub_802F2E8 + thumb_func_end GameFreakRTC_GetControlRegAndRTCDateTime - thumb_func_start sub_802F2FC -sub_802F2FC: ; 802F2FC + thumb_func_start GameFreakRTC_TestForErrors +; u16 GameFreakRTC_TestForErrors(struct RtcInfo *rtc) +GameFreakRTC_TestForErrors: ; 802F2FC push {r4-r7,lr} mov r7, r8 push {r7} @@ -76133,7 +76146,7 @@ sub_802F2FC: ; 802F2FC orrs r4, r0 @0802F322: ldrb r0, [r7] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD mov r8, r0 cmp r0, 0xFF bne @0802F336 @@ -76143,7 +76156,7 @@ sub_802F2FC: ; 802F2FC lsrs r4, r0, 16 @0802F336: ldrb r0, [r7, 0x1] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD adds r6, r0, 0 cmp r6, 0xFF beq @0802F34A @@ -76158,7 +76171,7 @@ sub_802F2FC: ; 802F2FC lsrs r4, r0, 16 @0802F352: ldrb r0, [r7, 0x2] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD adds r5, r0, 0 cmp r5, 0xFF bne @0802F36A @@ -76172,7 +76185,7 @@ sub_802F2FC: ; 802F2FC cmp r6, 0x2 bne @0802F384 mov r0, r8 - bl sub_802F120 + bl GameFreakRTC_IsLeapYear lsls r0, 24 lsrs r0, 24 ldr r1, =gUnknown_082FECCC @@ -76198,7 +76211,7 @@ sub_802F2FC: ; 802F2FC lsrs r4, r0, 16 @0802F39E: ldrb r0, [r7, 0x4] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD adds r5, r0, 0 cmp r5, 0x18 ble @0802F3B6 @@ -76210,7 +76223,7 @@ sub_802F2FC: ; 802F2FC lsrs r4, r0, 16 @0802F3B6: ldrb r0, [r7, 0x5] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD adds r5, r0, 0 cmp r5, 0x3C ble @0802F3CE @@ -76222,7 +76235,7 @@ sub_802F2FC: ; 802F2FC lsrs r4, r0, 16 @0802F3CE: ldrb r0, [r7, 0x6] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD adds r5, r0, 0 cmp r5, 0x3C ble @0802F3E6 @@ -76241,20 +76254,22 @@ sub_802F2FC: ; 802F2FC bx r1 .align 2, 0 .pool - thumb_func_end sub_802F2FC + thumb_func_end GameFreakRTC_TestForErrors - thumb_func_start sub_802F3F8 -sub_802F3F8: ; 802F3F8 + thumb_func_start GameFreakRTC_Reset +; void GameFreakRTC_Reset() +GameFreakRTC_Reset: ; 802F3F8 push {lr} - bl sub_802F0CC + bl GameFreakRTC_ClearIME bl RTC_Reset - bl sub_802F0E4 + bl GameFreakRTC_RestoreIME pop {r0} bx r0 - thumb_func_end sub_802F3F8 + thumb_func_end GameFreakRTC_Reset - thumb_func_start sub_802F40C -sub_802F40C: ; 802F40C + thumb_func_start GameFreakRTC_FormatDecimalTimeString +; void GameFreakRTC_FormatDecimalTimeString(u8 *dest, s32 hour, s32 minute, s32 second) +GameFreakRTC_FormatDecimalTimeString: ; 802F40C push {r4-r6,lr} adds r5, r2, 0 adds r6, r3, 0 @@ -76279,10 +76294,11 @@ sub_802F40C: ; 802F40C pop {r4-r6} pop {r0} bx r0 - thumb_func_end sub_802F40C + thumb_func_end GameFreakRTC_FormatDecimalTimeString - thumb_func_start sub_802F444 -sub_802F444: ; 802F444 + thumb_func_start GameFreakRTC_FormatHexTimeString +; void GameFreakRTC_FormatHexTimeString(u8 *dest, s32 hour, s32 minute, s32 second) +GameFreakRTC_FormatHexTimeString: ; 802F444 push {r4-r6,lr} adds r5, r2, 0 adds r6, r3, 0 @@ -76307,24 +76323,26 @@ sub_802F444: ; 802F444 pop {r4-r6} pop {r0} bx r0 - thumb_func_end sub_802F444 + thumb_func_end GameFreakRTC_FormatHexTimeString - thumb_func_start sub_802F47C -sub_802F47C: ; 802F47C + thumb_func_start GameFreakRTC_FormatHexTimeStringFromRtcInfo +; void GameFreakRTC_FormatHexTimeStringFromRtcInfo() +GameFreakRTC_FormatHexTimeStringFromRtcInfo: ; 802F47C push {lr} ldr r3, =0x03000dc0 ldrb r1, [r3, 0x4] ldrb r2, [r3, 0x5] ldrb r3, [r3, 0x6] - bl sub_802F444 + bl GameFreakRTC_FormatHexTimeString pop {r0} bx r0 .align 2, 0 .pool - thumb_func_end sub_802F47C + thumb_func_end GameFreakRTC_FormatHexTimeStringFromRtcInfo - thumb_func_start sub_802F494 -sub_802F494: ; 802F494 + thumb_func_start GameFreakRTC_FormatDecimalYearMonthDayString +; void GameFreakRTC_FormatDecimalYearMonthDayString(u8 *dest, s32 year, s32 month, s32 dayOfMonth) +GameFreakRTC_FormatDecimalYearMonthDayString: ; 802F494 push {r4-r6,lr} adds r5, r2, 0 adds r6, r3, 0 @@ -76349,10 +76367,11 @@ sub_802F494: ; 802F494 pop {r4-r6} pop {r0} bx r0 - thumb_func_end sub_802F494 + thumb_func_end GameFreakRTC_FormatDecimalYearMonthDayString - thumb_func_start sub_802F4CC -sub_802F4CC: ; 802F4CC + thumb_func_start GameFreakRTC_FormatHexYearMonthDayString +; void GameFreakRTC_FormatHexYearMonthDayString(u8 *dest, s32 year, s32 month, s32 dayOfMonth) +GameFreakRTC_FormatHexYearMonthDayString: ; 802F4CC push {r4-r6,lr} adds r5, r2, 0 adds r6, r3, 0 @@ -76377,30 +76396,31 @@ sub_802F4CC: ; 802F4CC pop {r4-r6} pop {r0} bx r0 - thumb_func_end sub_802F4CC + thumb_func_end GameFreakRTC_FormatHexYearMonthDayString - thumb_func_start sub_802F504 -sub_802F504: ; 802F504 + thumb_func_start GameFreakRTC_GetRTCDelta +; void GameFreakRTC_GetRTCDelta(RtcInfo *rtc, GameDateTime *delta, GameDateTime *dateTime) +GameFreakRTC_GetRTCDelta: ; 802F504 push {r4-r7,lr} adds r5, r0, 0 adds r7, r1, 0 adds r6, r2, 0 - bl sub_802F1E0 + bl GameFreakRTC_GetNumDaysInternal adds r4, r0, 0 lsls r4, 16 lsrs r4, 16 ldrb r0, [r5, 0x6] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD ldrb r1, [r6, 0x4] subs r0, r1 strb r0, [r7, 0x4] ldrb r0, [r5, 0x5] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD ldrb r1, [r6, 0x3] subs r0, r1 strb r0, [r7, 0x3] ldrb r0, [r5, 0x4] - bl sub_802F0F8 + bl GameFreakRTC_ConvertFromBCD ldrb r1, [r6, 0x2] subs r0, r1 strb r0, [r7, 0x2] @@ -76446,42 +76466,45 @@ sub_802F504: ; 802F504 pop {r4-r7} pop {r0} bx r0 - thumb_func_end sub_802F504 + thumb_func_end GameFreakRTC_GetRTCDelta - thumb_func_start sub_802F588 -sub_802F588: ; 802F588 + thumb_func_start GameFreakRTC_CalcLocalDateTime +; void GameFreakRTC_CalcLocalDateTime() +GameFreakRTC_CalcLocalDateTime: ; 802F588 push {r4,lr} ldr r4, =0x03000dc0 adds r0, r4, 0 - bl sub_802F288 + bl GameFreakRTC_GetRTCDateTime ldr r1, =0x03005cf8 ldr r0, =0x03005d90 ldr r2, [r0] adds r2, 0x98 adds r0, r4, 0 - bl sub_802F504 + bl GameFreakRTC_GetRTCDelta pop {r4} pop {r0} bx r0 .align 2, 0 .pool - thumb_func_end sub_802F588 + thumb_func_end GameFreakRTC_CalcLocalDateTime - thumb_func_start sub_802F5B4 -sub_802F5B4: ; 802F5B4 + thumb_func_start GameFreakRTC_CalcRTCToLocalDelta_DayZero +; void GameFreakRTC_CalcRTCToLocalDelta_DayZero(u8 hour, u8 minute) +GameFreakRTC_CalcRTCToLocalDelta_DayZero: ; 802F5B4 push {lr} adds r3, r0, 0 adds r2, r1, 0 movs r0, 0 adds r1, r3, 0 movs r3, 0 - bl sub_802F5C8 + bl GameFreakRTC_CalcRTCToLocalDelta pop {r0} bx r0 - thumb_func_end sub_802F5B4 + thumb_func_end GameFreakRTC_CalcRTCToLocalDelta_DayZero - thumb_func_start sub_802F5C8 -sub_802F5C8: ; 802F5C8 + thumb_func_start GameFreakRTC_CalcRTCToLocalDelta +; void GameFreakRTC_CalcRTCToLocalDelta(u16 numDays, u8 hour, u8 minute, u8 second) +GameFreakRTC_CalcRTCToLocalDelta: ; 802F5C8 push {r4,r5,lr} ldr r4, =0x03005cf8 strh r0, [r4] @@ -76490,22 +76513,23 @@ sub_802F5C8: ; 802F5C8 strb r3, [r4, 0x4] ldr r5, =0x03000dc0 adds r0, r5, 0 - bl sub_802F288 + bl GameFreakRTC_GetRTCDateTime ldr r0, =0x03005d90 ldr r1, [r0] adds r1, 0x98 adds r0, r5, 0 adds r2, r4, 0 - bl sub_802F504 + bl GameFreakRTC_GetRTCDelta pop {r4,r5} pop {r0} bx r0 .align 2, 0 .pool - thumb_func_end sub_802F5C8 + thumb_func_end GameFreakRTC_CalcRTCToLocalDelta - thumb_func_start sub_802F5FC -sub_802F5FC: ; 802F5FC + thumb_func_start GameFreakRTC_GetDelta +; void GameFreakRTC_GetDelta(GameDateTime *delta, GameDateTime *dateTime1, GameDateTime *dateTime2) +GameFreakRTC_GetDelta: ; 802F5FC push {r4-r6,lr} adds r4, r0, 0 ldrb r3, [r2, 0x4] @@ -76560,16 +76584,17 @@ sub_802F5FC: ; 802F5FC pop {r4-r6} pop {r0} bx r0 - thumb_func_end sub_802F5FC + thumb_func_end GameFreakRTC_GetDelta - thumb_func_start sub_802F664 -sub_802F664: ; 802F664 + thumb_func_start GameFreakRTC_GetNumMinutes +; u16 GameFreakRTC_GetNumMinutes() +GameFreakRTC_GetNumMinutes: ; 802F664 push {r4,lr} ldr r4, =0x03000dc0 adds r0, r4, 0 - bl sub_802F288 + bl GameFreakRTC_GetRTCDateTime adds r0, r4, 0 - bl sub_802F1E0 + bl GameFreakRTC_GetNumDaysInternal lsls r0, 16 lsrs r0, 16 lsls r1, r0, 1 @@ -76589,20 +76614,21 @@ sub_802F664: ; 802F664 bx r1 .align 2, 0 .pool - thumb_func_end sub_802F664 + thumb_func_end GameFreakRTC_GetNumMinutes - thumb_func_start sub_802F69C -sub_802F69C: ; 802F69C + thumb_func_start GameFreakRTC_GetNumDays +; u16 GameFreakRTC_GetNumDays() +GameFreakRTC_GetNumDays: ; 802F69C push {lr} ldr r0, =0x03000dc0 - bl sub_802F1E0 + bl GameFreakRTC_GetNumDaysInternal lsls r0, 16 lsrs r0, 16 pop {r1} bx r1 .align 2, 0 .pool - thumb_func_end sub_802F69C + thumb_func_end GameFreakRTC_GetNumDays thumb_func_start c2_title_menu_3 c2_title_menu_3: ; 802F6B0 @@ -77084,7 +77110,7 @@ task_init_title_menu_graphics_2: ; 802FAB0 movs r0, 0x54 movs r1, 0x7 bl lcd_io_set - bl sub_802F27C + bl GameFreakRTC_GetErrorFlags movs r1, 0xFF lsls r1, 4 ands r1, r0 @@ -192867,7 +192893,7 @@ GetEvolutionTargetSpecies: ; 806D098 adds r0, r3 b @0806D228 @0806D1E6: - bl sub_802F588 + bl GameFreakRTC_CalcLocalDateTime ldr r0, =0x03005cf8 ldrb r0, [r0, 0x2] subs r0, 0xC @@ -192886,7 +192912,7 @@ GetEvolutionTargetSpecies: ; 806D098 .align 2, 0 .pool @0806D208: - bl sub_802F588 + bl GameFreakRTC_CalcLocalDateTime ldr r0, =0x03005cf8 ldrb r0, [r0, 0x2] cmp r0, 0xB @@ -237712,7 +237738,7 @@ new_game_init_data: ; 80844A0 cmp r0, 0x2 bne @080844B2 @080844AE: - bl sub_802F3F8 + bl GameFreakRTC_Reset @080844B2: ldr r1, =0x020322d4 movs r0, 0x1 @@ -285374,7 +285400,7 @@ s2C_unknown: ; 8099DD8 lsls r1, 24 lsrs r1, 24 adds r0, r4, 0 - bl sub_802F5B4 + bl GameFreakRTC_CalcRTCToLocalDelta_DayZero movs r0, 0 pop {r4,r5} pop {r1} @@ -285395,7 +285421,7 @@ s2D_unknown: ; 8099E10 ; int s2E_unknown(script_env *env) s2E_unknown: ; 8099E1C push {lr} - bl sub_802F588 + bl GameFreakRTC_CalcLocalDateTime ldr r2, =0x020375d8 ldr r1, =0x03005cf8 movs r0, 0x2 @@ -294939,7 +294965,7 @@ sub_809E778: ; 809E778 push {lr} ldr r0, =0x00000895 bl FlagSet - bl sub_802F588 + bl GameFreakRTC_CalcLocalDateTime ldr r0, =0x03005d90 ldr r2, [r0] adds r2, 0xA0 @@ -294969,7 +294995,7 @@ sub_809E7B0: ; 809E7B0 lsls r0, 24 cmp r0, 0 bne @0809E7DA - bl sub_802F588 + bl GameFreakRTC_CalcLocalDateTime ldr r4, =0x03005cf8 adds r0, r4, 0 bl sub_809E7E8 @@ -295043,7 +295069,7 @@ sub_809E858: ; 809E858 adds r1, 0xA0 mov r0, sp adds r2, r5, 0 - bl sub_802F5FC + bl GameFreakRTC_GetDelta mov r0, sp movs r2, 0 ldrsh r1, [r0, r2] @@ -295093,10 +295119,10 @@ sub_809E8B4: ; 809E8B4 .pool thumb_func_end sub_809E8B4 - thumb_func_start sub_809E8C8 -sub_809E8C8: ; 809E8C8 + thumb_func_start Special_StartWallClock +Special_StartWallClock: ; 809E8C8 push {lr} - ldr r0, =sub_81349F4 + ldr r0, =Cb2_StartWallClock bl set_callback2 ldr r1, =0x030022c0 ldr r0, =sub_809E8B4 @@ -295105,7 +295131,7 @@ sub_809E8C8: ; 809E8C8 bx r0 .align 2, 0 .pool - thumb_func_end sub_809E8C8 + thumb_func_end Special_StartWallClock thumb_func_start sub_809E8E8 sub_809E8E8: ; 809E8E8 @@ -296288,7 +296314,7 @@ sub_809F200: ; 809F200 .align 2, 0 .pool @0809F29C: - bl sub_802F588 + bl GameFreakRTC_CalcLocalDateTime ldr r0, =sub_809F0F8 movs r1, 0x50 bl AddTask @@ -296362,7 +296388,7 @@ sub_809F200: ; 809F200 @0809F340: ldrb r0, [r5, 0x2] bl remove_task - bl sub_802F3F8 + bl GameFreakRTC_Reset ldr r4, =0x03005cf8 movs r1, 0 ldrsh r0, [r4, r1] @@ -296372,7 +296398,7 @@ sub_809F200: ; 809F200 ldrsb r2, [r4, r2] movs r3, 0x4 ldrsb r3, [r4, r3] - bl sub_802F5C8 + bl GameFreakRTC_CalcRTCToLocalDelta ldr r0, =0x03005d90 ldr r2, [r0] adds r2, 0xA0 @@ -590588,8 +590614,8 @@ sub_81347B4: ; 81347B4 bx r0 thumb_func_end sub_81347B4 - thumb_func_start sub_81347C8 -sub_81347C8: ; 81347C8 + thumb_func_start LoadWallClockGraphics +LoadWallClockGraphics: ; 81347C8 push {r4-r7,lr} mov r7, r8 push {r7} @@ -590767,7 +590793,7 @@ sub_81347C8: ; 81347C8 bx r0 .align 2, 0 .pool - thumb_func_end sub_81347C8 + thumb_func_end LoadWallClockGraphics thumb_func_start sub_813498C sub_813498C: ; 813498C @@ -590812,15 +590838,15 @@ sub_813498C: ; 813498C .pool thumb_func_end sub_813498C - thumb_func_start sub_81349F4 -sub_81349F4: ; 81349F4 + 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 sub_81347C8 + bl LoadWallClockGraphics ldr r0, =gUnknown_08DCC648 ldr r1, =0x06003800 bl LZ77UnCompVram @@ -590952,17 +590978,17 @@ sub_81349F4: ; 81349F4 bx r0 .align 2, 0 .pool - thumb_func_end sub_81349F4 + thumb_func_end Cb2_StartWallClock - thumb_func_start sub_8134B44 -sub_8134B44: ; 8134B44 + thumb_func_start Cb2_ViewWallClock +Cb2_ViewWallClock: ; 8134B44 push {r4-r7,lr} mov r7, r10 mov r6, r9 mov r5, r8 push {r5-r7} sub sp, 0x10 - bl sub_81347C8 + bl LoadWallClockGraphics ldr r0, =gUnknown_08DCC908 ldr r1, =0x06003800 bl LZ77UnCompVram @@ -591101,7 +591127,7 @@ sub_8134B44: ; 8134B44 bx r0 .align 2, 0 .pool - thumb_func_end sub_8134B44 + thumb_func_end Cb2_ViewWallClock thumb_func_start sub_8134C9C sub_8134C9C: ; 8134C9C @@ -591370,7 +591396,7 @@ sub_8134EA4: ; 8134EA4 ldrsh r0, [r4, r1] movs r2, 0xE ldrsh r1, [r4, r2] - bl sub_802F5B4 + bl GameFreakRTC_CalcRTCToLocalDelta_DayZero movs r0, 0x1 negs r0, r0 movs r1, 0 @@ -591722,7 +591748,7 @@ sub_8135130: ; 8135130 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_802F588 + bl GameFreakRTC_CalcLocalDateTime ldr r1, =0x03005e00 lsls r0, r4, 2 adds r0, r4 @@ -596559,7 +596585,7 @@ sub_8137988: ; 8137988 lsls r0, 24 cmp r0, 0 beq @081379CE - bl sub_802F588 + bl GameFreakRTC_CalcLocalDateTime ldr r1, =gUnknown_085B2B44 ldr r0, =0x03005cf8 ldrb r0, [r0, 0x2] @@ -596986,20 +597012,20 @@ sub_8137CB4: ; 8137CB4 .pool thumb_func_end sub_8137CB4 - thumb_func_start sub_8137CC8 -sub_8137CC8: ; 8137CC8 + thumb_func_start Special_ViewWallClock +Special_ViewWallClock: ; 8137CC8 push {lr} ldr r0, =0x030022c0 ldr r1, =c2_exit_to_overworld_2_switch str r1, [r0, 0x8] - ldr r0, =sub_8134B44 + ldr r0, =Cb2_ViewWallClock bl set_callback2 bl script_env_2_enable pop {r0} bx r0 .align 2, 0 .pool - thumb_func_end sub_8137CC8 + thumb_func_end Special_ViewWallClock thumb_func_start wild_pokemon_reroll wild_pokemon_reroll: ; 8137CEC @@ -613278,7 +613304,7 @@ sub_8140470: ; 8140470 lsrs r4, r0, 24 cmp r4, 0x5 bls @0814056C - bl sub_802F588 + bl GameFreakRTC_CalcLocalDateTime add sp, 0x8 pop {r4-r6} pop {r0} @@ -779868,7 +779894,7 @@ sub_8195DB8: ; 8195DB8 thumb_func_start sub_8195E10 sub_8195E10: ; 8195E10 push {lr} - bl sub_802F588 + bl GameFreakRTC_CalcLocalDateTime ldr r0, =0x03005cf8 bl sub_8195E34 ldr r1, =0x0203cd80 @@ -779907,7 +779933,7 @@ sub_8195E34: ; 8195E34 thumb_func_start sub_8195E58 sub_8195E58: ; 8195E58 push {lr} - bl sub_802F588 + bl GameFreakRTC_CalcLocalDateTime ldr r0, =0x03005cf8 bl sub_8195E34 adds r1, r0, 0 @@ -781889,7 +781915,7 @@ sub_8196D74: ; 8196D74 bl sub_8196D4C cmp r0, 0x4 ble @08196DF4 - bl sub_802F69C + bl GameFreakRTC_GetNumDays adds r4, r0, 0 ldr r0, =0x03005d90 ldr r0, [r0] diff --git a/asm/main.s b/asm/main.s index d60d250dfb..5cac741957 100644 --- a/asm/main.s +++ b/asm/main.s @@ -20,7 +20,7 @@ Main: bl m4aSoundInit bl lcd_enable_vcount_irq_at_150px bl sub_800E6D0 - bl sub_802F21C + bl GameFreakRTC_Init bl flash_timeout_start_on_timer_2_when_flash_present bl init_saveblock_ptrs_and_set_copyright_callback2 bl sound_sources_off