mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-12 18:01:16 +00:00
[headers 9] Add src/libc64/ and new "z64" rand.h (#2164)
* rand.h -> libc64/qrand.h * Add rand.h with z64 rand wrappers * yeet comment * code/rand.c -> libc64/qrand.c * fixup * move libc64 source to src/libc64/ * fix * bss * update file splits disasm metadata
This commit is contained in:
parent
a903f8b8bc
commit
c7ec814d78
19 changed files with 52 additions and 49 deletions
28
src/libc64/sleep.c
Normal file
28
src/libc64/sleep.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
#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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue