// // CCTextInputNode::updateCursorPosition from 0x2fb1c8 to 0x2fb4de (790 bytes) // // 1 xrefs: // > CCTextInputNode::ccTouchBegan @ 0x2fb5e8 // // 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::updateCursorPosition(CCTextInputNode *a1, cocos2d::CCPoint a2, cocos2d::CCRect a3) { float x; // r11 char *v5; // r0 int v6; // r4 cocos2d::CCLabelBMFont *m_textLabel; // r4 int v8; // r9 int v9; // r8 int v10; // r0 TextArea *m_textArea; // r3 cocos2d::CCArray *m_lines; // r7 int v13; // r0 float v14; // s17 unsigned int v15; // r3 signed int v16; // r10 cocos2d::CCLabelBMFont *v17; // r8 const cocos2d::CCPoint *v18; // r0 int v19; // r0 float v20; // s15 unsigned int v21; // r3 int v22; // r0 cocos2d::CCArray *v23; // r0 int v24; // r0 int v25; // r0 int v26; // r0 signed int v27; // r7 unsigned int v28; // r6 signed int v29; // r6 cocos2d::CCSprite *v30; // r0 float LetterPosXRight; // s18 float v32; // s16 cocos2d::CCSprite *v33; // r11 float v34; // s17 int v35; // r6 const cocos2d::CCPoint *v36; // r0 cocos2d::CCNode *v37; // r1 float v38; // s16 cocos2d::CCArray *v39; // r10 float v40; // s18 unsigned int v41; // [sp+0h] [bp-34h] int v42; // [sp+0h] [bp-34h] unsigned int v43; // [sp+4h] [bp-30h] cocos2d::CCNode *v44; // [sp+4h] [bp-30h] unsigned int v45; // [sp+Ch] [bp-28h] cocos2d::CCPoint v46; // [sp+1Ch] [bp-18h] BYREF cocos2d::CCPoint v47; // [sp+24h] [bp-10h] BYREF x = a2.x; v5 = (char *)((int (__fastcall *)(cocos2d::CCTextFieldTTF *, _DWORD, _DWORD))a1->m_textField->getString)( a1->m_textField, LODWORD(a2.x), LODWORD(a2.y)); sub_776584((int)&v46, v5); sub_776584((int)&v47, (char *)&unk_939830); v6 = sub_774DBC(&v46, &v47); sub_774008(&v47); sub_774008(&v46); if ( !v6 ) goto LABEL_31; cocos2d::CCPoint::CCPoint(&v46); m_textLabel = a1->m_textLabel; if ( m_textLabel ) { v8 = 0; v9 = 0; v10 = (int)m_textLabel->getPosition(a1->m_textLabel); cocos2d::CCPoint::operator=(&v46, v10); } else { m_textArea = a1->m_textArea; if ( !m_textArea ) return; m_lines = m_textArea->m_label->m_lines; if ( !cocos2d::CCArray::count(m_lines) ) goto LABEL_31; if ( cocos2d::CCArray::count(m_lines) == 1 ) { v8 = 0; v9 = 0; m_textLabel = (cocos2d::CCLabelBMFont *)cocos2d::CCArray::objectAtIndex(m_lines, 0); } else { v13 = cocos2d::CCArray::count(m_lines); v14 = -1.0; v15 = 0; v16 = 0; v8 = v13; while ( 1 ) { v43 = v15; if ( v15 >= cocos2d::CCArray::count(m_lines) ) break; v45 = v43; v17 = (cocos2d::CCLabelBMFont *)cocos2d::CCArray::objectAtIndex(m_lines, v43); v44 = v17->getParent(v17); v18 = v17->getPosition(v17); cocos2d::CCNode::convertToWorldSpace(&v47, v44, v18); v19 = (int)v17->getContentSize(v17); v20 = fabsf( (float)(v47.y + (float)((float)(*(float *)(v19 + 4) * 0.5) * v17->getScale(v17))) - *(float *)(LODWORD(x) + 4)); if ( v20 < v14 ) { v16 = v45; } else if ( v14 < 0.0 ) { v16 = v45; } else { v20 = v14; v17 = m_textLabel; } v15 = v45 + 1; v14 = v20; m_textLabel = v17; } if ( v16 ) { v21 = 0; v9 = 0; do { v41 = v21; v22 = cocos2d::CCArray::objectAtIndex(m_lines, v21); v23 = (cocos2d::CCArray *)(*(int (__fastcall **)(int))(*(_DWORD *)v22 + 236))(v22); v24 = cocos2d::CCArray::count(v23); v21 = v41 + 1; v9 += v24; } while ( (int)(v41 + 1) < v16 ); } else { v9 = 0; } } v25 = (int)m_textLabel->getPosition(m_textLabel); cocos2d::CCPoint::operator=(&v46, v25); } v34 = *(float *)LODWORD(x); v35 = (int)m_textLabel->getParent(m_textLabel); v36 = m_textLabel->getPosition(m_textLabel); v37 = (cocos2d::CCNode *)v35; v28 = 0; v27 = 0; cocos2d::CCNode::convertToWorldSpace(&v47, v37, v36); v38 = v47.x; v39 = m_textLabel->getChildren(m_textLabel); while ( v28 < cocos2d::CCArray::count(v39) ) { v26 = cocos2d::CCArray::objectAtIndex(v39, v28); if ( (*(int (__fastcall **)(int))(*(_DWORD *)v26 + 168))(v26) ) ++v27; ++v28; } if ( !v27 ) goto LABEL_31; v29 = 0; v30 = (cocos2d::CCSprite *)cocos2d::CCArray::objectAtIndex(v39, v27 - 1); LetterPosXRight = cocos2d::CCLabelBMFont::getLetterPosXRight(m_textLabel, v30, 0.0, 0); v42 = 0; v32 = v38 - (float)(LetterPosXRight * m_textLabel->getAnchorPoint(m_textLabel)->x); while ( 1 ) { v33 = (cocos2d::CCSprite *)cocos2d::CCArray::objectAtIndex(v39, v29); if ( ((int (__fastcall *)(cocos2d::CCSprite *))v33->isVisible)(v33) ) break; LABEL_29: if ( ++v29 >= v27 ) goto LABEL_30; } v40 = cocos2d::CCLabelBMFont::getLetterPosXRight(m_textLabel, v33, a1->m_fontValue2, a1->m_isChatFont) + v32; if ( v34 > v40 ) { if ( v29 == v27 - 1 && v8 > 1 ) { a1->m_textField->m_uCursorPos = v27 + v9; CCTextInputNode::updateBlinkLabel(a1); v42 = 1; } goto LABEL_29; } if ( (float)(v40 - v34) < (float)(v34 - (float)(cocos2d::CCLabelBMFont::getLetterPosXLeft( m_textLabel, v33, a1->m_fontValue2, a1->m_isChatFont) + v32)) ) ++v29; if ( v29 < v27 ) { a1->m_textField->m_uCursorPos = v29 + v9; goto LABEL_32; } LABEL_30: if ( v42 ) return; LABEL_31: a1->m_textField->m_uCursorPos = -1; LABEL_32: CCTextInputNode::updateBlinkLabel(a1); }
GD Web Decomp Icon

GD Web Decomp

Raw Source