//
// cocos2d::CCMenu::initWithArray from 0x1001d8004 to 0x1001d8198 (404 bytes)
//
// 2 xrefs:
// > cocos2d::CCMenu::createWithArray @ 0x1001d7fb8
// > cocos2d::CCMenu::init @ 0x1001d81bc
//
// 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)
{
_BOOL4 v4; // w19
cocos2d::CCDirector *v5; // x0
__n128 v6; // q0
__n128 v7; // q1
__n128 v8; // q0
__n128 v9; // q1
cocos2d::ccArray *data; // x9
__int64 num; // x8
__int64 v12; // x21
cocos2d::CCObject **arr; // x22
unsigned __int64 v14; // x23
int v16; // [xsp+0h] [xbp-50h] BYREF
float v17[2]; // [xsp+8h] [xbp-48h] BYREF
cocos2d::CCSize WinSize; // 0:kr00_8.8
v4 = cocos2d::CCLayer::init(a1);
if ( v4 )
{
((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;
v5 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v5);
v6 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, __int64, float, float))a1->ignoreAnchorPointForPosition)(
a1,
1,
WinSize.width,
WinSize.height);
v6.n128_u32[0] = 0.5;
v7.n128_u32[0] = 0.5;
sub_100022980(v6, v7, &v16);
((void (__fastcall *)(cocos2d::CCMenu *, int *))a1->setAnchorPoint)(a1, &v16);
v8 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, float *))a1->setContentSize)(a1, v17);
v8.n128_f32[0] = v17[0] * 0.5;
v9.n128_f32[0] = v17[1] * 0.5;
sub_100022980(v8, v9, &v16);
((void (__fastcall *)(cocos2d::CCMenu *, int *))a1->setPosition)(a1, &v16);
if ( a2 )
{
data = a2->data;
num = data->num;
if ( (_DWORD)num )
{
v12 = 0;
arr = data->arr;
v14 = (unsigned __int64)&arr[num - 1];
do
{
if ( !*arr )
break;
((void (__fastcall *)(cocos2d::CCMenu *, cocos2d::CCObject *, __int64))a1->addChild_0)(a1, *arr, v12);
v12 = (unsigned int)(v12 + 1);
++arr;
}
while ( (unsigned __int64)arr <= v14 );
}
}
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 v4;
}