Skip to content

Commit

Permalink
Debug Update
Browse files Browse the repository at this point in the history
Screen debug for errors
  • Loading branch information
GDQR committed Nov 8, 2023
1 parent 15a2dbb commit 19c6737
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile.base
Original file line number Diff line number Diff line change
Expand Up @@ -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

#---------------------------------------------------------------------------------
Expand Down
18 changes: 18 additions & 0 deletions engine/inc/debug/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#else // IF Debug

#include <stdio.h>
#include <debug.h>
#include <string>
#include <sstream>
#include <fstream>
Expand Down Expand Up @@ -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());
}
}

Expand All @@ -103,6 +109,18 @@ class TyraDebug {
printf("%s", ss.str().c_str());
}
}

template <typename Arg, typename... Args>
static void writeAssertLinesInScreen(Arg&& arg, Args&&... args) {
std::stringstream ss;

ss << "| " << std::forward<Arg>(arg) << "\n";
using expander = int[];
(void)expander{
0, (void(ss << "| " << std::forward<Args>(args) << "\n"), 0)...};

scr_printf(ss.str().c_str());
}
};

#endif // NDEBUG

0 comments on commit 19c6737

Please sign in to comment.