//
// CCTextInputNode::updateBlinkLabelToChar from 0x5a2f34 to 0x5a33f4 (1216 bytes)
//
// 2 xrefs:
// > CCTextInputNode::updateBlinkLabel @ 0x5a33fc
// > ??> @ 0xac128
//
// 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::updateBlinkLabelToChar(CCTextInputNode *a1, int a2)
{
cocos2d::CCLabelBMFont *m_textLabel; // x19
unsigned int v4; // w21
float v5; // s11
cocos2d::CCArray *v6; // x0
cocos2d::CCArray *v7; // x25
cocos2d::CCSprite *v8; // x0
float LetterPosXLeft; // s8
float m_fontValue1; // s10
float v11; // s10
float width; // s10
float v13; // s9
float v14; // s0
char *v15; // x0
_DWORD *v16; // x26
_DWORD *v17; // x27
unsigned __int64 v18; // x25
unsigned __int64 v19; // x28
size_t v20; // x2
int v21; // w21
__int64 v22; // x25
char *v23; // x0
char *v24; // x0
cocos2d::CCLabelBMFont *m_cursor; // x21
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
__int64 v27; // x26
float v28; // s9
float v29; // s8
float v30; // s13
float v31; // s9
float v32; // s0
cocos2d::CCLabelBMFont *v33; // x20
cocos2d::CCLabelBMFont *v34; // x0
const cocos2d::CCPoint *(__fastcall *getAnchorPoint)(cocos2d::CCNode *__hidden); // x1
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x19
__int64 v37; // x0
unsigned int *v38; // x26
int v39; // w1
TextArea *m_textArea; // x0
unsigned int v41; // w22
cocos2d::CCArray *m_lines; // x24
cocos2d::CCArray *v43; // x0
signed int v44; // w0
cocos2d::CCNode *v45; // x25
const cocos2d::CCPoint *v46; // x0
cocos2d::CCNode *v47; // x0
unsigned int *v48; // x27
int v49; // w1
float v50; // s0
void *v51; // [xsp+A8h] [xbp+A8h] BYREF
void *v52; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::CCPoint v53; // 0:kr00_8.8
m_textLabel = a1->m_textLabel;
v4 = a2;
if ( m_textLabel )
{
if ( !a1->m_cursor )
return;
v5 = 0.0;
LABEL_4:
v6 = m_textLabel->getChildren(m_textLabel);
v7 = v6;
if ( (v4 & 0x80000000) != 0 || (unsigned int)cocos2d::CCArray::count(v6) <= v4 )
{
width = m_textLabel->getContentSize(m_textLabel)->width;
v13 = m_textLabel->getScale(m_textLabel);
v14 = m_textLabel->getScaleX(m_textLabel);
v11 = (float)(v14 + v14) + (float)(width * v13);
}
else
{
v8 = (cocos2d::CCSprite *)cocos2d::CCArray::objectAtIndex(v7, v4);
LetterPosXLeft = cocos2d::CCLabelBMFont::getLetterPosXLeft(m_textLabel, v8, a1->m_fontValue2, a1->m_isChatFont);
m_fontValue1 = a1->m_fontValue1;
v11 = LetterPosXLeft + (float)(m_fontValue1 * m_textLabel->getScaleX(m_textLabel));
}
v15 = (char *)a1->m_textField->getString(a1->m_textField);
sub_D153B8((int)&v51, v15);
sub_D153B8((int)&v52, &byte_F288A0);
v16 = v51;
v17 = v52;
v18 = *((_QWORD *)v51 - 3);
v19 = *((_QWORD *)v52 - 3);
if ( v19 > v18 )
v20 = *((_QWORD *)v51 - 3);
else
v20 = *((_QWORD *)v52 - 3);
v21 = memcmp(v51, v52, v20);
if ( !v21 )
{
v21 = 0x7FFFFFFF;
v22 = v18 - v19;
if ( v22 <= 0x7FFFFFFF )
{
if ( v22 >= (__int64)0xFFFFFFFF80000000LL )
v21 = v22;
else
v21 = 0x80000000;
}
}
v23 = (char *)(v17 - 6);
if ( v17 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = v17 - 2;
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *(v17 - 2);
*(v17 - 2) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v23);
v16 = v51;
}
v24 = (char *)(v16 - 6);
if ( v16 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_15;
if ( &pthread_create )
{
v38 = v16 - 2;
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *(v16 - 2);
*(v16 - 2) = v39 - 1;
}
if ( v39 > 0 )
{
LABEL_15:
if ( v21 )
{
LABEL_16:
m_cursor = a1->m_cursor;
setPosition = m_cursor->setPosition;
v27 = (__int64)m_textLabel->getPosition(m_textLabel);
v28 = m_textLabel->getContentSize(m_textLabel)->width;
v29 = v28 * (float)(1.0 - m_textLabel->getAnchorPoint(m_textLabel)->x);
v30 = m_textLabel->getScale(m_textLabel);
v31 = m_textLabel->getContentSize(m_textLabel)->width;
v32 = m_textLabel->getScale(m_textLabel);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v51,
v11 - (float)((float)(v31 * v32) - (float)(v29 * v30)),
v5 - 1.0);
cocos2d::CCPoint::operator+(&v52, v27, &v51);
setPosition(m_cursor, (const cocos2d::CCPoint *)&v52);
v33 = a1->m_cursor;
v34 = m_textLabel;
getAnchorPoint = m_textLabel->getAnchorPoint;
setAnchorPoint = v33->setAnchorPoint;
v37 = (__int64)getAnchorPoint(v34);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, 0.5, *(float *)(v37 + 4));
setAnchorPoint(v33, (const cocos2d::CCPoint *)&v52);
return;
}
}
else
{
operator delete(v24);
if ( v21 )
goto LABEL_16;
}
v11 = 2.0;
goto LABEL_16;
}
m_textArea = a1->m_textArea;
if ( m_textArea && a1->m_cursor )
{
if ( (a2 & 0x80000000) == 0 )
{
v41 = 0;
m_lines = m_textArea->m_label->m_lines;
while ( v41 < (unsigned int)cocos2d::CCArray::count(m_lines) )
{
m_textLabel = (cocos2d::CCLabelBMFont *)cocos2d::CCArray::objectAtIndex(m_lines, v41);
v43 = m_textLabel->getChildren(m_textLabel);
v44 = cocos2d::CCArray::count(v43);
if ( (int)v4 <= v44 )
goto LABEL_37;
v4 -= v44;
++v41;
}
m_textArea = a1->m_textArea;
}
m_textLabel = (cocos2d::CCLabelBMFont *)cocos2d::CCArray::lastObject(m_textArea->m_label->m_lines);
v4 = -1;
a1->m_textField->m_uCursorPos = -1;
LABEL_37:
v45 = m_textLabel->getParent(m_textLabel);
v46 = m_textLabel->getPosition(m_textLabel);
v53 = cocos2d::CCNode::convertToWorldSpace(v45, v46);
v47 = (cocos2d::CCNode *)((__int64 (__fastcall *)(TextArea *, float, float))a1->m_textArea->getParent)(
a1->m_textArea,
v53.x,
v53.y);
LODWORD(v50) = COERCE_UNSIGNED_INT(cocos2d::CCNode::convertToWorldSpace(v47, &stru_1241B38).x);
v5 = (float)(*((float *)&v51 + 1) - *((float *)&v52 + 1))
- *(float *)(((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, float))m_textLabel->getPosition)(
m_textLabel,
v50)
+ 4);
goto LABEL_4;
}
}