//
// DS_Dictionary::getObjectForKey from 0x18001a7f0 to 0x18001aaef (767 bytes)
//
// 3 xrefs:
// > DS_Dictionary::getArrayForKey @ 0x180019ab5
// > ??> @ 0x18014cf68
// > ??> @ 0x1801b8a70
//
// 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 11:21:26 +0000
//
// Hidden C++ exception states: #wind=1
struct cocos2d::CCObject *__fastcall DS_Dictionary::getObjectForKey(DS_Dictionary *this, const char *a2)
{
const char *v4; // r8
const char *v5; // rax
const char *v6; // r8
struct cocos2d::CCObject *result; // rax
char v8; // bl
const char *v9; // rdx
const char *v10; // rcx
bool BoolForKey; // r14
int IntegerForKey; // eax
int v13; // ebx
ObjectDecoder *v14; // rax
char v15; // bl
const char *v16; // rdx
const char *v17; // rcx
cocos2d::CCObject *v18; // rbx
void *v19; // r8
const char *v20; // rbx
size_t v21; // rax
__int64 v22; // [rsp+30h] [rbp-40h] BYREF
_BYTE v23[8]; // [rsp+38h] [rbp-38h] BYREF
void *Block[2]; // [rsp+40h] [rbp-30h] BYREF
__m128i si128; // [rsp+50h] [rbp-20h]
v4 = "k";
if ( *((_BYTE *)this + 232) )
v4 = "key";
sub_180082A40(*((_QWORD *)this + 27) - 8LL, &v22, v4);
if ( !sub_1800823F0(&v22) )
return nullptr;
while ( 1 )
{
v5 = (const char *)sub_180082AC0(&v22);
if ( !strcmp(a2, v5) )
break;
v6 = "k";
if ( *((_BYTE *)this + 232) )
v6 = "key";
v22 = *(_QWORD *)sub_180084A40(&v22, v23, v6);
if ( !sub_1800823F0(&v22) )
return nullptr;
}
sub_180084AC0(&v22, v23);
v8 = *((_BYTE *)this + 232);
v9 = (const char *)sub_180084A20(v23);
v10 = "d";
if ( v8 )
v10 = "dict";
if ( strcmp(v10, v9) )
{
v15 = *((_BYTE *)this + 232);
v16 = (const char *)sub_180084A20(v23);
v17 = "t";
if ( v15 )
v17 = "true";
if ( !strcmp(v17, v16) )
{
*(_OWORD *)Block = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_1800ED1C0);
LOWORD(Block[0]) = 49;
v18 = cocos2d::CCString::create((__int64)Block);
if ( si128.m128i_i64[1] <= 0xFuLL )
return v18;
v19 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v19 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v19 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
}
else
{
v20 = (const char *)sub_180082AC0(v23);
*(_OWORD *)Block = 0;
si128 = 0;
v21 = strlen(v20);
sub_18000CEF0(Block, v20, v21);
v18 = cocos2d::CCString::create((__int64)Block);
if ( si128.m128i_i64[1] <= 0xFuLL )
return v18;
v19 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v19 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v19 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
}
j_j_free_0(v19);
return v18;
}
sub_18001C710((char *)this + 208, v23);
BoolForKey = DS_Dictionary::getBoolForKey(this, "_isArr");
IntegerForKey = DS_Dictionary::getIntegerForKey(this, "kCEK");
v13 = IntegerForKey;
if ( IntegerForKey )
{
if ( IntegerForKey == -1 )
v13 = DS_Dictionary::getIntegerForKey(this, "kCEK");
v14 = ObjectDecoder::sharedDecoder();
result = ObjectDecoder::getDecodedObject(v14, v13, this);
if ( (unsigned __int64)((__int64)(*((_QWORD *)this + 27) - *((_QWORD *)this + 26)) >> 3) > 1 )
*((_QWORD *)this + 27) -= 8LL;
}
else if ( BoolForKey )
{
return DS_Dictionary::getArrayForKey(this, a2, 1);
}
else
{
return DS_Dictionary::getDictForKey((char **)this, a2, 1);
}
return result;
}