summaryrefslogtreecommitdiff
path: root/arm9/src/play_timer.c
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2021-11-06 09:23:55 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2021-11-06 09:23:55 -0400
commit276b63e161d40ad080d77e7aedc418f62123eb1a (patch)
tree1efc7ecd56a66780e0f87b80e2f0e84baaad885d /arm9/src/play_timer.c
parent60780539f9f599924eb2c5dc12cb09d2b9831ed1 (diff)
unk_02015E30 -> play_timer
Diffstat (limited to 'arm9/src/play_timer.c')
-rw-r--r--arm9/src/play_timer.c37
1 files changed, 37 insertions, 0 deletions
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;
+ }
+ }
+}