Textbox progress

This commit is contained in:
robojumper
2025-04-02 17:47:19 +02:00
parent 4e88b4aec7
commit 010c0a9a3b
18 changed files with 553 additions and 90 deletions
+4
View File
@@ -241,6 +241,10 @@ d/lyt/d_lyt_draw_mark.cpp:
d/lyt/d_textbox.cpp:
.text start:0x800AE960 end:0x800B1628
.data start:0x80510780 end:0x80510820
.sdata start:0x805722C0 end:0x805722D8
.sdata2 start:0x805797D0 end:0x805797F0
.bss start:0x805A6370 end:0x805A6F70
d/lyt/d_window.cpp:
.text start:0x800B1630 end:0x800B1818
+26 -26
View File
@@ -3763,9 +3763,9 @@ fn_800AB940__Q23d2d9LytBase_cFPCci = .text:0x800AB940; // type:function size:0x5
fn_800AB9A0__Q23d2d9LytBase_cFP10dTextBox_ci = .text:0x800AB9A0; // type:function size:0x1DC
fn_800ABB80__Q23d2d9LytBase_cFP10dTextBox_cP10dTextBox_ci = .text:0x800ABB80; // type:function size:0x158
fn_800ABCE0__Q23d2d9LytBase_cFPCQ44nw4r3lyt3res11ExtUserDataP10dTextBox_cP10dTextBox_ci = .text:0x800ABCE0; // type:function size:0x170
fn_800ABE50__Q23d2d9LytBase_cFP10dTextBox_ciPv = .text:0x800ABE50; // type:function size:0x1E8
fn_800AC040__Q23d2d9LytBase_cFP10dTextBox_cP10dTextBox_ciPv = .text:0x800AC040; // type:function size:0x160
fn_800AC1AC__Q23d2d9LytBase_cFPCQ44nw4r3lyt3res11ExtUserDataP10dTextBox_cP10dTextBox_ciPv = .text:0x800AC1A0; // type:function size:0x158
fn_800ABE50__Q23d2d9LytBase_cFP10dTextBox_cPwUl = .text:0x800ABE50; // type:function size:0x1E8
fn_800AC040__Q23d2d9LytBase_cFP10dTextBox_cP10dTextBox_cPwUl = .text:0x800AC040; // type:function size:0x160
fn_800AC1AC__Q23d2d9LytBase_cFPCQ44nw4r3lyt3res11ExtUserDataP10dTextBox_cP10dTextBox_cPwUl = .text:0x800AC1A0; // type:function size:0x158
getMsbtInfo__Q23d2d9LytBase_cCFv = .text:0x800AC300; // type:function size:0x8
findGroupByName__Q23d2d9LytBase_cFPCc = .text:0x800AC310; // type:function size:0x38
hasSameBaseName__3d2dFPCcPCc = .text:0x800AC350; // type:function size:0x64
@@ -3833,36 +3833,36 @@ LytDrawMark__initStates = .text:0x800AE220; // type:function size:0x644
LytDrawMark__dtor = .text:0x800AE870; // type:function size:0x58
fn_800AE8D0 = .text:0x800AE8D0; // type:function size:0x88
__ct__10dTextBox_cFPCQ44nw4r3lyt3res7TextBoxRCQ34nw4r3lyt11ResBlockSet = .text:0x800AE960; // type:function size:0xE0
fn_800AEA40 = .text:0x800AEA40; // type:function size:0xB4
fn_800AEB00 = .text:0x800AEB00; // type:function size:0x178
fn_800AEC80 = .text:0x800AEC80; // type:function size:0x108
fn_800AED90 = .text:0x800AED90; // type:function size:0x1E8
fn_800AEF80 = .text:0x800AEF80; // type:function size:0x414
GetColor__FRC11_GXColorS10 = .text:0x800AEA40; // type:function size:0xB4
GetMyTextDrawRect__10dTextBox_cCFPQ34nw4r2ut17TextWriterBase<w>Pb = .text:0x800AEB00; // type:function size:0x178
CalcStringRect__FPQ34nw4r2ut4RectRQ34nw4r2ut17TextWriterBase<w>PCwiPbf = .text:0x800AEC80; // type:function size:0x108
CalcStringRectImpl__FPQ34nw4r2ut4RectPQ34nw4r2ut17TextWriterBase<w>PCwifPb = .text:0x800AED90; // type:function size:0x1E8
CalcLineRectImpl__FPQ34nw4r2ut4RectPQ34nw4r2ut17TextWriterBase<w>PCwifPbPb = .text:0x800AEF80; // type:function size:0x414
GetCharStrmReader__Q34nw4r2ut4FontCFv = .text:0x800AF3A0; // type:function size:0x38
fn_800AF3E0 = .text:0x800AF3E0; // type:function size:0x8C
fn_800AF470 = .text:0x800AF470; // type:function size:0xCC
fn_800AF540__10dTextBox_cFPCwP15dTagProcessor_ce = .text:0x800AF540; // type:function size:0x8C
fn_800AF5D0 = .text:0x800AF5D0; // type:function size:0xD4
fn_800AF6B0__10dTextBox_cFPCwP15dTagProcessor_c = .text:0x800AF6B0; // type:function size:0x64
fn_800AF720 = .text:0x800AF720; // type:function size:0x8C
fn_800AF7B0 = .text:0x800AF7B0; // type:function size:0x84
fn_800AF840 = .text:0x800AF840; // type:function size:0xEC
fn_800AF930__10dTextBox_cFPCw = .text:0x800AF930; // type:function size:0x50
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
setTextWithTextProcessorV__10dTextBox_cFPCwP15dTagProcessor_cPvP16__va_list_struct = .text:0x800AF5D0; // type:function size:0xD4
calcTextLines__10dTextBox_cFPCwP15dTagProcessor_c = .text:0x800AF6B0; // type:function size:0x64
setMessageWithGlobalTextProcessor__10dTextBox_cFPCcPvPve = .text:0x800AF720; // type:function size:0x8C
setMessageWithGlobalTextProcessorV__10dTextBox_cFPCcPvPvP16__va_list_struct = .text:0x800AF7B0; // type:function size:0x84
setMessageWithGlobalTextProcessorAndMsbtInfo__10dTextBox_cFPC8MsbtInfoPCcPwUl = .text:0x800AF840; // type:function size:0xEC
setTextWithGlobalTextProcessor__10dTextBox_cFPCw = .text:0x800AF930; // type:function size:0x50
GetLineWidth__10dTextBox_cFPf = .text:0x800AF980; // type:function size:0x1E4
fn_800AFB70 = .text:0x800AFB70; // type:function size:0x1A4
fn_800AFD20 = .text:0x800AFD20; // type:function size:0x3C
fn_800AFD60 = .text:0x800AFD60; // type:function size:0xC8
fn_800AFE30 = .text:0x800AFE30; // type:function size:0x204
fn_800AFD60__10dTextBox_cFf = .text:0x800AFD60; // type:function size:0xC8
init__10dTextBox_cFv = .text:0x800AFE30; // type:function size:0x204
fn_800B0040 = .text:0x800B0040; // type:function size:0x278
fn_800B02C0 = .text:0x800B02C0; // type:function size:0x1EC
dTextBox_c__DrawSelf = .text:0x800B04B0; // type:function size:0x930
DrawSelf__10dTextBox_cFRCQ34nw4r3lyt8DrawInfo = .text:0x800B04B0; // type:function size:0x930
fn_800B0DE0 = .text:0x800B0DE0; // type:function size:0x158
fn_800B0F40 = .text:0x800B0F40; // type:function size:0x240
fn_800B0F40__10dTextBox_cFv = .text:0x800B0F40; // type:function size:0x240
fn_800B1180 = .text:0x800B1180; // type:function size:0x3F0
dTextBox_c__setFontSize = .text:0x800B1570; // type:function size:0x14
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
fn_800B15C0 = .text:0x800B15C0; // type:function size:0x68
__dt__10dTextBox_cFv = .text:0x800B15C0; // type:function size:0x68
__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
@@ -3902,8 +3902,8 @@ fn_800B34B0 = .text:0x800B34B0; // type:function size:0x40
fn_800B34F0 = .text:0x800B34F0; // type:function size:0xD0
__ct__15dTagProcessor_cFv = .text:0x800B35C0; // type:function size:0x260
__dt__15dTagProcessor_cFv = .text:0x800B3820; // type:function size:0x58
fn_800B3880 = .text:0x800B3880; // type:function size:0x8C
eventFlowTextProcessingRelated__15dTagProcessor_cFP10dTextBox_cPCwPwUlPUl = .text:0x800B3910; // type:function size:0x980
format__15dTagProcessor_cFP10dTextBox_cPCwPwUlPUlPve = .text:0x800B3880; // type:function size:0x8C
formatV__15dTagProcessor_cFP10dTextBox_cPCwPwUlPUlPvP16__va_list_struct = .text:0x800B3910; // type:function size:0x980
fn_800B4290 = .text:0x800B4290; // type:function size:0x5AC
Process__15dTagProcessor_cFUsPQ34nw4r2ut15PrintContext<w> = .text:0x800B4840; // type:function size:0x10
CalcRect__15dTagProcessor_cFPQ34nw4r2ut4RectUsPQ34nw4r2ut15PrintContext<w> = .text:0x800B4850; // type:function size:0x4
@@ -30998,7 +30998,7 @@ 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
lbl_80510798 = .data:0x80510798; // type:object size:0x88
__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
__vt__12UnkTextThing = .data:0x805108C8; // type:object size:0xC scope:weak
+24 -2
View File
@@ -13,7 +13,9 @@ public:
virtual ~dTagProcessor_c();
void
eventFlowTextProcessingRelated(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen);
format(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, ...);
void
formatV(dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, va_list list);
virtual nw4r::ut::Operation Process(u16 ch, nw4r::ut::PrintContext<wchar_t> *ctx) override;
virtual nw4r::ut::Operation CalcRect(nw4r::ut::Rect *rect, u16 ch, nw4r::ut::PrintContext<wchar_t> *ctx) override;
@@ -72,6 +74,26 @@ public:
return mCommandInsert;
}
u8 getMsgWindowSubtype() const {
return field_0x90C;
}
void setMsgWindowSubtype(u8 type) {
field_0x90C = type;
}
void setField_0xEE1(u8 val) {
field_0xEE1 = val;
}
void setField_0xEE2(u8 val) {
field_0xEE2 = val;
}
void setField_0xEE3(u8 val) {
field_0xEE3 = val;
}
private:
/* 0x004 */ dTextBox_c *field_0x004;
/* 0x008 */ wchar_t field_0x008[4][256];
@@ -126,7 +148,7 @@ private:
/* 0x90E */ u8 field_0x90E;
/* 0x90F */ u8 field_0x90F[4];
/* 0x914 */ f32 field_0x914[0x32]; // Maybe width for each individual line
/* 0x9DC */ s32 mCommandInsert; // Maybe number of lines
/* 0x9DC */ s32 mCommandInsert; // Maybe number of lines
/* 0x9E0 */ wchar_t mStringArgs[8][64];
/* 0xDE0 */ u8 field_0xDE0[0xEE0 - 0xDE0];
/* 0xEE0 */ u8 field_0xEE0;
+3 -3
View File
@@ -92,7 +92,7 @@ public:
bool fn_800AB940(const char *name, int arg);
bool fn_800AB9A0(dTextBox_c *textbox, int arg);
bool fn_800ABE50(dTextBox_c *textbox, int arg, void *unk);
bool fn_800ABE50(dTextBox_c *textbox, wchar_t *destBuf, u32 maxLen);
private:
void setPropertiesRecursive(nw4r::lyt::Pane *pane, f32, f32, f32, f32, f32);
@@ -101,9 +101,9 @@ private:
bool fn_800ABB80(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg);
bool fn_800ABCE0(const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, int arg);
bool fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk);
bool fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf, u32 maxLen);
bool fn_800AC1AC(
const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk
const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf, u32 maxLen
);
MsbtInfo *getMsbtInfo() const;
bool fn_800AB930(dTextBox_c *box);
+48 -12
View File
@@ -2,8 +2,12 @@
#define D_LYT_TEXTBOX_H
#include "d/lyt/d2d.h"
#include "libms/msgfile.h"
#include "nw4r/lyt/lyt_drawInfo.h"
#include "nw4r/lyt/lyt_textBox.h"
#include "nw4r/lyt/lyt_types.h"
#include "nw4r/ut/ut_Rect.h"
#include "nw4r/ut/ut_TextWriterBase.h"
class dTagProcessor_c;
@@ -11,7 +15,8 @@ class dTextBox_c : public nw4r::lyt::TextBox {
friend class dWindow_c;
public:
dTextBox_c(const nw4r::lyt::res::TextBox *pBlock, const nw4r::lyt::ResBlockSet &ResBlockSet);
dTextBox_c(const nw4r::lyt::res::TextBox *pBlock, const nw4r::lyt::ResBlockSet &resBlockSet);
virtual void DrawSelf(const nw4r::lyt::DrawInfo &drawInfo) override; // at 0x18
f32 GetLineWidth(f32 *pOutSpacing);
@@ -20,10 +25,10 @@ public:
}
void SetScale(f32 scale) {
nw4r::lyt::Size value(mTextScale);
nw4r::lyt::Size value(mMyTextScale);
value.width *= scale;
value.height *= scale;
mScale = scale;
mMyScale = scale;
MySetScale(value);
nw4r::lyt::TextBox::SetFontSize(value);
}
@@ -37,31 +42,62 @@ public:
}
f32 getMyScale() const {
return mScale;
return mMyScale;
}
void fn_800E0A60(const char *area, ...) {
// TODO
}
s32 fn_800AF6B0(const wchar_t *, dTagProcessor_c *tagProcessor);
void fn_800AF930(const wchar_t *);
void fn_800AF540(const wchar_t *text, dTagProcessor_c *tagProcessor, ...);
void setTextWithGlobalTextProcessor(const wchar_t *str);
void setTextWithGlobalTextProcessor(const wchar_t *str, void *, ...);
void setMessageWithGlobalTextProcessor(const char *labelId, void *unused, void *, ...);
void setMessageWithGlobalTextProcessorV(const char *labelId, void *unused, void *, va_list list);
void setTextWithTextProcessor(const wchar_t *str, dTagProcessor_c *tagProcessor, void *, ...);
s32 calcTextLines(const wchar_t *src, dTagProcessor_c *tagProcessor);
void setMessageWithGlobalTextProcessorAndMsbtInfo(const MsbtInfo *info, const char *labelId, wchar_t *destBuf, u32 maxLen);
void fn_800B0F40();
// @bug: This does not implement UT's RTTI, so casts to dTextBox_c will
// succeed even if all you have is a lyt::TextBox
private:
void init();
void MySetFontSize(const nw4r::lyt::Size &value);
void MySetScale(const nw4r::lyt::Size &value);
void setTextWithGlobalTextProcessorV(const wchar_t *str, void *, va_list list);
void setTextWithTextProcessorV(const wchar_t *str, dTagProcessor_c *tagProcessor, void *, va_list list);
nw4r::ut::Rect GetMyTextDrawRect(nw4r::ut::TextWriterBase<wchar_t> *pWriter, bool *pbWideScreenUnk) const;
void fn_800AFD60(f32);
/* 0x104 */ d2d::LytBase_c *mpLytBase;
/* 0x108 */ u8 field_0x108[0x118 - 0x108];
/* 0x118 */ nw4r::lyt::Size mTextScale;
/* 0x120 */ f32 mScale;
/* 0x124 */ u8 field_0x124[0x1F6 - 0x124];
/* 0x108 */ f32 mFixedWidth;
/* 0x10C */ u8 mIsWidthFixed;
/* 0x114 */ nw4r::lyt::Size mMyFontSize;
/* 0x118 */ nw4r::lyt::Size mMyTextScale;
/* 0x120 */ f32 mMyScale;
/* 0x124 */ nw4r::ut::TextWriterBase<wchar_t> mTextWriter;
/* 0x188 */ f32 field_0x188;
/* 0x18C */ f32 field_0x18C;
/* 0x190 */ f32 field_0x190;
/* 0x194 */ f32 field_0x194;
/* 0x198 */ u32 field_0x198[10];
/* 0x1C0 */ u8 mFontIdx;
/* 0x1C1 */ u8 mWindowSubtype;
/* 0x1C4 */ f32 field_0x1C4[10];
/* 0x1EC */ u8 field_0x1EC[10];
/* 0x1F6 */ u8 field_0x1F6;
/* 0x1F7 */ u8 field_0x1F7;
/* 0x1F8 */ u8 field_0x1F8;
/* 0x1F9 */ u8 field_0x1F9[0x204 - 0x1F9];
/* 0x1F9 */ u8 field_0x1F9;
/* 0x1FA */ u8 field_0x1FA;
/* 0x1FC */ dTagProcessor_c *mpMyTagProcessor;
/* 0x200 */ bool mHasTextWriter;
/* 0x201 */ u8 field_0x201;
};
#endif
+2 -3
View File
@@ -22,8 +22,7 @@ struct MsbBlock {
/* 0x0C */ u16 field_0x0C;
};
#pragma push
#pragma pack(2)
#pragma pack(push ,2)
struct MsbHeader {
/* 0x00 */ unsigned char field_0x00[0x0C - 0x00];
@@ -33,7 +32,7 @@ struct MsbHeader {
/* 0x12 */ int fileLength;
};
#pragma pop
#pragma pack(pop)
struct MsbInfo {
/* 0x00 */ struct MsbHeader *header;
+6 -5
View File
@@ -2,6 +2,7 @@
#define LIBMS_MSGFILE_H
#include "common.h"
#include <wchar.h>
#ifdef __cplusplus
extern "C" {
@@ -16,11 +17,11 @@ struct MsbtAttrInfo {
struct MsbtInfo *LMS_InitMessage(void *data);
void LMS_CloseMessage(struct MsbtInfo *info);
int LMS_GetTextIndexByLabel(struct MsbtInfo *info, const char *label);
const char *LMS_GetText(struct MsbtInfo *info, int index);
const char *LMS_GetTextByLabel(struct MsbtInfo *info, const char *label);
const char *LMS_GetLabelByTextIndex(struct MsbtInfo *info, int index);
struct MsbtAttrInfo *LMS_GetAttribute(struct MsbtInfo *info, int index);
int LMS_GetTextIndexByLabel(const struct MsbtInfo *info, const char *label);
const wchar_t *LMS_GetText(const struct MsbtInfo *info, int index);
const wchar_t *LMS_GetTextByLabel(const struct MsbtInfo *info, const char *label);
const char *LMS_GetLabelByTextIndex(const struct MsbtInfo *info, int index);
struct MsbtAttrInfo *LMS_GetAttribute(const struct MsbtInfo *info, int index);
#ifdef __cplusplus
}
+6 -1
View File
@@ -1,5 +1,6 @@
#ifndef NW4R_UT_FONT_H
#define NW4R_UT_FONT_H
#include "common.h"
#include "nw4r/types_nw4r.h"
#include "nw4r/ut/ut_CharStrmReader.h"
#include "rvl/GX.h" // IWYU pragma: export
@@ -67,7 +68,11 @@ public:
void InitReaderFunc(FontEncoding encode);
CharStrmReader GetCharStrmReader() const;
// ???
DECOMP_DONT_INLINE CharStrmReader GetCharStrmReader() const {
CharStrmReader reader(mReadFunc);
return reader;
}
private:
CharStrmReader::ReadFunc mReadFunc; // at 0x4
+12 -3
View File
@@ -212,8 +212,17 @@ struct StackThing {
wchar_t us[4];
};
void dTagProcessor_c::eventFlowTextProcessingRelated(
dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen
void dTagProcessor_c::format(
dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, ...
) {
va_list l;
va_start(l, str);
formatV(textBox, src, dest, destLen, pOutLen, unk, l);
va_end(l);
}
void dTagProcessor_c::formatV(
dTextBox_c *textBox, const wchar_t *src, wchar_t *dest, u32 destLen, u32 *pOutLen, void *unk, va_list list
) {
s32 state3 = 0;
s32 state4 = 0;
@@ -407,7 +416,7 @@ void dTagProcessor_c::eventFlowTextProcessingRelated(
}
} else {
if (textBox != nullptr) {
if (c == '\n') {
if (c == L'\n') {
*writePtr = c;
src++;
writePtr++;
+11 -13
View File
@@ -441,8 +441,7 @@ void LytBase_c::setPropertiesRecursive(nw4r::lyt::Pane *pane, f32 posX, f32 posY
}
}
extern "C" const wchar_t *fn_801B2600(const char *);
extern "C" void fn_800B0F40(dTextBox_c *);
extern "C" const wchar_t *fn_801B2600(const wchar_t *);
void LytBase_c::setProperties(nw4r::lyt::Pane *pane, f32 posX, f32 posY, f32 scale, f32 spaceX, f32 spaceY) {
if (pane->GetName()[0] != 'T') {
@@ -456,7 +455,7 @@ void LytBase_c::setProperties(nw4r::lyt::Pane *pane, f32 posX, f32 posY, f32 sca
textBox->AllocStringBuffer(0x200);
textBox->setLytBase(this);
fn_800B0F40(textBox);
textBox->fn_800B0F40();
if (posX != -9999.0f || posY != -9999.0f) {
if (posX == -9999.0f) {
@@ -606,17 +605,16 @@ bool LytBase_c::fn_800ABCE0(
str1.append(fmt);
}
const char *text = LMS_GetTextByLabel(getMsbtInfo(), str1);
const wchar_t *text = LMS_GetTextByLabel(getMsbtInfo(), str1);
if (text == nullptr) {
return false;
}
textbox1->fn_800AF930(fn_801B2600(text));
textbox1->setTextWithGlobalTextProcessor(fn_801B2600(text));
return true;
}
// Now largely the same functions again, but with an additional argument
bool LytBase_c::fn_800ABE50(dTextBox_c *textbox, int arg, void *unk) {
bool LytBase_c::fn_800ABE50(dTextBox_c *textbox, wchar_t *destBuf, u32 maxLen) {
if (getMsbtInfo() == nullptr) {
return false;
}
@@ -651,15 +649,15 @@ bool LytBase_c::fn_800ABE50(dTextBox_c *textbox, int arg, void *unk) {
if (ty == 1) {
dTextBox_c *otherBox = getTextBox(list->GetString());
if (otherBox != nullptr) {
return fn_800AC040(textbox, otherBox, arg, unk);
return fn_800AC040(textbox, otherBox, destBuf, maxLen);
}
} else {
return fn_800AC1AC(list, textbox, textbox, arg, unk);
return fn_800AC1AC(list, textbox, textbox, destBuf, maxLen);
}
return false;
}
bool LytBase_c::fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk) {
bool LytBase_c::fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf, u32 maxLen) {
u16 num = textbox2->GetExtUserDataNum();
if (num == 0) {
return false;
@@ -679,13 +677,13 @@ bool LytBase_c::fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg,
if (found != 1) {
return false;
}
return fn_800AC1AC(list, textbox1, textbox2, arg, unk);
return fn_800AC1AC(list, textbox1, textbox2, destBuf, maxLen);
}
extern "C" void fn_800AF840(dTextBox_c *textbox1, MsbtInfo *, const char *, int arg, void *unk);
bool LytBase_c::fn_800AC1AC(
const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk
const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf, u32 maxLen
) {
s32 userDatInt = userDatum->GetInt();
SizedString<0x40> str1;
@@ -698,7 +696,7 @@ bool LytBase_c::fn_800AC1AC(
str1.append(fmt);
}
fn_800AF840(textbox1, getMsbtInfo(), str1, arg, unk);
textbox1->setMessageWithGlobalTextProcessorAndMsbtInfo(getMsbtInfo(), str1, destBuf, maxLen);
return true;
}
+5 -5
View File
@@ -45,14 +45,14 @@ void dLytAutoCaption_c::executeState_Invisible() {
void dLytAutoCaption_c::finalizeState_Invisible() {}
void dLytAutoCaption_c::initializeState_In() {
s32 unk = mpTextboxes[0]->fn_800AF6B0(mpTextboxes[0]->GetString(), mpTagProcessor);
s32 numTextLines = mpTextboxes[0]->calcTextLines(mpTextboxes[0]->GetString(), mpTagProcessor);
f32 lineWidth = mpTextboxes[0]->GetLineWidth(nullptr);
f32 frame = 0.0f;
if (lineWidth <= 226.0f) {
if (unk > 1) {
if (numTextLines > 1) {
frame = 1.0f;
}
} else if (unk > 1) {
} else if (numTextLines > 1) {
frame = 3.0f;
} else {
frame = 2.0f;
@@ -165,8 +165,8 @@ bool dLytAutoCaption_c::isClosing() const {
bool dLytAutoCaption_c::setText(const wchar_t *text) {
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
mpTextboxes[0]->fn_800AF930(text);
mpTextboxes[1]->fn_800AF930(text);
mpTextboxes[0]->setTextWithGlobalTextProcessor(text);
mpTextboxes[1]->setTextWithGlobalTextProcessor(text);
return true;
}
+2 -2
View File
@@ -158,8 +158,8 @@ bool dLytAutoExplain_c::isClosing() const {
bool dLytAutoExplain_c::setText(const wchar_t *text) {
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
mpTextboxes[0]->fn_800AF540(text, mpTagProcessor, 0);
mpTextboxes[1]->fn_800AF540(text, mpTagProcessor, 0);
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
return true;
}
+2 -2
View File
@@ -182,7 +182,7 @@ void dLytCommonIconItemPart1_c::setNumber(s32 number) {
std::memset(mNumberBuf, 0, sizeof(mNumberBuf));
swprintf(mNumberBuf, ARRAY_LENGTH(mNumberBuf), L"%d", number);
for (int i = 0; i < 2; i++) {
mpTextBoxes[i]->fn_800AF930(mNumberBuf);
mpTextBoxes[i]->setTextWithGlobalTextProcessor(mNumberBuf);
}
}
@@ -515,7 +515,7 @@ void dLytCommonIconItemPart2_c::setNumber(s32 number) {
std::memset(mNumberBuf, 0, sizeof(mNumberBuf));
swprintf(mNumberBuf, ARRAY_LENGTH(mNumberBuf), L"%d", number);
for (int i = 0; i < 2; i++) {
mpTextBoxes[i]->fn_800AF930(mNumberBuf);
mpTextBoxes[i]->setTextWithGlobalTextProcessor(mNumberBuf);
}
}
+2 -2
View File
@@ -175,7 +175,7 @@ void dLytCommonIconMaterialPart1_c::setNumber(s32 number) {
std::memset(mNumberBuf, 0, sizeof(mNumberBuf));
swprintf(mNumberBuf, ARRAY_LENGTH(mNumberBuf), L"%d", number);
for (int i = 0; i < 2; i++) {
mpTextBoxes[i]->fn_800AF930(mNumberBuf);
mpTextBoxes[i]->setTextWithGlobalTextProcessor(mNumberBuf);
}
}
@@ -374,7 +374,7 @@ void dLytCommonIconMaterialPart2_c::setNumber(s32 number) {
std::memset(mNumberBuf, 0, sizeof(mNumberBuf));
swprintf(mNumberBuf, ARRAY_LENGTH(mNumberBuf), L"%d", number);
for (int i = 0; i < 2; i++) {
mpTextBoxes[i]->fn_800AF930(mNumberBuf);
mpTextBoxes[i]->setTextWithGlobalTextProcessor(mNumberBuf);
}
}
+389
View File
@@ -0,0 +1,389 @@
#include "d/lyt/d_textbox.h"
#include "common.h"
#include "d/d_font_manager.h"
#include "d/d_tag_processor.h"
#include "d/d_textunk.h"
#include "libms/msgfile.h"
#include "nw4r/lyt/lyt_drawInfo.h"
#include "nw4r/lyt/lyt_textBox.h"
#include "nw4r/lyt/lyt_types.h"
#include "nw4r/ut/ut_Rect.h"
#include <cstring>
dTextBox_c::dTextBox_c(const nw4r::lyt::res::TextBox *pBlock, const nw4r::lyt::ResBlockSet &resBlockSet)
: nw4r::lyt::TextBox(pBlock, resBlockSet),
mMyFontSize(0.0f, 0.0f),
mMyTextScale(0.0f, 0.0f),
field_0x188(0.0f),
field_0x18C(0.0f),
field_0x190(0.0f),
field_0x194(0.0f) {
const nw4r::lyt::res::Font *fonts = nw4r::lyt::detail::ConvertOffsToPtr<nw4r::lyt::res::Font>(
resBlockSet.pFontList, sizeof(nw4r::lyt::res::FontList)
);
const char *fontName = nw4r::lyt::detail::ConvertOffsToPtr<char>(fonts, fonts[pBlock->fontIdx].nameStrOffset);
for (u32 i = 0; i < 5; i++) {
const char *name = dFontMng_c::getFontName(i);
if (!std::strcmp(fontName, name)) {
mFontIdx = i;
break;
}
}
init();
}
///////////////////////////////////////////////////////////////////////////
// Begin largely copied from nw4r::lyt::TextBox
///////////////////////////////////////////////////////////////////////////
inline u8 ClampColor(s16 colVal) {
// The CLAMP macro was reversed for this -_-
return colVal < 0 ? 0 : (colVal > 0xFF ? 0xFF : colVal);
}
nw4r::ut::Color GetColor(const GXColorS10 &src) {
GXColor dst;
dst.r = ClampColor(src.r);
dst.g = ClampColor(src.g);
dst.b = ClampColor(src.b);
dst.a = ClampColor(src.a);
return dst;
}
static void CalcStringRect(
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> &textWriter, const wchar_t *str, int length,
bool *pbWideScreenUnk, f32 maxWidth
);
static void CalcStringRectImpl(
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> *pTextWriter, const wchar_t *str, int length, f32 maxWidth,
bool *pbWideScreenUnk
);
static int CalcLineRectImpl(
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> *pTextWriter, const wchar_t *str, int length, f32 maxWidth,
bool *pbOver, bool *pbWideScreenUnk
);
nw4r::ut::Rect dTextBox_c::GetMyTextDrawRect(nw4r::ut::TextWriterBase<wchar_t> *pWriter, bool *pbWideScreenUnk) const {
nw4r::ut::Rect textRect;
pWriter->SetCursor(0.0f, 0.0f);
pWriter->SetFont(*mpFont);
pWriter->SetFontSize(GetFontSize().width, GetFontSize().height);
pWriter->SetLineSpace(mLineSpace);
pWriter->SetCharSpace(mCharSpace);
if (mIsWidthFixed == true) {
pWriter->EnableFixedWidth(true);
pWriter->SetFixedWidth(mFixedWidth);
}
if (GetTagProcessor() != nullptr) {
pWriter->SetTagProcessor(GetTagProcessor());
}
CalcStringRect(&textRect, *pWriter, mTextBuf, mTextLen, pbWideScreenUnk, FLT_MAX);
nw4r::lyt::Size textSize(textRect.GetWidth(), textRect.GetHeight());
nw4r::math::VEC2 ltPos = GetVtxPos();
// Adjust for Alignment (left, center, right)
ltPos.x += (mSize.width - textSize.width) * GetTextMagH();
ltPos.y -= (mSize.height - textSize.height) * GetTextMagV();
// Apply the new pos
textRect.left = ltPos.x;
textRect.top = ltPos.y;
textRect.right = ltPos.x + textSize.width;
textRect.bottom = ltPos.y - textSize.height;
return textRect;
}
static void CalcStringRect(
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> &textWriter, const wchar_t *str, int length,
bool *pbWideScreenUnk, f32 maxWidth
) {
nw4r::ut::TextWriterBase<wchar_t> writerCpy(textWriter);
CalcStringRectImpl(pRect, &writerCpy, str, length, maxWidth, pbWideScreenUnk);
}
static void CalcStringRectImpl(
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> *pTextWriter, const wchar_t *str, int length, f32 maxWidth,
bool *pbWideScreenUnk
) {
pRect->left = 0.0f;
pRect->right = 0.0f;
pRect->top = 0.0f;
pRect->bottom = 0.0f;
pTextWriter->SetCursor(0.0f, 0.0f);
int remain = length;
const wchar_t *pos = str;
int i = 0;
do {
nw4r::ut::Rect rect;
bool bOver;
int read =
CalcLineRectImpl(&rect, pTextWriter, pos, remain, maxWidth, &bOver, i == 0 ? pbWideScreenUnk : nullptr);
pos += read;
remain -= read;
pRect->left = nw4r::ut::Min(pRect->left, rect.left);
pRect->top = nw4r::ut::Min(pRect->top, rect.top);
pRect->right = nw4r::ut::Max(pRect->right, rect.right);
pRect->bottom = nw4r::ut::Max(pRect->bottom, rect.bottom);
if (bOver) {
CalcLineRectImpl(&rect, pTextWriter, L"\n", 1, maxWidth, &bOver, nullptr);
pRect->left = nw4r::ut::Min(pRect->left, rect.left);
pRect->top = nw4r::ut::Min(pRect->top, rect.top);
pRect->right = nw4r::ut::Max(pRect->right, rect.right);
pRect->bottom = nw4r::ut::Max(pRect->bottom, rect.bottom);
}
i++;
} while (remain > 0);
}
extern "C" bool NeedsScreenAdjustment();
static int CalcLineRectImpl(
nw4r::ut::Rect *pRect, nw4r::ut::TextWriterBase<wchar_t> *pTextWriter, const wchar_t *str, int length, f32 maxWidth,
bool *pbOver, bool *pbWideScreenUnk
) {
nw4r::ut::PrintContext<wchar_t> context = {pTextWriter, str, 0.0f, 0.0f, 0};
f32 x = 0.0f;
const nw4r::ut::Font *font = pTextWriter->GetFont();
bool bCharSpace = false;
nw4r::ut::CharStrmReader reader = font->GetCharStrmReader();
const wchar_t *prStrPos = (const wchar_t *)reader.GetCurrentPos();
pRect->left = 0.0f;
pRect->right = 0.0f;
pRect->top = nw4r::ut::Min(0.0f, pTextWriter->GetLineHeight());
pRect->bottom = nw4r::ut::Max(0.0f, pTextWriter->GetLineHeight());
*pbOver = false;
reader.Set(str);
nw4r::ut::Rect prMaxRect = *pRect;
u16 code = reader.Next();
while (((const wchar_t *)reader.GetCurrentPos() - str) <= length) {
if (code < ' ') {
nw4r::ut::Operation operation;
nw4r::ut::Rect rect(x, 0.0f, 0.0f, 0.0f);
context.str = (const wchar_t *)reader.GetCurrentPos();
context.flags = !bCharSpace;
pTextWriter->SetCursorX(x);
// ??????????
if (pbWideScreenUnk != nullptr && ((u32 *)context.str)[0] == 0 && NeedsScreenAdjustment()) {
*pbWideScreenUnk = true;
}
operation = pTextWriter->GetTagProcessor()->CalcRect(&rect, code, &context);
reader.Set(context.str);
pRect->left = nw4r::ut::Min(pRect->left, rect.left);
pRect->top = nw4r::ut::Min(pRect->top, rect.top);
pRect->right = nw4r::ut::Max(pRect->right, rect.right);
pRect->bottom = nw4r::ut::Max(pRect->bottom, rect.bottom);
x = pTextWriter->GetCursorX();
if (pRect->GetWidth() > maxWidth) {
*pbOver = true;
break;
}
if (operation == nw4r::ut::OPERATION_END_DRAW) {
return length;
} else if (operation == nw4r::ut::OPERATION_NO_CHAR_SPACE) {
bCharSpace = false;
} else if (operation == nw4r::ut::OPERATION_CHAR_SPACE) {
bCharSpace = true;
} else if (operation == nw4r::ut::OPERATION_NEXT_LINE) {
break;
}
} else {
if (bCharSpace) {
x += pTextWriter->GetCharSpace();
}
bCharSpace = true;
if (pTextWriter->IsWidthFixed()) {
x += pTextWriter->GetFixedWidth();
} else {
x += pTextWriter->GetFont()->GetCharWidth(code) * pTextWriter->GetScaleH();
}
pRect->left = nw4r::ut::Min(pRect->left, x);
pRect->right = nw4r::ut::Max(pRect->right, x);
if (pRect->GetWidth() > maxWidth) {
*pbOver = true;
break;
}
}
prStrPos = (const wchar_t *)reader.GetCurrentPos();
code = reader.Next();
prMaxRect = *pRect;
}
if (*pbOver) {
if (prStrPos) {
*pRect = prMaxRect;
return (prStrPos - str);
}
}
return ((const wchar_t *)reader.GetCurrentPos() - str);
}
///////////////////////////////////////////////////////////////////////////
// End largely copied from nw4r::lyt::TextBox
///////////////////////////////////////////////////////////////////////////
void dTextBox_c::setTextWithGlobalTextProcessor(const wchar_t *str, void *unk, ...) {
va_list l;
va_start(l, str);
setTextWithGlobalTextProcessorV(str, unk, l);
va_end(l);
}
extern "C" dTagProcessor_c *GLOBAL_TEXT_MANAGER;
void dTextBox_c::setTextWithGlobalTextProcessorV(const wchar_t *str, void *unk, va_list list) {
SetFontSize(mMyTextScale);
mHasTextWriter = true;
mpMyTagProcessor = GLOBAL_TEXT_MANAGER;
u32 outLen = 0;
mWindowSubtype = mpMyTagProcessor->getMsgWindowSubtype();
mpMyTagProcessor->setField_0xEE1(field_0x1F6);
mpMyTagProcessor->setField_0xEE2(0);
mpMyTagProcessor->setField_0xEE3(1);
static wchar_t destBuffer[0x200];
mpMyTagProcessor->formatV(nullptr, str, destBuffer, ARRAY_LENGTH(destBuffer), &outLen, unk, list);
SetString(destBuffer, 0, outLen);
}
void dTextBox_c::setTextWithTextProcessor(const wchar_t *str, dTagProcessor_c *tagProcessor, void *unk, ...) {
va_list l;
va_start(l, str);
setTextWithTextProcessorV(str, tagProcessor, unk, l);
va_end(l);
}
void dTextBox_c::setTextWithTextProcessorV(const wchar_t *str, dTagProcessor_c *tagProcessor, void *unk, va_list list) {
SetFontSize(mMyTextScale);
mHasTextWriter = true;
u32 outLen = 0;
mpMyTagProcessor = tagProcessor;
mWindowSubtype = mpMyTagProcessor->getMsgWindowSubtype();
mpMyTagProcessor->setField_0xEE1(field_0x1F6);
mpMyTagProcessor->setField_0xEE2(0);
mpMyTagProcessor->setField_0xEE3(1);
static wchar_t destBuffer[0x200];
mpMyTagProcessor->formatV(nullptr, str, destBuffer, ARRAY_LENGTH(destBuffer), &outLen, unk, list);
SetString(destBuffer, 0, outLen);
}
s32 dTextBox_c::calcTextLines(const wchar_t *src, dTagProcessor_c *tagProcessor) {
static wchar_t destBuffer[0x200];
u32 outLen = 0;
tagProcessor->format(this, src, destBuffer, ARRAY_LENGTH(destBuffer), &outLen, nullptr);
return tagProcessor->getNumLinesMaybe();
}
extern "C" const wchar_t *getTextMessageByLabel(const char *labelId, int, int, int);
void dTextBox_c::setMessageWithGlobalTextProcessor(const char *labelId, void *unused, void *unk, ...) {
va_list l;
va_start(l, str);
setMessageWithGlobalTextProcessorV(labelId, unused, unk, l);
va_end(l);
}
void dTextBox_c::setMessageWithGlobalTextProcessorV(const char *labelId, void *unused, void *unk, va_list list) {
const wchar_t *text = getTextMessageByLabel(labelId, 1, 0, 0);
setTextWithGlobalTextProcessorV(text, unk, list);
if (GetFont() != nullptr) {
fn_800AFD60(GetSize().width);
}
}
void dTextBox_c::setMessageWithGlobalTextProcessorAndMsbtInfo(
const MsbtInfo *info, const char *labelId, wchar_t *destBuf, u32 maxLen
) {
const wchar_t *src = LMS_GetTextByLabel(info, labelId);
SetFontSize(mMyTextScale);
mHasTextWriter = true;
field_0x1FA = 1;
u32 outLen = 0;
mpMyTagProcessor = GLOBAL_TEXT_MANAGER;
mpMyTagProcessor->setMsgWindowSubtype(0x22);
mWindowSubtype = mpMyTagProcessor->getMsgWindowSubtype();
mpMyTagProcessor->setField_0xEE1(field_0x1F6);
mpMyTagProcessor->setField_0xEE2(0);
mpMyTagProcessor->setField_0xEE3(1);
mpMyTagProcessor->format(nullptr, src, destBuf, maxLen, &outLen, 0);
SetString(destBuf, 0, outLen);
}
void dTextBox_c::setTextWithGlobalTextProcessor(const wchar_t *str) {
setTextWithGlobalTextProcessor(str, nullptr);
if (GetFont() != nullptr) {
fn_800AFD60(GetSize().width);
}
}
void dTextBox_c::init() {
mpLytBase = nullptr;
mIsWidthFixed = false;
mFixedWidth = 0.0f;
mHasTextWriter = true;
field_0x1F6 = 0;
field_0x1F7 = 0;
field_0x1F9 = 0;
field_0x1FA = 0;
field_0x1F8 = 2;
mpMyTagProcessor = nullptr;
MySetFontSize(GetFontSize());
for (int i = 0; i < 10; i++) {
field_0x198[i] = 0;
field_0x1C4[i] = 0.0f;
field_0x1EC[i] = 0;
}
f32 f1 = 35.0f;
if (mFontIdx > 1 && mFontIdx < 4) {
f1 = 41.0f;
}
nw4r::lyt::Size sz = GetFontSize();
f32 scale = UnkTextThing::getFn800B1F70();
f32 height = sz.height / f1;
sz.width = GetFont()->GetWidth() * height * scale;
sz.height = GetFont()->GetHeight() * height * scale;
SetFontSize(sz);
mMyTextScale = sz;
mMyScale = 1.0f;
mWindowSubtype = 0x24;
field_0x201 = 1;
}
void dTextBox_c::DrawSelf(const nw4r::lyt::DrawInfo &drawInfo) {
if (!mTextBuf || !mpFont || !mpMaterial) {
return;
}
LoadMtx(drawInfo);
nw4r::ut::TextWriterBase<wchar_t> writer;
// TODO
}
void dTextBox_c::MySetFontSize(const nw4r::lyt::Size &value) {
mMyFontSize = value;
}
void dTextBox_c::MySetScale(const nw4r::lyt::Size &value) {
mMyTextScale = value;
}
@@ -188,8 +188,8 @@ bool dLytMsgWindowStone_c::setText(const wchar_t *text) {
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
mpTextboxes[2]->SetTagProcessor(mpTagProcessor);
mpTextboxes[0]->fn_800AF540(text, mpTagProcessor, 0);
mpTextboxes[1]->fn_800AF540(text, mpTagProcessor, 0);
mpTextboxes[2]->fn_800AF540(text, mpTagProcessor, 0);
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
mpTextboxes[2]->setTextWithTextProcessor(text, mpTagProcessor, 0);
return true;
}
@@ -185,7 +185,7 @@ bool dLytMsgWindowWood_c::isClosing() const {
bool dLytMsgWindowWood_c::setText(const wchar_t *text) {
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
mpTextboxes[0]->fn_800AF540(text, mpTagProcessor, 0);
mpTextboxes[1]->fn_800AF540(text, mpTagProcessor, 0);
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
return true;
}
+6 -6
View File
@@ -30,7 +30,7 @@ void LMS_CloseMessage(struct MsbtInfo *info) {
LMSi_Free(info);
}
int LMS_GetTextIndexByLabel(struct MsbtInfo *info, const char *label) {
int LMS_GetTextIndexByLabel(const struct MsbtInfo *info, const char *label) {
if (info->lbl1Index == -1) {
return -2;
} else {
@@ -38,7 +38,7 @@ int LMS_GetTextIndexByLabel(struct MsbtInfo *info, const char *label) {
}
}
const char *LMS_GetText(struct MsbtInfo *info, int index) {
const wchar_t *LMS_GetText(const struct MsbtInfo *info, int index) {
if (info->txt2Index == -1) {
return NULL;
}
@@ -48,10 +48,10 @@ const char *LMS_GetText(struct MsbtInfo *info, int index) {
return NULL;
}
return &((const char *)header)[header[index + 1]];
return (const wchar_t*)&((const char *)header)[header[index + 1]];
}
const char *LMS_GetTextByLabel(struct MsbtInfo *info, const char *label) {
const wchar_t *LMS_GetTextByLabel(const struct MsbtInfo *info, const char *label) {
int index = LMS_GetTextIndexByLabel(info, label);
if (index < 0) {
return NULL;
@@ -60,11 +60,11 @@ const char *LMS_GetTextByLabel(struct MsbtInfo *info, const char *label) {
}
}
const char *LMS_GetLabelByTextIndex(struct MsbtInfo *info, int index) {
const char *LMS_GetLabelByTextIndex(const struct MsbtInfo *info, int index) {
// TODO
}
struct MsbtAttrInfo *LMS_GetAttribute(struct MsbtInfo *info, int index) {
struct MsbtAttrInfo *LMS_GetAttribute(const struct MsbtInfo *info, int index) {
int *p = info->base.sectionInfos[info->atr1Index].ptr;
return (struct MsbtAttrInfo *)&((const char *)p)[p[1] * index + 8];
}