//
// EditorUI::createCustomItems from 0x1401f6210 to 0x1401f6766 (1366 bytes)
//
// 3 xrefs:
// > EditorUI::setupCreateMenu @ 0x1401effa1
// > EditorUI::reloadCustomItems @ 0x1401f6993
// > ??> @ 0x14091aaa4
//
// This function is hookable on this platform (idp: pc, 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 11:28:09 +0000
//
// Hidden C++ exception states: #wind=3
cocos2d::CCArray *__fastcall EditorUI::createCustomItems(__int64 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
char *v14; // rax
cocos2d::CCObject *v15; // rax
const struct cocos2d::CCPoint *v16; // rax
const struct cocos2d::CCPoint *v17; // rsi
int v18; // eax
__int64 v19; // r8
__int64 *v20; // rdi
__int64 v21; // rdx
char *v22; // rbx
__int64 v23; // rax
const struct cocos2d::CCPoint *v24; // rax
const struct cocos2d::CCPoint *v25; // rsi
int v26; // eax
__int64 v27; // r8
__int64 *v28; // rdi
__int64 v29; // rdx
char *v30; // rbx
__int64 v31; // rax
const struct cocos2d::CCPoint *v32; // rax
const struct cocos2d::CCPoint *v33; // rsi
int v34; // eax
__int64 v35; // r8
__int64 *v36; // rdi
__int64 v37; // rdx
char *v38; // rbx
__int64 v39; // rax
const struct cocos2d::CCPoint *v40; // rax
const struct cocos2d::CCPoint *v41; // rsi
int v42; // eax
__int64 v43; // r8
__int64 *v44; // rdi
__int64 v45; // rdx
char *v46; // rbx
__int64 v47; // rax
void *v49; // [rsp+50h] [rbp-C8h] BYREF
_BYTE v50[8]; // [rsp+58h] [rbp-C0h] BYREF
__int128 v51; // [rsp+60h] [rbp-B8h] BYREF
__int64 v52; // [rsp+70h] [rbp-A8h]
__int64 v53; // [rsp+78h] [rbp-A0h]
_QWORD v54[4]; // [rsp+80h] [rbp-98h] BYREF
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(a1 + 1408));
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(v2);
v4 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v49 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v49);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v4 = qword_14090BFD0;
}
v5 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(v4 + 464));
if ( cocos2d::CCArray::count(v5) )
qsort(*(void **)(*((_QWORD *)v5 + 7) + 16LL), **((unsigned int **)v5 + 7), 8u, sub_1402760B0);
v7 = cocos2d::CCArray::count(v5);
for ( i = 0; i < v7; ++i )
{
v9 = cocos2d::CCArray::stringAtIndex(v5, i);
v10 = cocos2d::CCString::intValue(v9);
v11 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v49 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v49);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v11 = qword_14090BFD0;
}
GameManager::stringForCustomObject(v11, v54, v10);
if ( v54[2] )
{
v12 = v54;
if ( v54[3] > 0xFu )
v12 = (_QWORD *)v54[0];
v51 = 0;
v52 = 0;
v53 = 0;
v13 = -1;
do
++v13;
while ( *((_BYTE *)v12 + v13) );
sub_14003D230(&v51, v12, v13);
v14 = EditorUI::menuItemFromObjectString(a1, (__int64)&v51, v10);
cocos2d::CCArray::addObject(v3, (struct cocos2d::CCObject *)v14);
}
sub_14003D310((__int64)v54);
}
if ( !*(_QWORD *)(a1 + 960) )
{
v15 = (cocos2d::CCObject *)cocos2d::CCArray::create(v6);
*(_QWORD *)(a1 + 960) = v15;
cocos2d::CCObject::retain(v15);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, (const struct cocos2d::CCPoint *)&unk_14090A768);
v17 = v16;
v18 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("edit_upBtn_001.png");
v20 = (__int64 *)ButtonSprite::create(v18, 32, v19, 32.0, 1065353216);
v22 = CreateMenuItem::create(v20, v21, a1, (__int64)EditorUI::orderUpCustomItem);
(*(void (__fastcall **)(char *))(*(_QWORD *)v22 + 160LL))(v22);
*((_DWORD *)v22 + 101) = 1063675494;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, v17);
cocos2d::CCPoint::operator=(v20 + 84, v23);
ButtonSprite::updateSpriteBGSize(v20);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 960), (struct cocos2d::CCObject *)v22);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, (const struct cocos2d::CCPoint *)&unk_14090A768);
v25 = v24;
v26 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("edit_downBtn_001.png");
v28 = (__int64 *)ButtonSprite::create(v26, 32, v27, 32.0, 1065353216);
v30 = CreateMenuItem::create(v28, v29, a1, (__int64)EditorUI::orderDownCustomItem);
(*(void (__fastcall **)(char *))(*(_QWORD *)v30 + 160LL))(v30);
*((_DWORD *)v30 + 101) = 1063675494;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, v25);
cocos2d::CCPoint::operator=(v28 + 84, v31);
ButtonSprite::updateSpriteBGSize(v28);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 960), (struct cocos2d::CCObject *)v30);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, (const struct cocos2d::CCPoint *)&unk_14090A768);
v33 = v32;
v34 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("edit_addCBtn_001.png");
v36 = (__int64 *)ButtonSprite::create(v34, 32, v35, 32.0, 1065353216);
v38 = CreateMenuItem::create(v36, v37, a1, (__int64)EditorUI::onNewCustomItem);
(*(void (__fastcall **)(char *))(*(_QWORD *)v38 + 160LL))(v38);
*((_DWORD *)v38 + 101) = 1063675494;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, v33);
cocos2d::CCPoint::operator=(v36 + 84, v39);
ButtonSprite::updateSpriteBGSize(v36);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 960), (struct cocos2d::CCObject *)v38);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, (const struct cocos2d::CCPoint *)&unk_14090A768);
v41 = v40;
v42 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("edit_delCBtn_001.png");
v44 = (__int64 *)ButtonSprite::create(v42, 32, v43, 32.0, 1065353216);
v46 = CreateMenuItem::create(v44, v45, a1, (__int64)EditorUI::onDeleteCustomItem);
(*(void (__fastcall **)(char *))(*(_QWORD *)v46 + 160LL))(v46);
*((_DWORD *)v46 + 101) = 1063675494;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, v41);
cocos2d::CCPoint::operator=(v44 + 84, v47);
ButtonSprite::updateSpriteBGSize(v44);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 960), (struct cocos2d::CCObject *)v46);
}
cocos2d::CCArray::addObjectsFromArray(v3, *(struct cocos2d::CCArray **)(a1 + 960));
return v3;
}