//
// CCTextInputNode::updateLabel from 0x14004f8b0 to 0x14004fba8 (760 bytes)
//
// 31 xrefs:
// > CCTextInputNode::addTextArea @ 0x14004f66e
// > CCTextInputNode::setString @ 0x14004f864
// > CCTextInputNode::textChanged @ 0x1400504e2
// > CCTextInputNode::onTextFieldDetachWithIME @ 0x140050d67
// > ColorSelectPopup::updateTextInputLabel @ 0x1400934b5
// > ColorSelectPopup::colorSelectClosed @ 0x140093810
// > ColorSelectPopup::colorSelectClosed @ 0x1400938c0
// > ColorSelectPopup::updateCopyColorTextInputLabel @ 0x140093c45
// > CustomizeObjectLayer::textInputOpened @ 0x1400a97e4
// > EditLevelLayer::textInputClosed @ 0x1400d76df
// > EditLevelLayer::textInputOpened @ 0x1400d7be9
// > GJGarageLayer::textInputOpened @ 0x140274df4
// > SetColorIDPopup::init @ 0x14029c2b1
// > SetColorIDPopup::colorSelectClosed @ 0x14029c3e5
// > LevelListLayer::textInputClosed @ 0x140308b61
// > LevelListLayer::textInputOpened @ 0x140308d0b
// > LevelSearchLayer::textInputOpened @ 0x14030f8d5
// > LevelSearchLayer::updateSearchLabel @ 0x14030fcda
// > SecretLayer::textInputOpened @ 0x1403df905
// > SecretLayer::updateSearchLabel @ 0x1403dfcce
// > SecretLayer2::textInputOpened @ 0x1403e6e65
// > SecretLayer2::updateSearchLabel @ 0x1403e722e
// > SecretLayer5::onSubmit @ 0x1403f6d69
// > SecretLayer5::textInputOpened @ 0x1403f7435
// > SecretLayer5::updateSearchLabel @ 0x1403f77fe
// > SetupPulsePopup::colorSelectClosed @ 0x14043bab0
// > SetupPulsePopup::colorSelectClosed @ 0x14043bb51
// > SetupPulsePopup::updateTextInputLabel @ 0x14043cfe5
// > SetupPulsePopup::updateCopyColorTextInputLabel @ 0x14043d0f5
// > SetupSmartTemplateLayer::textInputOpened @ 0x140459b78
// > ??> @ 0x1406c4ce0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=3
void __fastcall CCTextInputNode::updateLabel(CCTextInputNode *a1, __int64 a2)
{
cocos2d::CCLabelBMFont *m_textLabel; // rcx
const char *v5; // rcx
size_t v6; // r14
size_t v7; // r8
char **p_m_caption; // rdx
size_t v9; // r8
size_t v10; // r8
unsigned __int64 v11; // rax
int v12; // esi
void **v13; // rdx
cocos2d::CCLabelBMFont *v14; // rcx
const char *v15; // rdx
const char *v16; // rdx
size_t v17; // r8
const char *v18; // rax
size_t v19; // r8
__int128 *p_Buf2; // rcx
char *v21; // rsi
unsigned __int64 v22; // r15
size_t v23; // r8
int v24; // r14d
char *v25; // rax
__int128 Buf2; // [rsp+30h] [rbp-39h] BYREF
size_t v27; // [rsp+40h] [rbp-29h]
unsigned __int64 v28; // [rsp+48h] [rbp-21h]
void *Src[2]; // [rsp+50h] [rbp-19h] BYREF
size_t Size; // [rsp+60h] [rbp-9h]
__int64 v31; // [rsp+68h] [rbp-1h]
__int128 v32; // [rsp+70h] [rbp+7h] BYREF
__int64 v33; // [rsp+80h] [rbp+17h]
__int64 v34; // [rsp+88h] [rbp+1Fh]
m_textLabel = a1->m_textLabel;
if ( m_textLabel )
{
m_textLabel->m_nExtraKerning = a1->m_kerningAmount;
}
else if ( !a1->m_textArea )
{
goto LABEL_51;
}
Buf2 = 0;
v27 = 0;
v28 = 15;
LOBYTE(Buf2) = 0;
v5 = (const char *)a2;
if ( *(_QWORD *)(a2 + 24) > 0xFu )
v5 = *(const char **)a2;
v6 = *(_QWORD *)(a2 + 16);
v7 = v6;
if ( v6 )
v7 = 0;
if ( memcmp(v5, &Buf2, v7) || v6 )
{
if ( a1->m_usePasswordChar )
{
*(_OWORD *)Src = 0;
v10 = 0;
Size = 0;
v11 = 15;
v31 = 15;
LOBYTE(Src[0]) = 0;
v12 = 0;
if ( v6 )
{
do
{
sub_140041270(Src, &dword_140531F08, 3u);
++v12;
}
while ( (unsigned __int64)v12 < *(_QWORD *)(a2 + 16) );
v11 = v31;
v10 = Size;
}
if ( (void **)a2 != Src )
{
v13 = Src;
if ( v11 > 0xF )
v13 = (void **)Src[0];
sub_14003CCE0((void **)a2, v13, v10);
}
sub_14003A830((__int64)Src);
}
}
else
{
p_m_caption = (char **)&a1->m_caption;
if ( a1->m_caption.m_data.m_capacity > 0xF )
p_m_caption = (char **)*p_m_caption;
v9 = -1;
do
++v9;
while ( *((_BYTE *)p_m_caption + v9) );
sub_14003CCE0((void **)a2, p_m_caption, v9);
}
v14 = a1->m_textLabel;
if ( v14 )
{
v15 = (const char *)a2;
if ( *(_QWORD *)(a2 + 24) > 0xFu )
v15 = *(const char **)a2;
v14->setString(&v14->cocos2d::CCLabelProtocol, v15);
}
else if ( a1->m_textArea )
{
v16 = (const char *)a2;
if ( *(_QWORD *)(a2 + 24) > 0xFu )
v16 = *(const char **)a2;
Buf2 = 0;
v27 = 0;
v28 = 0;
v17 = -1;
do
++v17;
while ( v16[v17] );
sub_14003A930(&Buf2, v16, v17);
TextArea::setString(a1->m_textArea, &Buf2);
}
CCTextInputNode::refreshLabel(a1);
v32 = 0;
v33 = 0;
v34 = 15;
LOBYTE(v32) = 0;
v18 = a1->m_textField->getString(&a1->m_textField->cocos2d::CCLabelProtocol);
Buf2 = 0;
v27 = 0;
v28 = 0;
v19 = -1;
do
++v19;
while ( v18[v19] );
sub_14003A930(&Buf2, v18, v19);
p_Buf2 = &Buf2;
v21 = (char *)Buf2;
v22 = v28;
if ( v28 > 0xF )
p_Buf2 = (__int128 *)Buf2;
v23 = v27;
if ( v27 )
v23 = 0;
v24 = memcmp(p_Buf2, &v32, v23);
if ( !v24 )
v24 = v27 != 0;
if ( v22 > 0xF )
{
v25 = v21;
if ( v22 + 1 >= 0x1000 )
{
v21 = *((char **)v21 - 1);
if ( (unsigned __int64)(v25 - v21 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v21);
}
if ( !v24 )
a1->m_textField->m_uCursorPos = -1;
CCTextInputNode::updateBlinkLabelToChar(a1, a1->m_textField->m_uCursorPos);
LABEL_51:
sub_14003A830(a2);
}