//
// EditorUI::onNewCustomItem from 0x3a6650 to 0x3a67f4 (420 bytes)
//
// 0 xrefs:
//
// 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
//
void EditorUI::onNewCustomItem(EditorUI *a1, cocos2d::CCObject *a2)
{
cocos2d::CCArray *m_selectedObjects; // r0
GameManager *v4; // r0
cocos2d::CCString *v5; // r0
char *v6; // r0
FLAlertLayer *v7; // r6
cocos2d::CCString *v8; // r0
char *CString; // r0
FLAlertLayer *v10; // r6
GameObject *m_selectedObject; // r3
cocos2d::CCArray *v12; // r6
GameManager *v13; // r8
int v14; // r2
int v15; // r3
char *v16; // [sp+Ch] [bp-Ch] BYREF
char v17; // [sp+10h] [bp-8h] BYREF
m_selectedObjects = a1->m_selectedObjects;
if ( m_selectedObjects && cocos2d::CCArray::count(m_selectedObjects) > 0x3E8u )
{
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"A custom object cannot contain more than %i objects.",
(const char *)&stru_3DC.st_info);
CString = (char *)cocos2d::CCString::getCString(v8);
sub_776584((int)&v16, CString);
sub_776584((int)&v17, v16);
v10 = FLAlertLayer::create(0, (int)"Max Limit", (int)&v17, (int)"OK", 0, 340.0);
sub_774008(&v17);
v10->show(v10);
goto LABEL_9;
}
v4 = GameManager::sharedState();
if ( cocos2d::CCDictionary::count(v4->m_customObjectDict) > 0xC7 )
{
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"You cannot create more than %i custom objects.",
(const char *)&dword_C8);
v6 = (char *)cocos2d::CCString::getCString(v5);
sub_776584((int)&v16, v6);
sub_776584((int)&v17, v16);
v7 = FLAlertLayer::create(0, (int)"Max Custom Objects", (int)&v17, (int)"OK", 0, 340.0);
sub_774008(&v17);
v7->show(v7);
LABEL_9:
sub_774008(&v16);
return;
}
if ( a1->m_selectedObject || cocos2d::CCArray::count(a1->m_selectedObjects) )
{
m_selectedObject = a1->m_selectedObject;
if ( !m_selectedObject || m_selectedObject->m_objectID != 749 )
{
if ( cocos2d::CCArray::count(a1->m_selectedObjects) )
{
v12 = a1->m_selectedObjects;
}
else
{
v12 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
cocos2d::CCArray::addObject(v12, a1->m_selectedObject);
}
EditorUI::copyObjects((EditorUI *)&v16, (cocos2d::CCArray *)a1, (int)v12, 0, 0);
if ( *((_DWORD *)v16 - 3) )
{
if ( cocos2d::CCArray::count(a1->m_selectedObjects) <= 0x3E8u )
{
v13 = GameManager::sharedState();
sub_775C20(&v17, &v16);
GameManager::addNewCustomObject(v13, (cocos2d::CCString *)&v17, v14, v15);
sub_774008(&v17);
a1->m_selectedObjectIndex = 0;
EditorUI::reloadCustomItems(a1);
}
}
goto LABEL_9;
}
}
}