//
// GameToolbox::alignItemsHorisontally from 0x140064140 to 0x140064331 (497 bytes)
//
// 42 xrefs:
// > AccountRegisterLayer::init @ 0x140078da3
// > AccountLoginLayer::init @ 0x14007bcd6
// > NewgroundsInfoLayer::init @ 0x1400c5dd7
// > NCSInfoLayer::init @ 0x1400c6b8d
// > EditLevelLayer::setupLevelInfo @ 0x1400d7137
// > EditLevelLayer::setupLevelInfo @ 0x1400d717d
// > EditLevelLayer::setupLevelInfo @ 0x1400d71c1
// > EditLevelLayer::setupLevelInfo @ 0x1400d7233
// > EndLevelLayer::customSetup @ 0x140134322
// > GJAccountSettingsLayer::init @ 0x140293973
// > GJWriteMessagePopup::init @ 0x140299820
// > UIPOptionsLayer::init @ 0x1402a5dfb
// > PurchaseItemPopup::init @ 0x1402af5db
// > GJRateLevelLayer::init @ 0x1402f4d7b
// > GJRateLevelLayer::init @ 0x1402f4dd9
// > GJRateLevelLayer::init @ 0x1402f5402
// > ShareListLayer::init @ 0x14030a3e3
// > LevelSearchLayer::init @ 0x14030d65b
// > LevelSearchLayer::init @ 0x14030db00
// > DemonFilterSelectLayer::init @ 0x140317e07
// > ProfilePage::loadPageFromUserInfo @ 0x1403c2530
// > ProfilePage::loadPageFromUserInfo @ 0x1403c2c52
// > DemonInfoPopup::init @ 0x1403c74eb
// > RateDemonLayer::init @ 0x1403c8f0a
// > RateDemonLayer::init @ 0x1403c90e5
// > RateLevelLayer::init @ 0x1403c9a84
// > RateLevelLayer::init @ 0x1403c9c57
// > RateStarsLayer::init @ 0x1403ca551
// > RateStarsLayer::init @ 0x1403ca5ae
// > RateStarsLayer::init @ 0x1403ca876
// > SetGroupIDLayer::init @ 0x1403f9803
// > SetupGradientPopup::init @ 0x140421abb
// > SetupGradientPopup::init @ 0x140421b0b
// > SetupShaderEffectPopup::setupShaderTrigger @ 0x14044ab85
// > SetupShaderEffectPopup::setupShaderTrigger @ 0x14044abd0
// > ShareCommentLayer::init @ 0x14048db48
// > ShareLevelLayer::init @ 0x14048f917
// > ShareLevelLayer::setupStars @ 0x14048fdb6
// > ShareLevelLayer::setupStars @ 0x14048fdee
// > SongInfoLayer::init @ 0x140493507
// > UILayer::init @ 0x1404cd0a1
// > ??> @ 0x1406c5cf4
//
// 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 GameToolbox::alignItemsHorisontally(cocos2d::CCArray *a1, float a2, cocos2d::CCPoint a3, bool a4)
{
float v6; // xmm6_4
cocos2d::ccArray *data; // rdi
__int64 num; // rax
cocos2d::CCObject **arr; // rdi
cocos2d::CCObject **i; // rsi
cocos2d::CCObject *v12; // rbx
const struct cocos2d::CCSize *v13; // rax
float v14; // xmm0_4
float v15; // xmm6_4
cocos2d::ccArray *v16; // rsi
__int64 v17; // rax
cocos2d::CCObject **v18; // rsi
cocos2d::CCObject **j; // r14
cocos2d::CCObject *v20; // rdi
const struct cocos2d::CCSize *v21; // rax
cocos2d::CCObject_vtbl *v22; // rbx
double v23; // xmm0_8
DS_Dictionary *v24; // rax
float v25; // xmm0_4
char v26; // [rsp+20h] [rbp-68h] BYREF
cocos2d::CCPoint v27; // [rsp+28h] [rbp-60h] BYREF
cocos2d::CCSize v28; // [rsp+90h] [rbp+8h] BYREF
v6 = -a2;
if ( a1 )
{
data = a1->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
for ( i = &arr[num - 1]; arr <= i; v6 = v6 + (float)((float)(v14 * v28.width) + a2) )
{
v12 = *arr;
if ( !*arr )
break;
v13 = a4
? &stru_1406C14A0
: (const struct cocos2d::CCSize *)((__int64 (__fastcall *)(cocos2d::CCObject *))v12->__vftable[4].isEqual)(*arr);
cocos2d::CCSize::CCSize(&v28, v13);
v14 = ((float (__fastcall *)(cocos2d::CCObject *))v12->__vftable[1].getTag)(v12);
++arr;
}
}
}
v15 = (float)-v6 * 0.5;
if ( a1 )
{
v16 = a1->data;
v17 = v16->num;
if ( (_DWORD)v17 )
{
v18 = v16->arr;
for ( j = &v18[v17 - 1]; v18 <= j; v15 = v15 + (float)((float)(v25 * v28.width) + a2) )
{
v20 = *v18;
if ( !*v18 )
break;
v21 = a4
? &stru_1406C14A0
: (const struct cocos2d::CCSize *)((__int64 (__fastcall *)(cocos2d::CCObject *))v20->__vftable[4].isEqual)(*v18);
cocos2d::CCSize::CCSize(&v28, v21);
v22 = v20->__vftable;
v23 = ((double (__fastcall *)(cocos2d::CCObject *))v20->__vftable[1].getTag)(v20);
cocos2d::CCPoint::CCPoint(&v27, (float)((float)(*(float *)&v23 * v28.width) * 0.5) + v15, 0.0);
v22[2].encodeWithCoder(v20, v24);
v20->__vftable[2].getTag(v20);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator+)(a3, &v26);
v20->__vftable[2].encodeWithCoder(v20, (DS_Dictionary *)&v26);
v25 = ((float (__fastcall *)(cocos2d::CCObject *))v20->__vftable[1].getTag)(v20);
++v18;
}
}
}
}