//
// EditorUI::createCustomItems from 0x100031690 to 0x1000319b7 (807 bytes)
//
// 6 xrefs:
// > EditorUI::setupCreateMenu @ 0x100029f67
// > EditorUI::onNewCustomItem @ 0x100030cb6
// > EditorUI::reloadCustomItems @ 0x100031446
// > EditorUI::onDeleteCustomItem @ 0x1000314dd
// > EditorUI::orderUpCustomItem @ 0x100031594
// > EditorUI::orderDownCustomItem @ 0x100031651
//
// 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 *__fastcall EditorUI::createCustomItems(EditorUI *a1)
{
__int64 v1; // rsi
double v2; // xmm0_8
cocos2d::CCPoint v3; // xmm1_8
EditorUI *v4; // r12
cocos2d::CCArray *m_customObjectButtonArray; // rdi
cocos2d::CCArray *v6; // r14
GameManager *v7; // rax
const char *p_src; // rdi
unsigned int v9; // r13d
cocos2d::CCString *v10; // rax
unsigned int v11; // r15d
GameManager *v12; // rax
size_t v13; // rax
size_t v14; // r15
char *v15; // r12
size_t v16; // r14
__int64 v17; // rax
cocos2d::CCArray *m_customTabControls; // rsi
cocos2d::CCObject *v19; // rax
cocos2d::CCSprite *v20; // r14
CreateMenuItem *MenuItemButton; // rax
cocos2d::CCSprite *v22; // r14
CreateMenuItem *v23; // rax
cocos2d::CCSprite *v24; // r14
CreateMenuItem *v25; // rax
cocos2d::CCSprite *v26; // r14
cocos2d::CCSprite *v27; // rsi
CreateMenuItem *v28; // rax
cocos2d::CCArray *OrderedCustomObjectKeys; // [rsp+8h] [rbp-78h]
EditorUI *v31; // [rsp+10h] [rbp-70h]
cocos2d::CCArray *v32; // [rsp+18h] [rbp-68h]
char v33; // [rsp+20h] [rbp-60h] BYREF
char __src; // [rsp+21h] [rbp-5Fh] BYREF
__int64 v35; // [rsp+28h] [rbp-58h]
char *__s; // [rsp+30h] [rbp-50h]
_QWORD __dst[2]; // [rsp+38h] [rbp-48h] BYREF
void *__p; // [rsp+48h] [rbp-38h]
unsigned int v39; // [rsp+50h] [rbp-30h]
int v40; // [rsp+54h] [rbp-2Ch]
v4 = a1;
m_customObjectButtonArray = a1->m_customObjectButtonArray;
sub_100720270(m_customObjectButtonArray);
v6 = (cocos2d::CCArray *)sub_10071F9E0(m_customObjectButtonArray, v1);
v7 = GameManager::sharedState();
OrderedCustomObjectKeys = GameManager::getOrderedCustomObjectKeys(v7);
p_src = (const char *)OrderedCustomObjectKeys;
v40 = sub_100720070(OrderedCustomObjectKeys);
v32 = v6;
if ( v40 > 0 )
{
v9 = 0;
v31 = v4;
do
{
v10 = cocos2d::CCArray::stringAtIndex(OrderedCustomObjectKeys, v9);
v11 = cocos2d::CCString::intValue(v10);
v12 = GameManager::sharedState();
p_src = &v33;
GameManager::stringForCustomObject(&v33, v12, v11);
if ( (v33 & 1) != 0 )
{
if ( v35 )
{
p_src = __s;
LABEL_9:
v39 = v11;
v13 = strlen(p_src);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v14 = v13;
if ( v13 >= 0x17 )
{
v16 = (v13 | 7) + 1;
if ( (v13 | 7) == 0x17 )
v16 = 26;
v15 = (char *)operator new(v16);
__p = v15;
__dst[0] = v16 | 1;
__dst[1] = v14;
v6 = v32;
}
else
{
LOBYTE(__dst[0]) = 2 * v13;
v15 = (char *)__dst + 1;
if ( !v13 )
{
LABEL_17:
v15[v14] = 0;
v4 = v31;
v17 = EditorUI::menuItemFromObjectString(v31, __dst, v39);
p_src = (const char *)v6;
sub_10071FCD0(v6, v17);
if ( (__dst[0] & 1) != 0 )
{
p_src = (const char *)__p;
operator delete(__p);
}
goto LABEL_19;
}
}
memmove(v15, p_src, v14);
goto LABEL_17;
}
}
else
{
p_src = &__src;
if ( v33 )
goto LABEL_9;
}
LABEL_19:
if ( (v33 & 1) != 0 )
{
p_src = __s;
operator delete(__s);
}
++v9;
}
while ( v40 != v9 );
}
m_customTabControls = v4->m_customTabControls;
if ( !m_customTabControls )
{
v19 = (cocos2d::CCObject *)sub_10071F9E0(p_src, 0);
v4->m_customTabControls = (cocos2d::CCArray *)v19;
cocos2d::CCObject::retain(v19);
v20 = cocos2d::CCSprite::createWithSpriteFrameName("edit_upBtn_001.png");
sub_10028CC60(&v33, &qword_10099EC08);
MenuItemButton = EditorUI::getCreateMenuItemButton(
v4,
v20,
(cocos2d::SEL_MenuHandler)(unsigned __int64)EditorUI::orderUpCustomItem,
nullptr,
0.89999998,
5,
v3);
sub_10071FCD0(v4->m_customTabControls, MenuItemButton);
v22 = cocos2d::CCSprite::createWithSpriteFrameName("edit_downBtn_001.png");
sub_10028CC60(&v33, &qword_10099EC08);
v23 = EditorUI::getCreateMenuItemButton(
v4,
v22,
(cocos2d::SEL_MenuHandler)(unsigned __int64)EditorUI::orderDownCustomItem,
nullptr,
0.89999998,
5,
v3);
sub_10071FCD0(v4->m_customTabControls, v23);
v24 = cocos2d::CCSprite::createWithSpriteFrameName("edit_addCBtn_001.png");
sub_10028CC60(&v33, &qword_10099EC08);
v25 = EditorUI::getCreateMenuItemButton(
v4,
v24,
(cocos2d::SEL_MenuHandler)(unsigned __int64)EditorUI::onNewCustomItem,
nullptr,
0.89999998,
1,
v3);
sub_10071FCD0(v4->m_customTabControls, v25);
v26 = cocos2d::CCSprite::createWithSpriteFrameName("edit_delCBtn_001.png");
sub_10028CC60(&v33, &qword_10099EC08);
v27 = v26;
v6 = v32;
v28 = EditorUI::getCreateMenuItemButton(
v4,
v27,
(cocos2d::SEL_MenuHandler)(unsigned __int64)EditorUI::onDeleteCustomItem,
nullptr,
0.89999998,
6,
v3);
sub_10071FCD0(v4->m_customTabControls, v28);
m_customTabControls = v4->m_customTabControls;
}
sub_100720050(v6, m_customTabControls);
return v6;
}