//
// EditorUI::createCustomItems from 0x100638500 to 0x100638827 (807 bytes)
//
// 6 xrefs:
// > EditorUI::setupCreateMenu @ 0x100637867
// > EditorUI::onNewCustomItem @ 0x10063c866
// > EditorUI::reloadCustomItems @ 0x10063c946
// > EditorUI::onDeleteCustomItem @ 0x10063c9dd
// > EditorUI::orderUpCustomItem @ 0x10063ca94
// > EditorUI::orderDownCustomItem @ 0x10063cb51
//
// 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 12:34:39 +0000
//
__int64 __fastcall EditorUI::createCustomItems(__int64 a1, double a2)
{
__int64 v2; // r12
__int64 v3; // rdi
__int64 v4; // r14
__int64 v5; // rax
const char *v6; // rdi
unsigned int v7; // r13d
__int64 v8; // rax
unsigned int v9; // r15d
__int64 v10; // rax
size_t v11; // rax
size_t v12; // r15
char *v13; // r12
size_t v14; // r14
__int64 v15; // rax
__int64 v16; // rsi
__int64 v17; // rax
char *v18; // r14
float *MenuItemButton; // rax
char *v20; // r14
float *v21; // rax
char *v22; // r14
float *v23; // rax
char *v24; // r14
__int64 v25; // rsi
float *v26; // rax
__int64 OrderedCustomObjectKeys; // [rsp+8h] [rbp-78h]
__int64 v29; // [rsp+10h] [rbp-70h]
__int64 v30; // [rsp+18h] [rbp-68h]
char *v31[2]; // [rsp+20h] [rbp-60h] BYREF
char *__s; // [rsp+30h] [rbp-50h]
_QWORD __dst[2]; // [rsp+38h] [rbp-48h] BYREF
void *__p; // [rsp+48h] [rbp-38h]
unsigned int v35; // [rsp+50h] [rbp-30h]
int v36; // [rsp+54h] [rbp-2Ch]
v2 = a1;
v3 = *(_QWORD *)(a1 + 1360);
sub_1007FF190(v3);
v4 = sub_1007FE900(v3);
v5 = GameManager::sharedState();
OrderedCustomObjectKeys = GameManager::getOrderedCustomObjectKeys(v5);
v6 = (const char *)OrderedCustomObjectKeys;
v36 = sub_1007FEF90(OrderedCustomObjectKeys);
v30 = v4;
if ( v36 > 0 )
{
v7 = 0;
v29 = v2;
do
{
v8 = cocos2d::CCArray::stringAtIndex(OrderedCustomObjectKeys, v7);
v9 = cocos2d::CCString::intValue(v8);
v10 = GameManager::sharedState();
v6 = (const char *)v31;
GameManager::stringForCustomObject(v31, v10);
if ( ((__int64)v31[0] & 1) != 0 )
{
if ( v31[1] )
{
v6 = __s;
LABEL_9:
v35 = v9;
v11 = strlen(v6);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v12 = v11;
if ( v11 >= 0x17 )
{
v14 = (v11 | 7) + 1;
if ( (v11 | 7) == 0x17 )
v14 = 26;
v13 = (char *)operator new(v14);
__p = v13;
__dst[0] = v14 | 1;
__dst[1] = v12;
v4 = v30;
}
else
{
LOBYTE(__dst[0]) = 2 * v11;
v13 = (char *)__dst + 1;
if ( !v11 )
{
LABEL_17:
v13[v12] = 0;
v2 = v29;
v15 = EditorUI::menuItemFromObjectString(v29, __dst, v35);
v6 = (const char *)v4;
sub_1007FEBF0(v4, v15);
if ( (__dst[0] & 1) != 0 )
{
v6 = (const char *)__p;
operator delete(__p);
}
goto LABEL_19;
}
}
memmove(v13, v6, v12);
goto LABEL_17;
}
}
else
{
v6 = (char *)v31 + 1;
if ( LOBYTE(v31[0]) )
goto LABEL_9;
}
LABEL_19:
if ( ((__int64)v31[0] & 1) != 0 )
{
v6 = __s;
operator delete(__s);
}
++v7;
}
while ( v36 != v7 );
}
v16 = *(_QWORD *)(v2 + 912);
if ( !v16 )
{
v17 = sub_1007FE900(v6);
*(_QWORD *)(v2 + 912) = v17;
cocos2d::CCObject::retain(v17);
v18 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"edit_upBtn_001.png", a2);
sub_1002782D0(v31, &qword_100BE5A88);
MenuItemButton = EditorUI::getCreateMenuItemButton(
v2,
(__int64)v18,
(__int64)EditorUI::orderUpCustomItem,
0,
0,
5,
0.89999998,
(__int64)v31);
sub_1007FEBF0(*(_QWORD *)(v2 + 912), MenuItemButton);
v20 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"edit_downBtn_001.png", COERCE_DOUBLE(1063675494));
sub_1002782D0(v31, &qword_100BE5A88);
v21 = EditorUI::getCreateMenuItemButton(
v2,
(__int64)v20,
(__int64)EditorUI::orderDownCustomItem,
0,
0,
5,
0.89999998,
(__int64)v31);
sub_1007FEBF0(*(_QWORD *)(v2 + 912), v21);
v22 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"edit_addCBtn_001.png", COERCE_DOUBLE(1063675494));
sub_1002782D0(v31, &qword_100BE5A88);
v23 = EditorUI::getCreateMenuItemButton(
v2,
(__int64)v22,
(__int64)EditorUI::onNewCustomItem,
0,
0,
1,
0.89999998,
(__int64)v31);
sub_1007FEBF0(*(_QWORD *)(v2 + 912), v23);
v24 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"edit_delCBtn_001.png", COERCE_DOUBLE(1063675494));
sub_1002782D0(v31, &qword_100BE5A88);
v25 = (__int64)v24;
v4 = v30;
v26 = EditorUI::getCreateMenuItemButton(
v2,
v25,
(__int64)EditorUI::onDeleteCustomItem,
0,
0,
6,
0.89999998,
(__int64)v31);
sub_1007FEBF0(*(_QWORD *)(v2 + 912), v26);
v16 = *(_QWORD *)(v2 + 912);
}
sub_1007FEF70(v4, v16);
return v4;
}