{"type": "func", "start": 5371863824, "end": 5371864529, "name": "LevelLeaderboard::loadScores", "pseudocode": "// \n// LevelLeaderboard::loadScores from 0x140302310 to 0x1403025d1 (705 bytes)\n// \n// 3 xrefs:\n// > LevelLeaderboard::init @ 0x140301c39\n// > LevelLeaderboard::updateUserScoreFinished @ 0x1403025e7\n// > <???> @ 0x1406d43ac\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=6\nvoid LevelLeaderboard::loadScores(LevelLeaderboard *a1)\n{\n  int v2; // ebx\n  cocos2d::CCString *v3; // rax\n  const char *CString; // rax\n  size_t v5; // r8\n  void **v6; // rsi\n  LeaderboardManagerDelegate_vtbl *v7; // rdi\n  cocos2d::CCArray *LocalScores; // rax\n  void **v9; // rbx\n  GameLevelManager *v10; // rcx\n  cocos2d::CCArray *StoredOnlineLevels; // rax\n  void **v12; // r8\n  GameLevelManager *v13; // rcx\n  _BOOL8 v14; // rdx\n  GameLevelManager *v15; // rcx\n  void *v16; // rcx\n  void *v17; // [rsp+20h] [rbp-38h]\n  void *v18; // [rsp+20h] [rbp-38h]\n  void *v19; // [rsp+20h] [rbp-38h]\n  void *v20; // [rsp+20h] [rbp-38h]\n  void *Block[2]; // [rsp+28h] [rbp-30h] BYREF\n  __int64 v22; // [rsp+38h] [rbp-20h]\n  unsigned __int64 v23; // [rsp+40h] [rbp-18h]\n\n  v2 = a1->m_level->m_levelID.random - a1->m_level->m_levelID.seed;\n  if ( !qword_1406C2EC0 )\n  {\n    v17 = operator new(0x3D0u);\n    qword_1406C2EC0 = sub_140141280((__int64)v17);\n    (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);\n  }\n  v3 = cocos2d::CCString::createWithFormat(\"ll_%i_%i_%i\", v2, a1->m_type, a1->m_mode);\n  CString = cocos2d::CCString::getCString(v3);\n  *(_OWORD *)Block = 0;\n  v22 = 0;\n  v23 = 0;\n  v5 = -1;\n  do\n    ++v5;\n  while ( CString[v5] );\n  sub_14003A930(Block, CString, v5);\n  if ( a1->m_type == Local )\n  {\n    v6 = Block;\n    if ( v23 > 0xF )\n      v6 = (void **)Block[0];\n    v7 = a1->LeaderboardManagerDelegate::__vftable;\n    LocalScores = LevelLeaderboard::getLocalScores(a1);\n    v7->loadLeaderboardFinished(&a1->LeaderboardManagerDelegate, LocalScores, (const char *)v6);\n  }\n  else\n  {\n    v9 = Block;\n    if ( v23 > 0xF )\n      v9 = (void **)Block[0];\n    v10 = (GameLevelManager *)qword_1406C2EC0;\n    if ( !qword_1406C2EC0 )\n    {\n      v18 = operator new(0x3D0u);\n      qword_1406C2EC0 = sub_140141280((__int64)v18);\n      (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);\n      v10 = (GameLevelManager *)qword_1406C2EC0;\n    }\n    StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v10, (const char *)v9);\n    if ( StoredOnlineLevels )\n    {\n      v12 = Block;\n      if ( v23 > 0xF )\n        v12 = (void **)Block[0];\n      a1->loadLeaderboardFinished(&a1->LeaderboardManagerDelegate, StoredOnlineLevels, (const char *)v12);\n    }\n    else\n    {\n      v13 = (GameLevelManager *)qword_1406C2EC0;\n      if ( !qword_1406C2EC0 )\n      {\n        v19 = operator new(0x3D0u);\n        qword_1406C2EC0 = sub_140141280((__int64)v19);\n        (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);\n        v13 = (GameLevelManager *)qword_1406C2EC0;\n      }\n      GameLevelManager::makeTimeStamp(v13, \"upd_ll\");\n      LOBYTE(v14) = 1;\n      a1->m_circle->setVisible(a1->m_circle, v14);\n      a1->m_noInternet->setVisible(a1->m_noInternet, 0);\n      LevelLeaderboard::setupLeaderboard(a1, nullptr);\n      v15 = (GameLevelManager *)qword_1406C2EC0;\n      if ( !qword_1406C2EC0 )\n      {\n        v20 = operator new(0x3D0u);\n        qword_1406C2EC0 = sub_140141280((__int64)v20);\n        (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);\n        v15 = (GameLevelManager *)qword_1406C2EC0;\n      }\n      v15->m_leaderboardManagerDelegate = &a1->LeaderboardManagerDelegate;\n      GameLevelManager::getLevelLeaderboard(v15, a1->m_level, a1->m_type, a1->m_mode);\n    }\n  }\n  if ( v23 > 0xF )\n  {\n    v16 = Block[0];\n    if ( v23 + 1 >= 0x1000 )\n    {\n      v16 = *((void **)Block[0] - 1);\n      if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )\n        invalid_parameter_noinfo_noreturn();\n    }\n    j_j_free(v16);\n  }\n}", "assembly": "; \n; LevelLeaderboard::loadScores from 0x140302310 to 0x1403025d1 (705 bytes)\n; \n; 3 xrefs:\n; > LevelLeaderboard::init @ 0x140301c39\n; > LevelLeaderboard::updateUserScoreFinished @ 0x1403025e7\n; > <???> @ 0x1406d43ac\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, 0x140302310\nmov     [rsp+arg_10], rbp                                              ; +0x5, 0x140302315\nmov     [rsp+arg_18], rsi                                              ; +0xa, 0x14030231a\npush    rdi                                                            ; +0xf, 0x14030231f\nsub     rsp, 50h                                                       ; +0x10, 0x140302320\nmov     rax, cs:__security_cookie                                      ; +0x14, 0x140302324\nxor     rax, rsp                                                       ; +0x1b, 0x14030232b\nmov     [rsp+58h+var_10], rax                                          ; +0x1e, 0x14030232e\nmov     rbp, rcx                                                       ; +0x23, 0x140302333\nmov     rax, [rcx+288h]                                                ; +0x26, 0x140302336\nmov     ebx, [rax+148h]                                                ; +0x2d, 0x14030233d\nsub     ebx, [rax+14Ch]                                                ; +0x33, 0x140302343\ncmp     cs:qword_1406C2EC0, 0                                          ; +0x39, 0x140302349\njnz     short loc_14030237C                                            ; +0x41, 0x140302351\nmov     ecx, 3D0h; Size                                                ; +0x43, 0x140302353\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x48, 0x140302358\nmov     [rsp+58h+var_38], rax                                          ; +0x4d, 0x14030235d\nmov     rcx, rax                                                       ; +0x52, 0x140302362\ncall    sub_140141280                                                  ; +0x55, 0x140302365\nnop                                                                    ; +0x5a, 0x14030236a\nmov     cs:qword_1406C2EC0, rax                                        ; +0x5b, 0x14030236b\nmov     r8, [rax]                                                      ; +0x62, 0x140302372\nmov     rcx, rax                                                       ; +0x65, 0x140302375\ncall    qword ptr [r8+48h]                                             ; +0x68, 0x140302378\nmov     r9d, [rbp+294h]                                                ; +0x6c, 0x14030237c\nmov     r8d, [rbp+290h]                                                ; +0x73, 0x140302383\nmov     edx, ebx                                                       ; +0x7a, 0x14030238a\nlea     rcx, aLlIII; \"ll_%i_%i_%i\"                                     ; +0x7c, 0x14030238c\ncall    cs:?createWithFormat@CCString@cocos2d@@SAPEAV12@PEBDZZ; cocos2d::CCString::createWithFormat(char const *,...) ; +0x83, 0x140302393\nmov     rcx, rax                                                       ; +0x89, 0x140302399\ncall    cs:?getCString@CCString@cocos2d@@QEBAPEBDXZ; cocos2d::CCString::getCString(void) ; +0x8c, 0x14030239c\nxorps   xmm0, xmm0                                                     ; +0x92, 0x1403023a2\nmovups  xmmword ptr [rsp+58h+Block], xmm0                              ; +0x95, 0x1403023a5\nxor     ecx, ecx                                                       ; +0x9a, 0x1403023aa\nmov     [rsp+58h+var_20], rcx                                          ; +0x9c, 0x1403023ac\nmov     [rsp+58h+var_18], rcx                                          ; +0xa1, 0x1403023b1\nmov     r8, 0FFFFFFFFFFFFFFFFh                                         ; +0xa6, 0x1403023b6\nnop     dword ptr [rax]                                                ; +0xad, 0x1403023bd\ninc     r8                                                             ; +0xb0, 0x1403023c0\ncmp     [rax+r8], cl                                                   ; +0xb3, 0x1403023c3\njnz     short loc_1403023C0                                            ; +0xb7, 0x1403023c7\nmov     rdx, rax                                                       ; +0xb9, 0x1403023c9\nlea     rcx, [rsp+58h+Block]                                           ; +0xbc, 0x1403023cc\ncall    sub_14003A930                                                  ; +0xc1, 0x1403023d1\nnop                                                                    ; +0xc6, 0x1403023d6\ncmp     dword ptr [rbp+290h], 3                                        ; +0xc7, 0x1403023d7\njnz     short loc_140302415                                            ; +0xce, 0x1403023de\nlea     rsi, [rsp+58h+Block]                                           ; +0xd0, 0x1403023e0\ncmp     [rsp+58h+var_18], 0Fh                                          ; +0xd5, 0x1403023e5\ncmova   rsi, [rsp+58h+Block]                                           ; +0xdb, 0x1403023eb\nmov     rdi, [rbp+278h]                                                ; +0xe1, 0x1403023f1\nmov     rcx, rbp                                                       ; +0xe8, 0x1403023f8\ncall    LevelLeaderboard__getLocalScores                               ; +0xeb, 0x1403023fb\nmov     rdx, rax                                                       ; +0xf0, 0x140302400\nmov     r8, rsi                                                        ; +0xf3, 0x140302403\nlea     rcx, [rbp+278h]                                                ; +0xf6, 0x140302406\ncall    qword ptr [rdi+10h]                                            ; +0xfd, 0x14030240d\njmp     loc_14030256F                                                  ; +0x100, 0x140302410\nlea     rbx, [rsp+58h+Block]                                           ; +0x105, 0x140302415\ncmp     [rsp+58h+var_18], 0Fh                                          ; +0x10a, 0x14030241a\ncmova   rbx, [rsp+58h+Block]                                           ; +0x110, 0x140302420\nmov     rcx, cs:qword_1406C2EC0                                        ; +0x116, 0x140302426\ntest    rcx, rcx                                                       ; +0x11d, 0x14030242d\njnz     short loc_140302462                                            ; +0x120, 0x140302430\nmov     ecx, 3D0h; Size                                                ; +0x122, 0x140302432\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x127, 0x140302437\nmov     [rsp+58h+var_38], rax                                          ; +0x12c, 0x14030243c\nmov     rcx, rax                                                       ; +0x131, 0x140302441\ncall    sub_140141280                                                  ; +0x134, 0x140302444\nnop                                                                    ; +0x139, 0x140302449\nmov     cs:qword_1406C2EC0, rax                                        ; +0x13a, 0x14030244a\nmov     r8, [rax]                                                      ; +0x141, 0x140302451\nmov     rcx, rax                                                       ; +0x144, 0x140302454\ncall    qword ptr [r8+48h]                                             ; +0x147, 0x140302457\nmov     rcx, cs:qword_1406C2EC0                                        ; +0x14b, 0x14030245b\nmov     rdx, rbx                                                       ; +0x152, 0x140302462\ncall    GameLevelManager__getStoredOnlineLevels                        ; +0x155, 0x140302465\ntest    rax, rax                                                       ; +0x15a, 0x14030246a\njz      short loc_140302496                                            ; +0x15d, 0x14030246d\nlea     r8, [rsp+58h+Block]                                            ; +0x15f, 0x14030246f\ncmp     [rsp+58h+var_18], 0Fh                                          ; +0x164, 0x140302474\ncmova   r8, [rsp+58h+Block]                                            ; +0x16a, 0x14030247a\nlea     rcx, [rbp+278h]                                                ; +0x170, 0x140302480\nmov     r9, [rcx]                                                      ; +0x177, 0x140302487\nmov     rdx, rax                                                       ; +0x17a, 0x14030248a\ncall    qword ptr [r9+10h]                                             ; +0x17d, 0x14030248d\njmp     loc_14030256F                                                  ; +0x181, 0x140302491\nmov     rcx, cs:qword_1406C2EC0                                        ; +0x186, 0x140302496\ntest    rcx, rcx                                                       ; +0x18d, 0x14030249d\njnz     short loc_1403024D1                                            ; +0x190, 0x1403024a0\nmov     ecx, 3D0h; Size                                                ; +0x192, 0x1403024a2\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x197, 0x1403024a7\nmov     [rsp+58h+var_38], rax                                          ; +0x19c, 0x1403024ac\nmov     rcx, rax                                                       ; +0x1a1, 0x1403024b1\ncall    sub_140141280                                                  ; +0x1a4, 0x1403024b4\nnop                                                                    ; +0x1a9, 0x1403024b9\nmov     cs:qword_1406C2EC0, rax                                        ; +0x1aa, 0x1403024ba\nmov     rdx, [rax]                                                     ; +0x1b1, 0x1403024c1\nmov     rcx, rax                                                       ; +0x1b4, 0x1403024c4\ncall    qword ptr [rdx+48h]                                            ; +0x1b7, 0x1403024c7\nmov     rcx, cs:qword_1406C2EC0                                        ; +0x1ba, 0x1403024ca\nlea     rdx, aUpdLl; \"upd_ll\"                                          ; +0x1c1, 0x1403024d1\ncall    GameLevelManager__makeTimeStamp                                ; +0x1c8, 0x1403024d8\nmov     rcx, [rbp+2A8h]                                                ; +0x1cd, 0x1403024dd\nmov     rax, [rcx]                                                     ; +0x1d4, 0x1403024e4\nmov     dl, 1                                                          ; +0x1d7, 0x1403024e7\ncall    qword ptr [rax+140h]                                           ; +0x1d9, 0x1403024e9\nmov     rcx, [rbp+2B0h]                                                ; +0x1df, 0x1403024ef\nmov     rax, [rcx]                                                     ; +0x1e6, 0x1403024f6\nxor     edx, edx                                                       ; +0x1e9, 0x1403024f9\ncall    qword ptr [rax+140h]                                           ; +0x1eb, 0x1403024fb\nxor     edx, edx                                                       ; +0x1f1, 0x140302501\nmov     rcx, rbp                                                       ; +0x1f3, 0x140302503\ncall    LevelLeaderboard__setupLeaderboard                             ; +0x1f6, 0x140302506\nlea     rbx, [rbp+278h]                                                ; +0x1fb, 0x14030250b\nmov     rcx, cs:qword_1406C2EC0                                        ; +0x202, 0x140302512\ntest    rcx, rcx                                                       ; +0x209, 0x140302519\njnz     short loc_14030254D                                            ; +0x20c, 0x14030251c\nmov     ecx, 3D0h; Size                                                ; +0x20e, 0x14030251e\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x213, 0x140302523\nmov     [rsp+58h+var_38], rax                                          ; +0x218, 0x140302528\nmov     rcx, rax                                                       ; +0x21d, 0x14030252d\ncall    sub_140141280                                                  ; +0x220, 0x140302530\nnop                                                                    ; +0x225, 0x140302535\nmov     cs:qword_1406C2EC0, rax                                        ; +0x226, 0x140302536\nmov     rdx, [rax]                                                     ; +0x22d, 0x14030253d\nmov     rcx, rax                                                       ; +0x230, 0x140302540\ncall    qword ptr [rdx+48h]                                            ; +0x233, 0x140302543\nmov     rcx, cs:qword_1406C2EC0                                        ; +0x236, 0x140302546\nmov     [rcx+308h], rbx                                                ; +0x23d, 0x14030254d\nmov     r9d, [rbp+294h]                                                ; +0x244, 0x140302554\nmov     r8d, [rbp+290h]                                                ; +0x24b, 0x14030255b\nmov     rdx, [rbp+288h]                                                ; +0x252, 0x140302562\ncall    GameLevelManager__getLevelLeaderboard                          ; +0x259, 0x140302569\nnop                                                                    ; +0x25e, 0x14030256e\nmov     rdx, [rsp+58h+var_18]                                          ; +0x25f, 0x14030256f\ncmp     rdx, 0Fh                                                       ; +0x264, 0x140302574\njbe     short loc_1403025AF                                            ; +0x268, 0x140302578\ninc     rdx                                                            ; +0x26a, 0x14030257a\nmov     rcx, [rsp+58h+Block]; Block                                    ; +0x26d, 0x14030257d\nmov     rax, rcx                                                       ; +0x272, 0x140302582\ncmp     rdx, 1000h                                                     ; +0x275, 0x140302585\njb      short loc_1403025AA                                            ; +0x27c, 0x14030258c\nadd     rdx, 27h ; '''                                                 ; +0x27e, 0x14030258e\nmov     rcx, [rcx-8]                                                   ; +0x282, 0x140302592\nsub     rax, rcx                                                       ; +0x286, 0x140302596\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x289, 0x140302599\ncmp     rax, 1Fh                                                       ; +0x28d, 0x14030259d\njbe     short loc_1403025AA                                            ; +0x291, 0x1403025a1\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x293, 0x1403025a3\nalign 2                                                                ; +0x299, 0x1403025a9\ncall    j_j_free                                                       ; +0x29a, 0x1403025aa\nmov     rcx, [rsp+58h+var_10]                                          ; +0x29f, 0x1403025af\nxor     rcx, rsp; StackCookie                                          ; +0x2a4, 0x1403025b4\ncall    __security_check_cookie                                        ; +0x2a7, 0x1403025b7\nmov     rbx, [rsp+58h+arg_8]                                           ; +0x2ac, 0x1403025bc\nmov     rbp, [rsp+58h+arg_10]                                          ; +0x2b1, 0x1403025c1\nmov     rsi, [rsp+58h+arg_18]                                          ; +0x2b6, 0x1403025c6\nadd     rsp, 50h                                                       ; +0x2bb, 0x1403025cb\npop     rdi                                                            ; +0x2bf, 0x1403025cf\nretn                                                                   ; +0x2c0, 0x1403025d0", "xrefs": ["LevelLeaderboard::init @ 0x140301c39", "LevelLeaderboard::updateUserScoreFinished @ 0x1403025e7", "<???> @ 0x1406d43ac"], "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"}