//
// EditorUI::createCustomItems from 0x1400e4780 to 0x1400e4c8f (1295 bytes)
//
// 3 xrefs:
// > EditorUI::reloadCustomItems @ 0x1400e4d37
// > EditorUI::setupCreateMenu @ 0x14010d5f6
// > ??> @ 0x1406c8c88
//
// 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
//
// Hidden C++ exception states: #wind=3
cocos2d::CCArray *EditorUI::createCustomItems(EditorUI *a1)
{
__int64 v2; // rcx
cocos2d::CCArray *v3; // r14
__int64 v4; // rcx
struct cocos2d::CCArray *v5; // rsi
__int64 v6; // rcx
signed int v7; // r15d
signed int i; // ebx
cocos2d::CCString *v9; // rax
unsigned int v10; // edi
__int64 v11; // rcx
_QWORD *v12; // rdx
size_t v13; // r8
struct cocos2d::CCObject *v14; // rax
cocos2d::CCArray *v15; // rax
const struct cocos2d::CCPoint *v16; // rax
const struct cocos2d::CCPoint *v17; // rsi
cocos2d::CCSprite *v18; // rax
int v19; // r8d
ButtonSprite *v20; // rdi
cocos2d::CCNode *v21; // rdx
CreateMenuItem *v22; // rbx
__int64 v23; // rax
const struct cocos2d::CCPoint *v24; // rax
const struct cocos2d::CCPoint *v25; // rsi
cocos2d::CCSprite *v26; // rax
int v27; // r8d
ButtonSprite *v28; // rdi
cocos2d::CCNode *v29; // rdx
CreateMenuItem *v30; // rbx
__int64 v31; // rax
const struct cocos2d::CCPoint *v32; // rax
const struct cocos2d::CCPoint *v33; // rsi
cocos2d::CCSprite *v34; // rax
int v35; // r8d
ButtonSprite *v36; // rdi
cocos2d::CCNode *v37; // rdx
CreateMenuItem *v38; // rbx
__int64 v39; // rax
const struct cocos2d::CCPoint *v40; // rax
const struct cocos2d::CCPoint *v41; // rsi
cocos2d::CCSprite *v42; // rax
int v43; // r8d
ButtonSprite *v44; // rdi
cocos2d::CCNode *v45; // rdx
CreateMenuItem *v46; // rbx
__int64 v47; // rax
bool v49; // [rsp+28h] [rbp-D0h]
bool v50; // [rsp+28h] [rbp-D0h]
bool v51; // [rsp+28h] [rbp-D0h]
bool v52; // [rsp+28h] [rbp-D0h]
cocos2d::CCPoint v53; // [rsp+40h] [rbp-B8h] BYREF
cocos2d::CCPoint v54; // [rsp+48h] [rbp-B0h] BYREF
__int128 v55; // [rsp+50h] [rbp-A8h] BYREF
__int64 v56; // [rsp+60h] [rbp-98h]
__int64 v57; // [rsp+68h] [rbp-90h]
_QWORD v58[4]; // [rsp+70h] [rbp-88h] BYREF
cocos2d::CCArray::removeAllObjects(a1->m_customObjectButtonArray);
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(v2);
v4 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v53 = (cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v53);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v4 = qword_1406C2ED8;
}
v5 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(v4 + 424));
if ( cocos2d::CCArray::count(v5) )
qsort(v5->data->arr, v5->data->num, 8u, sub_14017B290);
v7 = cocos2d::CCArray::count(v5);
for ( i = 0; i < v7; ++i )
{
v9 = cocos2d::CCArray::stringAtIndex(v5, i);
v10 = cocos2d::CCString::intValue(v9);
v11 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v53 = (cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v53);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v11 = qword_1406C2ED8;
}
GameManager::stringForCustomObject(v11, v58, v10);
if ( v58[2] )
{
v12 = v58;
if ( v58[3] > 0xFu )
v12 = (_QWORD *)v58[0];
v55 = 0;
v56 = 0;
v57 = 0;
v13 = -1;
do
++v13;
while ( *((_BYTE *)v12 + v13) );
sub_14003A930(&v55, v12, v13);
v14 = (struct cocos2d::CCObject *)EditorUI::menuItemFromObjectString(a1, &v55, v10);
cocos2d::CCArray::addObject(v3, v14);
}
sub_14003A830((__int64)v58);
}
if ( !a1->m_customTabControls )
{
v15 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
a1->m_customTabControls = v15;
cocos2d::CCObject::retain(v15);
cocos2d::CCPoint::CCPoint(&v54, (const struct cocos2d::CCPoint *)&dword_1406C1AA8);
v17 = v16;
v18 = cocos2d::CCSprite::createWithSpriteFrameName("edit_upBtn_001.png");
v20 = ButtonSprite::create(v18, 32, v19, 32.0, 1.0, v49, "GJ_button_05.png", 1);
v22 = CreateMenuItem::create(v20, v21, a1, (cocos2d::SEL_MenuHandler *)EditorUI::orderUpCustomItem);
((void (__fastcall *)(CreateMenuItem *))v22->setScale_0)(v22);
HIDWORD(v22->m_pDisabledImage) = 1063675494;
cocos2d::CCPoint::CCPoint(&v53, v17);
cocos2d::CCPoint::operator=(&v20->m_spritePosition, v23);
ButtonSprite::updateSpriteBGSize(v20);
cocos2d::CCArray::addObject(a1->m_customTabControls, v22);
cocos2d::CCPoint::CCPoint(&v54, (const struct cocos2d::CCPoint *)&dword_1406C1AA8);
v25 = v24;
v26 = cocos2d::CCSprite::createWithSpriteFrameName("edit_downBtn_001.png");
v28 = ButtonSprite::create(v26, 32, v27, 32.0, 1.0, v50, "GJ_button_05.png", 1);
v30 = CreateMenuItem::create(v28, v29, a1, (cocos2d::SEL_MenuHandler *)EditorUI::orderDownCustomItem);
((void (__fastcall *)(CreateMenuItem *))v30->setScale_0)(v30);
HIDWORD(v30->m_pDisabledImage) = 1063675494;
cocos2d::CCPoint::CCPoint(&v53, v25);
cocos2d::CCPoint::operator=(&v28->m_spritePosition, v31);
ButtonSprite::updateSpriteBGSize(v28);
cocos2d::CCArray::addObject(a1->m_customTabControls, v30);
cocos2d::CCPoint::CCPoint(&v54, (const struct cocos2d::CCPoint *)&dword_1406C1AA8);
v33 = v32;
v34 = cocos2d::CCSprite::createWithSpriteFrameName("edit_addCBtn_001.png");
v36 = ButtonSprite::create(v34, 32, v35, 32.0, 1.0, v51, "GJ_button_01.png", 1);
v38 = CreateMenuItem::create(v36, v37, a1, (cocos2d::SEL_MenuHandler *)EditorUI::onNewCustomItem);
((void (__fastcall *)(CreateMenuItem *))v38->setScale_0)(v38);
HIDWORD(v38->m_pDisabledImage) = 1063675494;
cocos2d::CCPoint::CCPoint(&v53, v33);
cocos2d::CCPoint::operator=(&v36->m_spritePosition, v39);
ButtonSprite::updateSpriteBGSize(v36);
cocos2d::CCArray::addObject(a1->m_customTabControls, v38);
cocos2d::CCPoint::CCPoint(&v54, (const struct cocos2d::CCPoint *)&dword_1406C1AA8);
v41 = v40;
v42 = cocos2d::CCSprite::createWithSpriteFrameName("edit_delCBtn_001.png");
v44 = ButtonSprite::create(v42, 32, v43, 32.0, 1.0, v52, "GJ_button_06.png", 1);
v46 = CreateMenuItem::create(v44, v45, a1, (cocos2d::SEL_MenuHandler *)EditorUI::onDeleteCustomItem);
((void (__fastcall *)(CreateMenuItem *))v46->setScale_0)(v46);
HIDWORD(v46->m_pDisabledImage) = 1063675494;
cocos2d::CCPoint::CCPoint(&v53, v41);
cocos2d::CCPoint::operator=(&v44->m_spritePosition, v47);
ButtonSprite::updateSpriteBGSize(v44);
cocos2d::CCArray::addObject(a1->m_customTabControls, v46);
}
cocos2d::CCArray::addObjectsFromArray(v3, a1->m_customTabControls);
return v3;
}