//
// cocos2d::CCComponentContainer::remove from 0x100165164 to 0x1001652e4 (384 bytes)
//
// 1 xrefs:
// > ??> @ 0x10079bd98
//
// 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; // x22
cocos2d::CCDictElement *m_pElements; // x19
char *prev; // x9
cocos2d::CCDictionary *v7; // x8
cocos2d::CCDictElement **p_m_pElements; // x8
cocos2d::CCDictElement *v9; // x11
cocos2d::CCDictElement *v10; // t1
UT_hash_table *tbl; // x10
std::ptrdiff_t hho; // x13
cocos2d::CCDictElement *next; // x12
cocos2d::CCDictElement **v14; // x13
_QWORD *m_szKey; // x8
__int64 v16; // x8
__int64 v17; // x9
UT_hash_handle *hh_prev; // x9
UT_hash_handle *hh_next; // x10
void *v20; // x0
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);
sub_10012A620((__int64)a2, 0);
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
{
v7 = a1->m_pComponents;
v10 = v7->m_pElements;
p_m_pElements = &v7->m_pElements;
v9 = v10;
tbl = v10->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;
v14 = (cocos2d::CCDictElement **)&prev[hho + 16];
if ( prev )
{
m_szKey = v9->m_szKey;
}
else
{
v14 = p_m_pElements;
m_szKey = m_pElements->hh.next;
}
*v14 = next;
v16 = m_szKey[34];
if ( next )
*(_QWORD *)&next->m_szKey[*(_QWORD *)(v16 + 32) + 8] = prev;
v17 = *(_QWORD *)v16 + 16LL * ((*(_DWORD *)(v16 + 8) - 1) & m_pElements->hh.hashv);
--*(_DWORD *)(v17 + 8);
if ( *(cocos2d::CCDictElement **)v17 == (cocos2d::CCDictElement *)&m_pElements->hh )
*(_QWORD *)v17 = 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;
--*(_DWORD *)(v16 + 16);
}
cocos2d::CCObject::release(m_pElements->m_pObject);
v20 = (void *)nullsub_212(m_pElements);
operator delete(v20);
}
}
return m_pComponents != nullptr;
}