{"type": "func", "start": 5368945488, "end": 5368946018, "name": "AchievementManager::getAllAchievementsSorted", "pseudocode": "// \n// AchievementManager::getAllAchievementsSorted from 0x140039b50 to 0x140039d62 (530 bytes)\n// \n// 3 xrefs:\n// > AchievementManager::init @ 0x140007eae\n// > AchievementManager::init @ 0x140007ec8\n// > <???> @ 0x1406c3c6c\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\n// Hidden C++ exception states: #wind=2\ncocos2d::CCArray *AchievementManager::getAllAchievementsSorted(AchievementManager *a1, bool a2)\n{\n  cocos2d::CCArray *v4; // r14\n  cocos2d::CCArray *v5; // rbp\n  unsigned int i; // edi\n  cocos2d::CCString *v7; // rax\n  const char *CString; // rax\n  __int64 v9; // r8\n  struct cocos2d::CCObject *v10; // rsi\n  void *v11; // rcx\n  __int64 v12; // rbx\n  void *v13; // rcx\n  __int128 v15; // [rsp+20h] [rbp-78h] BYREF\n  __int64 v16; // [rsp+30h] [rbp-68h]\n  unsigned __int64 v17; // [rsp+38h] [rbp-60h]\n  __int128 v18; // [rsp+40h] [rbp-58h] BYREF\n  __int64 v19; // [rsp+50h] [rbp-48h]\n  unsigned __int64 v20; // [rsp+58h] [rbp-40h]\n\n  v4 = cocos2d::CCDictionary::allKeys(a1->m_platformAchievements);\n  v5 = (cocos2d::CCArray *)cocos2d::CCArray::create();\n  for ( i = 0; i < cocos2d::CCArray::count(v4); ++i )\n  {\n    v7 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v4, i);\n    CString = cocos2d::CCString::getCString(v7);\n    v15 = 0;\n    v16 = 0;\n    v17 = 0;\n    v9 = -1;\n    do\n      ++v9;\n    while ( CString[v9] );\n    sub_14003A930(&v15);\n    v10 = (struct cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(a1->m_platformAchievements, &v15);\n    if ( v17 > 0xF )\n    {\n      v11 = (void *)v15;\n      if ( v17 + 1 >= 0x1000 )\n      {\n        v11 = *(void **)(v15 - 8);\n        if ( (unsigned __int64)(v15 - (_QWORD)v11 - 8) > 0x1F )\n          invalid_parameter_noinfo_noreturn();\n      }\n      j_j_free(v11);\n    }\n    v16 = 0;\n    v17 = 15;\n    LOBYTE(v15) = 0;\n    if ( a2 )\n    {\n      v18 = 0;\n      v19 = 2;\n      v20 = 15;\n      strcpy((char *)&v18, \"un\");\n      v12 = cocos2d::CCDictionary::objectForKey(v10, &v18);\n      if ( v20 > 0xF )\n      {\n        v13 = (void *)v18;\n        if ( v20 + 1 >= 0x1000 )\n        {\n          v13 = *(void **)(v18 - 8);\n          if ( (unsigned __int64)(v18 - (_QWORD)v13 - 8) > 0x1F )\n            invalid_parameter_noinfo_noreturn();\n        }\n        j_j_free(v13);\n      }\n      if ( v12 )\n        continue;\n    }\n    cocos2d::CCArray::addObject(v5, v10);\n  }\n  if ( cocos2d::CCArray::count(v5) )\n    qsort(v5->data->arr, v5->data->num, 8u, (_CoreCrtNonSecureSearchSortCompareFunction)CompareFunction);\n  return v5;\n}", "assembly": "; \n; AchievementManager::getAllAchievementsSorted from 0x140039b50 to 0x140039d62 (530 bytes)\n; \n; 3 xrefs:\n; > AchievementManager::init @ 0x140007eae\n; > AchievementManager::init @ 0x140007ec8\n; > <???> @ 0x1406c3c6c\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\nmov     [rsp+arg_8], rbx                                               ; +0x0, 0x140039b50\nmov     [rsp+arg_10], rbp                                              ; +0x5, 0x140039b55\nmov     [rsp+arg_18], rsi                                              ; +0xa, 0x140039b5a\npush    rdi                                                            ; +0xf, 0x140039b5f\npush    r12                                                            ; +0x10, 0x140039b60\npush    r13                                                            ; +0x12, 0x140039b62\npush    r14                                                            ; +0x14, 0x140039b64\npush    r15                                                            ; +0x16, 0x140039b66\nsub     rsp, 70h                                                       ; +0x18, 0x140039b68\nmov     rax, cs:__security_cookie                                      ; +0x1c, 0x140039b6c\nxor     rax, rsp                                                       ; +0x23, 0x140039b73\nmov     [rsp+98h+var_38], rax                                          ; +0x26, 0x140039b76\nmovzx   r15d, dl                                                       ; +0x2b, 0x140039b7b\nmov     r13, rcx                                                       ; +0x2f, 0x140039b7f\nmov     rcx, [rcx+148h]                                                ; +0x32, 0x140039b82\ncall    cs:?allKeys@CCDictionary@cocos2d@@QEAAPEAVCCArray@2@XZ; cocos2d::CCDictionary::allKeys(void) ; +0x39, 0x140039b89\nmov     r14, rax                                                       ; +0x3f, 0x140039b8f\ncall    cs:?create@CCArray@cocos2d@@SAPEAV12@XZ; cocos2d::CCArray::create(void) ; +0x42, 0x140039b92\nmov     rbp, rax                                                       ; +0x48, 0x140039b98\nxor     r12d, r12d                                                     ; +0x4b, 0x140039b9b\nmov     edi, r12d                                                      ; +0x4e, 0x140039b9e\nmov     rcx, r14                                                       ; +0x51, 0x140039ba1\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x54, 0x140039ba4\ntest    eax, eax                                                       ; +0x5a, 0x140039baa\njz      loc_140039CFC                                                  ; +0x5c, 0x140039bac\nmov     ebx, 6E75h                                                     ; +0x62, 0x140039bb2\nmov     edx, edi                                                       ; +0x67, 0x140039bb7\nmov     rcx, r14                                                       ; +0x69, 0x140039bb9\ncall    cs:?objectAtIndex@CCArray@cocos2d@@QEAAPEAVCCObject@2@I@Z; cocos2d::CCArray::objectAtIndex(uint) ; +0x6c, 0x140039bbc\nmov     rcx, rax                                                       ; +0x72, 0x140039bc2\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0x75, 0x140039bc5\nxorps   xmm0, xmm0                                                     ; +0x7b, 0x140039bcb\nmovups  [rsp+98h+var_78], xmm0                                         ; +0x7e, 0x140039bce\nmov     [rsp+98h+var_68], r12                                          ; +0x83, 0x140039bd3\nmov     [rsp+98h+var_60], r12                                          ; +0x88, 0x140039bd8\nmov     r8, 0FFFFFFFFFFFFFFFFh                                         ; +0x8d, 0x140039bdd\ninc     r8                                                             ; +0x94, 0x140039be4\ncmp     byte ptr [rax+r8], 0                                           ; +0x97, 0x140039be7\njnz     short loc_140039BE4                                            ; +0x9c, 0x140039bec\nmov     rdx, rax                                                       ; +0x9e, 0x140039bee\nlea     rcx, [rsp+98h+var_78]                                          ; +0xa1, 0x140039bf1\ncall    sub_14003A930                                                  ; +0xa6, 0x140039bf6\nnop                                                                    ; +0xab, 0x140039bfb\nlea     rdx, [rsp+98h+var_78]                                          ; +0xac, 0x140039bfc\nmov     rcx, [r13+148h]                                                ; +0xb1, 0x140039c01\ncall    cs:?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 &) ; +0xb8, 0x140039c08\nmov     rsi, rax                                                       ; +0xbe, 0x140039c0e\nmov     rdx, [rsp+98h+var_60]                                          ; +0xc1, 0x140039c11\ncmp     rdx, 0Fh                                                       ; +0xc6, 0x140039c16\njbe     short loc_140039C4E                                            ; +0xca, 0x140039c1a\ninc     rdx                                                            ; +0xcc, 0x140039c1c\nmov     rcx, qword ptr [rsp+98h+var_78]                                ; +0xcf, 0x140039c1f\nmov     rax, rcx                                                       ; +0xd4, 0x140039c24\ncmp     rdx, 1000h                                                     ; +0xd7, 0x140039c27\njb      short loc_140039C49                                            ; +0xde, 0x140039c2e\nadd     rdx, 27h ; '''                                                 ; +0xe0, 0x140039c30\nmov     rcx, [rcx-8]; Block                                            ; +0xe4, 0x140039c34\nsub     rax, rcx                                                       ; +0xe8, 0x140039c38\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0xeb, 0x140039c3b\ncmp     rax, 1Fh                                                       ; +0xef, 0x140039c3f\nja      loc_140039D54                                                  ; +0xf3, 0x140039c43\ncall    j_j_free                                                       ; +0xf9, 0x140039c49\nmov     [rsp+98h+var_68], r12                                          ; +0xfe, 0x140039c4e\nmov     [rsp+98h+var_60], 0Fh                                          ; +0x103, 0x140039c53\nmov     byte ptr [rsp+98h+var_78], 0                                   ; +0x10c, 0x140039c5c\ntest    r15b, r15b                                                     ; +0x111, 0x140039c61\njz      short loc_140039CDD                                            ; +0x114, 0x140039c64\nxorps   xmm0, xmm0                                                     ; +0x116, 0x140039c66\nmovups  [rsp+98h+var_58], xmm0                                         ; +0x119, 0x140039c69\nmov     [rsp+98h+var_48], 2                                            ; +0x11e, 0x140039c6e\nmov     [rsp+98h+var_40], 0Fh                                          ; +0x127, 0x140039c77\nmov     word ptr [rsp+98h+var_58], bx                                  ; +0x130, 0x140039c80\nmov     byte ptr [rsp+98h+var_58+2], 0                                 ; +0x135, 0x140039c85\nlea     rdx, [rsp+98h+var_58]                                          ; +0x13a, 0x140039c8a\nmov     rcx, rsi                                                       ; +0x13f, 0x140039c8f\ncall    cs:?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 &) ; +0x142, 0x140039c92\nmov     rbx, rax                                                       ; +0x148, 0x140039c98\nmov     rdx, [rsp+98h+var_40]                                          ; +0x14b, 0x140039c9b\ncmp     rdx, 0Fh                                                       ; +0x150, 0x140039ca0\njbe     short loc_140039CD8                                            ; +0x154, 0x140039ca4\ninc     rdx                                                            ; +0x156, 0x140039ca6\nmov     rcx, qword ptr [rsp+98h+var_58]                                ; +0x159, 0x140039ca9\nmov     rax, rcx                                                       ; +0x15e, 0x140039cae\ncmp     rdx, 1000h                                                     ; +0x161, 0x140039cb1\njb      short loc_140039CD3                                            ; +0x168, 0x140039cb8\nadd     rdx, 27h ; '''                                                 ; +0x16a, 0x140039cba\nmov     rcx, [rcx-8]; Block                                            ; +0x16e, 0x140039cbe\nsub     rax, rcx                                                       ; +0x172, 0x140039cc2\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x175, 0x140039cc5\ncmp     rax, 1Fh                                                       ; +0x179, 0x140039cc9\nja      loc_140039D5B                                                  ; +0x17d, 0x140039ccd\ncall    j_j_free                                                       ; +0x183, 0x140039cd3\ntest    rbx, rbx                                                       ; +0x188, 0x140039cd8\njnz     short loc_140039CE9                                            ; +0x18b, 0x140039cdb\nmov     rdx, rsi                                                       ; +0x18d, 0x140039cdd\nmov     rcx, rbp                                                       ; +0x190, 0x140039ce0\ncall    cs:?addObject@CCArray@cocos2d@@QEAAXPEAVCCObject@2@@Z; cocos2d::CCArray::addObject(cocos2d::CCObject *) ; +0x193, 0x140039ce3\ninc     edi                                                            ; +0x199, 0x140039ce9\nmov     rcx, r14                                                       ; +0x19b, 0x140039ceb\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x19e, 0x140039cee\ncmp     edi, eax                                                       ; +0x1a4, 0x140039cf4\njb      loc_140039BB2                                                  ; +0x1a6, 0x140039cf6\nmov     rcx, rbp                                                       ; +0x1ac, 0x140039cfc\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x1af, 0x140039cff\ntest    eax, eax                                                       ; +0x1b5, 0x140039d05\njz      short loc_140039D26                                            ; +0x1b7, 0x140039d07\nmov     rcx, [rbp+38h]                                                 ; +0x1b9, 0x140039d09\nmov     edx, [rcx]; NumOfElements                                      ; +0x1bd, 0x140039d0d\nlea     r9, CompareFunction; CompareFunction                           ; +0x1bf, 0x140039d0f\nmov     r8d, 8; SizeOfElements                                         ; +0x1c6, 0x140039d16\nmov     rcx, [rcx+10h]; Base                                           ; +0x1cc, 0x140039d1c\ncall    cs:qsort                                                       ; +0x1d0, 0x140039d20\nmov     rax, rbp                                                       ; +0x1d6, 0x140039d26\nmov     rcx, [rsp+98h+var_38]                                          ; +0x1d9, 0x140039d29\nxor     rcx, rsp; StackCookie                                          ; +0x1de, 0x140039d2e\ncall    __security_check_cookie                                        ; +0x1e1, 0x140039d31\nlea     r11, [rsp+98h+var_28]                                          ; +0x1e6, 0x140039d36\nmov     rbx, [r11+38h]                                                 ; +0x1eb, 0x140039d3b\nmov     rbp, [r11+40h]                                                 ; +0x1ef, 0x140039d3f\nmov     rsi, [r11+48h]                                                 ; +0x1f3, 0x140039d43\nmov     rsp, r11                                                       ; +0x1f7, 0x140039d47\npop     r15                                                            ; +0x1fa, 0x140039d4a\npop     r14                                                            ; +0x1fc, 0x140039d4c\npop     r13                                                            ; +0x1fe, 0x140039d4e\npop     r12                                                            ; +0x200, 0x140039d50\npop     rdi                                                            ; +0x202, 0x140039d52\nretn                                                                   ; +0x203, 0x140039d53\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x204, 0x140039d54\ndb 0CCh                                                                ; +0x20a, 0x140039d5a\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x20b, 0x140039d5b\ndb 0CCh                                                                ; +0x211, 0x140039d61", "xrefs": ["AchievementManager::init @ 0x140007eae", "AchievementManager::init @ 0x140007ec8", "<???> @ 0x1406c3c6c"], "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"}