//
// cocos2d::CCMenu::alignItemsHorizontallyWithPadding from 0xaf1c5c to 0xaf1e80 (548 bytes)
//
// 9 xrefs:
// > FLAlertLayer::init @ 0x57ea08
// > MenuLayer::init @ 0x5c3358
// > EditorUI::setupCreateMenu @ 0x6b350c
// > PauseLayer::customSetup @ 0x6c7d88
// > EditLevelLayer::init @ 0x6e0ba8
// > GJGarageLayer::setupPage @ 0x797914
// > GJGarageLayer::setupIconSelect @ 0x798a38
// > cocos2d::CCMenu::alignItemsHorizontally @ 0xaf1e84
// > ??> @ 0x34440
//
// 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::alignItemsHorizontallyWithPadding(cocos2d::CCMenu *a1, float a2)
{
cocos2d::CCArray *m_pChildren; // x20
float v5; // s8
int v6; // w0
cocos2d::CCArray *v7; // x20
float v8; // s8
cocos2d::CCArray *v9; // x0
cocos2d::ccArray *v10; // x1
const void **v11; // x20
__int64 v12; // x0
char *v13; // x21
const void *i; // x0
void *v15; // x0
void *v16; // x19
void (__fastcall *v17)(void *, cocos2d::CCPoint *); // x26
float v18; // s9
float v19; // s0
float v20; // s9
cocos2d::ccArray *data; // x1
const void **arr; // x19
__int64 v23; // x0
char *v24; // x25
const void *v25; // x0
void *v26; // x0
void *v27; // x20
float v28; // s9
cocos2d::CCPoint v29; // [xsp+70h] [xbp+70h] BYREF
m_pChildren = a1->m_pChildren;
v5 = -a2;
if ( !m_pChildren )
return;
v6 = cocos2d::CCArray::count(m_pChildren);
v7 = a1->m_pChildren;
if ( !v6 )
goto LABEL_3;
if ( !v7 )
return;
data = v7->data;
if ( data->num )
{
arr = (const void **)data->arr;
v23 = 8LL * data->num - 8;
v24 = (char *)arr + v23;
if ( arr <= (const void **)((char *)arr + v23) )
{
v25 = *arr;
if ( *arr )
{
do
{
v26 = _dynamic_cast(
v25,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
0);
v27 = v26;
if ( v26 )
{
v28 = *(float *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v26 + 312LL))(v26);
v5 = v5 + (float)(a2 + (float)(v28 * (*(float (__fastcall **)(void *))(*(_QWORD *)v27 + 136LL))(v27)));
}
if ( v24 < (char *)++arr )
break;
v25 = *arr;
}
while ( *arr );
v7 = a1->m_pChildren;
LABEL_3:
if ( !v7 )
return;
v8 = v5 * -0.5;
goto LABEL_5;
}
}
}
v8 = a2 * 0.5;
LABEL_5:
if ( (unsigned int)cocos2d::CCArray::count(v7) )
{
v9 = a1->m_pChildren;
if ( v9 )
{
v10 = v9->data;
if ( v10->num )
{
v11 = (const void **)v10->arr;
v12 = 8LL * v10->num - 8;
v13 = (char *)v11 + v12;
if ( v11 <= (const void **)((char *)v11 + v12) )
{
for ( i = *v11; *v11; i = *v11 )
{
v15 = _dynamic_cast(
i,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
0);
v16 = v15;
if ( v15 )
{
v17 = *(void (__fastcall **)(void *, cocos2d::CCPoint *))(*(_QWORD *)v15 + 184LL);
v18 = *(float *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v15 + 312LL))(v15);
v19 = (*(float (__fastcall **)(void *))(*(_QWORD *)v16 + 136LL))(v16);
cocos2d::CCPoint::CCPoint(&v29, v8 + (float)((float)(v18 * v19) * 0.5), 0.0);
v17(v16, &v29);
v20 = *(float *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v16 + 312LL))(v16);
v8 = v8 + (float)(a2 + (float)(v20 * (*(float (__fastcall **)(void *))(*(_QWORD *)v16 + 136LL))(v16)));
}
if ( v13 < (char *)++v11 )
break;
}
}
}
}
}
}