//
// cocos2d::CCComponentContainer::add from 0x1002b1f60 to 0x1002b215f (511 bytes)
//
// 1 xrefs:
// > ??> @ 0x100b0e6d8
//
// 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:28:02 +0000
//
__int64 __fastcall cocos2d::CCComponentContainer::add(__int64 a1, __int64 a2)
{
__int64 v2; // r14
__int64 v3; // r15
__int64 v4; // rax
const char *Name; // r13
size_t v6; // rax
size_t v7; // r12
char *v8; // rbx
size_t v9; // r14
const void *v10; // rax
__int64 v11; // rbx
const char *v12; // r13
size_t v13; // rax
size_t v14; // r12
char *v15; // rbx
size_t v16; // r14
__int64 v18; // [rsp+0h] [rbp-50h]
__int64 v19; // [rsp+8h] [rbp-48h]
size_t __dst; // [rsp+10h] [rbp-40h] BYREF
size_t v21; // [rsp+18h] [rbp-38h]
void *__p; // [rsp+20h] [rbp-30h]
v2 = a2;
cocos2d::CCComponent::getOwner(a2);
v3 = *(_QWORD *)(a1 + 8);
if ( !v3 )
{
v4 = cocos2d::CCDictionary::create(a2, a2);
*(_QWORD *)(a1 + 8) = v4;
cocos2d::CCObject::retain(v4);
v3 = *(_QWORD *)(a1 + 8);
}
Name = (const char *)cocos2d::CCComponent::getName(a2);
v6 = strlen(Name);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_29;
v7 = v6;
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
__p = v8;
__dst = v9 + 1;
v2 = a2;
v21 = v7;
goto LABEL_10;
}
LOBYTE(__dst) = 2 * v6;
v8 = (char *)&__dst + 1;
if ( v6 )
LABEL_10:
memmove(v8, Name, v7);
v8[v7] = 0;
v10 = (const void *)cocos2d::CCDictionary::objectForKey(v3, &__dst);
if ( v10 )
{
LOBYTE(v3) = __dynamic_cast(
v10,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCComponent,
0) == nullptr;
if ( (__dst & 1) == 0 )
goto LABEL_14;
goto LABEL_13;
}
LOBYTE(v3) = 1;
if ( (__dst & 1) != 0 )
LABEL_13:
operator delete(__p);
LABEL_14:
if ( !(_BYTE)v3 )
return (unsigned int)v3;
cocos2d::CCComponent::setOwner(v2, *(_QWORD *)(a1 + 16));
v11 = *(_QWORD *)(a1 + 8);
v12 = (const char *)cocos2d::CCComponent::getName(v2);
v13 = strlen(v12);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_29:
sub_100003630();
v14 = v13;
v19 = v11;
if ( v13 >= 0x17 )
{
v18 = v2;
v16 = 26;
if ( (v13 | 7) != 0x17 )
v16 = (v13 | 7) + 1;
v15 = (char *)operator new(v16);
__p = v15;
__dst = v16 + 1;
v2 = v18;
v21 = v14;
}
else
{
LOBYTE(__dst) = 2 * v13;
v15 = (char *)&__dst + 1;
if ( !v13 )
goto LABEL_25;
}
memmove(v15, v12, v14);
LABEL_25:
v15[v14] = 0;
cocos2d::CCDictionary::setObject(v19, v2, &__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v2 + 88LL))(v2);
return (unsigned int)v3;
}