//
// cocos2d::CCDictionary::randomObject from 0x18000a930 to 0x18000aa1b (235 bytes)
//
// 2 xrefs:
// > ??> @ 0x1801438a8
// > ??> @ 0x1801add20
//
// 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
//
struct cocos2d::CCObject *__fastcall cocos2d::CCDictionary::randomObject(cocos2d::CCDictionary *this)
{
cocos2d::CCArray *v2; // rax
struct cocos2d::CCObject *v3; // rax
cocos2d::CCDictionary::CCDictType m_eDictType; // ecx
char *CString; // rax
__int64 v7; // rbx
void *v8; // rcx
void *Block[3]; // [rsp+20h] [rbp-38h] BYREF
unsigned __int64 v10; // [rsp+38h] [rbp-20h]
if ( this->m_eDictType == kCCDictUnknown )
return nullptr;
v2 = cocos2d::CCDictionary::allKeys(this);
v3 = cocos2d::CCArray::randomObject(v2);
m_eDictType = this->m_eDictType;
if ( m_eDictType == kCCDictInt )
return cocos2d::CCDictionary::objectForKey(this, SLODWORD(v3[1].__vftable));
if ( m_eDictType != kCCDictStr )
return nullptr;
CString = (char *)cocos2d::CCString::getCString((cocos2d::CCString *)v3);
sub_180005910(Block, CString);
v7 = cocos2d::CCDictionary::objectForKey((__int64)this, (unsigned __int8 *)Block);
if ( v10 > 0xF )
{
v8 = Block[0];
if ( v10 + 1 >= 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);
}
return (struct cocos2d::CCObject *)v7;
}