//
// cocos2d::CCMenu::initWithArray from 0x180059460 to 0x1800595e9 (393 bytes)
//
// 6 xrefs:
// > cocos2d::CCMenu::createWithArray @ 0x1800592fb
// > cocos2d::CCMenu::init @ 0x180059452
// > ??> @ 0x18013892c
// > ??> @ 0x180138984
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b2afc
//
// 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
//
char __fastcall cocos2d::CCMenu::initWithArray(cocos2d::CCMenu *this, struct cocos2d::CCArray *a2)
{
__int64 v4; // rdx
cocos2d::CCDirector *v5; // rax
__int64 v6; // rdx
cocos2d::CCMenu_vtbl *v7; // rbx
float *v8; // rax
cocos2d::CCMenu_vtbl *v9; // rbx
float *v10; // rax
cocos2d::CCObject *v11; // rdx
cocos2d::ccArray *data; // rbx
unsigned int v13; // esi
__int64 num; // rax
cocos2d::CCObject **arr; // rbx
cocos2d::CCObject **i; // rbp
cocos2d::CCRGBAProtocol_vtbl *v17; // rax
__int64 v18; // rdx
float v20; // [rsp+60h] [rbp+18h] BYREF
float v21; // [rsp+64h] [rbp+1Ch]
float v22; // [rsp+68h] [rbp+20h] BYREF
if ( !cocos2d::CCLayer::init(this) )
return 0;
((void (__fastcall *)(cocos2d::CCMenu *, __int64))this->setTouchPriority)(this, 4294967168LL);
((void (__fastcall *)(cocos2d::CCMenu *, __int64))this->setTouchMode)(this, 1);
LOBYTE(v4) = 1;
((void (__fastcall *)(cocos2d::CCMenu *, __int64))this->setTouchEnabled)(this, v4);
this->m_bEnabled = 1;
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
LOBYTE(v6) = 1;
((void (__fastcall *)(cocos2d::CCMenu *, __int64))this->ignoreAnchorPointForPosition)(this, v6);
v7 = this->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v8 = kmVec2Fill(&v22, 0.5, 0.5);
((void (__fastcall *)(cocos2d::CCMenu *, float *))v7->setAnchorPoint)(this, v8);
((void (__fastcall *)(cocos2d::CCMenu *, float *))this->setContentSize)(this, &v20);
v9 = this->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v10 = kmVec2Fill(&v22, v20 * 0.5, v21 * 0.5);
((void (__fastcall *)(cocos2d::CCMenu *, float *))v9->setPosition_0)(this, v10);
if ( a2 )
{
data = a2->data;
v13 = 0;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
v11 = *arr;
if ( !*arr )
break;
((void (__fastcall *)(cocos2d::CCMenu *, cocos2d::CCObject *, _QWORD))this->addChild_0)(this, v11, v13++);
}
}
}
v17 = this->cocos2d::CCLayerRGBA::cocos2d::CCRGBAProtocol::__vftable;
LOBYTE(v11) = 1;
this->m_pSelectedItem = nullptr;
this->m_eState = kCCMenuStateWaiting;
((void (__fastcall *)(cocos2d::CCRGBAProtocol *, cocos2d::CCObject *))v17->setCascadeColorEnabled)(
&this->cocos2d::CCRGBAProtocol,
v11);
LOBYTE(v18) = 1;
((void (__fastcall *)(cocos2d::CCRGBAProtocol *, __int64))this->setCascadeOpacityEnabled)(
&this->cocos2d::CCRGBAProtocol,
v18);
return 1;
}