//
// CCTextInputNode::refreshLabel from 0x5a2bb8 to 0x5a2ee8 (816 bytes)
//
// 7 xrefs:
// > CCTextInputNode::setMaxLabelScale @ 0x5a2eec
// > CCTextInputNode::setMaxLabelWidth @ 0x5a2ef4
// > CCTextInputNode::setLabelPlaceholderScale @ 0x5a2efc
// > CCTextInputNode::setLabelPlaceholderColor @ 0x5a2f14
// > CCTextInputNode::setLabelNormalColor @ 0x5a2f30
// > CCTextInputNode::updateLabel @ 0x5a34dc
// > ??> @ 0x9e430
//
// 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
//
void CCTextInputNode::refreshLabel(CCTextInputNode *a1)
{
char *v2; // x0
_DWORD *v3; // x22
_BOOL4 v4; // w26
_DWORD *v5; // x23
unsigned __int64 v6; // x20
unsigned __int64 v7; // x25
size_t v8; // x2
__int64 v9; // x20
char *v10; // x0
char *v11; // x0
cocos2d::CCLabelBMFont *m_textLabel; // x20
cocos2d::CCLabelBMFont_vtbl *v13; // x1
cocos2d::CCLabelBMFont *v14; // x0
float m_maxLabelWidth; // s8
void (__fastcall *setScale)(cocos2d::CCLabelBMFont *__hidden, float); // x22
float v17; // s8
void (__fastcall *v18)(cocos2d::CCLabelBMFont *__hidden, float); // x22
cocos2d::CCLabelBMFont *v19; // x20
float v20; // s8
float *v21; // x0
cocos2d::CCLabelBMFont *v22; // x20
float v23; // s8
float *v24; // x0
TextArea *m_textArea; // x0
unsigned int *v26; // x23
int v27; // w1
unsigned int *v28; // x22
int v29; // w1
void *v30; // [xsp+78h] [xbp+78h] BYREF
void *v31; // [xsp+80h] [xbp+80h] BYREF
if ( a1->m_textLabel || a1->m_textArea )
{
v2 = (char *)a1->m_textField->getString(a1->m_textField);
sub_D153B8((int)&v30, v2);
sub_D153B8((int)&v31, &byte_F288A0);
v3 = v30;
v4 = 0;
v5 = v31;
v6 = *((_QWORD *)v30 - 3);
v7 = *((_QWORD *)v31 - 3);
if ( v7 > v6 )
v8 = *((_QWORD *)v30 - 3);
else
v8 = *((_QWORD *)v31 - 3);
if ( !memcmp(v30, v31, v8) )
{
v9 = v6 - v7;
if ( v9 <= 0x7FFFFFFF && v9 >= (__int64)0xFFFFFFFF80000000LL )
v4 = v9 == 0;
}
v10 = (char *)(v5 - 6);
if ( v5 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = v5 - 2;
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(v5 - 2);
*(v5 - 2) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v10);
v3 = v30;
}
v11 = (char *)(v3 - 6);
if ( v3 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = v3 - 2;
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *(v3 - 2);
*(v3 - 2) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v11);
}
m_textLabel = a1->m_textLabel;
if ( m_textLabel )
{
if ( v4 )
{
v13 = m_textLabel->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v14 = a1->m_textLabel;
if ( a1->m_placeholderScale <= 0.0 )
{
m_maxLabelWidth = a1->m_maxLabelWidth;
setScale = v13->setScale;
if ( a1->m_maxLabelScale >= (float)(m_maxLabelWidth / v13->getContentSize(v14)->width) )
{
v19 = a1->m_textLabel;
v20 = a1->m_maxLabelWidth;
v21 = (float *)v19->getContentSize(v19);
setScale(v19, v20 / *v21);
}
else
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *))setScale)(m_textLabel);
}
}
else
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v13->setScale)(v14);
}
a1->m_textLabel->setColor(a1->m_textLabel, &a1->m_placeholderColor);
}
else
{
v17 = a1->m_maxLabelWidth;
v18 = m_textLabel->setScale;
if ( (float)(v17 / m_textLabel->getContentSize(a1->m_textLabel)->width) <= a1->m_maxLabelScale )
{
v22 = a1->m_textLabel;
v23 = a1->m_maxLabelWidth;
v24 = (float *)v22->getContentSize(v22);
v18(v22, v23 / *v24);
}
else
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v18)(m_textLabel);
}
a1->m_textLabel->setColor(a1->m_textLabel, &a1->m_textColor);
}
}
else
{
m_textArea = a1->m_textArea;
if ( m_textArea )
{
if ( v4 )
TextArea::colorAllLabels(m_textArea, (cocos2d::ccColor3B)*(_QWORD *)&a1->m_placeholderColor.r);
else
TextArea::colorAllLabels(m_textArea, (cocos2d::ccColor3B)*(_QWORD *)&a1->m_textColor.r);
}
}
}
}