//
// cocos2d::CCMenu::itemForTouch from 0x180059640 to 0x180059840 (512 bytes)
//
// 8 xrefs:
// > cocos2d::CCMenu::ccTouchBegan @ 0x180058fe1
// > cocos2d::CCMenu::ccTouchBegan @ 0x180058ffb
// > cocos2d::CCMenu::ccTouchMoved @ 0x1800590d4
// > cocos2d::CCMenu::ccTouchMoved @ 0x1800590ee
// > cocos2d::CCMenu::itemForTouch @ 0x180059613
// > cocos2d::CCMenu::itemForTouch @ 0x180059626
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b2b5c
//
// 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
//
struct cocos2d::CCMenuItem *__fastcall cocos2d::CCMenu::itemForTouch(
cocos2d::CCMenu *this,
struct cocos2d::CCTouch *a2,
char a3)
{
cocos2d::CCArray *m_pChildren; // rcx
cocos2d::CCArray *v6; // rax
cocos2d::ccArray *data; // rdi
__int64 num; // rax
cocos2d::CCObject **arr; // rdi
cocos2d::CCObject **v10; // rsi
__int64 v11; // rax
__int64 v12; // rbx
float v13; // xmm5_4
double width; // xmm0_8
double v15; // xmm3_8
double v16; // xmm0_8
cocos2d::CCRect v18[2]; // [rsp+30h] [rbp-58h] BYREF
struct cocos2d::CCPoint v19; // [rsp+90h] [rbp+8h] BYREF
struct cocos2d::CCPoint v20; // [rsp+A8h] [rbp+20h] BYREF
cocos2d::CCTouch::getLocation(a2);
m_pChildren = this->m_pChildren;
if ( m_pChildren )
{
if ( (unsigned int)cocos2d::CCArray::count(m_pChildren) )
{
v6 = this->m_pChildren;
if ( v6 )
{
data = v6->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
v10 = &arr[num - 1];
if ( arr <= v10 )
{
while ( *arr )
{
v11 = _RTDynamicCast(
*arr,
0,
&cocos2d::CCObject `RTTI Type Descriptor',
&cocos2d::CCMenuItem `RTTI Type Descriptor',
0);
v12 = v11;
if ( v11
&& (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v11 + 328LL))(v11)
&& (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v12 + 912LL))(v12) )
{
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v12, &v20, &v19);
cocos2d::CCMenuItem::rect((struct cocos2d::CCRect *)v12);
cocos2d::CCSize::operator=(v18, dword_1801A83D8);
if ( a3 )
{
v13 = *(float *)(v12 + 372);
if ( v13 > 1.0 )
{
width = v18[0].size.width;
v15 = v13 - 1.0;
v18[0].size.width = v18[0].size.width * v13;
*(float *)&width = v18[0].origin.x - width * v15 * 0.5;
v18[0].origin.x = *(float *)&width;
v16 = v18[0].size.height * v15;
v18[0].size.height = v18[0].size.height * v13;
v18[0].origin.y = v18[0].origin.y - v16 * 0.5;
}
}
if ( cocos2d::CCRect::containsPoint(v18, &v20) )
return (struct cocos2d::CCMenuItem *)v12;
}
if ( ++arr > v10 )
return nullptr;
}
}
}
}
}
}
return nullptr;
}