mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-09 02:45:25 -04:00
+2
-2
@@ -86,8 +86,8 @@ extern __OSViContext* __osViCurr;
|
||||
extern __OSViContext* __osViNext;
|
||||
// extern UNK_TYPE4 D_800980D0;
|
||||
extern OSViMode osViModeFpalLan1;
|
||||
extern char ldigs[];
|
||||
extern char udigs[];
|
||||
// extern u8 ldigs[];
|
||||
// extern u8 udigs[];
|
||||
extern OSDevMgr __osViDevMgr;
|
||||
extern UNK_TYPE4 __additional_scanline;
|
||||
// extern UNK_TYPE1 D_80098180;
|
||||
|
||||
+8
-1
@@ -2,7 +2,6 @@
|
||||
#define _XSTDIO_H_
|
||||
#include "stdarg.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ union {
|
||||
/* 0x0 */ s64 ll;
|
||||
@@ -22,4 +21,12 @@ typedef struct {
|
||||
/* 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
|
||||
|
||||
#endif
|
||||
|
||||
@@ -498,8 +498,6 @@ typedef struct {
|
||||
|
||||
typedef void(*osCreateThread_func)(void*);
|
||||
|
||||
typedef void* (*PrintCallback)(void*, const char*, size_t);
|
||||
|
||||
typedef enum {
|
||||
SLOWLY_CALLBACK_NO_ARGS,
|
||||
SLOWLY_CALLBACK_ONE_ARG,
|
||||
|
||||
@@ -217,7 +217,6 @@ beginseg
|
||||
include "build/src/libultra/os/settimer.o"
|
||||
include "build/data/boot/__libm_qnan_f.rodata.o"
|
||||
include "build/src/libultra/rmon/xldtob.o"
|
||||
include "build/data/boot/xldtob.data.o"
|
||||
include "build/src/libultra/libc/ldiv.o"
|
||||
include "build/src/libultra/rmon/xlitob.o"
|
||||
include "build/src/libultra/io/sirawwrite.o"
|
||||
|
||||
@@ -1,3 +1,56 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/boot/xlitob/_Litob.s")
|
||||
#define BUFF_LEN 0x18
|
||||
|
||||
u8 ldigs[] = "0123456789abcdef";
|
||||
u8 udigs[] = "0123456789ABCDEF";
|
||||
|
||||
void _Litob(_Pft* args, u8 type) {
|
||||
u8 buff[BUFF_LEN];
|
||||
const u8* numMap;
|
||||
s32 base;
|
||||
s32 idx;
|
||||
u64 num;
|
||||
lldiv_t quotrem;
|
||||
|
||||
if (type == 'X') {
|
||||
numMap = udigs;
|
||||
} else {
|
||||
numMap = ldigs;
|
||||
}
|
||||
|
||||
base = (type == 'o') ? 8 : ((type != 'x' && type != 'X') ? 10 : 16);
|
||||
idx = BUFF_LEN;
|
||||
num = args->v.ll;
|
||||
|
||||
if ((type == 'd' || type == 'i') && args->v.ll < 0) {
|
||||
num = -num;
|
||||
}
|
||||
|
||||
if (num != 0 || args->prec != 0) {
|
||||
buff[--idx] = numMap[num % base];
|
||||
}
|
||||
|
||||
args->v.ll = num / base;
|
||||
|
||||
while (args->v.ll > 0 && idx > 0) {
|
||||
quotrem = lldiv(args->v.ll, base);
|
||||
args->v.ll = quotrem.quot;
|
||||
buff[--idx] = numMap[quotrem.rem];
|
||||
}
|
||||
|
||||
args->n1 = BUFF_LEN - idx;
|
||||
|
||||
memcpy(args->s, buff + idx, args->n1);
|
||||
|
||||
if (args->n1 < args->prec) {
|
||||
args->nz0 = args->prec - args->n1;
|
||||
}
|
||||
|
||||
if (args->prec < 0 && (args->flags & (FLAGS_ZERO | FLAGS_MINUS)) == FLAGS_ZERO) {
|
||||
idx = args->width - args->n0 - args->nz0 - args->n1;
|
||||
if (idx > 0) {
|
||||
args->nz0 += idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,6 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#define FLAGS_SPACE 1
|
||||
#define FLAGS_PLUS 2
|
||||
#define FLAGS_MINUS 4
|
||||
#define FLAGS_HASH 8
|
||||
#define FLAGS_ZERO 16
|
||||
|
||||
char spaces[] = " ";
|
||||
char zeroes[] = "00000000000000000000000000000000";
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@
|
||||
0x800980C4:("__osViNext","__OSViContext*","",0x4),
|
||||
0x800980D0:("D_800980D0","UNK_TYPE4","",0x4),
|
||||
0x800980E0:("osViModeFpalLan1","OSViMode","",0x50),
|
||||
0x80098130:("ldigs","char","[]",0x14),
|
||||
0x80098144:("udigs","char","[]",0x14),
|
||||
0x80098130:("ldigs","u8","[]",0x14),
|
||||
0x80098144:("udigs","u8","[]",0x14),
|
||||
0x80098160:("__osViDevMgr","OSDevMgr","",0x1c),
|
||||
0x8009817C:("__additional_scanline","UNK_TYPE4","",0x4),
|
||||
0x80098180:("D_80098180","UNK_TYPE1","",0x1),
|
||||
|
||||
Reference in New Issue
Block a user