//
// DS_Dictionary::setObjectForKey from 0x10015fc70 to 0x10015fe66 (502 bytes)
//
// 2 xrefs:
// > DS_Dictionary::setArrayForKey @ 0x10015fc1c
// > DS_Dictionary::setDictForKey @ 0x1001604b9
//
// 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:07 +0000
//
void __fastcall DS_Dictionary::setObjectForKey(__int64 a1, char *a2, const void *a3)
{
char *v4; // r14
const char *CString; // r12
size_t v6; // rax
size_t v7; // r15
char *v8; // r13
size_t v9; // r14
__int128 __dst; // [rsp+8h] [rbp-58h] BYREF
void *v11; // [rsp+18h] [rbp-48h]
__int128 v12; // [rsp+20h] [rbp-40h] BYREF
void *__p; // [rsp+30h] [rbp-30h]
v4 = 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 = (const char *)cocos2d::CCString::getCString(a3);
v6 = strlen(CString);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v7 = v6;
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
v11 = v8;
*(_QWORD *)&__dst = v9 + 1;
v4 = a2;
*((_QWORD *)&__dst + 1) = v7;
}
else
{
LOBYTE(__dst) = 2 * v6;
v8 = (char *)&__dst + 1;
if ( !v6 )
{
LABEL_13:
v8[v7] = 0;
__p = v11;
v12 = __dst;
DS_Dictionary::setStringForKey(a1, v4, (unsigned __int8 *)&v12, 0);
if ( (v12 & 1) != 0 )
operator delete(__p);
return;
}
}
memmove(v8, CString, v7);
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, 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, (__int64)a3);
return;
}
}
if ( (*(unsigned __int8 (__fastcall **)(const void *))(*(_QWORD *)a3 + 56LL))(a3) )
{
DS_Dictionary::setSubDictForKey(a1, a2, 0, 1);
(*(void (__fastcall **)(const void *, __int64))(*(_QWORD *)a3 + 48LL))(a3, a1);
if ( *(_QWORD *)(a1 + 216) - *(_QWORD *)(a1 + 208) >= 9u )
*(_QWORD *)(a1 + 216) -= 8LL;
}
}