//
// CCTextInputNode::updateBlinkLabelToChar from 0x2fa614 to 0x2fa8a6 (658 bytes)
//
// 1 xrefs:
// > CCTextInputNode::updateBlinkLabel @ 0x2fa8c0
//
// 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)
{
signed int v3; // r6
cocos2d::CCLabelBMFont *m_textLabel; // r4
cocos2d::CCLabelBMFont *v5; // r7
cocos2d::CCArray *m_lines; // r9
cocos2d::CCArray *v7; // r0
signed int v8; // r0
cocos2d::CCLabelBMFont *Object; // r0
cocos2d::CCNode *v10; // r7
const cocos2d::CCPoint *v11; // r0
float y; // s16
cocos2d::CCNode *v13; // r0
float v14; // s18
float v15; // s19
cocos2d::CCArray *v16; // r0
cocos2d::CCArray *v17; // r7
cocos2d::CCSprite *v18; // r0
float LetterPosXLeft; // r0
float m_fontValue1; // s17
float v21; // s16
char *v22; // r0
int v23; // r9
bool v24; // zf
cocos2d::CCLabelBMFont *m_cursor; // r9
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
int v27; // r11
float v28; // s18
float x; // s17
float v30; // s17
float v31; // s18
float v32; // r0
cocos2d::CCLabelBMFont *v33; // r5
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r7
int v35; // r0
float width; // s16
float v37; // s16
float v38; // r0
cocos2d::CCPoint v39; // [sp+Ch] [bp-18h] BYREF
cocos2d::CCPoint v40; // [sp+14h] [bp-10h] BYREF
v3 = a2;
m_textLabel = a1->m_textLabel;
if ( (m_textLabel || a1->m_textArea) && a1->m_cursor )
{
if ( m_textLabel )
{
v15 = 0.0;
}
else
{
if ( a2 >= 0 )
{
v5 = a1->m_textLabel;
m_lines = a1->m_textArea->m_label->m_lines;
while ( (unsigned int)v5 < cocos2d::CCArray::count(m_lines) )
{
m_textLabel = (cocos2d::CCLabelBMFont *)cocos2d::CCArray::objectAtIndex(m_lines, (unsigned int)v5);
v7 = m_textLabel->getChildren(m_textLabel);
v8 = cocos2d::CCArray::count(v7);
if ( v3 <= v8 )
goto LABEL_11;
v3 -= v8;
v5 = (cocos2d::CCLabelBMFont *)((char *)v5 + 1);
}
}
v3 = -1;
Object = (cocos2d::CCLabelBMFont *)cocos2d::CCArray::lastObject(a1->m_textArea->m_label->m_lines);
a1->m_textField->m_uCursorPos = -1;
m_textLabel = Object;
LABEL_11:
v10 = m_textLabel->getParent(m_textLabel);
v11 = m_textLabel->getPosition(m_textLabel);
cocos2d::CCNode::convertToWorldSpace(&v39, v10, v11);
y = v39.y;
v13 = a1->m_textArea->getParent(a1->m_textArea);
cocos2d::CCNode::convertToWorldSpace(&v40, v13, &stru_AC57E4);
v14 = v40.y;
v15 = (float)(y - v14) - m_textLabel->getPosition(m_textLabel)->y;
}
v16 = m_textLabel->getChildren(m_textLabel);
v17 = v16;
if ( v3 < 0 || cocos2d::CCArray::count(v16) <= (unsigned int)v3 )
{
width = m_textLabel->getContentSize(m_textLabel)->width;
v37 = width * COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCLabelBMFont *))m_textLabel->getScale)(m_textLabel));
v38 = m_textLabel->getScaleX(m_textLabel);
v21 = v37 + (float)(v38 + v38);
}
else
{
v18 = (cocos2d::CCSprite *)cocos2d::CCArray::objectAtIndex(v17, v3);
LetterPosXLeft = cocos2d::CCLabelBMFont::getLetterPosXLeft(m_textLabel, v18, a1->m_fontValue2, a1->m_isChatFont);
m_fontValue1 = a1->m_fontValue1;
v21 = LetterPosXLeft + (float)(m_fontValue1 * m_textLabel->getScaleX(m_textLabel));
}
v22 = (char *)a1->m_textField->getString(a1->m_textField);
sub_776584((int)&v39, v22);
sub_776584((int)&v40, (char *)&unk_939830);
v23 = sub_774DBC(&v39, &v40);
sub_774008(&v40);
sub_774008(&v39);
v24 = v23 == 0;
m_cursor = a1->m_cursor;
setPosition = m_cursor->setPosition;
if ( v24 )
v21 = 2.0;
v27 = (int)m_textLabel->getPosition(m_textLabel);
v28 = m_textLabel->getContentSize(m_textLabel)->width;
x = m_textLabel->getAnchorPoint(m_textLabel)->x;
v30 = (float)(v28 * (float)(1.0 - x))
* COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCLabelBMFont *))m_textLabel->getScale)(m_textLabel));
v31 = m_textLabel->getContentSize(m_textLabel)->width;
v32 = m_textLabel->getScale(m_textLabel);
cocos2d::CCPoint::CCPoint(&v39, (float)(v30 - (float)(v31 * v32)) + v21, v15 - 1.0);
cocos2d::CCPoint::operator+(&v40, v27, &v39);
setPosition(m_cursor, &v40);
v33 = a1->m_cursor;
setAnchorPoint = v33->setAnchorPoint;
v35 = (int)m_textLabel->getAnchorPoint(m_textLabel);
cocos2d::CCPoint::CCPoint(&v40, 0.5, *(float *)(v35 + 4));
setAnchorPoint(v33, &v40);
}
}