diff --git a/src/debug.cpp b/src/debug.cpp index 7f81974..8f25077 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -31,11 +31,17 @@ static volatile uint16_t& flags = *reinterpret_cast(0x4FFF700); * * Max length of 0x100 (256) including null terminator. */ -static mtl::string_ext string(reinterpret_cast(0x4FFF600), 256); +static char* string = reinterpret_cast(0x4FFF600); +constexpr static size_t string_len = 255; }; // namespace reg void puts(const mtl::string_view& msg, level lvl) { - reg::string = msg; + size_t count = msg.length(); + if (count > reg::string_len) { count = reg::string_len; } + + // Must be copied manually because the MGBA string register does + // not allow copying in reverse (I think) + msg.copy(reg::string, count); reg::flags = lvl | 0x100; }