//
// EditorUI::createCustomItems from 0x697514 to 0x6978e0 (972 bytes)
//
// 3 xrefs:
// > EditorUI::reloadCustomItems @ 0x69792c
// > EditorUI::setupCreateMenu @ 0x6b3104
// > ??> @ 0x4b810
//
// 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
//
cocos2d::CCArray *EditorUI::createCustomItems(EditorUI *a1)
{
cocos2d::CCArray *v2; // x0
cocos2d::CCArray *v3; // x27
GameManager *v4; // x0
cocos2d::CCArray *OrderedCustomObjectKeys; // x24
cocos2d::CCArray *v6; // x0
int v7; // w23
unsigned int v8; // w19
cocos2d::CCString *v9; // x0
unsigned int v10; // w21
GameManager *v11; // x0
char *v12; // x1
cocos2d::CCObject *v13; // x0
void *v14; // x0
unsigned int *v15; // x1
int v16; // w2
cocos2d::CCArray *m_customTabControls; // x1
unsigned int *v19; // x1
int v20; // w2
cocos2d::CCArray *v21; // x0
cocos2d::CCSprite *v22; // x21
CreateMenuItem *MenuItemButton; // x0
cocos2d::CCSprite *v24; // x21
CreateMenuItem *v25; // x0
cocos2d::CCSprite *v26; // x21
CreateMenuItem *v27; // x0
cocos2d::CCSprite *v28; // x21
CreateMenuItem *v29; // x0
char *v30; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCPoint v31; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::SEL_MenuHandler v32; // 0:x2.16
cocos2d::SEL_MenuHandler v33; // 0:x2.16
cocos2d::SEL_MenuHandler v34; // 0:x2.16
cocos2d::SEL_MenuHandler v35; // 0:x2.16
cocos2d::CCPoint v36; // 0:s1.4,4:s2.4
cocos2d::CCPoint v37; // 0:s1.4,4:s2.4
cocos2d::CCPoint v38; // 0:s1.4,4:s2.4
cocos2d::CCPoint v39; // 0:s1.4,4:s2.4
v2 = (cocos2d::CCArray *)cocos2d::CCArray::removeAllObjects(a1->m_customObjectButtonArray);
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(v2);
v4 = GameManager::sharedState();
OrderedCustomObjectKeys = GameManager::getOrderedCustomObjectKeys(v4);
v6 = (cocos2d::CCArray *)cocos2d::CCArray::count(OrderedCustomObjectKeys);
v7 = (int)v6;
if ( (int)v6 > 0 )
{
v8 = 0;
while ( 1 )
{
v9 = cocos2d::CCArray::stringAtIndex(OrderedCustomObjectKeys, v8);
v10 = cocos2d::CCString::intValue(v9);
v11 = GameManager::sharedState();
GameManager::stringForCustomObject(v11, (const char *)v10, (__int64)&v30);
v12 = v30;
v6 = (cocos2d::CCArray *)(v30 - 24);
if ( *((_QWORD *)v30 - 3) )
{
sub_D153B8((int)&v31, v30);
v13 = EditorUI::menuItemFromObjectString(a1, (__int64)&v31, v10);
cocos2d::CCArray::addObject(v3, v13);
v14 = (void *)(*(_QWORD *)&v31 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v31 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(*(_QWORD *)&v31 - 8LL);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *(_DWORD *)(*(_QWORD *)&v31 - 8LL);
*(_DWORD *)(*(_QWORD *)&v31 - 8LL) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v14);
}
v12 = v30;
v6 = (cocos2d::CCArray *)(v30 - 24);
if ( v30 - 24 == (char *)&qword_124B6B0 )
goto LABEL_4;
LABEL_8:
if ( &pthread_create )
{
v15 = (unsigned int *)(v12 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v12 - 2);
*((_DWORD *)v12 - 2) = v16 - 1;
}
if ( v16 > 0 )
goto LABEL_4;
++v8;
operator delete(v6);
if ( v7 == v8 )
break;
}
else
{
if ( v6 != (cocos2d::CCArray *)&qword_124B6B0 )
goto LABEL_8;
LABEL_4:
if ( v7 == ++v8 )
break;
}
}
}
m_customTabControls = a1->m_customTabControls;
if ( !m_customTabControls )
{
v21 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
a1->m_customTabControls = v21;
cocos2d::CCObject::retain(v21);
v22 = cocos2d::CCSprite::createWithSpriteFrameName("edit_upBtn_001.png");
cocos2d::CCPoint::CCPoint(&v31, (const cocos2d::CCPoint *)&dword_1242110);
v32.ptr = (void (__cdecl *)(cocos2d::CCObject *))EditorUI::orderUpCustomItem;
v32.adj = 0;
MenuItemButton = EditorUI::getCreateMenuItemButton(a1, v22, v32, nullptr, 0.9, 5, v36);
cocos2d::CCArray::addObject(a1->m_customTabControls, MenuItemButton);
v24 = cocos2d::CCSprite::createWithSpriteFrameName("edit_downBtn_001.png");
cocos2d::CCPoint::CCPoint(&v31, (const cocos2d::CCPoint *)&dword_1242110);
v33.ptr = (void (__cdecl *)(cocos2d::CCObject *))EditorUI::orderDownCustomItem;
v33.adj = 0;
v25 = EditorUI::getCreateMenuItemButton(a1, v24, v33, nullptr, 0.9, 5, v37);
cocos2d::CCArray::addObject(a1->m_customTabControls, v25);
v26 = cocos2d::CCSprite::createWithSpriteFrameName("edit_addCBtn_001.png");
cocos2d::CCPoint::CCPoint(&v31, (const cocos2d::CCPoint *)&dword_1242110);
v34.ptr = (void (__cdecl *)(cocos2d::CCObject *))EditorUI::onNewCustomItem;
v34.adj = 0;
v27 = EditorUI::getCreateMenuItemButton(a1, v26, v34, nullptr, 0.9, 1, v38);
cocos2d::CCArray::addObject(a1->m_customTabControls, v27);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("edit_delCBtn_001.png");
cocos2d::CCPoint::CCPoint(&v31, (const cocos2d::CCPoint *)&dword_1242110);
v35.ptr = (void (__cdecl *)(cocos2d::CCObject *))EditorUI::onDeleteCustomItem;
v35.adj = 0;
v29 = EditorUI::getCreateMenuItemButton(a1, v28, v35, nullptr, 0.9, 6, v39);
cocos2d::CCArray::addObject(a1->m_customTabControls, v29);
m_customTabControls = a1->m_customTabControls;
}
cocos2d::CCArray::addObjectsFromArray(v3, m_customTabControls);
return v3;
}