tp/libs/dolphin/os/OSTime.c

110 lines
2.6 KiB
C

//
// Generated By: dol2asm
// Translation Unit: OSTime
//
#include "dolphin/os/OSTime.h"
#include "dol2asm.h"
#include "dolphin/os/OSInterrupt.h"
//
// External References:
//
void __div2i();
void __mod2i();
//
// Declarations:
//
/* 803426FC-80342714 33D03C 0018+00 1/1 33/33 0/0 .text OSGetTime */
asm OSTime OSGetTime(void) {
// clang-format off
nofralloc
mftbu r3
mftb r4, 0x10C
mftbu r5
cmpw r3, r5
bne OSGetTime
blr
// clang-format on
}
/* 80342714-8034271C -00001 0008+00 0/0 0/0 0/0 .text OSGetTick */
asm OSTick OSGetTick(void){
// clang-format off
nofralloc
mftb r3, 0x10C
blr
// clang-format on
}
/* 8034271C-80342780 33D05C 0064+00 0/0 16/16 0/0 .text __OSGetSystemTime */
// matches with mwcc 1.2.5e
#ifdef NONMATCHING
OSTime __OSGetSystemTime(void) {
s32 pad;
const BOOL intr = OSDisableInterrupts();
const OSTime time = OSGetTime() + OS_SYSTEM_TIME;
OSRestoreInterrupts(intr);
return time;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm OSTime __OSGetSystemTime(void) {
nofralloc
#include "asm/dolphin/os/OSTime/__OSGetSystemTime.s"
}
#pragma pop
#endif
/* 80342780-803427D8 33D0C0 0058+00 0/0 1/1 0/0 .text __OSTimeToSystemTime */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm OSTime __OSTimeToSystemTime(OSTime time) {
nofralloc
#include "asm/dolphin/os/OSTime/__OSTimeToSystemTime.s"
}
#pragma pop
/* ############################################################################################## */
/* 803D1048-803D1078 02E168 0030+00 1/1 0/0 0/0 .data YearDays */
// End of each month in standard year
static s32 YearDays[] = {
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
};
/* 803D1078-803D10A8 02E198 0030+00 1/1 0/0 0/0 .data LeapYearDays */
// End of each month in leap year
static s32 LeapYearDays[] = {
0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335,
};
/* 803427D8-80342974 33D118 019C+00 1/1 0/0 0/0 .text GetDates */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void GetDates(OSTime ticks, OSCalendarTime* ct) {
nofralloc
#include "asm/dolphin/os/OSTime/GetDates.s"
}
#pragma pop
/* 80342974-80342B78 33D2B4 0204+00 0/0 4/4 0/0 .text OSTicksToCalendarTime */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void OSTicksToCalendarTime(OSTime ticks, OSCalendarTime* ct) {
nofralloc
#include "asm/dolphin/os/OSTime/OSTicksToCalendarTime.s"
}
#pragma pop