//
// CCContentManager::addDict from 0xb41104 to 0xb412c4 (448 bytes)
//
// 8 xrefs:
// > LoadingLayer::loadAssets @ 0x5c4b2c
// > LoadingLayer::loadAssets @ 0x5c4b40
// > LoadingLayer::loadAssets @ 0x5c4b54
// > cocos2d::CCLabelAtlas::initWithString @ 0xae1ddc
// > cocos2d::CCParticleSystem::initWithFile @ 0xb019b8
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0xb1a73c
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0xb1bbbc
// > ??> @ 0x7de38
//
// 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::addDict(CCContentManager *a1, const char *a2, bool a3)
{
CCContentManager_vtbl *v4; // x19
cocos2d::CCDictionary *v6; // x19
char *v7; // x0
cocos2d::CCDictionary *result; // x0
DS_Dictionary *v9; // x26
cocos2d::CCDictionary *DictForKey; // x19
pugi::xml_node *m_start; // x0
CCContentManager_vtbl *v12; // x24
char *v13; // x0
unsigned int *v14; // x1
int v15; // w2
unsigned int *v16; // x1
int v17; // w2
const char *v18; // [xsp+60h] [xbp+60h] BYREF
v4 = a1[1].__vftable;
sub_D153B8((int)&v18, (char *)a2);
v6 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey((__int64)v4, &v18);
v7 = (char *)(v18 - 24);
if ( v18 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v18 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)v18 - 2);
*((_DWORD *)v18 - 2) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v7);
}
result = v6;
if ( !v6 )
{
v9 = (DS_Dictionary *)operator new(0xF0u);
DS_Dictionary::DS_Dictionary(v9);
DS_Dictionary::loadRootSubDictFromFile(v9, a2);
DictForKey = DS_Dictionary::getDictForKey(v9, nullptr, 0);
m_start = v9->dictTree.m_start;
if ( m_start )
operator delete(m_start);
pugi::xml_document::~xml_document(&v9->doc);
operator delete(v9);
v12 = a1[1].__vftable;
sub_D153B8((int)&v18, (char *)a2);
cocos2d::CCDictionary::setObject((__int64)v12, DictForKey, &v18);
v13 = (char *)(v18 - 24);
if ( v18 - 24 == (const char *)&qword_124B6B0 )
return DictForKey;
if ( &pthread_create )
{
v16 = (unsigned int *)(v18 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *((_DWORD *)v18 - 2);
*((_DWORD *)v18 - 2) = v17 - 1;
}
if ( v17 > 0 )
{
return DictForKey;
}
else
{
operator delete(v13);
return DictForKey;
}
}
return result;
}