//
// DS_Dictionary::loadRootSubDictFromFile from 0x100159ee0 to 0x10015a1e7 (775 bytes)
//
// 2 xrefs:
// > CCContentManager::addDictDS @ 0x100163a05
// > CCAnimateFrameCache::addCustomSpriteFramesWithFile @ 0x10059826d
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:25:05 +0000
//
__int64 __fastcall DS_Dictionary::loadRootSubDictFromFile(_QWORD *a1, const std::string::value_type *a2)
{
const std::string::value_type *v2; // r14
_QWORD *v3; // r13
char *v4; // r15
unsigned __int64 v5; // rax
__int64 v6; // rbx
_BYTE *v7; // r12
signed __int64 v8; // r15
__int64 v9; // r14
__int64 v10; // rax
unsigned __int64 v11; // rbx
_QWORD *v12; // r13
_QWORD *v13; // rax
__int64 v14; // rax
__int64 v15; // rax
char *v16; // rsi
__int64 v17; // r15
bool v18; // bl
__int64 v19; // rax
std::string::pointer data; // rsi
__int64 v21; // r14
unsigned int v22; // eax
unsigned int v23; // r14d
__int128 v25; // [rsp+8h] [rbp-A8h] BYREF
int v26; // [rsp+18h] [rbp-98h]
__int128 v27; // [rsp+20h] [rbp-90h] BYREF
int v28; // [rsp+30h] [rbp-80h]
_QWORD *v29; // [rsp+38h] [rbp-78h]
char *v30; // [rsp+40h] [rbp-70h]
const std::string::value_type *v31; // [rsp+48h] [rbp-68h]
_QWORD v32[2]; // [rsp+50h] [rbp-60h] BYREF
void *__p; // [rsp+60h] [rbp-50h]
std::string v34; // [rsp+68h] [rbp-48h] BYREF
_QWORD v35[6]; // [rsp+80h] [rbp-30h] BYREF
v2 = a2;
v3 = a1;
a1[27] = a1[26];
pugi::xml_node::xml_node(v32);
v4 = (char *)a1[27];
v5 = a1[28];
if ( (unsigned __int64)v4 >= v5 )
{
v31 = a2;
v7 = (_BYTE *)a1[26];
v8 = v4 - v7;
v9 = v8 >> 3;
if ( (unsigned __int64)((v8 >> 3) + 1) >> 61 )
sub_100162D00();
v10 = v5 - (_QWORD)v7;
v11 = v10 >> 2;
if ( v10 >> 2 <= (unsigned __int64)((v8 >> 3) + 1) )
v11 = (v8 >> 3) + 1;
if ( (unsigned __int64)v10 >= 0x7FFFFFFFFFFFFFF8LL )
v11 = 0x1FFFFFFFFFFFFFFFLL;
v29 = a1;
if ( v11 )
{
if ( v11 > 0x1FFFFFFFFFFFFFFFLL )
sub_10001ADB0();
v12 = operator new(8 * v11);
}
else
{
v12 = nullptr;
}
v30 = (char *)&v12[v11];
v12[v9] = v32[0];
v6 = (__int64)&v12[v9 + 1];
memcpy(v12, v7, v8);
v13 = v29;
v29[26] = v12;
v3 = v13;
v13[27] = v6;
v13[28] = v30;
if ( v7 )
operator delete(v7);
v2 = v31;
}
else
{
*(_QWORD *)v4 = v32[0];
v6 = (__int64)(v4 + 8);
}
v3[27] = v6;
v14 = cocos2d::CCFileUtils::sharedFileUtils();
(*(void (__fastcall **)(_QWORD *, __int64, const std::string::value_type *, _QWORD))(*(_QWORD *)v14 + 48LL))(
v32,
v14,
v2,
0);
v35[0] = 0;
v15 = cocos2d::CCFileUtils::sharedFileUtils();
if ( (v32[0] & 1) != 0 )
v16 = (char *)__p;
else
v16 = (char *)v32 + 1;
v17 = (*(__int64 (__fastcall **)(__int64, char *, const char *, _QWORD *))(*(_QWORD *)v15 + 32LL))(v15, v16, "r", v35);
sub_10071EEE0(&v27, v3, v17, v35[0], 116, 0);
v18 = 1;
if ( ((v17 != 0) & (unsigned __int8)sub_10071DD50(&v27)) == 0 )
{
FileOperation::getFilePath(&v34);
std::string::append(&v34, v2);
v35[0] = 0;
v19 = cocos2d::CCFileUtils::sharedFileUtils();
if ( (*(_BYTE *)&v34.__r_.__value_.__s.0 & 1) != 0 )
data = v34.__r_.__value_.__l.__data_;
else
data = v34.__r_.__value_.__s.__data_;
v21 = (*(__int64 (__fastcall **)(__int64, std::string::pointer, const char *, _QWORD *))(*(_QWORD *)v19 + 32LL))(
v19,
data,
"r",
v35);
sub_10071EEE0(&v25, v3, v21, v35[0], 116, 0);
v28 = v26;
v27 = v25;
if ( (*(_BYTE *)&v34.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v34.__r_.__value_.__l.__data_);
v18 = v21 != 0;
}
v22 = sub_10071DD50(&v27);
v23 = v22;
LOBYTE(v23) = v18 & v22;
if ( (v18 & (unsigned __int8)v22) == 1 )
{
v34.__r_.__value_.__r.__words[0] = sub_100718180(v3, "plist");
*(_QWORD *)(v3[27] - 8LL) = sub_100718180(&v34, "dict");
*(_QWORD *)&v25 = sub_100718180(v3, "plist");
v34.__r_.__value_.__r.__words[0] = sub_100718310(&v25, "gjver");
*((_BYTE *)v3 + 232) = (int)sub_1007173F0(&v34, 0) < 2;
}
if ( (v32[0] & 1) != 0 )
operator delete(__p);
return v23;
}