{"type": "func", "start": 5370121504, "end": 5370122149, "name": "GameLevelManager::onGetLevelLeaderboardCompleted", "pseudocode": "// \n// GameLevelManager::onGetLevelLeaderboardCompleted from 0x140158d20 to 0x140158fa5 (645 bytes)\n// \n// 2 xrefs:\n// > GameLevelManager::handleIt @ 0x140143bfa\n// > <???> @ 0x1406ca998\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=4\nvoid __fastcall GameLevelManager::onGetLevelLeaderboardCompleted(GameLevelManager *a1, const char *a2, const char *a3)\n{\n  const char *v6; // r12\n  int v7; // r13d\n  __int64 *v8; // rax\n  __int64 v9; // rdx\n  void *v10; // rbp\n  char *v11; // rdi\n  const char *v12; // rcx\n  const char *v13; // rcx\n  const char *v14; // rcx\n  __int64 i; // rbx\n  char *v16; // rax\n  const char *v17; // rcx\n  int v18; // ebx\n  __int64 v19; // rax\n  LeaderboardManagerDelegate *v20; // rcx\n  const void **v21; // rax\n  __int64 Scores; // rbx\n  LeaderboardManagerDelegate *m_leaderboardManagerDelegate; // rcx\n  __int64 *v24; // [rsp+20h] [rbp-A8h]\n  void *Block[2]; // [rsp+28h] [rbp-A0h] BYREF\n  __int64 v26; // [rsp+38h] [rbp-90h]\n  __int64 v27; // [rsp+40h] [rbp-88h]\n  __int64 v28; // [rsp+48h] [rbp-80h]\n  _BYTE v29[32]; // [rsp+50h] [rbp-78h] BYREF\n  const char *v30; // [rsp+70h] [rbp-58h]\n  const char *v31; // [rsp+78h] [rbp-50h]\n\n  v30 = a2;\n  v31 = a3;\n  v6 = a3;\n  if ( *((_QWORD *)a3 + 3) > 0xFu )\n    v6 = *(const char **)a3;\n  GameLevelManager::removeDLFromActive(a1, v6);\n  v28 = 0;\n  v7 = 0;\n  v8 = (__int64 *)sub_14003BDB0((__int64)v29, (__int64)a3);\n  v24 = v8;\n  if ( v8[2] )\n  {\n    *(_OWORD *)Block = 0;\n    v26 = 0;\n    sub_140140D00(v8, v9, (__int64 *)Block);\n    v10 = Block[1];\n    v11 = (char *)Block[0];\n    if ( ((char *)Block[1] - (char *)Block[0]) >> 5 == 4 )\n    {\n      v12 = (char *)Block[0] + 32;\n      if ( *((_QWORD *)Block[0] + 7) > 0xFu )\n        v12 = *(const char **)v12;\n      atoi(v12);\n      v13 = v11 + 64;\n      if ( *((_QWORD *)v11 + 11) > 0xFu )\n        v13 = *(const char **)v13;\n      LODWORD(v28) = atoi(v13);\n      v14 = v11 + 96;\n      if ( *((_QWORD *)v11 + 15) > 0xFu )\n        v14 = *(const char **)v14;\n      v7 = atoi(v14);\n    }\n    if ( v11 )\n    {\n      for ( i = (__int64)v11; (void *)i != v10; i += 32 )\n        sub_14003A830(i);\n      v16 = v11;\n      if ( ((v26 - (_QWORD)v11) & 0xFFFFFFFFFFFFFFE0uLL) >= 0x1000 )\n      {\n        v11 = *((char **)v11 - 1);\n        if ( (unsigned __int64)(v16 - v11 - 8) > 0x1F )\n          invalid_parameter_noinfo_noreturn();\n      }\n      j_j_free(v11);\n    }\n    v8 = v24;\n  }\n  sub_14003A830((__int64)v8);\n  v17 = a2;\n  if ( *((_QWORD *)a2 + 3) > 0xFu )\n    v17 = *(const char **)a2;\n  v18 = atoi(v17);\n  if ( (_DWORD)v28 == 4 )\n  {\n    v19 = cocos2d::CCDictionary::objectForKey(a1->m_localLeaderboardLevels, a3);\n    if ( v19 && v18 >= 0 )\n    {\n      if ( v7 )\n      {\n        if ( v7 == 1 )\n          *(_BYTE *)(v19 + 1473) = 0;\n      }\n      else\n      {\n        *(_BYTE *)(v19 + 1472) = 0;\n      }\n    }\n    cocos2d::CCDictionary::removeObjectForKey(a1->m_localLeaderboardLevels, a3);\n  }\n  else if ( v18 >= 0 )\n  {\n    v21 = (const void **)sub_14003BDB0((__int64)v29, (__int64)a2);\n    Scores = GameLevelManager::createAndGetScores((__int64)a1, v21, 3);\n    *(_OWORD *)Block = 0;\n    v26 = 1;\n    v27 = 15;\n    LOWORD(Block[0]) = 32;\n    GameLevelManager::storeSearchResult(a1, Scores, Block, v6);\n    m_leaderboardManagerDelegate = a1->m_leaderboardManagerDelegate;\n    if ( m_leaderboardManagerDelegate )\n      m_leaderboardManagerDelegate->loadLeaderboardFinished(\n        m_leaderboardManagerDelegate,\n        (cocos2d::CCArray *)Scores,\n        v6);\n  }\n  else\n  {\n    v20 = a1->m_leaderboardManagerDelegate;\n    if ( v20 )\n      v20->loadLeaderboardFailed(v20, v6);\n  }\n  sub_14003A830((__int64)a2);\n  sub_14003A830((__int64)a3);\n}", "assembly": "; \n; GameLevelManager::onGetLevelLeaderboardCompleted from 0x140158d20 to 0x140158fa5 (645 bytes)\n; \n; 2 xrefs:\n; > GameLevelManager::handleIt @ 0x140143bfa\n; > <???> @ 0x1406ca998\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_18], rbx                                              ; +0x0, 0x140158d20\npush    rbp                                                            ; +0x5, 0x140158d25\npush    rsi                                                            ; +0x6, 0x140158d26\npush    rdi                                                            ; +0x7, 0x140158d27\npush    r12                                                            ; +0x8, 0x140158d28\npush    r13                                                            ; +0xa, 0x140158d2a\npush    r14                                                            ; +0xc, 0x140158d2c\npush    r15                                                            ; +0xe, 0x140158d2e\nsub     rsp, 90h                                                       ; +0x10, 0x140158d30\nmov     rax, cs:__security_cookie                                      ; +0x17, 0x140158d37\nxor     rax, rsp                                                       ; +0x1e, 0x140158d3e\nmov     [rsp+0C8h+var_48], rax                                         ; +0x21, 0x140158d41\nmov     rsi, r8                                                        ; +0x29, 0x140158d49\nmov     r14, rdx                                                       ; +0x2c, 0x140158d4c\nmov     r15, rcx                                                       ; +0x2f, 0x140158d4f\nmov     [rsp+0C8h+var_58], rdx                                         ; +0x32, 0x140158d52\nmov     [rsp+0C8h+var_50], r8                                          ; +0x37, 0x140158d57\nmov     r12, r8                                                        ; +0x3c, 0x140158d5c\ncmp     qword ptr [r8+18h], 0Fh                                        ; +0x3f, 0x140158d5f\njbe     short loc_140158D69                                            ; +0x44, 0x140158d64\nmov     r12, [r8]                                                      ; +0x46, 0x140158d66\nmov     rdx, r12                                                       ; +0x49, 0x140158d69\ncall    GameLevelManager__removeDLFromActive                           ; +0x4c, 0x140158d6c\nxor     ebx, ebx                                                       ; +0x51, 0x140158d71\nmov     [rsp+0C8h+var_80], rbx                                         ; +0x53, 0x140158d73\nmov     r13d, ebx                                                      ; +0x58, 0x140158d78\nmov     rdx, rsi                                                       ; +0x5b, 0x140158d7b\nlea     rcx, [rsp+0C8h+var_78]                                         ; +0x5e, 0x140158d7e\ncall    sub_14003BDB0                                                  ; +0x63, 0x140158d83\nmov     [rsp+0C8h+var_A8], rax                                         ; +0x68, 0x140158d88\ncmp     [rax+10h], rbx                                                 ; +0x6d, 0x140158d8d\njnz     short loc_140158D98                                            ; +0x71, 0x140158d91\njmp     loc_140158E73                                                  ; +0x73, 0x140158d93\nxorps   xmm0, xmm0                                                     ; +0x78, 0x140158d98\nmovdqu  xmmword ptr [rsp+0C8h+Block], xmm0                             ; +0x7b, 0x140158d9b\nmov     [rsp+0C8h+var_90], rbx                                         ; +0x81, 0x140158da1\nlea     r8, [rsp+0C8h+Block]                                           ; +0x86, 0x140158da6\nmov     rcx, rax                                                       ; +0x8b, 0x140158dab\ncall    sub_140140D00                                                  ; +0x8e, 0x140158dae\nmov     rbp, [rsp+0C8h+Block+8]                                        ; +0x93, 0x140158db3\nmov     rax, rbp                                                       ; +0x98, 0x140158db8\nmov     rdi, [rsp+0C8h+Block]                                          ; +0x9b, 0x140158dbb\nsub     rax, rdi                                                       ; +0xa0, 0x140158dc0\nsar     rax, 5                                                         ; +0xa3, 0x140158dc3\ncmp     rax, 4                                                         ; +0xa7, 0x140158dc7\njnz     short loc_140158E10                                            ; +0xab, 0x140158dcb\nlea     rcx, [rdi+20h]                                                 ; +0xad, 0x140158dcd\ncmp     qword ptr [rcx+18h], 0Fh                                       ; +0xb1, 0x140158dd1\njbe     short loc_140158DDB                                            ; +0xb6, 0x140158dd6\nmov     rcx, [rcx]; String                                             ; +0xb8, 0x140158dd8\ncall    cs:atoi                                                        ; +0xbb, 0x140158ddb\nlea     rcx, [rdi+40h]                                                 ; +0xc1, 0x140158de1\ncmp     qword ptr [rcx+18h], 0Fh                                       ; +0xc5, 0x140158de5\njbe     short loc_140158DEF                                            ; +0xca, 0x140158dea\nmov     rcx, [rcx]; String                                             ; +0xcc, 0x140158dec\ncall    cs:atoi                                                        ; +0xcf, 0x140158def\nmov     dword ptr [rsp+0C8h+var_80], eax                               ; +0xd5, 0x140158df5\nlea     rcx, [rdi+60h]                                                 ; +0xd9, 0x140158df9\ncmp     qword ptr [rcx+18h], 0Fh                                       ; +0xdd, 0x140158dfd\njbe     short loc_140158E07                                            ; +0xe2, 0x140158e02\nmov     rcx, [rcx]; String                                             ; +0xe4, 0x140158e04\ncall    cs:atoi                                                        ; +0xe7, 0x140158e07\nmov     r13d, eax                                                      ; +0xed, 0x140158e0d\ntest    rdi, rdi                                                       ; +0xf0, 0x140158e10\njz      short loc_140158E6E                                            ; +0xf3, 0x140158e13\nmov     rbx, rdi                                                       ; +0xf5, 0x140158e15\ncmp     rdi, rbp                                                       ; +0xf8, 0x140158e18\njz      short loc_140158E31                                            ; +0xfb, 0x140158e1b\nnop     dword ptr [rax]                                                ; +0xfd, 0x140158e1d\nmov     rcx, rbx                                                       ; +0x100, 0x140158e20\ncall    sub_14003A830                                                  ; +0x103, 0x140158e23\nadd     rbx, 20h ; ' '                                                 ; +0x108, 0x140158e28\ncmp     rbx, rbp                                                       ; +0x10c, 0x140158e2c\njnz     short loc_140158E20                                            ; +0x10f, 0x140158e2f\nmov     rdx, [rsp+0C8h+var_90]                                         ; +0x111, 0x140158e31\nsub     rdx, rdi                                                       ; +0x116, 0x140158e36\nand     rdx, 0FFFFFFFFFFFFFFE0h                                        ; +0x119, 0x140158e39\nmov     rax, rdi                                                       ; +0x11d, 0x140158e3d\ncmp     rdx, 1000h                                                     ; +0x120, 0x140158e40\njb      short loc_140158E65                                            ; +0x127, 0x140158e47\nadd     rdx, 27h ; '''                                                 ; +0x129, 0x140158e49\nmov     rdi, [rdi-8]                                                   ; +0x12d, 0x140158e4d\nsub     rax, rdi                                                       ; +0x131, 0x140158e51\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x134, 0x140158e54\ncmp     rax, 1Fh                                                       ; +0x138, 0x140158e58\njbe     short loc_140158E65                                            ; +0x13c, 0x140158e5c\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x13e, 0x140158e5e\ndb 0CCh                                                                ; +0x144, 0x140158e64\nmov     rcx, rdi; Block                                                ; +0x145, 0x140158e65\ncall    j_j_free                                                       ; +0x148, 0x140158e68\nnop                                                                    ; +0x14d, 0x140158e6d\nmov     rax, [rsp+0C8h+var_A8]                                         ; +0x14e, 0x140158e6e\nmov     rcx, rax                                                       ; +0x153, 0x140158e73\ncall    sub_14003A830                                                  ; +0x156, 0x140158e76\nmov     rcx, r14                                                       ; +0x15b, 0x140158e7b\ncmp     qword ptr [r14+18h], 0Fh                                       ; +0x15e, 0x140158e7e\njbe     short loc_140158E88                                            ; +0x163, 0x140158e83\nmov     rcx, [r14]; String                                             ; +0x165, 0x140158e85\ncall    cs:atoi                                                        ; +0x168, 0x140158e88\nmov     ebx, eax                                                       ; +0x16e, 0x140158e8e\ncmp     dword ptr [rsp+0C8h+var_80], 4                                 ; +0x170, 0x140158e90\njnz     short loc_140158EE0                                            ; +0x175, 0x140158e95\nmov     rdx, rsi                                                       ; +0x177, 0x140158e97\nmov     rcx, [r15+278h]                                                ; +0x17a, 0x140158e9a\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 &) ; +0x181, 0x140158ea1\ntest    rax, rax                                                       ; +0x187, 0x140158ea7\njz      short loc_140158ECB                                            ; +0x18a, 0x140158eaa\ntest    ebx, ebx                                                       ; +0x18c, 0x140158eac\njs      short loc_140158ECB                                            ; +0x18e, 0x140158eae\ntest    r13d, r13d                                                     ; +0x190, 0x140158eb0\njnz     short loc_140158EBE                                            ; +0x193, 0x140158eb3\nmov     [rax+5C0h], r13b                                               ; +0x195, 0x140158eb5\njmp     short loc_140158ECB                                            ; +0x19c, 0x140158ebc\ncmp     r13d, 1                                                        ; +0x19e, 0x140158ebe\njnz     short loc_140158ECB                                            ; +0x1a2, 0x140158ec2\nmov     byte ptr [rax+5C1h], 0                                         ; +0x1a4, 0x140158ec4\nmov     rdx, rsi                                                       ; +0x1ab, 0x140158ecb\nmov     rcx, [r15+278h]                                                ; +0x1ae, 0x140158ece\ncall    cs:?removeObjectForKey@CCDictionary@cocos2d@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::removeObjectForKey(std::string const &) ; +0x1b5, 0x140158ed5\njmp     loc_140158F69                                                  ; +0x1bb, 0x140158edb\ntest    ebx, ebx                                                       ; +0x1c0, 0x140158ee0\njns     short loc_140158EFB                                            ; +0x1c2, 0x140158ee2\nmov     rcx, [r15+308h]                                                ; +0x1c4, 0x140158ee4\ntest    rcx, rcx                                                       ; +0x1cb, 0x140158eeb\njz      short loc_140158F69                                            ; +0x1ce, 0x140158eee\nmov     rax, [rcx]                                                     ; +0x1d0, 0x140158ef0\nmov     rdx, r12                                                       ; +0x1d3, 0x140158ef3\ncall    qword ptr [rax+18h]                                            ; +0x1d6, 0x140158ef6\njmp     short loc_140158F69                                            ; +0x1d9, 0x140158ef9\nmov     rdx, r14                                                       ; +0x1db, 0x140158efb\nlea     rcx, [rsp+0C8h+var_78]                                         ; +0x1de, 0x140158efe\ncall    sub_14003BDB0                                                  ; +0x1e3, 0x140158f03\nmov     r8d, 3                                                         ; +0x1e8, 0x140158f08\nmov     rdx, rax                                                       ; +0x1ee, 0x140158f0e\nmov     rcx, r15                                                       ; +0x1f1, 0x140158f11\ncall    GameLevelManager__createAndGetScores                           ; +0x1f4, 0x140158f14\nmov     rbx, rax                                                       ; +0x1f9, 0x140158f19\nxorps   xmm0, xmm0                                                     ; +0x1fc, 0x140158f1c\nmovups  xmmword ptr [rsp+0C8h+Block], xmm0                             ; +0x1ff, 0x140158f1f\nmov     [rsp+0C8h+var_90], 1                                           ; +0x204, 0x140158f24\nmov     [rsp+0C8h+var_88], 0Fh                                         ; +0x20d, 0x140158f2d\nmov     word ptr [rsp+0C8h+Block], 20h ; ' '                           ; +0x216, 0x140158f36\nmov     r9, r12                                                        ; +0x21d, 0x140158f3d\nlea     r8, [rsp+0C8h+Block]                                           ; +0x220, 0x140158f40\nmov     rdx, rax                                                       ; +0x225, 0x140158f45\nmov     rcx, r15                                                       ; +0x228, 0x140158f48\ncall    GameLevelManager__storeSearchResult                            ; +0x22b, 0x140158f4b\nmov     rcx, [r15+308h]                                                ; +0x230, 0x140158f50\ntest    rcx, rcx                                                       ; +0x237, 0x140158f57\njz      short loc_140158F69                                            ; +0x23a, 0x140158f5a\nmov     rax, [rcx]                                                     ; +0x23c, 0x140158f5c\nmov     r8, r12                                                        ; +0x23f, 0x140158f5f\nmov     rdx, rbx                                                       ; +0x242, 0x140158f62\ncall    qword ptr [rax+10h]                                            ; +0x245, 0x140158f65\nnop                                                                    ; +0x248, 0x140158f68\nmov     rcx, r14                                                       ; +0x249, 0x140158f69\ncall    sub_14003A830                                                  ; +0x24c, 0x140158f6c\nnop                                                                    ; +0x251, 0x140158f71\nmov     rcx, rsi                                                       ; +0x252, 0x140158f72\ncall    sub_14003A830                                                  ; +0x255, 0x140158f75\nmov     rcx, [rsp+0C8h+var_48]                                         ; +0x25a, 0x140158f7a\nxor     rcx, rsp; StackCookie                                          ; +0x262, 0x140158f82\ncall    __security_check_cookie                                        ; +0x265, 0x140158f85\nmov     rbx, [rsp+0C8h+arg_18]                                         ; +0x26a, 0x140158f8a\nadd     rsp, 90h                                                       ; +0x272, 0x140158f92\npop     r15                                                            ; +0x279, 0x140158f99\npop     r14                                                            ; +0x27b, 0x140158f9b\npop     r13                                                            ; +0x27d, 0x140158f9d\npop     r12                                                            ; +0x27f, 0x140158f9f\npop     rdi                                                            ; +0x281, 0x140158fa1\npop     rsi                                                            ; +0x282, 0x140158fa2\npop     rbp                                                            ; +0x283, 0x140158fa3\nretn                                                                   ; +0x284, 0x140158fa4", "xrefs": ["GameLevelManager::handleIt @ 0x140143bfa", "<???> @ 0x1406ca998"], "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"}