//
// cocos2d::CCDictionary::removeObjectForElememt from 0x100423fd0 to 0x1004240ec (284 bytes)
//
// 2 xrefs:
// > cocos2d::CCDictionary::removeObjectForKey_1 @ 0x100423fb8
// > cocos2d::CCDictionary::removeObjectForKey @ 0x100424214
//
// 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 __fastcall cocos2d::CCDictionary::removeObjectForElememt(cocos2d::CCDictionary *a1, cocos2d::CCDictElement *a2)
{
char *prev; // x9
_QWORD *m_szKey; // x8
__int64 v6; // x10
__int64 v7; // x12
cocos2d::CCDictElement *next; // x11
cocos2d::CCDictElement **p_m_pElements; // x12
__int64 v10; // x8
__int64 v11; // x9
UT_hash_handle *hh_prev; // x9
UT_hash_handle *hh_next; // x10
if ( a2 )
{
prev = (char *)a2->hh.prev;
if ( *(_OWORD *)&a2->hh.prev == 0 )
{
free(a1->m_pElements->hh.tbl->buckets);
free(a1->m_pElements->hh.tbl);
a1->m_pElements = nullptr;
}
else
{
m_szKey = a1->m_pElements->m_szKey;
v6 = m_szKey[34];
v7 = *(_QWORD *)(v6 + 32);
if ( (cocos2d::CCDictElement *)(*(_QWORD *)(v6 + 24) - v7) == a2 )
*(_QWORD *)(v6 + 24) = &prev[v7];
next = (cocos2d::CCDictElement *)a2->hh.next;
p_m_pElements = (cocos2d::CCDictElement **)&prev[v7 + 16];
if ( !prev )
{
p_m_pElements = &a1->m_pElements;
m_szKey = a2->hh.next;
}
*p_m_pElements = next;
v10 = m_szKey[34];
if ( next )
*(_QWORD *)&next->m_szKey[*(_QWORD *)(v10 + 32) + 8] = prev;
v11 = *(_QWORD *)v10 + 16LL * ((*(_DWORD *)(v10 + 8) - 1) & a2->hh.hashv);
--*(_DWORD *)(v11 + 8);
if ( *(cocos2d::CCDictElement **)v11 == (cocos2d::CCDictElement *)&a2->hh )
*(_QWORD *)v11 = a2->hh.hh_next;
hh_prev = a2->hh.hh_prev;
hh_next = a2->hh.hh_next;
if ( hh_prev )
hh_prev->hh_next = hh_next;
if ( hh_next )
hh_next->hh_prev = hh_prev;
--*(_DWORD *)(v10 + 16);
}
cocos2d::CCObject::release(a2->m_pObject);
operator delete(a2);
}
}