//
// cocos2d::CCMenu::itemForTouch from 0x1001d8980 to 0x1001d8b18 (408 bytes)
//
// 2 xrefs:
// > cocos2d::CCMenu::itemForTouch_1 @ 0x1001d842c
// > cocos2d::CCMenu::itemForTouch_1 @ 0x1001d8454
//
// 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
//
cocos2d::CCMenuItem *__fastcall cocos2d::CCMenu::itemForTouch(cocos2d::CCMenu *a1, cocos2d::CCTouch *a2, bool a3)
{
_BOOL4 v3; // w19
cocos2d::CCArray *m_pChildren; // x0
cocos2d::CCArray *v6; // x8
cocos2d::ccArray *data; // x9
__int64 num; // x8
const void **arr; // x24
unsigned __int64 v10; // x25
cocos2d::CCMenuItem *v15; // x0
cocos2d::CCMenuItem *v16; // x23
float m_fSizeMult; // s0
float64x2_t v20; // [xsp+0h] [xbp-90h]
float32x2_t v21; // [xsp+10h] [xbp-80h] BYREF
float32x2_t v22; // [xsp+18h] [xbp-78h]
float v23; // [xsp+20h] [xbp-70h] BYREF
cocos2d::CCPoint v24; // [xsp+28h] [xbp-68h] BYREF
v3 = a3;
cocos2d::CCTouch::getLocation(a2);
m_pChildren = a1->m_pChildren;
if ( m_pChildren )
{
if ( (unsigned int)sub_10024A36C(m_pChildren) )
{
v6 = a1->m_pChildren;
if ( v6 )
{
data = v6->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (const void **)data->arr;
v10 = (unsigned __int64)&arr[num - 1];
__asm { FMOV V0.2D, #-0.5 }
v20 = _Q0;
while ( *arr )
{
v15 = (cocos2d::CCMenuItem *)__dynamic_cast(
*arr,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCMenuItem,
0);
if ( v15 )
{
v16 = v15;
if ( ((unsigned int (__fastcall *)(cocos2d::CCMenuItem *))v15->isVisible)(v15) )
{
if ( ((unsigned int (__fastcall *)(cocos2d::CCMenuItem *))v16->isEnabled)(v16) )
{
cocos2d::CCNode::convertToNodeSpace(v16, &v24);
cocos2d::CCMenuItem::rect(v16);
sub_1000229D0(&v21, &dbl_10086C940);
if ( v3 )
{
m_fSizeMult = v16->m_fSizeMult;
if ( m_fSizeMult < 1.2 && m_fSizeMult != 1.0 )
m_fSizeMult = 1.2;
if ( m_fSizeMult > 1.0 )
{
v21 = vcvt_f32_f64(
vaddq_f64(
vcvtq_f64_f32(v21),
vmulq_f64(vmulq_n_f64(vcvtq_f64_f32(v22), m_fSizeMult + -1.0), v20)));
v22 = vmul_n_f32(v22, m_fSizeMult);
}
}
if ( sub_100022C60((float *)&v21, &v23) )
return v16;
}
}
}
if ( (unsigned __int64)++arr > v10 )
return nullptr;
}
}
}
}
}
return nullptr;
}