//
// DS_Dictionary::setVec2ForKey from 0x1800208e0 to 0x180020c1e (830 bytes)
//
// 3 xrefs:
// > DS_Dictionary::setVec2ForKey @ 0x1800208d3
// > ??> @ 0x1801438a8
// > ??> @ 0x1801aed70
//
// 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=4
void __fastcall DS_Dictionary::setVec2ForKey(DS_Dictionary *this, char *a2, const struct cocos2d::CCPoint *a3, char a4)
{
const char *v7; // rbx
const char *v8; // r8
char *v9; // rax
const char *v10; // r8
_QWORD *v11; // rax
__int64 v12; // rax
_QWORD *v13; // rax
_QWORD *v14; // rbx
const char *v15; // r8
__int64 v16; // rax
__int64 v17; // rax
_BYTE *v18; // rcx
__int64 v19; // [rsp+20h] [rbp-E0h] BYREF
_BYTE v20[8]; // [rsp+28h] [rbp-D8h] BYREF
_QWORD v21[2]; // [rsp+30h] [rbp-D0h] BYREF
_QWORD v22[2]; // [rsp+40h] [rbp-C0h] BYREF
void *v23; // [rsp+50h] [rbp-B0h] BYREF
void **v24; // [rsp+58h] [rbp-A8h] BYREF
_BYTE v25[96]; // [rsp+60h] [rbp-A0h] BYREF
__int64 v26; // [rsp+C0h] [rbp-40h]
int v27; // [rsp+C8h] [rbp-38h]
_BYTE v28[104]; // [rsp+D8h] [rbp-28h] BYREF
void *Block; // [rsp+140h] [rbp+40h] BYREF
unsigned __int64 v30; // [rsp+158h] [rbp+58h]
v22[0] = &unk_1800E6C00;
v23 = &unk_1800E6C08;
std::ios::ios(v28);
LODWORD(v19) = 1;
std::iostream::iostream(v22, &v24, 0);
*(_QWORD *)((char *)v22 + *(int *)(v22[0] + 4LL)) = &std::basic_stringstream,std::allocator>::`vftable';
*(_DWORD *)((char *)&v21[1] + *(int *)(v22[0] + 4LL) + 4) = *(_DWORD *)(v22[0] + 4LL) - 152;
std::streambuf::streambuf(&v24);
v24 = &std::stringbuf::`vftable';
v26 = 0;
v27 = 0;
sub_180015680((__int64)&v23, (__int64)"{");
std::ostream::operator<<(&v23);
sub_180015680((__int64)&v23, (__int64)",");
std::ostream::operator<<(&v23);
sub_180015680((__int64)&v23, (__int64)"}");
DS_Dictionary::removeKey(this, a2);
pugi::xml_node::xml_node((cocos2d::CCThread *)v21);
v7 = "k";
if ( !a4 )
goto LABEL_9;
v8 = "k";
if ( this->compatible )
v8 = "key";
sub_18007FB10(&this->dictTree._Mypair._Myval2._Mylast[-1], &v19, v8);
if ( sub_18007F4E0(&v19) )
{
while ( 1 )
{
v9 = (char *)sub_18007FB70(&v19);
if ( !sub_1800190E0(v9, a2) )
break;
v10 = "k";
if ( this->compatible )
v10 = "key";
v19 = *(_QWORD *)sub_180081A50(&v19, v20, v10);
if ( !sub_18007F4E0(&v19) )
goto LABEL_9;
}
if ( this->compatible )
v7 = "key";
v11 = (_QWORD *)sub_180081070(&this->dictTree._Mypair._Myval2._Mylast[-1], v20, v7, &v19);
}
else
{
LABEL_9:
if ( this->compatible )
v7 = "key";
v11 = (_QWORD *)sub_18007F870(&this->dictTree._Mypair._Myval2._Mylast[-1], v20, v7);
}
v21[0] = *v11;
v12 = sub_18007F910(v21, v20, 3);
sub_180085410(v12, a2);
v13 = (_QWORD *)sub_1800214B0(v22, &Block);
v14 = v13;
if ( v13[3] > 0xFu )
v14 = (_QWORD *)*v13;
v15 = "s";
if ( this->compatible )
v15 = "string";
v16 = sub_180080EE0(&this->dictTree._Mypair._Myval2._Mylast[-1], v20, v15, v21);
v17 = sub_18007F910(v16, &v19, 3);
sub_180085410(v17, v14);
if ( v30 > 0xF )
{
v18 = Block;
if ( v30 + 1 >= 0x1000 )
{
v18 = *((_BYTE **)Block - 1);
if ( (unsigned __int64)((_BYTE *)Block - v18 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v18);
}
*(_QWORD *)((char *)v22 + *(int *)(v22[0] + 4LL)) = &std::basic_stringstream,std::allocator>::`vftable';
*(_DWORD *)((char *)&v21[1] + *(int *)(v22[0] + 4LL) + 4) = *(_DWORD *)(v22[0] + 4LL) - 152;
sub_1800179A0((__int64)&v24);
std::iostream::~iostream>(v25);
std::ios::~ios>(v28);
}