//
// cocos2d::CCMenu::initWithArray from 0x100792f10 to 0x10079308c (380 bytes)
//
// 3 xrefs:
// > cocos2d::CCMenu::createWithItems @ 0x100792dfd
// > cocos2d::CCMenu::createWithArray @ 0x100792ece
// > cocos2d::CCMenu::init @ 0x1007930a7
//
// 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 __fastcall cocos2d::CCMenu::initWithArray(cocos2d::CCMenu *a1, cocos2d::CCArray *a2)
{
bool result; // al
bool v3; // r13
cocos2d::ccArray *data; // rax
cocos2d::CCObject **arr; // r15
unsigned __int64 v6; // r12
unsigned int v7; // r14d
float v8; // [rsp+8h] [rbp-38h] BYREF
float v9[12]; // [rsp+10h] [rbp-30h] BYREF
double v10; // 0:xmm0_8.8
result = cocos2d::CCLayer::init(a1);
if ( result )
{
v3 = result;
((void (__fastcall *)(cocos2d::CCMenu *, __int64))a1->setTouchPriority)(a1, 4294967168LL);
((void (__fastcall *)(cocos2d::CCMenu *, __int64))a1->setTouchMode)(a1, 1);
((void (__fastcall *)(cocos2d::CCMenu *, __int64))a1->setTouchEnabled)(a1, 1);
a1->m_bEnabled = 1;
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v10 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v9);
((void (__fastcall *)(cocos2d::CCMenu *, __int64, double))a1->ignoreAnchorPointForPosition)(a1, 1, v10);
sub_10028CBE0(&v8, 0.5, 0.5);
((void (__fastcall *)(cocos2d::CCMenu *, float *))a1->setAnchorPoint)(a1, &v8);
((void (__fastcall *)(cocos2d::CCMenu *, float *))a1->setContentSize)(a1, v9);
sub_10028CBE0(&v8, v9[0] * 0.5, 0.5 * v9[1]);
((void (__fastcall *)(cocos2d::CCMenu *, float *))a1->setPosition)(a1, &v8);
if ( a2 )
{
data = a2->data;
if ( data->num )
{
arr = data->arr;
v6 = (unsigned __int64)&arr[data->num - 1];
v7 = 0;
do
{
if ( !*arr )
break;
((void (__fastcall *)(cocos2d::CCMenu *, _QWORD, _QWORD))a1->addChild_0)(a1, *arr++, v7++);
}
while ( (unsigned __int64)arr <= v6 );
}
}
a1->m_pSelectedItem = nullptr;
a1->m_eState = kCCMenuStateWaiting;
((void (__fastcall *)(cocos2d::CCMenu *, __int64))a1->setCascadeColorEnabled)(a1, 1);
((void (__fastcall *)(cocos2d::CCMenu *, __int64))a1->setCascadeOpacityEnabled)(a1, 1);
return v3;
}
return result;
}