//
// CCTextInputNode::ccTouchBegan from 0x140051330 to 0x140051537 (519 bytes)
//
// 2 xrefs:
// > ??> @ 0x1405323c0
// > ??> @ 0x1406c4d94
//
// 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 CCTextInputNode::ccTouchBegan(CCTextInputNode *a1, cocos2d::CCTouch *a2, cocos2d::CCEvent *a3)
{
cocos2d::CCDirector *v4; // rax
struct cocos2d::CCPoint v5; // rax
int *p_m_nUpdateScriptHandler; // rdi
struct cocos2d::CCPoint v7; // rax
struct cocos2d::CCPoint v8; // rax
const struct cocos2d::CCPoint *v9; // rax
float *v10; // rbx
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // rax
const struct cocos2d::CCPoint *v15; // rax
const struct cocos2d::CCPoint *v16; // rax
__int64 v17; // rdx
cocos2d::CCGLProgram *m_pShaderProgram; // rcx
cocos2d::CCPoint v19; // rax
cocos2d::CCRect *v20; // r8
cocos2d::CCRect v22; // [rsp+20h] [rbp-30h] BYREF
cocos2d::CCPoint v23; // [rsp+30h] [rbp-20h] BYREF
cocos2d::CCRect v24; // [rsp+38h] [rbp-18h] BYREF
struct cocos2d::CCPoint v25; // [rsp+70h] [rbp+20h] BYREF
cocos2d::CCPoint v26; // [rsp+88h] [rbp+38h] BYREF
cocos2d::CCTouch::getLocationInView(a2);
v4 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector();
v5 = cocos2d::CCDirector::convertToGL(v4, &v22.origin);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v25, v5);
p_m_nUpdateScriptHandler = &a1[-1].m_nUpdateScriptHandler;
v7 = cocos2d::CCNode::convertToWorldSpace((CCTextInputNode *)((char *)a1 - 320), &v22.origin);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v25, v7);
v8 = cocos2d::CCNode::convertToNodeSpace((CCTextInputNode *)((char *)a1 - 320), &v22.origin);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v25, v8);
v9 = (const struct cocos2d::CCPoint *)((__int64 (__fastcall *)(cocos2d::CCObject *))a1->m_pUserObject->cocos2d::CCLayer::cocos2d::CCNode::__vftable[3].setTag)(a1->m_pUserObject);
v10 = (float *)cocos2d::CCPoint::CCPoint(&v22.origin, v9);
cocos2d::CCRect::CCRect(&v24);
v11 = (*(__int64 (__fastcall **)(int *))(*(_QWORD *)&a1[-1].m_nUpdateScriptHandler + 200LL))(&a1[-1].m_nUpdateScriptHandler);
cocos2d::CCPoint::operator=(&v24, v11);
v12 = (*(__int64 (__fastcall **)(int *))(*(_QWORD *)&a1[-1].m_nUpdateScriptHandler + 304LL))(&a1[-1].m_nUpdateScriptHandler);
cocos2d::CCSize::operator=(&v24.size, v12);
v13 = *(_QWORD *)&a1[-1].m_nUpdateScriptHandler;
v24.origin.x = v24.origin.x - (float)(v24.size.width * *v10);
v24.origin.y = v24.origin.y - (float)(v24.size.height * v10[1]);
if ( (*(__int64 (__fastcall **)(int *))(v13 + 488))(&a1[-1].m_nUpdateScriptHandler) )
{
v14 = (*(__int64 (__fastcall **)(int *))(*(_QWORD *)p_m_nUpdateScriptHandler + 488LL))(&a1[-1].m_nUpdateScriptHandler);
v15 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 200LL))(v14);
v16 = (const struct cocos2d::CCPoint *)cocos2d::CCPoint::CCPoint(&v22.origin, v15);
}
else
{
cocos2d::CCPoint::CCPoint(&v23, 0.0, 0.0);
}
cocos2d::CCPoint::CCPoint(&v26, v16);
cocos2d::CCPoint::operator+(&v24, &v22);
cocos2d::CCPoint::operator=(&v24, &v22);
if ( !cocos2d::CCRect::containsPoint(&v24, &v25) )
return 0;
m_pShaderProgram = a1->m_pShaderProgram;
if ( m_pShaderProgram )
{
if ( !((unsigned __int8 (__fastcall *)(cocos2d::CCGLProgram *, int *))m_pShaderProgram->encodeWithCoder)(
m_pShaderProgram,
&a1[-1].m_nUpdateScriptHandler) )
return 0;
}
LOBYTE(v17) = 1;
(*(void (__fastcall **)(int *, __int64))(*(_QWORD *)p_m_nUpdateScriptHandler + 1016LL))(
&a1[-1].m_nUpdateScriptHandler,
v17);
cocos2d::CCRect::CCRect(&v22, &v24);
v19 = (cocos2d::CCPoint)cocos2d::CCPoint::CCPoint(&v23, &v25);
CCTextInputNode::updateCursorPosition((CCTextInputNode *)((char *)a1 - 320), v19, v20);
return 1;
}