diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2021-11-06 09:23:55 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2021-11-06 09:23:55 -0400 |
commit | 276b63e161d40ad080d77e7aedc418f62123eb1a (patch) | |
tree | 1efc7ecd56a66780e0f87b80e2f0e84baaad885d /arm9/src | |
parent | 60780539f9f599924eb2c5dc12cb09d2b9831ed1 (diff) |
unk_02015E30 -> play_timer
Diffstat (limited to 'arm9/src')
-rw-r--r-- | arm9/src/main.c | 8 | ||||
-rw-r--r-- | arm9/src/play_timer.c | 37 | ||||
-rw-r--r-- | arm9/src/unk_02015E30.c | 37 |
3 files changed, 41 insertions, 41 deletions
diff --git a/arm9/src/main.c b/arm9/src/main.c index 3b3b0dd6..2930e801 100644 --- a/arm9/src/main.c +++ b/arm9/src/main.c @@ -33,10 +33,10 @@ struct UnkStruct_02016FA8 UNK_02016FA8; extern void FUN_02022294(void); extern void GF_InitRTCWork(void); extern int FUN_020337E8(int); -extern void FUN_02015E30(void); +extern void PlayTimerInit(void); extern void FUN_0201B5CC(void *); extern void GF_RTC_UpdateOnFrame(void); -extern void FUN_02015E60(void); +extern void PlayTimerUpdate(void); extern void FUN_020222C4(void); extern void FUN_0200E2D8(void); @@ -97,7 +97,7 @@ THUMB_FUNC void NitroMain(void) gMain.unk30 = 0; InitializeMainRNG(); InitAllScreenBrightnessData(); - FUN_02015E30(); + PlayTimerInit(); UNK_02016FA4 = 0; for (;;) { @@ -120,7 +120,7 @@ THUMB_FUNC void NitroMain(void) } } GF_RTC_UpdateOnFrame(); - FUN_02015E60(); + PlayTimerUpdate(); FUN_020222C4(); FUN_0201B5CC(gMain.unk24); OS_WaitIrq(1, 1); diff --git a/arm9/src/play_timer.c b/arm9/src/play_timer.c new file mode 100644 index 00000000..9675e179 --- /dev/null +++ b/arm9/src/play_timer.c @@ -0,0 +1,37 @@ + +#include "play_timer.h" + +u64 sTimer3Start; +u64 sUnused; +u64 sDuration; +struct IGT * sIGT_p; +BOOL sTimerActive; + +THUMB_FUNC void PlayTimerInit() +{ + sTimerActive = FALSE; +} + +THUMB_FUNC void PlayTimerStart(struct IGT *igt) +{ + sTimerActive = TRUE; + sUnused = 0; + sDuration = 0; + sIGT_p = igt; + + sTimer3Start = GetTimer3Count(); +} + +THUMB_FUNC void PlayTimerUpdate(void) +{ + if (sTimerActive) + { + u64 res = Timer3CountToSeconds(GetTimer3Count() - sTimer3Start); + + if (sDuration < res) + { + AddIGTSeconds(sIGT_p, (u32)(res - sDuration)); + sDuration = res; + } + } +} diff --git a/arm9/src/unk_02015E30.c b/arm9/src/unk_02015E30.c deleted file mode 100644 index 2f7b5bb5..00000000 --- a/arm9/src/unk_02015E30.c +++ /dev/null @@ -1,37 +0,0 @@ - -#include "unk_02015E30.h" - -u64 UNK_021C48B0; -u64 UNK_021C48A8; -u64 UNK_021C48A0; -struct IGT * UNK_021C489C; -u32 UNK_021C4898; - -THUMB_FUNC void FUN_02015E30() -{ - UNK_021C4898 = 0; -} - -THUMB_FUNC void FUN_02015E3C(struct IGT *igt) -{ - UNK_021C4898 = 1; - UNK_021C48A8 = 0; - UNK_021C48A0 = 0; - UNK_021C489C = igt; - - UNK_021C48B0 = GetTimer3Count(); -} - -THUMB_FUNC void FUN_02015E60() -{ - if (UNK_021C4898 != 0) - { - u64 res = Timer3CountToSeconds(GetTimer3Count() - UNK_021C48B0); - - if (UNK_021C48A0 < res) - { - AddIGTSeconds(UNK_021C489C, (u32)(res - UNK_021C48A0)); - UNK_021C48A0 = res; - } - } -} |