{"type": "func", "start": 7934840, "end": 7935304, "name": "GJGarageLayer::descriptionForUnlock", "pseudocode": "// \n// GJGarageLayer::descriptionForUnlock from 0x791378 to 0x791548 (464 bytes)\n// \n// 2 xrefs:\n// > ItemInfoPopup::init @ 0x7952b4\n// > <???> @ 0x78dc8\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__int64 __usercall GJGarageLayer::descriptionForUnlock@<X0>(signed int a1@<W0>, int a2@<W1>, __int64 a3@<X8>)\n{\n  AchievementManager *v4; // x0\n  AchievementManager *v5; // x0\n  cocos2d::CCDictionary *AchievementsWithID; // x19\n  cocos2d::CCString *v7; // x0\n  char *CString; // x0\n  char *v9; // x0\n  char *v10; // x0\n  unsigned int *v12; // x1\n  int v13; // w2\n  unsigned int *v14; // x1\n  int v15; // w2\n  char *v18; // [xsp+68h] [xbp+68h] BYREF\n  std::string v19; // [xsp+70h] [xbp+70h] BYREF\n\n  v4 = AchievementManager::sharedState();\n  AchievementManager::achievementForUnlock((__int64)v4, a1, a2, (__int64)&v18);\n  v5 = AchievementManager::sharedState();\n  AchievementsWithID = AchievementManager::getAchievementsWithID(v5, v18);\n  sub_D153B8((int)&v19, \"unachievedDescription\");\n  v7 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(AchievementsWithID, &v19);\n  CString = (char *)cocos2d::CCString::getCString(v7);\n  sub_D153B8(a3, CString);\n  v9 = (char *)v19.m_data.m_data - 24;\n  if ( (__int64 *)v19.m_data.m_data - 3 != &qword_124B6B0 )\n  {\n    if ( &pthread_create )\n    {\n      v12 = (unsigned int *)((char *)v19.m_data.m_data - 8);\n      do\n        v13 = __ldaxr(v12);\n      while ( __stlxr(v13 - 1, v12) );\n    }\n    else\n    {\n      v13 = *((_DWORD *)v19.m_data.m_data - 2);\n      *((_DWORD *)v19.m_data.m_data - 2) = v13 - 1;\n    }\n    if ( v13 <= 0 )\n      operator delete(v9);\n  }\n  v10 = v18 - 24;\n  if ( v18 - 24 != (char *)&qword_124B6B0 )\n  {\n    if ( &pthread_create )\n    {\n      v14 = (unsigned int *)(v18 - 8);\n      do\n        v15 = __ldaxr(v14);\n      while ( __stlxr(v15 - 1, v14) );\n    }\n    else\n    {\n      v15 = *((_DWORD *)v18 - 2);\n      *((_DWORD *)v18 - 2) = v15 - 1;\n    }\n    if ( v15 <= 0 )\n      operator delete(v10);\n  }\n  return a3;\n}", "assembly": "; \n; GJGarageLayer::descriptionForUnlock from 0x791378 to 0x791548 (464 bytes)\n; \n; 2 xrefs:\n; > ItemInfoPopup::init @ 0x7952b4\n; > <???> @ 0x78dc8\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\nSTP             X29, X30, [SP,#var_80]!                                ; +0x0, 0x791378\nMOV             W2, W1                                                 ; +0x4, 0x79137c\nMOV             W1, W0                                                 ; +0x8, 0x791380\nMOV             X29, SP                                                ; +0xc, 0x791384\nSTP             X19, X20, [SP,#0x80+var_70]                            ; +0x10, 0x791388\nADRP            X20, #__stack_chk_guard_ptr@PAGE                       ; +0x14, 0x79138c\nSTR             X23, [SP,#0x80+var_50]                                 ; +0x18, 0x791390\nSTP             X21, X22, [SP,#0x80+var_60]                            ; +0x1c, 0x791394\nSTR             X2, [X29,#0x80+var_40]                                 ; +0x20, 0x791398\nMOV             X22, X8                                                ; +0x24, 0x79139c\nLDR             X0, [X20,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x28, 0x7913a0\nSTR             X1, [X29,#0x80+var_38]                                 ; +0x2c, 0x7913a4\nLDR             X0, [X0]; this                                         ; +0x30, 0x7913a8\nSTR             X0, [X29,#0x80+var_8]                                  ; +0x34, 0x7913ac\nBL              _ZN18AchievementManager11sharedStateEv; AchievementManager::sharedState(void) ; +0x38, 0x7913b0\nLDR             X1, [X29,#0x80+var_38]                                 ; +0x3c, 0x7913b4\nADD             X8, X29, #0x80+var_18                                  ; +0x40, 0x7913b8\nLDR             X2, [X29,#0x80+var_40]                                 ; +0x44, 0x7913bc\nBL              _ZN18AchievementManager20achievementForUnlockEi10UnlockType; AchievementManager::achievementForUnlock(int,UnlockType) ; +0x48, 0x7913c0\nBL              _ZN18AchievementManager11sharedStateEv; AchievementManager::sharedState(void) ; +0x4c, 0x7913c4\nLDR             X1, [X29,#0x80+var_18]; char *                         ; +0x50, 0x7913c8\nBL              _ZN18AchievementManager21getAchievementsWithIDEPKc; AchievementManager::getAchievementsWithID(char const*) ; +0x54, 0x7913cc\nADD             X21, X29, #0x80+var_10                                 ; +0x58, 0x7913d0\nADRP            X1, #aUnachieveddesc@PAGE; \"unachievedDescription\"     ; +0x5c, 0x7913d4\nMOV             X19, X0                                                ; +0x60, 0x7913d8\nADD             X1, X1, #aUnachieveddesc@PAGEOFF; \"unachievedDescription\" ; +0x64, 0x7913dc\nMOV             X0, X21; int                                           ; +0x68, 0x7913e0\nADD             X2, X29, #0x80+var_28                                  ; +0x6c, 0x7913e4\nBL              sub_D153B8                                             ; +0x70, 0x7913e8\nMOV             X0, X19                                                ; +0x74, 0x7913ec\nMOV             X1, X21                                                ; +0x78, 0x7913f0\nBL              _ZN7cocos2d12CCDictionary11valueForKeyERKSs; cocos2d::CCDictionary::valueForKey(std::string const&) ; +0x7c, 0x7913f4\nBL              _ZNK7cocos2d8CCString10getCStringEv; cocos2d::CCString::getCString(void) ; +0x80, 0x7913f8\nADD             X23, X29, #0x80+var_20                                 ; +0x84, 0x7913fc\nMOV             X1, X0; char *                                         ; +0x88, 0x791400\nMOV             X2, X23                                                ; +0x8c, 0x791404\nMOV             X0, X22; int                                           ; +0x90, 0x791408\nBL              sub_D153B8                                             ; +0x94, 0x79140c\nADRP            X19, #off_122EFE8@PAGE                                 ; +0x98, 0x791410\nLDR             X1, [X29,#0x80+var_10]                                 ; +0x9c, 0x791414\nSUB             X0, X1, #0x18; p                                       ; +0xa0, 0x791418\nLDR             X2, [X19,#off_122EFE8@PAGEOFF]; qword_124B6B0          ; +0xa4, 0x79141c\nCMP             X0, X2                                                 ; +0xa8, 0x791420\nB.NE            loc_791468                                             ; +0xac, 0x791424\nLDR             X1, [X29,#0x80+var_18]                                 ; +0xb0, 0x791428\nLDR             X19, [X19,#off_122EFE8@PAGEOFF]; qword_124B6B0         ; +0xb4, 0x79142c\nSUB             X0, X1, #0x18; p                                       ; +0xb8, 0x791430\nCMP             X0, X19                                                ; +0xbc, 0x791434\nB.NE            loc_79149C                                             ; +0xc0, 0x791438\nLDR             X20, [X20,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0xc4, 0x79143c\nMOV             X0, X22                                                ; +0xc8, 0x791440\nLDR             X2, [X29,#0x80+var_8]                                  ; +0xcc, 0x791444\nLDR             X1, [X20]                                              ; +0xd0, 0x791448\nCMP             X2, X1                                                 ; +0xd4, 0x79144c\nB.NE            loc_7914F0                                             ; +0xd8, 0x791450\nLDP             X19, X20, [SP,#0x80+var_70]                            ; +0xdc, 0x791454\nLDP             X21, X22, [SP,#0x80+var_60]                            ; +0xe0, 0x791458\nLDR             X23, [SP,#0x80+var_50]                                 ; +0xe4, 0x79145c\nLDP             X29, X30, [SP+0x80+var_80],#0x80                       ; +0xe8, 0x791460\nRET                                                                    ; +0xec, 0x791464\nADRP            X2, #pthread_create_ptr_0@PAGE                         ; +0xf0, 0x791468\nLDR             X2, [X2,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0xf4, 0x79146c\nCBZ             X2, loc_7914E0                                         ; +0xf8, 0x791470\nSUB             X1, X1, #8                                             ; +0xfc, 0x791474\nLDAXR           W2, [X1]                                               ; +0x100, 0x791478\nSUB             W3, W2, #1                                             ; +0x104, 0x79147c\nSTLXR           W4, W3, [X1]                                           ; +0x108, 0x791480\nCBNZ            W4, loc_791478                                         ; +0x10c, 0x791484\nCMP             W2, WZR                                                ; +0x110, 0x791488\nB.GT            loc_791428                                             ; +0x114, 0x79148c\nMOV             X1, X23                                                ; +0x118, 0x791490\nBL              j__ZdlPv; operator delete(void *)                      ; +0x11c, 0x791494\nB               loc_791428                                             ; +0x120, 0x791498\nADRP            X2, #pthread_create_ptr_0@PAGE                         ; +0x124, 0x79149c\nLDR             X2, [X2,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0x128, 0x7914a0\nCBZ             X2, loc_7914D0                                         ; +0x12c, 0x7914a4\nSUB             X1, X1, #8                                             ; +0x130, 0x7914a8\nLDAXR           W2, [X1]                                               ; +0x134, 0x7914ac\nSUB             W3, W2, #1                                             ; +0x138, 0x7914b0\nSTLXR           W4, W3, [X1]                                           ; +0x13c, 0x7914b4\nCBNZ            W4, loc_7914AC                                         ; +0x140, 0x7914b8\nCMP             W2, WZR                                                ; +0x144, 0x7914bc\nB.GT            loc_79143C                                             ; +0x148, 0x7914c0\nMOV             X1, X21                                                ; +0x14c, 0x7914c4\nBL              j__ZdlPv; operator delete(void *)                      ; +0x150, 0x7914c8\nB               loc_79143C                                             ; +0x154, 0x7914cc\nLDUR            W2, [X1,#-8]                                           ; +0x158, 0x7914d0\nSUB             W3, W2, #1                                             ; +0x15c, 0x7914d4\nSTUR            W3, [X1,#-8]                                           ; +0x160, 0x7914d8\nB               loc_7914BC                                             ; +0x164, 0x7914dc\nLDUR            W2, [X1,#-8]                                           ; +0x168, 0x7914e0\nSUB             W3, W2, #1                                             ; +0x16c, 0x7914e4\nSTUR            W3, [X1,#-8]                                           ; +0x170, 0x7914e8\nB               loc_791488                                             ; +0x174, 0x7914ec\nBL              .__stack_chk_fail                                      ; +0x178, 0x7914f0\nADRP            X19, #off_122EFE8@PAGE                                 ; +0x17c, 0x7914f4\nMOV             X20, X0                                                ; +0x180, 0x7914f8\nLDR             X0, [X29,#0x80+var_10]                                 ; +0x184, 0x7914fc\nLDR             X1, [X19,#off_122EFE8@PAGEOFF]; qword_124B6B0          ; +0x188, 0x791500\nSUB             X0, X0, #0x18                                          ; +0x18c, 0x791504\nCMP             X0, X1                                                 ; +0x190, 0x791508\nB.EQ            loc_791518                                             ; +0x194, 0x79150c\nADD             X1, X29, #0x80+var_20                                  ; +0x198, 0x791510\nBL              sub_4DBC48                                             ; +0x19c, 0x791514\nLDR             X0, [X29,#0x80+var_18]                                 ; +0x1a0, 0x791518\nLDR             X19, [X19,#off_122EFE8@PAGEOFF]; qword_124B6B0         ; +0x1a4, 0x79151c\nSUB             X0, X0, #0x18                                          ; +0x1a8, 0x791520\nCMP             X0, X19                                                ; +0x1ac, 0x791524\nB.EQ            loc_791534                                             ; +0x1b0, 0x791528\nADD             X1, X29, #0x80+var_20                                  ; +0x1b4, 0x79152c\nBL              sub_4DBC48                                             ; +0x1b8, 0x791530\nMOV             X0, X20                                                ; +0x1bc, 0x791534\nBL              _Unwind_Resume                                         ; +0x1c0, 0x791538\nMOV             X20, X0                                                ; +0x1c4, 0x79153c\nADRP            X19, #off_122EFE8@PAGE                                 ; +0x1c8, 0x791540\nB               loc_791518                                             ; +0x1cc, 0x791544", "xrefs": ["ItemInfoPopup::init @ 0x7952b4", "<???> @ 0x78dc8"], "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"}