2023-10-30 00:19:30 +03:00
|
|
|
#include "global.h"
|
|
|
|
|
2023-11-27 00:27:05 +03:00
|
|
|
char D_800C7C80[] = "$Id: sprintf.c,v 1.5 1997/03/19 02:28:53 hayakawa Exp $";
|
|
|
|
|
2023-10-30 00:19:30 +03:00
|
|
|
void* proutSprintf(void* dst, const char* fmt, size_t size) {
|
|
|
|
return (void*) ((uintptr_t) memcpy(dst, fmt, size) + size);
|
|
|
|
}
|
|
|
|
|
2023-11-27 00:27:05 +03:00
|
|
|
s32 vsprintf(char* dst, const char* fmt, va_list args) {
|
Match Libultra (#120)
* Matched perspective, contquery, contreaddata, recvmesg and sendmesg
* Fixed libultra compilation flags
* Matched viblack
* Matched virepeatline, visetmode, visetspecial and viswapbuf
* Matched cartrominit, dpsetstat, sptask, sptaskyield, visetevent, createthread, gettime, setthreadpri, settime, settimer and starthread
* Fixed bss bs
* Matched even more libultra stuff
* Matched even more
* __osRdbSend
* Decompiled most of the functions of libultra <3
* Matched last functions
* Added a separation to libultra macros
* Removed ARRLEN from controller.h
* Fix libultra warnings
---------
Co-authored-by: Alejandro Javier Asenjo Nitti <alejandro.asenjo88@gmail.com>
2024-02-14 18:24:31 +03:00
|
|
|
s32 ret = _Printf((outfun*) proutSprintf, dst, fmt, args);
|
2023-10-30 00:19:30 +03:00
|
|
|
|
|
|
|
if (ret > -1) {
|
|
|
|
dst[ret] = 0;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
int sprintf(char* s, const char* fmt, ...) {
|
|
|
|
s32 ret;
|
|
|
|
va_list args;
|
|
|
|
va_start(args, fmt);
|
|
|
|
|
Match Libultra (#120)
* Matched perspective, contquery, contreaddata, recvmesg and sendmesg
* Fixed libultra compilation flags
* Matched viblack
* Matched virepeatline, visetmode, visetspecial and viswapbuf
* Matched cartrominit, dpsetstat, sptask, sptaskyield, visetevent, createthread, gettime, setthreadpri, settime, settimer and starthread
* Fixed bss bs
* Matched even more libultra stuff
* Matched even more
* __osRdbSend
* Decompiled most of the functions of libultra <3
* Matched last functions
* Added a separation to libultra macros
* Removed ARRLEN from controller.h
* Fix libultra warnings
---------
Co-authored-by: Alejandro Javier Asenjo Nitti <alejandro.asenjo88@gmail.com>
2024-02-14 18:24:31 +03:00
|
|
|
ret = _Printf((outfun*) proutSprintf, s, fmt, args);
|
2023-10-30 00:19:30 +03:00
|
|
|
|
|
|
|
if (ret >= 0) {
|
|
|
|
s[ret] = 0;
|
|
|
|
}
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|