{"type": "func", "start": 5581876, "end": 5582156, "name": "AchievementManager::isAchievementAvailable", "pseudocode": "// \n// AchievementManager::isAchievementAvailable from 0x552c34 to 0x552d4c (280 bytes)\n// \n// 3 xrefs:\n// > GJGarageLayer::achievementForUnlock @ 0x7915bc\n// > GameStatsManager::getItemUnlockStateLite @ 0x7bc658\n// > <???> @ 0x90e10\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 __fastcall AchievementManager::isAchievementAvailable(AchievementManager *a1, const char **a2)\n{\n  cocos2d::CCDictionary *AchievementsWithID; // x20\n  bool v3; // zf\n  __int64 *v4; // x0\n  unsigned int v5; // w20\n  unsigned int *v7; // x2\n  int v8; // w1\n  std::string v9; // [xsp+40h] [xbp+40h] BYREF\n\n  AchievementsWithID = AchievementManager::getAchievementsWithID(a1, *a2);\n  if ( AchievementsWithID )\n  {\n    sub_D153B8((int)&v9, \"un\");\n    v3 = cocos2d::CCDictionary::objectForKey(AchievementsWithID, &v9) == 0;\n    v4 = (__int64 *)((char *)v9.m_data.m_data - 24);\n    v5 = v3;\n    if ( v4 != &qword_124B6B0 )\n    {\n      if ( &pthread_create )\n      {\n        v7 = (unsigned int *)((char *)v9.m_data.m_data - 8);\n        do\n          v8 = __ldaxr(v7);\n        while ( __stlxr(v8 - 1, v7) );\n      }\n      else\n      {\n        v8 = *((_DWORD *)v9.m_data.m_data - 2);\n        *((_DWORD *)v9.m_data.m_data - 2) = v8 - 1;\n      }\n      if ( v8 <= 0 )\n        operator delete(v4);\n    }\n  }\n  else\n  {\n    return 0;\n  }\n  return v5;\n}", "assembly": "; \n; AchievementManager::isAchievementAvailable from 0x552c34 to 0x552d4c (280 bytes)\n; \n; 3 xrefs:\n; > GJGarageLayer::achievementForUnlock @ 0x7915bc\n; > GameStatsManager::getItemUnlockStateLite @ 0x7bc658\n; > <???> @ 0x90e10\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_50]!                                ; +0x0, 0x552c34\nMOV             X29, SP                                                ; +0x4, 0x552c38\nSTP             X19, X20, [SP,#0x50+var_40]                            ; +0x8, 0x552c3c\nADRP            X19, #__stack_chk_guard_ptr@PAGE                       ; +0xc, 0x552c40\nLDR             X1, [X1]; char *                                       ; +0x10, 0x552c44\nSTR             X21, [SP,#0x50+var_30]                                 ; +0x14, 0x552c48\nLDR             X2, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x18, 0x552c4c\nLDR             X2, [X2]                                               ; +0x1c, 0x552c50\nSTR             X2, [X29,#0x50+var_8]                                  ; +0x20, 0x552c54\nBL              _ZN18AchievementManager21getAchievementsWithIDEPKc; AchievementManager::getAchievementsWithID(char const*) ; +0x24, 0x552c58\nMOV             X20, X0                                                ; +0x28, 0x552c5c\nCBZ             X0, loc_552CD0                                         ; +0x2c, 0x552c60\nADD             X21, X29, #0x50+var_10                                 ; +0x30, 0x552c64\nADRP            X1, #(aModuleRun+8)@PAGE; \"un\"                         ; +0x34, 0x552c68\nMOV             X0, X21; int                                           ; +0x38, 0x552c6c\nADD             X1, X1, #(aModuleRun+8)@PAGEOFF; char *                ; +0x3c, 0x552c70\nADD             X2, X29, #0x50+var_20                                  ; +0x40, 0x552c74\nBL              sub_D153B8                                             ; +0x44, 0x552c78\nMOV             X0, X20                                                ; +0x48, 0x552c7c\nMOV             X1, X21                                                ; +0x4c, 0x552c80\nBL              _ZN7cocos2d12CCDictionary12objectForKeyERKSs; cocos2d::CCDictionary::objectForKey(std::string const&) ; +0x50, 0x552c84\nADRP            X1, #off_122EFE8@PAGE                                  ; +0x54, 0x552c88\nLDR             X2, [X29,#0x50+var_10]                                 ; +0x58, 0x552c8c\nCMP             X0, XZR                                                ; +0x5c, 0x552c90\nSUB             X0, X2, #0x18; p                                       ; +0x60, 0x552c94\nCSET            W20, EQ                                                ; +0x64, 0x552c98\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0x68, 0x552c9c\nCMP             X0, X1                                                 ; +0x6c, 0x552ca0\nB.NE            loc_552CD8                                             ; +0x70, 0x552ca4\nLDR             X19, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x74, 0x552ca8\nMOV             W0, W20                                                ; +0x78, 0x552cac\nLDR             X2, [X29,#0x50+var_8]                                  ; +0x7c, 0x552cb0\nLDR             X1, [X19]                                              ; +0x80, 0x552cb4\nCMP             X2, X1                                                 ; +0x84, 0x552cb8\nB.NE            loc_552D1C                                             ; +0x88, 0x552cbc\nLDP             X19, X20, [SP,#0x50+var_40]                            ; +0x8c, 0x552cc0\nLDR             X21, [SP,#0x50+var_30]                                 ; +0x90, 0x552cc4\nLDP             X29, X30, [SP+0x50+var_50],#0x50                       ; +0x94, 0x552cc8\nRET                                                                    ; +0x98, 0x552ccc\nMOV             W20, #0                                                ; +0x9c, 0x552cd0\nB               loc_552CA8                                             ; +0xa0, 0x552cd4\nADRP            X1, #pthread_create_ptr_0@PAGE                         ; +0xa4, 0x552cd8\nLDR             X1, [X1,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0xa8, 0x552cdc\nCBZ             X1, loc_552D0C                                         ; +0xac, 0x552ce0\nSUB             X2, X2, #8                                             ; +0xb0, 0x552ce4\nLDAXR           W1, [X2]                                               ; +0xb4, 0x552ce8\nSUB             W3, W1, #1                                             ; +0xb8, 0x552cec\nSTLXR           W4, W3, [X2]                                           ; +0xbc, 0x552cf0\nCBNZ            W4, loc_552CE8                                         ; +0xc0, 0x552cf4\nCMP             W1, WZR                                                ; +0xc4, 0x552cf8\nB.GT            loc_552CA8                                             ; +0xc8, 0x552cfc\nADD             X1, X29, #0x50+var_18                                  ; +0xcc, 0x552d00\nBL              j__ZdlPv; operator delete(void *)                      ; +0xd0, 0x552d04\nB               loc_552CA8                                             ; +0xd4, 0x552d08\nLDUR            W1, [X2,#-8]                                           ; +0xd8, 0x552d0c\nSUB             W3, W1, #1                                             ; +0xdc, 0x552d10\nSTUR            W3, [X2,#-8]                                           ; +0xe0, 0x552d14\nB               loc_552CF8                                             ; +0xe4, 0x552d18\nBL              .__stack_chk_fail                                      ; +0xe8, 0x552d1c\nADRP            X1, #off_122EFE8@PAGE                                  ; +0xec, 0x552d20\nMOV             X19, X0                                                ; +0xf0, 0x552d24\nLDR             X0, [X29,#0x50+var_10]                                 ; +0xf4, 0x552d28\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0xf8, 0x552d2c\nSUB             X0, X0, #0x18                                          ; +0xfc, 0x552d30\nCMP             X0, X1                                                 ; +0x100, 0x552d34\nB.EQ            loc_552D44                                             ; +0x104, 0x552d38\nADD             X1, X29, #0x50+var_18                                  ; +0x108, 0x552d3c\nBL              sub_4EDFD8                                             ; +0x10c, 0x552d40\nMOV             X0, X19                                                ; +0x110, 0x552d44\nBL              _Unwind_Resume                                         ; +0x114, 0x552d48", "xrefs": ["GJGarageLayer::achievementForUnlock @ 0x7915bc", "GameStatsManager::getItemUnlockStateLite @ 0x7bc658", "<???> @ 0x90e10"], "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"}