diff --git a/src/debug.cpp b/src/debug.cpp index 0c3d8b6..940991d 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -6,6 +6,8 @@ #include +#include + namespace debug { /** * \brief MGBA debug registers and constants @@ -26,15 +28,14 @@ static volatile uint16_t* flags = reinterpret_cast(0x4FFF700); /** * \brief MGBA debug string register. * - * Max length of 0x100 (256) + * Max length of 0x100 (256) including null terminator. */ -static char* string = reinterpret_cast(0x4FFF600); -constexpr size_t string_len = 0x100; +static mtl::string_ext string(reinterpret_cast(0x4FFF600), 256); }; // namespace reg void puts(const char* msg, level lvl) { - std::strncpy(reg::string, msg, reg::string_len); + reg::string = msg; *reg::flags = (lvl) | 0x100; }