// // CCTextInputNode::updateCursorPosition from 0x140050dd0 to 0x140051326 (1366 bytes) // // 2 xrefs: // > CCTextInputNode::ccTouchBegan @ 0x140051514 // > @ 0x1406c4d88 // // 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::updateCursorPosition(CCTextInputNode *a1, cocos2d::CCPoint a2, cocos2d::CCRect *a3) { float *v3; // r12 CCTextInputNode *v4; // rsi signed int v5; // edi _BYTE *v6; // rax __m128 v7; // xmm0 size_t v8; // r8 void **v9; // rcx char *v10; // rbx unsigned __int64 v11; // r14 size_t v12; // r15 size_t v13; // r8 __int64 v14; // rbp char *v15; // rax int v16; // r13d struct cocos2d::CCObject *v17; // rbx cocos2d::CCLabelBMFont *m_textLabel; // r14 __int64 v19; // rax TextArea *m_textArea; // rax cocos2d::CCArray *m_lines; // r14 float v22; // xmm7_4 int v23; // r12d unsigned int v24; // ebp struct cocos2d::CCObject *v25; // r15 cocos2d::CCNode *v26; // rax float v27; // xmm6_4 signed int i; // ebx struct cocos2d::CCObject *v29; // rax cocos2d::CCArray *v30; // rax __int64 v31; // rax float v32; // xmm7_4 cocos2d::CCNode *v33; // rax float v34; // xmm8_4 cocos2d::CCArray *v35; // r15 int v36; // ebp unsigned int v37; // ebx struct cocos2d::CCObject *v38; // rax char v39; // al int v40; // ecx float *v41; // rbx struct cocos2d::CCSprite *v42; // rax float v43; // xmm8_4 struct cocos2d::CCSprite *v44; // rbx float v45; // xmm6_4 char v46; // [rsp+20h] [rbp-F8h] int v47; // [rsp+24h] [rbp-F4h] struct cocos2d::CCObject *v49; // [rsp+30h] [rbp-E8h] CCTextInputNode *v50; // [rsp+38h] [rbp-E0h] BYREF cocos2d::CCPoint v51; // [rsp+40h] [rbp-D8h] BYREF struct cocos2d::CCPoint v52; // [rsp+48h] [rbp-D0h] BYREF void *Buf1[2]; // [rsp+50h] [rbp-C8h] BYREF size_t v54; // [rsp+60h] [rbp-B8h] unsigned __int64 v55; // [rsp+68h] [rbp-B0h] __int128 Buf2; // [rsp+70h] [rbp-A8h] BYREF __int64 v57; // [rsp+80h] [rbp-98h] __int64 v58; // [rsp+88h] [rbp-90h] v3 = (float *)a2; v4 = a1; v50 = a1; Buf2 = 0; v5 = 0; v57 = 0; v58 = 15; LOBYTE(Buf2) = 0; v6 = (_BYTE *)((__int64 (__fastcall *)(_QWORD, _QWORD, _QWORD))a1->m_textField->getString)( &a1->m_textField->cocos2d::CCLabelProtocol, a2, a3); v7 = 0; *(_OWORD *)Buf1 = 0; v54 = 0; v55 = 0; v8 = -1; do ++v8; while ( v6[v8] ); sub_14003A930(Buf1, v6, v8); v9 = Buf1; v10 = (char *)Buf1[0]; v11 = v55; if ( v55 > 0xF ) v9 = (void **)Buf1[0]; v12 = v54; v13 = v54; if ( v54 ) v13 = 0; LODWORD(v14) = memcmp(v9, &Buf2, v13); if ( !(_DWORD)v14 ) v14 = v12 != 0; if ( v11 > 0xF ) { v15 = v10; if ( v11 + 1 >= 0x1000 ) { v10 = *((char **)v10 - 1); if ( (unsigned __int64)(v15 - v10 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free(v10); } if ( !(_DWORD)v14 ) goto LABEL_46; v16 = 0; v47 = 0; v17 = nullptr; v49 = nullptr; cocos2d::CCPoint::CCPoint(&v51); m_textLabel = v4->m_textLabel; if ( m_textLabel ) { v19 = (__int64)m_textLabel->getPosition_0(v4->m_textLabel); cocos2d::CCPoint::operator=(&v51, v19); LABEL_33: v32 = *v3; m_textLabel->getPosition_0(m_textLabel); v33 = m_textLabel->getParent(m_textLabel); cocos2d::CCNode::convertToWorldSpace(v33, (const struct cocos2d::CCPoint *)&v50); v34 = *(float *)&v50; v46 = 0; v35 = m_textLabel->getChildren(m_textLabel); v36 = 0; v37 = 0; if ( !cocos2d::CCArray::count(v35) ) goto LABEL_46; do { v38 = cocos2d::CCArray::objectAtIndex(v35, v37); v39 = ((__int64 (__fastcall *)(struct cocos2d::CCObject *))v38->__vftable[4].encodeWithCoder)(v38); v40 = v36 + 1; if ( !v39 ) v40 = v36; v36 = v40; ++v37; } while ( v37 < cocos2d::CCArray::count(v35) ); if ( v36 <= 0 ) goto LABEL_46; v41 = (float *)m_textLabel->getAnchorPoint(m_textLabel); v42 = (struct cocos2d::CCSprite *)cocos2d::CCArray::objectAtIndex(v35, v36 - 1); v43 = v34 - (float)(cocos2d::CCLabelBMFont::getLetterPosXRight(m_textLabel, v42, 0.0, 0) * *v41); while ( 1 ) { v44 = (struct cocos2d::CCSprite *)cocos2d::CCArray::objectAtIndex(v35, v5); if ( v44->isVisible(v44) ) { v45 = cocos2d::CCLabelBMFont::getLetterPosXRight(m_textLabel, v44, v4->m_fontValue2, v4->m_isChatFont) + v43; if ( v45 >= v32 ) { if ( (float)(v32 - (float)(cocos2d::CCLabelBMFont::getLetterPosXLeft( m_textLabel, v44, v4->m_fontValue2, v4->m_isChatFont) + v43)) > (float)(v45 - v32) ) ++v5; if ( v5 < v36 ) { v4->m_textField->m_uCursorPos = v5 + v16; goto LABEL_47; } LABEL_45: if ( v46 ) return; LABEL_46: v4->m_textField->m_uCursorPos = -1; LABEL_47: CCTextInputNode::updateBlinkLabelToChar(v4, v4->m_textField->m_uCursorPos); return; } if ( v5 == v36 - 1 && v47 > 1 ) { v4->m_textField->m_uCursorPos = v5 + v16 + 1; CCTextInputNode::updateBlinkLabelToChar(v4, v4->m_textField->m_uCursorPos); v46 = 1; } } if ( ++v5 >= v36 ) goto LABEL_45; } } m_textArea = v4->m_textArea; if ( m_textArea ) { m_lines = m_textArea->m_label->m_lines; if ( !cocos2d::CCArray::count(m_lines) ) goto LABEL_46; if ( cocos2d::CCArray::count(m_lines) == 1 ) { v17 = cocos2d::CCArray::objectAtIndex(m_lines, 0); } else { v22 = -1.0; v23 = 0; v47 = cocos2d::CCArray::count(m_lines); v24 = 0; if ( cocos2d::CCArray::count(m_lines) ) { do { v25 = cocos2d::CCArray::objectAtIndex(m_lines, v24); v25->__vftable[2].getTag(v25); v26 = (cocos2d::CCNode *)((__int64 (__fastcall *)(struct cocos2d::CCObject *))v25->__vftable[6].getTag)(v25); cocos2d::CCNode::convertToWorldSpace(v26, &v52); v27 = *(float *)(((__int64 (__fastcall *)(struct cocos2d::CCObject *))v25->__vftable[4].isEqual)(v25) + 4); *(double *)v7.m128_u64 = ((double (__fastcall *)(struct cocos2d::CCObject *))v25->__vftable[2].acceptVisitor)(v25); v7.m128_f32[0] = (float)((float)(v7.m128_f32[0] * (float)(v27 * 0.5)) + v52.y) - *(float *)(*(_QWORD *)&a2 + 4LL); v7 = _mm_and_ps(v7, (__m128)0x7FFFFFFFu); if ( v22 <= v7.m128_f32[0] && v22 >= 0.0 ) { v17 = v49; } else { v22 = v7.m128_f32[0]; v17 = v25; v49 = v25; v23 = v24; } ++v24; } while ( v24 < cocos2d::CCArray::count(m_lines) ); v4 = v50; if ( v23 > 0 ) { for ( i = 0; i < v23; ++i ) { v29 = cocos2d::CCArray::objectAtIndex(m_lines, i); v30 = (cocos2d::CCArray *)((__int64 (__fastcall *)(struct cocos2d::CCObject *))v29->__vftable[6].update)(v29); v16 += cocos2d::CCArray::count(v30); } v17 = v49; } } v3 = (float *)a2; } m_textLabel = (cocos2d::CCLabelBMFont *)v17; v31 = ((__int64 (__fastcall *)(struct cocos2d::CCObject *))v17->__vftable[2].getTag)(v17); cocos2d::CCPoint::operator=(&v51, v31); if ( v17 ) goto LABEL_33; } }