//
// cocos2d::CCDictionary::randomObject from 0x1002fa890 to 0x1002fa99c (268 bytes)
//
// 0 xrefs:
//
// 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:28:30 +0000
//
__int64 __fastcall cocos2d::CCDictionary::randomObject(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rax
int v3; // ecx
__int64 result; // rax
const char *CString; // r15
size_t v6; // rax
size_t v7; // r14
char *v8; // r12
size_t v9; // r13
__int64 v10; // rbx
_QWORD __dst[2]; // [rsp+0h] [rbp-40h] BYREF
void *__p; // [rsp+10h] [rbp-30h]
if ( !*(_DWORD *)(a1 + 64) )
return 0;
v1 = cocos2d::CCDictionary::allKeys(a1);
v2 = sub_1007FF020(v1);
v3 = *(_DWORD *)(a1 + 64);
if ( v3 != 1 )
{
if ( v3 == 2 )
return cocos2d::CCDictionary::objectForKey_1(a1, *(int *)(v2 + 56));
return 0;
}
CString = (const char *)cocos2d::CCString::getCString(v2);
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);
__p = v8;
__dst[0] = v9 + 1;
__dst[1] = v7;
goto LABEL_14;
}
LOBYTE(__dst[0]) = 2 * v6;
v8 = (char *)__dst + 1;
if ( v6 )
LABEL_14:
memmove(v8, CString, v7);
v8[v7] = 0;
result = cocos2d::CCDictionary::objectForKey(a1, (char *)__dst);
if ( (__dst[0] & 1) != 0 )
{
v10 = result;
operator delete(__p);
return v10;
}
return result;
}