eepy disease x3 (match sleep & sprintf)

This commit is contained in:
Prakxo
2023-03-07 13:50:34 +00:00
parent 771ffca329
commit adc2da492b
5 changed files with 43 additions and 2 deletions
+2
View File
@@ -30,6 +30,8 @@ libc64/qrand.c:
.sdata: [0x80217de8, 0x80217df0]
.sbss: [0x80218640, 0x80218648]
.sdata2: [0x80219130, 0x80219138]
#libc64/sprintf.c:
# .text: [0x8005ce18, 0x8005cf08]
#libc64/malloc.c:
# .text: [0x8005cf08, 0x8005d01c]
# .bss: [0x80206F30, 0x80206F60]
+1 -1
View File
@@ -1,7 +1,7 @@
#include "types.h"
#include "dolphin/os.h"
#include "dolphin/BASE/ppcarch.h"
#include "init.h"
#include "dolphin/os/__ppc_eabi_init.h"
#ifdef __cplusplus
extern "C" {
+18
View File
@@ -0,0 +1,18 @@
#include "sleep.h"
#include "dolphin/os/OSAlarm.h"
#include "dolphin/os/OSTimer.h"
#include "dolphin/os/OSThread.h"
void csleep(OSTime c){
OSMessage msg;
OSMessageQueue mq;
OSTimer timer;
osCreateMesgQueue(&mq, &msg, 1);
osSetTimer(&timer, c, 0, &mq, NULL);
osRecvMesg(&mq, NULL, 1);
}
void msleep(u32 ms){
csleep((OS_MSEC_TO_TICKS((OSTime)ms)));
}
+21
View File
@@ -0,0 +1,21 @@
#include "libultra/xprintf.h"
#include "_mem.h"
static void* proutPrintf(void* dst, const char* fmt, size_t size) {
return (void*)((u8*)memcpy(dst, fmt, size) + size);
}
s32 sprintf(char* dst, const char* fmt, ...) {
s32 ret;
va_list args;
va_start(args, fmt);
ret = _Printf(&proutPrintf, dst, fmt, args);
if (ret >= 0) {
dst[ret] = '\0';
}
va_end(args);
return ret;
}