2021-11-18 19:21:54 +00:00
|
|
|
#ifndef POKEHEARTGOLD_GF_RTC_H
|
|
|
|
#define POKEHEARTGOLD_GF_RTC_H
|
|
|
|
|
2023-08-13 19:49:48 +00:00
|
|
|
#include <nitro/rtc/ARM9/api.h>
|
2024-08-30 21:46:38 +00:00
|
|
|
|
2024-08-12 23:40:12 +00:00
|
|
|
#include "system.h"
|
2023-08-13 19:49:48 +00:00
|
|
|
|
2021-11-27 16:14:12 +00:00
|
|
|
typedef enum RTC_TimeOfDay {
|
|
|
|
RTC_TIMEOFDAY_MORN = 0,
|
|
|
|
RTC_TIMEOFDAY_DAY,
|
|
|
|
RTC_TIMEOFDAY_EVE,
|
|
|
|
RTC_TIMEOFDAY_NITE,
|
|
|
|
RTC_TIMEOFDAY_LATE,
|
|
|
|
} TIMEOFDAY;
|
|
|
|
|
|
|
|
typedef enum TimeOfDayWildParam {
|
|
|
|
TIMEOFDAY_WILD_MORN,
|
|
|
|
TIMEOFDAY_WILD_DAY,
|
|
|
|
TIMEOFDAY_WILD_NITE,
|
|
|
|
} TimeOfDayWildParam;
|
|
|
|
|
2022-01-27 13:49:33 +00:00
|
|
|
struct GF_RTC_DateTime {
|
|
|
|
RTCDate date;
|
|
|
|
RTCTime time;
|
|
|
|
};
|
|
|
|
|
2021-11-27 16:14:12 +00:00
|
|
|
BOOL IsNighttime(void);
|
2021-11-18 19:58:19 +00:00
|
|
|
void GF_RTC_CopyTime(RTCTime *time);
|
2021-11-22 14:12:46 +00:00
|
|
|
void GF_RTC_CopyDate(RTCDate *date);
|
2022-01-09 00:13:19 +00:00
|
|
|
s64 GF_RTC_DateTimeToSec(void);
|
2021-11-22 14:12:46 +00:00
|
|
|
void GF_RTC_CopyDateTime(RTCDate *date, RTCTime *time);
|
2021-11-27 16:14:12 +00:00
|
|
|
TIMEOFDAY GF_RTC_GetTimeOfDay(void);
|
|
|
|
TIMEOFDAY GF_RTC_GetTimeOfDayByHour(s32 hour);
|
|
|
|
TimeOfDayWildParam GF_RTC_GetTimeOfDayWildParam(void);
|
|
|
|
TimeOfDayWildParam GF_RTC_GetTimeOfDayWildParamByHour(s32 hour);
|
2022-01-10 15:42:18 +00:00
|
|
|
void GF_InitRTCWork(void);
|
|
|
|
void GF_RTC_UpdateOnFrame(void);
|
|
|
|
s32 GF_RTC_TimeToSec(void);
|
2024-08-30 21:46:38 +00:00
|
|
|
s32 GF_RTC_GetDayOfYear(const RTCDate *date);
|
2022-01-10 15:42:18 +00:00
|
|
|
s64 GF_RTC_TimeDelta(s64 first, s64 last);
|
2024-05-20 18:35:37 +00:00
|
|
|
void GF_RTC_UnfreezeTime(void);
|
|
|
|
void GF_RTC_SetAndFreezeTime(s32 hour, s32 minute);
|
2021-11-18 19:21:54 +00:00
|
|
|
|
2024-08-12 23:40:12 +00:00
|
|
|
// doesn't match as a static inline
|
2024-08-30 21:46:38 +00:00
|
|
|
#define RngSeedFromRTC() ({ \
|
|
|
|
RTCDate date; \
|
|
|
|
RTCTime time; \
|
|
|
|
GF_RTC_CopyDateTime(&date, &time); \
|
2024-08-12 23:40:12 +00:00
|
|
|
date.year + date.month * 0x100 * date.day * 0x10000 + time.hour * 0x10000 + (time.minute + time.second) * 0x1000000 + gSystem.vblankCounter; \
|
|
|
|
})
|
|
|
|
|
2024-08-30 21:46:38 +00:00
|
|
|
#endif // POKEHEARTGOLD_GF_RTC_H
|