//
// cocos2d::CCComponentContainer::remove from 0x1002c5660 to 0x1002c57fb (411 bytes)
//
// 1 xrefs:
// > ??> @ 0x100907038
//
// 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(cocos2d::CCComponentContainer *a1, cocos2d::CCComponent *a2)
{
cocos2d::CCDictionary *m_pComponents; // r15
cocos2d::CCDictElement *m_pElements; // rbx
char *prev; // rcx
cocos2d::CCDictionary *v5; // rsi
cocos2d::CCDictElement *v6; // rax
cocos2d::CCDictElement **p_m_pElements; // rsi
UT_hash_table *tbl; // rdx
std::ptrdiff_t hho; // rdi
cocos2d::CCDictElement *next; // r8
cocos2d::CCDictElement **v11; // rdi
UT_hash_table *v12; // rax
UT_hash_bucket *buckets; // rsi
__int64 v14; // rcx
UT_hash_handle *hh_prev; // rcx
UT_hash_handle *hh_next; // rdx
m_pComponents = a1->m_pComponents;
if ( m_pComponents )
{
m_pElements = m_pComponents->m_pElements;
if ( m_pElements )
{
while ( m_pElements->m_pObject != a2 )
{
m_pElements = (cocos2d::CCDictElement *)m_pElements->hh.next;
if ( !m_pElements )
return m_pComponents != nullptr;
}
((void (__fastcall *)(cocos2d::CCComponent *))a2->onExit)(a2);
cocos2d::CCComponent::setOwner(a2, nullptr);
prev = (char *)m_pElements->hh.prev;
if ( *(_OWORD *)&m_pElements->hh.prev == 0 )
{
free(a1->m_pComponents->m_pElements->hh.tbl->buckets);
free(a1->m_pComponents->m_pElements->hh.tbl);
a1->m_pComponents->m_pElements = nullptr;
}
else
{
v5 = a1->m_pComponents;
v6 = v5->m_pElements;
p_m_pElements = &v5->m_pElements;
tbl = v6->hh.tbl;
hho = tbl->hho;
if ( m_pElements == (cocos2d::CCDictElement *)((char *)tbl->tail - hho) )
tbl->tail = (UT_hash_handle *)&prev[hho];
next = (cocos2d::CCDictElement *)m_pElements->hh.next;
v11 = (cocos2d::CCDictElement **)&prev[hho + 16];
if ( !prev )
{
v11 = p_m_pElements;
v6 = (cocos2d::CCDictElement *)m_pElements->hh.next;
}
*v11 = next;
v12 = v6->hh.tbl;
if ( next )
*(_QWORD *)&next->m_szKey[v12->hho + 8] = prev;
buckets = v12->buckets;
v14 = m_pElements->hh.hashv & (v12->num_buckets - 1);
--buckets[v14].count;
if ( buckets[v14].hh_head == &m_pElements->hh )
buckets[v14].hh_head = m_pElements->hh.hh_next;
hh_prev = m_pElements->hh.hh_prev;
hh_next = m_pElements->hh.hh_next;
if ( hh_prev )
hh_prev->hh_next = hh_next;
if ( hh_next )
hh_next->hh_prev = hh_prev;
--v12->num_items;
}
cocos2d::CCObject::release(m_pElements->m_pObject);
sub_10030D9D0(m_pElements);
operator delete(m_pElements);
}
}
return m_pComponents != nullptr;
}