//
// cocos2d::CCMenu::initWithArray from 0xaf2ee0 to 0xaf30c4 (484 bytes)
//
// 3 xrefs:
// > cocos2d::CCMenu::createWithArray @ 0xaf3130
// > cocos2d::CCMenu::init @ 0xaf3340
// > ??> @ 0xa7f88
//
// 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 cocos2d::CCMenu::initWithArray(cocos2d::CCMenu *a1, cocos2d::CCArray *a2)
{
bool v4; // w23
cocos2d::CCDirector *v6; // x0
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::ccArray *data; // x1
cocos2d::CCNode **arr; // x20
__int64 v11; // x0
char *v12; // x24
cocos2d::CCNode *v13; // x1
unsigned int i; // w22
__int64 v15; // x2
cocos2d::CCMenu_vtbl *v16; // x2
float v17[2]; // [xsp+58h] [xbp+58h] BYREF
cocos2d::CCPoint v18; // [xsp+60h] [xbp+60h] BYREF
cocos2d::CCSize WinSize; // 0:kr00_8.8
v4 = cocos2d::CCLayer::init(a1);
if ( v4 )
{
a1->setTouchPriority(a1, -128);
a1->setTouchMode(a1, kCCTouchesOneByOne);
a1->setTouchEnabled(a1, 1);
a1->m_bEnabled = 1;
v6 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v6);
((void (__fastcall *)(cocos2d::CCMenu *, __int64, float, float))a1->ignoreAnchorPointForPosition)(
a1,
1,
WinSize.width,
WinSize.height);
setAnchorPoint = a1->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v18, 0.5, 0.5);
setAnchorPoint(a1, &v18);
a1->setContentSize(a1, (const cocos2d::CCSize *)v17);
setPosition = a1->setPosition;
cocos2d::CCPoint::CCPoint(&v18, v17[0] * 0.5, v17[1] * 0.5);
setPosition(a1, &v18);
if ( a2 )
{
data = a2->data;
if ( data->num )
{
arr = (cocos2d::CCNode **)data->arr;
v11 = 8LL * data->num - 8;
v12 = (char *)arr + v11;
if ( arr <= (cocos2d::CCNode **)((char *)arr + v11) )
{
v13 = *arr;
for ( i = 0; *arr; v13 = *arr )
{
v15 = i;
++arr;
++i;
a1->addChild_0(a1, v13, v15);
if ( v12 < (char *)arr )
break;
}
}
}
}
v16 = a1->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_pSelectedItem = nullptr;
a1->m_eState = kCCMenuStateWaiting;
v16->setCascadeColorEnabled(a1, 1);
a1->setCascadeOpacityEnabled(a1, 1);
}
return v4;
}