//
// DS_Dictionary::getObjectForKey from 0xb46be4 to 0xb46ec8 (740 bytes)
//
// 2 xrefs:
// > DS_Dictionary::getArrayForKey @ 0xb46f68
// > ??> @ 0x4d7a8
//
// 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::CCObject *DS_Dictionary::getObjectForKey(DS_Dictionary *a1, const char *a2)
{
_BOOL4 compatible; // w1
pugi::xml_node *v5; // x0
const char *v6; // x1
const char *v7; // x0
const char *v8; // x1
cocos2d::CCObject *v9; // x19
const char *v11; // x19
const char *v12; // x0
pugi::xml_node *m_finish; // x1
_BOOL4 BoolForKey; // w19
int IntegerForKey; // w3
const char *v16; // x0
__int64 v17; // x2
void *v18; // x0
unsigned int *v19; // x2
int v20; // w1
const char *v21; // x0
char *v22; // x0
unsigned int *v23; // x2
pugi::xml_node v24; // [xsp+50h] [xbp+50h] BYREF
pugi::xml_node v25; // [xsp+58h] [xbp+58h] BYREF
__int64 v26; // [xsp+60h] [xbp+60h] BYREF
compatible = a1->compatible;
v5 = a1->dictTree.m_finish - 1;
if ( compatible )
v6 = "key";
else
v6 = "k";
for ( v24._root = (pugi::xml_node_struct *)pugi::xml_node::child(v5, v6);
;
v24._root = (pugi::xml_node_struct *)pugi::xml_node::next_sibling(&v24, v8) )
{
if ( !pugi::xml_node::operator void (*)(pugi::xml_node***)(&v24) )
return nullptr;
v7 = (const char *)pugi::xml_node::child_value(&v24);
if ( !strcmp(a2, v7) )
break;
if ( a1->compatible )
v8 = "key";
else
v8 = "k";
}
v25._root = (pugi::xml_node_struct *)pugi::xml_node::next_sibling(&v24);
if ( a1->compatible )
v11 = "dict";
else
v11 = &byte_F27208;
v12 = (const char *)pugi::xml_node::name(&v25);
if ( !strcmp(v11, v12) )
{
m_finish = a1->dictTree.m_finish;
if ( m_finish == a1->dictTree.m_reserveEnd )
{
std::vector
::_M_emplace_back_aux((__int64)&a1->dictTree, &v25);
}
else
{
if ( m_finish )
m_finish->_root = v25._root;
a1->dictTree.m_finish = m_finish + 1;
}
BoolForKey = DS_Dictionary::getBoolForKey(a1, "_isArr");
IntegerForKey = DS_Dictionary::getIntegerForKey(a1, "kCEK");
if ( IntegerForKey )
return DS_Dictionary::decodeObjectForKey(a1, a2, 1, IntegerForKey);
if ( BoolForKey )
return DS_Dictionary::getArrayForKey(a1, a2, 1);
return DS_Dictionary::getDictForKey(a1, a2, 1);
}
if ( a1->compatible )
{
v21 = (const char *)pugi::xml_node::name(&v25);
if ( !strcmp("true", v21) )
{
LABEL_25:
sub_D153B8((int)&v26, "1");
v9 = cocos2d::CCString::create();
v17 = v26;
v18 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) == &qword_124B6B0 )
return v9;
if ( &pthread_create )
{
v19 = (unsigned int *)(v26 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
goto LABEL_36;
}
LABEL_41:
v20 = *(_DWORD *)(v17 - 8);
*(_DWORD *)(v17 - 8) = v20 - 1;
goto LABEL_36;
}
}
else
{
v16 = (const char *)pugi::xml_node::name(&v25);
if ( !strcmp("t", v16) )
goto LABEL_25;
}
v22 = (char *)pugi::xml_node::child_value(&v25);
sub_D153B8((int)&v26, v22);
v9 = cocos2d::CCString::create();
v17 = v26;
v18 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) == &qword_124B6B0 )
return v9;
if ( !&pthread_create )
goto LABEL_41;
v23 = (unsigned int *)(v26 - 8);
do
v20 = __ldaxr(v23);
while ( __stlxr(v20 - 1, v23) );
LABEL_36:
if ( v20 <= 0 )
operator delete(v18);
return v9;
}