//
// DS_Dictionary::loadRootSubDictFromFile from 0x10017ab30 to 0x10017ae37 (775 bytes)
//
// 2 xrefs:
// > CCContentManager::addDictDS @ 0x100184615
// > CCAnimateFrameCache::addCustomSpriteFramesWithFile @ 0x10056b1ad
//
// 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
//
bool __fastcall DS_Dictionary::loadRootSubDictFromFile(DS_Dictionary *a1, const char *a2)
{
const char *v2; // r14
DS_Dictionary *v3; // r13
std::__vector_base
::pointer end; // r15
pugi::xml_node *value; // rax
__int64 v6; // rbx
std::__vector_base::pointer begin; // r12
signed __int64 v8; // r15
__int64 v9; // r14
__int64 v10; // rax
unsigned __int64 v11; // rbx
pugi::xml_node *v12; // r13
DS_Dictionary *v13; // rax
cocos2d::CCFileUtils *v14; // rax
cocos2d::CCFileUtils *v15; // rax
char *v16; // rsi
__int64 v17; // r15
bool v18; // bl
cocos2d::CCFileUtils *v19; // rax
std::string::pointer data; // rsi
__int64 v21; // r14
bool v22; // r14
__int128 v24; // [rsp+8h] [rbp-A8h] BYREF
int v25; // [rsp+18h] [rbp-98h]
__int128 v26; // [rsp+20h] [rbp-90h] BYREF
int v27; // [rsp+30h] [rbp-80h]
DS_Dictionary *v28; // [rsp+38h] [rbp-78h]
pugi::xml_node *v29; // [rsp+40h] [rbp-70h]
const char *v30; // [rsp+48h] [rbp-68h]
pugi::xml_node v31; // [rsp+50h] [rbp-60h] BYREF
void *__p; // [rsp+60h] [rbp-50h]
std::string v33; // [rsp+68h] [rbp-48h] BYREF
_QWORD v34[6]; // [rsp+80h] [rbp-30h] BYREF
v2 = a2;
v3 = a1;
a1->dictTree.__end_ = a1->dictTree.__begin_;
pugi::xml_node::xml_node(&v31);
end = a1->dictTree.__end_;
value = a1->dictTree.__end_cap_.__value_;
if ( end >= value )
{
v30 = a2;
begin = a1->dictTree.__begin_;
v8 = (char *)end - (char *)begin;
v9 = v8 >> 3;
if ( (unsigned __int64)((v8 >> 3) + 1) >> 61 )
sub_100183910();
v10 = (char *)value - (char *)begin;
v11 = v10 >> 2;
if ( v10 >> 2 <= (unsigned __int64)((v8 >> 3) + 1) )
v11 = (v8 >> 3) + 1;
if ( (unsigned __int64)v10 >= 0x7FFFFFFFFFFFFFF8LL )
v11 = 0x1FFFFFFFFFFFFFFFLL;
v28 = a1;
if ( v11 )
{
if ( v11 > 0x1FFFFFFFFFFFFFFFLL )
sub_100054850();
v12 = (pugi::xml_node *)operator new(8 * v11);
}
else
{
v12 = nullptr;
}
v29 = &v12[v11];
v12[v9] = v31;
v6 = (__int64)&v12[v9 + 1];
memcpy(v12, begin, v8);
v13 = v28;
v28->dictTree.__begin_ = v12;
v3 = v13;
v13->dictTree.__end_ = (std::__vector_base::pointer)v6;
v13->dictTree.__end_cap_.__value_ = v29;
if ( begin )
operator delete(begin);
v2 = v30;
}
else
{
end->_root = v31._root;
v6 = (__int64)&end[1];
}
v3->dictTree.__end_ = (std::__vector_base::pointer)v6;
v14 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(pugi::xml_node *, cocos2d::CCFileUtils *, const char *, _QWORD))v14->createCCArrayWithContentsOfFile)(
&v31,
v14,
v2,
0);
v34[0] = 0;
v15 = cocos2d::CCFileUtils::sharedFileUtils();
if ( ((__int64)v31._root & 1) != 0 )
v16 = (char *)__p;
else
v16 = (char *)&v31._root + 1;
v17 = ((__int64 (__fastcall *)(cocos2d::CCFileUtils *, char *, const char *, _QWORD *))v15->addSearchResolutionsOrder)(
v15,
v16,
"r",
v34);
sub_1006422B0(&v26, v3, v17, v34[0], 116, 0);
v18 = 1;
if ( ((v17 != 0) & (unsigned __int8)sub_100641120(&v26)) == 0 )
{
FileOperation::getFilePath(&v33);
std::string::append(&v33, v2);
v34[0] = 0;
v19 = cocos2d::CCFileUtils::sharedFileUtils();
if ( (*(_BYTE *)&v33.__r_.__value_.__s.0 & 1) != 0 )
data = v33.__r_.__value_.__l.__data_;
else
data = v33.__r_.__value_.__s.__data_;
v21 = ((__int64 (__fastcall *)(cocos2d::CCFileUtils *, std::string::pointer, const char *, _QWORD *))v19->addSearchResolutionsOrder)(
v19,
data,
"r",
v34);
sub_1006422B0(&v24, v3, v21, v34[0], 116, 0);
v27 = v25;
v26 = v24;
if ( (*(_BYTE *)&v33.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v33.__r_.__value_.__l.__data_);
v18 = v21 != 0;
}
v22 = v18 & sub_100641120(&v26);
if ( v22 )
{
v33.__r_.__value_.__r.__words[0] = sub_10063B550(v3, "plist");
v3->dictTree.__end_[-1]._root = (pugi::xml_node_struct *)sub_10063B550(&v33, "dict");
*(_QWORD *)&v24 = sub_10063B550(v3, "plist");
v33.__r_.__value_.__r.__words[0] = sub_10063B6E0(&v24, "gjver");
v3->compatible = (int)sub_10063A7C0(&v33, 0) < 2;
}
if ( ((__int64)v31._root & 1) != 0 )
operator delete(__p);
return v22;
}