//
// cocos2d::CCComponentContainer::add from 0xda0630 to 0xda0858 (552 bytes)
//
// 2 xrefs:
// > ??> @ 0xf7df8
// > ??> @ 0x152fa48
//
// This function is hookable on this platform (idp: arm, 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 13:08:29 +0000
//
__int64 __fastcall cocos2d::CCComponentContainer::add(cocos2d::CCComponentContainer *this, cocos2d::CCComponent *a2)
{
cocos2d::CCDictionary *Owner; // x0
__int64 v5; // x23
char *Name; // x26
size_t v7; // x0
size_t v8; // x19
char *v9; // x3
const void *v10; // x0
void *v11; // x19
__int64 result; // x0
unsigned __int64 v13; // x0
__int64 v14; // x23
char *v15; // x0
char *v16; // x25
size_t v17; // x0
size_t v18; // x19
char *v19; // x3
cocos2d::CCDictionary *v20; // x0
unsigned __int64 v21; // x0
__int64 v22; // x22
char *v23; // x0
__int64 v24; // [xsp+50h] [xbp+50h] BYREF
size_t v25; // [xsp+58h] [xbp+58h]
void *v26; // [xsp+60h] [xbp+60h]
Owner = (cocos2d::CCDictionary *)cocos2d::CCComponent::getOwner(a2);
v5 = *((_QWORD *)this + 1);
if ( !v5 )
{
v20 = cocos2d::CCDictionary::create(Owner);
*((_QWORD *)this + 1) = v20;
cocos2d::CCObject::retain((__int64)v20);
v5 = *((_QWORD *)this + 1);
}
v24 = 0;
Name = cocos2d::CCComponent::getName(a2);
v25 = 0;
v26 = nullptr;
v7 = strlen(Name);
v8 = v7;
if ( v7 > 0x16 )
{
v13 = (v7 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v24 = v13 | 1;
v9 = (char *)operator new(v13);
v26 = v9;
v25 = v8;
}
else
{
LOBYTE(v24) = 2 * v7;
v9 = (char *)&v24 + 1;
if ( !v7 )
{
BYTE1(v24) = 0;
v10 = (const void *)cocos2d::CCDictionary::objectForKey(v5, (__int64)&v24);
if ( v10 )
goto LABEL_6;
goto LABEL_11;
}
}
*((_BYTE *)memcpy(v9, Name, v8) + v8) = 0;
v10 = (const void *)cocos2d::CCDictionary::objectForKey(v5, (__int64)&v24);
if ( v10 )
{
LABEL_6:
v11 = _dynamic_cast(
v10,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCComponent,
0);
if ( (v24 & 1) == 0 )
goto LABEL_7;
goto LABEL_18;
}
LABEL_11:
if ( (v24 & 1) == 0 )
goto LABEL_12;
v11 = nullptr;
LABEL_18:
operator delete(v26);
LABEL_7:
result = 0;
if ( v11 )
return result;
LABEL_12:
cocos2d::CCComponent::setOwner((__int64)a2, *((cocos2d::CCNode **)this + 2));
v14 = *((_QWORD *)this + 1);
v15 = cocos2d::CCComponent::getName(a2);
v24 = 0;
v16 = v15;
v25 = 0;
v26 = nullptr;
v17 = strlen(v15);
v18 = v17;
if ( v17 > 0x16 )
{
v21 = (v17 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v22 = v21 | 1;
v23 = (char *)operator new(v21);
v24 = v22;
v19 = v23;
v26 = v23;
v25 = v18;
goto LABEL_20;
}
LOBYTE(v24) = 2 * v17;
v19 = (char *)&v24 + 1;
if ( v17 )
LABEL_20:
v19 = (char *)memcpy(v19, v16, v18);
v19[v18] = 0;
cocos2d::CCDictionary::setObject(v14, a2, (__int64)&v24);
if ( (v24 & 1) != 0 )
operator delete(v26);
(*(void (__fastcall **)(cocos2d::CCComponent *))(*(_QWORD *)a2 + 88LL))(a2);
return 1;
}