//
// cocos2d::CCMenu::initWithArray from 0x5d4978 to 0x5d4aa2 (298 bytes)
//
// 2 xrefs:
// > cocos2d::CCMenu::createWithArray @ 0x5d4b00
// > cocos2d::CCMenu::init @ 0x5d4b94
//
// 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)
{
_BOOL4 v4; // r8
cocos2d::CCDirector *v5; // r0
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::ccArray *data; // r2
cocos2d::CCObject **arr; // r7
int v10; // r9
cocos2d::CCObject **v11; // r5
cocos2d::CCNode *v12; // r1
cocos2d::CCNode *v13; // t1
int v14; // r2
cocos2d::CCSize v16; // [sp+4h] [bp-14h] BYREF
cocos2d::CCPoint v17; // [sp+Ch] [bp-Ch] BYREF
v4 = cocos2d::CCLayer::init(a1);
if ( v4 )
{
a1->setTouchPriority(a1, -128);
a1->setTouchMode(a1, kCCTouchesOneByOne);
a1->setTouchEnabled(a1, 1);
a1->m_bEnabled = 1;
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v16, v5);
a1->ignoreAnchorPointForPosition(a1, 1);
setAnchorPoint = a1->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v17, 0.5, 0.5);
setAnchorPoint(a1, &v17);
a1->setContentSize(a1, &v16);
setPosition = a1->setPosition;
cocos2d::CCPoint::CCPoint(&v17, v16.width * 0.5, v16.height * 0.5);
setPosition(a1, &v17);
if ( a2 )
{
data = a2->data;
if ( data->num )
{
arr = data->arr;
v10 = 0;
v11 = &arr[data->num] + 0x3FFFFFFF;
while ( arr <= v11 )
{
v13 = (cocos2d::CCNode *)*arr++;
v12 = v13;
if ( !v13 )
break;
v14 = v10++;
a1->addChild_0(a1, v12, v14);
}
}
}
a1->m_pSelectedItem = nullptr;
a1->m_eState = kCCMenuStateWaiting;
a1->setCascadeColorEnabled(a1, 1);
a1->setCascadeOpacityEnabled(a1, 1);
}
return v4;
}