//
// EditorUI::onNewCustomItem from 0x6f68f8 to 0x6f6b04 (524 bytes)
//
// 1 xrefs:
// > EditorUI::handleEditorAction @ 0x6f227e
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:57:39 +0000
//
unsigned int __fastcall EditorUI::onNewCustomItem(EditorUI *this, cocos2d::CCObject *a2)
{
cocos2d::CCArray *v3; // r0
int v4; // r0
unsigned int result; // r0
cocos2d::CCString *v6; // r0
char *v7; // r7
size_t v8; // r0
size_t v9; // r0
int *v10; // r7
int v11; // r3
cocos2d::CCArray *v12; // r7
int v13; // r3
cocos2d::CCString *v14; // r0
const char *CString; // r6
size_t v16; // r0
char *v17; // r6
size_t v18; // r0
int *v19; // r6
GameManager *v20; // r0
int v21; // r8
int v22; // [sp+Ch] [bp-1Ch] BYREF
int v23; // [sp+10h] [bp-18h]
char *v24; // [sp+14h] [bp-14h]
int v25; // [sp+18h] [bp-10h] BYREF
int v26; // [sp+1Ch] [bp-Ch]
int v27; // [sp+20h] [bp-8h]
v3 = *((cocos2d::CCArray **)this + 167);
if ( v3 )
{
v3 = (cocos2d::CCArray *)cocos2d::CCArray::count(v3);
if ( (unsigned int)v3 > 0x3E8 )
{
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"A custom object cannot contain more than %i objects.",
(const char *)&stru_3DC.st_info);
v22 = 0;
v23 = 0;
v24 = nullptr;
CString = (const char *)cocos2d::CCString::getCString(v14);
v16 = strlen(CString);
std::string::__init(&v22, CString, v16);
if ( (v22 & 1) != 0 )
v17 = v24;
else
v17 = (char *)&v22 + 1;
v25 = 0;
v26 = 0;
v27 = 0;
v18 = strlen(v17);
std::string::__init(&v25, v17, v18);
v19 = FLAlertLayer::create(
0,
(cocos2d::CCLabelBMFont *)"Max Limit",
(int)&v25,
(ButtonSprite *)"OK",
nullptr,
340.0);
std::string::~string((int)&v25);
(*(void (__fastcall **)(int *))(*v19 + 656))(v19);
return std::string::~string((int)&v22);
}
}
v4 = GameManager::sharedState(v3);
result = cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(v4 + 336));
if ( result > 0xC7 )
{
v6 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"You cannot create more than %i custom objects.",
(const char *)&dword_C8);
v22 = 0;
v23 = 0;
v24 = nullptr;
v7 = (char *)cocos2d::CCString::getCString(v6);
v8 = strlen(v7);
std::string::__init(&v22, v7, v8);
v25 = 0;
v26 = 0;
if ( (v22 & 1) == 0 )
v7 = (char *)&v22 + 1;
v27 = 0;
if ( (v22 & 1) != 0 )
v7 = v24;
v9 = strlen(v7);
std::string::__init(&v25, v7, v9);
v10 = FLAlertLayer::create(
0,
(cocos2d::CCLabelBMFont *)"Max Custom Objects",
(int)&v25,
(ButtonSprite *)"OK",
nullptr,
340.0);
std::string::~string((int)&v25);
(*(void (__fastcall **)(int *))(*v10 + 656))(v10);
return std::string::~string((int)&v22);
}
if ( *((_DWORD *)this + 249) || (result = cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 167))) != 0 )
{
v11 = *((_DWORD *)this + 249);
if ( !v11 || *(_DWORD *)(v11 + 892) != 749 )
{
if ( cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 167)) )
{
v12 = *((cocos2d::CCArray **)this + 167);
}
else
{
v12 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
cocos2d::CCArray::addObject(v12, *((cocos2d::CCObject **)this + 249));
}
EditorUI::copyObjects((EditorUI *)&v22, this, (int)v12, 0, 0);
if ( (v22 & 1) != 0 )
v13 = v23;
else
v13 = (int)(unsigned __int8)v22 >> 1;
if ( v13 )
{
v20 = (GameManager *)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 167));
if ( (unsigned int)v20 <= 0x3E8 )
{
v21 = GameManager::sharedState(v20);
std::string::basic_string(&v25, (int)&v22);
GameManager::addNewCustomObject(v21, (int)&v25);
std::string::~string((int)&v25);
*((_DWORD *)this + 223) = 0;
EditorUI::reloadCustomItems((EditButtonBar **)this);
}
}
return std::string::~string((int)&v22);
}
}
return result;
}