Poke_Transporter_GB/source/dbg/ptgb_mgba_print.cpp
Philippe Symons 1ee98caa55 Integrate libmgba into PTGB debug builds
This allows us to log to mgba's logging window.
It will be very useful to debug issues.

But we only allow enabling this for debug builds for license reasons.
2026-03-30 21:06:36 +02:00

44 lines
706 B
C++

#include "dbg/ptgb_mgba_print.h"
#include "dbg/debug_mode.h"
#include <stdarg.h>
#if DEBUG_USE_MGBA_PRINT
#include "libraries/libmgba/mgba.h"
#if !DEBUG
static_assert(false, "DEBUG_USE_MGBA_PRINT is only allowed for debug builds!");
#endif
void ptgb_mgba_init(void)
{
mgba_console_open();
}
void ptgb_mgba_deinit(void)
{
mgba_close();
}
void ptgb_mgba_print(int level, const char *format_str, ...)
{
va_list args;
va_start(args, format_str);
mgba_printf(level, format_str, args);
va_end(args);
}
#else
void ptgb_mgba_init(void)
{
}
void ptgb_mgba_deinit(void)
{
}
void ptgb_mgba_print(int level, const char *format_str, ...)
{
(void)level;
(void)format_str;
}
#endif