[ox/std] Begin mGBA registers with REG_MGBA_
This commit is contained in:
parent
1868d53ecb
commit
7434d949e7
14
deps/ox/src/ox/std/tracehook.cpp
vendored
14
deps/ox/src/ox/std/tracehook.cpp
vendored
@ -12,9 +12,9 @@
|
||||
#include "stringview.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
#define REG_DEBUG_ENABLE *reinterpret_cast<volatile uint16_t*>(0x4FFF780)
|
||||
#define REG_DEBUG_FLAGS *reinterpret_cast<volatile uint16_t*>(0x4FFF700)
|
||||
#define REG_DEBUG_STRING (reinterpret_cast<char*>(0x4FFF600))
|
||||
#define REG_MGBA_DEBUG_ENABLE *reinterpret_cast<volatile uint16_t*>(0x4FFF780)
|
||||
#define REG_MGBA_DEBUG_FLAGS *reinterpret_cast<volatile uint16_t*>(0x4FFF700)
|
||||
#define REG_MGBA_DEBUG_STRING (reinterpret_cast<char*>(0x4FFF600))
|
||||
|
||||
namespace ox::hw {
|
||||
static void (*infoLog)(ox::CRStringView) = [](ox::CRStringView) {};
|
||||
@ -36,14 +36,14 @@ template<LogChan chan>
|
||||
static auto mkLogger() {
|
||||
return [](ox::CRStringView str) {
|
||||
const auto sz = ox::min<std::size_t>(0x100, str.bytes());
|
||||
ox_strncpy(REG_DEBUG_STRING, str.data(), sz);
|
||||
REG_DEBUG_FLAGS = chan | 0x100;
|
||||
ox_strncpy(REG_MGBA_DEBUG_STRING, str.data(), sz);
|
||||
REG_MGBA_DEBUG_FLAGS = chan | 0x100;
|
||||
};
|
||||
}
|
||||
|
||||
void initConsole() {
|
||||
REG_DEBUG_ENABLE = 0xC0DE;
|
||||
if (REG_DEBUG_ENABLE == 0x1DEA) {
|
||||
REG_MGBA_DEBUG_ENABLE = 0xC0DE;
|
||||
if (REG_MGBA_DEBUG_ENABLE == 0x1DEA) {
|
||||
ox::hw::infoLog = mgba::mkLogger<LOG_INFO>();
|
||||
ox::hw::debugLog = mgba::mkLogger<LOG_INFO>(); // use INFO because mGBA disables DEBUG on start
|
||||
ox::hw::errorLog = mgba::mkLogger<LOG_ERROR>();
|
||||
|
Loading…
Reference in New Issue
Block a user