// // CCTextInputNode::updateCursorPosition from 0x1000a07a0 to 0x1000a0dc1 (1569 bytes) // // 1 xrefs: // > CCTextInputNode::ccTouchBegan @ 0x1000a0f71 // // 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 __fastcall CCTextInputNode::updateCursorPosition(CCTextInputNode *a1, cocos2d::CCPoint a2, cocos2d::CCRect a3) { __int64 v3; // rsi CCTextInputNode *v4; // r13 const char *v5; // r15 size_t v6; // rax size_t v7; // r14 char *v8; // r12 size_t v9; // r13 cocos2d::CCLabelBMFont *m_textLabel; // r14 __int64 v11; // rsi const cocos2d::CCPoint *v12; // rbx cocos2d::CCLabelBMFont_vtbl *v13; // rax __int64 v14; // r15 unsigned int v15; // r12d unsigned int v16; // r14d unsigned int v17; // ebx __int64 v18; // rax int v19; // r13d unsigned int v20; // r12d cocos2d::CCSprite *v21; // rsi float *v22; // rax cocos2d::CCSprite *v23; // r13 float v24; // xmm0_4 float v25; // xmm0_4 CCTextInputNode *v26; // rdi int v27; // esi __int64 v28; // rax size_t v29; // rbx TextArea *m_textArea; // rax cocos2d::CCArray *m_lines; // rbx int v32; // r15d int v33; // ebx float v34; // xmm0_4 float v35; // xmm0_4 CCTextInputNode *v36; // rdi __m128 v37; // xmm0 unsigned int v38; // r12d unsigned int v39; // eax cocos2d::CCArray *v40; // r13 __int64 v41; // r15 const cocos2d::CCPoint *v42; // rbx __int64 v43; // rax __m128 v44; // xmm0 __m128 v45; // xmm0 bool v46; // zf unsigned int v47; // eax int v48; // r13d cocos2d::CCArray *v49; // r12 unsigned int v50; // r15d __int64 v51; // rax __int64 v52; // rax float LetterPosXLeft; // xmm0_4 unsigned int v54; // esi int v55; // esi int v56; // eax size_t __dst; // [rsp+0h] [rbp-90h] BYREF size_t v58; // [rsp+8h] [rbp-88h] void *__p; // [rsp+10h] [rbp-80h] _DWORD v60[2]; // [rsp+18h] [rbp-78h] BYREF __m128 v61; // [rsp+20h] [rbp-70h] cocos2d::CCArray *v62; // [rsp+38h] [rbp-58h] CCTextInputNode *v63; // [rsp+40h] [rbp-50h] __int64 v64; // [rsp+48h] [rbp-48h] __int64 v65; // [rsp+50h] [rbp-40h] cocos2d::CCLabelBMFont *v66; // [rsp+58h] [rbp-38h] float LetterPosXRight; // [rsp+64h] [rbp-2Ch] double v68; // 0:xmm0_8.8 v64 = v3; v4 = a1; v5 = (const char *)((__int64 (__fastcall *)(cocos2d::CCTextFieldTTF *, double, double, double))a1->m_textField->getString)( a1->m_textField, *(double *)&a2, *(double *)&a3.origin, *(double *)&a3.size); v6 = strlen(v5); if ( v6 >= 0xFFFFFFFFFFFFFFF8LL ) sub_100006BF0(*(double *)&a2); v7 = v6; v63 = a1; if ( v6 >= 0x17 ) { v9 = 26; if ( (v6 | 7) != 0x17 ) v9 = (v6 | 7) + 1; v8 = (char *)operator new(v9); __p = v8; __dst = v9 + 1; v4 = v63; v58 = v7; goto LABEL_8; } LOBYTE(__dst) = 2 * v6; v8 = (char *)&__dst + 1; if ( v6 ) LABEL_8: memmove(v8, v5, v7); v8[v7] = 0; if ( (__dst & 1) == 0 ) { if ( (unsigned __int8)__dst >> 1 ) goto LABEL_11; LABEL_25: v4->m_textField->m_uCursorPos = -1; CCTextInputNode::updateBlinkLabelToChar(v4, -1); return; } v29 = v58; operator delete(__p); if ( !v29 ) goto LABEL_25; LABEL_11: sub_10028CC30(&__dst); m_textLabel = v4->m_textLabel; if ( m_textLabel ) { v11 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))m_textLabel->getPosition)(v4->m_textLabel); sub_10028CC90(); LODWORD(v65) = 0; v62 = nullptr; LABEL_13: v61.i32[0] = *(_DWORD *)v64; v12 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))m_textLabel->getParent)( m_textLabel, v11); ((void (__fastcall *)(cocos2d::CCLabelBMFont *))m_textLabel->getPosition)(m_textLabel); cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v60, v12); LODWORD(v64) = v60[0]; v13 = m_textLabel->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable; v66 = m_textLabel; v14 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v13->getChildren)(m_textLabel); if ( !(unsigned int)sub_100720070(v14) ) goto LABEL_52; v15 = 0; v16 = 0; do { v17 = v16; v18 = sub_1007200C0(v14, v15); v19 = (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v18 + 336LL))(v18); v16 += v19; ++v15; } while ( v15 < (unsigned int)sub_100720070(v14) ); if ( !v16 ) goto LABEL_52; v20 = 0; v21 = (cocos2d::CCSprite *)sub_1007200C0(v14, v16 - 1); LetterPosXRight = cocos2d::CCLabelBMFont::getLetterPosXRight(v66, v21, 0.0, 0); v22 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v66->getAnchorPoint)(v66); *(float *)&v64 = *(float *)&v64 - (float)(LetterPosXRight * *v22); if ( !(_BYTE)v65 ) { v33 = v19 + v17; do { v23 = (cocos2d::CCSprite *)sub_1007200C0(v14, v20); if ( ((unsigned __int8 (__fastcall *)(cocos2d::CCSprite *))v23->isVisible)(v23) ) { v34 = cocos2d::CCLabelBMFont::getLetterPosXRight(v66, v23, v63->m_fontValue2, v63->m_isChatFont); v35 = v34 + *(float *)&v64; if ( v35 >= v61.f32[0] ) { LetterPosXRight = v35; v65 = 0; goto LABEL_49; } } ++v20; } while ( v33 != v20 ); goto LABEL_52; } LODWORD(LetterPosXRight) = v16 + (_DWORD)v62; v20 = 0; v65 = 0; while ( 1 ) { v23 = (cocos2d::CCSprite *)sub_1007200C0(v14, v20); if ( ((unsigned __int8 (__fastcall *)(cocos2d::CCSprite *))v23->isVisible)(v23) ) { v24 = cocos2d::CCLabelBMFont::getLetterPosXRight(v66, v23, v63->m_fontValue2, v63->m_isChatFont); v25 = v24 + *(float *)&v64; if ( v25 >= v61.f32[0] ) { LetterPosXRight = v25; LABEL_49: LetterPosXLeft = cocos2d::CCLabelBMFont::getLetterPosXLeft(v66, v23, v63->m_fontValue2, v63->m_isChatFont); v54 = v20 + ((float)(v61.f32[0] - (float)(*(float *)&v64 + LetterPosXLeft)) > (float)(LetterPosXRight - v61.f32[0])); if ( v54 < v16 ) { v55 = (_DWORD)v62 + v54; v36 = v63; v63->m_textField->m_uCursorPos = v55; goto LABEL_54; } LABEL_51: if ( (v65 & 1) == 0 ) { LABEL_52: v36 = v63; v63->m_textField->m_uCursorPos = -1; goto LABEL_53; } return; } if ( v20 - v16 == -1 ) { v26 = v63; v27 = LODWORD(LetterPosXRight); *(float *)&v63->m_textField->m_uCursorPos = LetterPosXRight; CCTextInputNode::updateBlinkLabelToChar(v26, v27); LOBYTE(v28) = 1; v65 = v28; } } if ( ++v20 == v16 ) goto LABEL_51; } } m_textArea = v4->m_textArea; if ( !m_textArea ) return; m_lines = m_textArea->m_label->m_lines; if ( (unsigned int)sub_100720070(m_lines) ) { if ( (unsigned int)sub_100720070(m_lines) == 1 ) { v32 = 0; m_textLabel = (cocos2d::CCLabelBMFont *)sub_1007200C0(m_lines, 0); m_lines = nullptr; } else { LODWORD(LetterPosXRight) = sub_100720070(m_lines); sub_100720070(m_lines); m_textLabel = nullptr; v37 = (__m128)0xBF800000; LODWORD(v66) = 0; v38 = 0; do { v61 = v37; v40 = m_lines; v41 = sub_1007200C0(m_lines, v38); v42 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v41 + 496LL))(v41); (*(void (__fastcall **)(__int64))(*(_QWORD *)v41 + 192LL))(v41); *(cocos2d::CCPoint *)&v68 = cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v60, v42); v43 = (*(__int64 (__fastcall **)(__int64, double))(*(_QWORD *)v41 + 312LL))(v41, v68); LODWORD(v65) = v60[1]; v44 = (__m128)*(unsigned int *)(v43 + 4); *(float *)&v62 = v44.f32[0] * 0.5; *(double *)v44.i64 = (*(double (__fastcall **)(__int64))(*(_QWORD *)v41 + 168LL))(v41); v44.f32[0] = (float)((float)(v44.f32[0] * *(float *)&v62) + *(float *)&v65) - *(float *)(v64 + 4); v45 = _mm_and_ps(v44, (__m128)xmmword_100815500); v46 = (_mm_cvtsi128_si32((__m128i)_mm_or_ps(_mm_cmplt_ps(v61, (__m128)0LL), _mm_cmplt_ps(v45, v61))) & 1) == 0; v47 = (unsigned int)v66; if ( !v46 ) v47 = v38; LODWORD(v66) = v47; if ( v46 ) v45 = v61; v61 = v45; if ( !v46 ) m_textLabel = (cocos2d::CCLabelBMFont *)v41; ++v38; m_lines = v40; v39 = sub_100720070(v40); v37 = v61; } while ( v38 < v39 ); v48 = (int)v66; if ( (int)v66 <= 0 ) { m_lines = nullptr; } else { v49 = m_lines; LODWORD(m_lines) = 0; v50 = 0; do { v51 = sub_1007200C0(v49, v50); v52 = (*(__int64 (__fastcall **)(__int64, double))(*(_QWORD *)v51 + 472LL))(v51, *(double *)v37.i64); m_lines = (cocos2d::CCArray *)((unsigned int)sub_100720070(v52) + (unsigned int)m_lines); ++v50; } while ( v48 != v50 ); } v32 = LODWORD(LetterPosXRight); } v62 = m_lines; v11 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))m_textLabel->getPosition)(m_textLabel); sub_10028CC90(); LOBYTE(v56) = v32 >= 2; LODWORD(v65) = v56; goto LABEL_13; } v4->m_textField->m_uCursorPos = -1; v36 = v4; LABEL_53: v55 = -1; LABEL_54: CCTextInputNode::updateBlinkLabelToChar(v36, v55); }