//
// CCTextInputNode::ccTouchBegan from 0x10016e770 to 0x10016e900 (400 bytes)
//
// 2 xrefs:
// > sub_10016E900 @ 0x10016e904
// > ??> @ 0x10079f960
//
// 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
//
bool __fastcall CCTextInputNode::ccTouchBegan(CCTextInputNode *a1, cocos2d::CCTouch *a2, cocos2d::CCEvent *a3)
{
cocos2d::CCDirector *v4; // x0
double v5; // d0
__int64 *v6; // x0
double v7; // d0
__n128 v8; // q0
__n128 v9; // q1
__int64 v10; // x0
__int64 *v11; // x0
TextInputDelegate *m_delegate; // x0
bool v13; // w20
double v14; // d0
float v16; // s1
float32x2_t v17[2]; // [xsp+8h] [xbp-48h] BYREF
__int64 v18; // [xsp+18h] [xbp-38h] BYREF
float32x2_t v19; // [xsp+20h] [xbp-30h] BYREF
float32x2_t v20[2]; // [xsp+28h] [xbp-28h] BYREF
cocos2d::CCPoint v21; // [xsp+38h] [xbp-18h] BYREF
cocos2d::CCPoint v22; // 0:kr20_8.8
cocos2d::CCRect v23; // 0:s2.4,4:s3.4,8:s4.4,12:s5.4
cocos2d::CCTouch::getLocationInView(a2);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::convertToGL(v4, &v21);
sub_1000229D0(&v21, (double *)v20);
cocos2d::CCNode::convertToWorldSpace(a1, &v21);
sub_1000229D0(&v21, (double *)v20);
cocos2d::CCNode::convertToNodeSpace(a1, &v21);
v5 = sub_1000229D0(&v21, (double *)v20);
v6 = (__int64 *)((__int64 (__fastcall *)(cocos2d::CCTextFieldTTF *, double))a1->m_textField->getAnchorPoint)(
a1->m_textField,
v5);
sub_1000229B8((__int64 *)v17, v6);
v7 = sub_10016D5C8((__int64)a1, v17, v20);
if ( ((__int64 (__fastcall *)(CCTextInputNode *, double))a1->getParent)(a1, v7) )
{
v10 = ((__int64 (__fastcall *)(CCTextInputNode *))a1->getParent)(a1);
v11 = (__int64 *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 192LL))(v10);
sub_1000229B8((__int64 *)&v19, v11);
}
else
{
v8.n128_u32[0] = 0;
v9.n128_u32[0] = 0;
sub_100022980(v8, v9, &v19);
}
sub_1000229DC(v20, &v19, v17);
sub_1000229D0(v20, (double *)v17);
if ( !sub_100022C60((float *)v20, (float *)&v21) )
return 0;
m_delegate = a1->m_delegate;
if ( m_delegate )
{
if ( !((unsigned int (__fastcall *)(TextInputDelegate *, CCTextInputNode *))m_delegate->allowTextInput)(
m_delegate,
a1) )
return 0;
}
v13 = 1;
((void (__fastcall *)(CCTextInputNode *, __int64))a1->onClickTrackNode)(a1, 1);
sub_1000229B8(&v18, (__int64 *)&v21);
v14 = sub_100022B98(v17, (__int64)v20);
v22.x = *(float *)&v14;
v22.y = v16;
CCTextInputNode::updateCursorPosition(a1, v22, v23);
return v13;
}