1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-02 07:46:01 +00:00
oot/src/code/sleep.c
Dragorn421 0832b5af68
Fix misc 14 (#1279)
* Remove fake temp in `BossDodongo_DrawEffects`

* `OS_WRITE` for `__osSpRawStartDma` `direction`

* remove outdated comment

* fixup osRecvMesg

* make sShopkeeperStores static

* `PHYSICAL_TO_VIRTUAL(gSegments[0])` -> `SEGMENTED_TO_VIRTUAL(NULL)` (mimics `CollisionHeader_SegmentedToVirtual`)

* Run formatter

* Remove assets from include path in suggested vscode properties

* Fix `osCreateMesgQueue` getting `OS_MESG_BLOCK` as `count` instead of `1`
2022-06-13 17:38:20 +02:00

28 lines
559 B
C

#include "global.h"
void Sleep_Cycles(OSTime cycles) {
OSMesgQueue mq;
OSMesg msg;
OSTimer timer;
osCreateMesgQueue(&mq, &msg, 1);
osSetTimer(&timer, cycles, 0, &mq, NULL);
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
}
void Sleep_Nsec(u32 nsec) {
Sleep_Cycles(OS_NSEC_TO_CYCLES(nsec));
}
void Sleep_Usec(u32 usec) {
Sleep_Cycles(OS_USEC_TO_CYCLES(usec));
}
// originally "msleep"
void Sleep_Msec(u32 ms) {
Sleep_Cycles((ms * OS_CPU_COUNTER) / 1000ull);
}
void Sleep_Sec(u32 sec) {
Sleep_Cycles(sec * OS_CPU_COUNTER);
}