From f3b8dc17d86768c212d62c80ab49c1823fee1f15 Mon Sep 17 00:00:00 2001 From: robojumper Date: Thu, 22 May 2025 16:25:37 +0200 Subject: [PATCH] d_textbox OK --- config/SOUE01/symbols.txt | 46 ++++++++++++++++---------------- configure.py | 2 +- src/d/lyt/d_textbox.cpp | 55 ++++++++++----------------------------- 3 files changed, 38 insertions(+), 65 deletions(-) diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index eff75314..34827585 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -3835,10 +3835,10 @@ fn_800AE8D0 = .text:0x800AE8D0; // type:function size:0x88 __ct__10dTextBox_cFPCQ44nw4r3lyt3res7TextBoxRCQ34nw4r3lyt11ResBlockSet = .text:0x800AE960; // type:function size:0xE0 GetColor__FRC11_GXColorS10 = .text:0x800AEA40; // type:function size:0xB4 GetMyTextDrawRect__10dTextBox_cCFPQ34nw4r2ut17TextWriterBasePb = .text:0x800AEB00; // type:function size:0x178 -CalcStringRect__FPQ34nw4r2ut4RectRQ34nw4r2ut17TextWriterBasePCwiPbf = .text:0x800AEC80; // type:function size:0x108 -CalcStringRectImpl__FPQ34nw4r2ut4RectPQ34nw4r2ut17TextWriterBasePCwifPb = .text:0x800AED90; // type:function size:0x1E8 -CalcLineRectImpl__FPQ34nw4r2ut4RectPQ34nw4r2ut17TextWriterBasePCwifPbPb = .text:0x800AEF80; // type:function size:0x414 -GetCharStrmReader__Q34nw4r2ut4FontCFv = .text:0x800AF3A0; // type:function size:0x38 +CalcStringRect__FPQ34nw4r2ut4RectRQ34nw4r2ut17TextWriterBasePCwiPbf = .text:0x800AEC80; // type:function size:0x108 scope:local +CalcStringRectImpl__FPQ34nw4r2ut4RectPQ34nw4r2ut17TextWriterBasePCwifPb = .text:0x800AED90; // type:function size:0x1E8 scope:local +CalcLineRectImpl__FPQ34nw4r2ut4RectPQ34nw4r2ut17TextWriterBasePCwifPbPb = .text:0x800AEF80; // type:function size:0x414 scope:local +GetCharStrmReader__Q34nw4r2ut4FontCFv = .text:0x800AF3A0; // type:function size:0x38 scope:weak setTextWithGlobalTextProcessor__10dTextBox_cFPCwPve = .text:0x800AF3E0; // type:function size:0x8C setTextWithGlobalTextProcessorV__10dTextBox_cFPCwPvP16__va_list_struct = .text:0x800AF470; // type:function size:0xCC setTextWithTextProcessor__10dTextBox_cFPCwP15dTagProcessor_cPve = .text:0x800AF540; // type:function size:0x8C @@ -3856,13 +3856,13 @@ init__10dTextBox_cFv = .text:0x800AFE30; // type:function size:0x204 hasDynamicText__10dTextBox_cFv = .text:0x800B0040; // type:function size:0x278 someDebugCheckMaybe__10dTextBox_cFv = .text:0x800B02C0; // type:function size:0x1EC DrawSelf__10dTextBox_cFRCQ34nw4r3lyt8DrawInfo = .text:0x800B04B0; // type:function size:0x930 -CalcLineStrNum__FPfPQ34nw4r2ut17TextWriterBasePCwifPb = .text:0x800B0DE0; // type:function size:0x158 +CalcLineStrNum__FPfPQ34nw4r2ut17TextWriterBasePCwifPb = .text:0x800B0DE0; // type:function size:0x158 scope:local loadTextFormatVars__10dTextBox_cFv = .text:0x800B0F40; // type:function size:0x240 setupGX__10dTextBox_cCFv = .text:0x800B1180; // type:function size:0x3F0 MySetFontSize__10dTextBox_cFRCQ34nw4r3lyt4Size = .text:0x800B1570; // type:function size:0x14 MySetScale__10dTextBox_cFRCQ34nw4r3lyt4Size = .text:0x800B1590; // type:function size:0x14 GetRuntimeTypeInfo__Q34nw4r3lyt7TextBoxCFv = .text:0x800B15B0; // type:function size:0x8 scope:weak -__dt__10dTextBox_cFv = .text:0x800B15C0; // type:function size:0x68 +__dt__10dTextBox_cFv = .text:0x800B15C0; // type:function size:0x68 scope:weak __ct__9dWindow_cFPCQ44nw4r3lyt3res6WindowRCQ34nw4r3lyt11ResBlockSet = .text:0x800B1630; // type:function size:0x3C UpdateSize__9dWindow_cFP10dTextBox_cf = .text:0x800B1670; // type:function size:0x134 GetRuntimeTypeInfo__Q34nw4r3lyt6WindowCFv = .text:0x800B17B0; // type:function size:0x8 scope:weak @@ -31044,8 +31044,8 @@ lbl_805104A8 = .data:0x805104A8; // type:object size:0xC lbl_805104B4 = .data:0x805104B4; // type:object size:0x60 lbl_80510514 = .data:0x80510514; // type:object size:0x238 lbl_8051074C = .data:0x8051074C; // type:object size:0x34 -lbl_80510780 = .data:0x80510780; // type:object size:0xC -lbl_8051078C = .data:0x8051078C; // type:object size:0xC +@20500 = .data:0x80510780; // type:object size:0xA scope:local data:string +@20902 = .data:0x8051078C; // type:object size:0xA scope:local data:string __vt__10dTextBox_c = .data:0x80510798; // type:object size:0x84 __vt__9dWindow_c = .data:0x80510820; // type:object size:0x8C scope:weak __vt__Q23d2d10ResAccIf_c = .data:0x805108B0; // type:object size:0x18 @@ -39407,9 +39407,9 @@ lbl_80572280 = .sdata:0x80572280; // type:object size:0x8 sRef__3d2d = .sdata:0x805722B4; // type:object size:0x4 data:4byte lbl_805722B8 = .sdata:0x805722B8; // type:object size:0x4 lbl_805722BC = .sdata:0x805722BC; // type:object size:0x4 -lbl_805722C0 = .sdata:0x805722C0; // type:object size:0x4 data:wstring -lbl_805722C4 = .sdata:0x805722C4; // type:object size:0x8 -lbl_805722CC = .sdata:0x805722CC; // type:object size:0xC +@20123 = .sdata:0x805722C0; // type:object size:0x4 scope:local data:wstring +@20499 = .sdata:0x805722C4; // type:object size:0x6 scope:local data:string +@20501 = .sdata:0x805722CC; // type:object size:0x5 scope:local data:string @1032 = .sdata:0x805722D8; // type:object size:0x1 scope:local lbl_805722E0 = .sdata:0x805722E0; // type:object size:0x8 lbl_805722E8 = .sdata:0x805722E8; // type:object size:0x8 @@ -41376,8 +41376,8 @@ lbl_80575390 = .sbss:0x80575390; // type:object size:0x4 data:4byte lbl_80575394 = .sbss:0x80575394; // type:object size:0x4 data:4byte lbl_80575398 = .sbss:0x80575398; // type:object size:0x8 data:byte SCRAPPER_PICKUP_TARGET = .sbss:0x805753A0; // type:object size:0x8 data:4byte -lbl_805753A8 = .sbss:0x805753A8; // type:object size:0x1 data:byte -lbl_805753AC = .sbss:0x805753AC; // type:object size:0x4 data:4byte +@GUARD@setupGX__10dTextBox_cCFv@sFogColor = .sbss:0x805753A8; // type:object size:0x1 scope:local data:byte +@LOCAL@setupGX__10dTextBox_cCFv@sFogColor = .sbss:0x805753AC; // type:object size:0x4 scope:local data:4byte sInstance__12UnkTextThing = .sbss:0x805753B0; // type:object size:0x4 data:4byte lbl_805753B8 = .sbss:0x805753B8; // type:object size:0x1 data:byte lbl_805753BC = .sbss:0x805753BC; // type:object size:0x4 data:4byte @@ -44444,13 +44444,13 @@ lbl_805797C0 = .sdata2:0x805797C0; // type:object size:0x4 align:4 data:float lbl_805797C4 = .sdata2:0x805797C4; // type:object size:0x4 align:4 data:float lbl_805797C8 = .sdata2:0x805797C8; // type:object size:0x4 align:4 data:float lbl_805797CC = .sdata2:0x805797CC; // type:object size:0x4 align:4 data:float -lbl_805797D0 = .sdata2:0x805797D0; // type:object size:0x4 align:4 data:float -lbl_805797D4 = .sdata2:0x805797D4; // type:object size:0x4 align:4 data:float -lbl_805797D8 = .sdata2:0x805797D8; // type:object size:0x8 align:8 data:double -lbl_805797E0 = .sdata2:0x805797E0; // type:object size:0x4 align:4 data:float -lbl_805797E4 = .sdata2:0x805797E4; // type:object size:0x4 align:4 data:float -lbl_805797E8 = .sdata2:0x805797E8; // type:object size:0x4 align:4 data:float -lbl_805797EC = .sdata2:0x805797EC; // type:object size:0x4 align:4 data:float +@19900 = .sdata2:0x805797D0; // type:object size:0x4 scope:local align:4 data:float +@19989 = .sdata2:0x805797D4; // type:object size:0x4 scope:local align:4 data:float +@20255 = .sdata2:0x805797D8; // type:object size:0x8 scope:local align:8 data:double +@20352 = .sdata2:0x805797E0; // type:object size:0x4 scope:local align:4 data:float +@20377 = .sdata2:0x805797E4; // type:object size:0x4 scope:local align:4 data:float +@20392 = .sdata2:0x805797E8; // type:object size:0x4 scope:local align:4 data:float +@20430 = .sdata2:0x805797EC; // type:object size:0x4 scope:local align:4 data:float @6476 = .sdata2:0x805797F0; // type:object size:0x4 scope:local align:4 data:float @1020 = .sdata2:0x805797F8; // type:object size:0x4 scope:local align:4 data:float @1021 = .sdata2:0x805797FC; // type:object size:0x4 scope:local align:4 data:float @@ -50441,9 +50441,9 @@ LytDrawMark__STATE_MOVE_WAIT = .bss:0x805A6240; // type:object size:0x40 data:4b LytDrawMark__STATE_MOVE_DRAW = .bss:0x805A6280; // type:object size:0x40 data:4byte LytDrawMark__STATE_MOVE_FIX = .bss:0x805A62C0; // type:object size:0x80 data:4byte lbl_805A6340 = .bss:0x805A6340; // type:object size:0x30 data:4byte -eventFlowTextStringMaybe1 = .bss:0x805A6370; // type:object size:0x400 -eventFlowTextStringMaybe2 = .bss:0x805A6770; // type:object size:0x400 -eventFlowTextStringMaybe3 = .bss:0x805A6B70; // type:object size:0x400 +@LOCAL@setTextWithGlobalTextProcessorV__10dTextBox_cFPCwPvP16__va_list_struct@destBuffer = .bss:0x805A6370; // type:object size:0x400 scope:local +@LOCAL@setTextWithTextProcessorV__10dTextBox_cFPCwP15dTagProcessor_cPvP16__va_list_struct@destBuffer = .bss:0x805A6770; // type:object size:0x400 scope:local +@LOCAL@calcTextLines__10dTextBox_cFPCwP15dTagProcessor_c@destBuffer = .bss:0x805A6B70; // type:object size:0x400 scope:local textThing = .bss:0x805A6F70; // type:object size:0x7C0 FontColors1 = .bss:0x805A7730; // type:object size:0xC4 data:byte FontColors2 = .bss:0x805A77F4; // type:object size:0xC4 data:byte diff --git a/configure.py b/configure.py index 3f0143a1..e43ace26 100644 --- a/configure.py +++ b/configure.py @@ -452,7 +452,7 @@ config.libs = [ Object(NonMatching, "toBeSorted/d_area.cpp"), Object(Matching, "d/lyt/d2d.cpp"), Object(NonMatching, "d/lyt/d_lyt_draw_mark.cpp"), - Object(NonMatching, "d/lyt/d_textbox.cpp"), + Object(Matching, "d/lyt/d_textbox.cpp"), Object(Matching, "d/lyt/d_window.cpp"), Object(Matching, "d/d_textunk.cpp"), Object(NonMatching, "d/d_textwindow_unk.cpp"), diff --git a/src/d/lyt/d_textbox.cpp b/src/d/lyt/d_textbox.cpp index 8d97b56d..50187791 100644 --- a/src/d/lyt/d_textbox.cpp +++ b/src/d/lyt/d_textbox.cpp @@ -683,10 +683,7 @@ void dTextBox_c::DrawSelf(const nw4r::lyt::DrawInfo &drawInfo) { while (remain > 0 && i < 10) { bool bOver; f32 lineWidth; - int lineStrNum = GetStoredLineStrNum(i, &lineWidth, &bOver); - // lineWidth = mLineWidths[i]; - // int lineStrNum = mLineStrNums[i]; - // bOver = mbOvers[i]; + s32 lineStrNum = GetStoredLineStrNum(i, &lineWidth, &bOver); f32 textPosX = textRect.left + hMag * (texWidth - lineWidth); writer.SetCursorX(textPosX); writer.PrintMutable(strPos, lineStrNum); @@ -703,15 +700,12 @@ void dTextBox_c::DrawSelf(const nw4r::lyt::DrawInfo &drawInfo) { while (remain > 0 && i < 10) { bool bOver; f32 lineWidth; - int lineStrNum = CalcLineStrNum(&lineWidth, &writer, strPos, remain, mSize.width, &bOver); + s32 lineStrNum = CalcLineStrNum(&lineWidth, &writer, strPos, remain, mSize.width, &bOver); f32 textPosX = textRect.left + hMag * (texWidth - lineWidth); writer.SetCursorX(textPosX); writer.PrintMutable(strPos, lineStrNum); if (mHasTextWriter && field_0x201 == true && i < 10) { SetStoredLineStrNum(i, lineWidth, lineStrNum, bOver); - // mLineWidths[i] = lineWidth; - // mLineStrNums[i] = lineStrNum; - // mbOvers[i] = bOver; } if (bOver) { writer.PrintMutable(L"\n", 1); @@ -722,30 +716,21 @@ void dTextBox_c::DrawSelf(const nw4r::lyt::DrawInfo &drawInfo) { } } - /* - const wchar_t *strPos = mTextBuf; - writer.SetCursor(textRect.left, -textRect.top); - f32 texWidth = textRect.GetWidth(); - int remain = mTextLen; - - while (remain > 0) { - bool bOver; - f32 lineWidth; - int lineStrNum = CalcLineStrNum(&lineWidth, &writer, strPos, remain, mSize.width, &bOver); - f32 textPosX = textRect.left + hMag * (texWidth - lineWidth); - writer.SetCursorX(textPosX); - writer.PrintMutable(strPos, lineStrNum); - if (bOver) { - writer.PrintMutable(L"\n", 1); - } - strPos += lineStrNum; - remain -= lineStrNum; - } - */ - mHasTextWriter = false; } +static int CalcLineStrNum( + f32 *pWidth, nw4r::ut::TextWriterBase *pTextWriter, const wchar_t *str, int length, f32 maxWidth, + bool *pbOver +) { + nw4r::ut::Rect rect; + nw4r::ut::TextWriterBase writerCpy(*pTextWriter); + writerCpy.SetCursor(0.0f, 0.0f); + int ret = CalcLineRectImpl(&rect, &writerCpy, str, length, maxWidth, pbOver, nullptr); + *pWidth = rect.right - rect.left; + return ret; +} + void dTextBox_c::loadTextFormatVars() { u16 myNum = GetExtUserDataNum(); if (myNum == 0) { @@ -841,18 +826,6 @@ void dTextBox_c::setupGX() const { GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); } -static int CalcLineStrNum( - f32 *pWidth, nw4r::ut::TextWriterBase *pTextWriter, const wchar_t *str, int length, f32 maxWidth, - bool *pbOver -) { - nw4r::ut::Rect rect; - nw4r::ut::TextWriterBase writerCpy(*pTextWriter); - writerCpy.SetCursor(0.0f, 0.0f); - int ret = CalcLineRectImpl(&rect, &writerCpy, str, length, maxWidth, pbOver, nullptr); - *pWidth = rect.right - rect.left; - return ret; -} - void dTextBox_c::MySetFontSize(const nw4r::lyt::Size &value) { mMyFontSize = value; }