//
// CCContentManager::addDictDS from 0x100184530 to 0x100184708 (472 bytes)
//
// 0 xrefs:
//
// 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 *__fastcall CCContentManager::addDictDS(CCContentManager *a1, const char *a2)
{
double v2; // xmm0_8
const char *v3; // rbx
CCContentManager *v4; // r14
CCContentManager_vtbl *v5; // r15
size_t v6; // rax
size_t v7; // r12
char *v8; // r13
size_t v9; // r14
cocos2d::CCDictionary *DictForKey; // r15
DS_Dictionary *v11; // r12
pugi::xml_node *begin; // rdi
CCContentManager_vtbl *v13; // r14
size_t v14; // rax
size_t v15; // r12
char *v16; // r13
size_t v17; // r14
CCContentManager_vtbl *v19; // [rsp+8h] [rbp-48h]
size_t __dst; // [rsp+10h] [rbp-40h] BYREF
size_t v21; // [rsp+18h] [rbp-38h]
void *__p; // [rsp+20h] [rbp-30h]
v3 = a2;
v4 = a1;
v5 = a1[1].__vftable;
v6 = strlen(a2);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_25;
v7 = v6;
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
__p = v8;
__dst = v9 + 1;
v4 = a1;
v3 = a2;
v21 = v7;
goto LABEL_8;
}
LOBYTE(__dst) = 2 * v6;
v8 = (char *)&__dst + 1;
if ( v6 )
LABEL_8:
memcpy(v8, v3, v7);
v8[v7] = 0;
DictForKey = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey_1(v5, &__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( !DictForKey )
{
v11 = (DS_Dictionary *)operator new(0xF0u);
sub_100179B00(v11);
DS_Dictionary::loadRootSubDictFromFile(v11, v3);
DictForKey = DS_Dictionary::getDictForKey(v11, nullptr, 0);
begin = v11->dictTree.__begin_;
if ( begin )
{
v11->dictTree.__end_ = begin;
operator delete(begin);
}
pugi::xml_document::dxml_document(v11);
operator delete(v11);
v13 = v4[1].__vftable;
v14 = strlen(v3);
if ( v14 < 0xFFFFFFFFFFFFFFF8LL )
{
v15 = v14;
if ( v14 >= 0x17 )
{
v19 = v13;
v17 = 26;
if ( (v14 | 7) != 0x17 )
v17 = (v14 | 7) + 1;
v16 = (char *)operator new(v17);
__p = v16;
__dst = v17 + 1;
v13 = v19;
v21 = v15;
}
else
{
LOBYTE(__dst) = 2 * v14;
v16 = (char *)&__dst + 1;
if ( !v14 )
{
LABEL_22:
v16[v15] = 0;
cocos2d::CCDictionary::setObject_1(v13, DictForKey, &__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
return DictForKey;
}
}
memcpy(v16, v3, v15);
goto LABEL_22;
}
LABEL_25:
sub_100006BF0(v2);
}
return DictForKey;
}