[ox/std] Begin mGBA registers with REG_MGBA_

This commit is contained in:
Gary Talent 2022-12-03 17:24:21 -06:00
parent 1868d53ecb
commit 7434d949e7

View File

@ -12,9 +12,9 @@
#include "stringview.hpp" #include "stringview.hpp"
#include "types.hpp" #include "types.hpp"
#define REG_DEBUG_ENABLE *reinterpret_cast<volatile uint16_t*>(0x4FFF780) #define REG_MGBA_DEBUG_ENABLE *reinterpret_cast<volatile uint16_t*>(0x4FFF780)
#define REG_DEBUG_FLAGS *reinterpret_cast<volatile uint16_t*>(0x4FFF700) #define REG_MGBA_DEBUG_FLAGS *reinterpret_cast<volatile uint16_t*>(0x4FFF700)
#define REG_DEBUG_STRING (reinterpret_cast<char*>(0x4FFF600)) #define REG_MGBA_DEBUG_STRING (reinterpret_cast<char*>(0x4FFF600))
namespace ox::hw { namespace ox::hw {
static void (*infoLog)(ox::CRStringView) = [](ox::CRStringView) {}; static void (*infoLog)(ox::CRStringView) = [](ox::CRStringView) {};
@ -36,14 +36,14 @@ template<LogChan chan>
static auto mkLogger() { static auto mkLogger() {
return [](ox::CRStringView str) { return [](ox::CRStringView str) {
const auto sz = ox::min<std::size_t>(0x100, str.bytes()); const auto sz = ox::min<std::size_t>(0x100, str.bytes());
ox_strncpy(REG_DEBUG_STRING, str.data(), sz); ox_strncpy(REG_MGBA_DEBUG_STRING, str.data(), sz);
REG_DEBUG_FLAGS = chan | 0x100; REG_MGBA_DEBUG_FLAGS = chan | 0x100;
}; };
} }
void initConsole() { void initConsole() {
REG_DEBUG_ENABLE = 0xC0DE; REG_MGBA_DEBUG_ENABLE = 0xC0DE;
if (REG_DEBUG_ENABLE == 0x1DEA) { if (REG_MGBA_DEBUG_ENABLE == 0x1DEA) {
ox::hw::infoLog = mgba::mkLogger<LOG_INFO>(); ox::hw::infoLog = mgba::mkLogger<LOG_INFO>();
ox::hw::debugLog = mgba::mkLogger<LOG_INFO>(); // use INFO because mGBA disables DEBUG on start ox::hw::debugLog = mgba::mkLogger<LOG_INFO>(); // use INFO because mGBA disables DEBUG on start
ox::hw::errorLog = mgba::mkLogger<LOG_ERROR>(); ox::hw::errorLog = mgba::mkLogger<LOG_ERROR>();