From 8c14d3440b1159ab1694834b2618947d7b97610e Mon Sep 17 00:00:00 2001 From: kiwi515 <49212064+kiwi515@users.noreply.github.com> Date: Sun, 20 Sep 2026 15:20:44 -0400 Subject: [PATCH 01/12] Name translation corrections Co-Authored-By: Amber Brault --- include/Pack/RPSystem/RPSysGameConfig.h | 4 ++-- src/Pack/RPSystem/RPSysGameConfig.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/Pack/RPSystem/RPSysGameConfig.h b/include/Pack/RPSystem/RPSysGameConfig.h index 2c845422..b107daaf 100644 --- a/include/Pack/RPSystem/RPSysGameConfig.h +++ b/include/Pack/RPSystem/RPSysGameConfig.h @@ -50,9 +50,9 @@ class RPSysGameConfig : public RPSysTagParameters { RPSysPrimTagParm mRPKasPrint; // at 0xD0 //! Mr. Matsutani print setting RPSysPrimTagParm mRPMatPrint; // at 0xE0 - //! Mr. Sawaya print setting + //! Mr. Sawatani print setting RPSysPrimTagParm mRPSawPrint; // at 0xF0 - //! Mr. Sakakibara print setting + //! Mr. Sakakihara print setting RPSysPrimTagParm mRPSakPrint; // at 0x100 //! Mr. Koda print setting RPSysPrimTagParm mRPKodPrint; // at 0x110 diff --git a/src/Pack/RPSystem/RPSysGameConfig.cpp b/src/Pack/RPSystem/RPSysGameConfig.cpp index e93e9614..c0092fb3 100644 --- a/src/Pack/RPSystem/RPSysGameConfig.cpp +++ b/src/Pack/RPSystem/RPSysGameConfig.cpp @@ -47,16 +47,19 @@ RPSysGameConfig::RPSysGameConfig(EGG::Heap* pHeap) mRootScene.set(NULL); mTVMode.set(NULL); + #if defined(VERSION_RSPE01_01) mLanguage.set(NULL); #endif mRPPrint.set(false); mRPSysPrint.set(false); + #if defined(VERSION_RSPE01_01) mRPUtlPrint.set(false); mRPAudPrint.set(false); #endif + mRPSndPrint.set(false); mRPUserPrint.set(false); From d54d12de1c514060eec80aa89e6ce7c7e74af410 Mon Sep 17 00:00:00 2001 From: kiwi515 <49212064+kiwi515@users.noreply.github.com> Date: Sun, 20 Sep 2026 15:21:07 -0400 Subject: [PATCH 02/12] Build Rev 0 in CI --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbcfc00e..37675770 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: # Add game versions here - version: [RSPE01_01] + version: [RSPE01_00, RSPE01_01] steps: # Checkout the repository From a5578553624222ab903b4d4d6582cd01e7608d27 Mon Sep 17 00:00:00 2001 From: kiwi515 <49212064+kiwi515@users.noreply.github.com> Date: Sun, 20 Sep 2026 15:21:12 -0400 Subject: [PATCH 03/12] Create .gitkeep --- orig/RSPE01_00/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 orig/RSPE01_00/.gitkeep diff --git a/orig/RSPE01_00/.gitkeep b/orig/RSPE01_00/.gitkeep new file mode 100644 index 00000000..e69de29b From 5990551c11ef8b08a7870e5cf6ae00576f514a73 Mon Sep 17 00:00:00 2001 From: kiwi515 <49212064+kiwi515@users.noreply.github.com> Date: Fri, 2 Oct 2026 01:32:38 -0400 Subject: [PATCH 04/12] temp --- config/RSPE01_00/config.yml | 8 + config/RSPE01_00/splits.txt | 13 + config/RSPE01_00/symbols.txt | 40 +-- configure.py | 40 ++- include/decomp/assertion.h | 212 ++++++++++++ include/decomp/compat.h | 8 +- include/decomp/decomp.h | 4 +- include/decomp/lang.h | 4 +- include/macros.h | 18 +- include/nw4r/config.h | 35 ++ include/nw4r/db.h | 1 + include/nw4r/db/db_assert.h | 108 ++++++ include/nw4r/db/db_console.h | 96 +++-- include/nw4r/db/db_directPrint.h | 24 +- include/nw4r/types_nw4r.h | 9 +- include/revolution/GX/GXFrameBuf.h | 3 + src/nw4r/db/db_console.cpp | 43 +++ src/nw4r/db/db_directPrint.cpp | 539 +++++++++++++++++++++++++++++ 18 files changed, 1132 insertions(+), 73 deletions(-) create mode 100644 include/decomp/assertion.h create mode 100644 include/nw4r/config.h create mode 100644 include/nw4r/db/db_assert.h create mode 100644 src/nw4r/db/db_console.cpp create mode 100644 src/nw4r/db/db_directPrint.cpp diff --git a/config/RSPE01_00/config.yml b/config/RSPE01_00/config.yml index eb70f3db..3d37e71b 100644 --- a/config/RSPE01_00/config.yml +++ b/config/RSPE01_00/config.yml @@ -4,3 +4,11 @@ hash: affe3e260e4ebf99f13ef291c9504de1bd0bb7ec symbols: config/RSPE01_00/symbols.txt splits: config/RSPE01_00/splits.txt quick_analysis: true + +block_relocations: + # db_directPrint:sFontData + - source: .rodata:0x80342AC0 + end: .rodata:0x80342BC0 + # db_directPrint:sFontData2 + - source: .rodata:0x80342BC0 + end: .rodata:0x80342CF4 diff --git a/config/RSPE01_00/splits.txt b/config/RSPE01_00/splits.txt index e391653b..69d60e18 100644 --- a/config/RSPE01_00/splits.txt +++ b/config/RSPE01_00/splits.txt @@ -184,6 +184,19 @@ nw4r/snd/snd_FxChorus.cpp: nw4r/snd/snd_SoundHeap.cpp: .text start:0x80041F48 end:0x8004223C +nw4r/db/db_directPrint.cpp: + .text start:0x800492F0 end:0x80049D5C + .rodata start:0x80342A40 end:0x80342CF8 + .data start:0x80360250 end:0x80360260 + .bss start:0x803ADB10 end:0x803ADB38 + .sbss start:0x804DF1E8 end:0x804DF1F0 + +nw4r/db/db_console.cpp: + .text start:0x80049D5C end:0x8004A630 + .data start:0x80360260 end:0x80360288 + .bss start:0x803ADB38 end:0x803ADF50 + .sbss start:0x804DF1F0 end:0x804DF1F8 + nw4r/db/db_exception.cpp: .text start:0x8004A630 end:0x8004B4AC .data start:0x80360288 end:0x80360860 diff --git a/config/RSPE01_00/symbols.txt b/config/RSPE01_00/symbols.txt index de9bfc87..ae4572a5 100644 --- a/config/RSPE01_00/symbols.txt +++ b/config/RSPE01_00/symbols.txt @@ -1659,16 +1659,16 @@ fn_80048BD8 = .text:0x80048BD8; // type:function size:0x78 fn_80048C50 = .text:0x80048C50; // type:function size:0x4DC fn_8004912C = .text:0x8004912C; // type:function size:0x144 fn_80049270 = .text:0x80049270; // type:function size:0x80 -fn_800492F0 = .text:0x800492F0; // type:function size:0xB4 -fn_800493A4 = .text:0x800493A4; // type:function size:0x28 -fn_800493CC = .text:0x800493CC; // type:function size:0x18C +DirectPrint_Init__Q24nw4r2dbFv = .text:0x800492F0; // type:function size:0xB4 +DirectPrint_IsActive__Q24nw4r2dbFv = .text:0x800493A4; // type:function size:0x28 +DirectPrint_EraseXfb__Q24nw4r2dbFiiii = .text:0x800493CC; // type:function size:0x18C DirectPrint_ChangeXfb__Q24nw4r2dbFPvUsUs = .text:0x80049558; // type:function size:0x34 -fn_8004958C = .text:0x8004958C; // type:function size:0x14 -fn_800495A0 = .text:0x800495A0; // type:function size:0xE4 -fn_80049684 = .text:0x80049684; // type:function size:0x154 -fn_800497D8 = .text:0x800497D8; // type:function size:0xDC -fn_800498B4 = .text:0x800498B4; // type:function size:0x2B8 -fn_80049B6C = .text:0x80049B6C; // type:function size:0x1F0 +DirectPrint_StoreCache__Q24nw4r2dbFv = .text:0x8004958C; // type:function size:0x14 +DirectPrint_DrawString__Q24nw4r2dbFiibPCce = .text:0x800495A0; // type:function size:0xE4 +DrawStringToXfb___Q24nw4r2dbFiiPCcbb = .text:0x80049684; // type:function size:0x154 +DrawStringLineToXfb___Q24nw4r2dbFiiPCci = .text:0x800497D8; // type:function size:0xDC +DrawCharToXfb___Q24nw4r2dbFiii = .text:0x800498B4; // type:function size:0x2B8 +DirectPrint_SetupFB__Q34nw4r2db6detailFPC16_GXRenderModeObj = .text:0x80049B6C; // type:function size:0x1F0 fn_80049D5C = .text:0x80049D5C; // type:function size:0xAC fn_80049E08 = .text:0x80049E08; // type:function size:0x164 fn_80049F6C = .text:0x80049F6C; // type:function size:0x30 @@ -14306,9 +14306,9 @@ lbl_803412F8 = .rodata:0x803412F8; // type:object size:0x30 lbl_80341328 = .rodata:0x80341328; // type:object size:0x400 lbl_80341728 = .rodata:0x80341728; // type:object size:0xF14 lbl_8034263C = .rodata:0x8034263C; // type:object size:0x404 -lbl_80342A40 = .rodata:0x80342A40; // type:object size:0x80 -lbl_80342AC0 = .rodata:0x80342AC0; // type:object size:0x100 -lbl_80342BC0 = .rodata:0x80342BC0; // type:object size:0x138 +sAsciiTable__Q24nw4r2db = .rodata:0x80342A40; // type:object size:0x80 +sFontData__Q24nw4r2db = .rodata:0x80342AC0; // type:object size:0x100 +sFontData2__Q24nw4r2db = .rodata:0x80342BC0; // type:object size:0x134 r2c$10503 = .rodata:0x80342CF8; // type:object size:0x20 dlsize$10538 = .rodata:0x80342D18; // type:object size:0x40 gGetAnmResultTable__Q34nw4r3g3d27@unnamed@g3d_resanmchr_cpp@ = .rodata:0x80342D58; // type:object size:0x20 @@ -16670,7 +16670,7 @@ lbl_803600B8 = .data:0x803600B8; // type:object size:0x10 lbl_803600C8 = .data:0x803600C8; // type:object size:0x68 lbl_80360130 = .data:0x80360130; // type:object size:0x68 lbl_80360198 = .data:0x80360198; // type:object size:0xB8 -lbl_80360250 = .data:0x80360250; // type:object size:0x10 +twiceBit$3496 = .data:0x80360250; // type:object size:0x10 lbl_80360260 = .data:0x80360260; // type:object size:0xF data:string lbl_80360270 = .data:0x80360270; // type:object size:0x17 data:string lbl_80360288 = .data:0x80360288; // type:object size:0xD data:string @@ -16880,11 +16880,11 @@ jumptable_80363D8C = .data:0x80363D8C; // type:object size:0x44 scope:local jumptable_80363DD0 = .data:0x80363DD0; // type:object size:0x44 scope:local jumptable_80363E14 = .data:0x80363E14; // type:object size:0x1C scope:local jumptable_80363E30 = .data:0x80363E30; // type:object size:0x54 scope:local -lbl_80363E88 = .data:0x80363E88; // type:object size:0x3C +GXNtsc480IntDf = .data:0x80363E88; // type:object size:0x3C lbl_80363EC4 = .data:0x80363EC4; // type:object size:0x3C -lbl_80363F00 = .data:0x80363F00; // type:object size:0x3C -lbl_80363F3C = .data:0x80363F3C; // type:object size:0x3C -lbl_80363F78 = .data:0x80363F78; // type:object size:0x40 +GXMpal480IntDf = .data:0x80363F00; // type:object size:0x3C +GXPal528IntDf = .data:0x80363F3C; // type:object size:0x3C +GXEurgb60Hz480IntDf = .data:0x80363F78; // type:object size:0x40 jumptable_80363FB8 = .data:0x80363FB8; // type:object size:0x1C scope:local jumptable_80363FD8 = .data:0x80363FD8; // type:object size:0xF4 scope:local jumptable_803640CC = .data:0x803640CC; // type:object size:0xF4 scope:local @@ -18636,8 +18636,8 @@ lbl_803ADAE0 = .bss:0x803ADAE0; // type:object size:0xC lbl_803ADAEC = .bss:0x803ADAEC; // type:object size:0xC data:4byte lbl_803ADAF8 = .bss:0x803ADAF8; // type:object size:0xC lbl_803ADB04 = .bss:0x803ADB04; // type:object size:0xC data:4byte -lbl_803ADB10 = .bss:0x803ADB10; // type:object size:0x10 data:4byte -lbl_803ADB20 = .bss:0x803ADB20; // type:object size:0x18 data:byte +sFrameBufferInfo__Q24nw4r2db = .bss:0x803ADB10; // type:object size:0x10 data:4byte +sFrameBufferColor__Q24nw4r2db = .bss:0x803ADB20; // type:object size:0x14 data:byte lbl_803ADB38 = .bss:0x803ADB38; // type:object size:0x18 lbl_803ADB50 = .bss:0x803ADB50; // type:object size:0x400 sException__Q24nw4r2db = .bss:0x803ADF50; // type:object size:0x360 @@ -20253,7 +20253,7 @@ lbl_804DF1C8 = .sbss:0x804DF1C8; // type:object size:0x8 data:4byte lbl_804DF1D0 = .sbss:0x804DF1D0; // type:object size:0x8 data:byte lbl_804DF1D8 = .sbss:0x804DF1D8; // type:object size:0x8 data:byte lbl_804DF1E0 = .sbss:0x804DF1E0; // type:object size:0x8 data:4byte -lbl_804DF1E8 = .sbss:0x804DF1E8; // type:object size:0x8 data:4byte +sInitialized__Q24nw4r2db = .sbss:0x804DF1E8; // type:object size:0x4 data:4byte lbl_804DF1F0 = .sbss:0x804DF1F0; // type:object size:0x4 data:4byte lbl_804DF1F4 = .sbss:0x804DF1F4; // type:object size:0x1 data:byte sMsgBuffer__Q24nw4r2db = .sbss:0x804DF1F8; // type:object size:0x4 align:4 diff --git a/configure.py b/configure.py index 4660adf5..b79d513c 100755 --- a/configure.py +++ b/configure.py @@ -31,11 +31,14 @@ ) # Game versions -DEFAULT_VERSION = 1 +RSPE01_00 = "RSPE01_00" # USA, Revision 0 +RSPE01_01 = "RSPE01_01" # USA, Revision 1 + VERSIONS = [ - "RSPE01_00", - "RSPE01_01", # USA Rev 1 + RSPE01_00, + RSPE01_01, ] +DEFAULT_VERSION = VERSIONS.index(RSPE01_01) parser = argparse.ArgumentParser() parser.add_argument( @@ -246,15 +249,40 @@ def find_directories(root_path: str, recursive: bool) -> list[str]: f"-i build/{config.version}/include", f"-DBUILD_VERSION={version_num}", f"-DVERSION_{config.version}", + "-DNW4R_BIG_ENDIAN", "-ir include/revolution/BTE", # thanks broadcom... "-DREVOLUTION", # BTE changes ] # Debug flags if args.debug: - cflags_base.extend(["-sym dwarf-2", "-DDEBUG=1"]) + cflags_base.extend([ + "-sym dwarf-2", + "-DDEBUG", + "-DNW4R_DEBUG", + "-DEGG_DEBUG", + "-DRP_DEBUG", + ]) else: - cflags_base.append("-DNDEBUG=1") + if config.non_matching: + cflags_base.extend([ + "-DNDEBUG", + "-DNW4R_PRODUCT", + "-DEGG_PRODUCT", + "-DRP_PRODUCT", + ]) + else: + cflags_base.extend([ + "-DNDEBUG", + "-DEGG_DEBUG", + "-DRP_PRODUCT", + ]) + + # USA, Rev 0 enables the exception handler + cflags_base.append({ + RSPE01_00: "-DNW4R_RELEASE", + RSPE01_01: "-DNW4R_PRODUCT", + }[config.version]) # Warning flags if args.warn == "all": @@ -710,6 +738,8 @@ def MatchingFor(*versions): "cflags": cflags_libnw4r_db, "progress_category": "nw4r", "objects": [ + Object(NonMatching, "nw4r/db/db_directPrint.cpp"), + Object(NonMatching, "nw4r/db/db_console.cpp", extra_cflags=["-inline off", "-O0"]), Object(NonMatching, "nw4r/db/db_exception.cpp"), ] }, diff --git a/include/decomp/assertion.h b/include/decomp/assertion.h new file mode 100644 index 00000000..c59735a9 --- /dev/null +++ b/include/decomp/assertion.h @@ -0,0 +1,212 @@ +/** + * Non-intrusive assertion macros for matching decomp + * + * References: + * https://github.com/pfultz2/Cloak/wiki/C-Preprocessor-tricks,-tips,-and-idioms + * http://jhnet.co.uk/articles/cpp_magic + */ + +#ifndef DECOMP_ASSERTION_H +#define DECOMP_ASSERTION_H + +/****************************************************************************** + * + * Public macros + * + ******************************************************************************/ + +/** + * @brief Performs a runtime assertion + * + * The 'assert_macro' parameter must be the name of the assertion + * implementation. + + * Arguments are passed to 'assert_macro' in the following + * order: (file, line, ...). + * + * The 'lines_macro' parameter must be the name of the line tuple evaluator. + * + * Example: + * #define MY_ASSERT \ + * DECOMP_ASSERT(MY_ASSERT_IMPL, MY_LINES, __VA_ARGS__) + * + * #define MY_ASSERT_IMPL(file, line, expr) \ + * if (!expr) { Panic("Assertion failed: %s", #expr); } + * + * // choose Rev 1 line number + * #define MY_LINES(rev0, rev1) rev1 + */ +#define DECOMP_ASSERT(assert_macro, lines_macro, ...) \ + AA_FWD(assert_macro, \ + AA_EVAL_ARGS(lines_macro, __LINE__, __VA_ARGS__, AA_DUMMY)) + +/** + * @brief Forces a specific source line number in an assertion + * @note This macro must come first in the DECOMP_ASSERT argument list. + */ +#define LINE(no) (AA_LINE, no) + +/** + * @brief Forces a specific source line number tuple in an assertion + * @note This macro must come first in the DECOMP_ASSERT argument list. + * @note You will need to define the appropriate *_LINES handler macro. + */ +#define LINES(no1, ...) (AA_LINES, (no1, __VA_ARGS__)) + +/****************************************************************************** + * + * Utility macros + * + ******************************************************************************/ + +/** + * @brief Concatenates two tokens + * @details Macro expansion is often required, so the arguments are forwarded. + */ +#define AA_CAT(first, second) AA_CAT_IMPL(first, second) +#define AA_CAT_IMPL(first, second) first##second + +/** + * @brief Invokes the specified macro after an expansion pass + */ +#define AA_FWD(macro, tuple) macro tuple + +/** + * @brief Grabs the specified tuple element + * @note Dummy arguments make sure the tuple is always large enough. + */ +#define AA_1ST_IMPL(first, ...) first +#define AA_1ST(...) AA_1ST_IMPL(__VA_ARGS__, ~) +#define AA_2ND_IMPL(first, second, ...) second +#define AA_2ND(...) AA_2ND_IMPL(__VA_ARGS__, ~, ~) + +/** + * @brief Pattern matching primitives + * @details AA_BOOL can be used to evaluate boolean logic, where TRUE cases + * should expand to two tokens (AA_PROBE()). + * + * @note The '~' token is chosen specifically to help catch usage errors. + */ +#define AA_PROBE(...) ~, 1, +#define AA_BOOL(...) AA_2ND(__VA_ARGS__, 0, ) +#define AA_TRUE 1 +#define AA_FALSE 0 + +/** + * @brief Tests whether the input argument is surrounded by parentheses + * @details An argument beginning with parentheses will invoke AA_PROBE. + */ +#define AA_IS_IN_PARENS(x) AA_BOOL(AA_PROBE x) + +/** + * @brief Performs boolean logic + * @note Assumes the 'expr' argument expands to either 0 or 1. + */ +#define AA_IF(expr, if_true, if_false) AA_CAT(AA_IF_, expr)(if_true, if_false) +#define AA_IF_0(if_true, if_false) if_false +#define AA_IF_1(if_true, if_false) if_true + +/** + * @brief Dummy parameter to signal the end of the variadic argument list + * @details Keeps the syntax valid when AA_EVAL_ARGS receives only a single + * argument in __VA_ARGS__. + */ +#define AA_DUMMY ~ + +/** + * @brief Removes the last element from a variadic argument list + * @note Assumes the list's size is <= 10. + */ +// clang-format off +#define AA_DROP_LAST(...) \ + AA_DROP_LAST_SELECT( \ + __VA_ARGS__, \ + AA_DROP_LAST_10, \ + AA_DROP_LAST_9, \ + AA_DROP_LAST_8, \ + AA_DROP_LAST_7, \ + AA_DROP_LAST_6, \ + AA_DROP_LAST_5, \ + AA_DROP_LAST_4, \ + AA_DROP_LAST_3, \ + AA_DROP_LAST_2, \ + AA_DUMMY, \ + AA_DUMMY \ + )(__VA_ARGS__) + +// Variadic arguments will shift the AA_DROP_LAST* macros +#define AA_DROP_LAST_SELECT(for1, for2, for3, for4, for5, for6, for7, for8, for9, for10, selected, ...) selected +#define AA_DROP_LAST_10(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) p1, p2, p3, p4, p5, p6, p7, p8, p9 +#define AA_DROP_LAST_9(p1, p2, p3, p4, p5, p6, p7, p8, p9) p1, p2, p3, p4, p5, p6, p7, p8 +#define AA_DROP_LAST_8(p1, p2, p3, p4, p5, p6, p7, p8) p1, p2, p3, p4, p5, p6, p7 +#define AA_DROP_LAST_7(p1, p2, p3, p4, p5, p6, p7) p1, p2, p3, p4, p5, p6 +#define AA_DROP_LAST_6(p1, p2, p3, p4, p5, p6) p1, p2, p3, p4, p5 +#define AA_DROP_LAST_5(p1, p2, p3, p4, p5) p1, p2, p3, p4 +#define AA_DROP_LAST_4(p1, p2, p3, p4) p1, p2, p3 +#define AA_DROP_LAST_3(p1, p2, p3) p1, p2 +#define AA_DROP_LAST_2(p1, p2) p1 +// clang-format on + +/****************************************************************************** + * + * Assertion implementation details + * + ******************************************************************************/ + +/** + * @brief Evaluates the specified tuple of assertion arguments + * + * This macro evaluates to: (file, line, params...). + * The assertion parameters preserve their original order. + * + * If the first argument is not LINE/LINES, this macro uses __LINE__. + * Otherwise, this macro uses the hardcoded line number. + */ +// clang-format off +#define AA_EVAL_ARGS(lines_macro, real_line, first, ...) \ + AA_IF( \ + /* Test for a valid LINE tag. */ \ + AA_IS_TAG(first), \ + \ + /* Valid tag, extract the hardcoded line number. */ \ + (__FILE__, AA_EVAL_TAG(lines_macro, real_line, first), AA_DROP_LAST(__VA_ARGS__)), \ + \ + /* Not a tag, use the real source location. */ \ + (__FILE__, real_line, AA_DROP_LAST(first, __VA_ARGS__)) \ + ) +// clang-format on + +/** + * @brief Checks if a tag name is valid + */ +// clang-format off +#define AA_IS_TAG(x) \ + AA_IF( \ + /* Input must be in parentheses to possibly be a tuple. */ \ + AA_IS_IN_PARENS(x), \ + \ + /* Pattern match on the tag name. */ \ + AA_BOOL(AA_CAT(AA_IS_TAG_, AA_1ST x)), \ + \ + /* Can't be a tag if it's not even in parentheses. */ \ + AA_FALSE \ + ) + +#define AA_IS_TAG_AA_LINE AA_PROBE() +#define AA_IS_TAG_AA_LINES AA_PROBE() +// clang-format on + +/** + * Avoid hardcoded line numbers in nonmatching builds + */ +// clang-format off +#if defined(NONMATCHING) +#define AA_EVAL_TAG(lines_macro, real_line, tuple) real_line +#else +#define AA_EVAL_TAG(lines_macro, real_line, tuple) AA_CAT(AA_EVAL_TAG_, AA_1ST tuple)(lines_macro, tuple) +#define AA_EVAL_TAG_AA_LINE(lines_macro, tuple) AA_2ND tuple +#define AA_EVAL_TAG_AA_LINES(lines_macro, tuple) AA_FWD(lines_macro, AA_2ND tuple) +#endif +// clang-format on + +#endif diff --git a/include/decomp/compat.h b/include/decomp/compat.h index cdeb9e9b..7db6bb7d 100644 --- a/include/decomp/compat.h +++ b/include/decomp/compat.h @@ -2,8 +2,8 @@ * Compatability macros for language parsers such as Clangd and Intellisense */ -#ifndef COMPAT_H -#define COMPAT_H +#ifndef DECOMP_COMPAT_H +#define DECOMP_COMPAT_H /****************************************************************************** * @@ -53,7 +53,7 @@ #define DECL_ADDRESS(...) // Hide flexible arrays -#define FLEXIBLE_ARRAY(NAME) NAME[0] +#define FLEXIBLE_ARRAY(name) name[0] #else @@ -68,7 +68,7 @@ #define DECL_ADDRESS(addr) : addr // Allow flexible arrays -#define FLEXIBLE_ARRAY(NAME) NAME[] +#define FLEXIBLE_ARRAY(name) name[] #endif diff --git a/include/decomp/decomp.h b/include/decomp/decomp.h index 00bc14c5..2898a9d9 100644 --- a/include/decomp/decomp.h +++ b/include/decomp/decomp.h @@ -3,8 +3,8 @@ * (Macros generate prototypes to satisfy -requireprotos) */ -#ifndef DECOMP_H -#define DECOMP_H +#ifndef DECOMP_DECOMP_H +#define DECOMP_DECOMP_H #include diff --git a/include/decomp/lang.h b/include/decomp/lang.h index e7f3d50a..e2bf17a3 100644 --- a/include/decomp/lang.h +++ b/include/decomp/lang.h @@ -2,8 +2,8 @@ * Compatability macros for deprecated/future C++ features */ -#ifndef LANG_H -#define LANG_H +#ifndef DECOMP_LANG_H +#define DECOMP_LANG_H #if __cplusplus < 201103L #define noexcept throw() diff --git a/include/macros.h b/include/macros.h index 402972ac..8659f121 100644 --- a/include/macros.h +++ b/include/macros.h @@ -12,12 +12,12 @@ ******************************************************************************/ // Stringify expression -#define __STR(x) #x #define STR(x) __STR(x) +#define __STR(x) #x // Concatenate strings -#define __CONCAT(x, y) x##y #define CONCAT(x, y) __CONCAT(x, y) +#define __CONCAT(x, y) x##y // Multi-character character constants // clang-format off @@ -66,7 +66,7 @@ #define LENGTHOF(x) ARRAY_SIZE(x) // Declare an array of hardware registers -#define DECL_HW_REGS(NAME) FLEXIBLE_ARRAY(NAME##_HW_REGS) +#define DECL_HW_REGS(name) FLEXIBLE_ARRAY(name##_HW_REGS) /****************************************************************************** * @@ -92,4 +92,16 @@ // Give a symbol weak linkage #define DECL_WEAK __declspec(weak) +/****************************************************************************** + * + * Source location + * + ******************************************************************************/ + +#if defined(VERSION_RSPE01_00) +#define NW4R_LINE_TUPLE(...) __LINE__ +#elif defined(VERSION_RSPE01_01) +#define NW4R_LINE_TUPLE(...) __LINE__ +#endif + #endif diff --git a/include/nw4r/config.h b/include/nw4r/config.h new file mode 100644 index 00000000..6bd9d482 --- /dev/null +++ b/include/nw4r/config.h @@ -0,0 +1,35 @@ +#ifndef NW4R_CONFIG_H +#define NW4R_CONFIG_H + +// Binary file byteorder marks +#define NW4R_BYTEORDER_LITTLE 0xFFFE +#define NW4R_BYTEORDER_BIG 0xFEFF + +// Native byteorder mark +#if defined(NW4R_LITTLE_ENDIAN) +#define NW4R_BYTEORDER_NATIVE NW4R_BYTEORDER_LITTLE + +#elif defined(NW4R_BIG_ENDIAN) +#define NW4R_BYTEORDER_NATIVE NW4R_BYTEORDER_BIG + +#else +#error Please define either NW4R_LITTLE_ENDIAN, or NW4R_BIG_ENDIAN! +#endif + +// Debug configuration enables assertions, exception handler +#if defined(NW4R_DEBUG) +#define NW4R_FEATURE_ASSERT +#define NW4R_FEATURE_EXCEPTION + +// Release configuration enables exception handler +#elif defined(NW4R_RELEASE) +#define NW4R_FEATURE_EXCEPTION + +// Product configuration disables everything +#elif defined(NW4R_PRODUCT) + +#else +#error Please define either NW4R_DEBUG, NW4R_RELEASE, or NW4R_PRODUCT! +#endif + +#endif diff --git a/include/nw4r/db.h b/include/nw4r/db.h index eb6e1989..58fc2665 100644 --- a/include/nw4r/db.h +++ b/include/nw4r/db.h @@ -1,6 +1,7 @@ #ifndef NW4R_PUBLIC_DB_H #define NW4R_PUBLIC_DB_H +#include #include #include #include diff --git a/include/nw4r/db/db_assert.h b/include/nw4r/db/db_assert.h new file mode 100644 index 00000000..e53b81c1 --- /dev/null +++ b/include/nw4r/db/db_assert.h @@ -0,0 +1,108 @@ +#ifndef NW4R_DB_ASSERT_H +#define NW4R_DB_ASSERT_H + +#include + +#include + +namespace nw4r { +namespace db { + +void Panic(const char* pFile, int line, const char* pFmt, ...); +void VWarning(const char* pFile, int line, const char* pFmt, std::va_list argv); +void Warning(const char* pFile, int line, const char* pFmt, ...); +void Log(const char* pFmt, ...); + +} // namespace db +} // namespace nw4r + +#if defined(NW4R_FEATURE_ASSERT) + +// NW4R does not use line number tuples +#define NW4R_LINES(...) __LINE__ + +// clang-format off + +//! Emits a warning +#define NW4R_WARN(...) DECOMP_ASSERT(NW4R_WARN_IMPL, NW4R_LINES, __VA_ARGS__) +#define NW4R_WARN_IMPL(file, line, ...) \ + nw4r::db::Warning(file, line, __VA_ARGS__) + +//! Halts the program +#define NW4R_PANIC(...) DECOMP_ASSERT(NW4R_PANIC_IMPL, NW4R_LINES, __VA_ARGS__) +#define NW4R_PANIC_IMPL(file, line, ...) \ + nw4r::db::Panic(file, line, "NW4R:Fatal Error\n" __VA_ARGS__) + +//! Halts the program if the specified condition does not hold +#define NW4R_ASSERT(...) DECOMP_ASSERT(NW4R_ASSERT_IMPL, NW4R_LINES, __VA_ARGS__) +#define NW4R_ASSERT_IMPL(file, line, exp) \ + ((exp) && 1 || \ + (nw4r::db::Panic(file, line, \ + "NW4R:Failed assertion " #exp), \ + 0)) + +//! Halts the program if the specified value falls outside the range +#define NW4R_RANGE_ASSERT(...) DECOMP_ASSERT(NW4R_RANGE_ASSERT_IMPL, NW4R_LINES, __VA_ARGS__) +#define NW4R_RANGE_ASSERT_IMPL(file, line, exp) \ + ((exp) && 1 || \ + (nw4r::db::Panic(file, line, \ + "NW4R:Failed assertion " #exp), \ + 0)) + +//! Halts the program if the specified value is misaligned +#define NW4R_ALIGN_ASSERT(...) DECOMP_ASSERT(NW4R_ALIGN_ASSERT_IMPL, NW4R_LINES, __VA_ARGS__) +#define NW4R_ALIGN_ASSERT_IMPL(file, line, value, alignment) \ + (reinterpret_cast(value) % (alignment) == 0 && 1 || \ + (nw4r::db::Panic(file, line, \ + "NW4R:Alignment Error(0x%x)\n" #value \ + " must be aligned to " #alignment " bytes boundary."), \ + 0)) + +//! Halts the program if the specified pointer is NULL +#define NW4R_NULL_ASSERT(...) DECOMP_ASSERT(NW4R_NULL_ASSERT_IMPL, NW4R_LINES, __VA_ARGS__) +#define NW4R_NULL_ASSERT_IMPL(file, line, ptr) \ + ((ptr) != NULL && 1 || \ + (nw4r::db::Panic(file, line, \ + "NW4R:Pointer must not be NULL (" #ptr ")"), \ + 0)) + +//! Halts the program if the specified pointer is invalid +#define NW4R_POINTER_ASSERT(...) DECOMP_ASSERT(NW4R_POINTER_ASSERT_IMPL, NW4R_LINES, __VA_ARGS__) +#define NW4R_POINTER_ASSERT_IMPL(file, line, ptr) \ + (((reinterpret_cast(ptr) & 0xFF000000) == 0x80000000 || \ + (reinterpret_cast(ptr) & 0xFF800000) == 0x81000000 || \ + (reinterpret_cast(ptr) & 0xF8000000) == 0x90000000 || \ + (reinterpret_cast(ptr) & 0xFF000000) == 0xC0000000 || \ + (reinterpret_cast(ptr) & 0xFF800000) == 0xC1000000 || \ + (reinterpret_cast(ptr) & 0xF8000000) == 0xD0000000 || \ + (reinterpret_cast(ptr) & 0xFFFFC000) == 0xE0000000) && 1 || \ + (nw4r::db::Panic(file, line, \ + "NW4R:Pointer Error\n" #ptr "(=%p) is not valid pointer.", (ptr)), \ + 0)) + +//! Halts the program if the specified decimal value is invalid +#define NW4R_FLOAT_ASSERT(...) DECOMP_ASSERT(NW4R_FLOAT_ASSERT_IMPL, NW4R_LINES, __VA_ARGS__) +#define NW4R_FLOAT_ASSERT_IMPL(file, line, fp) \ + (isfinite((fp)) && !isnan((fp)) && 1 || \ + (nw4r::db::Panic(file, line, \ + "NW4R:Floating Point Value Error(%f)\n" #fp \ + " is infinite or nan.", (fp)), \ + 0)) + +// clang-format on + +#else + +#define NW4R_WARN(...) +#define NW4R_PANIC(...) +#define NW4R_ASSERT(...) +#define NW4R_ASSERT_MSG(...) +#define NW4R_RANGE_ASSERT(...) +#define NW4R_ALIGN_ASSERT(...) +#define NW4R_NULL_ASSERT(...) +#define NW4R_POINTER_ASSERT(...) +#define NW4R_FLOAT_ASSERT(...) + +#endif + +#endif diff --git a/include/nw4r/db/db_console.h b/include/nw4r/db/db_console.h index ea0f2cde..77ed627e 100644 --- a/include/nw4r/db/db_console.h +++ b/include/nw4r/db/db_console.h @@ -3,10 +3,9 @@ #include +#include #include -#include - namespace nw4r { namespace db { @@ -17,39 +16,84 @@ enum ConsoleOutputType { CONSOLE_OUTPUT_ALL, }; -namespace detail { -//! Forward declaration required for ConsoleHandle -typedef struct ConsoleHead ConsoleHead; -} // namespace detail - -typedef nw4r::db::detail::ConsoleHead* ConsoleHandle; +enum ConsoleAttr { + CONSOLE_ATTR_0 = 1 << 0, + CONSOLE_ATTR_1 = 1 << 1, + CONSOLE_ATTR_2 = 1 << 2, + CONSOLE_ATTR_3 = 1 << 3, + CONSOLE_ATTR_4 = 1 << 4, +}; namespace detail { struct ConsoleHead { - u8* textBuf; // at 0x0 - u16 width; // at 0x4 - u16 height; // at 0x6 - u16 UNK_0x8; - u16 UNK_0xA; - u16 firstPrint; // at 0xC - u16 xPosPrint; // at 0xE - u16 UNK_0x10; - s32 UNK_0x14; - s32 topLine; // at 0x18 - s16 posX; // at 0x1C - s16 posY; // at 0x1E - u16 linesShown; // at 0x20 - bool isVisible; // at 0x22 - u8 PAD_0x23; + u8* textBuf; // at 0x0 + u16 width; // at 0x4 + u16 height; // at 0x6 + u16 priority; // at 0x8 + u16 attr; // at 0xA + u16 printTop; // at 0xC + u16 printXPos; // at 0xE + u16 printTopUsed; // at 0x10 + u16 ringTop; // at 0x12 + s32 ringTopLineCnt; // at 0x14 + s32 viewTopLine; // at 0x18 + s16 viewPosX; // at 0x1C + s16 viewPosY; // at 0x1E + u16 viewLines; // at 0x20 + u8 isVisible; // at 0x22 + u8 padding_[1]; // at 0x23 nw4r::ut::TextWriter* writer; // at 0x24 - ConsoleHandle next; // at 0x28 + ConsoleHead* next; // at 0x28 }; } // namespace detail -void Console_VFPrintf(ConsoleOutputType type, ConsoleHandle handle, - const char* fmt, std::va_list vlist); +// Public namespace alias +typedef nw4r::db::detail::ConsoleHead* ConsoleHandle; + +s32 Console_GetTotalLines(ConsoleHandle console); + +void Console_VFPrintf(ConsoleOutputType type, ConsoleHandle console, + const char* pFmt, std::va_list argv); + +static inline void Console_VPrintf(ConsoleHandle console, const char* pFmt, + std::va_list argv) { + + Console_VFPrintf(CONSOLE_OUTPUT_ALL, console, pFmt, argv); +} + +static inline u16 Console_GetViewHeight(ConsoleHandle console) { + NW4R_NULL_ASSERT(LINE(433), console); + + return console->viewLines; +} + +static inline bool Console_SetVisible(ConsoleHandle console, bool visible) { + NW4R_NULL_ASSERT(LINE(496), console); + + bool before = console->isVisible; + console->isVisible = visible; + return before; +} + +static inline s32 Console_SetViewBaseLine(ConsoleHandle console, s32 line) { + NW4R_NULL_ASSERT(LINE(556), console); + + s32 before = console->viewTopLine; + console->viewTopLine = line; + return before; +} + +static inline s32 Console_ShowLatestLine(ConsoleHandle console) { + s32 line = Console_GetTotalLines(console) - Console_GetViewHeight(console); + if (line < 0) { + line = 0; + } + + Console_SetViewBaseLine(console, line); + return line; +} } // namespace db } // namespace nw4r diff --git a/include/nw4r/db/db_directPrint.h b/include/nw4r/db/db_directPrint.h index 961dd083..1804acbe 100644 --- a/include/nw4r/db/db_directPrint.h +++ b/include/nw4r/db/db_directPrint.h @@ -10,15 +10,33 @@ namespace db { void DirectPrint_Init(); bool DirectPrint_IsActive(); -void DirectPrint_ChangeXfb(void* pFrameBuf, u16 width, u16 height); -void DirectPrint_ChangeXfb(void* pFrameBuf); + +void DirectPrint_EraseXfb(int x, int y, int width, int height); + +void DirectPrint_ChangeXfb(void* pXfb, u16 width, u16 height); +void DirectPrint_ChangeXfb(void* pXfb); + +void DirectPrint_StoreCache(); + +void DirectPrint_Printf(int x, int y, const char* pFmt, ...); +void DirectPrint_Printf(int x, int y, bool turnOver, const char* pFmt, ...); + +void DirectPrint_DrawString(int x, int y, const char* pFmt, ...); +void DirectPrint_DrawString(int x, int y, bool turnOver, const char* pFmt, ...); + +void DirectPrint_SetColor(GXColor color); +void DirectPrint_SetColor(u8 r, u8 g, u8 b); +GXColor DirectPrint_GetColor(); namespace detail { +void DirectPrint_DrawStringToXfb(int x, int y, const char* pFmt, + std::va_list list, bool turnOver, + bool backErase); + void* DirectPrint_SetupFB(const GXRenderModeObj* pRenderMode); } // namespace detail - } // namespace db } // namespace nw4r diff --git a/include/nw4r/types_nw4r.h b/include/nw4r/types_nw4r.h index 748f2027..b6d1a41c 100644 --- a/include/nw4r/types_nw4r.h +++ b/include/nw4r/types_nw4r.h @@ -2,14 +2,7 @@ #define NW4R_TYPES_H #include -#define NW4R_BYTEORDER_BIG 0xFEFF -#define NW4R_BYTEORDER_LITTLE 0xFFFE - -#if defined(NW4R_LITTLE_ENDIAN) -#define NW4R_BYTEORDER_NATIVE NW4R_BYTEORDER_LITTLE -#else -#define NW4R_BYTEORDER_NATIVE NW4R_BYTEORDER_BIG -#endif +#include #define NW4R_VERSION(major, minor) ((major & 0xFF) << 8 | minor & 0xFF) diff --git a/include/revolution/GX/GXFrameBuf.h b/include/revolution/GX/GXFrameBuf.h index 88cde942..cba37567 100644 --- a/include/revolution/GX/GXFrameBuf.h +++ b/include/revolution/GX/GXFrameBuf.h @@ -1,6 +1,9 @@ #ifndef RVL_SDK_GX_FRAMEBUF_H #define RVL_SDK_GX_FRAMEBUF_H #include + +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/src/nw4r/db/db_console.cpp b/src/nw4r/db/db_console.cpp new file mode 100644 index 00000000..0927697e --- /dev/null +++ b/src/nw4r/db/db_console.cpp @@ -0,0 +1,43 @@ +#include + +namespace nw4r { +namespace db { + +static u8* GetTextPtr_(ConsoleHandle console, u16 line, u16 x) { + return console->textBuf + x + (console->width + 1) * line; +} + +static u8* NextLine_(ConsoleHandle console) { + *GetTextPtr_(console, console->printTop, console->printXPos) = '\0'; + + console->printXPos = 0; + console->printTop++; + + if (console->printTop == console->height && + !(console->attr & CONSOLE_ATTR_1)) { + + console->printTop = 0; + } + + if (console->printTop == console->printTopUsed) { + console->ringTopLineCnt++; + + if (++console->printTopUsed == console->height) { + console->printTopUsed = 0; + } + } + + return GetTextPtr_(console, console->printTop, 0); +} + +static void TerminateLine_(ConsoleHandle console) { + *GetTextPtr_(console, console->printTop, console->printXPos) = '\0'; +} + +static u32 GetTabSize_(ConsoleHandle console) { + s32 tab = (console->attr & (CONSOLE_ATTR_2 | CONSOLE_ATTR_3)) >> 2; + return 2 << tab; +} + +} // namespace db +} // namespace nw4r diff --git a/src/nw4r/db/db_directPrint.cpp b/src/nw4r/db/db_directPrint.cpp new file mode 100644 index 00000000..4390cd19 --- /dev/null +++ b/src/nw4r/db/db_directPrint.cpp @@ -0,0 +1,539 @@ +#include + +#include +#include +#include + +#include +#include + +#define DEFAULT_WIDTH 640 +#define DEFAULT_HEIGHT 480 + +#define FONT_CHAR_WIDTH 6 +#define FONT_CHAR_HEIGHT 7 +#define FONT_LEADING 10 + +#define TAB_SIZE 4 + +namespace nw4r { +namespace db { + +struct FrameBufferInfo { + u8* frameMemory; // at 0x0 + u32 frameSize; // at 0x4 + u16 frameWidth; // at 0x8 + u16 frameHeight; // at 0xA + u16 frameRow; // at 0xC + u16 reserved; // at 0xE +}; + +static FrameBufferInfo sFrameBufferInfo; + +struct YUVColorInfo { + GXColor colorRGBA; // at 0x0 + u16 colorY256; // at 0x4 + u16 colorU; // at 0x6 + u16 colorU2; // at 0x8 + u16 colorU4; // at 0xA + u16 colorV; // at 0xC + u16 colorV2; // at 0xE + u16 colorV4; // at 0x10 + u16 reserved; // at 0x12 +}; + +static YUVColorInfo sFrameBufferColor; + +static BOOL sInitialized = FALSE; + +static const u8 sAsciiTable[] = { + // clang-format off + /* 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F */ + /* 0x00 */ 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0xFD, 0xFE, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, + /* 0x10 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + /* 0x20 */ 0xFF, 0x29, 0x64, 0x65, 0x66, 0x2B, 0x67, 0x68, 0x25, 0x26, 0x69, 0x2A, 0x6A, 0x27, 0x2C, 0x6B, + /* 0x30 */ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x24, 0x6C, 0x6D, 0x6E, 0x6F, 0x28, + /* 0x40 */ 0x70, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, + /* 0x50 */ 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x71, 0x72, 0x73, 0x74, 0x75, + /* 0x60 */ 0xFF, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, + /* 0x70 */ 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x76, 0x77, 0x78, 0x79, 0x7A, + // clang-format on +}; + +static const u32 sFontData[] = { + 0x70871C30, 0x8988A250, 0x88808290, 0x88830C90, 0x888402F8, 0x88882210, + 0x71CF9C10, 0xF9CF9C70, 0x8208A288, 0xF200A288, 0x0BC11C78, 0x0A222208, + 0x8A222208, 0x71C21C70, 0x23C738F8, 0x5228A480, 0x8A282280, 0x8BC822F0, + 0xFA282280, 0x8A28A480, 0x8BC738F8, 0xF9C89C08, 0x82288808, 0x82088808, + 0xF2EF8808, 0x82288888, 0x82288888, 0x81C89C70, 0x8A08A270, 0x920DA288, + 0xA20AB288, 0xC20AAA88, 0xA208A688, 0x9208A288, 0x8BE8A270, 0xF1CF1CF8, + 0x8A28A220, 0x8A28A020, 0xF22F1C20, 0x82AA0220, 0x82492220, 0x81A89C20, + 0x8A28A288, 0x8A28A288, 0x8A289488, 0x8A2A8850, 0x894A9420, 0x894AA220, + 0x70852220, 0xF8011000, 0x08020800, 0x10840400, 0x20040470, 0x40840400, + 0x80020800, 0xF8011000, 0x70800000, 0x88822200, 0x08820400, 0x108F8800, + 0x20821000, 0x00022200, 0x20800020, 0x00000000, +}; + +static const u32 sFontData2[] = { + 0x51421820, 0x53E7A420, 0x014A2C40, 0x01471000, 0x0142AA00, 0x03EAA400, + 0x01471A78, 0x00000000, 0x50008010, 0x20010820, 0xF8020040, 0x20420820, + 0x50441010, 0x00880000, 0x00070E00, 0x01088840, 0x78898820, 0x004A8810, + 0x788A8810, 0x01098808, 0x00040E04, 0x70800620, 0x11400820, 0x12200820, + 0x10001020, 0x10000820, 0x100F8820, 0x70000620, 0x60070000, 0x110F82A0, + 0x12AA8AE0, 0x084F92A0, 0x100FBE1C, 0x10089008, 0x60070808, 0x00000000, + 0x02000200, 0x7A078270, 0x8BC81E88, 0x8A2822F8, 0x9A282280, 0x6BC79E78, + 0x30000000, 0x48080810, 0x41E80000, 0x422F1830, 0xFBE88810, 0x40288890, + 0x43C89C60, 0x81000000, 0x81000000, 0x990F3C70, 0xA10AA288, 0xE10AA288, + 0xA10AA288, 0x98CAA270, 0x00000000, 0x00000020, 0xF1EF1E20, 0x8A28A0F8, + 0x8A281C20, 0xF1E80220, 0x80283C38, 0x00000000, 0x00000000, 0x8A28B688, + 0x8A2A8888, 0x8A2A8878, 0x894A8808, 0x788536F0, 0x00000000, 0x00000000, + 0xF8000000, 0x10000000, 0x20000000, 0x40000000, 0xF8000000, +}; + +static inline int GetDotHeight_() { + return sFrameBufferInfo.frameHeight < 300 ? 1 : 2; +} + +static inline int GetDotWidth_() { + return sFrameBufferInfo.frameWidth < 400 ? 1 : 2; +} + +void DirectPrint_Init() { + if (sInitialized) { + return; + } + + DirectPrint_ChangeXfb(NULL, DEFAULT_WIDTH, DEFAULT_HEIGHT); + DirectPrint_SetColor(255, 255, 255); + + sInitialized = TRUE; +} + +bool DirectPrint_IsActive() { + return sInitialized && sFrameBufferInfo.frameMemory != NULL; +} + +void DirectPrint_EraseXfb(int x, int y, int width, int height) { + if (sFrameBufferInfo.frameMemory == NULL) { + return; + } + + if (GetDotWidth_() == 2) { + x *= 2; + width *= 2; + } + + int x2 = x + width; + + x = x >= 0 ? x : 0; + x2 = x2 <= sFrameBufferInfo.frameWidth ? x2 : sFrameBufferInfo.frameWidth; + + width = x2 - x; + + if (GetDotHeight_() == 2) { + y *= 2; + height *= 2; + } + + int y2 = y + height; + + y = y >= 0 ? y : 0; + y2 = y2 <= sFrameBufferInfo.frameHeight ? y2 : sFrameBufferInfo.frameHeight; + + height = y2 - y; + + // Character location in framebuffer + u16* pPixel = reinterpret_cast(sFrameBufferInfo.frameMemory) + + sFrameBufferInfo.frameRow * y + x; + + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + *pPixel++ = 0x1080; + } + + pPixel += sFrameBufferInfo.frameRow - width; + } +} + +void DirectPrint_ChangeXfb(void* pXfb, u16 width, u16 height) { + sFrameBufferInfo.frameMemory = static_cast(pXfb); + sFrameBufferInfo.frameWidth = width; + sFrameBufferInfo.frameHeight = height; + + sFrameBufferInfo.frameRow = ROUND_UP(static_cast(width), 16); + sFrameBufferInfo.frameSize = + sFrameBufferInfo.frameRow * sFrameBufferInfo.frameHeight * sizeof(u16); +} + +void DirectPrint_ChangeXfb(void* pXfb) { + sFrameBufferInfo.frameMemory = static_cast(pXfb); +} + +void DirectPrint_StoreCache() { + DCStoreRange(sFrameBufferInfo.frameMemory, sFrameBufferInfo.frameSize); +} + +void DirectPrint_Printf(int x, int y, const char* pFmt, ...) { + if (sFrameBufferInfo.frameMemory != NULL) { + std::va_list list; + va_start(list, pFmt); + + detail::DirectPrint_DrawStringToXfb(x, y, pFmt, list, true, true); + + va_end(list); + } +} + +void DirectPrint_Printf(int x, int y, bool turnOver, const char* pFmt, ...) { + if (sFrameBufferInfo.frameMemory != NULL) { + std::va_list list; + va_start(list, pFmt); + + detail::DirectPrint_DrawStringToXfb(x, y, pFmt, list, turnOver, true); + + va_end(list); + } +} + +void DirectPrint_DrawString(int x, int y, const char* pFmt, ...) { + if (sFrameBufferInfo.frameMemory != NULL) { + std::va_list list; + va_start(list, pFmt); + + detail::DirectPrint_DrawStringToXfb(x, y, pFmt, list, true, false); + + va_end(list); + } +} + +void DirectPrint_DrawString(int x, int y, bool turnOver, const char* pFmt, + ...) { + if (sFrameBufferInfo.frameMemory != NULL) { + std::va_list list; + va_start(list, pFmt); + + detail::DirectPrint_DrawStringToXfb(x, y, pFmt, list, turnOver, false); + + va_end(list); + } +} + +void DirectPrint_SetColor(GXColor color) { + DirectPrint_SetColor(color.r, color.g, color.b); +} + +void DirectPrint_SetColor(u8 r, u8 g, u8 b) { + int y = 0.257f * static_cast(r) + // + 0.504f * static_cast(g) + // + 0.098f * static_cast(b) + // + 16.0f; + + int u = -0.148f * static_cast(r) - // + 0.291f * static_cast(g) + // + 0.439f * static_cast(b) + // + 128.0f; + + int v = 0.439f * static_cast(r) - // + 0.368f * static_cast(g) - // + 0.071f * static_cast(b) + // + 128.0f; + + sFrameBufferColor.colorRGBA.r = r; + sFrameBufferColor.colorRGBA.g = g; + sFrameBufferColor.colorRGBA.b = b; + sFrameBufferColor.colorRGBA.a = 255; + + sFrameBufferColor.colorY256 = y * 256; + + sFrameBufferColor.colorU = u; + sFrameBufferColor.colorU2 = u / 2; + sFrameBufferColor.colorU4 = u / 4; + + sFrameBufferColor.colorV = v; + sFrameBufferColor.colorV2 = v / 2; + sFrameBufferColor.colorV4 = v / 4; +} + +GXColor DirectPrint_GetColor() { + return sFrameBufferColor.colorRGBA; +} + +static int StrLineWidth_(const char* pStr) { + int len = 0; + char c; + + NW4R_NULL_ASSERT(LINE(304), pStr); + + while (true) { + c = *pStr++; + + if (c == '\0' || c == '\n') { + return len; + } + + if (c == '\t') { + len = ROUND_DOWN(len + 4, 4); + } else { + len++; + } + } +} + +static void DrawCharToXfb_(int x, int y, int code) { + static u32 twiceBit[] = {0b0000, 0b0011, 0b1100, 0b1111}; + + // Convert to font-relative code + int ncode = code >= 100 ? code - 100 : code; + + int fontW = ncode % 5 * FONT_CHAR_WIDTH; + int fontH = ncode / 5 * FONT_CHAR_HEIGHT; + const u32* pFontLine = code < 100 ? &sFontData[fontH] : &sFontData2[fontH]; + + int dotW = GetDotWidth_(); + int dotH = GetDotHeight_(); + + // Character location in framebuffer + u16* pPixel = reinterpret_cast(sFrameBufferInfo.frameMemory) + + sFrameBufferInfo.frameRow * y * dotH + x * dotW; + + if (y < 0 || x < 0) { + return; + } + + if (sFrameBufferInfo.frameWidth <= dotW * (x + FONT_CHAR_WIDTH) || + sFrameBufferInfo.frameHeight <= dotH * (y + FONT_CHAR_HEIGHT)) { + return; + } + + for (int countY = 0; countY < FONT_CHAR_HEIGHT; countY++) { + u32 fontBits = *pFontLine++ << fontW; + + if (dotW == 1) { + fontBits = (fontBits & 0xFC000000) >> 1; + } else { + fontBits = ((twiceBit[(fontBits >> 26) & 3]) | + (twiceBit[(fontBits >> 28) & 3] << 4) | + (twiceBit[fontBits >> 30] << 8)) + << 19; + } + + for (int countX = 0; countX < dotW * FONT_CHAR_WIDTH; countX += 2) { + u16 color; + + // clang-format off + color = ((fontBits & 0x40000000) ? sFrameBufferColor.colorY256 : 0x00) | + ((fontBits & 0x80000000) ? sFrameBufferColor.colorU4 : 0x20) + + ((fontBits & 0x40000000) ? sFrameBufferColor.colorU2 : 0x40) + + ((fontBits & 0x20000000) ? sFrameBufferColor.colorU4 : 0x20); + // clang-format on + + *pPixel = color; + if (dotH > 1) { + pPixel[sFrameBufferInfo.frameRow] = color; + } + + pPixel++; + + // clang-format off + color = ((fontBits & 0x20000000) ? sFrameBufferColor.colorY256 : 0x00) | + ((fontBits & 0x40000000) ? sFrameBufferColor.colorV4 : 0x20) + + ((fontBits & 0x20000000) ? sFrameBufferColor.colorV2 : 0x40) + + ((fontBits & 0x10000000) ? sFrameBufferColor.colorV4 : 0x20); + // clang-format on + + *pPixel = color; + if (dotH > 1) { + pPixel[sFrameBufferInfo.frameRow] = color; + } + + pPixel++; + fontBits <<= 2; + } + + pPixel += (sFrameBufferInfo.frameRow * dotH) - (dotW * FONT_CHAR_WIDTH); + } +} + +static const char* DrawStringLineToXfb_(int x, int y, const char* str, + int width) { + char ch; + int code; + int count = 0; + + NW4R_NULL_ASSERT(LINE(743), str); + NW4R_ASSERT(LINE(744), width > 0); + + while ((ch = *str) != '\0') { + // Line or string has ended, stop drawing + if (ch == '\n' || ch == '\0') { + return str; + } + + // Convert to font code + code = sAsciiTable[ch & 0x7F]; + + // Tab character + if (code == 0xFD) { + int tabSize = TAB_SIZE - (count & (TAB_SIZE - 1)); + x += tabSize * FONT_CHAR_WIDTH; + count += tabSize; + } else { + // Non-tab character + if (code != 0xFF) { + DrawCharToXfb_(x, y, code); + } + + // 0xFF is treated as whitespace + x += FONT_CHAR_WIDTH; + count++; + } + + // Stop at max line width + if (count >= width) { + // Skip over newline if it comes next. + // It wouldn't take up view space anyways. + if (str[1] == '\n') { + str++; + } + + return str; + } + + str++; + } + + return str; +} + +static void DrawStringToXfb_(int x, int y, const char* pStr, bool turnOver, + bool backErase) { + int x1; + int width, fbWidth; + + x1 = x; + fbWidth = sFrameBufferInfo.frameWidth / GetDotWidth_(); + + while (*pStr != '\0') { + if (backErase) { + int len = StrLineWidth_(pStr); + DirectPrint_EraseXfb(x - 6, y - 3, (len + 2) * 6, 13); + } + + width = (fbWidth - x) / FONT_CHAR_WIDTH; + pStr = DrawStringLineToXfb_(x, y, pStr, width); + y += FONT_LEADING; + + if (*pStr == '\n') { + pStr++; + x = x1; + } else if (*pStr != '\0') { + pStr++; + + if (!turnOver) { + pStr = std::strchr(pStr, '\n'); + if (pStr == NULL) { + break; + } + + pStr++; + x = x1; + } else { + x = 0; + } + } + } +} + +namespace detail { + +void DirectPrint_DrawStringToXfb(int x, int y, const char* pFmt, + std::va_list list, bool turnOver, + bool backErase) { + NW4R_NULL_ASSERT(LINE(645), sFrameBufferInfo.frameMemory); + + char buffer[256]; + int length = std::vsnprintf(buffer, sizeof(buffer), pFmt, list); + + int start = x; // unused + if (length > 0) { + DrawStringToXfb_(x, y, buffer, turnOver, backErase); + } +} + +static void WaitVIRetrace_() { + BOOL enabled = OSEnableInterrupts(); + u32 count = VIGetRetraceCount(); + + while (count == VIGetRetraceCount()) { + ; + } + + OSRestoreInterrupts(enabled); +} + +static void* CreateFB_(const GXRenderModeObj* pRenderMode) { + u32 arenaHi = reinterpret_cast(OSGetArenaHi()); + + u32 size = static_cast(ROUND_UP(pRenderMode->fbWidth & 0xFFFF, 16)) * + pRenderMode->xfbHeight * sizeof(u16); + + u32 frameBuf = ROUND_DOWN(arenaHi - size, 32); + + VIConfigure(pRenderMode); + VISetNextFrameBuffer(reinterpret_cast(frameBuf)); + return reinterpret_cast(frameBuf); +} + +void* DirectPrint_SetupFB(const GXRenderModeObj* pRenderMode) { + DirectPrint_Init(); + + void* pXfb = VIGetCurrentFrameBuffer(); + if (pXfb == NULL) { + if (pRenderMode == NULL) { + switch (VIGetTvFormat()) { + case VI_TVFORMAT_NTSC: { + pRenderMode = &GXNtsc480IntDf; + break; + } + + case VI_TVFORMAT_PAL: { + pRenderMode = &GXPal528IntDf; + break; + } + + case VI_TVFORMAT_EURGB60: { + pRenderMode = &GXEurgb60Hz480IntDf; + break; + } + + case VI_TVFORMAT_MPAL: { + pRenderMode = &GXMpal480IntDf; + break; + } + + default: { + break; + } + } + } + + pXfb = CreateFB_(pRenderMode); + } + + VISetBlack(FALSE); + VIFlush(); + WaitVIRetrace_(); + + if (pRenderMode != NULL) { + DirectPrint_ChangeXfb(pXfb, pRenderMode->fbWidth, + pRenderMode->xfbHeight); + } else { + DirectPrint_ChangeXfb(pXfb); + } + + return pXfb; +} + +} // namespace detail +} // namespace db +} // namespace nw4r From fd06b76f593b821d7dbd708dbd442e0e61caeae0 Mon Sep 17 00:00:00 2001 From: kiwi515 <49212064+kiwi515@users.noreply.github.com> Date: Fri, 2 Oct 2026 22:26:31 -0400 Subject: [PATCH 05/12] db_console --- config/RSPE01_00/symbols.txt | 26 +- configure.py | 2 +- include/nw4r/db/db_console.h | 27 +- include/nw4r/db/db_directPrint.h | 4 + include/nw4r/ut/ut_TextWriterBase.h | 4 +- src/nw4r/db/db_console.cpp | 415 ++++++++++++++++++++++++++++ src/nw4r/db/db_directPrint.cpp | 35 ++- src/nw4r/ut/ut_TextWriterBase.cpp | 17 ++ 8 files changed, 489 insertions(+), 41 deletions(-) diff --git a/config/RSPE01_00/symbols.txt b/config/RSPE01_00/symbols.txt index ae4572a5..a5d46b73 100644 --- a/config/RSPE01_00/symbols.txt +++ b/config/RSPE01_00/symbols.txt @@ -619,7 +619,7 @@ fn_8000C968 = .text:0x8000C968; // type:function size:0x8 fn_8000C970 = .text:0x8000C970; // type:function size:0x8 fn_8000C978 = .text:0x8000C978; // type:function size:0x8 fn_8000C980 = .text:0x8000C980; // type:function size:0x8 -fn_8000C988 = .text:0x8000C988; // type:function size:0x2E4 +Printf__Q34nw4r2ut17TextWriterBaseFPCce = .text:0x8000C988; // type:function size:0x2E4 fn_8000CC6C = .text:0x8000CC6C; // type:function size:0x280 fn_8000CEEC = .text:0x8000CEEC; // type:function size:0x238 fn_8000D124 = .text:0x8000D124; // type:function size:0x3A8 @@ -1669,14 +1669,14 @@ DrawStringToXfb___Q24nw4r2dbFiiPCcbb = .text:0x80049684; // type:function size:0 DrawStringLineToXfb___Q24nw4r2dbFiiPCci = .text:0x800497D8; // type:function size:0xDC DrawCharToXfb___Q24nw4r2dbFiii = .text:0x800498B4; // type:function size:0x2B8 DirectPrint_SetupFB__Q34nw4r2db6detailFPC16_GXRenderModeObj = .text:0x80049B6C; // type:function size:0x1F0 -fn_80049D5C = .text:0x80049D5C; // type:function size:0xAC -fn_80049E08 = .text:0x80049E08; // type:function size:0x164 -fn_80049F6C = .text:0x80049F6C; // type:function size:0x30 -fn_80049F9C = .text:0x80049F9C; // type:function size:0x178 -fn_8004A114 = .text:0x8004A114; // type:function size:0x98 -fn_8004A1AC = .text:0x8004A1AC; // type:function size:0x36C +RemoveConsoleFromList__Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHead = .text:0x80049D5C; // type:function size:0xAC +Console_Create__Q24nw4r2dbFPvUsUsUsUsUs = .text:0x80049E08; // type:function size:0x164 +Console_Destroy__Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHead = .text:0x80049F6C; // type:function size:0x30 +DoDrawConsole___Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHeadPQ34nw4r2ut17TextWriterBase = .text:0x80049F9C; // type:function size:0x178 +Console_DrawDirect__Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHead = .text:0x8004A114; // type:function size:0x98 +PrintToBuffer___Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHeadPCUc = .text:0x8004A1AC; // type:function size:0x36C Console_VFPrintf__Q24nw4r2dbFQ34nw4r2db17ConsoleOutputTypePQ44nw4r2db6detail11ConsoleHeadPCcP16__va_list_struct = .text:0x8004A518; // type:function size:0x9C -fn_8004A5B4 = .text:0x8004A5B4; // type:function size:0x7C +Console_GetTotalLines__Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHead = .text:0x8004A5B4; // type:function size:0x7C Exception_Init__Q24nw4r2dbFv = .text:0x8004A630; // type:function size:0xE8 ErrorHandler___Q24nw4r2dbFUsP9OSContextUlUl = .text:0x8004A718; // type:function size:0x104 RunThread___Q24nw4r2dbFPv = .text:0x8004A81C; // type:function size:0x1F4 @@ -18638,8 +18638,8 @@ lbl_803ADAF8 = .bss:0x803ADAF8; // type:object size:0xC lbl_803ADB04 = .bss:0x803ADB04; // type:object size:0xC data:4byte sFrameBufferInfo__Q24nw4r2db = .bss:0x803ADB10; // type:object size:0x10 data:4byte sFrameBufferColor__Q24nw4r2db = .bss:0x803ADB20; // type:object size:0x14 data:byte -lbl_803ADB38 = .bss:0x803ADB38; // type:object size:0x18 -lbl_803ADB50 = .bss:0x803ADB50; // type:object size:0x400 +sMutex__Q24nw4r2db = .bss:0x803ADB38; // type:object size:0x18 +sStrBuf$3660 = .bss:0x803ADB50; // type:object size:0x400 sException__Q24nw4r2db = .bss:0x803ADF50; // type:object size:0x360 sThreadBuffer__Q24nw4r2db = .bss:0x803AE2B0; // type:object size:0x4000 sGenMode2__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B22C0; // type:object size:0xC data:byte @@ -20253,9 +20253,9 @@ lbl_804DF1C8 = .sbss:0x804DF1C8; // type:object size:0x8 data:4byte lbl_804DF1D0 = .sbss:0x804DF1D0; // type:object size:0x8 data:byte lbl_804DF1D8 = .sbss:0x804DF1D8; // type:object size:0x8 data:byte lbl_804DF1E0 = .sbss:0x804DF1E0; // type:object size:0x8 data:4byte -sInitialized__Q24nw4r2db = .sbss:0x804DF1E8; // type:object size:0x4 data:4byte -lbl_804DF1F0 = .sbss:0x804DF1F0; // type:object size:0x4 data:4byte -lbl_804DF1F4 = .sbss:0x804DF1F4; // type:object size:0x1 data:byte +sInitialized__Q24nw4r2db = .sbss:0x804DF1E8; // type:object size:0x4 scope:local data:4byte +sConsoleList__Q24nw4r2db = .sbss:0x804DF1F0; // type:object size:0x4 data:4byte +sInitialized__Q24nw4r2db = .sbss:0x804DF1F4; // type:object size:0x1 scope:local data:byte sMsgBuffer__Q24nw4r2db = .sbss:0x804DF1F8; // type:object size:0x4 align:4 sSyncGX__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x804DF200; // type:object size:0x1 data:byte sCurrMtx__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x804DF204; // type:object size:0x1 data:byte diff --git a/configure.py b/configure.py index b79d513c..c22f2f06 100755 --- a/configure.py +++ b/configure.py @@ -739,7 +739,7 @@ def MatchingFor(*versions): "progress_category": "nw4r", "objects": [ Object(NonMatching, "nw4r/db/db_directPrint.cpp"), - Object(NonMatching, "nw4r/db/db_console.cpp", extra_cflags=["-inline off", "-O0"]), + Object(NonMatching, "nw4r/db/db_console.cpp"), Object(NonMatching, "nw4r/db/db_exception.cpp"), ] }, diff --git a/include/nw4r/db/db_console.h b/include/nw4r/db/db_console.h index 77ed627e..46570087 100644 --- a/include/nw4r/db/db_console.h +++ b/include/nw4r/db/db_console.h @@ -10,10 +10,10 @@ namespace nw4r { namespace db { enum ConsoleOutputType { - CONSOLE_OUTPUT_NONE, - CONSOLE_OUTPUT_DISPLAY, - CONSOLE_OUTPUT_TERMINAL, - CONSOLE_OUTPUT_ALL, + CONSOLE_OUTPUT_NONE = 0, + CONSOLE_OUTPUT_DISPLAY = 1 << 0, + CONSOLE_OUTPUT_TERMINAL = 1 << 1, + CONSOLE_OUTPUT_ALL = CONSOLE_OUTPUT_DISPLAY | CONSOLE_OUTPUT_TERMINAL, }; enum ConsoleAttr { @@ -42,7 +42,7 @@ struct ConsoleHead { s16 viewPosY; // at 0x1E u16 viewLines; // at 0x20 u8 isVisible; // at 0x22 - u8 padding_[1]; // at 0x23 + u8 PADDING[0x24 - 0x23]; // at 0x23 nw4r::ut::TextWriter* writer; // at 0x24 ConsoleHead* next; // at 0x28 }; @@ -52,10 +52,23 @@ struct ConsoleHead { // Public namespace alias typedef nw4r::db::detail::ConsoleHead* ConsoleHandle; -s32 Console_GetTotalLines(ConsoleHandle console); +ConsoleHandle Console_Create(void* pConsoleWork, u16 width, u16 height, + u16 viewLines, u16 priority, u16 attr); +ConsoleHandle Console_Destroy(ConsoleHandle console); +void Console_Clear(ConsoleHandle console); +void Console_DrawDirect(ConsoleHandle console); -void Console_VFPrintf(ConsoleOutputType type, ConsoleHandle console, +void Console_VFPrintf(ConsoleOutputType output, ConsoleHandle console, const char* pFmt, std::va_list argv); +void Console_FPrintf(ConsoleOutputType output, ConsoleHandle console, + const char* pFmt, ...); +void Console_Printf(ConsoleHandle console, const char* pFmt, ...); +void Console_PrintfD(ConsoleHandle console, const char* pFmt, ...); +void Console_PrintfT(ConsoleHandle console, const char* pFmt, ...); + +void Console_ChangePriority(ConsoleHandle console, u16 priority); + +s32 Console_GetTotalLines(ConsoleHandle console); static inline void Console_VPrintf(ConsoleHandle console, const char* pFmt, std::va_list argv) { diff --git a/include/nw4r/db/db_directPrint.h b/include/nw4r/db/db_directPrint.h index 1804acbe..d296ff15 100644 --- a/include/nw4r/db/db_directPrint.h +++ b/include/nw4r/db/db_directPrint.h @@ -5,6 +5,10 @@ #include +#define NW4R_DB_FONT_CHAR_WIDTH 6 +#define NW4R_DB_FONT_CHAR_HEIGHT 7 +#define NW4R_DB_FONT_LEADING 10 + namespace nw4r { namespace db { diff --git a/include/nw4r/ut/ut_TextWriterBase.h b/include/nw4r/ut/ut_TextWriterBase.h index a7636af7..c592c8d7 100644 --- a/include/nw4r/ut/ut_TextWriterBase.h +++ b/include/nw4r/ut/ut_TextWriterBase.h @@ -2,11 +2,10 @@ #define NW4R_UT_TEXT_WRITER_BASE_H #include +#include #include #include -#include - #include #include @@ -107,6 +106,7 @@ template class TextWriterBase : public CharWriter { int VSNPrintf(T* buffer, u32 count, const T* pStr, std::va_list args); f32 VPrintf(const T* pStr, std::va_list args); + f32 Printf(const T* pStr, ...); f32 Print(const T* pStr, int len); static T* GetBuffer() { diff --git a/src/nw4r/db/db_console.cpp b/src/nw4r/db/db_console.cpp index 0927697e..371f0a89 100644 --- a/src/nw4r/db/db_console.cpp +++ b/src/nw4r/db/db_console.cpp @@ -1,8 +1,21 @@ #include +#include + +#include + +#define DEFAULT_VIEW_X 30 +#define DEFAULT_VIEW_Y 50 + namespace nw4r { namespace db { +/****************************************************************************** + * + * Text utilities + * + ******************************************************************************/ + static u8* GetTextPtr_(ConsoleHandle console, u16 line, u16 x) { return console->textBuf + x + (console->width + 1) * line; } @@ -34,10 +47,412 @@ static void TerminateLine_(ConsoleHandle console) { *GetTextPtr_(console, console->printTop, console->printXPos) = '\0'; } +static const u8* SearchEndOfLine_(const u8* pStr) { + while (*pStr != '\n' && *pStr != '\0') { + pStr++; + } + + return pStr; +} + static u32 GetTabSize_(ConsoleHandle console) { s32 tab = (console->attr & (CONSOLE_ATTR_2 | CONSOLE_ATTR_3)) >> 2; return 2 << tab; } +static u8* PutTab_(ConsoleHandle console, u8* pDst) { + u32 width = GetTabSize_(console); + + do { + *pDst++ = ' '; + console->printXPos += 1; + + if (console->printXPos >= console->width) { + break; + } + } while ((console->printXPos & (width - 1)) != 0); + + return pDst; +} + +static u32 CodeWidth_(const u8* pPtr) { + return *pPtr >= 0x81 ? 2 : 1; +} + +static u32 PutChar_(ConsoleHandle console, const u8* pSrc, u8* pDst) { + u32 width = CodeWidth_(pSrc); + + if (console->printXPos + width > console->width) { + return 0; + } + + console->printXPos += width; + + u32 remain = width; + while (remain > 0) { + *pDst++ = *pSrc++; + remain--; + } + + return width; +} + +/****************************************************************************** + * + * Console + * + ******************************************************************************/ + +static ConsoleHandle sConsoleList = NULL; +static OSMutex sMutex; +static bool sInitialized = false; + +static u16 GetRingUsedLines_(ConsoleHandle console) { + NW4R_NULL_ASSERT(console); + + s32 lines = console->printTop - console->printTopUsed; + if (lines < 0) { + lines += console->height; + } + + return static_cast(lines); +} + +static u16 GetActiveLines_(ConsoleHandle console) { + u16 lines = GetRingUsedLines_(console); + + if (console->printXPos > 0) { + lines++; + } + + return lines; +} + +static ConsoleHandle SearchConsoleFromListByPriority_(u16 priority) { + ConsoleHandle console = sConsoleList; + + if (console == NULL || console->priority < priority) { + return NULL; + } + + for (; console->next != NULL; console = console->next) { + if (console->next->priority < priority) { + return console; + } + } + + return console; +} + +static void AppendConsoleToList(ConsoleHandle console) { + NW4R_NULL_ASSERT(console); + + OSLockMutex(&sMutex); + + ConsoleHandle it = SearchConsoleFromListByPriority_(console->priority); + + if (it == NULL) { + console->next = sConsoleList; + sConsoleList = console; + } else { + console->next = it->next; + it->next = console; + } + + OSUnlockMutex(&sMutex); +} + +static void RemoveConsoleFromList(ConsoleHandle console) DECOMP_DONT_INLINE { + NW4R_NULL_ASSERT(console); + + OSLockMutex(&sMutex); + + ConsoleHandle it = sConsoleList; + + if (it == console) { + sConsoleList = console->next; + console->next = NULL; + goto _cleanup; + } + + for (; it->next != NULL; it = it->next) { + if (it->next == console) { + it->next = console->next; + console->next = NULL; + goto _cleanup; + } + } + + OS_ERROR("illegal console handle"); + // OS_ERROR(LINE(386), "illegal console handle"); + +_cleanup: + OSUnlockMutex(&sMutex); +} + +ConsoleHandle Console_Create(void* pConsoleWork, u16 width, u16 height, + u16 viewLines, u16 priority, u16 attr) { + NW4R_ASSERT(width > 0); + NW4R_ASSERT(height > 0); + + if (!sInitialized) { + OSInitMutex(&sMutex); + sInitialized = true; + } + + ConsoleHandle console = static_cast(pConsoleWork); + + console->textBuf = + static_cast(pConsoleWork) + sizeof(detail::ConsoleHead); + + console->width = width; + console->height = height; + console->priority = priority; + console->attr = attr; + console->isVisible = false; + console->printTop = 0; + console->printXPos = 0; + console->printTopUsed = 0; + console->ringTop = 0; + console->ringTopLineCnt = 0; + console->viewTopLine = 0; + console->viewPosX = DEFAULT_VIEW_X; + console->viewPosY = DEFAULT_VIEW_Y; + console->viewLines = viewLines; + console->writer = NULL; + + Console_Clear(console); + AppendConsoleToList(console); + + return console; +} + +ConsoleHandle Console_Destroy(ConsoleHandle console) { + NW4R_NULL_ASSERT(console); + + RemoveConsoleFromList(console); + return console; +} + +void Console_Clear(ConsoleHandle console) { + NW4R_NULL_ASSERT(console); + + OSLockMutex(&sMutex); + + console->printTop = 0; + console->printXPos = 0; + console->printTopUsed = 0; + console->ringTop = 0; + console->ringTopLineCnt = 0; + console->viewTopLine = 0; + + OSUnlockMutex(&sMutex); +} + +static void DoDrawString_(ConsoleHandle console, u32 line, const u8* pStr, + ut::TextWriter* pWriter) { + + if (pWriter != NULL) { + pWriter->Printf("%s\n", pStr); + } else { + s32 height = console->viewPosY + line * NW4R_DB_FONT_LEADING; + DirectPrint_DrawString(console->viewPosX, height, false, "%s\n", pStr); + } +} + +static void DoDrawConsole_(ConsoleHandle console, ut::TextWriter* pWriter) { + s32 viewOffset = console->viewTopLine - console->ringTopLineCnt; + u16 line; + u16 printLines = 0; + + if (viewOffset < 0) { + viewOffset = 0; + } else if (viewOffset > GetActiveLines_(console)) { + return; + } + + line = console->printTopUsed + viewOffset; + if (line >= console->height) { + line -= console->height; + } + + // if (line == console->printTop && console->printTopUsed == 0) { + // return; + // } + + while (printLines < console->viewLines) { + DoDrawString_(console, printLines, GetTextPtr_(console, line, 0), + pWriter); + + printLines++; + + if (line == console->printTop) { + break; + } + + line++; + + if (line == console->height) { + if (console->attr & CONSOLE_ATTR_1) { + break; + } + + line = 0; + } + } +} + +void Console_DrawDirect(ConsoleHandle console) { + NW4R_NULL_ASSERT(LINE(682), console); + + if (!DirectPrint_IsActive()) { + return; + } + + if (!console->isVisible) { + return; + } + + OSLockMutex(&sMutex); + + int width = console->width * NW4R_DB_FONT_CHAR_WIDTH + 12; + int height = console->viewLines * NW4R_DB_FONT_LEADING + 4; + + DirectPrint_EraseXfb(console->viewPosX - 6, console->viewPosY - 3, width, + height); + + DoDrawConsole_(console, NULL); + DirectPrint_StoreCache(); + + OSUnlockMutex(&sMutex); +} + +static void PrintToBuffer_(ConsoleHandle console, const u8* str) { + NW4R_NULL_ASSERT(LINE(806), console); + NW4R_NULL_ASSERT(LINE(807), str); + + u8* pDst; + bool newline; + u32 bytes; + + pDst = GetTextPtr_(console, console->printTop, console->printXPos); + + while (*str != '\0') { + if (console->attr & CONSOLE_ATTR_1 && + console->printTop == console->height) { + + break; + } + + while (*str != '\0') { + newline = false; + + if (*str == '\n') { + str++; + pDst = NextLine_(console); + break; + } else if (*str == '\t') { + str++; + pDst = PutTab_(console, pDst); + } else { + bytes = PutChar_(console, str, pDst); + + if (bytes > 0) { + str += bytes; + pDst += bytes; + } else { + newline = true; + } + } + + if (console->printTop >= console->width) { + newline = true; + } + + if (newline) { + if (console->attr & CONSOLE_ATTR_0) { + str = SearchEndOfLine_(str); + } else { + if (*str == '\n') { + str++; + } + + pDst = NextLine_(console); + } + break; + } + } + } +} + +static void Console_PrintString_(ConsoleOutputType output, + ConsoleHandle console, const u8* pStr) { + + NW4R_NULL_ASSERT(LINE(909), console); + + if (output & CONSOLE_OUTPUT_TERMINAL) { + OSReport("%s", pStr); + } + + if (output & CONSOLE_OUTPUT_DISPLAY) { + PrintToBuffer_(console, pStr); + } +} + +void Console_VFPrintf(ConsoleOutputType output, ConsoleHandle console, + const char* pFmt, std::va_list argv) { + + NW4R_NULL_ASSERT(LINE(941), console); + + OSLockMutex(&sMutex); + + static u8 sStrBuf[1024]; + std::vsnprintf(reinterpret_cast(sStrBuf), sizeof(sStrBuf), pFmt, + argv); + + Console_PrintString_(output, console, sStrBuf); + + OSUnlockMutex(&sMutex); +} + +void Console_FPrintf(ConsoleOutputType output, ConsoleHandle console, + const char* pFmt, ...) { + std::va_list argv; + va_start(argv, pFmt); + Console_VFPrintf(output, console, pFmt, argv); + va_end(argv); +} + +void Console_Printf(ConsoleHandle console, const char* pFmt, ...) { + std::va_list argv; + va_start(argv, pFmt); + Console_VFPrintf(CONSOLE_OUTPUT_ALL, console, pFmt, argv); + va_end(argv); +} + +void Console_PrintfD(ConsoleHandle console, const char* pFmt, ...) { + std::va_list argv; + va_start(argv, pFmt); + Console_VFPrintf(CONSOLE_OUTPUT_DISPLAY, console, pFmt, argv); + va_end(argv); +} + +void Console_PrintfT(ConsoleHandle console, const char* pFmt, ...) { + std::va_list argv; + va_start(argv, pFmt); + Console_VFPrintf(CONSOLE_OUTPUT_TERMINAL, console, pFmt, argv); + va_end(argv); +} + +s32 Console_GetTotalLines(ConsoleHandle console) { + NW4R_NULL_ASSERT(LINE(1128), console); + + OSLockMutex(&sMutex); + s32 count = console->ringTopLineCnt + GetActiveLines_(console); + OSUnlockMutex(&sMutex); + + return count; +} + } // namespace db } // namespace nw4r diff --git a/src/nw4r/db/db_directPrint.cpp b/src/nw4r/db/db_directPrint.cpp index 4390cd19..1c284f61 100644 --- a/src/nw4r/db/db_directPrint.cpp +++ b/src/nw4r/db/db_directPrint.cpp @@ -10,10 +10,6 @@ #define DEFAULT_WIDTH 640 #define DEFAULT_HEIGHT 480 -#define FONT_CHAR_WIDTH 6 -#define FONT_CHAR_HEIGHT 7 -#define FONT_LEADING 10 - #define TAB_SIZE 4 namespace nw4r { @@ -90,11 +86,11 @@ static const u32 sFontData2[] = { 0xF8000000, 0x10000000, 0x20000000, 0x40000000, 0xF8000000, }; -static inline int GetDotHeight_() { +static int GetDotHeight_() { return sFrameBufferInfo.frameHeight < 300 ? 1 : 2; } -static inline int GetDotWidth_() { +static int GetDotWidth_() { return sFrameBufferInfo.frameWidth < 400 ? 1 : 2; } @@ -285,8 +281,8 @@ static void DrawCharToXfb_(int x, int y, int code) { // Convert to font-relative code int ncode = code >= 100 ? code - 100 : code; - int fontW = ncode % 5 * FONT_CHAR_WIDTH; - int fontH = ncode / 5 * FONT_CHAR_HEIGHT; + int fontW = ncode % 5 * NW4R_DB_FONT_CHAR_WIDTH; + int fontH = ncode / 5 * NW4R_DB_FONT_CHAR_HEIGHT; const u32* pFontLine = code < 100 ? &sFontData[fontH] : &sFontData2[fontH]; int dotW = GetDotWidth_(); @@ -300,12 +296,12 @@ static void DrawCharToXfb_(int x, int y, int code) { return; } - if (sFrameBufferInfo.frameWidth <= dotW * (x + FONT_CHAR_WIDTH) || - sFrameBufferInfo.frameHeight <= dotH * (y + FONT_CHAR_HEIGHT)) { + if (sFrameBufferInfo.frameWidth <= dotW * (x + NW4R_DB_FONT_CHAR_WIDTH) || + sFrameBufferInfo.frameHeight <= dotH * (y + NW4R_DB_FONT_CHAR_HEIGHT)) { return; } - for (int countY = 0; countY < FONT_CHAR_HEIGHT; countY++) { + for (int countY = 0; countY < NW4R_DB_FONT_CHAR_HEIGHT; countY++) { u32 fontBits = *pFontLine++ << fontW; if (dotW == 1) { @@ -317,7 +313,8 @@ static void DrawCharToXfb_(int x, int y, int code) { << 19; } - for (int countX = 0; countX < dotW * FONT_CHAR_WIDTH; countX += 2) { + for (int countX = 0; countX < dotW * NW4R_DB_FONT_CHAR_WIDTH; + countX += 2) { u16 color; // clang-format off @@ -350,7 +347,8 @@ static void DrawCharToXfb_(int x, int y, int code) { fontBits <<= 2; } - pPixel += (sFrameBufferInfo.frameRow * dotH) - (dotW * FONT_CHAR_WIDTH); + pPixel += (sFrameBufferInfo.frameRow * dotH) - + (dotW * NW4R_DB_FONT_CHAR_WIDTH); } } @@ -375,7 +373,7 @@ static const char* DrawStringLineToXfb_(int x, int y, const char* str, // Tab character if (code == 0xFD) { int tabSize = TAB_SIZE - (count & (TAB_SIZE - 1)); - x += tabSize * FONT_CHAR_WIDTH; + x += tabSize * NW4R_DB_FONT_CHAR_WIDTH; count += tabSize; } else { // Non-tab character @@ -384,7 +382,7 @@ static const char* DrawStringLineToXfb_(int x, int y, const char* str, } // 0xFF is treated as whitespace - x += FONT_CHAR_WIDTH; + x += NW4R_DB_FONT_CHAR_WIDTH; count++; } @@ -416,12 +414,13 @@ static void DrawStringToXfb_(int x, int y, const char* pStr, bool turnOver, while (*pStr != '\0') { if (backErase) { int len = StrLineWidth_(pStr); - DirectPrint_EraseXfb(x - 6, y - 3, (len + 2) * 6, 13); + DirectPrint_EraseXfb(x - 6, y - 3, + (len + 2) * NW4R_DB_FONT_CHAR_WIDTH, 13); } - width = (fbWidth - x) / FONT_CHAR_WIDTH; + width = (fbWidth - x) / NW4R_DB_FONT_CHAR_WIDTH; pStr = DrawStringLineToXfb_(x, y, pStr, width); - y += FONT_LEADING; + y += NW4R_DB_FONT_LEADING; if (*pStr == '\n') { pStr++; diff --git a/src/nw4r/ut/ut_TextWriterBase.cpp b/src/nw4r/ut/ut_TextWriterBase.cpp index c2080b5b..ace89c61 100644 --- a/src/nw4r/ut/ut_TextWriterBase.cpp +++ b/src/nw4r/ut/ut_TextWriterBase.cpp @@ -28,6 +28,23 @@ template f32 TextWriterBase::GetLineHeight() const { return mLineSpace + GetScaleV() * lf; } +template f32 TextWriterBase::Printf(const T* pStr, ...) { + T* pBuffer; + + if (mFormatBuffer != NULL) { + pBuffer = mFormatBuffer; + } else { + pBuffer = static_cast(__alloca(mFormatBufferSize)); + } + + std::va_list args; + va_start(args, pStr); + f32 width = VPrintf(pBuffer, args); + va_end(args); + + return width; +} + template f32 TextWriterBase::VPrintf(const T* pStr, std::va_list args) { T* pBuffer; From 962aa337667a86af8c8a7bf0647e6640c684aa36 Mon Sep 17 00:00:00 2001 From: kiwi515 <49212064+kiwi515@users.noreply.github.com> Date: Fri, 2 Oct 2026 22:52:46 -0400 Subject: [PATCH 06/12] db_console OK --- config/RSPE01_00/splits.txt | 1 + configure.py | 2 +- include/decomp/assertion.h | 5 +++++ include/revolution/OS/OSError.h | 7 +++++++ src/nw4r/db/db_console.cpp | 30 ++++++++++++++++-------------- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/config/RSPE01_00/splits.txt b/config/RSPE01_00/splits.txt index 69d60e18..2510dfd3 100644 --- a/config/RSPE01_00/splits.txt +++ b/config/RSPE01_00/splits.txt @@ -195,6 +195,7 @@ nw4r/db/db_console.cpp: .text start:0x80049D5C end:0x8004A630 .data start:0x80360260 end:0x80360288 .bss start:0x803ADB38 end:0x803ADF50 + .sdata start:0x804DDB70 end:0x804DDB78 .sbss start:0x804DF1F0 end:0x804DF1F8 nw4r/db/db_exception.cpp: diff --git a/configure.py b/configure.py index c22f2f06..919efa54 100755 --- a/configure.py +++ b/configure.py @@ -739,7 +739,7 @@ def MatchingFor(*versions): "progress_category": "nw4r", "objects": [ Object(NonMatching, "nw4r/db/db_directPrint.cpp"), - Object(NonMatching, "nw4r/db/db_console.cpp"), + Object(Matching, "nw4r/db/db_console.cpp"), Object(NonMatching, "nw4r/db/db_exception.cpp"), ] }, diff --git a/include/decomp/assertion.h b/include/decomp/assertion.h index c59735a9..d759013f 100644 --- a/include/decomp/assertion.h +++ b/include/decomp/assertion.h @@ -53,6 +53,11 @@ */ #define LINES(no1, ...) (AA_LINES, (no1, __VA_ARGS__)) +/** + * @brief Dummy macro available for when line number tuples are not supported + */ +#define LINES_DUMMY(...) ~ + /****************************************************************************** * * Utility macros diff --git a/include/revolution/OS/OSError.h b/include/revolution/OS/OSError.h index e566a7b5..ee606079 100644 --- a/include/revolution/OS/OSError.h +++ b/include/revolution/OS/OSError.h @@ -1,6 +1,9 @@ #ifndef RVL_SDK_OS_ERROR_H #define RVL_SDK_OS_ERROR_H #include + +#include + #ifdef __cplusplus extern "C" { #endif @@ -8,8 +11,12 @@ extern "C" { // Forward declarations typedef struct OSContext OSContext; +// TODO(kiwi) Switch over OS_ERROR uses to OS_PANIC #define OS_ERROR(...) OSPanic(__FILE__, __LINE__, __VA_ARGS__) +#define OS_PANIC(...) DECOMP_ASSERT(OS_PANIC_IMPL, LINES_DUMMY, __VA_ARGS__) +#define OS_PANIC_IMPL(file, line, ...) OSPanic(file, line, __VA_ARGS__) + #define OS_ASSERT(exp, ...) \ if (!(exp)) \ OSPanic(__FILE__, __LINE__, __VA_ARGS__) diff --git a/src/nw4r/db/db_console.cpp b/src/nw4r/db/db_console.cpp index 371f0a89..e244f869 100644 --- a/src/nw4r/db/db_console.cpp +++ b/src/nw4r/db/db_console.cpp @@ -25,6 +25,7 @@ static u8* NextLine_(ConsoleHandle console) { console->printXPos = 0; console->printTop++; + console->printTopUsed = 0; if (console->printTop == console->height && !(console->attr & CONSOLE_ATTR_1)) { @@ -32,11 +33,11 @@ static u8* NextLine_(ConsoleHandle console) { console->printTop = 0; } - if (console->printTop == console->printTopUsed) { + if (console->printTop == console->ringTop) { console->ringTopLineCnt++; - if (++console->printTopUsed == console->height) { - console->printTopUsed = 0; + if (++console->ringTop == console->height) { + console->ringTop = 0; } } @@ -110,7 +111,7 @@ static bool sInitialized = false; static u16 GetRingUsedLines_(ConsoleHandle console) { NW4R_NULL_ASSERT(console); - s32 lines = console->printTop - console->printTopUsed; + s32 lines = console->printTop - console->ringTop; if (lines < 0) { lines += console->height; } @@ -121,7 +122,7 @@ static u16 GetRingUsedLines_(ConsoleHandle console) { static u16 GetActiveLines_(ConsoleHandle console) { u16 lines = GetRingUsedLines_(console); - if (console->printXPos > 0) { + if (console->printTopUsed > 0) { lines++; } @@ -183,8 +184,7 @@ static void RemoveConsoleFromList(ConsoleHandle console) DECOMP_DONT_INLINE { } } - OS_ERROR("illegal console handle"); - // OS_ERROR(LINE(386), "illegal console handle"); + OS_PANIC(LINE(332), "illegal console handle"); _cleanup: OSUnlockMutex(&sMutex); @@ -271,16 +271,16 @@ static void DoDrawConsole_(ConsoleHandle console, ut::TextWriter* pWriter) { return; } - line = console->printTopUsed + viewOffset; + line = console->ringTop + viewOffset; if (line >= console->height) { line -= console->height; } - // if (line == console->printTop && console->printTopUsed == 0) { - // return; - // } + do { + if (line == console->printTop && console->printTopUsed == 0) { + break; + } - while (printLines < console->viewLines) { DoDrawString_(console, printLines, GetTextPtr_(console, line, 0), pWriter); @@ -299,7 +299,7 @@ static void DoDrawConsole_(ConsoleHandle console, ut::TextWriter* pWriter) { line = 0; } - } + } while (printLines < console->viewLines); } void Console_DrawDirect(ConsoleHandle console) { @@ -354,18 +354,20 @@ static void PrintToBuffer_(ConsoleHandle console, const u8* str) { } else if (*str == '\t') { str++; pDst = PutTab_(console, pDst); + console->printTopUsed = 1; } else { bytes = PutChar_(console, str, pDst); if (bytes > 0) { str += bytes; pDst += bytes; + console->printTopUsed = 1; } else { newline = true; } } - if (console->printTop >= console->width) { + if (console->printXPos >= console->width) { newline = true; } From df3dbb2afbee55dd9acbb172641b7849faf8e2f8 Mon Sep 17 00:00:00 2001 From: kiwi515 <49212064+kiwi515@users.noreply.github.com> Date: Sat, 3 Oct 2026 00:34:16 -0400 Subject: [PATCH 07/12] idk --- include/decomp/assertion.h | 101 +++++++++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 28 deletions(-) diff --git a/include/decomp/assertion.h b/include/decomp/assertion.h index d759013f..730002e3 100644 --- a/include/decomp/assertion.h +++ b/include/decomp/assertion.h @@ -9,6 +9,61 @@ #ifndef DECOMP_ASSERTION_H #define DECOMP_ASSERTION_H +// clang-format off +// +// >> Description << +// +// The DECOMP_ASSERT provides a way for matching builds to force arbitrary line numbers, +// without needing intrusive changes, such as "_LINE" variations of every assertion macro. +// +// If a specific line number is desired, use the LINE(no) macro to force it. +// This macro must be the first argument of the assertion to be recognized. +// +// Additionally, the LINES(...) macro provided in this header allows for a single assertion +// to take different line numbers based on the build configuration. +// +// In nonmatching builds, the LINE family of macros is ignored for accuracy. +// DECOMP_ASSERT will instead provide the true source location. +// +// >> Parameters << +// +// The 'assert_impl' parameter is the name of the assertion implementation. +// It must be a function-like macro that accepts at least the following parameters: (file, line, str_expr). +// - file: The name of the source file where the macro was expanded. +// +// - line: The location in the source file where the macro was expanded. +// The LINE/LINES macros are provided to override this value. +// +// - str_expr: The first non-LINE argument in stringitized form. +// This is required to avoid macro expansion which may break matching code, +// such as NULL expanding to "0". +// +// The 'lines_impl' parameter is the name of the line tuple evaluator. +// It must be a function-like macro that accepts multiple line numbers. +// It is responsible for picking the correct line number, often based on the build configuration. +// +// For code where this feature should be disabled, specify LINES_DUMMY. +// Doing so will cause LINES(...) to produce a syntax error. +// +// >> Example << +// +// // keep DECOMP_ASSERT on the same line to stay accurate in non-matching builds! +// #define MY_ASSERT(...) DECOMP_ASSERT(MY_ASSERT_IMPL, MY_LINES, __VA_ARGS__) +// +// #define MY_ASSERT_IMPL(file, line, str_expr, expr) \ +// if (!expr) { Panic("Assertion failed: %s", str_expr); } +// +// // choose Rev 1 line number for this build +// #define MY_LINES(rev0, rev1) rev1 +// +// MY_ASSERT(LINE(123), p != NULL) expands to: +// MY_ASSERT_IMPL("code.cpp", 123, "p != NULL", p != 0) +// +// MY_ASSERT(LINES(200, 300), p != NULL, "Pointer is NULL") expands to: +// MY_ASSERT_IMPL("code.cpp", 300, "p != NULL", p != 0, "Pointer is NULL") +// +// clang-format on + /****************************************************************************** * * Public macros @@ -17,28 +72,11 @@ /** * @brief Performs a runtime assertion - * - * The 'assert_macro' parameter must be the name of the assertion - * implementation. - - * Arguments are passed to 'assert_macro' in the following - * order: (file, line, ...). - * - * The 'lines_macro' parameter must be the name of the line tuple evaluator. - * - * Example: - * #define MY_ASSERT \ - * DECOMP_ASSERT(MY_ASSERT_IMPL, MY_LINES, __VA_ARGS__) - * - * #define MY_ASSERT_IMPL(file, line, expr) \ - * if (!expr) { Panic("Assertion failed: %s", #expr); } - * - * // choose Rev 1 line number - * #define MY_LINES(rev0, rev1) rev1 */ -#define DECOMP_ASSERT(assert_macro, lines_macro, ...) \ - AA_FWD(assert_macro, \ - AA_EVAL_ARGS(lines_macro, __LINE__, __VA_ARGS__, AA_DUMMY)) +// clang-format off +// The formatting looks weird, but we need to get the correct source location! +#define DECOMP_ASSERT(assert_impl, lines_impl, ...) AA_FWD(assert_impl, AA_EVAL_ARGS(__LINE__, lines_impl, __VA_ARGS__, AA_DUMMY)) +// clang-format on /** * @brief Forces a specific source line number in an assertion @@ -64,6 +102,13 @@ * ******************************************************************************/ +/** + * @brief Stringitizes a token + * @details Macro expansion is often required, so the argument is forwarded. + */ +#define AA_STR(x) AA_STR_IMPL(x) +#define AA_STR_IMPL(x) #x + /** * @brief Concatenates two tokens * @details Macro expansion is often required, so the arguments are forwarded. @@ -77,8 +122,8 @@ #define AA_FWD(macro, tuple) macro tuple /** - * @brief Grabs the specified tuple element - * @note Dummy arguments make sure the tuple is always large enough. + * @brief Grabs the specified variadic argument + * @note Dummy arguments make sure the argument list is always large enough. */ #define AA_1ST_IMPL(first, ...) first #define AA_1ST(...) AA_1ST_IMPL(__VA_ARGS__, ~) @@ -168,7 +213,7 @@ * Otherwise, this macro uses the hardcoded line number. */ // clang-format off -#define AA_EVAL_ARGS(lines_macro, real_line, first, ...) \ +#define AA_EVAL_ARGS(real_line, lines_impl, first, ...) \ AA_IF( \ /* Test for a valid LINE tag. */ \ AA_IS_TAG(first), \ @@ -206,11 +251,11 @@ */ // clang-format off #if defined(NONMATCHING) -#define AA_EVAL_TAG(lines_macro, real_line, tuple) real_line +#define AA_EVAL_TAG(lines_impl, real_line, tuple) real_line #else -#define AA_EVAL_TAG(lines_macro, real_line, tuple) AA_CAT(AA_EVAL_TAG_, AA_1ST tuple)(lines_macro, tuple) -#define AA_EVAL_TAG_AA_LINE(lines_macro, tuple) AA_2ND tuple -#define AA_EVAL_TAG_AA_LINES(lines_macro, tuple) AA_FWD(lines_macro, AA_2ND tuple) +#define AA_EVAL_TAG(lines_impl, real_line, tuple) AA_CAT(AA_EVAL_TAG_, AA_1ST tuple)(lines_impl, tuple) +#define AA_EVAL_TAG_AA_LINE(lines_impl, tuple) AA_2ND tuple +#define AA_EVAL_TAG_AA_LINES(lines_impl, tuple) AA_FWD(lines_impl, AA_2ND tuple) #endif // clang-format on From 17cafe3aec6f76bd4b349d36106f4491f839796a Mon Sep 17 00:00:00 2001 From: Kiwi <49212064+kiwi515@users.noreply.github.com> Date: Sat, 3 Oct 2026 09:38:38 -0400 Subject: [PATCH 08/12] document console attributes --- include/nw4r/db/db_console.h | 9 ++++----- src/nw4r/db/db_console.cpp | 15 +++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/nw4r/db/db_console.h b/include/nw4r/db/db_console.h index 46570087..6a1ebc46 100644 --- a/include/nw4r/db/db_console.h +++ b/include/nw4r/db/db_console.h @@ -17,11 +17,10 @@ enum ConsoleOutputType { }; enum ConsoleAttr { - CONSOLE_ATTR_0 = 1 << 0, - CONSOLE_ATTR_1 = 1 << 1, - CONSOLE_ATTR_2 = 1 << 2, - CONSOLE_ATTR_3 = 1 << 3, - CONSOLE_ATTR_4 = 1 << 4, + CONSOLE_ATTR_NO_WRAP = 1 << 0, + CONSOLE_ATTR_NO_OVERFLOW = 1 << 1, + CONSOLE_ATTR_INDENT4 = 1 << 2, + CONSOLE_ATTR_INDENT8 = 1 << 3, }; namespace detail { diff --git a/src/nw4r/db/db_console.cpp b/src/nw4r/db/db_console.cpp index e244f869..3f28d174 100644 --- a/src/nw4r/db/db_console.cpp +++ b/src/nw4r/db/db_console.cpp @@ -28,7 +28,7 @@ static u8* NextLine_(ConsoleHandle console) { console->printTopUsed = 0; if (console->printTop == console->height && - !(console->attr & CONSOLE_ATTR_1)) { + !(console->attr & CONSOLE_ATTR_NO_OVERFLOW)) { console->printTop = 0; } @@ -57,7 +57,9 @@ static const u8* SearchEndOfLine_(const u8* pStr) { } static u32 GetTabSize_(ConsoleHandle console) { - s32 tab = (console->attr & (CONSOLE_ATTR_2 | CONSOLE_ATTR_3)) >> 2; + s32 tab = + (console->attr & (CONSOLE_ATTR_INDENT4 | CONSOLE_ATTR_INDENT8)) >> 2; + return 2 << tab; } @@ -192,9 +194,6 @@ static void RemoveConsoleFromList(ConsoleHandle console) DECOMP_DONT_INLINE { ConsoleHandle Console_Create(void* pConsoleWork, u16 width, u16 height, u16 viewLines, u16 priority, u16 attr) { - NW4R_ASSERT(width > 0); - NW4R_ASSERT(height > 0); - if (!sInitialized) { OSInitMutex(&sMutex); sInitialized = true; @@ -293,7 +292,7 @@ static void DoDrawConsole_(ConsoleHandle console, ut::TextWriter* pWriter) { line++; if (line == console->height) { - if (console->attr & CONSOLE_ATTR_1) { + if (console->attr & CONSOLE_ATTR_NO_OVERFLOW) { break; } @@ -338,7 +337,7 @@ static void PrintToBuffer_(ConsoleHandle console, const u8* str) { pDst = GetTextPtr_(console, console->printTop, console->printXPos); while (*str != '\0') { - if (console->attr & CONSOLE_ATTR_1 && + if (console->attr & CONSOLE_ATTR_NO_OVERFLOW && console->printTop == console->height) { break; @@ -372,7 +371,7 @@ static void PrintToBuffer_(ConsoleHandle console, const u8* str) { } if (newline) { - if (console->attr & CONSOLE_ATTR_0) { + if (console->attr & CONSOLE_ATTR_NO_WRAP) { str = SearchEndOfLine_(str); } else { if (*str == '\n') { From df4a56bc029145f6b8695d1a92ddf2a18a9d0a6b Mon Sep 17 00:00:00 2001 From: Kiwi <49212064+kiwi515@users.noreply.github.com> Date: Sat, 3 Oct 2026 09:42:11 -0400 Subject: [PATCH 09/12] Update db_console.h --- include/nw4r/db/db_console.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/nw4r/db/db_console.h b/include/nw4r/db/db_console.h index 6a1ebc46..a3063d43 100644 --- a/include/nw4r/db/db_console.h +++ b/include/nw4r/db/db_console.h @@ -65,8 +65,6 @@ void Console_Printf(ConsoleHandle console, const char* pFmt, ...); void Console_PrintfD(ConsoleHandle console, const char* pFmt, ...); void Console_PrintfT(ConsoleHandle console, const char* pFmt, ...); -void Console_ChangePriority(ConsoleHandle console, u16 priority); - s32 Console_GetTotalLines(ConsoleHandle console); static inline void Console_VPrintf(ConsoleHandle console, const char* pFmt, From fdbfed621e1d9c373e8fb2ba2576fffefbfe3265 Mon Sep 17 00:00:00 2001 From: Kiwi <49212064+kiwi515@users.noreply.github.com> Date: Wed, 7 Oct 2026 12:57:32 -0400 Subject: [PATCH 10/12] temp --- config/RSPE01_00/splits.txt | 2 + config/RSPE01_00/symbols.txt | 935 ++++++++++++------------ configure.py | 10 +- include/nw4r/config.h | 12 + include/nw4r/db.h | 1 + include/nw4r/db/db_assert.h | 40 +- include/nw4r/db/db_console.h | 49 +- include/nw4r/db/db_exception.h | 92 +-- include/nw4r/db/db_mapFile.h | 32 + include/nw4r/snd/snd_BankFile.h | 4 +- include/nw4r/snd/snd_RemoteSpeaker.h | 2 +- include/nw4r/snd/snd_SeqFile.h | 2 +- include/nw4r/snd/snd_SoundArchiveFile.h | 4 +- include/nw4r/snd/snd_SoundThread.h | 6 +- include/nw4r/snd/snd_StrmFile.h | 4 +- include/nw4r/snd/snd_WsdFile.h | 6 +- include/nw4r/types_nw4r.h | 2 +- include/revolution/OS/OSAlarm.h | 9 +- include/revolution/OS/OSCache.h | 2 - include/revolution/OS/OSError.h | 43 +- include/revolution/OS/OSLink.h | 20 + include/revolution/OS/OSMemory.h | 14 + include/revolution/OS/OSTime.h | 14 +- src/nw4r/db/db_assert.cpp | 217 ++++++ src/nw4r/db/db_console.cpp | 10 +- src/nw4r/db/db_directPrint.cpp | 249 ++++--- src/nw4r/db/db_exception.cpp | 606 +++++++++++---- src/nw4r/db/db_mapFile.cpp | 403 ++++++++++ src/nw4r/g3d/res/g3d_resanmchr.cpp | 4 +- src/nw4r/snd/snd_BankFile.cpp | 2 +- src/nw4r/snd/snd_SeqFile.cpp | 2 +- src/nw4r/snd/snd_SoundArchiveFile.cpp | 14 +- src/nw4r/snd/snd_SoundSystem.cpp | 2 +- src/nw4r/snd/snd_SoundThread.cpp | 2 +- src/nw4r/snd/snd_StrmFile.cpp | 2 +- src/nw4r/snd/snd_WsdFile.cpp | 10 +- src/nw4r/ut/ut_ResFont.cpp | 9 +- src/revolution/OS/OSAlarm.c | 16 +- src/revolution/OS/OSCache.c | 4 +- src/revolution/OS/OSContext.c | 2 +- src/revolution/OS/OSError.c | 42 +- src/revolution/OS/OSFatal.c | 2 +- src/revolution/OS/OSInterrupt.c | 3 +- src/revolution/OS/OSMemory.c | 7 +- src/revolution/OS/OSThread.c | 2 +- src/revolution/OS/OSTime.c | 10 +- 46 files changed, 2017 insertions(+), 908 deletions(-) create mode 100644 include/nw4r/db/db_mapFile.h create mode 100644 src/nw4r/db/db_assert.cpp create mode 100644 src/nw4r/db/db_mapFile.cpp diff --git a/config/RSPE01_00/splits.txt b/config/RSPE01_00/splits.txt index 2510dfd3..f556480f 100644 --- a/config/RSPE01_00/splits.txt +++ b/config/RSPE01_00/splits.txt @@ -202,7 +202,9 @@ nw4r/db/db_exception.cpp: .text start:0x8004A630 end:0x8004B4AC .data start:0x80360288 end:0x80360860 .bss start:0x803ADF50 end:0x803B22C0 + .sdata start:0x804DDB78 end:0x804DDBB0 .sbss start:0x804DF1F8 end:0x804DF200 + .sdata2 start:0x804E0750 end:0x804E0758 nw4r/g3d/res/g3d_rescommon.cpp: .text start:0x8004B4AC end:0x8004B5FC diff --git a/config/RSPE01_00/symbols.txt b/config/RSPE01_00/symbols.txt index a5d46b73..ba543467 100644 --- a/config/RSPE01_00/symbols.txt +++ b/config/RSPE01_00/symbols.txt @@ -76,22 +76,22 @@ _bss_init_info = .init:0x800064B0; // type:object size:0x20 scope:global data:4b @etb_800066C8 = extab:0x800066C8; // type:object size:0x8 scope:local hidden @etb_800066D0 = extab:0x800066D0; // type:object size:0x8 scope:local hidden @etb_800066D8 = extab:0x800066D8; // type:object size:0x8 scope:local hidden -@etb_800066E0 = extab:0x800066E0; // type:object size:0x8 scope:local hidden -@etb_800066E8 = extab:0x800066E8; // type:object size:0x8 scope:local hidden -@etb_800066F0 = extab:0x800066F0; // type:object size:0x8 scope:local hidden -@etb_800066F8 = extab:0x800066F8; // type:object size:0x8 scope:local hidden -@etb_80006700 = extab:0x80006700; // type:object size:0x8 scope:local hidden -@etb_80006708 = extab:0x80006708; // type:object size:0x8 scope:local hidden -@etb_80006710 = extab:0x80006710; // type:object size:0x8 scope:local hidden -@etb_80006718 = extab:0x80006718; // type:object size:0x8 scope:local hidden -@etb_80006720 = extab:0x80006720; // type:object size:0x8 scope:local hidden -@etb_80006728 = extab:0x80006728; // type:object size:0x8 scope:local hidden -@etb_80006730 = extab:0x80006730; // type:object size:0x8 scope:local hidden -@etb_80006738 = extab:0x80006738; // type:object size:0x8 scope:local hidden -@etb_80006740 = extab:0x80006740; // type:object size:0x8 scope:local hidden -@etb_80006748 = extab:0x80006748; // type:object size:0x8 scope:local hidden -@etb_80006750 = extab:0x80006750; // type:object size:0x8 scope:local hidden -@etb_80006758 = extab:0x80006758; // type:object size:0x8 scope:local hidden +@3738 = extab:0x800066E0; // type:object size:0x8 scope:local hidden +@3787 = extab:0x800066E8; // type:object size:0x8 scope:local hidden +@3797 = extab:0x800066F0; // type:object size:0x8 scope:local hidden +@3808 = extab:0x800066F8; // type:object size:0x8 scope:local hidden +@3814 = extab:0x80006700; // type:object size:0x8 scope:local hidden +@3820 = extab:0x80006708; // type:object size:0x8 scope:local hidden +@3828 = extab:0x80006710; // type:object size:0x8 scope:local hidden +@3839 = extab:0x80006718; // type:object size:0x8 scope:local hidden +@3857 = extab:0x80006720; // type:object size:0x8 scope:local hidden +@3877 = extab:0x80006728; // type:object size:0x8 scope:local hidden +@3895 = extab:0x80006730; // type:object size:0x8 scope:local hidden +@3915 = extab:0x80006738; // type:object size:0x8 scope:local hidden +@3933 = extab:0x80006740; // type:object size:0x8 scope:local hidden +@3953 = extab:0x80006748; // type:object size:0x8 scope:local hidden +@3959 = extab:0x80006750; // type:object size:0x8 scope:local hidden +@3964 = extab:0x80006758; // type:object size:0x8 scope:local hidden @etb_80006760 = extab:0x80006760; // type:object size:0x8 scope:local hidden @etb_80006768 = extab:0x80006768; // type:object size:0x8 scope:local hidden @etb_80006770 = extab:0x80006770; // type:object size:0x8 scope:local hidden @@ -273,22 +273,22 @@ _bss_init_info = .init:0x800064B0; // type:object size:0x20 scope:global data:4b @eti_80006DEC = extabindex:0x80006DEC; // type:object size:0xC scope:local hidden @eti_80006DF8 = extabindex:0x80006DF8; // type:object size:0xC scope:local hidden @eti_80006E04 = extabindex:0x80006E04; // type:object size:0xC scope:local hidden -@eti_80006E10 = extabindex:0x80006E10; // type:object size:0xC scope:local hidden -@eti_80006E1C = extabindex:0x80006E1C; // type:object size:0xC scope:local hidden -@eti_80006E28 = extabindex:0x80006E28; // type:object size:0xC scope:local hidden -@eti_80006E34 = extabindex:0x80006E34; // type:object size:0xC scope:local hidden -@eti_80006E40 = extabindex:0x80006E40; // type:object size:0xC scope:local hidden -@eti_80006E4C = extabindex:0x80006E4C; // type:object size:0xC scope:local hidden -@eti_80006E58 = extabindex:0x80006E58; // type:object size:0xC scope:local hidden -@eti_80006E64 = extabindex:0x80006E64; // type:object size:0xC scope:local hidden -@eti_80006E70 = extabindex:0x80006E70; // type:object size:0xC scope:local hidden -@eti_80006E7C = extabindex:0x80006E7C; // type:object size:0xC scope:local hidden -@eti_80006E88 = extabindex:0x80006E88; // type:object size:0xC scope:local hidden -@eti_80006E94 = extabindex:0x80006E94; // type:object size:0xC scope:local hidden -@eti_80006EA0 = extabindex:0x80006EA0; // type:object size:0xC scope:local hidden -@eti_80006EAC = extabindex:0x80006EAC; // type:object size:0xC scope:local hidden -@eti_80006EB8 = extabindex:0x80006EB8; // type:object size:0xC scope:local hidden -@eti_80006EC4 = extabindex:0x80006EC4; // type:object size:0xC scope:local hidden +@3739 = extabindex:0x80006E10; // type:object size:0xC scope:local hidden +@3788 = extabindex:0x80006E1C; // type:object size:0xC scope:local hidden +@3798 = extabindex:0x80006E28; // type:object size:0xC scope:local hidden +@3809 = extabindex:0x80006E34; // type:object size:0xC scope:local hidden +@3815 = extabindex:0x80006E40; // type:object size:0xC scope:local hidden +@3821 = extabindex:0x80006E4C; // type:object size:0xC scope:local hidden +@3829 = extabindex:0x80006E58; // type:object size:0xC scope:local hidden +@3840 = extabindex:0x80006E64; // type:object size:0xC scope:local hidden +@3858 = extabindex:0x80006E70; // type:object size:0xC scope:local hidden +@3878 = extabindex:0x80006E7C; // type:object size:0xC scope:local hidden +@3896 = extabindex:0x80006E88; // type:object size:0xC scope:local hidden +@3916 = extabindex:0x80006E94; // type:object size:0xC scope:local hidden +@3934 = extabindex:0x80006EA0; // type:object size:0xC scope:local hidden +@3954 = extabindex:0x80006EAC; // type:object size:0xC scope:local hidden +@3960 = extabindex:0x80006EB8; // type:object size:0xC scope:local hidden +@3965 = extabindex:0x80006EC4; // type:object size:0xC scope:local hidden @eti_80006ED0 = extabindex:0x80006ED0; // type:object size:0xC scope:local hidden @eti_80006EDC = extabindex:0x80006EDC; // type:object size:0xC scope:local hidden @eti_80006EE8 = extabindex:0x80006EE8; // type:object size:0xC scope:local hidden @@ -440,17 +440,17 @@ ReadAsync__Q34nw4r2ut8IOStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv = .text:0x80008 Write__Q34nw4r2ut8IOStreamFPCvUl = .text:0x800081F4; // type:function size:0x4 WriteAsync__Q34nw4r2ut8IOStreamFPCvUlPFlPQ34nw4r2ut8IOStreamPv_vPv = .text:0x800081F8; // type:function size:0x8 IsBusy__Q34nw4r2ut8IOStreamCFv = .text:0x80008200; // type:function size:0x8 -GetBufferAlign__Q34nw4r2ut8IOStreamCFv = .text:0x80008208; // type:function size:0x8 -GetSizeAlign__Q34nw4r2ut8IOStreamCFv = .text:0x80008210; // type:function size:0x8 -GetOffsetAlign__Q34nw4r2ut8IOStreamCFv = .text:0x80008218; // type:function size:0x8 -__sinit_\ut_IOStream_cpp = .text:0x80008220; // type:function size:0xC +GetBufferAlign__Q34nw4r2ut8IOStreamCFv = .text:0x80008208; // type:function size:0x8 scope:weak +GetSizeAlign__Q34nw4r2ut8IOStreamCFv = .text:0x80008210; // type:function size:0x8 scope:weak +GetOffsetAlign__Q34nw4r2ut8IOStreamCFv = .text:0x80008218; // type:function size:0x8 scope:weak +__sinit_\ut_IOStream_cpp = .text:0x80008220; // type:function size:0xC scope:local Cancel__Q34nw4r2ut10FileStreamFv = .text:0x8000822C; // type:function size:0x4 CancelAsync__Q34nw4r2ut10FileStreamFPFlPQ34nw4r2ut8IOStreamPv_vPv = .text:0x80008230; // type:function size:0x8 Skip__Q44nw4r2ut10FileStream12FilePositionFl = .text:0x80008238; // type:function size:0x64 Append__Q44nw4r2ut10FileStream12FilePositionFl = .text:0x8000829C; // type:function size:0x50 Seek__Q44nw4r2ut10FileStream12FilePositionFlUl = .text:0x800082EC; // type:function size:0x98 -GetRuntimeTypeInfo__Q34nw4r2ut10FileStreamCFv = .text:0x80008384; // type:function size:0x8 -__sinit_\ut_FileStream_cpp = .text:0x8000838C; // type:function size:0xC +GetRuntimeTypeInfo__Q34nw4r2ut10FileStreamCFv = .text:0x80008384; // type:function size:0x8 scope:weak +__sinit_\ut_FileStream_cpp = .text:0x8000838C; // type:function size:0xC scope:local DvdAsyncCallback___Q34nw4r2ut13DvdFileStreamFlP11DVDFileInfo = .text:0x80008398; // type:function size:0x2C DvdCBAsyncCallback___Q34nw4r2ut13DvdFileStreamFlP15DVDCommandBlock = .text:0x800083C4; // type:function size:0x28 __ct__Q34nw4r2ut13DvdFileStreamFl = .text:0x800083EC; // type:function size:0xBC @@ -464,29 +464,29 @@ PeekAsync__Q34nw4r2ut13DvdFileStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv = .text:0 Seek__Q34nw4r2ut13DvdFileStreamFlUl = .text:0x800088D0; // type:function size:0x8 Cancel__Q34nw4r2ut13DvdFileStreamFv = .text:0x800088D8; // type:function size:0x8 CancelAsync__Q34nw4r2ut13DvdFileStreamFPFlPQ34nw4r2ut8IOStreamPv_vPv = .text:0x800088E0; // type:function size:0x5C -GetBufferAlign__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000893C; // type:function size:0x8 -GetSizeAlign__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008944; // type:function size:0x8 -GetOffsetAlign__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000894C; // type:function size:0x8 -CanCancel__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008954; // type:function size:0x8 -CanWrite__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000895C; // type:function size:0x8 -CanRead__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008964; // type:function size:0x8 -CanSeek__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000896C; // type:function size:0x8 -CanAsync__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008974; // type:function size:0x8 -GetSize__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000897C; // type:function size:0x8 -Tell__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008984; // type:function size:0x8 -IsBusy__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000898C; // type:function size:0x8 -GetRuntimeTypeInfo__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008994; // type:function size:0x8 -__sinit_\ut_DvdFileStream_cpp = .text:0x8000899C; // type:function size:0xC +GetBufferAlign__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000893C; // type:function size:0x8 scope:weak +GetSizeAlign__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008944; // type:function size:0x8 scope:weak +GetOffsetAlign__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000894C; // type:function size:0x8 scope:weak +CanCancel__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008954; // type:function size:0x8 scope:weak +CanWrite__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000895C; // type:function size:0x8 scope:weak +CanRead__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008964; // type:function size:0x8 scope:weak +CanSeek__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000896C; // type:function size:0x8 scope:weak +CanAsync__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008974; // type:function size:0x8 scope:weak +GetSize__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000897C; // type:function size:0x8 scope:weak +Tell__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008984; // type:function size:0x8 scope:weak +IsBusy__Q34nw4r2ut13DvdFileStreamCFv = .text:0x8000898C; // type:function size:0x8 scope:weak +GetRuntimeTypeInfo__Q34nw4r2ut13DvdFileStreamCFv = .text:0x80008994; // type:function size:0x8 scope:weak +__sinit_\ut_DvdFileStream_cpp = .text:0x8000899C; // type:function size:0xC scope:local __ct__Q34nw4r2ut19DvdLockedFileStreamFl = .text:0x800089A8; // type:function size:0x74 __ct__Q34nw4r2ut19DvdLockedFileStreamFPC11DVDFileInfob = .text:0x80008A1C; // type:function size:0x74 __dt__Q34nw4r2ut19DvdLockedFileStreamFv = .text:0x80008A90; // type:function size:0x58 Read__Q34nw4r2ut19DvdLockedFileStreamFPvUl = .text:0x80008AE8; // type:function size:0x74 Peek__Q34nw4r2ut19DvdLockedFileStreamFPvUl = .text:0x80008B5C; // type:function size:0x74 -CanAsync__Q34nw4r2ut19DvdLockedFileStreamCFv = .text:0x80008BD0; // type:function size:0x8 -PeekAsync__Q34nw4r2ut19DvdLockedFileStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv = .text:0x80008BD8; // type:function size:0x8 -ReadAsync__Q34nw4r2ut19DvdLockedFileStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv = .text:0x80008BE0; // type:function size:0x8 -GetRuntimeTypeInfo__Q34nw4r2ut19DvdLockedFileStreamCFv = .text:0x80008BE8; // type:function size:0x8 -__sinit_\ut_DvdLockedFileStream_cpp = .text:0x80008BF0; // type:function size:0xC +CanAsync__Q34nw4r2ut19DvdLockedFileStreamCFv = .text:0x80008BD0; // type:function size:0x8 scope:weak +PeekAsync__Q34nw4r2ut19DvdLockedFileStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv = .text:0x80008BD8; // type:function size:0x8 scope:weak +ReadAsync__Q34nw4r2ut19DvdLockedFileStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv = .text:0x80008BE0; // type:function size:0x8 scope:weak +GetRuntimeTypeInfo__Q34nw4r2ut19DvdLockedFileStreamCFv = .text:0x80008BE8; // type:function size:0x8 scope:weak +__sinit_\ut_DvdLockedFileStream_cpp = .text:0x80008BF0; // type:function size:0xC scope:local NandAsyncCallback___Q34nw4r2ut14NandFileStreamFlP16NANDCommandBlock = .text:0x80008BFC; // type:function size:0x2C __ct__Q34nw4r2ut14NandFileStreamFPCcUl = .text:0x80008C28; // type:function size:0x70 __ct__Q34nw4r2ut14NandFileStreamFPC12NANDFileInfoUlb = .text:0x80008C98; // type:function size:0x70 @@ -499,19 +499,19 @@ ReadAsync__Q34nw4r2ut14NandFileStreamFPvUlPFlPQ34nw4r2ut8IOStreamPv_vPv = .text: Write__Q34nw4r2ut14NandFileStreamFPCvUl = .text:0x80009734; // type:function size:0x6C WriteAsync__Q34nw4r2ut14NandFileStreamFPCvUlPFlPQ34nw4r2ut8IOStreamPv_vPv = .text:0x800097A0; // type:function size:0xA8 Seek__Q34nw4r2ut14NandFileStreamFlUl = .text:0x80009848; // type:function size:0x8 -GetBufferAlign__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009850; // type:function size:0x8 -GetSizeAlign__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009858; // type:function size:0x8 -GetOffsetAlign__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009860; // type:function size:0x8 -CanCancel__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009868; // type:function size:0x8 -CanWrite__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009870; // type:function size:0x8 -CanRead__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009878; // type:function size:0x8 -CanSeek__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009880; // type:function size:0x8 -CanAsync__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009888; // type:function size:0x8 -GetSize__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009890; // type:function size:0x8 -Tell__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009898; // type:function size:0x8 -IsBusy__Q34nw4r2ut14NandFileStreamCFv = .text:0x800098A0; // type:function size:0x8 -GetRuntimeTypeInfo__Q34nw4r2ut14NandFileStreamCFv = .text:0x800098A8; // type:function size:0x8 -__sinit_\ut_NandFileStream_cpp = .text:0x800098B0; // type:function size:0xC +GetBufferAlign__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009850; // type:function size:0x8 scope:weak +GetSizeAlign__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009858; // type:function size:0x8 scope:weak +GetOffsetAlign__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009860; // type:function size:0x8 scope:weak +CanCancel__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009868; // type:function size:0x8 scope:weak +CanWrite__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009870; // type:function size:0x8 scope:weak +CanRead__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009878; // type:function size:0x8 scope:weak +CanSeek__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009880; // type:function size:0x8 scope:weak +CanAsync__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009888; // type:function size:0x8 scope:weak +GetSize__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009890; // type:function size:0x8 scope:weak +Tell__Q34nw4r2ut14NandFileStreamCFv = .text:0x80009898; // type:function size:0x8 scope:weak +IsBusy__Q34nw4r2ut14NandFileStreamCFv = .text:0x800098A0; // type:function size:0x8 scope:weak +GetRuntimeTypeInfo__Q34nw4r2ut14NandFileStreamCFv = .text:0x800098A8; // type:function size:0x8 scope:weak +__sinit_\ut_NandFileStream_cpp = .text:0x800098B0; // type:function size:0xC scope:local Enable__Q34nw4r2ut2LCFv = .text:0x800098BC; // type:function size:0x60 Disable__Q34nw4r2ut2LCFv = .text:0x8000991C; // type:function size:0x78 Lock__Q34nw4r2ut2LCFv = .text:0x80009994; // type:function size:0x70 @@ -519,10 +519,10 @@ Unlock__Q34nw4r2ut2LCFv = .text:0x80009A04; // type:function size:0x40 LoadBlocks__Q34nw4r2ut2LCFPvPvUl = .text:0x80009A44; // type:function size:0x4 StoreBlocks__Q34nw4r2ut2LCFPvPvUl = .text:0x80009A48; // type:function size:0x4 StoreData__Q34nw4r2ut2LCFPvPvUl = .text:0x80009A4C; // type:function size:0x4 -__sinit_\ut_LockedCache_cpp = .text:0x80009A50; // type:function size:0x18 +__sinit_\ut_LockedCache_cpp = .text:0x80009A50; // type:function size:0x18 scope:local InitReaderFunc__Q34nw4r2ut4FontFQ34nw4r2ut12FontEncoding = .text:0x80009A68; // type:function size:0xA8 __ct__Q34nw4r2ut7RomFontFv = .text:0x80009B10; // type:function size:0x54 -__dt__Q34nw4r2ut4FontFv = .text:0x80009B64; // type:function size:0x40 +__dt__Q34nw4r2ut4FontFv = .text:0x80009B64; // type:function size:0x40 scope:weak __dt__Q34nw4r2ut7RomFontFv = .text:0x80009BA4; // type:function size:0x40 Load__Q34nw4r2ut7RomFontFPv = .text:0x80009BE4; // type:function size:0xD4 GetRequireBufferSize__Q34nw4r2ut7RomFontFv = .text:0x80009CB8; // type:function size:0x58 @@ -900,7 +900,7 @@ MTX34RotXYZFIdx__Q24nw4r4mathFPQ34nw4r4math5MTX34fff = .text:0x8002C750; // type VEC3TransformNormal__Q24nw4r4mathFPQ34nw4r4math4VEC3PCQ34nw4r4math5MTX34PCQ34nw4r4math4VEC3 = .text:0x8002C89C; // type:function size:0x90 MTX44Identity__Q24nw4r4mathFPQ34nw4r4math5MTX44 = .text:0x8002C92C; // type:function size:0x34 MTX44Copy__Q24nw4r4mathFPQ34nw4r4math5MTX44PCQ34nw4r4math5MTX44 = .text:0x8002C960; // type:function size:0x44 -__dt__Q34nw4r3snd11SoundHandleFv = .text:0x8002C9A4; // type:function size:0x54 +__dt__Q34nw4r3snd11SoundHandleFv = .text:0x8002C9A4; // type:function size:0x54 scope:weak fn_8002C9A4 = .text:0x8002C9F8; // type:function size:0x4FC fn_8002CEF4 = .text:0x8002CEF4; // type:function size:0x20 fn_8002CF14 = .text:0x8002CF14; // type:function size:0x58 @@ -1665,28 +1665,28 @@ DirectPrint_EraseXfb__Q24nw4r2dbFiiii = .text:0x800493CC; // type:function size: DirectPrint_ChangeXfb__Q24nw4r2dbFPvUsUs = .text:0x80049558; // type:function size:0x34 DirectPrint_StoreCache__Q24nw4r2dbFv = .text:0x8004958C; // type:function size:0x14 DirectPrint_DrawString__Q24nw4r2dbFiibPCce = .text:0x800495A0; // type:function size:0xE4 -DrawStringToXfb___Q24nw4r2dbFiiPCcbb = .text:0x80049684; // type:function size:0x154 -DrawStringLineToXfb___Q24nw4r2dbFiiPCci = .text:0x800497D8; // type:function size:0xDC -DrawCharToXfb___Q24nw4r2dbFiii = .text:0x800498B4; // type:function size:0x2B8 +DrawStringToXfb___Q24nw4r2dbFiiPCcbb = .text:0x80049684; // type:function size:0x154 scope:local +DrawStringLineToXfb___Q24nw4r2dbFiiPCci = .text:0x800497D8; // type:function size:0xDC scope:local +DrawCharToXfb___Q24nw4r2dbFiii = .text:0x800498B4; // type:function size:0x2B8 scope:local DirectPrint_SetupFB__Q34nw4r2db6detailFPC16_GXRenderModeObj = .text:0x80049B6C; // type:function size:0x1F0 -RemoveConsoleFromList__Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHead = .text:0x80049D5C; // type:function size:0xAC +RemoveConsoleFromList___Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHead = .text:0x80049D5C; // type:function size:0xAC scope:local Console_Create__Q24nw4r2dbFPvUsUsUsUsUs = .text:0x80049E08; // type:function size:0x164 Console_Destroy__Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHead = .text:0x80049F6C; // type:function size:0x30 -DoDrawConsole___Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHeadPQ34nw4r2ut17TextWriterBase = .text:0x80049F9C; // type:function size:0x178 +DoDrawConsole___Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHeadPQ34nw4r2ut17TextWriterBase = .text:0x80049F9C; // type:function size:0x178 scope:local Console_DrawDirect__Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHead = .text:0x8004A114; // type:function size:0x98 -PrintToBuffer___Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHeadPCUc = .text:0x8004A1AC; // type:function size:0x36C +PrintToBuffer___Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHeadPCUc = .text:0x8004A1AC; // type:function size:0x36C scope:local Console_VFPrintf__Q24nw4r2dbFQ34nw4r2db17ConsoleOutputTypePQ44nw4r2db6detail11ConsoleHeadPCcP16__va_list_struct = .text:0x8004A518; // type:function size:0x9C Console_GetTotalLines__Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHead = .text:0x8004A5B4; // type:function size:0x7C Exception_Init__Q24nw4r2dbFv = .text:0x8004A630; // type:function size:0xE8 -ErrorHandler___Q24nw4r2dbFUsP9OSContextUlUl = .text:0x8004A718; // type:function size:0x104 -RunThread___Q24nw4r2dbFPv = .text:0x8004A81C; // type:function size:0x1F4 -Exception_Printf___Q24nw4r2dbFPCce = .text:0x8004AA10; // type:function size:0xE4 -fn_8004AAF4 = .text:0x8004AAF4; // type:function size:0x294 -ShowMainInfo___Q24nw4r2dbFUsPC9OSContextUlUl = .text:0x8004AD88; // type:function size:0x23C -fn_8004AFC4 = .text:0x8004AFC4; // type:function size:0xB0 -fn_8004B074 = .text:0x8004B074; // type:function size:0x408 -fn_8004B47C = .text:0x8004B47C; // type:function size:0x1C -fn_8004B498 = .text:0x8004B498; // type:function size:0x14 +ErrorHandler___Q24nw4r2dbFUsP9OSContextUlUl = .text:0x8004A718; // type:function size:0x104 scope:local +RunThread___Q24nw4r2dbFPv = .text:0x8004A81C; // type:function size:0x1F4 scope:local +Exception_Printf___Q24nw4r2dbFPCce = .text:0x8004AA10; // type:function size:0xE4 scope:local +PrintContext___Q24nw4r2dbFUsPC9OSContextUlUl = .text:0x8004AAF4; // type:function size:0x294 scope:local +ShowMainInfo___Q24nw4r2dbFUsPC9OSContextUlUl = .text:0x8004AD88; // type:function size:0x23C scope:local +ShowGPRMap___Q24nw4r2dbFPC9OSContext = .text:0x8004AFC4; // type:function size:0xB0 scope:local +ShowFloat___Q24nw4r2dbFPC9OSContext = .text:0x8004B074; // type:function size:0x408 scope:local +Exception_SetConsole__Q24nw4r2dbFPQ44nw4r2db6detail11ConsoleHeadPC16_GXRenderModeObj = .text:0x8004B47C; // type:function size:0x1C +Exception_SetUserCallback__Q24nw4r2dbFPFPQ44nw4r2db6detail11ConsoleHeadPv_bPv = .text:0x8004B498; // type:function size:0x14 __eq__Q34nw4r3g3d7ResNameCFQ34nw4r3g3d7ResName = .text:0x8004B4AC; // type:function size:0x50 ResWriteBPCmd__Q34nw4r3g3d6detailFPUcUl = .text:0x8004B4FC; // type:function size:0x28 ResWriteBPCmd__Q34nw4r3g3d6detailFPUcUlUl = .text:0x8004B524; // type:function size:0x58 @@ -1859,7 +1859,7 @@ GetResKeyFrameAnmResult__Q34nw4r3g3d6detailFPCQ34nw4r3g3d18ResKeyFrameAnmDataf = GetResColorAnmResult__Q34nw4r3g3d6detailFPCQ34nw4r3g3d21ResColorAnmFramesDataf = .text:0x80051864; // type:function size:0x100 GetAnmResult__Q34nw4r3g3d9ResAnmVisCFUlf = .text:0x80051964; // type:function size:0x120 GetAnmResult__Q34nw4r3g3d9ResAnmClrCFPQ34nw4r3g3d12ClrAnmResultUlf = .text:0x80051A84; // type:function size:0x16C -SearchFrame__Q34nw4r3g3d30@unnamed@g3d_resanmtexpat_cpp@FPCQ34nw4r3g3d19ResAnmTexPatAnmDataf = .text:0x80051BF0; // type:function size:0xAC +SearchFrame__Q34nw4r3g3d30@unnamed@g3d_resanmtexpat_cpp@FPCQ34nw4r3g3d19ResAnmTexPatAnmDataf = .text:0x80051BF0; // type:function size:0xAC scope:local GetAnmResult__Q34nw4r3g3d12ResAnmTexPatCFPQ34nw4r3g3d15TexPatAnmResultUlf = .text:0x80051C9C; // type:function size:0x180 Bind__Q34nw4r3g3d12ResAnmTexPatFQ34nw4r3g3d7ResFile = .text:0x80051E1C; // type:function size:0x170 Release__Q34nw4r3g3d12ResAnmTexPatFv = .text:0x80051F8C; // type:function size:0x1A0 @@ -1907,7 +1907,7 @@ Attach__Q34nw4r3g3d9AnmObjVisFiPQ34nw4r3g3d12AnmObjVisRes = .text:0x80054D68; // Detach__Q34nw4r3g3d9AnmObjVisFi = .text:0x80054D70; // type:function size:0x8 DetachAll__Q34nw4r3g3d9AnmObjVisFv = .text:0x80054D78; // type:function size:0x58 G3dProc__Q34nw4r3g3d9AnmObjVisFUlUlPv = .text:0x80054DD0; // type:function size:0x50 -__dt__Q34nw4r3g3d9AnmObjVisFv = .text:0x80054E20; // type:function size:0x40 +__dt__Q34nw4r3g3d9AnmObjVisFv = .text:0x80054E20; // type:function size:0x40 scope:weak __dt__Q34nw4r3g3d13AnmObjVisNodeFv = .text:0x80054E60; // type:function size:0x88 Attach__Q34nw4r3g3d13AnmObjVisNodeFiPQ34nw4r3g3d12AnmObjVisRes = .text:0x80054EE8; // type:function size:0xEC Detach__Q34nw4r3g3d13AnmObjVisNodeFi = .text:0x80054FD4; // type:function size:0x16C @@ -1931,26 +1931,26 @@ Bind__Q34nw4r3g3d12AnmObjVisResFQ34nw4r3g3d6ResMdl = .text:0x80055900; // type:f GetResult__Q34nw4r3g3d12AnmObjVisResFUl = .text:0x80055A04; // type:function size:0x34 ApplyVisAnmResult__Q24nw4r3g3dFQ34nw4r3g3d6ResMdlPQ34nw4r3g3d9AnmObjVis = .text:0x80055A38; // type:function size:0xBC ApplyVisAnmResult__Q24nw4r3g3dFPUcQ34nw4r3g3d6ResMdlPQ34nw4r3g3d9AnmObjVis = .text:0x80055AF4; // type:function size:0x8C -IsDerivedFrom__Q34nw4r3g3d12AnmObjVisResCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x80055B80; // type:function size:0x68 -IsDerivedFrom__Q34nw4r3g3d9AnmObjVisCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x80055BE8; // type:function size:0x50 -GetTypeName__Q34nw4r3g3d12AnmObjVisResCFv = .text:0x80055C38; // type:function size:0x30 -GetTypeObj__Q34nw4r3g3d12AnmObjVisResCFv = .text:0x80055C68; // type:function size:0xC -__dt__Q34nw4r3g3d12AnmObjVisResFv = .text:0x80055C74; // type:function size:0x44 -IsDerivedFrom__Q34nw4r3g3d11AnmObjVisORCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x80055CB8; // type:function size:0x7C -IsDerivedFrom__Q34nw4r3g3d13AnmObjVisNodeCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x80055D34; // type:function size:0x68 -GetTypeName__Q34nw4r3g3d11AnmObjVisORCFv = .text:0x80055D9C; // type:function size:0x30 -GetTypeObj__Q34nw4r3g3d11AnmObjVisORCFv = .text:0x80055DCC; // type:function size:0xC -__dt__Q34nw4r3g3d11AnmObjVisORFv = .text:0x80055DD8; // type:function size:0x8C -GetTypeName__Q34nw4r3g3d13AnmObjVisNodeCFv = .text:0x80055E64; // type:function size:0x30 -GetTypeObj__Q34nw4r3g3d13AnmObjVisNodeCFv = .text:0x80055E94; // type:function size:0xC -GetTypeName__Q34nw4r3g3d9AnmObjVisCFv = .text:0x80055EA0; // type:function size:0x30 -GetTypeObj__Q34nw4r3g3d9AnmObjVisCFv = .text:0x80055ED0; // type:function size:0xC +IsDerivedFrom__Q34nw4r3g3d12AnmObjVisResCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x80055B80; // type:function size:0x68 scope:weak +IsDerivedFrom__Q34nw4r3g3d9AnmObjVisCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x80055BE8; // type:function size:0x50 scope:weak +GetTypeName__Q34nw4r3g3d12AnmObjVisResCFv = .text:0x80055C38; // type:function size:0x30 scope:weak +GetTypeObj__Q34nw4r3g3d12AnmObjVisResCFv = .text:0x80055C68; // type:function size:0xC scope:weak +__dt__Q34nw4r3g3d12AnmObjVisResFv = .text:0x80055C74; // type:function size:0x44 scope:weak +IsDerivedFrom__Q34nw4r3g3d11AnmObjVisORCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x80055CB8; // type:function size:0x7C scope:weak +IsDerivedFrom__Q34nw4r3g3d13AnmObjVisNodeCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x80055D34; // type:function size:0x68 scope:weak +GetTypeName__Q34nw4r3g3d11AnmObjVisORCFv = .text:0x80055D9C; // type:function size:0x30 scope:weak +GetTypeObj__Q34nw4r3g3d11AnmObjVisORCFv = .text:0x80055DCC; // type:function size:0xC scope:weak +__dt__Q34nw4r3g3d11AnmObjVisORFv = .text:0x80055DD8; // type:function size:0x8C scope:weak +GetTypeName__Q34nw4r3g3d13AnmObjVisNodeCFv = .text:0x80055E64; // type:function size:0x30 scope:weak +GetTypeObj__Q34nw4r3g3d13AnmObjVisNodeCFv = .text:0x80055E94; // type:function size:0xC scope:weak +GetTypeName__Q34nw4r3g3d9AnmObjVisCFv = .text:0x80055EA0; // type:function size:0x30 scope:weak +GetTypeObj__Q34nw4r3g3d9AnmObjVisCFv = .text:0x80055ED0; // type:function size:0xC scope:weak TestExistence__Q34nw4r3g3d12AnmObjMatClrCFUl = .text:0x80055EDC; // type:function size:0x1C Release__Q34nw4r3g3d12AnmObjMatClrFv = .text:0x80055EF8; // type:function size:0x3C Attach__Q34nw4r3g3d12AnmObjMatClrFiPQ34nw4r3g3d15AnmObjMatClrRes = .text:0x80055F34; // type:function size:0x8 Detach__Q34nw4r3g3d12AnmObjMatClrFi = .text:0x80055F3C; // type:function size:0x8 DetachAll__Q34nw4r3g3d12AnmObjMatClrFv = .text:0x80055F44; // type:function size:0x4 -__dt__Q34nw4r3g3d12AnmObjMatClrFv = .text:0x80055F48; // type:function size:0x40 +__dt__Q34nw4r3g3d12AnmObjMatClrFv = .text:0x80055F48; // type:function size:0x40 scope:weak __dt__Q34nw4r3g3d16AnmObjMatClrNodeFv = .text:0x80055F88; // type:function size:0x64 Attach__Q34nw4r3g3d16AnmObjMatClrNodeFiPQ34nw4r3g3d15AnmObjMatClrRes = .text:0x80055FEC; // type:function size:0xEC Detach__Q34nw4r3g3d16AnmObjMatClrNodeFi = .text:0x800560D8; // type:function size:0x118 @@ -1975,22 +1975,22 @@ Bind__Q34nw4r3g3d15AnmObjMatClrResFQ34nw4r3g3d6ResMdl = .text:0x80056C2C; // typ GetResult__Q34nw4r3g3d15AnmObjMatClrResFPQ34nw4r3g3d12ClrAnmResultUl = .text:0x80056D24; // type:function size:0x74 G3dProc__Q34nw4r3g3d15AnmObjMatClrResFUlUlPv = .text:0x80056D98; // type:function size:0x54 ApplyClrAnmResult__Q24nw4r3g3dFQ34nw4r3g3d10ResMatChanQ34nw4r3g3d14ResMatTevColorPCQ34nw4r3g3d12ClrAnmResult = .text:0x80056DEC; // type:function size:0x530 -__ad__Q34nw4r2ut5ColorCFUl = .text:0x8005731C; // type:function size:0x10 -__or__Q34nw4r2ut5ColorCFUl = .text:0x8005732C; // type:function size:0x10 -IsDerivedFrom__Q34nw4r3g3d15AnmObjMatClrResCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x8005733C; // type:function size:0x68 -IsDerivedFrom__Q34nw4r3g3d12AnmObjMatClrCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x800573A4; // type:function size:0x50 -GetTypeName__Q34nw4r3g3d15AnmObjMatClrResCFv = .text:0x800573F4; // type:function size:0x30 -GetTypeObj__Q34nw4r3g3d15AnmObjMatClrResCFv = .text:0x80057424; // type:function size:0xC -__dt__Q34nw4r3g3d15AnmObjMatClrResFv = .text:0x80057430; // type:function size:0x44 -IsDerivedFrom__Q34nw4r3g3d20AnmObjMatClrOverrideCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x80057474; // type:function size:0x7C -IsDerivedFrom__Q34nw4r3g3d16AnmObjMatClrNodeCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x800574F0; // type:function size:0x68 -GetTypeName__Q34nw4r3g3d20AnmObjMatClrOverrideCFv = .text:0x80057558; // type:function size:0x30 -GetTypeObj__Q34nw4r3g3d20AnmObjMatClrOverrideCFv = .text:0x80057588; // type:function size:0xC -__dt__Q34nw4r3g3d20AnmObjMatClrOverrideFv = .text:0x80057594; // type:function size:0x68 -GetTypeName__Q34nw4r3g3d16AnmObjMatClrNodeCFv = .text:0x800575FC; // type:function size:0x30 -GetTypeObj__Q34nw4r3g3d16AnmObjMatClrNodeCFv = .text:0x8005762C; // type:function size:0xC -GetTypeName__Q34nw4r3g3d12AnmObjMatClrCFv = .text:0x80057638; // type:function size:0x30 -GetTypeObj__Q34nw4r3g3d12AnmObjMatClrCFv = .text:0x80057668; // type:function size:0xC +__ad__Q34nw4r2ut5ColorCFUl = .text:0x8005731C; // type:function size:0x10 scope:weak +__or__Q34nw4r2ut5ColorCFUl = .text:0x8005732C; // type:function size:0x10 scope:weak +IsDerivedFrom__Q34nw4r3g3d15AnmObjMatClrResCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x8005733C; // type:function size:0x68 scope:weak +IsDerivedFrom__Q34nw4r3g3d12AnmObjMatClrCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x800573A4; // type:function size:0x50 scope:weak +GetTypeName__Q34nw4r3g3d15AnmObjMatClrResCFv = .text:0x800573F4; // type:function size:0x30 scope:weak +GetTypeObj__Q34nw4r3g3d15AnmObjMatClrResCFv = .text:0x80057424; // type:function size:0xC scope:weak +__dt__Q34nw4r3g3d15AnmObjMatClrResFv = .text:0x80057430; // type:function size:0x44 scope:weak +IsDerivedFrom__Q34nw4r3g3d20AnmObjMatClrOverrideCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x80057474; // type:function size:0x7C scope:weak +IsDerivedFrom__Q34nw4r3g3d16AnmObjMatClrNodeCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x800574F0; // type:function size:0x68 scope:weak +GetTypeName__Q34nw4r3g3d20AnmObjMatClrOverrideCFv = .text:0x80057558; // type:function size:0x30 scope:weak +GetTypeObj__Q34nw4r3g3d20AnmObjMatClrOverrideCFv = .text:0x80057588; // type:function size:0xC scope:weak +__dt__Q34nw4r3g3d20AnmObjMatClrOverrideFv = .text:0x80057594; // type:function size:0x68 scope:weak +GetTypeName__Q34nw4r3g3d16AnmObjMatClrNodeCFv = .text:0x800575FC; // type:function size:0x30 scope:weak +GetTypeObj__Q34nw4r3g3d16AnmObjMatClrNodeCFv = .text:0x8005762C; // type:function size:0xC scope:weak +GetTypeName__Q34nw4r3g3d12AnmObjMatClrCFv = .text:0x80057638; // type:function size:0x30 scope:weak +GetTypeObj__Q34nw4r3g3d12AnmObjMatClrCFv = .text:0x80057668; // type:function size:0xC scope:weak TestExistence__Q34nw4r3g3d12AnmObjTexPatCFUl = .text:0x80057674; // type:function size:0x1C fn_80057690 = .text:0x80057690; // type:function size:0x3C fn_800576CC = .text:0x800576CC; // type:function size:0x8 @@ -2179,9 +2179,9 @@ fn_8005D238 = .text:0x8005D238; // type:function size:0xC fn_8005D244 = .text:0x8005D244; // type:function size:0x314 GetLightSet__Q34nw4r3g3d12LightSettingFi = .text:0x8005D558; // type:function size:0x3C __dt__Q34nw4r3g3d6G3dObjFv = .text:0x8005D594; // type:function size:0x4C -IsDerivedFrom__Q34nw4r3g3d6G3dObjCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x8005D5E0; // type:function size:0x1C -GetTypeName__Q34nw4r3g3d6G3dObjCFv = .text:0x8005D5FC; // type:function size:0x30 -GetTypeObj__Q34nw4r3g3d6G3dObjCFv = .text:0x8005D62C; // type:function size:0xC +IsDerivedFrom__Q34nw4r3g3d6G3dObjCFQ44nw4r3g3d6G3dObj7TypeObj = .text:0x8005D5E0; // type:function size:0x1C scope:weak +GetTypeName__Q34nw4r3g3d6G3dObjCFv = .text:0x8005D5FC; // type:function size:0x30 scope:weak +GetTypeObj__Q34nw4r3g3d6G3dObjCFv = .text:0x8005D62C; // type:function size:0xC scope:weak PlayPolicy_Onetime__Q24nw4r3g3dFfff = .text:0x8005D638; // type:function size:0x8 PlayPolicy_Loop__Q24nw4r3g3dFfff = .text:0x8005D640; // type:function size:0x70 SetAnmFlag__Q34nw4r3g3d6AnmObjFQ44nw4r3g3d6AnmObj7AnmFlagb = .text:0x8005D6B0; // type:function size:0x28 @@ -2243,14 +2243,14 @@ __dt__Q44nw4r3g3d8G3DState11IndMtxOpStdFv = .text:0x800614B0; // type:function s __sinit_\g3d_state_cpp = .text:0x800614F0; // type:function size:0x294 __dt__Q54nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@10LightStateFv = .text:0x80061784; // type:function size:0x68 Draw1Mat1ShpDirectly__Q24nw4r3g3dFQ34nw4r3g3d6ResMatQ34nw4r3g3d6ResShpPCQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34UlPQ34nw4r3g3d16Draw1Mat1ShpSwapPQ44nw4r3g3d8G3DState8IndMtxOp = .text:0x800617EC; // type:function size:0x5C8 -GetModelLocalAxisY2__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math4VEC3PCQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34 = .text:0x80061DB4; // type:function size:0xB0 -GetModelLocalAxisY3__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math4VEC3PCQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34 = .text:0x80061E64; // type:function size:0xC8 -Calc_BILLBOARD_STD__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x80061F2C; // type:function size:0x22C -Calc_BILLBOARD_PERSP_STD__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x80062158; // type:function size:0x2C4 -Calc_BILLBOARD_ROT__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x8006241C; // type:function size:0x2CC -Calc_BILLBOARD_PERSP_ROT__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x800626E8; // type:function size:0x364 -Calc_BILLBOARD_Y__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x80062A4C; // type:function size:0x258 -Calc_BILLBOARD_PERSP_Y__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x80062CA4; // type:function size:0x27C +GetModelLocalAxisY2__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math4VEC3PCQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34 = .text:0x80061DB4; // type:function size:0xB0 scope:local +GetModelLocalAxisY3__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math4VEC3PCQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34 = .text:0x80061E64; // type:function size:0xC8 scope:local +Calc_BILLBOARD_STD__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x80061F2C; // type:function size:0x22C scope:local +Calc_BILLBOARD_PERSP_STD__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x80062158; // type:function size:0x2C4 scope:local +Calc_BILLBOARD_ROT__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x8006241C; // type:function size:0x2CC scope:local +Calc_BILLBOARD_PERSP_ROT__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x800626E8; // type:function size:0x364 scope:local +Calc_BILLBOARD_Y__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x80062A4C; // type:function size:0x258 scope:local +Calc_BILLBOARD_PERSP_Y__Q34nw4r3g3d26@unnamed@g3d_calcview_cpp@FPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34bPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlUl = .text:0x80062CA4; // type:function size:0x27C scope:local CalcView__Q24nw4r3g3dFPQ34nw4r4math5MTX34PQ34nw4r4math5MTX33PCQ34nw4r4math5MTX34PCUlUlPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlPQ34nw4r4math5MTX34 = .text:0x80062F20; // type:function size:0x324 CalcView_LC__Q24nw4r3g3dFPQ34nw4r4math5MTX34PQ34nw4r4math5MTX33PCQ34nw4r4math5MTX34PCUlUlPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlPQ34nw4r4math5MTX34 = .text:0x80063244; // type:function size:0x49C CalcView_LC_DMA_ModelMtx__Q24nw4r3g3dFPQ34nw4r4math5MTX34PQ34nw4r4math5MTX33PCQ34nw4r4math5MTX34PCUlUlPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlPQ34nw4r4math5MTX34 = .text:0x800636E0; // type:function size:0x55C @@ -2264,18 +2264,18 @@ GetShpAnmResultBufTemporary__Q44nw4r3g3d6detail7workmemFv = .text:0x80063D04; // CalcWorld__Q24nw4r3g3dFPQ34nw4r4math5MTX34PUlPCUcPCQ34nw4r4math5MTX34Q34nw4r3g3d6ResMdlPQ34nw4r3g3d9AnmObjChrPQ34nw4r3g3d16FuncObjCalcWorldUl = .text:0x80063D10; // type:function size:0x594 CalcSkinning__Q24nw4r3g3dFPQ34nw4r4math5MTX34PUlQ34nw4r3g3d6ResMdlPCUc = .text:0x800642A4; // type:function size:0x2DC GetIndMtxOp__Q34nw4r3g3d6detailFQ34nw4r3g3d6ResMatQ34nw4r3g3d7ResNodeQ34nw4r3g3d6ResShp = .text:0x80064580; // type:function size:0x51C -SetupDraw1Mat1ShpSwap__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FPQ34nw4r3g3d16Draw1Mat1ShpSwapPQ34nw4r3g3d21DrawResMdlReplacementUl = .text:0x80064A9C; // type:function size:0x1A8 -DrawResMdlLoop__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FQ34nw4r3g3d6ResMdlPCUcUl = .text:0x80064C44; // type:function size:0x148 -DrawResMdlLoop__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FQ34nw4r3g3d6ResMdlPCUcPQ34nw4r3g3d21DrawResMdlReplacementUl = .text:0x80064D8C; // type:function size:0x1CC -DrawResMdlLoop__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FQ34nw4r3g3d6ResMdlPCQ54nw4r3g3d6detail7workmem4MdlZUlUl = .text:0x80064F58; // type:function size:0x120 -DrawResMdlLoop__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FQ34nw4r3g3d6ResMdlPCQ54nw4r3g3d6detail7workmem4MdlZUlPQ34nw4r3g3d21DrawResMdlReplacementUl = .text:0x80065078; // type:function size:0x170 -SetUpMdlZ__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FPUlQ34nw4r3g3d6ResMdlPCQ34nw4r4math5MTX34PCUcPQ34nw4r3g3d21DrawResMdlReplacement = .text:0x800651E8; // type:function size:0x138 +SetupDraw1Mat1ShpSwap__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FPQ34nw4r3g3d16Draw1Mat1ShpSwapPQ34nw4r3g3d21DrawResMdlReplacementUl = .text:0x80064A9C; // type:function size:0x1A8 scope:local +DrawResMdlLoop__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FQ34nw4r3g3d6ResMdlPCUcUl = .text:0x80064C44; // type:function size:0x148 scope:local +DrawResMdlLoop__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FQ34nw4r3g3d6ResMdlPCUcPQ34nw4r3g3d21DrawResMdlReplacementUl = .text:0x80064D8C; // type:function size:0x1CC scope:local +DrawResMdlLoop__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FQ34nw4r3g3d6ResMdlPCQ54nw4r3g3d6detail7workmem4MdlZUlUl = .text:0x80064F58; // type:function size:0x120 scope:local +DrawResMdlLoop__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FQ34nw4r3g3d6ResMdlPCQ54nw4r3g3d6detail7workmem4MdlZUlPQ34nw4r3g3d21DrawResMdlReplacementUl = .text:0x80065078; // type:function size:0x170 scope:local +SetUpMdlZ__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FPUlQ34nw4r3g3d6ResMdlPCQ34nw4r4math5MTX34PCUcPQ34nw4r3g3d21DrawResMdlReplacement = .text:0x800651E8; // type:function size:0x138 scope:local DrawResMdlDirectly__Q24nw4r3g3dFQ34nw4r3g3d6ResMdlPCQ34nw4r4math5MTX34PCQ34nw4r4math5MTX33PCQ34nw4r4math5MTX34PCUcPCUcPQ34nw4r3g3d21DrawResMdlReplacementUl = .text:0x80065320; // type:function size:0x228 -FrontToBack__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ = .text:0x80065548; // type:function size:0x3C -BackToFront__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ = .text:0x80065584; // type:function size:0x64 -sort__3stdFPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZPFRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ_b_v = .text:0x800655E8; // type:function size:0x5BC -sort__3stdFPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZRPFRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ_b_v = .text:0x80065BA4; // type:function size:0x5BC -__sort132__3stdFPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZRPFRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ_b_v = .text:0x80066160; // type:function size:0x260 +FrontToBack__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ = .text:0x80065548; // type:function size:0x3C scope:local +BackToFront__Q34nw4r3g3d22@unnamed@g3d_draw_cpp@FRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ = .text:0x80065584; // type:function size:0x64 scope:local +sort__3stdFPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZPFRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ_b_v = .text:0x800655E8; // type:function size:0x5BC scope:weak +sort__3stdFPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZRPFRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ_b_v = .text:0x80065BA4; // type:function size:0x5BC scope:weak +__sort132__3stdFPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZRPFRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ_b_v = .text:0x80066160; // type:function size:0x260 scope:weak __ct__Q34nw4r3g3d6CameraFPQ34nw4r3g3d10CameraData = .text:0x800663C0; // type:function size:0x8 Init__Q34nw4r3g3d6CameraFv = .text:0x800663C8; // type:function size:0x50 Init__Q34nw4r3g3d6CameraFUsUsUsUsUsUs = .text:0x80066418; // type:function size:0x11C @@ -2301,20 +2301,20 @@ GXSetScissor__Q34nw4r3g3d6CameraCFv = .text:0x80066DF0; // type:function size:0x GXSetScissorBoxOffset__Q34nw4r3g3d6CameraCFv = .text:0x80066E14; // type:function size:0x1C UpdateCameraMtx__Q34nw4r3g3d6CameraCFv = .text:0x80066E30; // type:function size:0x404 CalcWorldMtx_Basic__Q44nw4r3g3d6detail3dccFPQ34nw4r4math5MTX34PQ34nw4r4math4VEC3PCQ34nw4r4math5MTX34PCQ34nw4r4math4VEC3UlPCQ34nw4r3g3d12ChrAnmResult = .text:0x80067234; // type:function size:0x168 -MakeTexSrtMtx_S__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x8006739C; // type:function size:0x38 -MakeTexSrtMtx_R__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x800673D4; // type:function size:0x94 -MakeTexSrtMtx_T__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067468; // type:function size:0x38 -MakeTexSrtMtx_SR__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x800674A0; // type:function size:0xBC -MakeTexSrtMtx_RT__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x8006755C; // type:function size:0xB0 -MakeTexSrtMtx_ST__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x8006760C; // type:function size:0x50 -MakeTexSrtMtx_SRT__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x8006765C; // type:function size:0xDC -ProductTexSrtMtx_S__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067738; // type:function size:0x78 -ProductTexSrtMtx_R__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x800677B0; // type:function size:0x130 -ProductTexSrtMtx_T__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x800678E0; // type:function size:0x28 -ProductTexSrtMtx_SR__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067908; // type:function size:0x194 -ProductTexSrtMtx_RT__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067A9C; // type:function size:0x160 -ProductTexSrtMtx_ST__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067BFC; // type:function size:0x88 -ProductTexSrtMtx_SRT__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067C84; // type:function size:0x1A8 +MakeTexSrtMtx_S__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x8006739C; // type:function size:0x38 scope:local +MakeTexSrtMtx_R__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x800673D4; // type:function size:0x94 scope:local +MakeTexSrtMtx_T__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067468; // type:function size:0x38 scope:local +MakeTexSrtMtx_SR__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x800674A0; // type:function size:0xBC scope:local +MakeTexSrtMtx_RT__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x8006755C; // type:function size:0xB0 scope:local +MakeTexSrtMtx_ST__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x8006760C; // type:function size:0x50 scope:local +MakeTexSrtMtx_SRT__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x8006765C; // type:function size:0xDC scope:local +ProductTexSrtMtx_S__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067738; // type:function size:0x78 scope:local +ProductTexSrtMtx_R__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x800677B0; // type:function size:0x130 scope:local +ProductTexSrtMtx_T__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x800678E0; // type:function size:0x28 scope:local +ProductTexSrtMtx_SR__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067908; // type:function size:0x194 scope:local +ProductTexSrtMtx_RT__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067A9C; // type:function size:0x160 scope:local +ProductTexSrtMtx_ST__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067BFC; // type:function size:0x88 scope:local +ProductTexSrtMtx_SRT__Q54nw4r3g3d6detail3dcc22@unnamed@g3d_maya_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80067C84; // type:function size:0x1A8 scope:local CalcTexMtx_Maya__Q44nw4r3g3d6detail3dccFPQ34nw4r4math5MTX34bRCQ34nw4r3g3d6TexSrtQ44nw4r3g3d6TexSrt4Flag = .text:0x80067E2C; // type:function size:0x9C CalcWorldMtx_Maya_SSC_Apply__Q44nw4r3g3d6detail3dccFPQ34nw4r4math5MTX34PQ34nw4r4math4VEC3PCQ34nw4r4math5MTX34PCQ34nw4r4math4VEC3UlPCQ34nw4r3g3d12ChrAnmResult = .text:0x80067EC8; // type:function size:0x190 MakeTexSrtMtx_S__Q54nw4r3g3d6detail3dcc21@unnamed@g3d_xsi_cpp@FPQ34nw4r4math5MTX34RCQ34nw4r3g3d6TexSrt = .text:0x80068058; // type:function size:0x38 @@ -2648,13 +2648,13 @@ FindAnimationLink__Q34nw4r3lyt6detailFPQ34nw4r2ut38LinkList = .data:0x8035D814; // type:object size:0x __vt__Q34nw4r2ut13DvdFileStream = .data:0x8035D828; // type:object size:0x64 __vt__Q34nw4r2ut19DvdLockedFileStream = .data:0x8035D890; // type:object size:0x64 __vt__Q34nw4r2ut14NandFileStream = .data:0x8035D8F8; // type:object size:0x5C -lbl_8035D958 = .data:0x8035D958; // type:object size:0xC data:4byte -lbl_8035D964 = .data:0x8035D964; // type:object size:0xC data:4byte -lbl_8035D970 = .data:0x8035D970; // type:object size:0xC -lbl_8035D97C = .data:0x8035D97C; // type:object size:0xC -lbl_8035D988 = .data:0x8035D988; // type:object size:0xC data:4byte +@3309 = .data:0x8035D958; // type:object size:0xC scope:local data:4byte +...data.0 = .data:0x8035D958; // type:label scope:local +@3310 = .data:0x8035D964; // type:object size:0xC scope:local data:4byte +@3311 = .data:0x8035D970; // type:object size:0xC scope:local +@3312 = .data:0x8035D97C; // type:object size:0xC scope:local +@3609 = .data:0x8035D988; // type:object size:0xC scope:local data:4byte __vt__Q34nw4r2ut7RomFont = .data:0x8035D998; // type:object size:0x58 -__vt__Q34nw4r2ut4Font = .data:0x8035D9F0; // type:object size:0x58 -lbl_8035DA48 = .data:0x8035DA48; // type:object size:0xC data:4byte +__vt__Q34nw4r2ut4Font = .data:0x8035D9F0; // type:object size:0x58 scope:weak +@3574 = .data:0x8035DA48; // type:object size:0xC scope:local data:4byte __vt__Q44nw4r2ut6detail11ResFontBase = .data:0x8035DA58; // type:object size:0x58 __vt__Q34nw4r2ut7ResFont = .data:0x8035DAB0; // type:object size:0x58 __vt__Q34nw4r2ef9DrawOrder = .data:0x8035DB08; // type:object size:0x14 @@ -16626,10 +16629,10 @@ lbl_8035DE08 = .data:0x8035DE08; // type:object size:0x18 lbl_8035DE20 = .data:0x8035DE20; // type:object size:0x18 jumptable_8035DE38 = .data:0x8035DE38; // type:object size:0x1C scope:local lbl_8035DE54 = .data:0x8035DE54; // type:object size:0x1C -sExpTbl__Q34nw4r4math29@unnamed@math_arithmetic_cpp@ = .data:0x8035DE70; // type:object size:0x108 -sLogTbl__Q34nw4r4math29@unnamed@math_arithmetic_cpp@ = .data:0x8035DF78; // type:object size:0x808 -sSinCosTbl__Q34nw4r4math29@unnamed@math_triangular_cpp@ = .data:0x8035E780; // type:object size:0x1010 -sArcTanTbl__Q34nw4r4math29@unnamed@math_triangular_cpp@ = .data:0x8035F790; // type:object size:0x108 +sExpTbl__Q34nw4r4math29@unnamed@math_arithmetic_cpp@ = .data:0x8035DE70; // type:object size:0x108 scope:local +sLogTbl__Q34nw4r4math29@unnamed@math_arithmetic_cpp@ = .data:0x8035DF78; // type:object size:0x808 scope:local +sSinCosTbl__Q34nw4r4math29@unnamed@math_triangular_cpp@ = .data:0x8035E780; // type:object size:0x1010 scope:local +sArcTanTbl__Q34nw4r4math29@unnamed@math_triangular_cpp@ = .data:0x8035F790; // type:object size:0x108 scope:local lbl_8035F898 = .data:0x8035F898; // type:object size:0x18 lbl_8035F8B0 = .data:0x8035F8B0; // type:object size:0x68 lbl_8035F918 = .data:0x8035F918; // type:object size:0x68 @@ -16670,49 +16673,82 @@ lbl_803600B8 = .data:0x803600B8; // type:object size:0x10 lbl_803600C8 = .data:0x803600C8; // type:object size:0x68 lbl_80360130 = .data:0x80360130; // type:object size:0x68 lbl_80360198 = .data:0x80360198; // type:object size:0xB8 -twiceBit$3496 = .data:0x80360250; // type:object size:0x10 -lbl_80360260 = .data:0x80360260; // type:object size:0xF data:string -lbl_80360270 = .data:0x80360270; // type:object size:0x17 data:string -lbl_80360288 = .data:0x80360288; // type:object size:0xD data:string -lbl_80360298 = .data:0x80360298; // type:object size:0xE data:string -lbl_803602A8 = .data:0x803602A8; // type:object size:0x13 data:string -lbl_803602BC = .data:0x803602BC; // type:object size:0xA data:string -lbl_803602C8 = .data:0x803602C8; // type:object size:0xF data:string -lbl_803602D8 = .data:0x803602D8; // type:object size:0xC data:string -lbl_803602E4 = .data:0x803602E4; // type:object size:0xC data:string -lbl_803602F0 = .data:0x803602F0; // type:object size:0x13 data:string -lbl_80360304 = .data:0x80360304; // type:object size:0xC data:string -lbl_80360310 = .data:0x80360310; // type:object size:0x11 data:string -lbl_80360324 = .data:0x80360324; // type:object size:0x12 data:string -lbl_80360338 = .data:0x80360338; // type:object size:0xB data:string +twiceBit$3679 = .data:0x80360250; // type:object size:0x10 scope:local +@3913 = .data:0x80360260; // type:object size:0xF scope:local data:string +@3914 = .data:0x80360270; // type:object size:0x17 scope:local data:string +@3502 = .data:0x80360288; // type:object size:0xD scope:local data:string +...data.0 = .data:0x80360288; // type:label scope:local +@3503 = .data:0x80360298; // type:object size:0xE scope:local data:string +@3506 = .data:0x803602A8; // type:object size:0x13 scope:local data:string +@3507 = .data:0x803602BC; // type:object size:0xA scope:local data:string +@3509 = .data:0x803602C8; // type:object size:0xF scope:local data:string +@3510 = .data:0x803602D8; // type:object size:0xC scope:local data:string +@3511 = .data:0x803602E4; // type:object size:0xC scope:local data:string +@3513 = .data:0x803602F0; // type:object size:0x13 scope:local data:string +@3514 = .data:0x80360304; // type:object size:0xC scope:local data:string +@3515 = .data:0x80360310; // type:object size:0x11 scope:local data:string +@3516 = .data:0x80360324; // type:object size:0x12 scope:local data:string +@3517 = .data:0x80360338; // type:object size:0xB scope:local data:string CPU_EXP_NAME__Q24nw4r2db = .data:0x80360344; // type:object size:0x44 -lbl_80360388 = .data:0x80360388; // type:object size:0x37 data:string -lbl_803603C0 = .data:0x803603C0; // type:object size:0x2D data:string -lbl_803603F0 = .data:0x803603F0; // type:object size:0x10 data:string -lbl_80360400 = .data:0x80360400; // type:object size:0x1C data:string -lbl_8036041C = .data:0x8036041C; // type:object size:0x26 data:string -lbl_80360444 = .data:0x80360444; // type:object size:0x26 data:string -lbl_8036046C = .data:0x8036046C; // type:object size:0x1A data:string -lbl_80360488 = .data:0x80360488; // type:object size:0x1E data:string -lbl_803604A8 = .data:0x803604A8; // type:object size:0x2A data:string -lbl_803604D2 = .data:0x803604D2; // type:object size:0xD -lbl_803604DF = .data:0x803604DF; // type:object size:0x2 data:string -lbl_803604E4 = .data:0x803604E4; // type:object size:0x11 data:string -lbl_803604F5 = .data:0x803604F5; // type:object size:0x36B -ResNameData_Models__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360860; // type:object size:0x20 -ResNameData_Pltts__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360880; // type:object size:0x20 -ResNameData_Textures__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x803608A0; // type:object size:0x20 -ResNameData_AnmChr__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x803608C0; // type:object size:0x20 -ResNameData_AnmVis__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x803608E0; // type:object size:0x20 -ResNameData_AnmClr__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360900; // type:object size:0x20 -ResNameData_AnmTexPat__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360920; // type:object size:0x20 -ResNameData_AnmTexSrt__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360940; // type:object size:0x20 -ResNameData_AnmShp__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360960; // type:object size:0x20 -ResNameData_AnmScn__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360980; // type:object size:0x20 -ResNameData_Ext__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x803609A0; // type:object size:0x20 -ResNameData_LightSet__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x803609C0; // type:object size:0x20 -ResNameData_AmbLights__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x803609E0; // type:object size:0x20 -ResNameData_Lights__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x80360A00; // type:object size:0x20 +@4008 = .data:0x80360388; // type:object size:0x37 scope:local data:string +@4009 = .data:0x803603C0; // type:object size:0x2D scope:local data:string +@4010 = .data:0x803603F0; // type:object size:0x10 scope:local data:string +@4011 = .data:0x80360400; // type:object size:0x1A scope:local data:string +@4012 = .data:0x8036041C; // type:object size:0x26 scope:local data:string +@4013 = .data:0x80360444; // type:object size:0x27 scope:local data:string +@4014 = .data:0x8036046C; // type:object size:0x1A scope:local data:string +@4015 = .data:0x80360488; // type:object size:0x1E scope:local data:string +@4016 = .data:0x803604A8; // type:object size:0x2A scope:local data:string +@4017 = .data:0x803604D4; // type:object size:0xD scope:local data:string +@4018 = .data:0x803604E4; // type:object size:0x11 scope:local data:string +@4019 = .data:0x803604F8; // type:object size:0x1D scope:local data:string +@4020 = .data:0x80360518; // type:object size:0x1A scope:local data:string +@4021 = .data:0x80360534; // type:object size:0x1C scope:local data:string +@4022 = .data:0x80360550; // type:object size:0x1C scope:local data:string +@4023 = .data:0x80360570; // type:object size:0x28 scope:local data:string +@4024 = .data:0x80360598; // type:object size:0x20 scope:local data:string +@4025 = .data:0x803605B8; // type:object size:0x15 scope:local data:string +@4027 = .data:0x803605D0; // type:object size:0x22 scope:local data:string +@4047 = .data:0x803605F4; // type:object size:0x1F scope:local data:string +@4048 = .data:0x80360614; // type:object size:0xF scope:local data:string +@4049 = .data:0x80360624; // type:object size:0x19 scope:local data:string +@4051 = .data:0x80360640; // type:object size:0x16 scope:local data:string +@4052 = .data:0x80360658; // type:object size:0x16 scope:local data:string +@4054 = .data:0x80360670; // type:object size:0xF scope:local data:string +@4055 = .data:0x80360680; // type:object size:0x12 scope:local data:string +@4056 = .data:0x80360694; // type:object size:0x13 scope:local data:string +@4057 = .data:0x803606A8; // type:object size:0x16 scope:local data:string +@4058 = .data:0x803606C0; // type:object size:0x1A scope:local data:string +@4059 = .data:0x803606E0; // type:object size:0x10 scope:local data:string +@4060 = .data:0x803606F0; // type:object size:0x11 scope:local data:string +@4061 = .data:0x80360704; // type:object size:0x15 scope:local data:string +@4062 = .data:0x8036071C; // type:object size:0x16 scope:local data:string +@4063 = .data:0x80360734; // type:object size:0x1C scope:local data:string +@4064 = .data:0x80360750; // type:object size:0x1C scope:local data:string +@4075 = .data:0x8036076C; // type:object size:0x29 scope:local data:string +@4076 = .data:0x80360798; // type:object size:0xE scope:local data:string +@4077 = .data:0x803607A8; // type:object size:0x26 scope:local data:string +@4109 = .data:0x803607D0; // type:object size:0x26 scope:local data:string +@4110 = .data:0x803607F8; // type:object size:0x11 scope:local data:string +@4111 = .data:0x8036080C; // type:object size:0x11 scope:local data:string +@4112 = .data:0x80360820; // type:object size:0x11 scope:local data:string +@4114 = .data:0x80360834; // type:object size:0x11 scope:local data:string +@4115 = .data:0x80360848; // type:object size:0xC scope:local data:string +ResNameData_Models__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360860; // type:object size:0x20 scope:local +...data.0 = .data:0x80360860; // type:label scope:local +ResNameData_Pltts__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360880; // type:object size:0x20 scope:local +ResNameData_Textures__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x803608A0; // type:object size:0x20 scope:local +ResNameData_AnmChr__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x803608C0; // type:object size:0x20 scope:local +ResNameData_AnmVis__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x803608E0; // type:object size:0x20 scope:local +ResNameData_AnmClr__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360900; // type:object size:0x20 scope:local +ResNameData_AnmTexPat__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360920; // type:object size:0x20 scope:local +ResNameData_AnmTexSrt__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360940; // type:object size:0x20 scope:local +ResNameData_AnmShp__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360960; // type:object size:0x20 scope:local +ResNameData_AnmScn__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x80360980; // type:object size:0x20 scope:local +ResNameData_Ext__Q34nw4r3g3d25@unnamed@g3d_resfile_cpp@ = .data:0x803609A0; // type:object size:0x20 scope:local +ResNameData_LightSet__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x803609C0; // type:object size:0x20 scope:local +ResNameData_AmbLights__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x803609E0; // type:object size:0x20 scope:local +ResNameData_Lights__Q34nw4r3g3d27@unnamed@g3d_resanmscn_cpp@ = .data:0x80360A00; // type:object size:0x20 scope:local __vt__Q34nw4r3g3d12AnmObjVisRes = .data:0x80360A20; // type:object size:0x44 __vt__Q34nw4r3g3d11AnmObjVisOR = .data:0x80360A64; // type:object size:0x44 __vt__Q34nw4r3g3d13AnmObjVisNode = .data:0x80360AA8; // type:object size:0x44 @@ -16739,7 +16775,7 @@ lbl_80361090 = .data:0x80361090; // type:object size:0x50 __vt__Q34nw4r3g3d9AnmObjShp = .data:0x803610E0; // type:object size:0x50 __vt__Q34nw4r3g3d6G3dObj = .data:0x80361130; // type:object size:0x1C __vt__Q44nw4r3g3d8G3DState11IndMtxOpStd = .data:0x80361150; // type:object size:0x18 -@10861 = .data:0x80361168; // type:object size:0x9 data:string +@10835 = .data:0x80361168; // type:object size:0x9 scope:local data:string @11648 = .data:0x80361178; // type:object size:0x24 scope:local @11682 = .data:0x8036119C; // type:object size:0x24 scope:local __vt__Q34nw4r3g3d8ScnGroup = .data:0x803611C0; // type:object size:0x40 @@ -16865,21 +16901,21 @@ lbl_80362EB0 = .data:0x80362EB0; // type:object size:0xB data:string lbl_80362EBC = .data:0x80362EBC; // type:object size:0x144 lbl_80363000 = .data:0x80363000; // type:object size:0x30 lbl_80363030 = .data:0x80363030; // type:object size:0x900 -lbl_80363930 = .data:0x80363930; // type:object size:0x48 data:string +@479 = .data:0x80363930; // type:object size:0x48 scope:local data:string @1651 = .data:0x80363978; // type:object size:0x21 scope:local data:string lbl_803639A0 = .data:0x803639A0; // type:object size:0x170 GXTexRegionAddrTable = .data:0x80363B10; // type:object size:0xC0 scope:local data:4byte GXShutdownFuncInfo = .data:0x80363BD0; // type:object size:0x10 scope:local lbl_80363BE0 = .data:0x80363BE0; // type:object size:0x16 data:string lbl_80363BF8 = .data:0x80363BF8; // type:object size:0x16 data:string -jumptable_80363C10 = .data:0x80363C10; // type:object size:0x68 scope:local -jumptable_80363C78 = .data:0x80363C78; // type:object size:0x68 scope:local -jumptable_80363CE0 = .data:0x80363CE0; // type:object size:0x68 scope:local -jumptable_80363D48 = .data:0x80363D48; // type:object size:0x44 scope:local -jumptable_80363D8C = .data:0x80363D8C; // type:object size:0x44 scope:local -jumptable_80363DD0 = .data:0x80363DD0; // type:object size:0x44 scope:local -jumptable_80363E14 = .data:0x80363E14; // type:object size:0x1C scope:local -jumptable_80363E30 = .data:0x80363E30; // type:object size:0x54 scope:local +@1807 = .data:0x80363C10; // type:object size:0x68 scope:local +@1870 = .data:0x80363C78; // type:object size:0x68 scope:local +@1950 = .data:0x80363CE0; // type:object size:0x68 scope:local +@1998 = .data:0x80363D48; // type:object size:0x44 scope:local +@2028 = .data:0x80363D8C; // type:object size:0x44 scope:local +@2072 = .data:0x80363DD0; // type:object size:0x44 scope:local +@2187 = .data:0x80363E14; // type:object size:0x1C scope:local +@2186 = .data:0x80363E30; // type:object size:0x54 scope:local GXNtsc480IntDf = .data:0x80363E88; // type:object size:0x3C lbl_80363EC4 = .data:0x80363EC4; // type:object size:0x3C GXMpal480IntDf = .data:0x80363F00; // type:object size:0x3C @@ -17093,9 +17129,9 @@ lbl_80373DF8 = .data:0x80373DF8; // type:object size:0x15 data:string lbl_80373E10 = .data:0x80373E10; // type:object size:0x12 data:string lbl_80373E24 = .data:0x80373E24; // type:object size:0x13 data:string lbl_80373E38 = .data:0x80373E38; // type:object size:0x47 data:string -@1001 = .data:0x80373E80; // type:object size:0x22 data:string -@1060 = .data:0x80373EA4; // type:object size:0x46 data:string -@448 = .data:0x80373EF0; // type:object size:0x47 data:string +@999 = .data:0x80373E80; // type:object size:0x22 scope:local data:string +@1058 = .data:0x80373EA4; // type:object size:0x46 scope:local data:string +@446 = .data:0x80373EF0; // type:object size:0x47 scope:local data:string lbl_80373F38 = .data:0x80373F38; // type:object size:0x88 lbl_80373FC0 = .data:0x80373FC0; // type:object size:0xFC0 lbl_80374F80 = .data:0x80374F80; // type:object size:0x2000 @@ -17385,10 +17421,10 @@ jumptable_8037E208 = .data:0x8037E208; // type:object size:0x20 scope:local lbl_8037E228 = .data:0x8037E228; // type:object size:0x18 data:string lbl_8037E240 = .data:0x8037E240; // type:object size:0x80 lbl_8037E2C0 = .data:0x8037E2C0; // type:object size:0x140 -lbl_8037E400 = .data:0x8037E400; // type:object size:0xC8 data:string -lbl_8037E4C8 = .data:0x8037E4C8; // type:object size:0x37 data:string -lbl_8037E500 = .data:0x8037E500; // type:object size:0x34 data:string -lbl_8037E534 = .data:0x8037E534; // type:object size:0x2F data:string +@1282 = .data:0x8037E400; // type:object size:0xC8 scope:local data:string +@1359 = .data:0x8037E4C8; // type:object size:0x37 scope:local data:string +@1470 = .data:0x8037E500; // type:object size:0x34 scope:local data:string +@1493 = .data:0x8037E534; // type:object size:0x2F scope:local data:string lbl_8037E568 = .data:0x8037E568; // type:object size:0x48 data:string lbl_8037E5B0 = .data:0x8037E5B0; // type:object size:0x34 data:string jumptable_8037E5E4 = .data:0x8037E5E4; // type:object size:0x9C scope:local @@ -17396,7 +17432,7 @@ jumptable_8037E680 = .data:0x8037E680; // type:object size:0x9C scope:local lbl_8037E71C = .data:0x8037E71C; // type:object size:0xC data:4byte jumptable_8037E728 = .data:0x8037E728; // type:object size:0x98 scope:local jumptable_8037E7C0 = .data:0x8037E7C0; // type:object size:0x38 scope:local -lbl_8037E7F8 = .data:0x8037E7F8; // type:object size:0x1B data:string +@916 = .data:0x8037E7F8; // type:object size:0x1B scope:local data:string @1147 = .data:0x8037E814; // type:object size:0xE scope:local data:string lbl_8037E828 = .data:0x8037E828; // type:object size:0x90 lbl_8037E8B8 = .data:0x8037E8B8; // type:object size:0x9C data:string @@ -17470,7 +17506,7 @@ lbl_80380084 = .data:0x80380084; // type:object size:0x14 data:string lbl_80380098 = .data:0x80380098; // type:object size:0xC data:string lbl_803800A8 = .data:0x803800A8; // type:object size:0xA0 lbl_80380148 = .data:0x80380148; // type:object size:0x10 -lbl_80380158 = .data:0x80380158; // type:object size:0x1D data:string +@3180 = .data:0x80380158; // type:object size:0x1D scope:local data:string lbl_80380178 = .data:0x80380178; // type:object size:0x21 data:string lbl_8038019C = .data:0x8038019C; // type:object size:0x22 data:string lbl_803801C0 = .data:0x803801C0; // type:object size:0xE data:string @@ -17631,17 +17667,17 @@ lbl_80381564 = .data:0x80381564; // type:object size:0x34 jumptable_80381598 = .data:0x80381598; // type:object size:0x30 scope:local __vt__17RPSysSceneCreator = .data:0x803815C8; // type:object size:0x18 __vt__10RPSysScene = .data:0x803815E0; // type:object size:0x60 -localNtsc640x456IntDf__29@unnamed@RPSysRenderMode_cpp@ = .data:0x80381640; // type:object size:0x3C -localNtsc640x456Prog__29@unnamed@RPSysRenderMode_cpp@ = .data:0x8038167C; // type:object size:0x3C -localPal50_640x456IntDf__29@unnamed@RPSysRenderMode_cpp@ = .data:0x803816B8; // type:object size:0x3C -localPal60_640x456IntDf__29@unnamed@RPSysRenderMode_cpp@ = .data:0x803816F4; // type:object size:0x3C -localPal60_640x456Prog__29@unnamed@RPSysRenderMode_cpp@ = .data:0x80381730; // type:object size:0x3C +localNtsc640x456IntDf__29@unnamed@RPSysRenderMode_cpp@ = .data:0x80381640; // type:object size:0x3C scope:local +localNtsc640x456Prog__29@unnamed@RPSysRenderMode_cpp@ = .data:0x8038167C; // type:object size:0x3C scope:local +localPal50_640x456IntDf__29@unnamed@RPSysRenderMode_cpp@ = .data:0x803816B8; // type:object size:0x3C scope:local +localPal60_640x456IntDf__29@unnamed@RPSysRenderMode_cpp@ = .data:0x803816F4; // type:object size:0x3C scope:local +localPal60_640x456Prog__29@unnamed@RPSysRenderMode_cpp@ = .data:0x80381730; // type:object size:0x3C scope:local jumptable_80381770 = .data:0x80381770; // type:object size:0x20 scope:local __vt__13RPSysSceneMgr = .data:0x80381790; // type:object size:0x28 -jumptable_803817B8 = .data:0x803817B8; // type:object size:0x20 scope:local +@27475 = .data:0x803817B8; // type:object size:0x20 scope:local __vt__17RPSysProjectLocal = .data:0x803817D8; // type:object size:0xC __vt__15RPSysGameConfig = .data:0x803817E8; // type:object size:0xC -__vt__19RPSysPrimTagParm = .data:0x803817F4; // type:object size:0x14 +__vt__19RPSysPrimTagParm = .data:0x803817F4; // type:object size:0x14 scope:weak __vt__18RPSysStringTagParm = .data:0x80381808; // type:object size:0x14 __vt__12RPSysTagParm = .data:0x8038181C; // type:object size:0x14 STATIC_DIR_NAMES__20RPSysResourceManager = .data:0x80381830; // type:object size:0x10 @@ -18599,7 +18635,7 @@ lbl_80392DA0 = .data:0x80392DA0; // type:object size:0x48 lbl_80392DE8 = .data:0x80392DE8; // type:object size:0x28 lbl_80392E10 = .data:0x80392E10; // type:object size:0x30 sMutex__Q34nw4r2ut19DvdLockedFileStream = .bss:0x80392E80; // type:object size:0x18 -sLCImpl__Q34nw4r2ut28@unnamed@ut_LockedCache_cpp@ = .bss:0x80392E98; // type:object size:0x1C data:byte +sLCImpl__Q34nw4r2ut28@unnamed@ut_LockedCache_cpp@ = .bss:0x80392E98; // type:object size:0x1C scope:local data:byte lbl_80392EB8 = .bss:0x80392EB8; // type:object size:0xC mLoadingTexture__Q34nw4r2ut10CharWriter = .bss:0x80392EC8; // type:object size:0x10 data:4byte lbl_80392ED8 = .bss:0x80392ED8; // type:object size:0xC @@ -18636,16 +18672,16 @@ lbl_803ADAE0 = .bss:0x803ADAE0; // type:object size:0xC lbl_803ADAEC = .bss:0x803ADAEC; // type:object size:0xC data:4byte lbl_803ADAF8 = .bss:0x803ADAF8; // type:object size:0xC lbl_803ADB04 = .bss:0x803ADB04; // type:object size:0xC data:4byte -sFrameBufferInfo__Q24nw4r2db = .bss:0x803ADB10; // type:object size:0x10 data:4byte -sFrameBufferColor__Q24nw4r2db = .bss:0x803ADB20; // type:object size:0x14 data:byte -sMutex__Q24nw4r2db = .bss:0x803ADB38; // type:object size:0x18 -sStrBuf$3660 = .bss:0x803ADB50; // type:object size:0x400 +sFrameBufferInfo__Q24nw4r2db = .bss:0x803ADB10; // type:object size:0x10 scope:local data:4byte +sFrameBufferColor__Q24nw4r2db = .bss:0x803ADB20; // type:object size:0x14 scope:local data:byte +sMutex__Q24nw4r2db = .bss:0x803ADB38; // type:object size:0x18 scope:local +sStrBuf$3692 = .bss:0x803ADB50; // type:object size:0x400 scope:local sException__Q24nw4r2db = .bss:0x803ADF50; // type:object size:0x360 -sThreadBuffer__Q24nw4r2db = .bss:0x803AE2B0; // type:object size:0x4000 +sThreadBuffer__Q24nw4r2db = .bss:0x803AE2B0; // type:object size:0x4000 scope:local sGenMode2__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B22C0; // type:object size:0xC data:byte sTexCoordScale__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B22CC; // type:object size:0x6C data:4byte -sTex__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B2340; // type:object size:0x104 data:4byte -sTlut__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B2460; // type:object size:0x64 +sTex__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B2340; // type:object size:0x104 align:32 data:4byte +sTlut__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B2460; // type:object size:0x64 align:32 sShp__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B24C4; // type:object size:0xC sPreTexMtxState__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B24D0; // type:object size:0x20 data:4byte sPosNrmArrayState__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B24F0; // type:object size:0xC data:4byte @@ -18658,7 +18694,7 @@ sRenderMode__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B7774; // @11418 = .bss:0x803B77B0; // type:object size:0xC IndMtxOpDefault__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .bss:0x803B77C0; // type:object size:0x98 data:4byte @LOCAL@GetViewNrmMtxPtr__Q54nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@19PosNrmMtxArrayStateCFUl@m = .bss:0x803B7858; // type:object size:0x24 align:4 data:float -sTemp__Q54nw4r3g3d6detail7workmem25@unnamed@g3d_workmem_cpp@ = .bss:0x803B7880; // type:object size:0x18000 +sTemp__Q54nw4r3g3d6detail7workmem25@unnamed@g3d_workmem_cpp@ = .bss:0x803B7880; // type:object size:0x18000 scope:local lbl_803CF880 = .bss:0x803CF880; // type:object size:0x20 align:4 data:float lbl_803CF8A0 = .bss:0x803CF8A0; // type:object size:0x10 lbl_803CF8B0 = .bss:0x803CF8B0; // type:object size:0x30 align:4 data:float @@ -18674,7 +18710,7 @@ sTextBuffer__Q23EGG6Stream = .bss:0x803D0060; // type:object size:0x400 sDvdList__Q23EGG7DvdFile = .bss:0x803D0460; // type:object size:0xC lbl_803D0470 = .bss:0x803D0470; // type:object size:0x10 lbl_803D0480 = .bss:0x803D0480; // type:object size:0x20 -fragmentinfo = .bss:0x803D04A0; // type:object size:0xC scope:local data:4byte +fragmentInfo = .bss:0x803D04A0; // type:object size:0xC scope:local data:4byte lbl_803D04B0 = .bss:0x803D04B0; // type:object size:0x38 data:4byte lbl_803D04E8 = .bss:0x803D04E8; // type:object size:0x100 lbl_803D05E8 = .bss:0x803D05E8; // type:object size:0x100 @@ -18811,7 +18847,8 @@ ResetAlarm = .bss:0x804435C0; // type:object size:0x30 __DVDStopMotorCommandBlock = .bss:0x804435F0; // type:object size:0x30 __DVDRestartMotorCommandBlock = .bss:0x80443620; // type:object size:0x30 WaitingQueue = .bss:0x80443650; // type:object size:0x20 scope:local data:4byte -NandInfo = .bss:0x80443680; // type:object size:0x8C +NandInfo = .bss:0x80443680; // type:object size:0x8C scope:local +...bss.0 = .bss:0x80443680; // type:label scope:local NandCb = .bss:0x80443710; // type:object size:0xB8 scope:local __ErrorInfo = .bss:0x804437E0; // type:object size:0x80 scope:global data:byte dvdContexts = .bss:0x80443860; // type:object size:0x80 scope:local data:4byte @@ -19092,22 +19129,22 @@ lbl_804DDB58 = .sdata:0x804DDB58; // type:object size:0x2 data:string lbl_804DDB5C = .sdata:0x804DDB5C; // type:object size:0x2 data:string lbl_804DDB60 = .sdata:0x804DDB60; // type:object size:0x8 lbl_804DDB68 = .sdata:0x804DDB68; // type:object size:0x8 data:4byte -lbl_804DDB70 = .sdata:0x804DDB70; // type:object size:0x4 data:string -lbl_804DDB74 = .sdata:0x804DDB74; // type:object size:0x3 data:string -lbl_804DDB78 = .sdata:0x804DDB78; // type:object size:0x4 data:string -lbl_804DDB7C = .sdata:0x804DDB7C; // type:object size:0x4 data:string -lbl_804DDB80 = .sdata:0x804DDB80; // type:object size:0x8 data:string -lbl_804DDB88 = .sdata:0x804DDB88; // type:object size:0x6 data:string -lbl_804DDB90 = .sdata:0x804DDB90; // type:object size:0x2 data:string -lbl_804DDB94 = .sdata:0x804DDB94; // type:object size:0x7 data:string -lbl_804DDBA0 = .sdata:0x804DDBA0; // type:object size:0x8 data:string -lbl_804DDBA8 = .sdata:0x804DDBA8; // type:object size:0x2 data:string -@LOCAL@GetAnmPlayPolicy__Q24nw4r3g3dFQ34nw4r3g3d9AnmPolicy@policyTable = .sdata:0x804DDBB0; // type:object size:0x8 +@3955 = .sdata:0x804DDB70; // type:object size:0x4 scope:local data:string +@4036 = .sdata:0x804DDB74; // type:object size:0x3 scope:local data:string +@3504 = .sdata:0x804DDB78; // type:object size:0x4 scope:local data:string +@3505 = .sdata:0x804DDB7C; // type:object size:0x4 scope:local data:string +@3508 = .sdata:0x804DDB80; // type:object size:0x8 scope:local data:string +@3512 = .sdata:0x804DDB88; // type:object size:0x6 scope:local data:string +@4026 = .sdata:0x804DDB90; // type:object size:0x2 scope:local data:string +@4050 = .sdata:0x804DDB94; // type:object size:0x7 scope:local data:string +@4053 = .sdata:0x804DDBA0; // type:object size:0x8 scope:local data:string +@4116 = .sdata:0x804DDBA8; // type:object size:0x2 scope:local data:string +@LOCAL@GetAnmPlayPolicy__Q24nw4r3g3dFQ34nw4r3g3d9AnmPolicy@policyTable = .sdata:0x804DDBB0; // type:object size:0x8 scope:weak @11231 = .sdata:0x804DDBB8; // type:object size:0x4 data:4byte pG3DStateIndMtxOp__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sdata:0x804DDBBC; // type:object size:0x4 data:4byte -@10914 = .sdata:0x804DDBC0; // type:object size:0x8 data:string -@LOCAL@sort__3stdFPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZPFRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ_b_v@shuffle@2 = .sdata:0x804DDBC8; // type:object size:0x4 data:4byte -@LOCAL@sort__3stdFPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZRPFRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ_b_v@shuffle@2 = .sdata:0x804DDBCC; // type:object size:0x4 data:4byte +@10878 = .sdata:0x804DDBC0; // type:object size:0x8 scope:local data:string +@LOCAL@sort__3stdFPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZPFRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ_b_v@shuffle@2 = .sdata:0x804DDBC8; // type:object size:0x4 scope:weak data:4byte +@LOCAL@sort__3stdFPQ54nw4r3g3d6detail7workmem4MdlZPQ54nw4r3g3d6detail7workmem4MdlZRPFRCQ54nw4r3g3d6detail7workmem4MdlZRCQ54nw4r3g3d6detail7workmem4MdlZ_b_v@shuffle@2 = .sdata:0x804DDBCC; // type:object size:0x4 scope:weak data:4byte @10648 = .sdata:0x804DDBD0; // type:object size:0x4 data:4byte @10660 = .sdata:0x804DDBD4; // type:object size:0x4 data:4byte @LOCAL@sort__3stdFPPQ34nw4r3g3d6ScnObjPPQ34nw4r3g3d6ScnObjPFPCQ34nw4r3g3d6ScnObjPCQ34nw4r3g3d6ScnObj_b_v@shuffle@2 = .sdata:0x804DDBD8; // type:object size:0x4 data:4byte @@ -19116,8 +19153,8 @@ lbl_804DDBE0 = .sdata:0x804DDBE0; // type:object size:0x8 data:string lbl_804DDBE8 = .sdata:0x804DDBE8; // type:object size:0x8 data:string lbl_804DDBF0 = .sdata:0x804DDBF0; // type:object size:0x8 data:string lbl_804DDBF8 = .sdata:0x804DDBF8; // type:object size:0x4 data:wstring -@5516 = .sdata:0x804DDC00; // type:object size:0x2 data:string -@5517 = .sdata:0x804DDC04; // type:object size:0x3 data:string +@5515 = .sdata:0x804DDC00; // type:object size:0x2 scope:local data:string +@5516 = .sdata:0x804DDC04; // type:object size:0x3 scope:local data:string sWPADWorkSize__Q23EGG17CoreControllerMgr = .sdata:0x804DDC08; // type:object size:0x4 data:4byte sErrorRetry__Q23EGG9DvdRipper = .sdata:0x804DDC10; // type:object size:0x1 data:byte lbl_804DDC18 = .sdata:0x804DDC18; // type:object size:0x5 data:string @@ -19167,9 +19204,9 @@ __fsFd = .sdata:0x804DDCE0; // type:object size:0x4 scope:local data:4byte firstFl$691 = .sdata:0x804DDCE4; // type:object size:0x4 scope:local data:4byte @1652 = .sdata:0x804DDCE8; // type:object size:0x8 scope:local data:string __GXVersion = .sdata:0x804DDCF0; // type:object size:0x4 scope:global data:4byte -lbl_804DDCF8 = .sdata:0x804DDCF8; // type:object size:0x4 -lbl_804DDCFC = .sdata:0x804DDCFC; // type:object size:0x4 -lbl_804DDD00 = .sdata:0x804DDD00; // type:object size:0x4 +tbl1$1033 = .sdata:0x804DDCF8; // type:object size:0x4 scope:local +tbl2$1034 = .sdata:0x804DDCFC; // type:object size:0x4 scope:local +tbl3$1035 = .sdata:0x804DDD00; // type:object size:0x4 scope:local lbl_804DDD08 = .sdata:0x804DDD08; // type:object size:0x8 lbl_804DDD10 = .sdata:0x804DDD10; // type:object size:0x8 lbl_804DDD18 = .sdata:0x804DDD18; // type:object size:0x8 @@ -19263,7 +19300,7 @@ lbl_804DDF34 = .sdata:0x804DDF34; // type:object size:0x4 data:4byte lbl_804DDF38 = .sdata:0x804DDF38; // type:object size:0x8 data:byte lbl_804DDF40 = .sdata:0x804DDF40; // type:object size:0x6 data:string lbl_804DDF48 = .sdata:0x804DDF48; // type:object size:0x8 data:4byte -@1000 = .sdata:0x804DDF50; // type:object size:0x6 data:string +@998 = .sdata:0x804DDF50; // type:object size:0x6 scope:local data:string __AXVersion = .sdata:0x804DDF58; // type:object size:0x4 data:4byte lbl_804DDF60 = .sdata:0x804DDF60; // type:object size:0x2 data:2byte lbl_804DDF62 = .sdata:0x804DDF62; // type:object size:0x2 data:2byte @@ -19299,7 +19336,7 @@ lbl_804DE010 = .sdata:0x804DE010; // type:object size:0x7 data:string lbl_804DE018 = .sdata:0x804DE018; // type:object size:0x7 data:string lbl_804DE020 = .sdata:0x804DE020; // type:object size:0x8 data:4byte __DVDLongFileNameFlag = .sdata:0x804DE028; // type:object size:0x4 scope:global data:4byte -lbl_804DE030 = .sdata:0x804DE030; // type:object size:0x8 data:string +@1281 = .sdata:0x804DE030; // type:object size:0x8 scope:local data:string __DVDVersion = .sdata:0x804DE038; // type:object size:0x4 scope:global data:4byte lbl_804DE03C = .sdata:0x804DE03C; // type:object size:0x4 data:4byte lbl_804DE040 = .sdata:0x804DE040; // type:object size:0x4 data:4byte @@ -19374,7 +19411,7 @@ lbl_804DE1A5 = .sdata:0x804DE1A5; // type:object size:0x1 data:byte lbl_804DE1A8 = .sdata:0x804DE1A8; // type:object size:0x2 data:string lbl_804DE1B0 = .sdata:0x804DE1B0; // type:object size:0x8 sRFLLastErrCode = .sdata:0x804DE1B8; // type:object size:0x4 data:4byte -scResFileFullPathName = .sdata:0x804DE1C0; // type:object size:0x4 data:4byte +scResFileFullPathName = .sdata:0x804DE1C0; // type:object size:0x4 scope:local data:4byte scFileNames = .sdata:0x804DE1C8; // type:object size:0x8 align:8 scFirstDirectory = .sdata:0x804DE1D0; // type:object size:0x4 data:4byte scSecondDirectory = .sdata:0x804DE1D4; // type:object size:0x4 data:4byte @@ -20254,9 +20291,9 @@ lbl_804DF1D0 = .sbss:0x804DF1D0; // type:object size:0x8 data:byte lbl_804DF1D8 = .sbss:0x804DF1D8; // type:object size:0x8 data:byte lbl_804DF1E0 = .sbss:0x804DF1E0; // type:object size:0x8 data:4byte sInitialized__Q24nw4r2db = .sbss:0x804DF1E8; // type:object size:0x4 scope:local data:4byte -sConsoleList__Q24nw4r2db = .sbss:0x804DF1F0; // type:object size:0x4 data:4byte +sConsoleList__Q24nw4r2db = .sbss:0x804DF1F0; // type:object size:0x4 scope:local data:4byte sInitialized__Q24nw4r2db = .sbss:0x804DF1F4; // type:object size:0x1 scope:local data:byte -sMsgBuffer__Q24nw4r2db = .sbss:0x804DF1F8; // type:object size:0x4 align:4 +sMessageBuffer__Q24nw4r2db = .sbss:0x804DF1F8; // type:object size:0x4 scope:local align:4 sSyncGX__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x804DF200; // type:object size:0x1 data:byte sCurrMtx__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x804DF204; // type:object size:0x1 data:byte sPostTexMtx__Q44nw4r3g3d8G3DState23@unnamed@g3d_state_cpp@ = .sbss:0x804DF208; // type:object size:0x4 data:4byte @@ -20308,7 +20345,7 @@ __global_destructor_chain = .sbss:0x804DF328; // type:object size:0x4 scope:glob lbl_804DF330 = .sbss:0x804DF330; // type:object size:0x8 data:byte errno = .sbss:0x804DF338; // type:object size:0x8 data:4byte lbl_804DF340 = .sbss:0x804DF340; // type:object size:0x8 data:4byte -lbl_804DF348 = .sbss:0x804DF348; // type:object size:0x8 data:4byte +__stdio_exit = .sbss:0x804DF348; // type:object size:0x4 scope:global data:4byte gTRKInputPendingPtr = .sbss:0x804DF350; // type:object size:0x4 scope:global data:4byte lbl_804DF358 = .sbss:0x804DF358; // type:object size:0x8 data:4byte lbl_804DF360 = .sbss:0x804DF360; // type:object size:0x4 data:4byte @@ -20618,7 +20655,7 @@ lbl_804DF890 = .sbss:0x804DF890; // type:object size:0x4 data:4byte lbl_804DF894 = .sbss:0x804DF894; // type:object size:0x4 data:4byte lbl_804DF898 = .sbss:0x804DF898; // type:object size:0x4 data:4byte lbl_804DF89C = .sbss:0x804DF89C; // type:object size:0x4 data:4byte -currentDirectory = .sbss:0x804DF8A0; // type:object size:0x4 data:4byte +currentDirectory = .sbss:0x804DF8A0; // type:object size:0x4 scope:local data:4byte __DVDThreadQueue = .sbss:0x804DF8A8; // type:object size:0x8 scope:global MaxEntryNum = .sbss:0x804DF8B0; // type:object size:0x4 scope:local data:4byte FstStringStart = .sbss:0x804DF8B4; // type:object size:0x4 scope:local data:4byte @@ -21046,11 +21083,11 @@ lbl_804E0108 = .sdata2:0x804E0108; // type:object size:0x4 align:4 data:float lbl_804E0110 = .sdata2:0x804E0110; // type:object size:0x8 align:8 data:double lbl_804E0118 = .sdata2:0x804E0118; // type:object size:0x4 align:4 data:float lbl_804E011C = .sdata2:0x804E011C; // type:object size:0x4 align:4 data:float -lbl_804E0120 = .sdata2:0x804E0120; // type:object size:0x4 align:4 data:float -lbl_804E0124 = .sdata2:0x804E0124; // type:object size:0x4 align:4 data:float -lbl_804E0128 = .sdata2:0x804E0128; // type:object size:0x4 align:4 data:float -lbl_804E012C = .sdata2:0x804E012C; // type:object size:0x4 align:4 data:float -lbl_804E0130 = .sdata2:0x804E0130; // type:object size:0x8 align:8 data:double +@5148 = .sdata2:0x804E0120; // type:object size:0x4 scope:local align:4 data:float +@5149 = .sdata2:0x804E0124; // type:object size:0x4 scope:local align:4 data:float +@5150 = .sdata2:0x804E0128; // type:object size:0x4 scope:local align:4 data:float +@5226 = .sdata2:0x804E012C; // type:object size:0x4 scope:local align:4 data:float +@5272 = .sdata2:0x804E0130; // type:object size:0x8 scope:local align:8 data:double lbl_804E0138 = .sdata2:0x804E0138; // type:object size:0x4 align:4 data:float lbl_804E013C = .sdata2:0x804E013C; // type:object size:0x4 align:4 data:float lbl_804E0140 = .sdata2:0x804E0140; // type:object size:0x4 align:4 data:float @@ -21198,25 +21235,25 @@ lbl_804E0428 = .sdata2:0x804E0428; // type:object size:0x4 align:4 data:float lbl_804E042C = .sdata2:0x804E042C; // type:object size:0x4 align:4 data:float lbl_804E0430 = .sdata2:0x804E0430; // type:object size:0x4 align:4 data:float lbl_804E0434 = .sdata2:0x804E0434; // type:object size:0x4 align:4 data:float -@1457 = .sdata2:0x804E0438; // type:object size:0x4 align:4 data:float -@1458 = .sdata2:0x804E043C; // type:object size:0x4 align:4 data:float -@1459 = .sdata2:0x804E0440; // type:object size:0x4 align:4 data:float -@1479 = .sdata2:0x804E0444; // type:object size:0x4 align:4 data:float -@1480 = .sdata2:0x804E0448; // type:object size:0x4 align:4 data:float -@1482 = .sdata2:0x804E044C; // type:object size:0x4 align:4 data:float -@1483 = .sdata2:0x804E0450; // type:object size:0x4 align:4 data:float -lbl_804E0458 = .sdata2:0x804E0458; // type:object size:0x4 align:4 data:float -lbl_804E045C = .sdata2:0x804E045C; // type:object size:0x4 align:4 data:float -lbl_804E0460 = .sdata2:0x804E0460; // type:object size:0x4 align:4 data:float -lbl_804E0464 = .sdata2:0x804E0464; // type:object size:0x4 align:4 data:float -lbl_804E0468 = .sdata2:0x804E0468; // type:object size:0x4 align:4 data:float -lbl_804E046C = .sdata2:0x804E046C; // type:object size:0x4 align:4 data:float -lbl_804E0470 = .sdata2:0x804E0470; // type:object size:0x4 align:4 data:float -lbl_804E0474 = .sdata2:0x804E0474; // type:object size:0x4 align:4 data:float -lbl_804E0478 = .sdata2:0x804E0478; // type:object size:0x4 align:4 data:float -lbl_804E0480 = .sdata2:0x804E0480; // type:object size:0x4 align:4 data:float -lbl_804E0484 = .sdata2:0x804E0484; // type:object size:0x4 align:4 data:float -lbl_804E0488 = .sdata2:0x804E0488; // type:object size:0x4 align:4 data:float +@1455 = .sdata2:0x804E0438; // type:object size:0x4 scope:local align:4 data:float +@1456 = .sdata2:0x804E043C; // type:object size:0x4 scope:local align:4 data:float +@1457 = .sdata2:0x804E0440; // type:object size:0x4 scope:local align:4 data:float +@1477 = .sdata2:0x804E0444; // type:object size:0x4 scope:local align:4 data:float +@1478 = .sdata2:0x804E0448; // type:object size:0x4 scope:local align:4 data:float +@1480 = .sdata2:0x804E044C; // type:object size:0x4 scope:local align:4 data:float +@1481 = .sdata2:0x804E0450; // type:object size:0x4 scope:local align:4 data:float +@1628 = .sdata2:0x804E0458; // type:object size:0x4 scope:local align:4 data:float +@1629 = .sdata2:0x804E045C; // type:object size:0x4 scope:local align:4 data:float +@1662 = .sdata2:0x804E0460; // type:object size:0x4 scope:local align:4 data:float +@1663 = .sdata2:0x804E0464; // type:object size:0x4 scope:local align:4 data:float +@1664 = .sdata2:0x804E0468; // type:object size:0x4 scope:local align:4 data:float +@1665 = .sdata2:0x804E046C; // type:object size:0x4 scope:local align:4 data:float +@1666 = .sdata2:0x804E0470; // type:object size:0x4 scope:local align:4 data:float +@1684 = .sdata2:0x804E0474; // type:object size:0x4 scope:local align:4 data:float +@1685 = .sdata2:0x804E0478; // type:object size:0x4 scope:local align:4 data:float +@1360 = .sdata2:0x804E0480; // type:object size:0x4 scope:local align:4 data:float +@1361 = .sdata2:0x804E0484; // type:object size:0x4 scope:local align:4 data:float +@1382 = .sdata2:0x804E0488; // type:object size:0x4 scope:local align:4 data:float lbl_804E0490 = .sdata2:0x804E0490; // type:object size:0x4 align:4 data:float lbl_804E0494 = .sdata2:0x804E0494; // type:object size:0x4 align:4 data:float lbl_804E0498 = .sdata2:0x804E0498; // type:object size:0x8 align:8 data:double @@ -21351,27 +21388,27 @@ lbl_804E0734 = .sdata2:0x804E0734; // type:object size:0x4 align:4 data:float lbl_804E0738 = .sdata2:0x804E0738; // type:object size:0x4 align:4 data:float lbl_804E0740 = .sdata2:0x804E0740; // type:object size:0x8 align:8 data:double lbl_804E0748 = .sdata2:0x804E0748; // type:object size:0x8 align:8 data:double -lbl_804E0750 = .sdata2:0x804E0750; // type:object size:0x8 align:4 data:float -@13150 = .sdata2:0x804E0758; // type:object size:0x4 align:4 data:float -@13151 = .sdata2:0x804E075C; // type:object size:0x4 align:4 data:float -@13152 = .sdata2:0x804E0760; // type:object size:0x4 align:4 data:float -@13153 = .sdata2:0x804E0764; // type:object size:0x4 align:4 data:float -@13154 = .sdata2:0x804E0768; // type:object size:0x4 align:4 data:float -@13159 = .sdata2:0x804E0770; // type:object size:0x8 align:8 data:double -@13168 = .sdata2:0x804E0778; // type:object size:0x4 align:4 data:float -@10598 = .sdata2:0x804E0780; // type:object size:0x4 align:4 data:float -@10637 = .sdata2:0x804E0784; // type:object size:0x4 align:4 data:float -lbl_804E0788 = .sdata2:0x804E0788; // type:object size:0x4 align:4 data:float -lbl_804E078C = .sdata2:0x804E078C; // type:object size:0x4 align:4 data:float -lbl_804E0790 = .sdata2:0x804E0790; // type:object size:0x4 align:4 data:float -lbl_804E0794 = .sdata2:0x804E0794; // type:object size:0x4 align:4 data:float -lbl_804E0798 = .sdata2:0x804E0798; // type:object size:0x4 align:4 data:float -@10577 = .sdata2:0x804E07A0; // type:object size:0x4 align:4 data:float -@10580 = .sdata2:0x804E07A8; // type:object size:0x8 align:8 data:double -@10596 = .sdata2:0x804E07B0; // type:object size:0x4 align:4 data:float -@10600 = .sdata2:0x804E07B8; // type:object size:0x8 align:8 data:double -@10822 = .sdata2:0x804E07C0; // type:object size:0x4 align:4 data:float -@10823 = .sdata2:0x804E07C4; // type:object size:0x4 align:4 data:float +@4113 = .sdata2:0x804E0750; // type:object size:0x4 scope:local align:4 data:float +@13148 = .sdata2:0x804E0758; // type:object size:0x4 scope:local align:4 data:float +@13149 = .sdata2:0x804E075C; // type:object size:0x4 scope:local align:4 data:float +@13150 = .sdata2:0x804E0760; // type:object size:0x4 scope:local align:4 data:float +@13151 = .sdata2:0x804E0764; // type:object size:0x4 scope:local align:4 data:float +@13152 = .sdata2:0x804E0768; // type:object size:0x4 scope:local align:4 data:float +@13157 = .sdata2:0x804E0770; // type:object size:0x8 scope:local align:8 data:double +@13166 = .sdata2:0x804E0778; // type:object size:0x4 scope:local align:4 data:float +@10596 = .sdata2:0x804E0780; // type:object size:0x4 scope:local align:4 data:float +@10635 = .sdata2:0x804E0784; // type:object size:0x4 scope:local align:4 data:float +@10668 = .sdata2:0x804E0788; // type:object size:0x4 scope:local align:4 data:float +@10669 = .sdata2:0x804E078C; // type:object size:0x4 scope:local align:4 data:float +@10670 = .sdata2:0x804E0790; // type:object size:0x4 scope:local align:4 data:float +@10710 = .sdata2:0x804E0794; // type:object size:0x4 scope:local align:4 data:float +@10711 = .sdata2:0x804E0798; // type:object size:0x4 scope:local align:4 data:float +@10577 = .sdata2:0x804E07A0; // type:object size:0x4 scope:local align:4 data:float +@10580 = .sdata2:0x804E07A8; // type:object size:0x8 scope:local align:8 data:double +@10596 = .sdata2:0x804E07B0; // type:object size:0x4 scope:local align:4 data:float +@10600 = .sdata2:0x804E07B8; // type:object size:0x8 scope:local align:8 data:double +@10822 = .sdata2:0x804E07C0; // type:object size:0x4 scope:local align:4 data:float +@10823 = .sdata2:0x804E07C4; // type:object size:0x4 scope:local align:4 data:float @13297 = .sdata2:0x804E07C8; // type:object size:0x4 align:4 data:float lbl_804E07CC = .sdata2:0x804E07CC; // type:object size:0x4 align:4 data:float lbl_804E07D0 = .sdata2:0x804E07D0; // type:object size:0x4 align:4 data:float @@ -21385,19 +21422,19 @@ lbl_804E07EC = .sdata2:0x804E07EC; // type:object size:0x4 align:4 data:float lbl_804E07F0 = .sdata2:0x804E07F0; // type:object size:0x4 align:4 data:float lbl_804E07F4 = .sdata2:0x804E07F4; // type:object size:0x4 align:4 data:float lbl_804E07F8 = .sdata2:0x804E07F8; // type:object size:0x4 align:4 data:float -@10512 = .sdata2:0x804E0800; // type:object size:0x4 align:4 data:float -@10516 = .sdata2:0x804E0808; // type:object size:0x8 align:8 data:double -@10719 = .sdata2:0x804E0810; // type:object size:0x4 align:4 data:float -@10723 = .sdata2:0x804E0818; // type:object size:0x8 align:8 data:double -@10537 = .sdata2:0x804E0820; // type:object size:0x4 align:4 data:float -@10541 = .sdata2:0x804E0828; // type:object size:0x8 align:8 data:double -@10595 = .sdata2:0x804E0830; // type:object size:0x4 align:4 data:float -@11500 = .sdata2:0x804E0838; // type:object size:0x4 align:4 data:float -@11517 = .sdata2:0x804E083C; // type:object size:0x4 align:4 data:float -@11644 = .sdata2:0x804E0840; // type:object size:0x8 align:8 data:double -@11812 = .sdata2:0x804E0848; // type:object size:0x4 align:4 data:float -@11835 = .sdata2:0x804E084C; // type:object size:0x4 align:4 data:float -@11988 = .sdata2:0x804E0850; // type:object size:0x8 align:8 data:double +@10512 = .sdata2:0x804E0800; // type:object size:0x4 scope:local align:4 data:float +@10516 = .sdata2:0x804E0808; // type:object size:0x8 scope:local align:8 data:double +@10719 = .sdata2:0x804E0810; // type:object size:0x4 scope:local align:4 data:float +@10723 = .sdata2:0x804E0818; // type:object size:0x8 scope:local align:8 data:double +@10537 = .sdata2:0x804E0820; // type:object size:0x4 scope:local align:4 data:float +@10541 = .sdata2:0x804E0828; // type:object size:0x8 scope:local align:8 data:double +@10594 = .sdata2:0x804E0830; // type:object size:0x4 scope:local align:4 data:float +@11499 = .sdata2:0x804E0838; // type:object size:0x4 scope:local align:4 data:float +@11516 = .sdata2:0x804E083C; // type:object size:0x4 scope:local align:4 data:float +@11643 = .sdata2:0x804E0840; // type:object size:0x8 scope:local align:8 data:double +@11811 = .sdata2:0x804E0848; // type:object size:0x4 scope:local align:4 data:float +@11834 = .sdata2:0x804E084C; // type:object size:0x4 scope:local align:4 data:float +@11987 = .sdata2:0x804E0850; // type:object size:0x8 scope:local align:8 data:double lbl_804E0858 = .sdata2:0x804E0858; // type:object size:0x4 align:4 data:float lbl_804E085C = .sdata2:0x804E085C; // type:object size:0x4 align:4 data:float lbl_804E0860 = .sdata2:0x804E0860; // type:object size:0x8 align:8 data:double @@ -21413,14 +21450,14 @@ lbl_804E0898 = .sdata2:0x804E0898; // type:object size:0x8 align:8 data:double lbl_804E08A0 = .sdata2:0x804E08A0; // type:object size:0x4 align:4 data:float lbl_804E08A4 = .sdata2:0x804E08A4; // type:object size:0x4 align:4 data:float lbl_804E08A8 = .sdata2:0x804E08A8; // type:object size:0x8 align:8 data:double -@10494 = .sdata2:0x804E08B0; // type:object size:0x4 align:4 data:float +@10493 = .sdata2:0x804E08B0; // type:object size:0x4 scope:local align:4 data:float cm2hw__Q34nw4r3g3d4fifo = .sdata2:0x804E08B8; // type:object size:0x4 scope:local -@10596 = .sdata2:0x804E08BC; // type:object size:0x4 align:4 data:float -@10597 = .sdata2:0x804E08C0; // type:object size:0x4 align:4 data:float -@10598 = .sdata2:0x804E08C4; // type:object size:0x4 align:4 data:float -@10599 = .sdata2:0x804E08C8; // type:object size:0x4 align:4 data:float -@10611 = .sdata2:0x804E08CC; // type:object size:0x4 align:4 data:float -@10482 = .sdata2:0x804E08D0; // type:object size:0x4 align:4 data:float +@10595 = .sdata2:0x804E08BC; // type:object size:0x4 scope:local align:4 data:float +@10596 = .sdata2:0x804E08C0; // type:object size:0x4 scope:local align:4 data:float +@10597 = .sdata2:0x804E08C4; // type:object size:0x4 scope:local align:4 data:float +@10598 = .sdata2:0x804E08C8; // type:object size:0x4 scope:local align:4 data:float +@10610 = .sdata2:0x804E08CC; // type:object size:0x4 scope:local align:4 data:float +@10481 = .sdata2:0x804E08D0; // type:object size:0x4 scope:local align:4 data:float cm2hw__Q34nw4r3g3d4fifo = .sdata2:0x804E08D8; // type:object size:0x4 scope:local @13283 = .sdata2:0x804E08DC; // type:object size:0x4 align:4 data:float @13284 = .sdata2:0x804E08E0; // type:object size:0x4 align:4 data:float @@ -21429,29 +21466,29 @@ cm2hw__Q34nw4r3g3d4fifo = .sdata2:0x804E08D8; // type:object size:0x4 scope:loca @14013 = .sdata2:0x804E08EC; // type:object size:0x4 align:4 data:float @14014 = .sdata2:0x804E08F0; // type:object size:0x4 align:4 data:float @14019 = .sdata2:0x804E08F8; // type:object size:0x8 align:8 data:double -@11865 = .sdata2:0x804E0900; // type:object size:0x4 align:4 data:float -@10862 = .sdata2:0x804E0908; // type:object size:0x4 align:4 data:float -@10915 = .sdata2:0x804E090C; // type:object size:0x4 align:4 data:float -@12070 = .sdata2:0x804E0910; // type:object size:0x4 align:4 data:float -@12071 = .sdata2:0x804E0914; // type:object size:0x4 align:4 data:float -@12072 = .sdata2:0x804E0918; // type:object size:0x4 align:4 data:float -@11009 = .sdata2:0x804E0920; // type:object size:0x4 align:4 data:float -@11010 = .sdata2:0x804E0924; // type:object size:0x4 align:4 data:float -@11011 = .sdata2:0x804E0928; // type:object size:0x4 align:4 data:float -@11012 = .sdata2:0x804E092C; // type:object size:0x4 align:4 data:float -@11013 = .sdata2:0x804E0930; // type:object size:0x4 align:4 data:float -@11014 = .sdata2:0x804E0934; // type:object size:0x4 align:4 data:float -@11015 = .sdata2:0x804E0938; // type:object size:0x4 align:4 data:float -@11016 = .sdata2:0x804E093C; // type:object size:0x4 align:4 data:float -@11020 = .sdata2:0x804E0940; // type:object size:0x8 align:8 data:double -@11390 = .sdata2:0x804E0948; // type:object size:0x4 align:4 data:float -@11391 = .sdata2:0x804E094C; // type:object size:0x4 align:4 data:float -@10590 = .sdata2:0x804E0950; // type:object size:0x4 align:4 data:float -@10655 = .sdata2:0x804E0958; // type:object size:0x4 align:4 data:float -@10656 = .sdata2:0x804E095C; // type:object size:0x4 align:4 data:float -@10660 = .sdata2:0x804E0960; // type:object size:0x4 align:4 data:float -@10661 = .sdata2:0x804E0964; // type:object size:0x4 align:4 data:float -@10668 = .sdata2:0x804E0968; // type:object size:0x4 align:4 data:float +@11864 = .sdata2:0x804E0900; // type:object size:0x4 scope:local align:4 data:float +@10836 = .sdata2:0x804E0908; // type:object size:0x4 scope:local align:4 data:float +@10879 = .sdata2:0x804E090C; // type:object size:0x4 scope:local align:4 data:float +@12069 = .sdata2:0x804E0910; // type:object size:0x4 scope:local align:4 data:float +@12070 = .sdata2:0x804E0914; // type:object size:0x4 scope:local align:4 data:float +@12071 = .sdata2:0x804E0918; // type:object size:0x4 scope:local align:4 data:float +@11008 = .sdata2:0x804E0920; // type:object size:0x4 scope:local align:4 data:float +@11009 = .sdata2:0x804E0924; // type:object size:0x4 scope:local align:4 data:float +@11010 = .sdata2:0x804E0928; // type:object size:0x4 scope:local align:4 data:float +@11011 = .sdata2:0x804E092C; // type:object size:0x4 scope:local align:4 data:float +@11012 = .sdata2:0x804E0930; // type:object size:0x4 scope:local align:4 data:float +@11013 = .sdata2:0x804E0934; // type:object size:0x4 scope:local align:4 data:float +@11014 = .sdata2:0x804E0938; // type:object size:0x4 scope:local align:4 data:float +@11015 = .sdata2:0x804E093C; // type:object size:0x4 scope:local align:4 data:float +@11019 = .sdata2:0x804E0940; // type:object size:0x8 scope:local align:8 data:double +@11389 = .sdata2:0x804E0948; // type:object size:0x4 scope:local align:4 data:float +@11390 = .sdata2:0x804E094C; // type:object size:0x4 scope:local align:4 data:float +@10589 = .sdata2:0x804E0950; // type:object size:0x4 scope:local align:4 data:float +@10654 = .sdata2:0x804E0958; // type:object size:0x4 scope:local align:4 data:float +@10655 = .sdata2:0x804E095C; // type:object size:0x4 scope:local align:4 data:float +@10659 = .sdata2:0x804E0960; // type:object size:0x4 scope:local align:4 data:float +@10660 = .sdata2:0x804E0964; // type:object size:0x4 scope:local align:4 data:float +@10667 = .sdata2:0x804E0968; // type:object size:0x4 scope:local align:4 data:float lbl_804E0970 = .sdata2:0x804E0970; // type:object size:0x4 align:4 data:float lbl_804E0974 = .sdata2:0x804E0974; // type:object size:0x4 align:4 data:float lbl_804E0978 = .sdata2:0x804E0978; // type:object size:0x8 align:4 data:float @@ -21525,9 +21562,9 @@ lbl_804E0AC0 = .sdata2:0x804E0AC0; // type:object size:0x8 align:4 data:float lbl_804E0AC8 = .sdata2:0x804E0AC8; // type:object size:0x8 align:4 data:float lbl_804E0AD0 = .sdata2:0x804E0AD0; // type:object size:0x4 align:4 data:float lbl_804E0AD4 = .sdata2:0x804E0AD4; // type:object size:0x4 align:4 data:float -lbl_804E0AD8 = .sdata2:0x804E0AD8; // type:object size:0x4 align:4 data:float -lbl_804E0AE0 = .sdata2:0x804E0AE0; // type:object size:0x8 align:8 data:double -lbl_804E0AE8 = .sdata2:0x804E0AE8; // type:object size:0x8 align:8 data:double +@7413 = .sdata2:0x804E0AD8; // type:object size:0x4 scope:local align:4 data:float +@7416 = .sdata2:0x804E0AE0; // type:object size:0x8 scope:local align:8 data:double +@7418 = .sdata2:0x804E0AE8; // type:object size:0x8 scope:local align:8 data:double lbl_804E0AF0 = .sdata2:0x804E0AF0; // type:object size:0x4 align:4 data:float lbl_804E0AF8 = .sdata2:0x804E0AF8; // type:object size:0x8 align:8 data:double lbl_804E0B00 = .sdata2:0x804E0B00; // type:object size:0x4 align:4 data:float @@ -21543,8 +21580,8 @@ lbl_804E0B10 = .sdata2:0x804E0B10; // type:object size:0x8 align:4 data:float @8471 = .sdata2:0x804E0B2C; // type:object size:0x4 align:4 data:float @8681 = .sdata2:0x804E0B30; // type:object size:0x4 align:4 data:float @8682 = .sdata2:0x804E0B34; // type:object size:0x4 align:4 data:float -lbl_804E0B38 = .sdata2:0x804E0B38; // type:object size:0x4 align:4 data:float -lbl_804E0B40 = .sdata2:0x804E0B40; // type:object size:0x8 align:8 data:double +@7302 = .sdata2:0x804E0B38; // type:object size:0x4 scope:local align:4 data:float +@7305 = .sdata2:0x804E0B40; // type:object size:0x8 scope:local align:8 data:double lbl_804E0B48 = .sdata2:0x804E0B48; // type:object size:0x8 align:8 data:double lbl_804E0B50 = .sdata2:0x804E0B50; // type:object size:0x4 align:4 data:float lbl_804E0B54 = .sdata2:0x804E0B54; // type:object size:0x4 align:4 data:float @@ -21692,20 +21729,20 @@ lbl_804E0F70 = .sdata2:0x804E0F70; // type:object size:0x8 align:8 data:double lbl_804E0F78 = .sdata2:0x804E0F78; // type:object size:0x8 align:8 data:double lbl_804E0F80 = .sdata2:0x804E0F80; // type:object size:0x8 align:8 data:double lbl_804E0F88 = .sdata2:0x804E0F88; // type:object size:0x8 align:8 data:double -lbl_804E0F90 = .sdata2:0x804E0F90; // type:object size:0x8 align:8 data:double -lbl_804E0F98 = .sdata2:0x804E0F98; // type:object size:0x8 align:8 data:double -lbl_804E0FA0 = .sdata2:0x804E0FA0; // type:object size:0x8 align:8 data:double -lbl_804E0FA8 = .sdata2:0x804E0FA8; // type:object size:0x8 align:8 data:double -lbl_804E0FB0 = .sdata2:0x804E0FB0; // type:object size:0x8 align:8 data:double -lbl_804E0FB8 = .sdata2:0x804E0FB8; // type:object size:0x8 align:8 data:double -lbl_804E0FC0 = .sdata2:0x804E0FC0; // type:object size:0x8 align:8 data:double -lbl_804E0FC8 = .sdata2:0x804E0FC8; // type:object size:0x8 align:8 data:double -lbl_804E0FD0 = .sdata2:0x804E0FD0; // type:object size:0x8 align:8 data:double -lbl_804E0FD8 = .sdata2:0x804E0FD8; // type:object size:0x8 align:8 data:double -lbl_804E0FE0 = .sdata2:0x804E0FE0; // type:object size:0x8 align:8 data:double -lbl_804E0FE8 = .sdata2:0x804E0FE8; // type:object size:0x8 align:8 data:double -lbl_804E0FF0 = .sdata2:0x804E0FF0; // type:object size:0x8 align:8 data:double -lbl_804E0FF8 = .sdata2:0x804E0FF8; // type:object size:0x8 align:8 data:double +@19 = .sdata2:0x804E0F90; // type:object size:0x8 scope:local align:8 data:double +@20 = .sdata2:0x804E0F98; // type:object size:0x8 scope:local align:8 data:double +@21 = .sdata2:0x804E0FA0; // type:object size:0x8 scope:local align:8 data:double +@22 = .sdata2:0x804E0FA8; // type:object size:0x8 scope:local align:8 data:double +@23 = .sdata2:0x804E0FB0; // type:object size:0x8 scope:local align:8 data:double +@24 = .sdata2:0x804E0FB8; // type:object size:0x8 scope:local align:8 data:double +@25 = .sdata2:0x804E0FC0; // type:object size:0x8 scope:local align:8 data:double +@130 = .sdata2:0x804E0FC8; // type:object size:0x8 scope:local align:8 data:double +@131 = .sdata2:0x804E0FD0; // type:object size:0x8 scope:local align:8 data:double +@132 = .sdata2:0x804E0FD8; // type:object size:0x8 scope:local align:8 data:double +@133 = .sdata2:0x804E0FE0; // type:object size:0x8 scope:local align:8 data:double +@134 = .sdata2:0x804E0FE8; // type:object size:0x8 scope:local align:8 data:double +@135 = .sdata2:0x804E0FF0; // type:object size:0x8 scope:local align:8 data:double +@137 = .sdata2:0x804E0FF8; // type:object size:0x8 scope:local align:8 data:double lbl_804E1000 = .sdata2:0x804E1000; // type:object size:0x8 align:8 data:double lbl_804E1008 = .sdata2:0x804E1008; // type:object size:0x8 align:8 data:double lbl_804E1010 = .sdata2:0x804E1010; // type:object size:0x8 align:8 data:double @@ -21804,7 +21841,7 @@ lbl_804E11B4 = .sdata2:0x804E11B4; // type:object size:0x4 align:4 data:float lbl_804E11B8 = .sdata2:0x804E11B8; // type:object size:0x4 align:4 data:float lbl_804E11BC = .sdata2:0x804E11BC; // type:object size:0x4 align:4 data:float lbl_804E11C0 = .sdata2:0x804E11C0; // type:object size:0x8 align:8 data:double -lbl_804E11C8 = .sdata2:0x804E11C8; // type:object size:0x4 align:4 data:float +@1111 = .sdata2:0x804E11C8; // type:object size:0x4 scope:local align:4 data:float lbl_804E11D0 = .sdata2:0x804E11D0; // type:object size:0x4 align:4 data:float lbl_804E11D4 = .sdata2:0x804E11D4; // type:object size:0x4 align:4 data:float lbl_804E11D8 = .sdata2:0x804E11D8; // type:object size:0x4 align:4 data:float @@ -21840,12 +21877,12 @@ lbl_804E1284 = .sdata2:0x804E1284; // type:object size:0x4 align:4 data:float lbl_804E1288 = .sdata2:0x804E1288; // type:object size:0x4 align:4 data:float lbl_804E128C = .sdata2:0x804E128C; // type:object size:0x4 align:4 data:float lbl_804E1290 = .sdata2:0x804E1290; // type:object size:0x8 align:4 data:float -lbl_804E1298 = .sdata2:0x804E1298; // type:object size:0x4 align:4 data:float -lbl_804E129C = .sdata2:0x804E129C; // type:object size:0x4 align:4 data:float -lbl_804E12A0 = .sdata2:0x804E12A0; // type:object size:0x4 align:4 data:float -lbl_804E12A4 = .sdata2:0x804E12A4; // type:object size:0x4 align:4 data:float -lbl_804E12A8 = .sdata2:0x804E12A8; // type:object size:0x4 align:4 data:float -lbl_804E12AC = .sdata2:0x804E12AC; // type:object size:0x4 align:4 data:float +@176 = .sdata2:0x804E1298; // type:object size:0x4 scope:local align:4 data:float +@177 = .sdata2:0x804E129C; // type:object size:0x4 scope:local align:4 data:float +@178 = .sdata2:0x804E12A0; // type:object size:0x4 scope:local align:4 data:float +@179 = .sdata2:0x804E12A4; // type:object size:0x4 scope:local align:4 data:float +@182 = .sdata2:0x804E12A8; // type:object size:0x4 scope:local align:4 data:float +@186 = .sdata2:0x804E12AC; // type:object size:0x4 scope:local align:4 data:float lbl_804E12B0 = .sdata2:0x804E12B0; // type:object size:0x4 align:4 data:float lbl_804E12B4 = .sdata2:0x804E12B4; // type:object size:0x4 align:4 data:float lbl_804E12B8 = .sdata2:0x804E12B8; // type:object size:0x8 align:4 data:float @@ -21918,10 +21955,10 @@ lbl_804E13D8 = .sdata2:0x804E13D8; // type:object size:0x8 align:8 data:double lbl_804E13E0 = .sdata2:0x804E13E0; // type:object size:0x4 align:4 data:float lbl_804E13E4 = .sdata2:0x804E13E4; // type:object size:0x4 align:4 data:float lbl_804E13E8 = .sdata2:0x804E13E8; // type:object size:0x8 align:8 data:double -lbl_804E13F0 = .sdata2:0x804E13F0; // type:object size:0x4 align:4 data:float -lbl_804E13F4 = .sdata2:0x804E13F4; // type:object size:0x4 align:4 data:float -lbl_804E13F8 = .sdata2:0x804E13F8; // type:object size:0x4 align:4 data:float -lbl_804E1400 = .sdata2:0x804E1400; // type:object size:0x8 align:8 data:double +@82 = .sdata2:0x804E13F0; // type:object size:0x4 scope:local align:4 data:float +@83 = .sdata2:0x804E13F4; // type:object size:0x4 scope:local align:4 data:float +@84 = .sdata2:0x804E13F8; // type:object size:0x4 scope:local align:4 data:float +@87 = .sdata2:0x804E1400; // type:object size:0x8 scope:local align:8 data:double lbl_804E1408 = .sdata2:0x804E1408; // type:object size:0x4 align:4 data:float lbl_804E140C = .sdata2:0x804E140C; // type:object size:0x4 align:4 data:float lbl_804E1410 = .sdata2:0x804E1410; // type:object size:0x8 align:8 data:double @@ -22113,8 +22150,8 @@ lbl_804E1778 = .sdata2:0x804E1778; // type:object size:0x8 align:8 data:double lbl_804E1780 = .sdata2:0x804E1780; // type:object size:0x4 align:4 data:float lbl_804E1784 = .sdata2:0x804E1784; // type:object size:0x4 align:4 data:float lbl_804E1788 = .sdata2:0x804E1788; // type:object size:0x4 align:4 data:float -@27451 = .sdata2:0x804E1790; // type:object size:0x8 align:8 data:double -@27455 = .sdata2:0x804E1798; // type:object size:0x8 align:8 data:double +@27442 = .sdata2:0x804E1790; // type:object size:0x8 scope:local align:8 data:double +@27446 = .sdata2:0x804E1798; // type:object size:0x8 scope:local align:8 data:double @27045 = .sdata2:0x804E17A0; // type:object size:0x4 align:4 data:float @27050 = .sdata2:0x804E17A8; // type:object size:0x8 align:8 data:double @27052 = .sdata2:0x804E17B0; // type:object size:0x8 align:8 data:double diff --git a/configure.py b/configure.py index 919efa54..59ff5afa 100755 --- a/configure.py +++ b/configure.py @@ -274,6 +274,7 @@ def find_directories(root_path: str, recursive: bool) -> list[str]: else: cflags_base.extend([ "-DNDEBUG", + "-DNW4R_DISABLE_MAPFILE", "-DEGG_DEBUG", "-DRP_PRODUCT", ]) @@ -284,6 +285,11 @@ def find_directories(root_path: str, recursive: bool) -> list[str]: RSPE01_01: "-DNW4R_PRODUCT", }[config.version]) + cflags_base.append({ + RSPE01_00: "-DNW4R_VERSION=0", + RSPE01_01: "-DNW4R_VERSION=20070608", + }[config.version]) + # Warning flags if args.warn == "all": cflags_base.append("-W all") @@ -738,9 +744,9 @@ def MatchingFor(*versions): "cflags": cflags_libnw4r_db, "progress_category": "nw4r", "objects": [ - Object(NonMatching, "nw4r/db/db_directPrint.cpp"), + Object(Matching, "nw4r/db/db_directPrint.cpp"), Object(Matching, "nw4r/db/db_console.cpp"), - Object(NonMatching, "nw4r/db/db_exception.cpp"), + Object(Matching, "nw4r/db/db_exception.cpp"), ] }, { diff --git a/include/nw4r/config.h b/include/nw4r/config.h index 6bd9d482..d137fbf2 100644 --- a/include/nw4r/config.h +++ b/include/nw4r/config.h @@ -1,6 +1,10 @@ #ifndef NW4R_CONFIG_H #define NW4R_CONFIG_H +#if !defined(NW4R_VERSION) +#error Please provide a value for NW4R_VERSION! +#endif + // Binary file byteorder marks #define NW4R_BYTEORDER_LITTLE 0xFFFE #define NW4R_BYTEORDER_BIG 0xFEFF @@ -21,10 +25,18 @@ #define NW4R_FEATURE_ASSERT #define NW4R_FEATURE_EXCEPTION +#if !defined(NW4R_DISABLE_MAPFILE) +#define NW4R_FEATURE_MAPFILE +#endif + // Release configuration enables exception handler #elif defined(NW4R_RELEASE) #define NW4R_FEATURE_EXCEPTION +#if !defined(NW4R_DISABLE_MAPFILE) +#define NW4R_FEATURE_MAPFILE +#endif + // Product configuration disables everything #elif defined(NW4R_PRODUCT) diff --git a/include/nw4r/db.h b/include/nw4r/db.h index 58fc2665..7c72d566 100644 --- a/include/nw4r/db.h +++ b/include/nw4r/db.h @@ -5,5 +5,6 @@ #include #include #include +#include #endif diff --git a/include/nw4r/db/db_assert.h b/include/nw4r/db/db_assert.h index e53b81c1..25fc674a 100644 --- a/include/nw4r/db/db_assert.h +++ b/include/nw4r/db/db_assert.h @@ -5,13 +5,33 @@ #include +#include + namespace nw4r { namespace db { -void Panic(const char* pFile, int line, const char* pFmt, ...); -void VWarning(const char* pFile, int line, const char* pFmt, std::va_list argv); -void Warning(const char* pFile, int line, const char* pFmt, ...); -void Log(const char* pFmt, ...); +// Forward declarations +namespace detail { +struct ConsoleHead; +} // namespace detail +typedef nw4r::db::detail::ConsoleHead* ConsoleHandle; + +/* DECL_WEAK */ void VPanic(const char* pFile, int line, const char* pFmt, + std::va_list argv, bool halt); +/* DECL_WEAK */ void Panic(const char* pFile, int line, const char* pFmt, ...); + +/* DECL_WEAK */ void VWarning(const char* pFile, int line, const char* pFmt, + std::va_list argv); +/* DECL_WEAK */ void Warning(const char* pFile, int line, const char* pFmt, + ...); + +/* DECL_WEAK */ void Log(const char* pFmt, ...); + +ConsoleHandle Assertion_SetConsole(ConsoleHandle console); +ConsoleHandle Assertion_GetConsole(); + +void Assertion_ShowConsole(OSTick time); +void Assertion_SetWarningTime(OSTick time); } // namespace db } // namespace nw4r @@ -23,6 +43,9 @@ void Log(const char* pFmt, ...); // clang-format off +//! Logs a message +#define NW4R_LOG(...) nw4r::db::Log(__VA_ARGS__) + //! Emits a warning #define NW4R_WARN(...) DECOMP_ASSERT(NW4R_WARN_IMPL, NW4R_LINES, __VA_ARGS__) #define NW4R_WARN_IMPL(file, line, ...) \ @@ -41,14 +64,6 @@ void Log(const char* pFmt, ...); "NW4R:Failed assertion " #exp), \ 0)) -//! Halts the program if the specified value falls outside the range -#define NW4R_RANGE_ASSERT(...) DECOMP_ASSERT(NW4R_RANGE_ASSERT_IMPL, NW4R_LINES, __VA_ARGS__) -#define NW4R_RANGE_ASSERT_IMPL(file, line, exp) \ - ((exp) && 1 || \ - (nw4r::db::Panic(file, line, \ - "NW4R:Failed assertion " #exp), \ - 0)) - //! Halts the program if the specified value is misaligned #define NW4R_ALIGN_ASSERT(...) DECOMP_ASSERT(NW4R_ALIGN_ASSERT_IMPL, NW4R_LINES, __VA_ARGS__) #define NW4R_ALIGN_ASSERT_IMPL(file, line, value, alignment) \ @@ -97,7 +112,6 @@ void Log(const char* pFmt, ...); #define NW4R_PANIC(...) #define NW4R_ASSERT(...) #define NW4R_ASSERT_MSG(...) -#define NW4R_RANGE_ASSERT(...) #define NW4R_ALIGN_ASSERT(...) #define NW4R_NULL_ASSERT(...) #define NW4R_POINTER_ASSERT(...) diff --git a/include/nw4r/db/db_console.h b/include/nw4r/db/db_console.h index a3063d43..d8ef7ec5 100644 --- a/include/nw4r/db/db_console.h +++ b/include/nw4r/db/db_console.h @@ -19,8 +19,8 @@ enum ConsoleOutputType { enum ConsoleAttr { CONSOLE_ATTR_NO_WRAP = 1 << 0, CONSOLE_ATTR_NO_OVERFLOW = 1 << 1, - CONSOLE_ATTR_INDENT4 = 1 << 2, - CONSOLE_ATTR_INDENT8 = 1 << 3, + CONSOLE_ATTR_INDENT_4 = 1 << 2, + CONSOLE_ATTR_INDENT_8 = 1 << 3, }; namespace detail { @@ -40,7 +40,7 @@ struct ConsoleHead { s16 viewPosX; // at 0x1C s16 viewPosY; // at 0x1E u16 viewLines; // at 0x20 - u8 isVisible; // at 0x22 + bool isVisible; // at 0x22 u8 PADDING[0x24 - 0x23]; // at 0x23 nw4r::ut::TextWriter* writer; // at 0x24 ConsoleHead* next; // at 0x28 @@ -73,12 +73,55 @@ static inline void Console_VPrintf(ConsoleHandle console, const char* pFmt, Console_VFPrintf(CONSOLE_OUTPUT_ALL, console, pFmt, argv); } +static inline void Console_VPrintfD(ConsoleHandle console, const char* pFmt, + std::va_list argv) { + + Console_VFPrintf(CONSOLE_OUTPUT_DISPLAY, console, pFmt, argv); +} + +static inline void Console_VPrintfT(ConsoleHandle console, const char* pFmt, + std::va_list argv) { + + Console_VFPrintf(CONSOLE_OUTPUT_TERMINAL, console, pFmt, argv); +} + +static inline s32 Console_GetBufferHeadLine(ConsoleHandle console) { + NW4R_NULL_ASSERT(console); + + return console->ringTopLineCnt; +} + +static inline s16 Console_GetPositionX(ConsoleHandle console) { + NW4R_NULL_ASSERT(console); + + return console->viewPosX; +} + +static inline s16 Console_GetPositionY(ConsoleHandle console) { + NW4R_NULL_ASSERT(console); + + return console->viewPosY; +} + +static inline void Console_SetPosition(ConsoleHandle console, s32 x, s32 y) { + NW4R_NULL_ASSERT(console); + + console->viewPosX = x; + console->viewPosY = y; +} + static inline u16 Console_GetViewHeight(ConsoleHandle console) { NW4R_NULL_ASSERT(LINE(433), console); return console->viewLines; } +static inline bool Console_IsVisible(ConsoleHandle console) { + NW4R_NULL_ASSERT(console); + + return console->isVisible; +} + static inline bool Console_SetVisible(ConsoleHandle console, bool visible) { NW4R_NULL_ASSERT(LINE(496), console); diff --git a/include/nw4r/db/db_exception.h b/include/nw4r/db/db_exception.h index 0cca1304..401b90a5 100644 --- a/include/nw4r/db/db_exception.h +++ b/include/nw4r/db/db_exception.h @@ -3,96 +3,40 @@ #include -#include - #include -#include namespace nw4r { namespace db { -enum ExceptionDisplayInfo { - EXCEPTION_INFO_MAIN = 1 << 0, - EXCEPTION_INFO_GPR = 1 << 1, - EXCEPTION_INFO_GPRMAP = 1 << 2, - EXCEPTION_INFO_SRR0MAP = 1 << 3, - EXCEPTION_INFO_FPR = 1 << 4, - EXCEPTION_INFO_TRACE = 1 << 5, +// Forward declarations +namespace detail { +struct ConsoleHead; +} // namespace detail +typedef nw4r::db::detail::ConsoleHead* ConsoleHandle; - EXCEPTION_INFO_ALL = (1 << 6) - 1, - EXCEPTION_INFO_DEFAULT = EXCEPTION_INFO_MAIN | EXCEPTION_INFO_TRACE -}; - -struct ExceptionCallbackParam { - u16 error; // at 0x0 - u8 PADDING[2]; // at 0x2 - OSContext* context; // at 0x4 - u32 dsisr; // at 0x8 - u32 dar; // at 0xC -}; +typedef bool (*ExceptionUserCallback)(ConsoleHandle console, + void* pCallbackArg); -/** - * @brief Function to be executed upon an exception occurring. - * - * @param console The specified console handle. - * @param arg The specified callback argument. - * @return bool: Returns TRUE if the callback is executed more than once. - */ -typedef bool (*ExceptionUserCallback)(ConsoleHandle pConsole, void* pArg); - -struct ExceptionHead { - OSThread thread; // at 0x0 - OSMessageQueue msgQueue; // at 0x318 - void* frameMemory; // at 0x338 - u32 stackPointer; // at 0x33C - ConsoleHandle console; // at 0x340 - const GXRenderModeObj* renderMode; // at 0x344 - ExceptionUserCallback callback; // at 0x348 - void* callbackArg; // at 0x34C - u32 msr; // at 0x350 - u32 fpscr; // at 0x354 - u16 dispInfo; // at 0x358 - u8 PADDING[6]; // at 0x35A +enum ExceptionDisplayInfo { + EXCEPTION_DISPLAY_MAININFO = 1 << 0, + EXCEPTION_DISPLAY_GPR = 1 << 1, + EXCEPTION_DISPLAY_GPRMAP = 1 << 2, + EXCEPTION_DISPLAY_SRR0 = 1 << 3, + EXCEPTION_DISPLAY_FPR = 1 << 4, + EXCEPTION_DISPLAY_STACKTRACE = 1 << 5, }; -/** - * @brief Creates a thread with the highest priority to handle exceptions. - */ void Exception_Init(); -/** - * @brief Sets the console for displaying exception info. - * - * @param console The specified console handle. - * @param renderMode Render mode pointer, stored as a GXRenderModeObj. - * @return ConsoleHandle: The console prior to executing the function. - */ ConsoleHandle Exception_SetConsole(ConsoleHandle console, const GXRenderModeObj* pRenderMode); - -/** - * @brief Returns the currently set console for displaying exception info. - * - * @return ConsoleHandle: Ditto. - */ ConsoleHandle Exception_GetConsole(); -/** - * @brief Sets the function to be executed upon an exception occurring. - * - * @param callback Callback function itself. - * @param arg Argument to be passed to callback. - */ -void Exception_SetUserCallback(ExceptionUserCallback callback, void* pArg); +void Exception_SetUserCallback(ExceptionUserCallback pCallback, + void* pCallbackArg); + +u16 Exception_SetDisplayInfo(u16 displayInfo); -/** - * @brief Sets which info is to be displayed/reported on screen or by serial. - * Defaults to Main and Trace. - * - * @param info The new display info setting. - * @return ExceptionDisplayInfo: The prior display info setting. - */ -u16 Exception_SetDisplayInfo(u16 pInfo); } // namespace db } // namespace nw4r diff --git a/include/nw4r/db/db_mapFile.h b/include/nw4r/db/db_mapFile.h new file mode 100644 index 00000000..231c3c7d --- /dev/null +++ b/include/nw4r/db/db_mapFile.h @@ -0,0 +1,32 @@ +#ifndef NW4R_DB_MAP_FILE_H +#define NW4R_DB_MAP_FILE_H + +#include + +#include + +namespace nw4r { +namespace db { + +struct MapFile { + u8* mapBuf; // at 0x0 + const OSModuleInfo* moduleInfo; // at 0x4 + s32 fileEntry; // at 0x8 + MapFile* next; // at 0xC +}; + +MapFile* MapFile_RegistOnMem(void* pMapWork, u8* pMapData, u32 fileSize, + const OSModuleInfo* pModuleInfo); +MapFile* MapFile_RegistOnDvd(void* pMapWork, const char* pPath, + const OSModuleInfo* pModuleInfo); + +void MapFile_Unregist(MapFile* pMapFile); +void MapFile_UnregistAll(); + +bool MapFile_Exists(); +bool MapFile_QuerySymbol(u32 address, u8* pBuffer, u32 maxlen); + +} // namespace db +} // namespace nw4r + +#endif diff --git a/include/nw4r/snd/snd_BankFile.h b/include/nw4r/snd/snd_BankFile.h index 9b7b87dd..212de8bb 100644 --- a/include/nw4r/snd/snd_BankFile.h +++ b/include/nw4r/snd/snd_BankFile.h @@ -4,9 +4,9 @@ #include #include - #include + namespace nw4r { namespace snd { namespace detail { @@ -90,7 +90,7 @@ struct InstInfo { class BankFileReader { public: static const u32 SIGNATURE = FOURCC('R', 'B', 'N', 'K'); - static const int VERSION = NW4R_VERSION(1, 1); + static const int VERSION = NW4R_FILE_VERSION(1, 1); public: explicit BankFileReader(const void* pBankBin); diff --git a/include/nw4r/snd/snd_RemoteSpeaker.h b/include/nw4r/snd/snd_RemoteSpeaker.h index bd8abaf3..53a50eef 100644 --- a/include/nw4r/snd/snd_RemoteSpeaker.h +++ b/include/nw4r/snd/snd_RemoteSpeaker.h @@ -89,7 +89,7 @@ class RemoteSpeaker { WPADCallback mWpadCallback; // at 0x3C OSAlarm mContinueAlarm; // at 0x40 OSAlarm mIntervalAlarm; // at 0x70 - s64 mContinueBeginTime; // at 0xA0 + OSTime mContinueBeginTime; // at 0xA0 }; } // namespace snd diff --git a/include/nw4r/snd/snd_SeqFile.h b/include/nw4r/snd/snd_SeqFile.h index 1e43f52b..9341dd60 100644 --- a/include/nw4r/snd/snd_SeqFile.h +++ b/include/nw4r/snd/snd_SeqFile.h @@ -38,7 +38,7 @@ struct DataBlock { class SeqFileReader { public: static const u32 SIGNATURE = FOURCC('R', 'S', 'E', 'Q'); - static const int VERSION = NW4R_VERSION(1, 0); + static const int VERSION = NW4R_FILE_VERSION(1, 0); public: explicit SeqFileReader(const void* pSeqBin); diff --git a/include/nw4r/snd/snd_SoundArchiveFile.h b/include/nw4r/snd/snd_SoundArchiveFile.h index 0a230c0b..00e53b32 100644 --- a/include/nw4r/snd/snd_SoundArchiveFile.h +++ b/include/nw4r/snd/snd_SoundArchiveFile.h @@ -4,9 +4,9 @@ #include #include - #include + namespace nw4r { namespace snd { namespace detail { @@ -198,7 +198,7 @@ static const int HEADER_AREA_SIZE = ROUND_UP(sizeof(Header), 32) + 40; class SoundArchiveFileReader { public: static const u32 SIGNATURE = FOURCC('R', 'S', 'A', 'R'); - static const int VERSION = NW4R_VERSION(1, 3); + static const int VERSION = NW4R_FILE_VERSION(1, 3); public: SoundArchiveFileReader(); diff --git a/include/nw4r/snd/snd_SoundThread.h b/include/nw4r/snd/snd_SoundThread.h index b17317b4..c7f3f35e 100644 --- a/include/nw4r/snd/snd_SoundThread.h +++ b/include/nw4r/snd/snd_SoundThread.h @@ -3,11 +3,11 @@ #include #include - #include #include + namespace nw4r { namespace snd { namespace detail { @@ -105,8 +105,8 @@ class SoundThread { SoundFrameCallbackList mSoundFrameCallbackList; // at 0x378 PlayerCallbackList mPlayerCallbackList; // at 0x384 - u32 mProcessTick; // at 0x390 - bool mCreateFlag; // at 0x394 + OSTick mProcessTick; // at 0x390 + bool mCreateFlag; // at 0x394 }; } // namespace detail diff --git a/include/nw4r/snd/snd_StrmFile.h b/include/nw4r/snd/snd_StrmFile.h index 96e2a46a..40cc6d6e 100644 --- a/include/nw4r/snd/snd_StrmFile.h +++ b/include/nw4r/snd/snd_StrmFile.h @@ -4,9 +4,9 @@ #include #include - #include + namespace nw4r { namespace snd { namespace detail { @@ -104,7 +104,7 @@ struct StrmInfo { class StrmFileReader { public: static const u32 SIGNATURE = FOURCC('R', 'S', 'T', 'M'); - static const int VERSION = NW4R_VERSION(1, 0); + static const int VERSION = NW4R_FILE_VERSION(1, 0); public: StrmFileReader(); diff --git a/include/nw4r/snd/snd_WsdFile.h b/include/nw4r/snd/snd_WsdFile.h index 44bd6c82..d7599aa0 100644 --- a/include/nw4r/snd/snd_WsdFile.h +++ b/include/nw4r/snd/snd_WsdFile.h @@ -1,9 +1,9 @@ #ifndef NW4R_SND_WSD_FILE_H #define NW4R_SND_WSD_FILE_H #include - #include + namespace nw4r { namespace snd { namespace detail { @@ -82,7 +82,7 @@ struct WaveBlock { u32 offsetTable[]; // at 0xC }; -// <= NW4R_VERSION(1, 0) +// <= NW4R_FILE_VERSION(1, 0) struct WaveBlockOld { ut::BinaryBlockHeader blockHeader; // at 0x0 u32 offsetTable[]; // at 0x8 @@ -121,7 +121,7 @@ struct WaveSoundNoteInfo { class WsdFileReader { public: static const u32 SIGNATURE = FOURCC('R', 'W', 'S', 'D'); - static const int VERSION = NW4R_VERSION(1, 2); + static const int VERSION = NW4R_FILE_VERSION(1, 2); public: explicit WsdFileReader(const void* pWsdBin); diff --git a/include/nw4r/types_nw4r.h b/include/nw4r/types_nw4r.h index b6d1a41c..b6f47979 100644 --- a/include/nw4r/types_nw4r.h +++ b/include/nw4r/types_nw4r.h @@ -4,7 +4,7 @@ #include -#define NW4R_VERSION(major, minor) ((major & 0xFF) << 8 | minor & 0xFF) +#define NW4R_FILE_VERSION(major, minor) ((major & 0xFF) << 8 | minor & 0xFF) #define NW4R_LIB_VERSION(NAME, ORIGINAL_DATE, ORIGINAL_TIME, ORIGINAL_CWCC) \ const char* NW4R_##NAME##_Version_ = \ diff --git a/include/revolution/OS/OSAlarm.h b/include/revolution/OS/OSAlarm.h index 16979643..408f5acf 100644 --- a/include/revolution/OS/OSAlarm.h +++ b/include/revolution/OS/OSAlarm.h @@ -1,6 +1,9 @@ #ifndef RVL_SDK_OS_ALARM_H #define RVL_SDK_OS_ALARM_H #include + +#include + #ifdef __cplusplus extern "C" { #endif @@ -14,11 +17,11 @@ typedef void (*OSAlarmHandler)(OSAlarm* alarm, OSContext* ctx); typedef struct OSAlarm { OSAlarmHandler handler; // at 0x0 u32 tag; // at 0x4 - s64 end; // at 0x8 + OSTime fire; // at 0x8 OSAlarm* prev; // at 0x10 OSAlarm* next; // at 0x14 s64 period; // at 0x18 - s64 start; // at 0x20 + OSTime start; // at 0x20 void* userData; // at 0x28 } OSAlarm; @@ -30,7 +33,7 @@ typedef struct OSAlarmQueue { void __OSInitAlarm(void); void OSCreateAlarm(OSAlarm* alarm); void OSSetAlarm(OSAlarm* alarm, s64 tick, OSAlarmHandler handler); -void OSSetPeriodicAlarm(OSAlarm* alarm, s64 tick, s64 period, +void OSSetPeriodicAlarm(OSAlarm* alarm, OSTime start, s64 period, OSAlarmHandler handler); void OSCancelAlarm(OSAlarm* alarm); void OSSetAlarmTag(OSAlarm* alarm, u32 tag); diff --git a/include/revolution/OS/OSCache.h b/include/revolution/OS/OSCache.h index 71d46691..44fda95d 100644 --- a/include/revolution/OS/OSCache.h +++ b/include/revolution/OS/OSCache.h @@ -34,8 +34,6 @@ void L2Enable(void); void L2Disable(void); void L2GlobalInvalidate(void); -void DMAErrorHandler(u8 error, OSContext* ctx, u32 dsisr, u32 dar, ...); - void __OSCacheInit(void); #ifdef __cplusplus diff --git a/include/revolution/OS/OSError.h b/include/revolution/OS/OSError.h index ee606079..9fea42c4 100644 --- a/include/revolution/OS/OSError.h +++ b/include/revolution/OS/OSError.h @@ -22,34 +22,35 @@ typedef struct OSContext OSContext; OSPanic(__FILE__, __LINE__, __VA_ARGS__) typedef enum { - OS_ERR_SYSTEM_RESET, - OS_ERR_MACHINE_CHECK, - OS_ERR_DSI, - OS_ERR_ISI, - OS_ERR_EXT_INTERRUPT, - OS_ERR_ALIGNMENT, - OS_ERR_PROGRAM, - OS_ERR_FP_UNAVAIL, - OS_ERR_DECREMENTER, - OS_ERR_SYSTEM_CALL, - OS_ERR_TRACE, - OS_ERR_PERF_MONITOR, - OS_ERR_IABR, - OS_ERR_SMI, - OS_ERR_THERMAL_INT, - OS_ERR_PROTECTION, - OS_ERR_FP_EXCEPTION, - - OS_ERR_MAX + OS_ERROR_SYSTEM_RESET, + OS_ERROR_MACHINE_CHECK, + OS_ERROR_DSI, + OS_ERROR_ISI, + OS_ERROR_EXTERNAL_INTERRUPT, + OS_ERROR_ALIGNMENT, + OS_ERROR_PROGRAM, + OS_ERROR_FLOATING_POINT, + OS_ERROR_DECREMENTER, + OS_ERROR_SYSTEM_CALL, + OS_ERROR_TRACE, + OS_ERROR_PERFORMACE_MONITOR, // typo + OS_ERROR_BREAKPOINT, + OS_ERROR_SYSTEM_INTERRUPT, + OS_ERROR_THERMAL_INTERRUPT, + OS_ERROR_PROTECTION, + OS_ERROR_FPE, + + OS_ERROR_MAX } OSErrorType; -typedef void (*OSErrorHandler)(u8 error, OSContext* ctx, u32 dsisr, u32 dar, +typedef void (*OSErrorHandler)(u16 error, OSContext* ctx, u32 dsisr, u32 dar, ...); -extern OSErrorHandler __OSErrorTable[OS_ERR_MAX]; +extern OSErrorHandler __OSErrorTable[OS_ERROR_MAX]; extern u32 __OSFpscrEnableBits; /* DECL_WEAK */ void OSReport(const char* msg, ...); +/* DECL_WEAK */ void OSVReport(const char* msg, va_list argv); /* DECL_WEAK */ void OSPanic(const char* file, int line, const char* msg, ...); OSErrorHandler OSSetErrorHandler(u16 error, OSErrorHandler handler); diff --git a/include/revolution/OS/OSLink.h b/include/revolution/OS/OSLink.h index e039336b..c05276f0 100644 --- a/include/revolution/OS/OSLink.h +++ b/include/revolution/OS/OSLink.h @@ -5,6 +5,26 @@ extern "C" { #endif +typedef struct OSModuleLink { + struct OSModuleInfo* next; // at 0x0 + struct OSModuleInfo* prev; // at 0x4 +} OSModuleLink; + +typedef struct OSModuleInfo { + u32 id; // at 0x0 + OSModuleLink link; // at 0x4 + u32 numSections; // at 0xC + u32 sectionInfoOffset; // at 0x10 + u32 nameOffset; // at 0x14 + u32 nameSize; // at 0x18 + u32 version; // at 0x1C +} OSModuleInfo; + +typedef struct OSSectionInfo { + u32 offset; // at 0x0 + u32 size; // at 0x0 +} OSSectionInfo; + void __OSModuleInit(void); #ifdef __cplusplus diff --git a/include/revolution/OS/OSMemory.h b/include/revolution/OS/OSMemory.h index 45de4879..a9bf690e 100644 --- a/include/revolution/OS/OSMemory.h +++ b/include/revolution/OS/OSMemory.h @@ -17,6 +17,20 @@ extern "C" { #define OS_IS_MEM1_REGION(addr) OSIsMEM1Region(addr) #define OS_IS_MEM2_REGION(addr) OSIsMEM2Region(addr) +typedef enum OSProtectChannel { + OS_PROTECT_CHANNEL_0, + OS_PROTECT_CHANNEL_1, + OS_PROTECT_CHANNEL_2, + OS_PROTECT_CHANNEL_3, +} OSProtectChannel; + +typedef enum OSProtectControl { + OS_PROTECT_CONTROL_NONE = 0, + OS_PROTECT_CONTROL_RD = 1 << 0, + OS_PROTECT_CONTROL_WR = 1 << 1, + OS_PROTECT_CONTROL_RDWR = OS_PROTECT_CONTROL_RD | OS_PROTECT_CONTROL_WR, +} OSProtectControl; + u32 OSGetPhysicalMem1Size(void); u32 OSGetPhysicalMem2Size(void); u32 OSGetConsoleSimulatedMem1Size(void); diff --git a/include/revolution/OS/OSTime.h b/include/revolution/OS/OSTime.h index 2ae09230..1bc48e8d 100644 --- a/include/revolution/OS/OSTime.h +++ b/include/revolution/OS/OSTime.h @@ -3,10 +3,14 @@ #include #include + #ifdef __cplusplus extern "C" { #endif +typedef u32 OSTick; +typedef s64 OSTime; + // Time base frequency = 1/4 bus clock #define OS_TIME_SPEED (OS_BUS_CLOCK_SPEED / 4) @@ -38,13 +42,13 @@ typedef struct OSCalendarTime { s32 usec; // at 0x24 } OSCalendarTime; -s64 OSGetTime(void); -u32 OSGetTick(void); +OSTime OSGetTime(void); +OSTick OSGetTick(void); -s64 __OSGetSystemTime(void); -s64 __OSTimeToSystemTime(s64 time); +OSTime __OSGetSystemTime(void); +OSTime __OSTimeToSystemTime(OSTime time); -void OSTicksToCalendarTime(s64 time, OSCalendarTime* cal); +void OSTicksToCalendarTime(s64 ticks, OSCalendarTime* cal); s64 OSCalendarTimeToTicks(const OSCalendarTime* cal); #ifdef __cplusplus diff --git a/src/nw4r/db/db_assert.cpp b/src/nw4r/db/db_assert.cpp new file mode 100644 index 00000000..92d37be2 --- /dev/null +++ b/src/nw4r/db/db_assert.cpp @@ -0,0 +1,217 @@ +#include + +#include +#include +#include + +namespace nw4r { +namespace db { + +static OSTick sWarningTime = 0; +static ConsoleHandle sAssertionConsole = NULL; +static bool sDispWarningAuto = true; + +static void Assertion_Printf_(const char* pFmt, ...) { + std::va_list argv; + va_start(argv, pFmt); + + if (sAssertionConsole != NULL) { + Console_VPrintf(sAssertionConsole, pFmt, argv); + } else { + OSVReport(pFmt, argv); + } + + va_end(argv); +} + +#if defined(NW4R_FEATURE_MAPFILE) +static bool ShowMapInfoSubroutine_(u32 address, bool preNewline) { + if (address < 0x80000000 || address > 0x82FFFFFF) { + return false; + } + + // TODO(kiwi) Where does this number come from? + u8 buffer[256 + 4]; + bool success = MapFile_QuerySymbol(address, buffer, sizeof(buffer)); + + if (success) { + if (preNewline) { + Assertion_Printf_("\n"); + } + + Assertion_Printf_("%s\n", reinterpret_cast(buffer)); + return true; + } + + return false; + return false; +} +#else +static bool ShowMapInfoSubroutine_(u32 /* address */, bool /* preNewline */) { + return false; +} +#endif + +static void ShowStack_(u32 sp) { + Assertion_Printf_("-------------------------------- TRACE\n"); + Assertion_Printf_("Address: BackChain LR save\n"); + + u32* it = reinterpret_cast(sp); + u32 i; + + for (i = 0; i < 16; i++) { + if (it == NULL || reinterpret_cast(it) == 0xFFFFFFFF) { + break; + } + + if (!(reinterpret_cast(it) & 0x80000000)) { + break; + } + + Assertion_Printf_("%08X: %08X %08X ", it, it[0], it[1]); + + if (!ShowMapInfoSubroutine_(it[1], false)) { + Assertion_Printf_("\n"); + } + + it = reinterpret_cast(*it); + } +} + +DECL_WEAK void VPanic(const char* pFile, int line, const char* pFmt, + std::va_list argv, bool halt) { + register u32 sp_; + ASM ( + mr sp_, r1 + lwz sp_, 0(sp_) // skip VPanic frame + ) + + OSDisableInterrupts(); + OSDisableScheduler(); + + VISetPreRetraceCallback(NULL); + VISetPostRetraceCallback(NULL); + + if (sAssertionConsole != NULL) { + detail::DirectPrint_SetupFB(NULL); + } + + ShowStack_(sp_); + + if (sAssertionConsole != NULL) { + Console_Printf(sAssertionConsole, "%s:%d Panic:", pFile, line); + Console_VPrintf(sAssertionConsole, pFmt, argv); + Console_Printf(sAssertionConsole, "\n"); + + Console_ShowLatestLine(sAssertionConsole); + Console_SetVisible(sAssertionConsole, true); + Console_DrawDirect(sAssertionConsole); + } else { + OSReport("%s:%d Panic:", pFile, line); + OSVReport(pFmt, argv); + OSReport("\n"); + } + + if (halt) { + PPCHalt(); + } +} + +DECL_WEAK void Panic(const char* pFile, int line, const char* pFmt, ...) { + std::va_list argv; + va_start(argv, pFmt); + VPanic(pFile, line, pFmt, argv, true); + va_end(argv); + + PPCHalt(); +} + +DECL_WEAK void VWarning(const char* pFile, int line, const char* pFmt, + std::va_list argv) { + if (sAssertionConsole != NULL) { + Console_Printf(sAssertionConsole, "%s:%d Warning:", pFile, line); + Console_VPrintf(sAssertionConsole, pFmt, argv); + Console_Printf(sAssertionConsole, "\n"); + + Console_ShowLatestLine(sAssertionConsole); + + if (sDispWarningAuto) { + Assertion_ShowConsole(sWarningTime); + } + } else { + OSReport("%s:%d Warning:", pFile, line); + OSVReport(pFmt, argv); + OSReport("\n"); + } +} + +DECL_WEAK void Warning(const char* pFile, int line, const char* pFmt, ...) { + std::va_list argv; + va_start(argv, pFmt); + VWarning(pFile, line, pFmt, argv); + va_end(argv); +} + +DECL_WEAK void Log(const char* pFmt, ...) { + std::va_list argv; + va_start(argv, pFmt); + + if (sAssertionConsole != NULL) { + Console_VPrintf(sAssertionConsole, pFmt, argv); + } else { + OSVReport(pFmt, argv); + } + + va_end(argv); +} + +ConsoleHandle Assertion_SetConsole(ConsoleHandle console) { + ConsoleHandle old = sAssertionConsole; + sAssertionConsole = console; + return old; +} + +ConsoleHandle Assertion_GetConsole() { + return sAssertionConsole; +} + +static OSAlarm& GetWarningAlarm_() { + static bool sInitializedAlarm = false; + static OSAlarm sWarningAlarm; + + if (!sInitializedAlarm) { + OSCreateAlarm(&sWarningAlarm); + sInitializedAlarm = true; + } + + return sWarningAlarm; +} + +static void WarningAlarmFunc_(OSAlarm* /* pAlarm */, + OSContext* /* pContext */) { + if (sAssertionConsole != NULL) { + Console_SetVisible(sAssertionConsole, false); + } +} + +void Assertion_ShowConsole(OSTick time) { + if (sAssertionConsole == NULL) { + return; + } + + OSAlarm& rAlarm = GetWarningAlarm_(); + + OSCancelAlarm(&rAlarm); + Console_SetVisible(sAssertionConsole, true); + + if (time > 0) { + OSSetAlarm(&rAlarm, time, WarningAlarmFunc_); + } +} + +void Assertion_SetWarningTime(OSTick time) { + sWarningTime = time; +} + +} // namespace db +} // namespace nw4r diff --git a/src/nw4r/db/db_console.cpp b/src/nw4r/db/db_console.cpp index 3f28d174..03d4a8ad 100644 --- a/src/nw4r/db/db_console.cpp +++ b/src/nw4r/db/db_console.cpp @@ -58,7 +58,7 @@ static const u8* SearchEndOfLine_(const u8* pStr) { static u32 GetTabSize_(ConsoleHandle console) { s32 tab = - (console->attr & (CONSOLE_ATTR_INDENT4 | CONSOLE_ATTR_INDENT8)) >> 2; + (console->attr & (CONSOLE_ATTR_INDENT_4 | CONSOLE_ATTR_INDENT_8)) >> 2; return 2 << tab; } @@ -147,7 +147,7 @@ static ConsoleHandle SearchConsoleFromListByPriority_(u16 priority) { return console; } -static void AppendConsoleToList(ConsoleHandle console) { +static void AppendConsoleToList_(ConsoleHandle console) { NW4R_NULL_ASSERT(console); OSLockMutex(&sMutex); @@ -165,7 +165,7 @@ static void AppendConsoleToList(ConsoleHandle console) { OSUnlockMutex(&sMutex); } -static void RemoveConsoleFromList(ConsoleHandle console) DECOMP_DONT_INLINE { +static void RemoveConsoleFromList_(ConsoleHandle console) DECOMP_DONT_INLINE { NW4R_NULL_ASSERT(console); OSLockMutex(&sMutex); @@ -221,7 +221,7 @@ ConsoleHandle Console_Create(void* pConsoleWork, u16 width, u16 height, console->writer = NULL; Console_Clear(console); - AppendConsoleToList(console); + AppendConsoleToList_(console); return console; } @@ -229,7 +229,7 @@ ConsoleHandle Console_Create(void* pConsoleWork, u16 width, u16 height, ConsoleHandle Console_Destroy(ConsoleHandle console) { NW4R_NULL_ASSERT(console); - RemoveConsoleFromList(console); + RemoveConsoleFromList_(console); return console; } diff --git a/src/nw4r/db/db_directPrint.cpp b/src/nw4r/db/db_directPrint.cpp index 1c284f61..c38b886e 100644 --- a/src/nw4r/db/db_directPrint.cpp +++ b/src/nw4r/db/db_directPrint.cpp @@ -15,6 +15,13 @@ namespace nw4r { namespace db { +// Forward declarations +static void DrawStringToXfb_(int x, int y, const char* pStr, bool turnOver, + bool backErase); +static const char* DrawStringLineToXfb_(int x, int y, const char* str, + int width); +static void DrawCharToXfb_(int x, int y, int code); + struct FrameBufferInfo { u8* frameMemory; // at 0x0 u32 frameSize; // at 0x4 @@ -86,12 +93,33 @@ static const u32 sFontData2[] = { 0xF8000000, 0x10000000, 0x20000000, 0x40000000, 0xF8000000, }; -static int GetDotHeight_() { +static inline int GetDotWidth_() { + return sFrameBufferInfo.frameWidth < 400 ? 1 : 2; +} + +static inline int GetDotHeight_() { return sFrameBufferInfo.frameHeight < 300 ? 1 : 2; } -static int GetDotWidth_() { - return sFrameBufferInfo.frameWidth < 400 ? 1 : 2; +static inline int StrLineWidth_(const char* pStr) { + int len = 0; + char c; + + NW4R_NULL_ASSERT(LINE(304), pStr); + + while (true) { + c = *pStr++; + + if (c == '\0' || c == '\n') { + return len; + } + + if (c == '\t') { + len = ROUND_DOWN(len + 4, 4); + } else { + len++; + } + } } void DirectPrint_Init() { @@ -254,25 +282,113 @@ GXColor DirectPrint_GetColor() { return sFrameBufferColor.colorRGBA; } -static int StrLineWidth_(const char* pStr) { - int len = 0; - char c; +namespace detail { - NW4R_NULL_ASSERT(LINE(304), pStr); +void DirectPrint_DrawStringToXfb(int x, int y, const char* pFmt, + std::va_list list, bool turnOver, + bool backErase) { + NW4R_NULL_ASSERT(LINE(645), sFrameBufferInfo.frameMemory); - while (true) { - c = *pStr++; + char buffer[256]; + int length = std::vsnprintf(buffer, sizeof(buffer), pFmt, list); - if (c == '\0' || c == '\n') { - return len; + int start = x; // unused + if (length > 0) { + DrawStringToXfb_(x, y, buffer, turnOver, backErase); + } +} + +} // namespace detail + +static void DrawStringToXfb_(int x, int y, const char* pStr, bool turnOver, + bool backErase) { + int x1; + int width, fbWidth; + + x1 = x; + fbWidth = sFrameBufferInfo.frameWidth / GetDotWidth_(); + + while (*pStr != '\0') { + if (backErase) { + int len = StrLineWidth_(pStr); + DirectPrint_EraseXfb(x - 6, y - 3, + (len + 2) * NW4R_DB_FONT_CHAR_WIDTH, 13); } - if (c == '\t') { - len = ROUND_DOWN(len + 4, 4); + width = (fbWidth - x) / NW4R_DB_FONT_CHAR_WIDTH; + pStr = DrawStringLineToXfb_(x, y, pStr, width); + y += NW4R_DB_FONT_LEADING; + + if (*pStr == '\n') { + pStr++; + x = x1; + } else if (*pStr != '\0') { + pStr++; + + if (!turnOver) { + pStr = std::strchr(pStr, '\n'); + if (pStr == NULL) { + break; + } + + pStr++; + x = x1; + } else { + x = 0; + } + } + } +} + +static const char* DrawStringLineToXfb_(int x, int y, const char* str, + int width) { + char ch; + int code; + int count = 0; + + NW4R_NULL_ASSERT(LINE(743), str); + NW4R_ASSERT(LINE(744), width > 0); + + while ((ch = *str) != '\0') { + // Line or string has ended, stop drawing + if (ch == '\n' || ch == '\0') { + return str; + } + + // Convert to font code + code = sAsciiTable[ch & 0x7F]; + + // Tab character + if (code == 0xFD) { + int tabSize = TAB_SIZE - (count & (TAB_SIZE - 1)); + x += tabSize * NW4R_DB_FONT_CHAR_WIDTH; + count += tabSize; } else { - len++; + // Non-tab character + if (code != 0xFF) { + DrawCharToXfb_(x, y, code); + } + + // 0xFF is treated as whitespace + x += NW4R_DB_FONT_CHAR_WIDTH; + count++; } + + // Stop at max line width + if (count >= width) { + // Skip over newline if it comes next. + // It wouldn't take up view space anyways. + if (str[1] == '\n') { + str++; + } + + return str; + } + + str++; } + + return str; } static void DrawCharToXfb_(int x, int y, int code) { @@ -352,113 +468,8 @@ static void DrawCharToXfb_(int x, int y, int code) { } } -static const char* DrawStringLineToXfb_(int x, int y, const char* str, - int width) { - char ch; - int code; - int count = 0; - - NW4R_NULL_ASSERT(LINE(743), str); - NW4R_ASSERT(LINE(744), width > 0); - - while ((ch = *str) != '\0') { - // Line or string has ended, stop drawing - if (ch == '\n' || ch == '\0') { - return str; - } - - // Convert to font code - code = sAsciiTable[ch & 0x7F]; - - // Tab character - if (code == 0xFD) { - int tabSize = TAB_SIZE - (count & (TAB_SIZE - 1)); - x += tabSize * NW4R_DB_FONT_CHAR_WIDTH; - count += tabSize; - } else { - // Non-tab character - if (code != 0xFF) { - DrawCharToXfb_(x, y, code); - } - - // 0xFF is treated as whitespace - x += NW4R_DB_FONT_CHAR_WIDTH; - count++; - } - - // Stop at max line width - if (count >= width) { - // Skip over newline if it comes next. - // It wouldn't take up view space anyways. - if (str[1] == '\n') { - str++; - } - - return str; - } - - str++; - } - - return str; -} - -static void DrawStringToXfb_(int x, int y, const char* pStr, bool turnOver, - bool backErase) { - int x1; - int width, fbWidth; - - x1 = x; - fbWidth = sFrameBufferInfo.frameWidth / GetDotWidth_(); - - while (*pStr != '\0') { - if (backErase) { - int len = StrLineWidth_(pStr); - DirectPrint_EraseXfb(x - 6, y - 3, - (len + 2) * NW4R_DB_FONT_CHAR_WIDTH, 13); - } - - width = (fbWidth - x) / NW4R_DB_FONT_CHAR_WIDTH; - pStr = DrawStringLineToXfb_(x, y, pStr, width); - y += NW4R_DB_FONT_LEADING; - - if (*pStr == '\n') { - pStr++; - x = x1; - } else if (*pStr != '\0') { - pStr++; - - if (!turnOver) { - pStr = std::strchr(pStr, '\n'); - if (pStr == NULL) { - break; - } - - pStr++; - x = x1; - } else { - x = 0; - } - } - } -} - namespace detail { -void DirectPrint_DrawStringToXfb(int x, int y, const char* pFmt, - std::va_list list, bool turnOver, - bool backErase) { - NW4R_NULL_ASSERT(LINE(645), sFrameBufferInfo.frameMemory); - - char buffer[256]; - int length = std::vsnprintf(buffer, sizeof(buffer), pFmt, list); - - int start = x; // unused - if (length > 0) { - DrawStringToXfb_(x, y, buffer, turnOver, backErase); - } -} - static void WaitVIRetrace_() { BOOL enabled = OSEnableInterrupts(); u32 count = VIGetRetraceCount(); diff --git a/src/nw4r/db/db_exception.cpp b/src/nw4r/db/db_exception.cpp index c58d4449..f104d679 100644 --- a/src/nw4r/db/db_exception.cpp +++ b/src/nw4r/db/db_exception.cpp @@ -1,6 +1,8 @@ #include #include +#include +#include #include #include @@ -8,230 +10,566 @@ namespace nw4r { namespace db { -//! Forward declarations - -static void ErrorHandler_(u16 error, OSContext* context, u32 dsisr, u32 dar); - -static void* RunThread_(void* arg); - -static void DumpException_(const ExceptionCallbackParam* exPtr); - -static void Exception_Printf_(const char* fmt, ...); - -static void PrintContext_(u16 error, const OSContext* context, u32 dsisr, +struct ExceptionCallbackParam { + u16 error; // at 0x0 + OSContext* pContext; // at 0x4 + u32 dsisr; // at 0x8 + u32 dar; // at 0xC +}; + +// Forward declarations +static void ErrorHandler_(u16 error, OSContext* pContext, u32 dsisr, u32 dar); +static void* RunThread_(void* pArg); +static void* DumpException_(const ExceptionCallbackParam* pParam); +static void PrintContext_(u16 error, const OSContext* pContext, u32 dsisr, u32 dar); - -static void ShowMainInfo_(u16 error, const OSContext* context, u32 dsisr, +static void ShowStackTrace_(u32 sp); +static void ShowMainInfo_(u16 error, const OSContext* pContext, u32 dsisr, u32 dar); +static void ShowGPR_(const OSContext* pContext); +static void ShowGPRMap_(const OSContext* pContext); +static void ShowSRR0Map_(const OSContext* pContext); +static void ShowFloat_(const OSContext* pContext); +static void SetFPException_(u32 fpscr); +static bool ShowMapInfoSubroutine_(u32 address, bool preNewline); +static void DrawConsoleEndless_(ConsoleHandle console); + +struct { + OSThread thread; // at 0x0 + OSMessageQueue msgQueue; // at 0x318 + void* pFrameMemory; // at 0x338 + u32 stackAddr; // at 0x33C + ConsoleHandle console; // at 0x340 + const GXRenderModeObj* pRenderMode; // at 0x344 + ExceptionUserCallback pUserCallback; // at 0x348 + void* pUserCallbackArg; // at 0x34C + u32 msr; // at 0x350 + u32 fpscr; // at 0x354 + u16 displayInfo; // at 0x358 + u8 unk35A[0x360 - 0x35A]; +} sException; + +static u8 sThreadBuffer[OS_MEM_KB_TO_B(16)]; +static OSMessage sMessageBuffer[1]; + +const char* CPU_EXP_NAME[OS_ERROR_MAX] = { + "SYSTEM RESET", // OS_ERROR_SYSTEM_RESET + "MACHINE CHECK", // OS_ERROR_MACHINE_CHECK + "DSI", // OS_ERROR_DSI + "ISI", // OS_ERROR_ISI + "EXTERNAL INTERRUPT", // OS_ERROR_EXTERNAL_INTERRUPT + "ALIGNMENT", // OS_ERROR_ALIGNMENT + "PROGRAM", // OS_ERROR_PROGRAM + "FLOATING POINT", // OS_ERROR_FLOATING_POINT + "DECREMENTER", // OS_ERROR_DECREMENTER + "SYSTEM CALL", // OS_ERROR_SYSTEM_CALL + "TRACE", // OS_ERROR_TRACE + "PERFORMACE MONITOR", // OS_ERROR_PERFORMACE_MONITOR + "BREAK POINT", // OS_ERROR_BREAKPOINT + "SYSTEM INTERRUPT", // OS_ERROR_SYSTEM_INTERRUPT + "THERMAL INTERRUPT", // OS_ERROR_THERMAL_INTERRUPT + "PROTECTION", // OS_ERROR_PROTECTION + "FLOATING POINT", // OS_ERROR_FPE +}; -static void setFPException(u32 type); +void Exception_Init() { + std::memset(&sException, 0, sizeof(sException)); -static ExceptionHead sException; -// TODO(texline) why? -static u8 sThreadBuffer[16384]; -static OSMessage sMsgBuffer[1]; + sException.pUserCallback = NULL; + sException.console = NULL; -static const char* CPU_EXP_NAME[] = { - "SYSTEM RESET", "MACHINE CHECK", "DSI", "ISI", - "EXTERNAL INTERRUPT", "ALIGNMENT", "PROGRAM", "FLOATING POINT", - "DECREMENTER", "SYSTEM CALL", "TRACE", "PERFORMACE MONITOR", - "BREAK POINT", "SYSTEM INTERRUPT", - "THERMAL INTERRUPT", // unused - "PROTECTION", "FLOATING POINT"}; + sException.displayInfo = + EXCEPTION_DISPLAY_MAININFO | EXCEPTION_DISPLAY_STACKTRACE; -void Exception_Init() { - memset(&sException, 0, sizeof(ExceptionHead)); - sException.callback = NULL; - sException.console = NULL; - sException.dispInfo = EXCEPTION_INFO_DEFAULT; - sException.frameMemory = NULL; - sException.renderMode = NULL; + sException.pFrameMemory = NULL; + sException.pRenderMode = NULL; - OSCreateThread(&sException.thread, RunThread_, NULL, sThreadBuffer + 16384, - 16384, 0, OS_THREAD_DETACHED); + OSCreateThread(&sException.thread, // + RunThread_, // + NULL, // + sThreadBuffer + sizeof(sThreadBuffer), // + sizeof(sThreadBuffer), // + OS_PRIORITY_MIN, // + OS_THREAD_DETACHED); - OSInitMessageQueue(&sException.msgQueue, &sMsgBuffer[0], 1); - OSResumeThread(&sException.thread); + OSInitMessageQueue(&sException.msgQueue, sMessageBuffer, + ARRAY_SIZE(sMessageBuffer)); - OSSetErrorHandler(OS_ERR_DSI, (OSErrorHandler)ErrorHandler_); - OSSetErrorHandler(OS_ERR_ISI, (OSErrorHandler)ErrorHandler_); - OSSetErrorHandler(OS_ERR_ALIGNMENT, (OSErrorHandler)ErrorHandler_); - OSSetErrorHandler(OS_ERR_PROTECTION, (OSErrorHandler)ErrorHandler_); + OSResumeThread(&sException.thread); - setFPException(NULL); + // Why make the error handler non-variadic? + OSSetErrorHandler(OS_ERROR_DSI, + reinterpret_cast(ErrorHandler_)); + OSSetErrorHandler(OS_ERROR_ISI, + reinterpret_cast(ErrorHandler_)); + OSSetErrorHandler(OS_ERROR_ALIGNMENT, + reinterpret_cast(ErrorHandler_)); + OSSetErrorHandler(OS_ERROR_PROTECTION, + reinterpret_cast(ErrorHandler_)); + + // Disable floating-point exceptions? + SetFPException_(0); } -void ErrorHandler_(u16 error, OSContext* context, u32 dsisr, u32 dar) { - ExceptionCallbackParam exCallbackObject; - +static void ErrorHandler_(u16 error, OSContext* pContext, u32 dsisr, u32 dar) { sException.msr = PPCMfmsr(); - sException.fpscr = context->fpscr; - OSFillFPUContext(context); + sException.fpscr = pContext->fpscr; + OSFillFPUContext(pContext); + OSSetErrorHandler(error, NULL); - if (error == OS_ERR_PROTECTION) { - OSProtectRange(0, 0, 0, 3); - OSProtectRange(1, 0, 0, 3); - OSProtectRange(2, 0, 0, 3); - OSProtectRange(3, 0, 0, 3); + if (error == OS_ERROR_PROTECTION) { + OSProtectRange(OS_PROTECT_CHANNEL_0, NULL, 0, OS_PROTECT_CONTROL_RDWR); + OSProtectRange(OS_PROTECT_CHANNEL_1, NULL, 0, OS_PROTECT_CONTROL_RDWR); + OSProtectRange(OS_PROTECT_CHANNEL_2, NULL, 0, OS_PROTECT_CONTROL_RDWR); + OSProtectRange(OS_PROTECT_CHANNEL_3, NULL, 0, OS_PROTECT_CONTROL_RDWR); } - exCallbackObject.error = error; - exCallbackObject.context = context; - exCallbackObject.dsisr = dsisr; - exCallbackObject.dar = dar; + ExceptionCallbackParam param; + param.error = error; + param.pContext = pContext; + param.dsisr = dsisr; + param.dar = dar; - OSSendMessage(&sException.msgQueue, (OSMessage)(&exCallbackObject), + OSSendMessage(&sException.msgQueue, static_cast(¶m), OS_MSG_BLOCKING); + OSEnableScheduler(); OSYieldThread(); OSDisableScheduler(); } -void* RunThread_(void* arg) { -//! OSCreateThread needs a voidptr parameter. -#pragma unused(arg) - u32 msr = PPCMfmsr(); - msr &= ~(MSR_FE0 | MSR_FE1); - PPCMtmsr(msr); - { - OSMessage msg; +static void* RunThread_(void* /* pArg */) { + PPCMtmsr(PPCMfmsr() & ~(MSR_FE0 | MSR_FE1)); - OSReceiveMessage(&sException.msgQueue, &msg, OS_MSG_BLOCKING); - OSDisableInterrupts(); - VISetPreRetraceCallback(NULL); - VISetPostRetraceCallback(NULL); - if (sException.console) { - VISetBlack(FALSE); - VIFlush(); - } - DumpException_((ExceptionCallbackParam*)msg); + // Thread blocks until error handler is invoked + OSMessage msg; + OSReceiveMessage(&sException.msgQueue, &msg, OS_MSG_BLOCKING); + + OSDisableInterrupts(); + + VISetPreRetraceCallback(NULL); + VISetPostRetraceCallback(NULL); + + if (sException.console != NULL) { + VISetBlack(FALSE); + VIFlush(); } - return NULL; -} -void DumpException_(const ExceptionCallbackParam* exPtr) { - u16 error = exPtr->error; - const OSContext* context = exPtr->context; - u32 dsisr = exPtr->dsisr; - u32 dar = exPtr->dar; + const ExceptionCallbackParam* pParam = + reinterpret_cast(msg); - if (error < OS_ERR_MAX) { - sException.stackPointer = context->gprs[1]; + u16 error = pParam->error; + OSContext* pContext = pParam->pContext; + u32 dsisr = pParam->dsisr; + u32 dar = pParam->dar; + + // Fake OS error values are used to signal a halt/panic. + // Panic is expected to set SP (outside of the panic function itself). + if (error < OS_ERROR_MAX) { + sException.stackAddr = pContext->gprs[1]; } - if (sException.console) { - sException.frameMemory = - detail::DirectPrint_SetupFB(sException.renderMode); + + if (sException.console != NULL) { + sException.pFrameMemory = + detail::DirectPrint_SetupFB(sException.pRenderMode); } + while (true) { - PrintContext_(error, context, dsisr, dar); + PrintContext_(error, pContext, dsisr, dar); + + if (sException.console != NULL && DirectPrint_IsActive()) { + Console_DrawDirect(sException.console); + } + + if (sException.pUserCallback != NULL) { + u16 info = sException.displayInfo; + + // The console needs to be re-drawn if the content changes + do { + // User callback can choose to terminate the display + if (!sException.pUserCallback(sException.console, + sException.pUserCallbackArg)) { + return NULL; + } + + } while (info == sException.displayInfo); + } + // Default behavior (auto scroll) + else if (sException.console != NULL) { + DrawConsoleEndless_(sException.console); + } + // Terminal display only + else { + break; + } } + + return NULL; } -void Exception_Printf_(const char* fmt, ...) { - const GXRenderModeObj* rMode = sException.renderMode; - { - va_list vlist; - va_start(vlist, fmt); - vprintf(fmt, vlist); - va_end(vlist); - } - if (sException.console) { - void* fb = VIGetCurrentFrameBuffer(); - DirectPrint_ChangeXfb(fb, rMode->fbWidth, rMode->xfbHeight); +static void Exception_Printf_(const char* pFmt, ...) { + const GXRenderModeObj* pRenderMode = sException.pRenderMode; + + std::va_list argv; + va_start(argv, pFmt); + OSVReport(pFmt, argv); + va_end(argv); - va_list vlist; - va_start(vlist, fmt); - Console_VFPrintf(CONSOLE_OUTPUT_DISPLAY, sException.console, fmt, - vlist); - va_end(vlist); + if (sException.console != NULL) { + DirectPrint_ChangeXfb(VIGetCurrentFrameBuffer(), pRenderMode->fbWidth, + pRenderMode->xfbHeight); + + std::va_list argv; + va_start(argv, pFmt); + Console_VFPrintf(CONSOLE_OUTPUT_DISPLAY, sException.console, pFmt, + argv); + va_end(argv); } } -void PrintContext_(u16 error, const OSContext* context, u32 dsisr, u32 dar) { - if (error > OS_ERR_MAX) { - Exception_Printf_("******** USER HALT ********\nFrameMemory:%XH\n", - sException.frameMemory); +static void PrintContext_(u16 error, const OSContext* pContext, u32 dsisr, + u32 dar) { + // Fake OS error values are used to signal a halt/panic + if (error < OS_ERROR_MAX) { + Exception_Printf_("******** EXCEPTION OCCURRED! ********\n" + "FrameMemory:%XH\n", + sException.pFrameMemory); } else { - Exception_Printf_( - "******** EXCEPTION OCCURRED! ********\nFrameMemory:%XH\n", - sException.frameMemory); + Exception_Printf_("******** USER HALT ********\n" + "FrameMemory:%XH\n", + sException.pFrameMemory); + } + + if (sException.displayInfo & EXCEPTION_DISPLAY_MAININFO) { + Exception_Printf_("---MainInfo---\n"); + ShowMainInfo_(error, pContext, dsisr, dar); + } + + if (sException.displayInfo & EXCEPTION_DISPLAY_GPR) { + Exception_Printf_("---EXCEPTION_INFO_GPR---\n"); + ShowGPR_(pContext); + } + + if (sException.displayInfo & EXCEPTION_DISPLAY_SRR0) { + Exception_Printf_("---EXCEPTION_INFO_SRR0MAP---\n"); + ShowSRR0Map_(pContext); + } + + if (sException.displayInfo & EXCEPTION_DISPLAY_GPRMAP) { + Exception_Printf_("---EXCEPTION_INFO_GPRMAP---\n"); + ShowGPRMap_(pContext); } - { - if (sException.dispInfo & EXCEPTION_INFO_MAIN) { - Exception_Printf_("---MainInfo---\n"); - ShowMainInfo_(error, context, dsisr, dar); + + if (sException.displayInfo & EXCEPTION_DISPLAY_FPR) { + Exception_Printf_("---EXCEPTION_INFO_FPR---\n"); + ShowFloat_(pContext); + Exception_Printf_(" MSR:%08XH FPSCR:%08XH\n", sException.msr, + sException.fpscr); + } + + if (sException.displayInfo & EXCEPTION_DISPLAY_STACKTRACE) { + Exception_Printf_("---EXCEPTION_INFO_TRACE---\n"); + ShowStackTrace_(sException.stackAddr); + } + + Exception_Printf_("--------------------------------\n"); +} + +static void ShowStackTrace_(u32 sp) { + Exception_Printf_("-------------------------------- TRACE\n"); + Exception_Printf_("Address: BackChain LR save\n"); + + u32 i; + u32* it = reinterpret_cast(sp); + + for (i = 0; i < 16; i++) { + if (it == NULL || reinterpret_cast(it) == 0xFFFFFFFF) { + break; } + + Exception_Printf_("%08X: %08X %08X ", it, it[0], it[1]); + + if (!ShowMapInfoSubroutine_(it[1], false)) { + Exception_Printf_("\n"); + } + + it = reinterpret_cast(*it); } } -void ShowMainInfo_(u16 error, const OSContext* context, u32 dsisr, u32 dar) { - if (error < OS_ERR_MAX) { - Exception_Printf_("CONTEXT:%08XH (%s EXCEPTION)\n", context, +static void ShowMainInfo_(u16 error, const OSContext* pContext, u32 dsisr, + u32 dar) { + // Fake OS error values are used to signal a halt/panic + if (error < OS_ERROR_MAX) { + Exception_Printf_("CONTEXT:%08XH (%s EXCEPTION)\n", pContext, CPU_EXP_NAME[error]); } else { - Exception_Printf_("CONTEXT:%08XH\n", context); + Exception_Printf_("CONTEXT:%08XH\n", pContext); } - if (error == OS_ERR_FP_EXCEPTION) { - u32 fpscr = sException.fpscr; - // TODO(texline): how is this calculated? - fpscr &= (fpscr << 22) & 0x3E000000 | 0x1F80700; - if (fpscr & FPSCR_VX) { + + if (error == OS_ERROR_FPE) { + u32 fpe = sException.fpscr; + + // clang-format off + fpe &= + // Mask away exceptions that are disabled. + // Overlaps FPSCR_V* bits with FPSCR_*X bits. + (fpe & (FPSCR_VE | FPSCR_OE | FPSCR_UE | FPSCR_ZE | FPSCR_XE)) << 22 + // Allow invalid-operation (FPSCR_VX) details + | FPSCR_VXSNAN | FPSCR_VXISI | FPSCR_VXIDI | FPSCR_VXZDZ | FPSCR_VXIMZ | FPSCR_VXVC + | FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI; + // clang-format on + + if (fpe & FPSCR_VX) { Exception_Printf_(" FPE: Invalid operation\n"); + if (sException.fpscr & FPSCR_VXSNAN) { Exception_Printf_(" SNaN\n"); } + if (sException.fpscr & FPSCR_VXISI) { Exception_Printf_(" Infinity - Infinity\n"); } + if (sException.fpscr & FPSCR_VXIDI) { Exception_Printf_(" Infinity / Infinity\n"); } + if (sException.fpscr & FPSCR_VXZDZ) { Exception_Printf_(" 0 / 0\n"); } + if (sException.fpscr & FPSCR_VXIMZ) { Exception_Printf_(" Infinity * 0\n"); } + if (sException.fpscr & FPSCR_VXVC) { Exception_Printf_(" Invalid compare\n"); } + if (sException.fpscr & FPSCR_VXSOFT) { Exception_Printf_(" Software request\n"); } + if (sException.fpscr & FPSCR_VXSQRT) { Exception_Printf_(" Invalid square root\n"); } + if (sException.fpscr & FPSCR_VXCVI) { Exception_Printf_(" Invalid integer convert\n"); } } - if (fpscr & FPSCR_OX) { + + if (fpe & FPSCR_OX) { Exception_Printf_(" FPE: Overflow\n"); } - if (fpscr & FPSCR_UX) { + + if (fpe & FPSCR_UX) { Exception_Printf_(" FPE: Underflow\n"); } - if (fpscr & FPSCR_ZX) { + + if (fpe & FPSCR_ZX) { Exception_Printf_(" FPE: Zero division\n"); } - if (fpscr & FPSCR_XX) { + + if (fpe & FPSCR_XX) { Exception_Printf_(" FPE: Inexact result\n"); } } - Exception_Printf_("SRR0: %08XH SRR1:%08XH\n", context->srr0, - context->srr1); + + Exception_Printf_("SRR0: %08XH SRR1:%08XH\n", pContext->srr0, + pContext->srr1); + Exception_Printf_("DSISR: %08XH DAR: %08XH\n", dsisr, dar); } -void setFPException(u32 type) { - __OSFpscrEnableBits = type; - if (type) { - (void)OSSetErrorHandler(OS_ERR_FP_EXCEPTION, - (OSErrorHandler)ErrorHandler_); +static void ShowGPR_(const OSContext* pContext) { + Exception_Printf_("-------------------------------- GPR\n"); + + for (int reg = 0; reg < 10; reg++) { + Exception_Printf_("R%02d:%08XH R%02d:%08XH R%02d:%08XH\n", // + reg, pContext->gprs[reg], // + reg + 11, pContext->gprs[reg + 11], // + reg + 22, pContext->gprs[reg + 22]); + } + + Exception_Printf_("R%02d:%08XH R%02d:%08XH\n", // + 10, pContext->gprs[10], // + 21, pContext->gprs[21]); +} + +static void ShowGPRMap_(const OSContext* pContext) { + bool anyAddr = false; + Exception_Printf_("-------------------------------- GPRMAP\n"); + + // @bug The value of r31 is never shown +#if defined(BUG_FIX) + for (int reg = 0; reg <= 31; reg++) { +#else + for (int reg = 0; reg < 31; reg++) { +#endif + if (pContext->gprs[reg] < 0x80000000 || + pContext->gprs[reg] > 0x82FFFFFF) { + continue; + } + + anyAddr = true; + Exception_Printf_("R%02d: %08XH ", reg, pContext->gprs[reg]); + + if (!ShowMapInfoSubroutine_(pContext->gprs[reg], false)) { + Exception_Printf_(" no information\n"); + } + } + + if (!anyAddr) { + Exception_Printf_(" no register which seem to address.\n"); + } +} + +static void ShowSRR0Map_(const OSContext* pContext) { + Exception_Printf_("-------------------------------- SRR0MAP\n"); + + if (pContext->srr0 < 0x80000000 || pContext->srr0 > 0x82FFFFFF) { + return; + } + Exception_Printf_("SRR0: %08XH ", pContext->srr0); + + if (!ShowMapInfoSubroutine_(pContext->srr0, false)) { + Exception_Printf_(" no information\n"); + } +} + +static void ShowFloatSub_(s32 reg, f32 value) { + if (isnan(value)) { + Exception_Printf_("F%02d: Nan ", reg); + } else if (isinfinite(value)) { + if (*reinterpret_cast(&value) & 0x80) { + Exception_Printf_("F%02d:+Inf ", reg); + } else { + Exception_Printf_("F%02d:-Inf ", reg); + } + } else if (value == 0.0f) { + Exception_Printf_("F%02d: 0.0 ", reg); } else { - (void)OSSetErrorHandler(OS_ERR_FP_EXCEPTION, NULL); + Exception_Printf_("F%02d:%+.3E", reg, value); + } +} + +static void ShowFloat_(const OSContext* pContext) { + Exception_Printf_("-------------------------------- FPR\n"); + + for (int reg = 0; reg < 10; reg++) { + ShowFloatSub_(reg, pContext->fprs[reg]); + Exception_Printf_(" "); + + ShowFloatSub_(reg + 11, pContext->fprs[reg + 11]); + Exception_Printf_(" "); + + ShowFloatSub_(reg + 22, pContext->fprs[reg + 22]); + Exception_Printf_("\n"); + } + + ShowFloatSub_(10, pContext->fprs[10]); + Exception_Printf_(" "); + + ShowFloatSub_(21, pContext->fprs[21]); + Exception_Printf_("\n"); +} + +static void SetFPException_(u32 fpscr) { + __OSFpscrEnableBits = fpscr; + + if (fpscr != 0) { + OSSetErrorHandler(OS_ERROR_FPE, + reinterpret_cast(ErrorHandler_)); + } else { + OSSetErrorHandler(OS_ERROR_FPE, NULL); + } +} + +#if defined(NW4R_FEATURE_MAPFILE) +static bool ShowMapInfoSubroutine_(u32 address, bool preNewline) { + if (address < 0x80000000 || address > 0x82FFFFFF) { + return false; + } + + // TODO(kiwi) Where does this number come from? + u8 buffer[256 + 4]; + bool success = MapFile_QuerySymbol(address, buffer, sizeof(buffer)); + + if (success) { + if (preNewline) { + Exception_Printf_("\n"); + } + + Exception_Printf_("%s\n", reinterpret_cast(buffer)); + return true; + } + + return false; +} +#else +static bool ShowMapInfoSubroutine_(u32 /* address */, bool /* preNewline */) { + return false; +} +#endif + +ConsoleHandle Exception_SetConsole(ConsoleHandle console, + const GXRenderModeObj* pRenderMode) { + NW4R_NULL_ASSERT(console); + + ConsoleHandle old = sException.console; + sException.console = console; + sException.pRenderMode = pRenderMode; + return old; +} + +ConsoleHandle Exception_GetConsole() { + return sException.console; +} + +void Exception_SetUserCallback(ExceptionUserCallback pCallback, + void* pCallbackArg) { + sException.pUserCallback = pCallback; + sException.pUserCallbackArg = pCallbackArg; +} + +u16 Exception_SetDisplayInfo(u16 displayInfo) { + u16 old = sException.displayInfo; + sException.displayInfo = displayInfo; + return old; +} + +static void WaitTime_(s32 millis) { + OSTime start = OSGetTime(); + + while (OS_TICKS_TO_MSEC(OSGetTime() - start) < millis) { + ; + } +} + +static void DrawConsoleEndless_(ConsoleHandle console) { + s32 head = Console_GetBufferHeadLine(console); + + while (true) { + s32 total = Console_GetTotalLines(console); + if (head >= total) { + head = Console_GetBufferHeadLine(console); + } + + // @bug Wrong console handle +#if defined(BUG_FIX) + Console_SetViewBaseLine(console, head); +#else + Console_SetViewBaseLine(sException.console, head); +#endif + + Console_DrawDirect(console); + + WaitTime_(200); + head++; } } diff --git a/src/nw4r/db/db_mapFile.cpp b/src/nw4r/db/db_mapFile.cpp new file mode 100644 index 00000000..ea6af4ba --- /dev/null +++ b/src/nw4r/db/db_mapFile.cpp @@ -0,0 +1,403 @@ +#include + +#include +#include + +namespace nw4r { +namespace db { + +#define MAP_WORK_SIZE 512 +static u8 sMapBuf[MAP_WORK_SIZE] ALIGN(32) = {}; +static s32 sMapBufOffset = -1; + +static DVDFileInfo sFileInfo; +static u32 sFileLength = 0; + +static MapFile* sMapFileList = NULL; + +static void AppendMapFile_(MapFile* pMapFile) { + NW4R_NULL_ASSERT(pMapFile); + + if (sMapFileList == NULL) { + sMapFileList = pMapFile; + return; + } + + // Static linkage takes priority + if (pMapFile->moduleInfo != NULL) { + pMapFile->next = sMapFileList->next; + sMapFileList->next = pMapFile; + } else { + pMapFile->next = sMapFileList; + sMapFileList = pMapFile; + } +} + +static void RemoveMapFile_(MapFile* pMapFile) { + NW4R_NULL_ASSERT(pMapFile); + + if (pMapFile == sMapFileList) { + sMapFileList = sMapFileList->next; + return; + } + + MapFile* it = sMapFileList; + + for (; it != NULL; it = it->next) { + if (it->next == pMapFile) { + it->next = pMapFile->next; + break; + } + } +} + +MapFile* MapFile_RegistOnMem(void* pMapWork, u8* pMapData, u32 /* mapSize */, + const OSModuleInfo* pModuleInfo) { + NW4R_NULL_ASSERT(pMapWork); + NW4R_NULL_ASSERT(pMapData); + + MapFile* pMapFile = static_cast(pMapWork); + + pMapFile->mapBuf = pMapData; + pMapFile->moduleInfo = pModuleInfo; + pMapFile->fileEntry = -1; + pMapFile->next = NULL; + + AppendMapFile_(pMapFile); + return pMapFile; +} + +MapFile* MapFile_RegistOnDvd(void* pMapWork, const char* pPath, + const OSModuleInfo* pModuleInfo) { + NW4R_NULL_ASSERT(pMapWork); + NW4R_NULL_ASSERT(pPath); + + MapFile* pMapFile = static_cast(pMapWork); + + pMapFile->mapBuf = NULL; + pMapFile->moduleInfo = pModuleInfo; + pMapFile->fileEntry = DVDConvertPathToEntrynum(pPath); + pMapFile->next = NULL; + + NW4R_ASSERT(pMapFile->fileEntry >= 0); + + AppendMapFile_(pMapFile); + return pMapFile; +} + +void MapFile_Unregist(MapFile* pMapFile) { + RemoveMapFile_(pMapFile); +} + +void MapFile_UnregistAll() { + sMapFileList = NULL; +} + +bool MapFile_Exists() { + return sMapFileList != NULL ? true : false; +} + +typedef u8 (*GetCharFunc)(const u8* pBuffer); +static GetCharFunc GetCharPtr_ = NULL; + +static u8 GetCharOnMem_(const u8* pBuffer) { + return *pBuffer; +} + +static u8 GetCharOnDvd_(const u8* pBuffer) { + s32 address = reinterpret_cast(pBuffer) & ~0x80000000; + s32 offset = address - sMapBufOffset; + s32 len, size; + + if (address >= sFileLength) { + return '\0'; + } + + if (sMapBufOffset < 0 || offset < 0 || offset >= MAP_WORK_SIZE) { + size = MAP_WORK_SIZE; + + sMapBufOffset = ROUND_DOWN(address, 32); + offset = address - sMapBufOffset; + + if (sMapBufOffset + MAP_WORK_SIZE >= sFileLength) { + size = ROUND_UP(sFileLength - sMapBufOffset, 32); + } + + BOOL enabled = OSEnableInterrupts(); + + len = DVDReadAsyncPrio(&sFileInfo, sMapBuf, size, sMapBufOffset, NULL, + DVD_PRIO_MEDIUM); + + while (DVDGetCommandBlockStatus(&sFileInfo.block) != DVD_STATE_IDLE) { + ; + } + + OSRestoreInterrupts(enabled); + + if (len <= 0) { + return '\0'; + } + } + + return sMapBuf[offset]; +} + +static u8* SearchNextLine_(u8* pBuffer, s32 lines) { + u8 ch; + + NW4R_NULL_ASSERT(LINE(363), GetCharPtr_); + + if (pBuffer == NULL) { + return NULL; + } + + while ((ch = GetCharPtr_(pBuffer)) != '\0') { + if (ch == '\n' && --lines <= 0) { + return pBuffer + 1; + } + + pBuffer++; + } + + return NULL; +} + +static u8* SearchNextSection_(u8* pBuffer) { + NW4R_NULL_ASSERT(LINE(399), GetCharPtr_); + + do { + pBuffer = SearchNextLine_(pBuffer, 1); + if (pBuffer == NULL) { + return NULL; + } + } while (GetCharPtr_(pBuffer) != '.'); + + return pBuffer; +} + +static u8* SearchParam_(u8* pLineTop, u32 argNum, u8 delim) { + BOOL inArg = FALSE; + u8* pBuffer = pLineTop; + + NW4R_NULL_ASSERT(LINE(434), GetCharPtr_); + + if (pBuffer == NULL) { + return NULL; + } + + while (true) { + u8 ch = GetCharPtr_(pBuffer); + + if (ch == '\0' || ch == '\n') { + return NULL; + } + + if (inArg) { + if (ch == delim) { + inArg = FALSE; + } + } else { + if (ch != delim) { + if (argNum-- <= 0) { + return pBuffer; + } else { + inArg = TRUE; + } + } + } + + pBuffer++; + } +} + +static u32 XStrToU32_(const u8* str) { + u32 value = 0; + + NW4R_NULL_ASSERT(LINE(488), str); + NW4R_NULL_ASSERT(LINE(489), GetCharPtr_); + + while (true) { + u32 num; + u8 ch = GetCharPtr_(str); + + if (ch >= '0' && ch <= '9') { + num = ch - '0'; + } else if (ch >= 'a' && ch <= 'z') { + num = ch - ('a' - 0xA); + } else if (ch >= 'A' && ch <= 'Z') { + num = ch - ('A' - 0xA); + } else { + return value; + } + + if (value >= 0x10000000) { + return 0; + } + + value = num + (value << 4); + str++; + } +} + +static u32 CopySymbol_(const u8* buf, u8* str, u32 maxlen, u8 delim) { + u32 written = 0; + + NW4R_NULL_ASSERT(LINE(546), buf); + NW4R_NULL_ASSERT(LINE(547), str); + NW4R_NULL_ASSERT(LINE(548), GetCharPtr_); + + while (true) { + u8 ch = GetCharPtr_(buf++); + + if (ch == delim || ch == '\0' || ch == '\n') { + *str = '\0'; + return written; + } + + *str++ = ch; + written++; + + if (written >= maxlen - 1) { + *str = '\0'; + return written; + } + } +} + +static bool QuerySymbolToMapFile_(u8* pBuffer, const OSModuleInfo* pModuleInfo, + u32 address, u8* strBuf, u32 strBufSize) { + OSSectionInfo* pSectionInfo = NULL; + u32 sectionNum; + + NW4R_NULL_ASSERT(LINE(604), strBuf); + NW4R_ASSERT(LINE(605), strBufSize > 0); + + if (pModuleInfo != NULL) { + pSectionInfo = (OSSectionInfo*)pModuleInfo->sectionInfoOffset; + sectionNum = pModuleInfo->numSections; + } + + while (true) { + u32 offset = 0; + + // Skip link map + pBuffer = SearchNextSection_(pBuffer); + // Skip section header + pBuffer = SearchNextLine_(pBuffer, 3); + + if (pSectionInfo != NULL) { + offset = pSectionInfo->offset; + + if (address < offset || address >= offset + pSectionInfo->size) { + goto _next_section; + } + } + + while (true) { + u8* pParam; + u32 startAddr; + u32 size; + + pBuffer = SearchNextLine_(pBuffer, 1); + if (pBuffer == NULL) { + return false; + } + + // 'Size' parameter + pParam = SearchParam_(pBuffer, 1, ' '); + if (pParam == NULL) { + break; + } + + size = XStrToU32_(pParam); + + // 'Virtual address' parameter + pParam = SearchParam_(pBuffer, 2, ' '); + if (pParam == NULL) { + break; + } + + startAddr = XStrToU32_(pParam); + if (startAddr == 0) { + continue; + } + + startAddr += offset; + if (address < startAddr || startAddr + size <= address) { + continue; + } + + // Symbol name + pParam = SearchParam_(pBuffer, 5, ' '); + if (pParam == NULL) { + strBuf[0] = '\0'; + return true; + } + + // Skip section header symbols + if (GetCharPtr_(pBuffer) == '.') { + continue; + } + + CopySymbol_(pParam, strBuf, strBufSize, ' '); + return true; + } + + _next_section: + if (pSectionInfo != NULL) { + if (--sectionNum <= 0) { + return false; + } + + pSectionInfo++; + } + } +} + +static bool QuerySymbolToSingleMapFile_(MapFile* pMapFile, u32 address, + u8* strBuf, u32 strBufSize) { + NW4R_NULL_ASSERT(LINE(725), pMapFile); + NW4R_NULL_ASSERT(LINE(726), strBuf); + + if (pMapFile->mapBuf != NULL) { + GetCharPtr_ = GetCharOnMem_; + + return QuerySymbolToMapFile_(pMapFile->mapBuf, pMapFile->moduleInfo, + address, strBuf, strBufSize); + } + + if (pMapFile->fileEntry >= 0) { + u8* pBuffer = reinterpret_cast(0x00000000 | 0x80000000); + + if (DVDFastOpen(pMapFile->fileEntry, &sFileInfo)) { + sFileLength = sFileInfo.size; + GetCharPtr_ = GetCharOnDvd_; + + bool success = QuerySymbolToMapFile_(pBuffer, pMapFile->moduleInfo, + address, strBuf, strBufSize); + + DVDClose(&sFileInfo); + return success; + } + } + + strBuf[0] = '\0'; + return false; +} + +bool MapFile_QuerySymbol(u32 address, u8* pBuffer, u32 maxlen) { + MapFile* pMapFile = sMapFileList; + + while (pMapFile != NULL) { + if (QuerySymbolToSingleMapFile_(pMapFile, address, pBuffer, maxlen)) { + return true; + } + + pMapFile = pMapFile->next; + } + + return false; +} + +} // namespace db +} // namespace nw4r diff --git a/src/nw4r/g3d/res/g3d_resanmchr.cpp b/src/nw4r/g3d/res/g3d_resanmchr.cpp index ca71a960..fcc095fc 100644 --- a/src/nw4r/g3d/res/g3d_resanmchr.cpp +++ b/src/nw4r/g3d/res/g3d_resanmchr.cpp @@ -1,4 +1,6 @@ +#if NW4R_VERSION >= 20070608 #pragma fp_contract on +#endif #include @@ -844,7 +846,7 @@ bool ChrAnmResult::GetRotateDeg(math::VEC3* pRotate) const { } // FSqrt returns 0 when -sin(y) <= -1 or -sin(y) >= 1 - f32 y = math::FSqrt(-(rt._20 * rt._20 - 1.0f)); + f32 y = math::FSqrt(1.0f - rt._20 * rt._20); if (y == 0.0f) { pRotate->x = math::Atan2Deg(rt._02 + rt._11, rt._12 + rt._01); diff --git a/src/nw4r/snd/snd_BankFile.cpp b/src/nw4r/snd/snd_BankFile.cpp index 0df76570..eb37be61 100644 --- a/src/nw4r/snd/snd_BankFile.cpp +++ b/src/nw4r/snd/snd_BankFile.cpp @@ -21,7 +21,7 @@ bool BankFileReader::IsValidFileHeader(const void* pBankBin) { return false; } - if (pFileHeader->version < NW4R_VERSION(1, 0)) { + if (pFileHeader->version < NW4R_FILE_VERSION(1, 0)) { return false; } diff --git a/src/nw4r/snd/snd_SeqFile.cpp b/src/nw4r/snd/snd_SeqFile.cpp index 6fb951ce..6ef17c10 100644 --- a/src/nw4r/snd/snd_SeqFile.cpp +++ b/src/nw4r/snd/snd_SeqFile.cpp @@ -13,7 +13,7 @@ bool SeqFileReader::IsValidFileHeader(const void* pSeqBin) { return false; } - if (Util::ReadBigEndian(pFileHeader->version) < NW4R_VERSION(1, 0)) { + if (Util::ReadBigEndian(pFileHeader->version) < NW4R_FILE_VERSION(1, 0)) { return false; } diff --git a/src/nw4r/snd/snd_SoundArchiveFile.cpp b/src/nw4r/snd/snd_SoundArchiveFile.cpp index a24b12b8..6ebb9691 100644 --- a/src/nw4r/snd/snd_SoundArchiveFile.cpp +++ b/src/nw4r/snd/snd_SoundArchiveFile.cpp @@ -32,7 +32,7 @@ bool SoundArchiveFileReader::IsValidFileHeader(const void* pSoundArchiveBin) { return false; } - if (pFileHeader->version < NW4R_VERSION(1, 0)) { + if (pFileHeader->version < NW4R_FILE_VERSION(1, 0)) { return false; } @@ -93,7 +93,7 @@ SoundType SoundArchiveFileReader::GetSoundType(u32 id) const { return SOUND_TYPE_INVALID; } - if (GetVersion() >= NW4R_VERSION(1, 1)) { + if (GetVersion() >= NW4R_FILE_VERSION(1, 1)) { const SoundArchiveFile::SoundCommonInfo* pCmnInfo = Util::GetDataRefAddress0(pTable->items[id], mInfo); @@ -140,7 +140,7 @@ bool SoundArchiveFileReader::ReadSoundInfo( pSoundInfo->volume = pCmnInfo->volume; pSoundInfo->remoteFilter = pCmnInfo->remoteFilter; - if (GetVersion() >= NW4R_VERSION(1, 2)) { + if (GetVersion() >= NW4R_FILE_VERSION(1, 2)) { pSoundInfo->panMode = static_cast(pCmnInfo->panMode); pSoundInfo->panCurve = static_cast(pCmnInfo->panCurve); @@ -189,7 +189,7 @@ bool SoundArchiveFileReader::ReadSeqSoundInfo( pInfo->channelPriority = pSrc->channelPriority; pInfo->allocTrack = pSrc->allocTrack; - if (GetVersion() >= NW4R_VERSION(1, 3)) { + if (GetVersion() >= NW4R_FILE_VERSION(1, 3)) { pInfo->releasePriorityFixFlag = pSrc->releasePriorityFix; } else { pInfo->releasePriorityFixFlag = false; @@ -224,7 +224,7 @@ bool SoundArchiveFileReader::ReadWaveSoundInfo( pInfo->subNo = pSrc->subNo; pInfo->channelPriority = pSrc->channelPriority; - if (GetVersion() >= NW4R_VERSION(1, 3)) { + if (GetVersion() >= NW4R_FILE_VERSION(1, 3)) { pInfo->releasePriorityFixFlag = pSrc->releasePriorityFix; } else { pInfo->releasePriorityFixFlag = false; @@ -538,7 +538,7 @@ SoundArchiveFileReader::impl_GetSoundInfo(u32 id) const { return NULL; } - if (GetVersion() >= NW4R_VERSION(1, 1)) { + if (GetVersion() >= NW4R_FILE_VERSION(1, 1)) { return Util::GetDataRefAddress0(pTable->items[id], mInfo); } else { return static_cast( @@ -561,7 +561,7 @@ SoundArchiveFileReader::impl_GetSoundInfoOffset(u32 id) const { return INVALID_DATA_REF; } - if (GetVersion() >= NW4R_VERSION(1, 1)) { + if (GetVersion() >= NW4R_FILE_VERSION(1, 1)) { const SoundArchiveFile::SoundCommonInfo* pInfo = Util::GetDataRefAddress0(pTable->items[id], mInfo); diff --git a/src/nw4r/snd/snd_SoundSystem.cpp b/src/nw4r/snd/snd_SoundSystem.cpp index 7710466d..a77cb6b6 100644 --- a/src/nw4r/snd/snd_SoundSystem.cpp +++ b/src/nw4r/snd/snd_SoundSystem.cpp @@ -145,7 +145,7 @@ void SoundSystem::WaitForResetReady() { return; } - u32 start = OSGetTick(); + OSTick start = OSGetTick(); while (!detail::AxManager::GetInstance().IsResetReady()) { if (OS_TICKS_TO_SEC(OSGetTick() - start) > 0) { diff --git a/src/nw4r/snd/snd_SoundThread.cpp b/src/nw4r/snd/snd_SoundThread.cpp index 422c8246..a2201f38 100644 --- a/src/nw4r/snd/snd_SoundThread.cpp +++ b/src/nw4r/snd/snd_SoundThread.cpp @@ -97,7 +97,7 @@ void SoundThread::SoundThreadProc() { NW4R_UT_LINKLIST_FOREACH_SAFE (it, mSoundFrameCallbackList, { it->OnBeginSoundFrame(); }) - u32 start = OSGetTick(); + OSTick start = OSGetTick(); { AxVoiceManager::GetInstance().FreeAllReservedAxVoice(); AxManager::GetInstance().Update(); diff --git a/src/nw4r/snd/snd_StrmFile.cpp b/src/nw4r/snd/snd_StrmFile.cpp index 6d417ad3..8eb39c0d 100644 --- a/src/nw4r/snd/snd_StrmFile.cpp +++ b/src/nw4r/snd/snd_StrmFile.cpp @@ -13,7 +13,7 @@ bool StrmFileReader::IsValidFileHeader(const void* pStrmBin) { return false; } - if (pFileHeader->version < NW4R_VERSION(1, 0)) { + if (pFileHeader->version < NW4R_FILE_VERSION(1, 0)) { return false; } diff --git a/src/nw4r/snd/snd_WsdFile.cpp b/src/nw4r/snd/snd_WsdFile.cpp index 16527021..5abdc4a5 100644 --- a/src/nw4r/snd/snd_WsdFile.cpp +++ b/src/nw4r/snd/snd_WsdFile.cpp @@ -12,7 +12,7 @@ bool WsdFileReader::IsValidFileHeader(const void* pWsdBin) { return false; } - if (pFileHeader->version < NW4R_VERSION(1, 0)) { + if (pFileHeader->version < NW4R_FILE_VERSION(1, 0)) { return false; } @@ -45,7 +45,7 @@ bool WsdFileReader::ReadWaveSoundInfo(WaveSoundInfo* pSoundInfo, int id) const { const WsdFile::WsdInfo* pWsdInfo = Util::GetDataRefAddress0(pWsd->refWsdInfo, &mDataBlock->wsdCount); - if (mHeader->fileHeader.version == NW4R_VERSION(1, 2)) { + if (mHeader->fileHeader.version == NW4R_FILE_VERSION(1, 2)) { pSoundInfo->pitch = pWsdInfo->pitch; pSoundInfo->pan = pWsdInfo->pan; pSoundInfo->surroundPan = pWsdInfo->surroundPan; @@ -53,7 +53,7 @@ bool WsdFileReader::ReadWaveSoundInfo(WaveSoundInfo* pSoundInfo, int id) const { pSoundInfo->fxSendB = pWsdInfo->fxSendB; pSoundInfo->fxSendC = pWsdInfo->fxSendC; pSoundInfo->mainSend = pWsdInfo->mainSend; - } else if (mHeader->fileHeader.version == NW4R_VERSION(1, 1)) { + } else if (mHeader->fileHeader.version == NW4R_FILE_VERSION(1, 1)) { pSoundInfo->pitch = pWsdInfo->pitch; pSoundInfo->pan = pWsdInfo->pan; pSoundInfo->surroundPan = pWsdInfo->surroundPan; @@ -93,7 +93,7 @@ bool WsdFileReader::ReadWaveSoundNoteInfo(WaveSoundNoteInfo* pSoundNoteInfo, pSoundNoteInfo->originalKey = pNoteInfo->originalKey; pSoundNoteInfo->volume = pNoteInfo->volume; - if (mHeader->fileHeader.version >= NW4R_VERSION(1, 1)) { + if (mHeader->fileHeader.version >= NW4R_FILE_VERSION(1, 1)) { pSoundNoteInfo->pan = pNoteInfo->pan; pSoundNoteInfo->surroundPan = pNoteInfo->surroundPan; pSoundNoteInfo->pitch = pNoteInfo->pitch; @@ -110,7 +110,7 @@ bool WsdFileReader::ReadWaveParam(int id, WaveData* pWaveData, const void* pWaveAddr) const { const WaveFile::WaveInfo* pWaveInfo; - if (mHeader->fileHeader.version == NW4R_VERSION(1, 0)) { + if (mHeader->fileHeader.version == NW4R_FILE_VERSION(1, 0)) { const WsdFile::WaveBlockOld* pWaveBlockOld = reinterpret_cast(mWaveBlock); diff --git a/src/nw4r/ut/ut_ResFont.cpp b/src/nw4r/ut/ut_ResFont.cpp index 64d41508..fb1060dd 100644 --- a/src/nw4r/ut/ut_ResFont.cpp +++ b/src/nw4r/ut/ut_ResFont.cpp @@ -37,12 +37,13 @@ bool ResFont::SetResource(void* pBuffer) { reinterpret_cast(pBlock) + pBlock->size); } } else { - if (pHeader->version == NW4R_VERSION(1, 4)) { - if (!IsValidBinaryFile(pHeader, SIGNATURE, NW4R_VERSION(1, 4), 2)) { + if (pHeader->version == NW4R_FILE_VERSION(1, 4)) { + if (!IsValidBinaryFile(pHeader, SIGNATURE, NW4R_FILE_VERSION(1, 4), + 2)) { return false; } - } else if (!IsValidBinaryFile(pHeader, SIGNATURE, NW4R_VERSION(1, 2), - 2)) { + } else if (!IsValidBinaryFile(pHeader, SIGNATURE, + NW4R_FILE_VERSION(1, 2), 2)) { return false; } diff --git a/src/revolution/OS/OSAlarm.c b/src/revolution/OS/OSAlarm.c index ea171a70..0a21bcf5 100644 --- a/src/revolution/OS/OSAlarm.c +++ b/src/revolution/OS/OSAlarm.c @@ -9,7 +9,7 @@ static OSAlarmQueue AlarmQueue; static OSShutdownFunctionInfo ShutdownFunctionInfo = {OnReset, 0xFFFFFFFF}; static void SetTimer(const OSAlarm* alarm) { - s64 timeLeft = alarm->end - __OSGetSystemTime(); + s64 timeLeft = alarm->fire - __OSGetSystemTime(); if (timeLeft < 0) { PPCMtdec(0); @@ -21,10 +21,10 @@ static void SetTimer(const OSAlarm* alarm) { } void __OSInitAlarm(void) { - if (__OSGetExceptionHandler(OS_ERR_DECREMENTER) != + if (__OSGetExceptionHandler(OS_ERROR_DECREMENTER) != DecrementerExceptionHandler) { AlarmQueue.head = AlarmQueue.tail = NULL; - __OSSetExceptionHandler(OS_ERR_DECREMENTER, + __OSSetExceptionHandler(OS_ERROR_DECREMENTER, DecrementerExceptionHandler); OSRegisterShutdownFunction(&ShutdownFunctionInfo); } @@ -51,11 +51,11 @@ static void InsertAlarm(OSAlarm* alarm, s64 end, OSAlarmHandler handler) { } alarm->handler = handler; - alarm->end = end; + alarm->fire = end; // Find position to insert alarm (sorted ascending by end time) for (iter = AlarmQueue.head; iter != NULL; iter = iter->next) { - if (iter->end <= end) { + if (iter->fire <= end) { continue; } @@ -97,12 +97,12 @@ void OSSetAlarm(OSAlarm* alarm, s64 tick, OSAlarmHandler handler) { OSRestoreInterrupts(enabled); } -void OSSetPeriodicAlarm(OSAlarm* alarm, s64 tick, s64 period, +void OSSetPeriodicAlarm(OSAlarm* alarm, OSTime start, s64 period, OSAlarmHandler handler) { BOOL enabled = OSDisableInterrupts(); alarm->period = period; - alarm->start = __OSTimeToSystemTime(tick); + alarm->start = __OSTimeToSystemTime(start); InsertAlarm(alarm, 0, handler); OSRestoreInterrupts(enabled); @@ -154,7 +154,7 @@ static void DecrementerExceptionCallback(u8 type, OSContext* ctx) { OSLoadContext(ctx); } - if (time < alarm->end) { + if (time < alarm->fire) { SetTimer(alarm); OSLoadContext(ctx); } diff --git a/src/revolution/OS/OSCache.c b/src/revolution/OS/OSCache.c index 1d86eeb1..b062762c 100644 --- a/src/revolution/OS/OSCache.c +++ b/src/revolution/OS/OSCache.c @@ -418,7 +418,7 @@ void L2GlobalInvalidate(void) { } } -void DMAErrorHandler(u8 error, OSContext* ctx, u32 dsisr, u32 dar, ...) { +void DMAErrorHandler(u16 error, OSContext* ctx, u32 dsisr, u32 dar, ...) { u32 hid2 = PPCMfhid2(); OSReport("Machine check received\n"); @@ -468,6 +468,6 @@ void __OSCacheInit(void) { DBPrintf("L2 cache initialized\n"); } - OSSetErrorHandler(OS_ERR_MACHINE_CHECK, DMAErrorHandler); + OSSetErrorHandler(OS_ERROR_MACHINE_CHECK, DMAErrorHandler); DBPrintf("Locked cache machine check handler installed\n"); } diff --git a/src/revolution/OS/OSContext.c b/src/revolution/OS/OSContext.c index 9424dc8b..896510e2 100644 --- a/src/revolution/OS/OSContext.c +++ b/src/revolution/OS/OSContext.c @@ -585,7 +585,7 @@ static asm void OSSwitchFPUContext(register u8 err, register OSContext* ctx) { } void __OSContextInit(void) { - __OSSetExceptionHandler(OS_ERR_FP_UNAVAIL, OSSwitchFPUContext); + __OSSetExceptionHandler(OS_ERROR_FLOATING_POINT, OSSwitchFPUContext); OS_CURRENT_FPU_CONTEXT = NULL; DBPrintf("FPU-unavailable handler installed\n"); } diff --git a/src/revolution/OS/OSError.c b/src/revolution/OS/OSError.c index f090c033..af32e02b 100644 --- a/src/revolution/OS/OSError.c +++ b/src/revolution/OS/OSError.c @@ -4,26 +4,30 @@ #include -OSErrorHandler __OSErrorTable[OS_ERR_MAX]; +OSErrorHandler __OSErrorTable[OS_ERROR_MAX]; u32 __OSFpscrEnableBits = FPSCR_VE | FPSCR_OE | FPSCR_UE | FPSCR_ZE | FPSCR_XE; DECL_WEAK void OSReport(const char* msg, ...) { - va_list list; - va_start(list, msg); - vprintf(msg, list); - va_end(list); + va_list argv; + va_start(argv, msg); + vprintf(msg, argv); + va_end(argv); +} + +DECL_WEAK void OSVReport(const char* msg, va_list argv) { + vprintf(msg, argv); } DECL_WEAK void OSPanic(const char* file, int line, const char* msg, ...) { u32 depth; u32* sp; - va_list list; + va_list argv; OSDisableInterrupts(); - va_start(list, msg); - vprintf(msg, list); - va_end(list); + va_start(argv, msg); + vprintf(msg, argv); + va_end(argv); OSReport(" in \"%s\" on line %d.\n", file, line); OSReport("\nAddress: Back Chain LR Save\n"); @@ -42,7 +46,7 @@ OSErrorHandler OSSetErrorHandler(u16 error, OSErrorHandler handler) { oldHandler = __OSErrorTable[error]; __OSErrorTable[error] = handler; - if (error == OS_ERR_FP_EXCEPTION) { + if (error == OS_ERROR_FPE) { OSThread* thread; u32 msr; u32 fpscr; @@ -111,12 +115,12 @@ void __OSUnhandledException(u8 error, OSContext* ctx, u32 dsisr, u32 dar) { if (!(ctx->srr1 & 0x2)) { OSReport("Non-recoverable Exception %d", error); } else { - if (error == OS_ERR_PROGRAM && ctx->srr1 & 0x100000 && - __OSErrorTable[OS_ERR_FP_EXCEPTION] != NULL) { + if (error == OS_ERROR_PROGRAM && ctx->srr1 & 0x100000 && + __OSErrorTable[OS_ERROR_FPE] != NULL) { u32 msr; u32 fpscr; - error = OS_ERR_FP_EXCEPTION; + error = OS_ERROR_FPE; msr = PPCMfmsr(); PPCMtmsr(msr | MSR_FP); @@ -157,7 +161,7 @@ void __OSUnhandledException(u8 error, OSContext* ctx, u32 dsisr, u32 dar) { OSLoadContext(ctx); } - if (error == OS_ERR_DECREMENTER) { + if (error == OS_ERROR_DECREMENTER) { OSLoadContext(ctx); } @@ -169,27 +173,27 @@ void __OSUnhandledException(u8 error, OSContext* ctx, u32 dsisr, u32 dar) { OSReport("\nDSISR = 0x%08x DAR = 0x%08x\n", dsisr, dar); OSReport("TB = 0x%016llx\n", tb); switch (error) { - case OS_ERR_DSI: + case OS_ERROR_DSI: OSReport("\nInstruction at 0x%x (read from SRR0) attempted to access " "invalid address 0x%x (read from DAR)\n", ctx->srr0, dar); break; - case OS_ERR_ISI: + case OS_ERROR_ISI: OSReport("\nAttempted to fetch instruction from invalid address 0x%x " "(read from SRR0)\n", ctx->srr0); break; - case OS_ERR_ALIGNMENT: + case OS_ERROR_ALIGNMENT: OSReport("\nInstruction at 0x%x (read from SRR0) attempted to access " "unaligned address 0x%x (read from DAR)\n", ctx->srr0, dar); break; - case OS_ERR_PROGRAM: + case OS_ERROR_PROGRAM: OSReport("\nProgram exception : Possible illegal instruction/operation " "at or around 0x%x (read from SRR0)\n", ctx->srr0, dar); break; - case OS_ERR_PROTECTION: + case OS_ERROR_PROTECTION: OSReport("\n"); OSReport("AI DMA Address = 0x%04x%04x\n", DSP_HW_REGS[DSP_AI_DMA_START_H], diff --git a/src/revolution/OS/OSFatal.c b/src/revolution/OS/OSFatal.c index 7e5e0f3c..90059d1c 100644 --- a/src/revolution/OS/OSFatal.c +++ b/src/revolution/OS/OSFatal.c @@ -231,7 +231,7 @@ void OSFatal(GXColor textColor, GXColor bgColor, const char* msg) { ; } - __OSSetExceptionHandler(OS_ERR_DECREMENTER, OSDefaultExceptionHandler); + __OSSetExceptionHandler(OS_ERROR_DECREMENTER, OSDefaultExceptionHandler); GXAbortFrame(); diff --git a/src/revolution/OS/OSInterrupt.c b/src/revolution/OS/OSInterrupt.c index 023ade2e..5a19e207 100644 --- a/src/revolution/OS/OSInterrupt.c +++ b/src/revolution/OS/OSInterrupt.c @@ -116,7 +116,8 @@ void __OSInterruptInit(void) { OS_INTR_MASK(OS_INTR_PI_VI) | OS_INTR_MASK(OS_INTR_PI_DEBUG) | OS_INTR_MASK(OS_INTR_PI_HSP) | OS_INTR_MASK(OS_INTR_PI_ACR)); - __OSSetExceptionHandler(OS_ERR_EXT_INTERRUPT, ExternalInterruptHandler); + __OSSetExceptionHandler(OS_ERROR_EXTERNAL_INTERRUPT, + ExternalInterruptHandler); } static u32 SetInterruptMask(u32 type, u32 mask) { diff --git a/src/revolution/OS/OSMemory.c b/src/revolution/OS/OSMemory.c index 9914e78b..4e645387 100644 --- a/src/revolution/OS/OSMemory.c +++ b/src/revolution/OS/OSMemory.c @@ -40,10 +40,11 @@ static void MEMIntrruptHandler(s16 intr, OSContext* ctx) { u32 dar = (MI_HW_REGS[MI_ADDRHI] & 0x3ff) << 0x10 | MI_HW_REGS[MI_ADDRLO]; MI_HW_REGS[MI_REG_0x20] = 0; - if (__OSErrorTable[OS_ERR_PROTECTION] != NULL) { - __OSErrorTable[OS_ERR_PROTECTION](OS_ERR_PROTECTION, ctx, dsisr, dar); + if (__OSErrorTable[OS_ERROR_PROTECTION] != NULL) { + __OSErrorTable[OS_ERROR_PROTECTION](OS_ERROR_PROTECTION, ctx, dsisr, + dar); } else { - __OSUnhandledException(OS_ERR_PROTECTION, ctx, dsisr, dar); + __OSUnhandledException(OS_ERROR_PROTECTION, ctx, dsisr, dar); } } diff --git a/src/revolution/OS/OSThread.c b/src/revolution/OS/OSThread.c index 961d34ad..69d0481b 100644 --- a/src/revolution/OS/OSThread.c +++ b/src/revolution/OS/OSThread.c @@ -472,7 +472,7 @@ BOOL OSCreateThread(OSThread* thread, OSThreadFunc func, void* funcArg, } enabled = OSDisableInterrupts(); - if (__OSErrorTable[OS_ERR_FP_EXCEPTION] != NULL) { + if (__OSErrorTable[OS_ERROR_FPE] != NULL) { thread->context.srr1 |= 0x900; thread->context.state |= 0x1; thread->context.fpscr = __OSFpscrEnableBits & 0xF8; diff --git a/src/revolution/OS/OSTime.c b/src/revolution/OS/OSTime.c index c424e6f9..c9baabbe 100644 --- a/src/revolution/OS/OSTime.c +++ b/src/revolution/OS/OSTime.c @@ -20,7 +20,7 @@ static s32 YearDays[MONTH_MAX] = {0, 31, 59, 90, 120, 151, static s32 LeapYearDays[MONTH_MAX] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}; -asm s64 OSGetTime(void) { +asm OSTime OSGetTime(void) { // clang-format off nofralloc @@ -45,16 +45,16 @@ asm u32 OSGetTick(void){ // clang-format on } -s64 __OSGetSystemTime(void) { +OSTime __OSGetSystemTime(void) { BOOL enabled = OSDisableInterrupts(); - s64 time = OSGetTime() + OS_SYSTEM_TIME; + OSTime time = OSGetTime() + OS_SYSTEM_TIME; OSRestoreInterrupts(enabled); return time; } -s64 __OSTimeToSystemTime(s64 time) { +OSTime __OSTimeToSystemTime(OSTime time) { BOOL enabled = OSDisableInterrupts(); - s64 sysTime = OS_SYSTEM_TIME + time; + OSTime sysTime = OS_SYSTEM_TIME + time; OSRestoreInterrupts(enabled); return sysTime; } From bc5f91591c9b65693eb546edbceaf6fe7ffd7f53 Mon Sep 17 00:00:00 2001 From: kiwi515 <49212064+kiwi515@users.noreply.github.com> Date: Thu, 15 Oct 2026 03:30:06 -0400 Subject: [PATCH 11/12] Update assertion.h --- include/decomp/assertion.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/include/decomp/assertion.h b/include/decomp/assertion.h index 730002e3..e068803e 100644 --- a/include/decomp/assertion.h +++ b/include/decomp/assertion.h @@ -25,18 +25,19 @@ // In nonmatching builds, the LINE family of macros is ignored for accuracy. // DECOMP_ASSERT will instead provide the true source location. // +// Due to this macro's implementation, unwanted macro expansion may occur. +// To preserve an expression +// // >> Parameters << // // The 'assert_impl' parameter is the name of the assertion implementation. -// It must be a function-like macro that accepts at least the following parameters: (file, line, str_expr). +// It must be a function-like macro that accepts at least the following parameters: (file, line). // - file: The name of the source file where the macro was expanded. // // - line: The location in the source file where the macro was expanded. // The LINE/LINES macros are provided to override this value. // -// - str_expr: The first non-LINE argument in stringitized form. -// This is required to avoid macro expansion which may break matching code, -// such as NULL expanding to "0". +// - ...: Any variadic arguments provided at the DECOMP_ASSERT invocation. // // The 'lines_impl' parameter is the name of the line tuple evaluator. // It must be a function-like macro that accepts multiple line numbers. @@ -50,17 +51,14 @@ // // keep DECOMP_ASSERT on the same line to stay accurate in non-matching builds! // #define MY_ASSERT(...) DECOMP_ASSERT(MY_ASSERT_IMPL, MY_LINES, __VA_ARGS__) // -// #define MY_ASSERT_IMPL(file, line, str_expr, expr) \ -// if (!expr) { Panic("Assertion failed: %s", str_expr); } +// #define MY_ASSERT_IMPL(file, line, expr) +// if (!expr) { Panic("Assertion failed: %s", #expr); } // // // choose Rev 1 line number for this build // #define MY_LINES(rev0, rev1) rev1 // -// MY_ASSERT(LINE(123), p != NULL) expands to: -// MY_ASSERT_IMPL("code.cpp", 123, "p != NULL", p != 0) -// -// MY_ASSERT(LINES(200, 300), p != NULL, "Pointer is NULL") expands to: -// MY_ASSERT_IMPL("code.cpp", 300, "p != NULL", p != 0, "Pointer is NULL") +// MY_ASSERT(LINE(123), num > 0) expands to: +// MY_ASSERT_IMPL("code.cpp", 123, "num > 0", num > 0) // // clang-format on From d61517bf3a70a188b0a3746ae1916801423ed8e7 Mon Sep 17 00:00:00 2001 From: kiwi515 <49212064+kiwi515@users.noreply.github.com> Date: Thu, 15 Oct 2026 04:18:02 -0400 Subject: [PATCH 12/12] Update assertion.h --- include/decomp/assertion.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/decomp/assertion.h b/include/decomp/assertion.h index e068803e..e7baeab7 100644 --- a/include/decomp/assertion.h +++ b/include/decomp/assertion.h @@ -25,9 +25,6 @@ // In nonmatching builds, the LINE family of macros is ignored for accuracy. // DECOMP_ASSERT will instead provide the true source location. // -// Due to this macro's implementation, unwanted macro expansion may occur. -// To preserve an expression -// // >> Parameters << // // The 'assert_impl' parameter is the name of the assertion implementation.