//
// CCTextInputNode::updateLabel from 0x5a3400 to 0x5a38bc (1212 bytes)
//
// 33 xrefs:
// > CCTextInputNode::addTextArea @ 0x5a3994
// > CCTextInputNode::setString @ 0x5a3b10
// > CCTextInputNode::textChanged @ 0x5a3c30
// > CCTextInputNode::onTextFieldDetachWithIME @ 0x5a3d90
// > LevelSearchLayer::textInputOpened @ 0x6ce280
// > LevelSearchLayer::updateSearchLabel @ 0x6ce538
// > EditLevelLayer::textInputOpened @ 0x6df1c4
// > EditLevelLayer::textInputClosed @ 0x6e1e60
// > ColorSelectPopup::updateTextInputLabel @ 0x73c984
// > ColorSelectPopup::colorSelectClosed @ 0x73cdd0
// > ColorSelectPopup::colorSelectClosed @ 0x73ce6c
// > ColorSelectPopup::updateCopyColorTextInputLabel @ 0x73d11c
// > GJGarageLayer::textInputOpened @ 0x790b80
// > CustomizeObjectLayer::textInputOpened @ 0x83ffec
// > SetColorIDPopup::colorSelectClosed @ 0x8c4dac
// > SetColorIDPopup::init @ 0x8d2a18
// > SetupPulsePopup::colorSelectClosed @ 0x8ed754
// > SetupPulsePopup::colorSelectClosed @ 0x8ed7f8
// > SetupPulsePopup::updateTextInputLabel @ 0x8ee3b8
// > SetupPulsePopup::updateCopyColorTextInputLabel @ 0x8ee8ac
// > SecretLayer::textInputOpened @ 0x901e94
// > SecretLayer::updateSearchLabel @ 0x902154
// > SecretLayer2::textInputOpened @ 0x93e434
// > SecretLayer2::updateSearchLabel @ 0x93faa4
// > SecretLayer4::textInputOpened @ 0x947004
// > SecretLayer4::updateSearchLabel @ 0x947e10
// > SetupSmartTemplateLayer::textInputOpened @ 0x9dc8e4
// > LevelListLayer::textInputOpened @ 0xa74138
// > LevelListLayer::textInputClosed @ 0xa74620
// > SecretLayer5::textInputOpened @ 0xa90cdc
// > SecretLayer5::updateSearchLabel @ 0xa93820
// > SecretLayer5::onSubmit @ 0xa954f8
// > ??> @ 0x374a0
//
// 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
//
__int64 __fastcall CCTextInputNode::updateLabel(CCTextInputNode *a1, const void **a2)
{
cocos2d::CCLabelBMFont *m_textLabel; // x0
_DWORD *v5; // x25
unsigned __int64 v6; // x27
unsigned __int64 v7; // x23
size_t v8; // x2
int v9; // w19
__int64 v10; // x23
__int64 *v11; // x0
cocos2d::CCLabelBMFont *v12; // x0
char *v13; // x0
_DWORD *v14; // x25
_DWORD *v15; // x26
unsigned __int64 v16; // x22
unsigned __int64 v17; // x27
size_t v18; // x2
int v19; // w19
__int64 v20; // x22
char *v21; // x0
char *v22; // x22
unsigned __int64 v24; // x19
char *v25; // x0
unsigned int *v26; // x1
int v27; // w2
__int64 m_textArea; // x19
char *v29; // x0
size_t v30; // x0
unsigned int *v31; // x25
int v32; // w1
unsigned int *v33; // x25
int v34; // w0
unsigned int *v35; // x26
int v36; // w1
unsigned int *v37; // x1
int v38; // w2
const char *m_data; // [xsp+68h] [xbp+68h]
void *v40; // [xsp+88h] [xbp+88h] BYREF
void *v41; // [xsp+90h] [xbp+90h] BYREF
m_textLabel = a1->m_textLabel;
if ( m_textLabel )
{
m_textLabel->m_nExtraKerning = a1->m_kerningAmount;
}
else if ( !a1->m_textArea )
{
return _stack_chk_guard;
}
sub_D153B8((int)&v41, &byte_F288A0);
v5 = v41;
v6 = *((_QWORD *)v41 - 3);
v7 = *((_QWORD *)*a2 - 3);
if ( v6 > v7 )
v8 = *((_QWORD *)*a2 - 3);
else
v8 = *((_QWORD *)v41 - 3);
v9 = memcmp(*a2, v41, v8);
if ( v9 || (v9 = 0x7FFFFFFF, v10 = v7 - v6, v10 > 0x7FFFFFFF) )
{
v11 = (__int64 *)(v5 - 6);
if ( v5 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_9;
}
else
{
v11 = (__int64 *)(v5 - 6);
if ( v10 >= (__int64)0xFFFFFFFF80000000LL )
v9 = v10;
else
v9 = 0x80000000;
if ( v11 == &qword_124B6B0 )
goto LABEL_9;
}
if ( &pthread_create )
{
v31 = v5 - 2;
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = *(v5 - 2);
*(v5 - 2) = v32 - 1;
}
if ( v32 <= 0 )
operator delete(v11);
LABEL_9:
if ( v9 )
{
if ( a1->m_usePasswordChar )
{
v24 = 1;
sub_D153B8((int)&v41, &byte_F288A0);
if ( *((_QWORD *)*a2 - 3) )
{
while ( 1 )
{
sub_D15FD4(&v41, &unk_EA06B8, 3);
if ( v24 >= *((_QWORD *)*a2 - 3) )
break;
++v24;
}
}
sub_D18EA8(a2, &v41);
v25 = (char *)v41 - 24;
if ( (char *)v41 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)((char *)v41 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *((_DWORD *)v41 - 2);
*((_DWORD *)v41 - 2) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v25);
}
}
}
else
{
m_data = (const char *)a1->m_caption.m_data.m_data;
v30 = strlen(m_data);
sub_D1798C(a2, m_data, v30);
}
v12 = a1->m_textLabel;
if ( v12 )
{
v12->setString(v12, (const unsigned __int8 *)*a2);
}
else
{
m_textArea = (__int64)a1->m_textArea;
if ( m_textArea )
{
sub_D153B8((int)&v41, (char *)*a2);
TextArea::setString(m_textArea, (const void **)&v41);
v29 = (char *)v41 - 24;
if ( (char *)v41 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)((char *)v41 - 8);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *((_DWORD *)v41 - 2);
*((_DWORD *)v41 - 2) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v29);
}
}
}
CCTextInputNode::refreshLabel(a1);
v13 = (char *)a1->m_textField->getString(a1->m_textField);
sub_D153B8((int)&v40, v13);
sub_D153B8((int)&v41, &byte_F288A0);
v14 = v40;
v15 = v41;
v16 = *((_QWORD *)v40 - 3);
v17 = *((_QWORD *)v41 - 3);
if ( v17 > v16 )
v18 = *((_QWORD *)v40 - 3);
else
v18 = *((_QWORD *)v41 - 3);
v19 = memcmp(v40, v41, v18);
if ( !v19 )
{
v19 = 0x7FFFFFFF;
v20 = v16 - v17;
if ( v20 <= 0x7FFFFFFF )
{
if ( v20 >= (__int64)0xFFFFFFFF80000000LL )
v19 = v20;
else
v19 = 0x80000000;
}
}
v21 = (char *)(v15 - 6);
if ( v15 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = v15 - 2;
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *(v15 - 2);
*(v15 - 2) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v21);
v14 = v40;
}
v22 = (char *)(v14 - 6);
if ( v14 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = v14 - 2;
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *(v14 - 2);
*(v14 - 2) = v34 - 1;
}
if ( v34 <= 0 )
{
operator delete(v22);
if ( v19 )
goto LABEL_21;
goto LABEL_23;
}
}
if ( !v19 )
LABEL_23:
a1->m_textField->m_uCursorPos = -1;
LABEL_21:
CCTextInputNode::updateBlinkLabel(a1);
return _stack_chk_guard;
}