//
// DS_Dictionary::setObjectForKey from 0x100180880 to 0x100180a76 (502 bytes)
//
// 2 xrefs:
// > DS_Dictionary::setArrayForKey @ 0x10018082c
// > DS_Dictionary::setDictForKey @ 0x1001810c9
//
// 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
//
void __fastcall DS_Dictionary::setObjectForKey(DS_Dictionary *a1, const char *a2, cocos2d::CCObject *a3)
{
double v3; // xmm0_8
char *v5; // r14
const char *CString; // r12
size_t v7; // rax
size_t v8; // r15
char *v9; // r13
size_t v10; // r14
__int128 __dst; // [rsp+8h] [rbp-58h] BYREF
void *v12; // [rsp+18h] [rbp-48h]
__int128 v13; // [rsp+20h] [rbp-40h] BYREF
void *__p; // [rsp+30h] [rbp-30h]
v5 = (char *)a2;
if ( a3 )
{
if ( __dynamic_cast(
a3,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCString,
0) )
{
CString = cocos2d::CCString::getCString((cocos2d::CCString *)a3);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v3);
v8 = v7;
if ( v7 >= 0x17 )
{
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
v9 = (char *)operator new(v10);
v12 = v9;
*(_QWORD *)&__dst = v10 + 1;
v5 = (char *)a2;
*((_QWORD *)&__dst + 1) = v8;
}
else
{
LOBYTE(__dst) = 2 * v7;
v9 = (char *)&__dst + 1;
if ( !v7 )
{
LABEL_13:
v9[v8] = 0;
__p = v12;
v13 = __dst;
DS_Dictionary::setStringForKey((__int64)a1, v5, (unsigned __int8 *)&v13, 0);
if ( (v13 & 1) != 0 )
operator delete(__p);
return;
}
}
memmove(v9, CString, v8);
goto LABEL_13;
}
if ( __dynamic_cast(
a3,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCDictionary,
0) )
{
DS_Dictionary::setDictForKey(a1, a2, (cocos2d::CCDictionary *)a3);
return;
}
if ( __dynamic_cast(
a3,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCArray,
0) )
{
DS_Dictionary::setArrayForKey(a1, a2, (cocos2d::CCArray *)a3);
return;
}
}
if ( ((unsigned __int8 (__fastcall *)(cocos2d::CCObject *))a3->canEncode)(a3) )
{
DS_Dictionary::setSubDictForKey(a1, a2, 0, 1);
((void (__fastcall *)(cocos2d::CCObject *, DS_Dictionary *))a3->encodeWithCoder)(a3, a1);
if ( (std::__vector_base
::pointer)((char *)a1->dictTree.__end_ - (char *)a1->dictTree.__begin_) >= (std::__vector_base::pointer)9 )
--a1->dictTree.__end_;
}
}