{"type": "func", "start": 4299523560, "end": 4299523940, "name": "LeaderboardsLayer::selectLeaderboard", "pseudocode": "// \n// LeaderboardsLayer::selectLeaderboard from 0x1004585e8 to 0x100458764 (380 bytes)\n// \n// 8 xrefs:\n// > LeaderboardsLayer::init @ 0x100457d08\n// > sub_1004587CC @ 0x1004587e4\n// > sub_1004587E8 @ 0x100458800\n// > sub_100458804 @ 0x10045881c\n// > sub_100458820 @ 0x100458838\n// > sub_10045883C @ 0x100458870\n// > LeaderboardsLayer::updateUserScoreFinished @ 0x100458cf0\n// > sub_100458CF4 @ 0x100458d14\n// \n// This function is hookable on this platform (idp: arm, 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:05:24 +0000\n// \n\nvoid __fastcall LeaderboardsLayer::selectLeaderboard(__int64 a1, int a2, int a3)\n{\n  int v3; // w21\n  __int64 v6; // x0\n  char *v7; // x1\n  __int64 v8; // x0\n  __int64 v9; // x0\n  void *__p[2]; // [xsp+8h] [xbp-38h] BYREF\n  char v11; // [xsp+1Fh] [xbp-21h]\n\n  v3 = a3;\n  if ( *(_DWORD *)(a1 + 440) != a2 || *(_DWORD *)(a1 + 444) != a3 )\n  {\n    *(_DWORD *)(a1 + 440) = a2;\n    *(_DWORD *)(a1 + 444) = a3;\n    *(_DWORD *)(GameLevelManager::sharedState() + 1208) = *(_DWORD *)(a1 + 440);\n    *(_DWORD *)(GameLevelManager::sharedState() + 1212) = *(_DWORD *)(a1 + 444);\n    sub_100458A50(a1);\n    (*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 480) + 344LL))(*(_QWORD *)(a1 + 480), 1);\n    (*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 488) + 344LL))(*(_QWORD *)(a1 + 488), 0);\n    if ( *(_DWORD *)(a1 + 440) == 3 )\n      v3 = 0;\n    if ( *(_BYTE *)(GameManager::sharedState() + 656) == 1 )\n    {\n      GameLevelManager::sharedState();\n      GameLevelManager::getLeaderboardKey(*(_DWORD *)(a1 + 440), v3, __p);\n      v6 = GameLevelManager::sharedState();\n      if ( v11 >= 0 )\n        v7 = (char *)__p;\n      else\n        v7 = (char *)__p[0];\n      if ( GameLevelManager::getStoredOnlineLevels(v6, v7) )\n      {\n        (*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1176LL))(a1);\n      }\n      else\n      {\n        LeaderboardsLayer::setupLevelBrowser(a1, 0);\n        *(_QWORD *)(GameLevelManager::sharedState() + 1296) = a1 + 408;\n        v9 = GameLevelManager::sharedState();\n        sub_1000BD33C(v9, a2, v3);\n      }\n      if ( v11 < 0 )\n        operator delete(__p[0]);\n    }\n    else\n    {\n      LeaderboardsLayer::setupLevelBrowser(a1, 0);\n      *(_QWORD *)(GameLevelManager::sharedState() + 1296) = a1 + 408;\n      v8 = GameLevelManager::sharedState();\n      GameLevelManager::updateUserScore(v8);\n    }\n  }\n}", "assembly": "; \n; LeaderboardsLayer::selectLeaderboard from 0x1004585e8 to 0x100458764 (380 bytes)\n; \n; 8 xrefs:\n; > LeaderboardsLayer::init @ 0x100457d08\n; > sub_1004587CC @ 0x1004587e4\n; > sub_1004587E8 @ 0x100458800\n; > sub_100458804 @ 0x10045881c\n; > sub_100458820 @ 0x100458838\n; > sub_10045883C @ 0x100458870\n; > LeaderboardsLayer::updateUserScoreFinished @ 0x100458cf0\n; > sub_100458CF4 @ 0x100458d14\n; \n; This function is hookable on this platform (idp: arm, 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:05:24 +0000\n; \nSUB             SP, SP, #0x50                                          ; +0x0, 0x1004585e8\nSTP             X22, X21, [SP,#0x40+var_20]                            ; +0x4, 0x1004585ec\nSTP             X20, X19, [SP,#0x40+var_10]                            ; +0x8, 0x1004585f0\nSTP             X29, X30, [SP,#0x40+var_s0]                            ; +0xc, 0x1004585f4\nADD             X29, SP, #0x40                                         ; +0x10, 0x1004585f8\nMOV             X21, X2                                                ; +0x14, 0x1004585fc\nMOV             X20, X1                                                ; +0x18, 0x100458600\nMOV             X19, X0                                                ; +0x1c, 0x100458604\nLDR             W8, [X0,#0x1B8]                                        ; +0x20, 0x100458608\nCMP             W8, W1                                                 ; +0x24, 0x10045860c\nB.NE            loc_100458620                                          ; +0x28, 0x100458610\nLDR             W8, [X19,#0x1BC]                                       ; +0x2c, 0x100458614\nCMP             W8, W21                                                ; +0x30, 0x100458618\nB.EQ            loc_100458750                                          ; +0x34, 0x10045861c\nSTR             W20, [X19,#0x1B8]                                      ; +0x38, 0x100458620\nSTR             W21, [X19,#0x1BC]                                      ; +0x3c, 0x100458624\nBL              GameLevelManager__sharedState                          ; +0x40, 0x100458628\nLDR             W8, [X19,#0x1B8]                                       ; +0x44, 0x10045862c\nSTR             W8, [X0,#0x4B8]                                        ; +0x48, 0x100458630\nBL              GameLevelManager__sharedState                          ; +0x4c, 0x100458634\nLDR             W8, [X19,#0x1BC]                                       ; +0x50, 0x100458638\nSTR             W8, [X0,#0x4BC]                                        ; +0x54, 0x10045863c\nMOV             X0, X19                                                ; +0x58, 0x100458640\nBL              sub_100458A50                                          ; +0x5c, 0x100458644\nLDR             X0, [X19,#0x1E0]                                       ; +0x60, 0x100458648\nLDR             X8, [X0]                                               ; +0x64, 0x10045864c\nLDR             X8, [X8,#0x158]                                        ; +0x68, 0x100458650\nMOV             W1, #1                                                 ; +0x6c, 0x100458654\nBLR             X8                                                     ; +0x70, 0x100458658\nLDR             X0, [X19,#0x1E8]                                       ; +0x74, 0x10045865c\nLDR             X8, [X0]                                               ; +0x78, 0x100458660\nLDR             X8, [X8,#0x158]                                        ; +0x7c, 0x100458664\nMOV             W1, #0                                                 ; +0x80, 0x100458668\nBLR             X8                                                     ; +0x84, 0x10045866c\nLDR             W8, [X19,#0x1B8]                                       ; +0x88, 0x100458670\nCMP             W8, #3                                                 ; +0x8c, 0x100458674\nCSEL            W21, WZR, W21, EQ                                      ; +0x90, 0x100458678\nBL              GameManager__sharedState                               ; +0x94, 0x10045867c\nLDRB            W8, [X0,#0x290]                                        ; +0x98, 0x100458680\nCMP             W8, #1                                                 ; +0x9c, 0x100458684\nB.NE            loc_1004586EC                                          ; +0xa0, 0x100458688\nBL              GameLevelManager__sharedState                          ; +0xa4, 0x10045868c\nLDR             W1, [X19,#0x1B8]                                       ; +0xa8, 0x100458690\nADD             X22, SP, #0x40+__p                                     ; +0xac, 0x100458694\nADD             X8, SP, #0x40+__p                                      ; +0xb0, 0x100458698\nMOV             X2, X21                                                ; +0xb4, 0x10045869c\nBL              GameLevelManager__getLeaderboardKey                    ; +0xb8, 0x1004586a0\nBL              GameLevelManager__sharedState                          ; +0xbc, 0x1004586a4\nLDRSB           W8, [SP,#0x40+var_21]                                  ; +0xc0, 0x1004586a8\nLDR             X9, [SP,#0x40+__p]                                     ; +0xc4, 0x1004586ac\nCMP             W8, #0                                                 ; +0xc8, 0x1004586b0\nCSEL            X1, X9, X22, LT                                        ; +0xcc, 0x1004586b4\nBL              GameLevelManager__getStoredOnlineLevels                ; +0xd0, 0x1004586b8\nMOV             X1, X0                                                 ; +0xd4, 0x1004586bc\nCBZ             X1, loc_10045871C                                      ; +0xd8, 0x1004586c0\nLDRSB           W8, [SP,#0x40+var_21]                                  ; +0xdc, 0x1004586c4\nLDR             X9, [SP,#0x40+__p]                                     ; +0xe0, 0x1004586c8\nCMP             W8, #0                                                 ; +0xe4, 0x1004586cc\nADD             X8, SP, #0x40+__p                                      ; +0xe8, 0x1004586d0\nCSEL            X2, X9, X8, LT                                         ; +0xec, 0x1004586d4\nLDR             X8, [X19]                                              ; +0xf0, 0x1004586d8\nLDR             X8, [X8,#0x498]                                        ; +0xf4, 0x1004586dc\nMOV             X0, X19                                                ; +0xf8, 0x1004586e0\nBLR             X8                                                     ; +0xfc, 0x1004586e4\nB               loc_100458740                                          ; +0x100, 0x1004586e8\nMOV             X0, X19                                                ; +0x104, 0x1004586ec\nMOV             X1, #0                                                 ; +0x108, 0x1004586f0\nBL              LeaderboardsLayer__setupLevelBrowser                   ; +0x10c, 0x1004586f4\nBL              GameLevelManager__sharedState                          ; +0x110, 0x1004586f8\nADD             X8, X19, #0x198                                        ; +0x114, 0x1004586fc\nSTR             X8, [X0,#0x510]                                        ; +0x118, 0x100458700\nBL              GameLevelManager__sharedState                          ; +0x11c, 0x100458704\nLDP             X29, X30, [SP,#0x40+var_s0]                            ; +0x120, 0x100458708\nLDP             X20, X19, [SP,#0x40+var_10]                            ; +0x124, 0x10045870c\nLDP             X22, X21, [SP,#0x40+var_20]                            ; +0x128, 0x100458710\nADD             SP, SP, #0x50 ; 'P'                                    ; +0x12c, 0x100458714\nB               GameLevelManager__updateUserScore                      ; +0x130, 0x100458718\nMOV             X0, X19                                                ; +0x134, 0x10045871c\nBL              LeaderboardsLayer__setupLevelBrowser                   ; +0x138, 0x100458720\nBL              GameLevelManager__sharedState                          ; +0x13c, 0x100458724\nADD             X8, X19, #0x198                                        ; +0x140, 0x100458728\nSTR             X8, [X0,#0x510]                                        ; +0x144, 0x10045872c\nBL              GameLevelManager__sharedState                          ; +0x148, 0x100458730\nMOV             X1, X20                                                ; +0x14c, 0x100458734\nMOV             X2, X21                                                ; +0x150, 0x100458738\nBL              sub_1000BD33C                                          ; +0x154, 0x10045873c\nLDRSB           W8, [SP,#0x40+var_21]                                  ; +0x158, 0x100458740\nTBZ             W8, #0x1F, loc_100458750                               ; +0x15c, 0x100458744\nLDR             X0, [SP,#0x40+__p]; __p                                ; +0x160, 0x100458748\nBL              __ZdlPv; operator delete(void *)                       ; +0x164, 0x10045874c\nLDP             X29, X30, [SP,#0x40+var_s0]                            ; +0x168, 0x100458750\nLDP             X20, X19, [SP,#0x40+var_10]                            ; +0x16c, 0x100458754\nLDP             X22, X21, [SP,#0x40+var_20]                            ; +0x170, 0x100458758\nADD             SP, SP, #0x50 ; 'P'                                    ; +0x174, 0x10045875c\nRET                                                                    ; +0x178, 0x100458760", "xrefs": ["LeaderboardsLayer::init @ 0x100457d08", "sub_1004587CC @ 0x1004587e4", "sub_1004587E8 @ 0x100458800", "sub_100458804 @ 0x10045881c", "sub_100458820 @ 0x100458838", "sub_10045883C @ 0x100458870", "LeaderboardsLayer::updateUserScoreFinished @ 0x100458cf0", "sub_100458CF4 @ 0x100458d14"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "arm", "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"}