//
// cocos2d::CCComponentContainer::remove_1 from 0x1002c5390 to 0x1002c5657 (711 bytes)
//
// 1 xrefs:
// > ??> @ 0x100907030
//
// 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
//
bool __fastcall cocos2d::CCComponentContainer::remove_1(cocos2d::CCComponentContainer *a1, const char *a2)
{
cocos2d::CCDictionary *m_pComponents; // rax
cocos2d::CCDictElement *m_pElements; // rax
int v4; // ecx
int v5; // r9d
unsigned int v6; // edx
unsigned int v7; // ecx
int v8; // r8d
unsigned int v9; // r9d
unsigned int v10; // edx
int v11; // ecx
unsigned int v12; // r8d
UT_hash_table *tbl; // rcx
UT_hash_handle *hh_head; // rdx
__int64 v15; // rbx
bool v16; // r14
cocos2d::CCComponent *v17; // rax
cocos2d::CCComponent *v18; // r15
__int64 v19; // rcx
cocos2d::CCDictionary *v20; // rsi
cocos2d::CCDictElement *v21; // rax
cocos2d::CCDictElement **p_m_pElements; // rsi
UT_hash_table *v23; // rdx
std::ptrdiff_t hho; // rdi
cocos2d::CCDictElement *v25; // r8
cocos2d::CCDictElement **v26; // rdi
UT_hash_table *v27; // rax
UT_hash_bucket *buckets; // rsi
__int64 v30; // rcx
__int64 v31; // rcx
__int64 v32; // rdx
m_pComponents = a1->m_pComponents;
if ( !m_pComponents )
return 0;
m_pElements = m_pComponents->m_pElements;
if ( !m_pElements )
return 0;
v4 = *((_DWORD *)a2 + 1) - 1640531527;
v5 = (*(unsigned __int8 *)a2
+ (*((unsigned __int8 *)a2 + 2) << 16)
+ (*((unsigned __int8 *)a2 + 1) << 8)
+ (*((unsigned __int8 *)a2 + 3) << 24)
- v4
- 1622558014)
^ 0x7F76D;
v6 = (v4 - v5 + 17973513) ^ (v5 << 8);
v7 = (-17973513 - v5 - v6) ^ (v6 >> 13);
v8 = (v5 - v6 - v7) ^ (v7 >> 12);
v9 = (v6 - v7 - v8) ^ (v8 << 16);
v10 = (v7 - v8 - v9) ^ (v9 >> 5);
v11 = (v8 - v9 - v10) ^ (v10 >> 3);
v12 = (v10 - (((v9 - v10 - v11) ^ (v11 << 10)) + v11)) ^ (((v9 - v10 - v11) ^ (v11 << 10)) >> 15);
tbl = m_pElements->hh.tbl;
hh_head = tbl->buckets[v12 & (tbl->num_buckets - 1)].hh_head;
if ( !hh_head )
return 0;
while ( 1 )
{
v15 = (__int64)hh_head - tbl->hho;
if ( *(_DWORD *)(v15 + 320) == 8 && **(_QWORD **)(v15 + 312) == *(_QWORD *)a2 )
break;
hh_head = *(UT_hash_handle **)(v15 + 304);
if ( !hh_head )
return 0;
}
if ( !*(_QWORD *)(v15 + 264) )
return 0;
v16 = 0;
v17 = (cocos2d::CCComponent *)__dynamic_cast(
*(const void **)(v15 + 264),
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCComponent,
0);
if ( v17 )
{
v18 = v17;
((void (__fastcall *)(cocos2d::CCComponent *))v17->onExit)(v17);
cocos2d::CCComponent::setOwner(v18, nullptr);
v19 = *(_QWORD *)(v15 + 280);
if ( v19 || *(_QWORD *)(v15 + 288) )
{
v20 = a1->m_pComponents;
v21 = v20->m_pElements;
p_m_pElements = &v20->m_pElements;
v23 = v21->hh.tbl;
hho = v23->hho;
if ( (UT_hash_handle *)v15 == (UT_hash_handle *)((char *)v23->tail - hho) )
v23->tail = (UT_hash_handle *)(hho + v19);
v25 = *(cocos2d::CCDictElement **)(v15 + 288);
v26 = (cocos2d::CCDictElement **)(hho + v19 + 16);
if ( !v19 )
{
v26 = p_m_pElements;
v21 = *(cocos2d::CCDictElement **)(v15 + 288);
}
*v26 = v25;
v27 = v21->hh.tbl;
if ( v25 )
*(_QWORD *)&v25->m_szKey[v27->hho + 8] = v19;
buckets = v27->buckets;
v30 = *(_DWORD *)(v15 + 324) & (v27->num_buckets - 1);
--buckets[v30].count;
if ( buckets[v30].hh_head == (UT_hash_handle *)(v15 + 272) )
buckets[v30].hh_head = *(UT_hash_handle **)(v15 + 304);
v31 = *(_QWORD *)(v15 + 296);
v32 = *(_QWORD *)(v15 + 304);
if ( v31 )
*(_QWORD *)(v31 + 32) = v32;
if ( v32 )
*(_QWORD *)(v32 + 24) = v31;
--v27->num_items;
}
else
{
free(a1->m_pComponents->m_pElements->hh.tbl->buckets);
free(a1->m_pComponents->m_pElements->hh.tbl);
a1->m_pComponents->m_pElements = nullptr;
}
cocos2d::CCObject::release(*(cocos2d::CCObject **)(v15 + 264));
sub_10030D9D0(v15);
operator delete((void *)v15);
return 1;
}
return v16;
}