//
// cocos2d::CCDictionary::copyWithZone from 0xad0ab4 to 0xad0c44 (400 bytes)
//
// 2 xrefs:
// > ??> @ 0xa4640
// > ??> @ 0x12009c0
//
// 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
//
cocos2d::CCObject *cocos2d::CCDictionary::copyWithZone(cocos2d::CCDictionary *a1, cocos2d::CCZone *a2)
{
cocos2d::CCDictionary *v3; // x22
cocos2d::CCDictionary::CCDictType m_eDictType; // w0
cocos2d::CCDictElement *v6; // x1
cocos2d::CCDictElement *j; // x19
cocos2d::CCObject *v8; // x21
char *v9; // x0
cocos2d::CCDictElement *m_pElements; // x20
cocos2d::CCDictElement *i; // x19
cocos2d::CCObject *v12; // x21
unsigned int *v13; // x1
int v14; // w2
char *v15; // [xsp+68h] [xbp+68h]
const char *v16; // [xsp+80h] [xbp+80h] BYREF
v3 = (cocos2d::CCDictionary *)operator new(0x48u);
cocos2d::CCDictionary::CCDictionary(v3);
m_eDictType = a1->m_eDictType;
if ( m_eDictType == kCCDictInt )
{
m_pElements = a1->m_pElements;
if ( m_pElements )
{
for ( i = (cocos2d::CCDictElement *)m_pElements->hh.next; ; i = (cocos2d::CCDictElement *)i->hh.next )
{
v12 = (cocos2d::CCObject *)cocos2d::CCObject::copy(m_pElements->m_pObject);
cocos2d::CCDictionary::setObject(v3, v12, m_pElements->m_iKey);
cocos2d::CCObject::release(v12);
if ( !i )
break;
m_pElements = i;
}
}
}
else if ( m_eDictType == kCCDictStr )
{
v6 = a1->m_pElements;
if ( v6 )
{
for ( j = (cocos2d::CCDictElement *)v6->hh.next; ; j = (cocos2d::CCDictElement *)j->hh.next )
{
v15 = (char *)v6;
v8 = (cocos2d::CCObject *)cocos2d::CCObject::copy(v6->m_pObject);
sub_D153B8((int)&v16, v15);
cocos2d::CCDictionary::setObject((__int64)v3, v8, &v16);
v9 = (char *)(v16 - 24);
if ( v16 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v16 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v16 - 2);
*((_DWORD *)v16 - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v9);
}
cocos2d::CCObject::release(v8);
if ( !j )
break;
v6 = j;
}
}
}
return v3;
}