//
// GameManager::addNewCustomObject from 0x10036dcc0 to 0x10036de36 (374 bytes)
//
// 1 xrefs:
// > EditorUI::onNewCustomItem @ 0x10063c810
//
// 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:29:01 +0000
//
__int64 __fastcall GameManager::addNewCustomObject(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
unsigned int *v3; // rax
_QWORD *v4; // r12
unsigned __int64 v5; // r13
int v6; // ebx
int v7; // eax
unsigned int v8; // ebx
__int64 v9; // r15
__int64 v10; // r14
__int64 v11; // rax
const char *CString; // r13
size_t v13; // rax
size_t v14; // r12
char *v15; // r15
size_t v16; // r14
char v18; // [rsp+0h] [rbp-50h]
__int64 v19; // [rsp+0h] [rbp-50h]
__int64 v20; // [rsp+8h] [rbp-48h]
_QWORD __dst[2]; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
v2 = cocos2d::CCDictionary::allKeys(*(_QWORD *)(a1 + 456));
if ( (unsigned int)sub_1007FEF90(v2) )
{
qsort(
*(void **)(*(_QWORD *)(v2 + 56) + 16LL),
**(unsigned int **)(v2 + 56),
8u,
(int (__cdecl *)(const void *, const void *))sub_10035FC40);
}
else if ( !v2 )
{
LABEL_11:
v8 = -1;
goto LABEL_12;
}
v3 = *(unsigned int **)(v2 + 56);
if ( !*v3 )
goto LABEL_11;
v4 = *((_QWORD **)v3 + 2);
v5 = (unsigned __int64)&v4[*v3 - 1];
v6 = 0;
do
{
if ( !*v4 )
break;
v7 = cocos2d::CCString::intValue(*v4);
if ( v7 < v6 )
v6 = v7;
++v4;
}
while ( (unsigned __int64)v4 <= v5 );
v8 = v6 - 1;
LABEL_12:
v9 = *(_QWORD *)(a1 + 456);
v10 = sub_10088E600(a2);
v11 = sub_10088E820("%i", v18);
CString = (const char *)cocos2d::CCString::getCString(v11);
v13 = strlen(CString);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v14 = v13;
v19 = v9;
if ( v13 >= 0x17 )
{
v20 = v10;
v16 = 26;
if ( (v13 | 7) != 0x17 )
v16 = (v13 | 7) + 1;
v15 = (char *)operator new(v16);
__p = v15;
__dst[0] = v16 + 1;
v10 = v20;
__dst[1] = v14;
goto LABEL_19;
}
LOBYTE(__dst[0]) = 2 * v13;
v15 = (char *)__dst + 1;
if ( v13 )
LABEL_19:
memmove(v15, CString, v14);
v15[v14] = 0;
cocos2d::CCDictionary::setObject(v19, v10, (char *)__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
return v8;
}