From 6a538fb5e56010151491512d919c674e52b82d56 Mon Sep 17 00:00:00 2001 From: Myles Busig Date: Mon, 4 Mar 2024 21:17:16 -0700 Subject: [PATCH] Change debug::string to use MTL string instead of C strings --- src/debug.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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; }