//
// EditButtonBar::loadFromItems from 0x86171c to 0x861df4 (1752 bytes)
//
// 4 xrefs:
// > EditButtonBar::init @ 0x861ea4
// > EditButtonBar::reloadItems @ 0x862010
// > EditorUI::reloadCustomItems @ 0xbdfe5c
// > ??> @ 0x6fe98
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:55:37 +0000
//
__int64 __fastcall EditButtonBar::loadFromItems(
EditButtonBar *this,
cocos2d::CCArray *a2,
int a3,
int a4,
unsigned __int8 a5)
{
__int64 v9; // x21
cocos2d::CCArray *v10; // x0
unsigned int v11; // w21
unsigned int v12; // w1
__int64 v13; // x0
bool v14; // cf
cocos2d::CCArray *v15; // x0
cocos2d::CCDirector *v16; // x0
__int64 v17; // x0
cocos2d::CCTouchDispatcher *v18; // x0
int v19; // w27
cocos2d::CCDirector *v20; // x0
cocos2d::CCDirector *v21; // x0
cocos2d::CCArray *WinSize; // x0
cocos2d::CCArray *v23; // x22
cocos2d::CCObject *v24; // x0
float v25; // s9
float v26; // s11
int v27; // w2
float v28; // s10
float v29; // s12
float v30; // s8
float v31; // s9
unsigned int v32; // w21
unsigned int i; // w23
float *v34; // x20
cocos2d::CCArray *v35; // x24
cocos2d::CCArray *v36; // x0
float v37; // s2
unsigned int v38; // w25
float v39; // s13
unsigned int v40; // w1
cocos2d::CCArray *v41; // x20
cocos2d::CCObject *v42; // x0
cocos2d::CCArray *v43; // x20
unsigned __int8 v44; // w2
__int64 v45; // x0
cocos2d::CCArray **v46; // x20
cocos2d::CCMenu *v47; // x0
cocos2d::CCNode *v48; // x20
const char *v49; // x1
__int64 v50; // x24
__int64 v51; // x24
float v52; // s11
void (__fastcall *v53)(__int64, __int64 *); // x25
const char *v54; // x1
cocos2d::CCSprite *v55; // x26
__int64 v56; // x25
void (__fastcall *v57)(__int64, __int64 *); // x22
cocos2d::CCMenu *v58; // x0
__int64 v59; // x20
float v60; // s0
void (__fastcall *v61)(__int64, __int64 *); // x21
int v62; // w0
const char *v63; // x1
int v64; // w22
int v65; // w21
float v66; // s11
__int64 v67; // x20
__int64 v68; // x20
float v69; // s0
void (__fastcall *v70)(__int64, __int64 *); // x25
cocos2d::CCArray *v72; // x24
int v73; // [xsp+94h] [xbp+94h]
int v74; // [xsp+98h] [xbp+98h]
int v75; // [xsp+9Ch] [xbp+9Ch]
__int64 v76; // [xsp+A8h] [xbp+A8h] BYREF
_BYTE v77[8]; // [xsp+B0h] [xbp+B0h] BYREF
_BYTE v78[8]; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v79; // [xsp+C0h] [xbp+C0h] BYREF
v9 = *((_QWORD *)this + 43);
if ( v9 )
{
v73 = *(_DWORD *)(v9 + 588);
v74 = a5 & (v73 > 0);
}
else
{
v74 = 0;
v73 = 0;
}
cocos2d::CCObject::retain(a2);
v10 = *((cocos2d::CCArray **)this + 42);
if ( v10 )
{
v11 = 0;
while ( 1 )
{
v14 = v11 >= (unsigned int)cocos2d::CCArray::count(v10);
v15 = *((cocos2d::CCArray **)this + 42);
if ( v14 )
break;
v12 = v11++;
v13 = cocos2d::CCArray::objectAtIndex(v15, v12);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v13 + 528LL))(v13, 0);
v10 = *((cocos2d::CCArray **)this + 42);
}
cocos2d::CCObject::release(v15);
}
v16 = *((cocos2d::CCDirector **)this + 43);
*((_QWORD *)this + 42) = a2;
if ( v16 )
{
v17 = cocos2d::CCDirector::sharedDirector(v16);
v18 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v17 + 160LL))(v17);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v18, *((cocos2d::CCObject **)this + 43));
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 43) + 536LL))(*((_QWORD *)this + 43));
*((_QWORD *)this + 43) = 0;
}
v19 = a3 * a4;
cocos2d::CCArray::removeAllObjects(*((cocos2d::CCArray **)this + 44));
v20 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(EditButtonBar *))(*(_QWORD *)this + 576LL))(this);
*((_QWORD *)this + 43) = 0;
*((_QWORD *)this + 45) = 0;
v21 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v20);
WinSize = (cocos2d::CCArray *)cocos2d::CCDirector::getWinSize(&v76, v21);
v23 = (cocos2d::CCArray *)cocos2d::CCArray::create(WinSize);
v24 = (cocos2d::CCObject *)cocos2d::CCArray::create(v23);
cocos2d::CCArray::addObject(v23, v24);
if ( (int)(cocos2d::CCArray::count(a2) + v19 - 1) / v19 <= 1 )
{
v75 = 1;
v25 = 84.0;
v26 = *(float *)&v76 - 200.0;
}
else
{
v75 = 0;
v25 = 78.0;
v26 = *(float *)&v76 - 256.0;
}
v27 = 4 * (a4 - 1);
v28 = (float)v27;
v29 = (float)a4;
v30 = (float)((float)(v26 - (float)(4 * (a3 - 1))) / (float)a3) / 40.0;
if ( v30 >= (float)((float)((float)(v25 - (float)v27) / (float)a4) / 40.0) )
v30 = (float)((float)(v25 - (float)v27) / (float)a4) / 40.0;
v31 = v30 * 40.0;
v32 = 0;
for ( i = 0; v32 < (unsigned int)cocos2d::CCArray::count(a2); ++v32 )
{
v34 = (float *)cocos2d::CCArray::objectAtIndex(a2, v32);
v35 = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(v23, i);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v34 + 160LL))(v34, v30);
v34[101] = v30;
v36 = (cocos2d::CCArray *)cocos2d::CCArray::count(v35);
if ( (unsigned int)v36 >= v19 )
{
v72 = (cocos2d::CCArray *)cocos2d::CCArray::create(v36);
++i;
cocos2d::CCArray::addObject(v72, (cocos2d::CCObject *)v34);
cocos2d::CCArray::addObject(v23, v72);
}
else
{
cocos2d::CCArray::addObject(v35, (cocos2d::CCObject *)v34);
}
if ( *((_BYTE *)this + 328) )
{
*((_DWORD *)v34 + 133) = i;
v34[134] = *((float *)this + 81);
}
}
v37 = 0.0;
if ( !v75 )
v37 = 8.0;
v38 = 0;
v39 = (float)(v37 + (float)(*((float *)this + 80) + 6.0)) * 0.5;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v77,
*((float *)this + 79),
v39 + (float)((float)(v28 + (float)(v29 * v31)) * 0.5));
while ( v38 < (unsigned int)cocos2d::CCArray::count(v23) )
{
v40 = v38++;
v41 = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(v23, v40);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v79, (const cocos2d::CCPoint *)v77);
v42 = ButtonPage::create(v41, (const cocos2d::CCPoint *)&v79, a3, v31);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 44), v42);
}
v43 = *((cocos2d::CCArray **)this + 44);
v44 = (unsigned int)cocos2d::CCArray::count(v43) > 1;
v45 = BoomScrollLayer::create(v43, nullptr, v44);
*((_QWORD *)this + 43) = v45;
*(_BYTE *)(v45 + 553) = 1;
BoomScrollLayer::setDotScale(*((cocos2d::CCArray ***)this + 43), 0.4);
(*(void (__fastcall **)(EditButtonBar *, _QWORD))(*(_QWORD *)this + 456LL))(this, *((_QWORD *)this + 43));
v46 = *((cocos2d::CCArray ***)this + 43);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v79, *(float *)&v76 * 0.5, 2.0);
BoomScrollLayer::setPagesIndicatorPosition(v46, (__int64)&v79);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 43) + 1000LL))(*((_QWORD *)this + 43), 0);
v47 = (cocos2d::CCMenu *)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 44));
if ( (unsigned int)v47 > 1 )
{
v48 = (cocos2d::CCNode *)cocos2d::CCMenu::create(v47);
(*(void (__fastcall **)(EditButtonBar *, cocos2d::CCNode *))(*(_QWORD *)this + 456LL))(this, v48);
v50 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_arrow_02_001.png", v49);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v50 + 160LL))(v50, 0.6);
v51 = CCMenuItemSpriteExtra::create(v50, 0, (__int64)this, (__int64)EditButtonBar::onLeft, 0);
(*(void (__fastcall **)(cocos2d::CCNode *, __int64))(*(_QWORD *)v48 + 456LL))(v48, v51);
v52 = (float)(v26 * 0.5) + 16.0;
v53 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v51 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v78, *((float *)this + 79) - v52, v39);
cocos2d::CCNode::convertToNodeSpace(&v79, v48, (const cocos2d::CCPoint *)v78);
v53(v51, &v79);
v55 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"GJ_arrow_02_001.png",
v54);
(*(void (__fastcall **)(cocos2d::CCSprite *, float))(*(_QWORD *)v55 + 160LL))(v55, 0.6);
cocos2d::CCSprite::setFlipX(v55, 1);
v56 = CCMenuItemSpriteExtra::create((__int64)v55, 0, (__int64)this, (__int64)EditButtonBar::onRight, 0);
(*(void (__fastcall **)(cocos2d::CCNode *, __int64))(*(_QWORD *)v48 + 456LL))(v48, v56);
v57 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v56 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v78, v52 + *((float *)this + 79), v39);
cocos2d::CCNode::convertToNodeSpace(&v79, v48, (const cocos2d::CCPoint *)v78);
v57(v56, &v79);
CCMenuItemSpriteExtra::setSizeMult(v51, 1.1);
CCMenuItemSpriteExtra::setSizeMult(v56, 1.1);
*(_BYTE *)(*((_QWORD *)this + 43) + 569LL) = 0;
v58 = BoomScrollLayer::togglePageIndicators(*((BoomScrollLayer **)this + 43), 0);
v59 = cocos2d::CCMenu::create(v58);
v60 = *(float *)&v76;
*((_QWORD *)this + 45) = v59;
v61 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v59 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v79, v60 * 0.5, 2.0);
v61(v59, &v79);
(*(void (__fastcall **)(EditButtonBar *, _QWORD))(*(_QWORD *)this + 456LL))(this, *((_QWORD *)this + 45));
v62 = cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 44));
v64 = v62;
if ( v62 > 0 )
{
v65 = 0;
v66 = (float)(v62 - 1);
do
{
v67 = cocos2d::CCSprite::create((cocos2d::CCSprite *)"smallDot.png", v63);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v67 + 160LL))(v67, 0.4);
v68 = CCMenuItemSpriteExtra::create(v67, 0, (__int64)this, (__int64)EditButtonBar::onDotClicked, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v68 + 72LL))(v68, (unsigned int)v65);
CCMenuItemSpriteExtra::setSizeMult(v68, 2.5);
v69 = (float)v65++;
v70 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v68 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v79, (float)(v69 - (float)(v66 * 0.5)) * 16.0, 0.0);
v70(v68, &v79);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 45) + 456LL))(*((_QWORD *)this + 45), v68);
}
while ( v64 != v65 );
}
}
if ( v74 )
{
BoomScrollLayer::instantMoveToPage(*((cocos2d::CCNode ***)this + 43), v73 - 1);
BoomScrollLayer::instantMoveToPage(*((cocos2d::CCNode ***)this + 43), v73);
}
EditButtonBar::updateDotState(this);
return _stack_chk_guard;
}