//
// cocos2d::CCComponentContainer::removeAll from 0xb2f02c to 0xb2f21c (496 bytes)
//
// 2 xrefs:
// > ??> @ 0x98ce8
// > ??> @ 0x1219a50
//
// 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
//
void cocos2d::CCComponentContainer::removeAll(cocos2d::CCComponentContainer *a1)
{
cocos2d::CCDictionary *m_pComponents; // x1
cocos2d::CCDictElement *m_pElements; // x19
char *prev; // x0
cocos2d::CCDictElement *v5; // x2
cocos2d::CCDictElement *next; // x21
UT_hash_table *v7; // x5
UT_hash_handle *p_hh; // x3
std::ptrdiff_t v9; // x1
char *v10; // x4
UT_hash_table *v11; // x4
UT_hash_bucket *buckets; // x5
__int64 v13; // x1
UT_hash_handle *hh_head; // x6
UT_hash_handle *hh_next; // x2
UT_hash_handle *hh_prev; // x0
__int64 *m_pObject; // x0
__int64 v18; // x2
UT_hash_table *tbl; // x4
UT_hash_handle *hho; // x5
m_pComponents = a1->m_pComponents;
if ( m_pComponents )
{
m_pElements = m_pComponents->m_pElements;
if ( m_pElements )
{
prev = (char *)m_pElements->hh.prev;
v5 = m_pComponents->m_pElements;
next = (cocos2d::CCDictElement *)m_pElements->hh.next;
if ( prev )
goto LABEL_4;
LABEL_16:
if ( next )
{
tbl = v5->hh.tbl;
p_hh = &m_pElements->hh;
hho = (UT_hash_handle *)tbl->hho;
if ( m_pElements == (cocos2d::CCDictElement *)((char *)tbl->tail - (char *)hho) )
tbl->tail = hho;
m_pComponents->m_pElements = next;
v5 = next;
v10 = (char *)next;
LABEL_7:
*(_QWORD *)&v10[v5->hh.tbl->hho + 8] = prev;
while ( 1 )
{
v11 = v5->hh.tbl;
buckets = v11->buckets;
v13 = (v11->num_buckets - 1) & p_hh->hashv;
hh_head = v11->buckets[v13].hh_head;
--v11->buckets[v13].count;
hh_next = p_hh->hh_next;
if ( hh_head == p_hh )
buckets[v13].hh_head = hh_next;
hh_prev = p_hh->hh_prev;
if ( hh_prev )
{
hh_prev->hh_next = hh_next;
hh_next = p_hh->hh_next;
}
if ( hh_next )
hh_next->hh_prev = hh_prev;
m_pObject = (__int64 *)m_pElements->m_pObject;
v18 = *m_pObject;
--v11->num_items;
(*(void (__fastcall **)(__int64 *))(v18 + 96))(m_pObject);
cocos2d::CCComponent::setOwner((cocos2d::CCComponent *)m_pElements->m_pObject, nullptr);
cocos2d::CCObject::release(m_pElements->m_pObject);
cocos2d::CCDictElement::~CCDictElement(m_pElements);
operator delete(m_pElements);
if ( !next )
break;
m_pElements = next;
m_pComponents = a1->m_pComponents;
next = (cocos2d::CCDictElement *)next->hh.next;
prev = (char *)m_pElements->hh.prev;
v5 = m_pComponents->m_pElements;
if ( !prev )
goto LABEL_16;
LABEL_4:
v7 = v5->hh.tbl;
p_hh = &m_pElements->hh;
v9 = v7->hho;
if ( m_pElements == (cocos2d::CCDictElement *)((char *)v7->tail - v9) )
v7->tail = (UT_hash_handle *)&prev[v9];
*(_QWORD *)&prev[v9 + 16] = m_pElements->hh.next;
v10 = (char *)m_pElements->hh.next;
if ( v10 )
goto LABEL_7;
}
}
else
{
free(v5->hh.tbl->buckets);
free(a1->m_pComponents->m_pElements->hh.tbl);
a1->m_pComponents->m_pElements = nullptr;
m_pElements->m_pObject->__vftable[1].~CCObject_0(m_pElements->m_pObject);
cocos2d::CCComponent::setOwner((cocos2d::CCComponent *)m_pElements->m_pObject, nullptr);
cocos2d::CCObject::release(m_pElements->m_pObject);
cocos2d::CCDictElement::~CCDictElement(m_pElements);
operator delete(m_pElements);
}
}
cocos2d::CCNode::unscheduleUpdate(a1->m_pOwner);
}
}