//
// EditButtonBar::loadFromItems from 0x4de0e0 to 0x4de62a (1354 bytes)
//
// 3 xrefs:
// > EditButtonBar::init @ 0x4de6aa
// > EditButtonBar::reloadItems @ 0x4de77e
// > EditorUI::reloadCustomItems @ 0x6f6842
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:50:58 +0000
//
int __fastcall EditButtonBar::loadFromItems(EditButtonBar *this, cocos2d::CCArray *a2, int a3, int a4, bool a5)
{
int v8; // r6
cocos2d::CCDirector *v9; // r0
unsigned int i; // r7
bool v11; // cf
cocos2d::CCArray *v12; // r0
unsigned int v13; // r1
int v14; // r0
int v15; // r3
int v16; // r0
cocos2d::CCTouchDispatcher *v17; // r0
unsigned int v18; // r10
cocos2d::CCDirector *v19; // r0
cocos2d::CCArray *WinSize; // r0
cocos2d::CCArray *v21; // r8
cocos2d::CCObject *v22; // r0
int v23; // r0
float v24; // s14
float v25; // s21
int v26; // r3
unsigned int v27; // r5
float v28; // s15
float v29; // s18
int v30; // s14
float v31; // s16
float v32; // s15
float v33; // s20
float *v34; // r7
cocos2d::CCArray *v35; // r11
cocos2d::CCArray *v36; // r0
cocos2d::CCArray *v37; // r0
cocos2d::CCObject *v38; // r1
cocos2d::CCArray *v39; // r11
float v40; // s16
unsigned int v41; // r5
float v42; // s16
cocos2d::CCArray *v43; // r0
cocos2d::CCArray *v44; // r10
cocos2d::CCObject *v45; // r0
cocos2d::CCArray *v46; // r5
_BOOL4 v47; // r2
bool v48; // r3
unsigned int v49; // r0
unsigned int v50; // r5
cocos2d::CCMenu *v51; // r0
int v52; // r5
const cocos2d::CCPoint *v53; // r8
const char *v54; // r1
int v55; // r9
int v56; // r9
float v57; // s18
const char *v58; // r1
cocos2d::CCSprite *v59; // r11
int v60; // r11
cocos2d::CCMenu *v61; // r0
int v62; // r0
float v63; // r1
int v64; // r8
void (__fastcall *v65)(int, _DWORD *); // r9
const char *v66; // r1
int v67; // r8
int v68; // r7
int v69; // r7
int v70; // s15
void (__fastcall *v71)(int, _BYTE *); // r11
void (__fastcall *v74)(int, _DWORD *); // [sp+8h] [bp-4Ch]
int v75; // [sp+Ch] [bp-48h]
void (__fastcall *v76)(int, _DWORD *); // [sp+Ch] [bp-48h]
_BOOL4 v77; // [sp+10h] [bp-44h]
float v78[2]; // [sp+1Ch] [bp-38h] BYREF
_BYTE v79[8]; // [sp+24h] [bp-30h] BYREF
_BYTE v80[8]; // [sp+2Ch] [bp-28h] BYREF
int (__fastcall *v81)(EditButtonBar *, cocos2d::CCObject *); // [sp+34h] [bp-20h]
int v82; // [sp+38h] [bp-1Ch]
_DWORD v83[2]; // [sp+3Ch] [bp-18h] BYREF
_DWORD v84[2]; // [sp+44h] [bp-10h] BYREF
v8 = *((_DWORD *)this + 71);
if ( v8 )
v8 = *(_DWORD *)(v8 + 460);
v9 = (cocos2d::CCDirector *)cocos2d::CCObject::retain(a2);
if ( *((_DWORD *)this + 70) )
{
for ( i = 0; ; ++i )
{
v11 = i >= cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 70));
v12 = *((cocos2d::CCArray **)this + 70);
if ( v11 )
break;
v13 = i;
v14 = cocos2d::CCArray::objectAtIndex(v12, v13);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v14 + 264))(v14, 0);
}
v9 = (cocos2d::CCDirector *)cocos2d::CCObject::release(v12);
}
v15 = *((_DWORD *)this + 71);
*((_DWORD *)this + 70) = a2;
if ( v15 )
{
v16 = cocos2d::CCDirector::sharedDirector(v9);
v17 = (cocos2d::CCTouchDispatcher *)(*(int (__fastcall **)(int))(*(_DWORD *)v16 + 80))(v16);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v17, *((cocos2d::CCObject **)this + 71));
(*(void (__fastcall **)(_DWORD))(**((_DWORD **)this + 71) + 268))(*((_DWORD *)this + 71));
*((_DWORD *)this + 71) = 0;
}
cocos2d::CCArray::removeAllObjects(*((cocos2d::CCArray **)this + 72));
v18 = 0;
v19 = (cocos2d::CCDirector *)(*(int (__fastcall **)(EditButtonBar *))(*(_DWORD *)this + 288))(this);
*((_DWORD *)this + 71) = 0;
*((_DWORD *)this + 73) = 0;
cocos2d::CCDirector::sharedDirector(v19);
WinSize = (cocos2d::CCArray *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v78);
v21 = (cocos2d::CCArray *)cocos2d::CCArray::create(WinSize);
v22 = (cocos2d::CCObject *)cocos2d::CCArray::create(v21);
cocos2d::CCArray::addObject(v21, v22);
v75 = a3 * a4;
v23 = (cocos2d::CCArray::count(a2) + v75 - 1) / v75;
v24 = 256.0;
v25 = (float)a4;
if ( v23 < 1 )
v23 = 1;
v77 = v23 <= 1;
v26 = a4 - 1;
v27 = 0;
if ( v23 <= 1 )
v24 = 200.0;
v28 = 78.0;
v29 = v78[0] - v24;
v30 = 4 * v26;
if ( v23 <= 1 )
v28 = 84.0;
v31 = (float)((float)(v29 - (float)(4 * (a3 - 1))) / (float)a3) / 40.0;
v32 = (float)((float)(v28 - (float)v30) / v25) / 40.0;
if ( v32 <= v31 )
v31 = v32;
v33 = v31 * 40.0;
while ( v27 < cocos2d::CCArray::count(a2) )
{
v34 = (float *)cocos2d::CCArray::objectAtIndex(a2, v27);
v35 = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(v21, v18);
(*(void (__fastcall **)(float *, float))(*(_DWORD *)v34 + 80))(v34, COERCE_FLOAT(LODWORD(v31)));
v34[79] = v31;
v36 = (cocos2d::CCArray *)cocos2d::CCArray::count(v35);
if ( (unsigned int)v36 >= v75 )
{
++v18;
v39 = (cocos2d::CCArray *)cocos2d::CCArray::create(v36);
cocos2d::CCArray::addObject(v39, (cocos2d::CCObject *)v34);
v37 = v21;
v38 = v39;
}
else
{
v37 = v35;
v38 = (cocos2d::CCObject *)v34;
}
cocos2d::CCArray::addObject(v37, v38);
if ( *((_BYTE *)this + 276) )
{
*((_DWORD *)v34 + 102) = v18;
v34[103] = *((float *)this + 68);
}
++v27;
}
v40 = 8.0;
v41 = 0;
if ( v77 )
v40 = 0.0;
v42 = (float)((float)(*((float *)this + 67) + 6.0) + v40) * 0.5;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v79,
*((float *)this + 66),
v42 + (float)((float)((float)v30 + (float)(v25 * v33)) * 0.5));
while ( v41 < cocos2d::CCArray::count(v21) )
{
v43 = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(v21, v41++);
v44 = v43;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v84, (const cocos2d::CCPoint *)v79);
v45 = ButtonPage::create(v44, (const cocos2d::CCPoint *)v84, a3, v33);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 72), v45);
}
v46 = *((cocos2d::CCArray **)this + 72);
v47 = cocos2d::CCArray::count(v46) > 1u;
v49 = BoomScrollLayer::create(v46, nullptr, v47, v48);
*((_DWORD *)this + 71) = v49;
*(_BYTE *)(v49 + 425) = 1;
BoomScrollLayer::setDotScale(*((cocos2d::CCArray ***)this + 71), 0.4);
(*(void (__fastcall **)(EditButtonBar *, _DWORD))(*(_DWORD *)this + 228))(this, *((_DWORD *)this + 71));
v50 = *((_DWORD *)this + 71);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v84, v78[0] * 0.5, 2.0);
BoomScrollLayer::setPagesIndicatorPosition(v50, (int)v84);
(*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 71) + 500))(*((_DWORD *)this + 71), 0);
v51 = (cocos2d::CCMenu *)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 72));
if ( (unsigned int)v51 > 1 )
{
v52 = 0;
v53 = (const cocos2d::CCPoint *)cocos2d::CCMenu::create(v51);
(*(void (__fastcall **)(EditButtonBar *, const cocos2d::CCPoint *))(*(_DWORD *)this + 228))(this, v53);
v55 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_arrow_02_001.png", v54);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v55 + 80))(v55, 1058642330);
v81 = EditButtonBar::onLeft;
v82 = 0;
v56 = CCMenuItemSpriteExtra::create(v55, 0, (int)this, (int)EditButtonBar::onLeft, 0);
(*(void (__fastcall **)(const cocos2d::CCPoint *, int))(*(_DWORD *)v53 + 228))(v53, v56);
v76 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v56 + 92);
v57 = (float)(v29 * 0.5) + 16.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v83, *((float *)this + 66) - v57, v42);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v84, v53);
v76(v56, v84);
v59 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"GJ_arrow_02_001.png",
v58);
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v59 + 80))(v59, 1058642330);
cocos2d::CCSprite::setFlipX(v59, 1);
v83[0] = EditButtonBar::onRight;
v83[1] = 0;
v60 = CCMenuItemSpriteExtra::create((int)v59, 0, (int)this, (int)EditButtonBar::onRight, 0);
(*(void (__fastcall **)(const cocos2d::CCPoint *, int))(*(_DWORD *)v53 + 228))(v53, v60);
v74 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v60 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v80, v57 + *((float *)this + 66), v42);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v84, v53);
v74(v60, v84);
CCMenuItemSpriteExtra::setSizeMult(v56, 1.1);
CCMenuItemSpriteExtra::setSizeMult(v60, 1.1);
*(_BYTE *)(*((_DWORD *)this + 71) + 441) = 0;
v61 = (cocos2d::CCMenu *)BoomScrollLayer::togglePageIndicators(*((_DWORD *)this + 71), 0);
v62 = cocos2d::CCMenu::create(v61);
v63 = v78[0] * 0.5;
*((_DWORD *)this + 73) = v62;
v64 = v62;
v65 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v62 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v84, v63, 2.0);
v65(v64, v84);
(*(void (__fastcall **)(EditButtonBar *, _DWORD))(*(_DWORD *)this + 228))(this, *((_DWORD *)this + 73));
v67 = cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 72));
while ( v52 < v67 )
{
v68 = cocos2d::CCSprite::create((cocos2d::CCSprite *)"smallDot.png", v66);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v68 + 80))(v68, 1053609165);
v84[0] = EditButtonBar::onDotClicked;
v84[1] = 0;
v69 = CCMenuItemSpriteExtra::create(v68, 0, (int)this, (int)EditButtonBar::onDotClicked, 0);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v69 + 36))(v69, v52);
CCMenuItemSpriteExtra::setSizeMult(v69, 2.5);
v70 = v52++;
v71 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v69 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v80,
(float)((float)v70 - (float)((float)(v67 - 1) * 0.5)) * 16.0,
0.0);
v71(v69, v80);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 73) + 228))(*((_DWORD *)this + 73), v69);
}
}
if ( v8 > 0 && a5 )
{
BoomScrollLayer::instantMoveToPage(*((_DWORD *)this + 71), v8 - 1);
BoomScrollLayer::instantMoveToPage(*((_DWORD *)this + 71), v8);
}
return EditButtonBar::updateDotState((int)this);
}