From 19c673767c39eeff46178ad9c6e6e08227c21f96 Mon Sep 17 00:00:00 2001 From: Guido Diego Quispe Robles Date: Wed, 8 Nov 2023 16:07:37 -0300 Subject: [PATCH] Debug Update Screen debug for errors --- Makefile.base | 2 +- engine/inc/debug/debug.hpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Makefile.base b/Makefile.base index e31c0b7..653ac9a 100644 --- a/Makefile.base +++ b/Makefile.base @@ -16,7 +16,7 @@ IRXEMBEDDEDEXT := irx-em CFLAGS += -D_EE -Wall -O3 LINKFLAGS += -O3 -Wl,-zmax-page-size=128 ASFLAGS += -O3 -LIB += -lstdc++ -ldma -lpacket2 -lgraph -ldraw -lmath3d -lpng -lz -lpad -laudsrv -lpatches -lcdvd +LIB += -lstdc++ -ldma -lpacket2 -lgraph -ldraw -lmath3d -lpng -ldebug -lz -lpad -laudsrv -lpatches -lcdvd INC += -I$(PS2DEV)/ps2sdk/ee/include -I$(PS2DEV)/ps2sdk/common/include -I$(PS2DEV)/ps2sdk/ports/include #--------------------------------------------------------------------------------- diff --git a/engine/inc/debug/debug.hpp b/engine/inc/debug/debug.hpp index 159bc51..a8d3e97 100644 --- a/engine/inc/debug/debug.hpp +++ b/engine/inc/debug/debug.hpp @@ -20,6 +20,7 @@ #else // IF Debug #include +#include #include #include #include @@ -81,7 +82,12 @@ class TyraDebug { printf("%s", ss2.str().c_str()); } + init_scr(); for (;;) { + scr_setXY(20, 10); + scr_printf(ss1.str().c_str()); + writeAssertLinesInScreen(args...); + scr_printf(ss2.str().c_str()); } } @@ -103,6 +109,18 @@ class TyraDebug { printf("%s", ss.str().c_str()); } } + + template + static void writeAssertLinesInScreen(Arg&& arg, Args&&... args) { + std::stringstream ss; + + ss << "| " << std::forward(arg) << "\n"; + using expander = int[]; + (void)expander{ + 0, (void(ss << "| " << std::forward(args) << "\n"), 0)...}; + + scr_printf(ss.str().c_str()); + } }; #endif // NDEBUG \ No newline at end of file