Change debug::string to use MTL string instead of C strings
This commit is contained in:
parent
e0f06fd2c2
commit
b088b7499d
@ -6,6 +6,8 @@
|
||||
|
||||
#include <tonc.h>
|
||||
|
||||
#include <mtl/string.hpp>
|
||||
|
||||
namespace debug {
|
||||
/**
|
||||
* \brief MGBA debug registers and constants
|
||||
@ -26,15 +28,14 @@ static volatile uint16_t* flags = reinterpret_cast<uint16_t*>(0x4FFF700);
|
||||
/**
|
||||
* \brief MGBA debug string register.
|
||||
*
|
||||
* Max length of 0x100 (256)
|
||||
* Max length of 0x100 (256) including null terminator.
|
||||
*/
|
||||
static char* string = reinterpret_cast<char*>(0x4FFF600);
|
||||
constexpr size_t string_len = 0x100;
|
||||
static mtl::string_ext string(reinterpret_cast<char*>(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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user