//
// cocos2d::CCMenu::alignItemsInColumnsWithArray from 0x5d42dc to 0x5d4510 (564 bytes)
//
// 1 xrefs:
// > cocos2d::CCMenu::alignItemsInColumns @ 0x5d4570
//
// 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
//
void cocos2d::CCMenu::alignItemsInColumnsWithArray(cocos2d::CCMenu *a1, cocos2d::CCArray *a2)
{
cocos2d::CCArray *m_pChildren; // r0
cocos2d::CCArray *num; // r4
int v5; // r5
cocos2d::CCDirector *v6; // r0
cocos2d::CCArray *v7; // r0
cocos2d::CCArray *v8; // r3
cocos2d::ccArray *v9; // r2
float v10; // s19
int v11; // s15
const void **v12; // r8
const void **v13; // r7
unsigned int v14; // r5
unsigned int v15; // s16
int v16; // r9
float v17; // s17
float v18; // s18
cocos2d::ccArray *data; // r3
const void **arr; // r7
char *v21; // r5
unsigned int v22; // s16
int v23; // r9
const void **v24; // r10
const void *v25; // r0
const void *v26; // t1
void *v27; // r0
unsigned int v28; // r11
int v29; // r0
float v30; // s16
float v31; // s17
unsigned int v32; // r3
const void *v33; // r0
const void *v34; // t1
void *v35; // r0
void *v36; // r10
int v37; // r0
float v38; // s16
float v39; // s20
float v40; // s20
int v41; // r0
struct __class_type_info *lpstype; // [sp+4h] [bp-30h]
cocos2d::CCSize v43; // [sp+10h] [bp-24h] BYREF
cocos2d::CCPoint v44; // [sp+18h] [bp-1Ch] BYREF
void *p; // [sp+20h] [bp-14h] BYREF
sub_5D4268((int)&p, (int)a2);
m_pChildren = a1->m_pChildren;
if ( !m_pChildren || !cocos2d::CCArray::count(m_pChildren) )
{
num = nullptr;
LABEL_4:
v5 = -5;
goto LABEL_5;
}
num = a1->m_pChildren;
if ( !num )
goto LABEL_4;
data = num->data;
num = (cocos2d::CCArray *)data->num;
if ( !data->num )
goto LABEL_4;
arr = (const void **)data->arr;
v21 = (char *)&num[19173961].m_uID + 3;
num = nullptr;
v22 = 0;
v23 = 0;
v24 = &arr[(_DWORD)v21];
v5 = -5;
while ( arr <= v24 )
{
v26 = *arr++;
v25 = v26;
if ( !v26 )
break;
v27 = _dynamic_cast(
v25,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
0);
if ( v27 )
{
v28 = *((_DWORD *)p + v23);
v29 = (*(int (__fastcall **)(void *))(*(_DWORD *)v27 + 156))(v27);
v30 = (float)v22;
v31 = *(float *)(v29 + 4);
if ( v30 >= v31 || _isnanf(*(float *)(v29 + 4)) )
v22 = (unsigned int)v30;
else
v22 = (unsigned int)v31;
num = (cocos2d::CCArray *)((char *)num + 1);
if ( (unsigned int)num >= v28 )
{
++v23;
v32 = v22;
v22 = 0;
num = nullptr;
v5 += 5 + v32;
}
}
}
LABEL_5:
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v43, v6);
v7 = a1->m_pChildren;
if ( v7 )
{
if ( cocos2d::CCArray::count(v7) )
{
v8 = a1->m_pChildren;
if ( v8 )
{
v9 = v8->data;
if ( v9->num )
{
v10 = 0.0;
v11 = v5 / 2;
v12 = (const void **)v9->arr;
v13 = &v12[v9->num] + 0x3FFFFFFF;
v14 = 0;
v15 = 0;
v16 = 0;
v17 = (float)v11;
v18 = 0.0;
while ( v12 <= v13 )
{
v34 = *v12++;
v33 = v34;
if ( !v34 )
break;
v35 = _dynamic_cast(
v33,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
0);
v36 = v35;
if ( v35 )
{
if ( !v14 )
{
v14 = *((_DWORD *)p + v16);
v18 = v43.width / (float)(v14 + 1);
v10 = v18;
}
v37 = (*(int (__fastcall **)(void *))(*(_DWORD *)v35 + 156))(v35);
v38 = (float)v15;
v39 = *(float *)(v37 + 4);
if ( v38 >= v39 || _isnanf(*(float *)(v37 + 4)) )
v15 = (unsigned int)v38;
else
v15 = (unsigned int)v39;
num = (cocos2d::CCArray *)((char *)num + 1);
lpstype = *(struct __class_type_info **)(*(_DWORD *)v36 + 92);
v40 = v10 - (float)(v43.width * 0.5);
v41 = (*(int (__fastcall **)(void *))(*(_DWORD *)v36 + 156))(v36);
cocos2d::CCPoint::CCPoint(&v44, v40, v17 - (float)(*(float *)(v41 + 4) * 0.5));
((void (__fastcall *)(void *, cocos2d::CCPoint *))lpstype)(v36, &v44);
v10 = v10 + v18;
if ( (unsigned int)num >= v14 )
{
v14 = 0;
++v16;
num = nullptr;
v17 = v17 - (float)(v15 + 5);
v15 = 0;
}
}
}
}
}
}
}
if ( p )
operator delete(p);
}