//
// cocos2d::CCComponentContainer::remove from 0xb2ee2c to 0xb2f02c (512 bytes)
//
// 2 xrefs:
// > ??> @ 0xa55e8
// > ??> @ 0x1219a48
//
// 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 cocos2d::CCComponentContainer::remove(cocos2d::CCComponentContainer *a1, const char *a2)
{
cocos2d::CCDictionary *m_pComponents; // x2
cocos2d::CCDictElement *m_pElements; // x2
cocos2d::CCDictElement *next; // x19
void *v5; // x3
char *prev; // x1
UT_hash_handle *p_hh; // x2
cocos2d::CCDictElement *v11; // x3
UT_hash_table *tbl; // x5
std::ptrdiff_t hho; // x0
void *v14; // x4
UT_hash_handle *v15; // x0
cocos2d::CCDictElement *v16; // x4
UT_hash_table *v17; // x3
UT_hash_bucket *buckets; // x4
__int64 v19; // x0
UT_hash_handle *hh_head; // x6
UT_hash_handle *hh_next; // x1
UT_hash_handle *hh_prev; // x0
cocos2d::CCDictionary *v23; // x5
UT_hash_table *v24; // x3
UT_hash_handle *v25; // x6
m_pComponents = a1->m_pComponents;
if ( m_pComponents )
{
m_pElements = m_pComponents->m_pElements;
if ( m_pElements )
{
next = (cocos2d::CCDictElement *)m_pElements->hh.next;
if ( (const char *)m_pElements->m_pObject == a2 )
{
next = m_pElements;
goto LABEL_9;
}
if ( next )
{
while ( 1 )
{
v5 = next->hh.next;
if ( (const char *)next->m_pObject == a2 )
break;
next = (cocos2d::CCDictElement *)next->hh.next;
if ( !v5 )
return 1;
}
LABEL_9:
(*(void (__fastcall **)(const char *))(*(_QWORD *)a2 + 96LL))(a2);
cocos2d::CCComponent::setOwner((cocos2d::CCComponent *)a2, nullptr);
prev = (char *)next->hh.prev;
if ( prev )
{
p_hh = &next->hh;
v11 = a1->m_pComponents->m_pElements;
tbl = v11->hh.tbl;
hho = tbl->hho;
v14 = next->hh.next;
if ( (cocos2d::CCDictElement *)((char *)tbl->tail - hho) == next )
{
v15 = (UT_hash_handle *)&prev[hho];
tbl->tail = v15;
}
else
{
v15 = (UT_hash_handle *)&prev[hho];
}
v15->next = v14;
v16 = (cocos2d::CCDictElement *)next->hh.next;
if ( !v16 )
goto LABEL_14;
}
else
{
v16 = (cocos2d::CCDictElement *)next->hh.next;
if ( !v16 )
{
free(a1->m_pComponents->m_pElements->hh.tbl->buckets);
free(a1->m_pComponents->m_pElements->hh.tbl);
a1->m_pComponents->m_pElements = nullptr;
LABEL_21:
cocos2d::CCObject::release(next->m_pObject);
cocos2d::CCDictElement::~CCDictElement(next);
operator delete(next);
return 1;
}
v23 = a1->m_pComponents;
p_hh = &next->hh;
v24 = v23->m_pElements->hh.tbl;
v25 = (UT_hash_handle *)v24->hho;
if ( next == (cocos2d::CCDictElement *)((char *)v24->tail - (char *)v25) )
v24->tail = v25;
v23->m_pElements = v16;
v11 = v16;
}
*(_QWORD *)&v16->m_szKey[v11->hh.tbl->hho + 8] = prev;
LABEL_14:
v17 = v11->hh.tbl;
buckets = v17->buckets;
v19 = (v17->num_buckets - 1) & p_hh->hashv;
hh_head = v17->buckets[v19].hh_head;
--v17->buckets[v19].count;
hh_next = p_hh->hh_next;
if ( hh_head == p_hh )
buckets[v19].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;
--v17->num_items;
goto LABEL_21;
}
}
return 1;
}
return 0;
}