//
// CCContentManager::addDictDS from 0xb412c4 to 0xb41484 (448 bytes)
//
// 1 xrefs:
// > ??> @ 0xc01c8
//
// 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::CCDictionary *CCContentManager::addDictDS(CCContentManager *a1, const char *a2)
{
CCContentManager_vtbl *v3; // x19
cocos2d::CCDictionary *v5; // x19
char *v6; // x0
cocos2d::CCDictionary *result; // x0
DS_Dictionary *v8; // x26
cocos2d::CCDictionary *DictForKey; // x19
pugi::xml_node *m_start; // x0
CCContentManager_vtbl *v11; // x24
char *v12; // x0
unsigned int *v13; // x1
int v14; // w2
unsigned int *v15; // x1
int v16; // w2
const char *v17; // [xsp+60h] [xbp+60h] BYREF
v3 = a1[1].__vftable;
sub_D153B8((int)&v17, (char *)a2);
v5 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey((__int64)v3, &v17);
v6 = (char *)(v17 - 24);
if ( v17 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v17 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v17 - 2);
*((_DWORD *)v17 - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v6);
}
result = v5;
if ( !v5 )
{
v8 = (DS_Dictionary *)operator new(0xF0u);
DS_Dictionary::DS_Dictionary(v8);
DS_Dictionary::loadRootSubDictFromFile(v8, a2);
DictForKey = DS_Dictionary::getDictForKey(v8, nullptr, 0);
m_start = v8->dictTree.m_start;
if ( m_start )
operator delete(m_start);
pugi::xml_document::~xml_document(&v8->doc);
operator delete(v8);
v11 = a1[1].__vftable;
sub_D153B8((int)&v17, (char *)a2);
cocos2d::CCDictionary::setObject((__int64)v11, DictForKey, &v17);
v12 = (char *)(v17 - 24);
if ( v17 - 24 == (const char *)&qword_124B6B0 )
return DictForKey;
if ( &pthread_create )
{
v15 = (unsigned int *)(v17 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v17 - 2);
*((_DWORD *)v17 - 2) = v16 - 1;
}
if ( v16 > 0 )
{
return DictForKey;
}
else
{
operator delete(v12);
return DictForKey;
}
}
return result;
}