From fedaa6c50e7ef919eac0b67e03cba7fb1f0ff871 Mon Sep 17 00:00:00 2001 From: Alejandro Javier Asenjo Nitti Date: Wed, 18 Oct 2023 09:07:13 -0300 Subject: [PATCH] libs --- include/PR/xstdio.h | 38 ++++++++++++++++++++++++++++++++++++++ src/libultra/rmon/xlitob.c | 6 +----- 2 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 include/PR/xstdio.h diff --git a/include/PR/xstdio.h b/include/PR/xstdio.h new file mode 100644 index 00000000..f8a26218 --- /dev/null +++ b/include/PR/xstdio.h @@ -0,0 +1,38 @@ +#ifndef PR_XSTDIO_H +#define PR_XSTDIO_H + +#include "ultratypes.h" +// #include "libc/stdarg.h" + +typedef struct { + /* 0x0 */ union { + /* 0x0 */ s64 ll; + /* 0x0 */ f64 ld; + } v; + /* 0x8 */ char* s; + /* 0xC */ s32 n0; + /* 0x10 */ s32 nz0; + /* 0x14 */ s32 n1; + /* 0x18 */ s32 nz1; + /* 0x1C */ s32 n2; + /* 0x20 */ s32 nz2; + /* 0x24 */ s32 prec; + /* 0x28 */ s32 width; + /* 0x2C */ size_t nchar; + /* 0x30 */ u32 flags; + /* 0x34 */ u8 qual; +} _Pft; + +typedef void* (*PrintCallback)(void*, const char*, size_t); + +#define FLAGS_SPACE 1 +#define FLAGS_PLUS 2 +#define FLAGS_MINUS 4 +#define FLAGS_HASH 8 +#define FLAGS_ZERO 16 + +s32 _Printf(PrintCallback pfn, void* arg, const char* fmt, va_list ap); +void _Litob(_Pft* args, u8 type); +void _Ldtob(_Pft* args, u8 type); + +#endif diff --git a/src/libultra/rmon/xlitob.c b/src/libultra/rmon/xlitob.c index b602b1b6..b238f579 100644 --- a/src/libultra/rmon/xlitob.c +++ b/src/libultra/rmon/xlitob.c @@ -1,10 +1,6 @@ #include "global.h" #include "libc/string.h" - -typedef struct { - /* 0x0 */ long long quot; - /* 0x8 */ long long rem; -} lldiv_t; +#include "libc/stdlib.h" typedef struct { /* 0x0 */ union {