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 | |
parent | 60780539f9f599924eb2c5dc12cb09d2b9831ed1 (diff) |
unk_02015E30 -> play_timer
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | arm9/arm9.lsf | 2 | ||||
-rw-r--r-- | arm9/global.inc | 6 | ||||
-rw-r--r-- | arm9/modules/52/src/module_52.c | 6 | ||||
-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 | ||||
-rw-r--r-- | include/constants/trdata.h | 8 | ||||
-rw-r--r-- | include/main.h | 13 | ||||
-rw-r--r-- | include/play_timer.h | 12 | ||||
-rw-r--r-- | include/unk_02015E30.h | 22 |
11 files changed, 69 insertions, 83 deletions
@@ -301,3 +301,4 @@ diamond: ; @$(HOST_VARS) $(MAKE) GAME_VERSION=DIAMOND pearl: ; @$(HOST_VARS) $(MAKE) GAME_VERSION=PEARL compare_diamond: ; @$(HOST_VARS) $(MAKE) GAME_VERSION=DIAMOND COMPARE=1 compare_pearl: ; @$(HOST_VARS) $(MAKE) GAME_VERSION=PEARL COMPARE=1 +compare: compare_diamond diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index 002ad8c9..f2988147 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -51,7 +51,7 @@ Static arm9 Object unk_02014BF4.o Object unk_02015CC0.o Object rs_migrate_string.o - Object unk_02015E30.o + Object play_timer.o Object game_init.o Object heap.o Object bg_window.o diff --git a/arm9/global.inc b/arm9/global.inc index b0d5df7e..a50a3113 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -1003,9 +1003,9 @@ .extern FUN_02015CE0 .extern FUN_02015CF8 .extern ConvertRSStringToDPStringInternational -.extern FUN_02015E30 -.extern FUN_02015E3C -.extern FUN_02015E60 +.extern PlayTimerInit +.extern PlayTimerStart +.extern PlayTimerUpdate .extern FUN_02015EF4 .extern Main_SetVBlankIntrCB .extern FUN_02015F1C diff --git a/arm9/modules/52/src/module_52.c b/arm9/modules/52/src/module_52.c index d96697e9..a9fdb810 100644 --- a/arm9/modules/52/src/module_52.c +++ b/arm9/modules/52/src/module_52.c @@ -1,7 +1,7 @@ #include "module_52.h" #include "heap.h" #include "unk_0205FA2C.h" -#include "unk_02015E30.h" +#include "play_timer.h" extern struct Unk21DBE18 UNK_020FD144; @@ -202,7 +202,7 @@ THUMB_FUNC BOOL MOD52_021D7540(struct UnkStruct_02006234 *param0, u32 *unused) MOD52_021D7604(0x4d, sav2, 1); struct IGT *igt = Sav2_PlayerData_GetIGTAddr(sav2); - FUN_02015E3C(igt); + PlayTimerStart(igt); return 1; } @@ -243,7 +243,7 @@ THUMB_FUNC BOOL MOD52_021D7594(struct UnkStruct_02006234 *param0, u32 *unused) Sav2_SysInfo_InitFromSystem(sav2_info); } - FUN_02015E3C(Sav2_PlayerData_GetIGTAddr(sav2)); + PlayTimerStart(Sav2_PlayerData_GetIGTAddr(sav2)); return 1; } 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; - } - } -} diff --git a/include/constants/trdata.h b/include/constants/trdata.h new file mode 100644 index 00000000..659423cf --- /dev/null +++ b/include/constants/trdata.h @@ -0,0 +1,8 @@ +// +// Created by scott on 16-Sep-21. +// + +#ifndef POKEDIAMOND_TRDATA_H +#define POKEDIAMOND_TRDATA_H + +#endif //POKEDIAMOND_TRDATA_H diff --git a/include/main.h b/include/main.h index 87110de5..6333744c 100644 --- a/include/main.h +++ b/include/main.h @@ -26,19 +26,6 @@ struct UnkStruct_02006234 u32 unk24; }; -struct Unk2106FA0 -{ - PMBackLightSwitch unk0; - s32 unk4; - FSOverlayID unk8; - struct UnkStruct_02006234 *unkC; - FSOverlayID unk10; - const struct Unk21DBE18 * unk14; - s32 unk18; - s32 unk1C; - struct SaveBlock2 * unk20; -}; - struct Unk21C4818 { u32 unk0; diff --git a/include/play_timer.h b/include/play_timer.h new file mode 100644 index 00000000..f6cfcbba --- /dev/null +++ b/include/play_timer.h @@ -0,0 +1,12 @@ +#ifndef POKEDIAMOND_PLAY_TIMER_H +#define POKEDIAMOND_PLAY_TIMER_H + +#include "global.h" +#include "igt.h" +#include "timer3.h" + +void PlayTimerInit(void); +void PlayTimerStart(struct IGT *igt); +void PlayTimerUpdate(void); + +#endif //POKEDIAMOND_PLAY_TIMER_H diff --git a/include/unk_02015E30.h b/include/unk_02015E30.h deleted file mode 100644 index 67a7aaaf..00000000 --- a/include/unk_02015E30.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef POKEDIAMOND_UNK_02015E30_H -#define POKEDIAMOND_UNK_02015E30_H - -#include "global.h" -#include "igt.h" -#include "timer3.h" - -struct UnkStruct_02015E30 -{ - u32 unk00; - struct IGT *unk04; - u64 unk08; - u32 unk10; - u32 unk14; - u64 unk18; -}; - -void FUN_02015E30(); -void FUN_02015E3C(struct IGT *igt); -void FUN_02015E60(); - -#endif //POKEDIAMOND_UNK_02015E30_H |