//
// CCTextInputNode::updateBlinkLabelToChar from 0x14004fe90 to 0x140050279 (1001 bytes)
//
// 7 xrefs:
// > CCTextInputNode::updateLabel @ 0x14004fb72
// > CCTextInputNode::onTextFieldInsertText @ 0x1400508ad
// > CCTextInputNode::onTextFieldAttachWithIME @ 0x140050ad5
// > CCTextInputNode::updateCursorPosition @ 0x14005124d
// > CCTextInputNode::updateCursorPosition @ 0x140051289
// > ??> @ 0x1406c4cec
// > ??> @ 0x1406c4cf8
//
// 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=1
void CCTextInputNode::updateBlinkLabelToChar(CCTextInputNode *a1, int a2)
{
signed int v2; // esi
cocos2d::CCLabelBMFont *m_textLabel; // rdi
float v5; // xmm11_4
size_t v6; // rbp
cocos2d::CCArray *m_lines; // r15
unsigned int v8; // ebx
cocos2d::CCArray *v9; // rax
signed int v10; // eax
cocos2d::CCNode *v11; // rax
struct cocos2d::CCPoint v12; // rbx
cocos2d::CCNode *v13; // rax
float v14; // xmm11_4
cocos2d::CCArray *v15; // rax
cocos2d::CCArray *v16; // rbx
struct cocos2d::CCSprite *v17; // rax
float LetterPosXLeft; // xmm0_4
float v19; // xmm10_4
float width; // xmm6_4
double v21; // xmm0_8
float v22; // xmm7_4
double v23; // xmm0_8
const char *v24; // rax
int v25; // ebx
float x; // xmm7_4
float v27; // xmm6_4
double v28; // xmm0_8
float *v29; // rbx
float v30; // xmm9_4
__int64 v31; // rax
cocos2d::CCLabelBMFont_vtbl *v32; // rbx
__int64 v33; // rax
const cocos2d::CCPoint *v34; // rax
struct cocos2d::CCPoint v35; // [rsp+20h] [rbp-D8h] BYREF
cocos2d::CCPoint v36; // [rsp+28h] [rbp-D0h] BYREF
__int128 Buf2; // [rsp+30h] [rbp-C8h] BYREF
__int64 v38; // [rsp+40h] [rbp-B8h]
__int64 v39; // [rsp+48h] [rbp-B0h]
_OWORD Buf1[2]; // [rsp+50h] [rbp-A8h] BYREF
v2 = a2;
m_textLabel = a1->m_textLabel;
if ( (m_textLabel || a1->m_textArea) && a1->m_cursor )
{
v5 = 0.0;
v6 = -1;
if ( !m_textLabel )
{
if ( a2 >= 0 && (m_lines = a1->m_textArea->m_label->m_lines, v8 = 0, cocos2d::CCArray::count(m_lines)) )
{
while ( 1 )
{
m_textLabel = (cocos2d::CCLabelBMFont *)cocos2d::CCArray::objectAtIndex(m_lines, v8);
v9 = m_textLabel->getChildren(m_textLabel);
v10 = cocos2d::CCArray::count(v9);
if ( v2 <= v10 )
break;
v2 -= v10;
if ( ++v8 >= cocos2d::CCArray::count(m_lines) )
goto LABEL_9;
}
}
else
{
LABEL_9:
m_textLabel = (cocos2d::CCLabelBMFont *)cocos2d::CCArray::lastObject(a1->m_textArea->m_label->m_lines);
v2 = -1;
a1->m_textField->m_uCursorPos = -1;
}
m_textLabel->getPosition_0(m_textLabel);
v11 = m_textLabel->getParent(m_textLabel);
v12 = cocos2d::CCNode::convertToWorldSpace(v11, &v35);
v13 = a1->m_textArea->getParent(a1->m_textArea);
v14 = *(float *)(*(_QWORD *)&v12 + 4LL)
- *(float *)(*(_QWORD *)&cocos2d::CCNode::convertToWorldSpace(v13, &v36) + 4LL);
v5 = v14 - m_textLabel->getPosition_0(m_textLabel)->y;
}
v15 = m_textLabel->getChildren(m_textLabel);
v16 = v15;
if ( v2 < 0 || cocos2d::CCArray::count(v15) <= v2 )
{
width = m_textLabel->getContentSize(m_textLabel)->width;
v21 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))m_textLabel->getScale)(m_textLabel);
v22 = *(float *)&v21 * width;
v23 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))m_textLabel->getScaleX)(m_textLabel);
v19 = (float)(*(float *)&v23 + *(float *)&v23) + v22;
}
else
{
v17 = (struct cocos2d::CCSprite *)cocos2d::CCArray::objectAtIndex(v16, v2);
LetterPosXLeft = cocos2d::CCLabelBMFont::getLetterPosXLeft(m_textLabel, v17, a1->m_fontValue2, a1->m_isChatFont);
v19 = LetterPosXLeft + (float)(m_textLabel->getScaleX(m_textLabel) * a1->m_fontValue1);
}
Buf2 = 0;
v38 = 0;
v39 = 15;
LOBYTE(Buf2) = 0;
v24 = a1->m_textField->getString(&a1->m_textField->cocos2d::CCLabelProtocol);
memset(Buf1, 0, sizeof(Buf1));
do
++v6;
while ( v24[v6] );
sub_14003A930(Buf1, v24, v6);
v25 = sub_14003A760(Buf1, &Buf2);
sub_14003A830((__int64)Buf1);
sub_14003A830((__int64)&Buf2);
if ( !v25 )
v19 = 2.0;
x = m_textLabel->getAnchorPoint(m_textLabel)->x;
v27 = m_textLabel->getContentSize(m_textLabel)->width;
v28 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))m_textLabel->getScale)(m_textLabel);
v29 = (float *)m_textLabel->getContentSize(m_textLabel);
v30 = (float)((float)(*(float *)&v28 * (float)((float)(1.0 - x) * v27))
- (float)(m_textLabel->getScale(m_textLabel) * *v29))
+ v19;
cocos2d::CCPoint::CCPoint(&v36, v30, v5 - 1.0);
v31 = (__int64)m_textLabel->getPosition_0(m_textLabel);
cocos2d::CCPoint::operator+(v31, &v35);
a1->m_cursor->setPosition_0(a1->m_cursor, &v35);
v32 = a1->m_cursor->__vftable;
v33 = (__int64)m_textLabel->getAnchorPoint(m_textLabel);
cocos2d::CCPoint::CCPoint(&v36, 0.5, *(float *)(v33 + 4));
v32->setAnchorPoint(a1->m_cursor, v34);
}
}