From 8f7a3b6f0bbac2c5b7f06b06ee42d149dd8a3d58 Mon Sep 17 00:00:00 2001 From: farisawan-2000 Date: Wed, 16 Dec 2020 00:57:28 -0500 Subject: [PATCH] cleanup --- config.h | 3 ++- s2d_parse.c | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index 6629703d..aee063fa 100644 --- a/config.h +++ b/config.h @@ -27,7 +27,8 @@ extern Gfx *gdl_head; #define s2d_timer gGlobalTimer // The equivalent vsprintf in your game (defaults to libultra _Printf) -#define vsprintf _Printf +#define vsprintf(dst, str, fmt, args) _Printf(proutSprintf, dst, fmt, args) +extern char *proutSprintf(char *dst, const char *src, size_t count); // texture glyph width and height diff --git a/s2d_parse.c b/s2d_parse.c index 21f398f6..1f7b44c3 100644 --- a/s2d_parse.c +++ b/s2d_parse.c @@ -108,9 +108,15 @@ void s2d_type_print(int x, int y, const char *str, uObjMtx *buf, int *pos) { } void s2d_vsprint(int x, int y, uObjMtx *buf, const char *str, ...) { + int last_chr; va_list args; + char *dst = alloc(s2d_strlen(str) * 2); va_start(args, str); - // vsprintf(str, ) + last_chr = vsprintf(dst, str, str, args); + if (last_chr >= 0) { + dst[last_chr] = '\0'; + } + s2d_print(x, y, dst, buf); }