//
// ListButtonBar::init from 0x100167d04 to 0x100168104 (1024 bytes)
//
// 1 xrefs:
// > ListButtonBar::create @ 0x100167cc0
//
// 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
//
// local variable allocation has failed, the output may be wrong!
bool __fastcall ListButtonBar::init(
ListButtonBar *a1,
cocos2d::CCArray *a2,
cocos2d::CCPoint a3,
int a4,
int a5,
float a6,
float a7,
float a8,
float a9,
int a10)
{
int v10; // w5
float y; // s10
float x; // s11
cocos2d::CCDirector *v19; // x0
__int64 v20; // x0
cocos2d::CCArray *v21; // x0
__int64 v22; // x0
__int64 v23; // x24
__int64 v24; // x0
__int64 v25; // x26
__int64 v26; // x27
__int64 v27; // x28
__int64 v28; // x21
int v29; // w19
__int64 v30; // x0
__int64 v31; // x0
__int64 v32; // x1
__int64 v33; // x0
__int64 v34; // x21
__int64 v35; // x25
cocos2d::CCArray *v36; // x19
float v37; // s3
float v38; // s4
ListButtonPage *v39; // x0
cocos2d::CCArray *m_pages; // x19
bool v41; // w2
BoomScrollLayer *v42; // x0
BoomScrollLayer *m_scrollLayer; // x19
float v44; // s9
cocos2d::CCDirector *v45; // x0
__n128 v46; // q0
__n128 v47; // q1
cocos2d::CCMenu *v48; // x22
cocos2d::CCString *v49; // x0
const char *CString; // x21
cocos2d::CCSprite *v51; // x19
CCMenuItemSpriteExtra *v52; // x19
__n128 v53; // q0
__n128 v54; // q1
cocos2d::CCSprite *v55; // x19
CCMenuItemSpriteExtra *v56; // x19
__n128 v57; // q0
__n128 v58; // q1
int v60; // [xsp+8h] [xbp-A8h]
ListButtonBar *v61; // [xsp+10h] [xbp-A0h]
__int64 *v62; // [xsp+18h] [xbp-98h]
float32x2_t v63; // [xsp+20h] [xbp-90h] BYREF
float32x2_t v64; // [xsp+28h] [xbp-88h] BYREF
__int64 v65; // [xsp+30h] [xbp-80h] BYREF
float v66; // [xsp+38h] [xbp-78h]
cocos2d::CCPoint v67; // 0:kr08_8.8
cocos2d::CCPoint v68; // 0:kr10_8.8
cocos2d::SEL_MenuHandler v69; // 0:x3.16
cocos2d::SEL_MenuHandler v70; // 0:x3.16
cocos2d::CCPoint v71; // 0:s0.4,4:s1.4
cocos2d::CCPoint v72; // 0:s0.4,4:s1.4
v60 = v10;
y = a3.y;
x = a3.x;
v62 = *(__int64 **)&a4;
v19 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v19);
v21 = (cocos2d::CCArray *)sub_10024A15C(v20);
v61 = a1;
a1->m_pages = v21;
cocos2d::CCObject::retain(v21);
v23 = sub_10024A15C(v22);
v24 = sub_10024A15C(v23);
sub_10024A2D0(v23, v24);
if ( (unsigned int)sub_10024A36C(a2) )
{
v25 = 0;
v26 = 0;
do
{
v27 = sub_10024A388(a2, v26);
v28 = sub_10024A388(v23, v25);
v29 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v27 + 64LL))(v27);
v30 = sub_10024A36C(v28);
if ( (unsigned int)v30 >= a10 * a5 || v29 == -1 )
{
v33 = sub_10024A15C(v30);
v34 = v33;
if ( v29 != -1 )
sub_10024A2D0(v33, v27);
v25 = (unsigned int)(v25 + 1);
v31 = v23;
v32 = v34;
}
else
{
v31 = v28;
v32 = v27;
}
sub_10024A2D0(v31, v32);
v26 = (unsigned int)(v26 + 1);
}
while ( (unsigned int)v26 < (unsigned int)sub_10024A36C(a2) );
}
if ( (unsigned int)sub_10024A36C(v23) )
{
v35 = 0;
do
{
v36 = (cocos2d::CCArray *)sub_10024A388(v23, v35);
sub_1000229B8(&v65, v62);
v71.x = x;
v71.y = y;
v39 = ListButtonPage::create(v36, v71, (int)&v65, a5, a6, v37, v38);
sub_10024A2D0(v61->m_pages, v39);
v35 = (unsigned int)(v35 + 1);
}
while ( (unsigned int)v35 < (unsigned int)sub_10024A36C(v23) );
}
m_pages = v61->m_pages;
v41 = (unsigned int)sub_10024A36C(m_pages) > 1;
v42 = BoomScrollLayer::create_1(m_pages, 0, v41);
v61->m_scrollLayer = v42;
((void (__fastcall *)(ListButtonBar *, BoomScrollLayer *))v61->addChild)(v61, v42);
m_scrollLayer = v61->m_scrollLayer;
v44 = v66 * 0.5;
v45 = cocos2d::CCDirector::sharedDirector();
v46.n128_f64[0] = sub_1001768D0(v45);
v47.n128_f32[0] = v46.n128_f32[0] + 6.0;
v46.n128_f32[0] = v44;
sub_100022980(v46, v47, &v65);
BoomScrollLayer::setPagesIndicatorPosition(m_scrollLayer, v72);
((void (__fastcall *)(BoomScrollLayer *, _QWORD))v61->m_scrollLayer->setTouchEnabled)(v61->m_scrollLayer, 0);
if ( (unsigned int)sub_10024A36C(v61->m_pages) <= 1 )
{
v61->m_scrollLayer->m_dotsVisible = 0;
}
else
{
v48 = cocos2d::CCMenu::create();
((void (__fastcall *)(ListButtonBar *, cocos2d::CCMenu *))v61->addChild)(v61, v48);
v49 = (cocos2d::CCString *)sub_100268F4C("GJ_arrow_%02d_001.png", v60);
CString = cocos2d::CCString::getCString(v49);
v51 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
((void (__fastcall *)(cocos2d::CCSprite *, float))v51->setScale)(v51, 0.8);
v69.ptr = (void (__cdecl *)(cocos2d::CCObject *))ListButtonBar::onLeft;
v69.adj = 0;
v52 = CCMenuItemSpriteExtra::create(v51, nullptr, v61, v69);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v48->addChild)(v48, v52);
CCMenuItemSpriteExtra::setSizeMult(v52, 2.2);
v53.n128_f32[0] = -a7;
v54.n128_u32[0] = 0;
sub_100022980(v53, v54, &v63);
sub_1000229DC((float32x2_t *)v62, &v63, &v64);
v67 = cocos2d::CCNode::convertToNodeSpace(v48, (const cocos2d::CCPoint *)&v64);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64 *, float, float))v52->setPosition)(v52, &v65, v67.x, v67.y);
v55 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
((void (__fastcall *)(cocos2d::CCSprite *, float))v55->setScale)(v55, 0.8);
cocos2d::CCSprite::setFlipX(v55, 1);
v70.ptr = (void (__cdecl *)(cocos2d::CCObject *))ListButtonBar::onRight;
v70.adj = 0;
v56 = CCMenuItemSpriteExtra::create(v55, nullptr, v61, v70);
v57 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v48->addChild)(v48, v56);
v58.n128_u32[0] = 0;
v57.n128_f32[0] = a7;
sub_100022980(v57, v58, &v63);
sub_1000229DC((float32x2_t *)v62, &v63, &v64);
v68 = cocos2d::CCNode::convertToNodeSpace(v48, (const cocos2d::CCPoint *)&v64);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64 *, float, float))v56->setPosition)(v56, &v65, v68.x, v68.y);
CCMenuItemSpriteExtra::setSizeMult(v56, 2.2);
}
return 1;
}