//
// DS_Dictionary::loadRootSubDictFromFile from 0xb47abc to 0xb47d9c (736 bytes)
//
// 5 xrefs:
// > CCAnimateFrameCache::addSpriteFramesWithFile @ 0x572b44
// > CCAnimateFrameCache::addCustomSpriteFramesWithFile @ 0x5738b0
// > CCContentManager::addDict @ 0xb411c0
// > CCContentManager::addDictDS @ 0xb41380
// > ??> @ 0x33018
//
// 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 DS_Dictionary::loadRootSubDictFromFile(DS_Dictionary *a1, const char *a2)
{
std::vector
*p_dictTree; // x20
__int64 v5; // x1
pugi::xml_node *m_finish; // x0
cocos2d::CCFileUtils *v7; // x0
cocos2d::CCFileUtils *v8; // x0
__int64 v9; // x20
FileOperation *v10; // x0
unsigned int v11; // w26
pugi::xml_node *v12; // x23
bool v13; // w22
__int64 v14; // x19
void *v15; // x0
size_t v17; // x0
cocos2d::CCFileUtils *v18; // x0
__int64 v19; // x23
void *v20; // x0
unsigned int *v21; // x19
int v22; // w1
unsigned int *v23; // x1
int v24; // w2
__int64 v25; // [xsp+60h] [xbp+60h] BYREF
__int64 v26; // [xsp+68h] [xbp+68h] BYREF
__int64 v27; // [xsp+70h] [xbp+70h] BYREF
_QWORD v28[2]; // [xsp+78h] [xbp+78h] BYREF
int v29; // [xsp+88h] [xbp+88h]
pugi::xml_node v30[2]; // [xsp+90h] [xbp+90h] BYREF
int v31; // [xsp+A0h] [xbp+A0h]
__int64 v32; // [xsp+A8h] [xbp+A8h]
p_dictTree = &a1->dictTree;
v5 = _stack_chk_guard;
a1->dictTree.m_finish = a1->dictTree.m_start;
v32 = v5;
pugi::xml_node::xml_node(v30);
m_finish = p_dictTree->m_finish;
if ( m_finish == p_dictTree->m_reserveEnd )
{
std::vector::_M_emplace_back_aux((__int64)p_dictTree, v30);
}
else
{
if ( m_finish )
m_finish->_root = (pugi::xml_node_struct *)v30[0];
p_dictTree->m_finish = m_finish + 1;
}
v7 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(__int64 *__return_ptr, cocos2d::CCFileUtils *, const char *, _QWORD))v7->createCCArrayWithContentsOfFile)(
&v25,
v7,
a2,
0);
v26 = 0;
v8 = cocos2d::CCFileUtils::sharedFileUtils();
v9 = ((__int64 (__fastcall *)(cocos2d::CCFileUtils *, __int64, char *, __int64 *))v8->addSearchResolutionsOrder)(
v8,
v25,
"r",
&v26);
pugi::xml_document::load_buffer(v28, a1, v9, v26, 116, 0);
v10 = (FileOperation *)pugi::xml_parse_result::operator bool(v28);
v11 = v9 == 0;
if ( v11 >= (unsigned __int8)v10 )
{
FileOperation::getFilePath(v10, (__int64)&v27);
v17 = strlen(a2);
sub_D15FD4(&v27, a2, v17);
v26 = 0;
v18 = cocos2d::CCFileUtils::sharedFileUtils();
v19 = ((__int64 (__fastcall *)(cocos2d::CCFileUtils *, __int64, char *, __int64 *))v18->addSearchResolutionsOrder)(
v18,
v27,
"r",
&v26);
pugi::xml_document::load_buffer(v30, a1, v19, v26, 116, 0);
v20 = (void *)(v27 - 24);
v29 = v31;
v28[0] = v30[0];
v28[1] = v30[1];
if ( (__int64 *)(v27 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(v27 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *(_DWORD *)(v27 - 8);
*(_DWORD *)(v27 - 8) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v20);
}
if ( (v19 == 0) < (unsigned int)(unsigned __int8)pugi::xml_parse_result::operator bool(v28) )
{
LABEL_7:
v12 = a1->dictTree.m_finish;
v13 = 1;
v30[0]._root = (pugi::xml_node_struct *)pugi::xml_node::child(&a1->doc, "plist");
v12[-1]._root = (pugi::xml_node_struct *)pugi::xml_node::child(v30, "dict");
DS_Dictionary::checkCompatibility(a1);
v14 = v25;
v15 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) == &qword_124B6B0 )
return v13;
goto LABEL_12;
}
}
else if ( v11 < (unsigned __int8)pugi::xml_parse_result::operator bool(v28) )
{
goto LABEL_7;
}
v14 = v25;
v13 = 0;
v15 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) == &qword_124B6B0 )
return v13;
LABEL_12:
if ( &pthread_create )
{
v21 = (unsigned int *)(v14 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v14 - 8);
*(_DWORD *)(v14 - 8) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v15);
return v13;
}