From d711118601dad11244eb8a2de79727ae9756cf9f Mon Sep 17 00:00:00 2001 From: robojumper Date: Fri, 24 May 2024 10:47:51 +0200 Subject: [PATCH] db_assert --- config/SOUE01/splits.txt | 4 ++++ config/SOUE01/symbols.txt | 2 +- configure.py | 1 + include/nw4r/db/db_assert.h | 20 ++++++++++++++++++++ src/nw4r/db/db_assert.cpp | 16 ++++++++++++++++ 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 include/nw4r/db/db_assert.h create mode 100644 src/nw4r/db/db_assert.cpp diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index fdd52647..5dbd2c35 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -338,6 +338,10 @@ nw4r/db/db_directPrint.cpp: .sbss start:0x805765E8 end:0x805765EC .bss start:0x80636B80 end:0x80636BA4 +nw4r/db/db_assert.cpp: + .text start:0x804373C0 end:0x804373D0 + .sbss start:0x80576610 end:0x80576618 + egg/core/eggArchive.cpp: .text start:0x80493510 end:0x80494254 .data start:0x8056E820 end:0x8056E830 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 5250ad05..30c5841e 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -40838,7 +40838,7 @@ lbl_805765F8 = .sbss:0x805765F8; // type:object size:0x8 lbl_80576600 = .sbss:0x80576600; // type:object size:0x4 data:4byte lbl_80576604 = .sbss:0x80576604; // type:object size:0x4 data:4byte lbl_80576608 = .sbss:0x80576608; // type:object size:0x8 data:4byte -lbl_80576610 = .sbss:0x80576610; // type:object size:0x8 data:4byte +sConsoleHandle__Q24nw4r2db = .sbss:0x80576610; // type:object size:0x4 scope:local data:4byte lbl_80576618 = .sbss:0x80576618; // type:object size:0x4 data:4byte lbl_8057661C = .sbss:0x8057661C; // type:object size:0x4 data:4byte lbl_80576620 = .sbss:0x80576620; // type:object size:0x4 data:4byte diff --git a/configure.py b/configure.py index 38b302df..8ee3f7e1 100644 --- a/configure.py +++ b/configure.py @@ -327,6 +327,7 @@ config.libs = [ nw4rLib( "db", [ + Object(Matching, "nw4r/db/db_assert.cpp"), Object(Matching, "nw4r/db/db_directPrint.cpp"), ], ), diff --git a/include/nw4r/db/db_assert.h b/include/nw4r/db/db_assert.h new file mode 100644 index 00000000..a7ff8de5 --- /dev/null +++ b/include/nw4r/db/db_assert.h @@ -0,0 +1,20 @@ +#ifndef DB_ASSERT_H +#define DB_ASSERT_H + +namespace nw4r { +namespace db { + +namespace detail { + struct ConsoleHead { + + }; +} + +typedef detail::ConsoleHead* ConsoleHandle; + +ConsoleHandle Assertion_SetConsole(ConsoleHandle handle); + +} // namespace db +} // namespace nw4r + +#endif diff --git a/src/nw4r/db/db_assert.cpp b/src/nw4r/db/db_assert.cpp new file mode 100644 index 00000000..d466a61f --- /dev/null +++ b/src/nw4r/db/db_assert.cpp @@ -0,0 +1,16 @@ +#include +#include + +namespace nw4r { +namespace db { + +static ConsoleHandle sConsoleHandle = nullptr; + +ConsoleHandle Assertion_SetConsole(ConsoleHandle handle) { + ConsoleHandle oldHandle = sConsoleHandle; + sConsoleHandle = handle; + return oldHandle; +} + +} // namespace db +} // namespace nw4r