{"type": "func", "start": 6442494256, "end": 6442494491, "name": "cocos2d::CCDictionary::randomObject", "pseudocode": "// \n// cocos2d::CCDictionary::randomObject from 0x18000a930 to 0x18000aa1b (235 bytes)\n// \n// 2 xrefs:\n// > <???> @ 0x1801438a8\n// > <???> @ 0x1801add20\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nstruct cocos2d::CCObject *__fastcall cocos2d::CCDictionary::randomObject(cocos2d::CCDictionary *this)\n{\n  cocos2d::CCArray *v2; // rax\n  struct cocos2d::CCObject *v3; // rax\n  cocos2d::CCDictionary::CCDictType m_eDictType; // ecx\n  char *CString; // rax\n  __int64 v7; // rbx\n  void *v8; // rcx\n  void *Block[3]; // [rsp+20h] [rbp-38h] BYREF\n  unsigned __int64 v10; // [rsp+38h] [rbp-20h]\n\n  if ( this->m_eDictType == kCCDictUnknown )\n    return nullptr;\n  v2 = cocos2d::CCDictionary::allKeys(this);\n  v3 = cocos2d::CCArray::randomObject(v2);\n  m_eDictType = this->m_eDictType;\n  if ( m_eDictType == kCCDictInt )\n    return cocos2d::CCDictionary::objectForKey(this, SLODWORD(v3[1].__vftable));\n  if ( m_eDictType != kCCDictStr )\n    return nullptr;\n  CString = (char *)cocos2d::CCString::getCString((cocos2d::CCString *)v3);\n  sub_180005910(Block, CString);\n  v7 = cocos2d::CCDictionary::objectForKey((__int64)this, (unsigned __int8 *)Block);\n  if ( v10 > 0xF )\n  {\n    v8 = Block[0];\n    if ( v10 + 1 >= 0x1000 )\n    {\n      v8 = *((void **)Block[0] - 1);\n      if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )\n        invalid_parameter_noinfo_noreturn();\n    }\n    j_j_free_0(v8);\n  }\n  return (struct cocos2d::CCObject *)v7;\n}", "assembly": "; \n; cocos2d::CCDictionary::randomObject from 0x18000a930 to 0x18000aa1b (235 bytes)\n; \n; 2 xrefs:\n; > <???> @ 0x1801438a8\n; > <???> @ 0x1801add20\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\npush    rbx                                                            ; +0x0, 0x18000a930\nsub     rsp, 50h                                                       ; +0x2, 0x18000a932\nmov     rax, cs:__security_cookie                                      ; +0x6, 0x18000a936\nxor     rax, rsp                                                       ; +0xd, 0x18000a93d\nmov     [rsp+58h+var_18], rax                                          ; +0x10, 0x18000a940\ncmp     dword ptr [rcx+40h], 0                                         ; +0x15, 0x18000a945\nmov     rbx, rcx                                                       ; +0x19, 0x18000a949\njz      loc_18000AA06                                                  ; +0x1c, 0x18000a94c\ncall    ?allKeys@CCDictionary@cocos2d@@QEAAPEAVCCArray@2@XZ; cocos2d::CCDictionary::allKeys(void) ; +0x22, 0x18000a952\nmov     rcx, rax; this                                                 ; +0x27, 0x18000a957\ncall    ?randomObject@CCArray@cocos2d@@QEAAPEAVCCObject@2@XZ; cocos2d::CCArray::randomObject(void) ; +0x2a, 0x18000a95a\nmov     ecx, [rbx+40h]                                                 ; +0x2f, 0x18000a95f\ncmp     ecx, 2                                                         ; +0x32, 0x18000a962\njnz     short loc_18000A986                                            ; +0x35, 0x18000a965\nmovsxd  rdx, dword ptr [rax+38h]; __int64                              ; +0x37, 0x18000a967\nmov     rcx, rbx; this                                                 ; +0x3b, 0x18000a96b\ncall    ?objectForKey@CCDictionary@cocos2d@@QEAAPEAVCCObject@2@_J@Z; cocos2d::CCDictionary::objectForKey(__int64) ; +0x3e, 0x18000a96e\nmov     rcx, [rsp+58h+var_18]                                          ; +0x43, 0x18000a973\nxor     rcx, rsp; StackCookie                                          ; +0x48, 0x18000a978\ncall    __security_check_cookie                                        ; +0x4b, 0x18000a97b\nadd     rsp, 50h                                                       ; +0x50, 0x18000a980\npop     rbx                                                            ; +0x54, 0x18000a984\nretn                                                                   ; +0x55, 0x18000a985\ncmp     ecx, 1                                                         ; +0x56, 0x18000a986\njnz     short loc_18000AA06                                            ; +0x59, 0x18000a989\nmov     rcx, rax; this                                                 ; +0x5b, 0x18000a98b\ncall    ?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0x5e, 0x18000a98e\nmov     rdx, rax                                                       ; +0x63, 0x18000a993\nlea     rcx, [rsp+58h+Block]                                           ; +0x66, 0x18000a996\ncall    sub_180005910                                                  ; +0x6b, 0x18000a99b\nlea     rdx, [rsp+58h+Block]                                           ; +0x70, 0x18000a9a0\nmov     rcx, rbx                                                       ; +0x75, 0x18000a9a5\ncall    ?objectForKey@CCDictionary@cocos2d@@QEAAPEAVCCObject@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::objectForKey(std::string const &) ; +0x78, 0x18000a9a8\nmov     rdx, [rsp+58h+var_20]                                          ; +0x7d, 0x18000a9ad\nmov     rbx, rax                                                       ; +0x82, 0x18000a9b2\ncmp     rdx, 0Fh                                                       ; +0x85, 0x18000a9b5\njbe     short loc_18000A9F0                                            ; +0x89, 0x18000a9b9\nmov     rcx, [rsp+58h+Block]; Block                                    ; +0x8b, 0x18000a9bb\ninc     rdx                                                            ; +0x90, 0x18000a9c0\nmov     rax, rcx                                                       ; +0x93, 0x18000a9c3\ncmp     rdx, 1000h                                                     ; +0x96, 0x18000a9c6\njb      short loc_18000A9EB                                            ; +0x9d, 0x18000a9cd\nmov     rcx, [rcx-8]                                                   ; +0x9f, 0x18000a9cf\nadd     rdx, 27h ; '''                                                 ; +0xa3, 0x18000a9d3\nsub     rax, rcx                                                       ; +0xa7, 0x18000a9d7\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0xaa, 0x18000a9da\ncmp     rax, 1Fh                                                       ; +0xae, 0x18000a9de\njbe     short loc_18000A9EB                                            ; +0xb2, 0x18000a9e2\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0xb4, 0x18000a9e4\ndb 0CCh                                                                ; +0xba, 0x18000a9ea\ncall    j_j_free_0                                                     ; +0xbb, 0x18000a9eb\nmov     rax, rbx                                                       ; +0xc0, 0x18000a9f0\nmov     rcx, [rsp+58h+var_18]                                          ; +0xc3, 0x18000a9f3\nxor     rcx, rsp; StackCookie                                          ; +0xc8, 0x18000a9f8\ncall    __security_check_cookie                                        ; +0xcb, 0x18000a9fb\nadd     rsp, 50h                                                       ; +0xd0, 0x18000aa00\npop     rbx                                                            ; +0xd4, 0x18000aa04\nretn                                                                   ; +0xd5, 0x18000aa05\nxor     eax, eax                                                       ; +0xd6, 0x18000aa06\nmov     rcx, [rsp+58h+var_18]                                          ; +0xd8, 0x18000aa08\nxor     rcx, rsp; StackCookie                                          ; +0xdd, 0x18000aa0d\ncall    __security_check_cookie                                        ; +0xe0, 0x18000aa10\nadd     rsp, 50h                                                       ; +0xe5, 0x18000aa15\npop     rbx                                                            ; +0xe9, 0x18000aa19\nretn                                                                   ; +0xea, 0x18000aa1a", "xrefs": ["<???> @ 0x1801438a8", "<???> @ 0x1801add20"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}