print() now also outputs to svcOutputDebugString

This commit is contained in:
archshift 2014-10-30 00:25:12 -07:00
parent 7470100c23
commit f0d6468017
2 changed files with 20 additions and 3 deletions

View File

@ -2,6 +2,8 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <3ds.h> #include <3ds.h>
#include "text.h" #include "text.h"
@ -57,3 +59,18 @@ void drawFrame()
gfxFlushBuffers(); gfxFlushBuffers();
gfxSwapBuffers(); gfxSwapBuffers();
} }
void print(const char* format, ...)
{
va_list arguments;
char new_str[512];
va_start(arguments, format);
vsprintf(new_str, format, arguments);
va_end(arguments);
sprintf(&superStr[strlen(superStr)], new_str);
svcOutputDebugString(new_str, strlen(new_str));
drawFrame();
}

View File

@ -1,9 +1,9 @@
#ifndef OUTPUT_H #ifndef OUTPUT_H
#define OUTPUT_H #define OUTPUT_H
#define print(...) sprintf(&superStr[strlen(superStr)], __VA_ARGS__); drawFrame()
void drawFrame();
extern char superStr[]; extern char superStr[];
void drawFrame();
void print(const char* format, ...);
#endif #endif