{"type": "func", "start": 5371036864, "end": 5371037579, "name": "GameLevelManager::onGetLeaderboardScoresCompleted", "pseudocode": "// \n// GameLevelManager::onGetLeaderboardScoresCompleted from 0x1402384c0 to 0x14023878b (715 bytes)\n// \n// 2 xrefs:\n// > GameLevelManager::handleIt @ 0x140219b8b\n// > <???> @ 0x14091c010\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 11:28:33 +0000\n// \n\n// Hidden C++ exception states: #wind=2\nvoid __fastcall GameLevelManager::onGetLeaderboardScoresCompleted(_QWORD *a1, const void **a2, __int64 *a3)\n{\n  _BYTE *v6; // r12\n  cocos2d::CCArray *v7; // rbx\n  int v8; // edi\n  cocos2d::CCString *v9; // rax\n  int v10; // r15d\n  cocos2d::CCString *v11; // rax\n  int v12; // eax\n  int v13; // ebx\n  const void *v14; // rcx\n  size_t v15; // r8\n  __int64 v16; // rcx\n  _QWORD *v17; // rax\n  cocos2d::CCArray *Scores; // rdi\n  unsigned int *v19; // rcx\n  __int64 v20; // rax\n  unsigned __int64 v21; // rcx\n  unsigned __int64 i; // rdx\n  int v23; // ebx\n  int v24; // ebx\n  int (__cdecl *v25)(const void *, const void *); // r9\n  int v26; // edx\n  unsigned int *v27; // rcx\n  __int64 v28; // rax\n  unsigned __int64 v29; // rcx\n  unsigned __int64 j; // r8\n  __int64 v31; // rcx\n  __int128 Buf2; // [rsp+20h] [rbp-98h] BYREF\n  __int64 v33; // [rsp+30h] [rbp-88h]\n  __int64 v34; // [rsp+38h] [rbp-80h]\n  _BYTE v35[32]; // [rsp+48h] [rbp-70h] BYREF\n  const void **v36; // [rsp+68h] [rbp-50h]\n  __int64 *v37; // [rsp+70h] [rbp-48h]\n\n  v36 = a2;\n  v37 = a3;\n  v6 = a3;\n  if ( (unsigned __int64)a3[3] > 0xF )\n    v6 = (_BYTE *)*a3;\n  GameLevelManager::removeDLFromActive((__int64)a1, v6);\n  v7 = sub_1400D2840(a3, \"_\");\n  v8 = 0;\n  if ( cocos2d::CCArray::count(v7) == 3 )\n  {\n    v9 = cocos2d::CCArray::stringAtIndex(v7, 1u);\n    v10 = cocos2d::CCString::intValue(v9);\n  }\n  else\n  {\n    v10 = 0;\n  }\n  if ( cocos2d::CCArray::count(v7) == 3 )\n  {\n    v11 = cocos2d::CCArray::stringAtIndex(v7, 2u);\n    v12 = cocos2d::CCString::intValue(v11);\n  }\n  else\n  {\n    v12 = 0;\n  }\n  v13 = 0;\n  if ( v10 != 3 )\n    v13 = v12;\n  Buf2 = 0;\n  v33 = 2;\n  v34 = 15;\n  strcpy((char *)&Buf2, \"-1\");\n  v14 = a2;\n  if ( (unsigned __int64)a2[3] > 0xF )\n    v14 = *a2;\n  v15 = (size_t)a2[2];\n  if ( v15 > 2 )\n    v15 = 2;\n  if ( !memcmp(v14, &Buf2, v15) && a2[2] == (const void *)2 )\n  {\n    v16 = a1[178];\n    if ( v16 )\n      (*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v16 + 24LL))(v16, v6);\n  }\n  else\n  {\n    v17 = (_QWORD *)sub_14003F4F0((__int64)v35, (__int64)a2);\n    LOBYTE(v8) = v10 == 3;\n    Scores = (cocos2d::CCArray *)GameLevelManager::createAndGetScores(a1, v17, v8);\n    if ( cocos2d::CCArray::count(Scores) )\n    {\n      if ( v13 )\n      {\n        if ( Scores )\n        {\n          v19 = *((unsigned int **)Scores + 7);\n          v20 = *v19;\n          if ( (_DWORD)v20 )\n          {\n            v21 = *((_QWORD *)v19 + 2);\n            for ( i = v21 + 8 * (v20 - 1); v21 <= i; v21 += 8LL )\n            {\n              if ( !*(_QWORD *)v21 )\n                break;\n              *(_DWORD *)(*(_QWORD *)v21 + 944LL) = v13;\n            }\n          }\n        }\n      }\n    }\n    if ( cocos2d::CCArray::count(Scores) && v10 == 4 )\n    {\n      v23 = v13 - 1;\n      if ( v23 )\n      {\n        v24 = v23 - 1;\n        if ( v24 )\n          v25 = v24 == 1\n              ? (int (__cdecl *)(const void *, const void *))scoreCompareUserCoins\n              : (int (__cdecl *)(const void *, const void *))scoreCompare;\n        else\n          v25 = (int (__cdecl *)(const void *, const void *))scoreCompareDemons;\n      }\n      else\n      {\n        v25 = (int (__cdecl *)(const void *, const void *))scoreCompareMoons;\n      }\n      qsort(*(void **)(*((_QWORD *)Scores + 7) + 16LL), **((unsigned int **)Scores + 7), 8u, v25);\n      v26 = 1;\n      if ( Scores )\n      {\n        v27 = *((unsigned int **)Scores + 7);\n        v28 = *v27;\n        if ( (_DWORD)v28 )\n        {\n          v29 = *((_QWORD *)v27 + 2);\n          for ( j = v29 + 8 * (v28 - 1); v29 <= j; v29 += 8LL )\n          {\n            if ( !*(_QWORD *)v29 )\n              break;\n            *(_DWORD *)(*(_QWORD *)v29 + 412LL) = v26++;\n          }\n        }\n      }\n    }\n    Buf2 = 0;\n    v33 = 1;\n    v34 = 15;\n    LOWORD(Buf2) = 32;\n    GameLevelManager::storeSearchResult((__int64)a1, (__int64)Scores, &Buf2, v6);\n    v31 = a1[178];\n    if ( v31 )\n      (*(void (__fastcall **)(__int64, cocos2d::CCArray *, _BYTE *))(*(_QWORD *)v31 + 16LL))(v31, Scores, v6);\n  }\n  sub_14003D310((__int64)a2);\n  sub_14003D310((__int64)a3);\n}", "assembly": "; \n; GameLevelManager::onGetLeaderboardScoresCompleted from 0x1402384c0 to 0x14023878b (715 bytes)\n; \n; 2 xrefs:\n; > GameLevelManager::handleIt @ 0x140219b8b\n; > <???> @ 0x14091c010\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 11:28:33 +0000\n; \npush    rbx                                                            ; +0x0, 0x1402384c0\npush    rsi                                                            ; +0x2, 0x1402384c2\npush    rdi                                                            ; +0x3, 0x1402384c3\npush    r12                                                            ; +0x4, 0x1402384c4\npush    r13                                                            ; +0x6, 0x1402384c6\npush    r14                                                            ; +0x8, 0x1402384c8\npush    r15                                                            ; +0xa, 0x1402384ca\nsub     rsp, 80h                                                       ; +0xc, 0x1402384cc\nmov     rax, cs:__security_cookie                                      ; +0x13, 0x1402384d3\nxor     rax, rsp                                                       ; +0x1a, 0x1402384da\nmov     [rsp+0B8h+var_40], rax                                         ; +0x1d, 0x1402384dd\nmov     rsi, r8                                                        ; +0x22, 0x1402384e2\nmov     r14, rdx                                                       ; +0x25, 0x1402384e5\nmov     r13, rcx                                                       ; +0x28, 0x1402384e8\nmov     [rsp+0B8h+var_50], rdx                                         ; +0x2b, 0x1402384eb\nmov     [rsp+0B8h+var_48], r8                                          ; +0x30, 0x1402384f0\nmov     r12, r8                                                        ; +0x35, 0x1402384f5\ncmp     qword ptr [r8+18h], 0Fh                                        ; +0x38, 0x1402384f8\njbe     short loc_140238502                                            ; +0x3d, 0x1402384fd\nmov     r12, [r8]                                                      ; +0x3f, 0x1402384ff\nmov     rdx, r12                                                       ; +0x42, 0x140238502\ncall    GameLevelManager__removeDLFromActive                           ; +0x45, 0x140238505\nlea     rdx, asc_14071413C; \"_\"                                        ; +0x4a, 0x14023850a\nmov     rcx, rsi                                                       ; +0x51, 0x140238511\ncall    sub_1400D2840                                                  ; +0x54, 0x140238514\nmov     rbx, rax                                                       ; +0x59, 0x140238519\nmov     rcx, rax                                                       ; +0x5c, 0x14023851c\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x5f, 0x14023851f\nxor     edi, edi                                                       ; +0x65, 0x140238525\ncmp     eax, 3                                                         ; +0x67, 0x140238527\njnz     short loc_140238548                                            ; +0x6a, 0x14023852a\nmov     edx, 1                                                         ; +0x6c, 0x14023852c\nmov     rcx, rbx                                                       ; +0x71, 0x140238531\ncall    cs:?stringAtIndex@CCArray@cocos2d@@QEAAPEAVCCString@2@I@Z; cocos2d::CCArray::stringAtIndex(uint) ; +0x74, 0x140238534\nmov     rcx, rax                                                       ; +0x7a, 0x14023853a\ncall    cs:?intValue@CCString@cocos2d@@QEBAHXZ; cocos2d::CCString::intValue(void) ; +0x7d, 0x14023853d\nmov     r15d, eax                                                      ; +0x83, 0x140238543\njmp     short loc_14023854B                                            ; +0x86, 0x140238546\nmov     r15d, edi                                                      ; +0x88, 0x140238548\nmov     rcx, rbx                                                       ; +0x8b, 0x14023854b\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x8e, 0x14023854e\nmov     edx, 2                                                         ; +0x94, 0x140238554\ncmp     eax, 3                                                         ; +0x99, 0x140238559\njnz     short loc_140238577                                            ; +0x9c, 0x14023855c\nmov     rcx, rbx                                                       ; +0x9e, 0x14023855e\ncall    cs:?stringAtIndex@CCArray@cocos2d@@QEAAPEAVCCString@2@I@Z; cocos2d::CCArray::stringAtIndex(uint) ; +0xa1, 0x140238561\nmov     rcx, rax                                                       ; +0xa7, 0x140238567\ncall    cs:?intValue@CCString@cocos2d@@QEBAHXZ; cocos2d::CCString::intValue(void) ; +0xaa, 0x14023856a\nmov     edx, 2                                                         ; +0xb0, 0x140238570\njmp     short loc_140238579                                            ; +0xb5, 0x140238575\nmov     eax, edi                                                       ; +0xb7, 0x140238577\nmov     ebx, edi                                                       ; +0xb9, 0x140238579\ncmp     r15d, 3                                                        ; +0xbb, 0x14023857b\ncmovnz  ebx, eax                                                       ; +0xbf, 0x14023857f\nxorps   xmm0, xmm0                                                     ; +0xc2, 0x140238582\nmovups  [rsp+0B8h+Buf2], xmm0                                          ; +0xc5, 0x140238585\nmov     [rsp+0B8h+var_88], rdx                                         ; +0xca, 0x14023858a\nmov     [rsp+0B8h+var_80], 0Fh                                         ; +0xcf, 0x14023858f\nmov     eax, 312Dh                                                     ; +0xd8, 0x140238598\nmov     word ptr [rsp+0B8h+Buf2], ax                                   ; +0xdd, 0x14023859d\nmov     byte ptr [rsp+0B8h+Buf2+2], dil                                ; +0xe2, 0x1402385a2\nmov     rcx, r14                                                       ; +0xe7, 0x1402385a7\ncmp     qword ptr [r14+18h], 0Fh                                       ; +0xea, 0x1402385aa\njbe     short loc_1402385B4                                            ; +0xef, 0x1402385af\nmov     rcx, [r14]; Buf1                                               ; +0xf1, 0x1402385b1\nmov     r8, [r14+10h]                                                  ; +0xf4, 0x1402385b4\ncmp     r8, 2                                                          ; +0xf8, 0x1402385b8\ncmova   r8, rdx; Size                                                  ; +0xfc, 0x1402385bc\nlea     rdx, [rsp+0B8h+Buf2]; Buf2                                     ; +0x100, 0x1402385c0\ncall    memcmp                                                         ; +0x105, 0x1402385c5\ntest    eax, eax                                                       ; +0x10a, 0x1402385ca\njnz     short loc_1402385F3                                            ; +0x10c, 0x1402385cc\ncmp     qword ptr [r14+10h], 2                                         ; +0x10e, 0x1402385ce\njnz     short loc_1402385F3                                            ; +0x113, 0x1402385d3\nmov     rcx, [r13+590h]                                                ; +0x115, 0x1402385d5\ntest    rcx, rcx                                                       ; +0x11c, 0x1402385dc\njz      loc_14023875A                                                  ; +0x11f, 0x1402385df\nmov     rax, [rcx]                                                     ; +0x125, 0x1402385e5\nmov     rdx, r12                                                       ; +0x128, 0x1402385e8\ncall    qword ptr [rax+18h]                                            ; +0x12b, 0x1402385eb\njmp     loc_14023875A                                                  ; +0x12e, 0x1402385ee\nmov     rdx, r14                                                       ; +0x133, 0x1402385f3\nlea     rcx, [rsp+0B8h+var_70]                                         ; +0x136, 0x1402385f6\ncall    sub_14003F4F0                                                  ; +0x13b, 0x1402385fb\ncmp     r15d, 3                                                        ; +0x140, 0x140238600\nsetz    dil                                                            ; +0x144, 0x140238604\nmov     r8d, edi                                                       ; +0x148, 0x140238608\nmov     rdx, rax                                                       ; +0x14b, 0x14023860b\nmov     rcx, r13                                                       ; +0x14e, 0x14023860e\ncall    GameLevelManager__createAndGetScores                           ; +0x151, 0x140238611\nmov     rdi, rax                                                       ; +0x156, 0x140238616\nmov     rcx, rax                                                       ; +0x159, 0x140238619\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x15c, 0x14023861c\ntest    eax, eax                                                       ; +0x162, 0x140238622\njz      short loc_140238667                                            ; +0x164, 0x140238624\ntest    ebx, ebx                                                       ; +0x166, 0x140238626\njz      short loc_140238667                                            ; +0x168, 0x140238628\ntest    rdi, rdi                                                       ; +0x16a, 0x14023862a\njz      short loc_140238667                                            ; +0x16d, 0x14023862d\nmov     rcx, [rdi+38h]                                                 ; +0x16f, 0x14023862f\nmov     eax, [rcx]                                                     ; +0x173, 0x140238633\ntest    eax, eax                                                       ; +0x175, 0x140238635\njz      short loc_140238667                                            ; +0x177, 0x140238637\nmov     rcx, [rcx+10h]                                                 ; +0x179, 0x140238639\nlea     rdx, [rax-1]                                                   ; +0x17d, 0x14023863d\nlea     rdx, [rcx+rdx*8]                                               ; +0x181, 0x140238641\ncmp     rcx, rdx                                                       ; +0x185, 0x140238645\nja      short loc_140238667                                            ; +0x188, 0x140238648\nnop     word ptr [rax+rax+00h]                                         ; +0x18a, 0x14023864a\nmov     rax, [rcx]                                                     ; +0x190, 0x140238650\ntest    rax, rax                                                       ; +0x193, 0x140238653\njz      short loc_140238667                                            ; +0x196, 0x140238656\nmov     [rax+3B0h], ebx                                                ; +0x198, 0x140238658\nadd     rcx, 8                                                         ; +0x19e, 0x14023865e\ncmp     rcx, rdx                                                       ; +0x1a2, 0x140238662\njbe     short loc_140238650                                            ; +0x1a5, 0x140238665\nmov     rcx, rdi                                                       ; +0x1a7, 0x140238667\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x1aa, 0x14023866a\ntest    eax, eax                                                       ; +0x1b0, 0x140238670\njz      loc_14023870D                                                  ; +0x1b2, 0x140238672\ncmp     r15d, 4                                                        ; +0x1b8, 0x140238678\njnz     loc_14023870D                                                  ; +0x1bc, 0x14023867c\nmov     rax, [rdi+38h]                                                 ; +0x1c2, 0x140238682\nmov     edx, [rax]; NumOfElements                                      ; +0x1c6, 0x140238686\nmov     rcx, [rax+10h]; Base                                           ; +0x1c8, 0x140238688\nsub     ebx, 1                                                         ; +0x1cc, 0x14023868c\njz      short loc_1402386BC                                            ; +0x1cf, 0x14023868f\nsub     ebx, 1                                                         ; +0x1d1, 0x140238691\njz      short loc_1402386B3                                            ; +0x1d4, 0x140238694\nmov     r8d, 8                                                         ; +0x1d6, 0x140238696\ncmp     ebx, 1                                                         ; +0x1dc, 0x14023869c\njz      short loc_1402386AA                                            ; +0x1df, 0x14023869f\nlea     r9, scoreCompare                                               ; +0x1e1, 0x1402386a1\njmp     short loc_1402386C9                                            ; +0x1e8, 0x1402386a8\nlea     r9, scoreCompareUserCoins                                      ; +0x1ea, 0x1402386aa\njmp     short loc_1402386C9                                            ; +0x1f1, 0x1402386b1\nlea     r9, scoreCompareDemons                                         ; +0x1f3, 0x1402386b3\njmp     short loc_1402386C3                                            ; +0x1fa, 0x1402386ba\nlea     r9, scoreCompareMoons; CompareFunction                         ; +0x1fc, 0x1402386bc\nmov     r8d, 8; SizeOfElements                                         ; +0x203, 0x1402386c3\ncall    cs:qsort                                                       ; +0x209, 0x1402386c9\nmov     edx, 1                                                         ; +0x20f, 0x1402386cf\ntest    rdi, rdi                                                       ; +0x214, 0x1402386d4\njz      short loc_14023870D                                            ; +0x217, 0x1402386d7\nmov     rcx, [rdi+38h]                                                 ; +0x219, 0x1402386d9\nmov     eax, [rcx]                                                     ; +0x21d, 0x1402386dd\ntest    eax, eax                                                       ; +0x21f, 0x1402386df\njz      short loc_14023870D                                            ; +0x221, 0x1402386e1\nmov     rcx, [rcx+10h]                                                 ; +0x223, 0x1402386e3\nlea     r8, [rax-1]                                                    ; +0x227, 0x1402386e7\nlea     r8, [rcx+r8*8]                                                 ; +0x22b, 0x1402386eb\ncmp     rcx, r8                                                        ; +0x22f, 0x1402386ef\nja      short loc_14023870D                                            ; +0x232, 0x1402386f2\nmov     rax, [rcx]                                                     ; +0x234, 0x1402386f4\ntest    rax, rax                                                       ; +0x237, 0x1402386f7\njz      short loc_14023870D                                            ; +0x23a, 0x1402386fa\nmov     [rax+19Ch], edx                                                ; +0x23c, 0x1402386fc\ninc     edx                                                            ; +0x242, 0x140238702\nadd     rcx, 8                                                         ; +0x244, 0x140238704\ncmp     rcx, r8                                                        ; +0x248, 0x140238708\njbe     short loc_1402386F4                                            ; +0x24b, 0x14023870b\nxorps   xmm0, xmm0                                                     ; +0x24d, 0x14023870d\nmovups  [rsp+0B8h+Buf2], xmm0                                          ; +0x250, 0x140238710\nmov     [rsp+0B8h+var_88], 1                                           ; +0x255, 0x140238715\nmov     [rsp+0B8h+var_80], 0Fh                                         ; +0x25e, 0x14023871e\nmov     word ptr [rsp+0B8h+Buf2], 20h ; ' '                            ; +0x267, 0x140238727\nmov     r9, r12                                                        ; +0x26e, 0x14023872e\nlea     r8, [rsp+0B8h+Buf2]                                            ; +0x271, 0x140238731\nmov     rdx, rdi                                                       ; +0x276, 0x140238736\nmov     rcx, r13                                                       ; +0x279, 0x140238739\ncall    GameLevelManager__storeSearchResult                            ; +0x27c, 0x14023873c\nmov     rcx, [r13+590h]                                                ; +0x281, 0x140238741\ntest    rcx, rcx                                                       ; +0x288, 0x140238748\njz      short loc_14023875A                                            ; +0x28b, 0x14023874b\nmov     rax, [rcx]                                                     ; +0x28d, 0x14023874d\nmov     r8, r12                                                        ; +0x290, 0x140238750\nmov     rdx, rdi                                                       ; +0x293, 0x140238753\ncall    qword ptr [rax+10h]                                            ; +0x296, 0x140238756\nnop                                                                    ; +0x299, 0x140238759\nmov     rcx, r14                                                       ; +0x29a, 0x14023875a\ncall    sub_14003D310                                                  ; +0x29d, 0x14023875d\nnop                                                                    ; +0x2a2, 0x140238762\nmov     rcx, rsi                                                       ; +0x2a3, 0x140238763\ncall    sub_14003D310                                                  ; +0x2a6, 0x140238766\nmov     rcx, [rsp+0B8h+var_40]                                         ; +0x2ab, 0x14023876b\nxor     rcx, rsp; StackCookie                                          ; +0x2b0, 0x140238770\ncall    __security_check_cookie                                        ; +0x2b3, 0x140238773\nadd     rsp, 80h                                                       ; +0x2b8, 0x140238778\npop     r15                                                            ; +0x2bf, 0x14023877f\npop     r14                                                            ; +0x2c1, 0x140238781\npop     r13                                                            ; +0x2c3, 0x140238783\npop     r12                                                            ; +0x2c5, 0x140238785\npop     rdi                                                            ; +0x2c7, 0x140238787\npop     rsi                                                            ; +0x2c8, 0x140238788\npop     rbx                                                            ; +0x2c9, 0x140238789\nretn                                                                   ; +0x2ca, 0x14023878a", "xrefs": ["GameLevelManager::handleIt @ 0x140219b8b", "<???> @ 0x14091c010"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}