//
// DS_Dictionary::setObjectForKey from 0x18001f330 to 0x18001f4f0 (448 bytes)
//
// 4 xrefs:
// > DS_Dictionary::setArrayForKey @ 0x18001e80c
// > DS_Dictionary::setDictForKey @ 0x18001ed8d
// > ??> @ 0x1801438a8
// > ??> @ 0x1801aecec
//
// 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
//
// Hidden C++ exception states: #wind=1
void __fastcall DS_Dictionary::setObjectForKey(DS_Dictionary *this, const char *a2, cocos2d::CCString *a3)
{
std::string *CString; // rax
size_t v7; // r8
void *v8; // rcx
__int128 v9; // [rsp+30h] [rbp-68h] BYREF
__int128 v10; // [rsp+40h] [rbp-58h]
void *Block[2]; // [rsp+58h] [rbp-40h] BYREF
__int128 v12; // [rsp+68h] [rbp-30h]
if ( _RTDynamicCast(a3, 0, &cocos2d::CCObject `RTTI Type Descriptor', &cocos2d::CCString `RTTI Type Descriptor', 0) )
{
CString = cocos2d::CCString::getCString(a3);
v9 = 0;
v10 = 0u;
v7 = -1;
do
++v7;
while ( CString->m_data.m_smallStorage._Elems[v7] );
sub_18000CE60(&v9, CString, v7);
*(_OWORD *)Block = v9;
v12 = v10;
DS_Dictionary::setStringForKey(this, a2, Block, 0);
if ( *((_QWORD *)&v12 + 1) > 0xFu )
{
v8 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v12 + 1) + 1LL) >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v8);
}
}
else if ( _RTDynamicCast(
a3,
0,
&cocos2d::CCObject `RTTI Type Descriptor',
&cocos2d::CCDictionary `RTTI Type Descriptor',
0) )
{
DS_Dictionary::setDictForKey(this, a2, (struct cocos2d::CCDictionary *)a3);
}
else if ( _RTDynamicCast(
a3,
0,
&cocos2d::CCObject `RTTI Type Descriptor',
&cocos2d::CCArray `RTTI Type Descriptor',
0) )
{
DS_Dictionary::setArrayForKey(this, a2, (struct cocos2d::CCArray *)a3);
}
else if ( ((unsigned __int8 (__fastcall *)(cocos2d::CCString *))a3->canEncode)(a3) )
{
DS_Dictionary::setSubDictForKey(this, a2, 0, 1);
((void (__fastcall *)(cocos2d::CCString *, DS_Dictionary *))a3->encodeWithCoder)(a3, this);
if ( (unsigned __int64)(this->dictTree._Mypair._Myval2._Mylast - this->dictTree._Mypair._Myval2._Myfirst) > 1 )
--this->dictTree._Mypair._Myval2._Mylast;
}
}