//
// cocos2d::CCComponentContainer::remove from 0x5f2770 to 0x5f2874 (260 bytes)
//
// 0 xrefs:
//
// 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; // r0
cocos2d::CCDictElement *m_pElements; // r4
cocos2d::CCDictElement *next; // r3
cocos2d::CCDictElement *v7; // r2
char *prev; // r3
cocos2d::CCDictionary *v9; // r1
cocos2d::CCDictElement *v10; // r6
UT_hash_table *tbl; // r0
std::ptrdiff_t hho; // r2
char *v13; // r0
cocos2d::CCDictElement *v14; // r1
UT_hash_table *v15; // r1
int v16; // r3
UT_hash_bucket *buckets; // r2
UT_hash_handle *hh_next; // r0
UT_hash_handle *hh_prev; // r3
UT_hash_handle *v20; // r2
m_pComponents = a1->m_pComponents;
if ( m_pComponents )
{
m_pElements = m_pComponents->m_pElements;
if ( m_pElements )
next = (cocos2d::CCDictElement *)m_pElements->hh.next;
else
next = nullptr;
while ( m_pElements )
{
if ( (const char *)m_pElements->m_pObject == a2 )
{
(*(void (__fastcall **)(const char *))(*(_DWORD *)a2 + 48))(a2);
cocos2d::CCComponent::setOwner((cocos2d::CCComponent *)a2, nullptr);
prev = (char *)m_pElements->hh.prev;
v9 = a1->m_pComponents;
v10 = (cocos2d::CCDictElement *)m_pElements->hh.next;
if ( prev || v10 )
{
tbl = v9->m_pElements->hh.tbl;
hho = tbl->hho;
if ( m_pElements == (cocos2d::CCDictElement *)((char *)tbl->tail - hho) )
tbl->tail = (UT_hash_handle *)&prev[hho];
if ( prev )
*(_DWORD *)&prev[hho + 8] = v10;
else
v9->m_pElements = v10;
v13 = (char *)m_pElements->hh.next;
v14 = v9->m_pElements;
if ( v13 )
*(_DWORD *)&v13[v14->hh.tbl->hho + 4] = prev;
v15 = v14->hh.tbl;
v16 = (v15->num_buckets - 1) & m_pElements->hh.hashv;
buckets = v15->buckets;
buckets[v16].count = v15->buckets[v16].count - 1;
hh_next = m_pElements->hh.hh_next;
if ( buckets[v16].hh_head == &m_pElements->hh )
buckets[v16].hh_head = hh_next;
hh_prev = m_pElements->hh.hh_prev;
if ( hh_prev )
hh_prev->hh_next = hh_next;
v20 = m_pElements->hh.hh_next;
if ( v20 )
v20->hh_prev = hh_prev;
--v15->num_items;
}
else
{
free(v9->m_pElements->hh.tbl->buckets);
free(a1->m_pComponents->m_pElements->hh.tbl);
a1->m_pComponents->m_pElements = nullptr;
}
cocos2d::CCObject::release(m_pElements->m_pObject);
cocos2d::CCDictElement::~CCDictElement(m_pElements);
operator delete(m_pElements);
break;
}
if ( next )
v7 = (cocos2d::CCDictElement *)next->hh.next;
else
v7 = nullptr;
m_pElements = next;
next = v7;
}
LOBYTE(m_pComponents) = 1;
}
return (char)m_pComponents;
}