{"type": "func", "start": 5585608, "end": 5586000, "name": "AchievementManager::reportAchievementWithID", "pseudocode": "// \n// AchievementManager::reportAchievementWithID from 0x553ac8 to 0x553c50 (392 bytes)\n// \n// 2 xrefs:\n// > GameManager::reportAchievementWithID @ 0x5f37a8\n// > <???> @ 0x93630\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\nvoid AchievementManager::reportAchievementWithID(AchievementManager *a1, const char *a2, int a3, bool a4)\n{\n  unsigned int v7; // w23\n  cocos2d::CCDictionary *m_reportedAchievements; // x26\n  cocos2d::CCObject *v9; // x25\n  void *v10; // x0\n  AchievementManager *v11; // x0\n  unsigned int *v12; // x2\n  int v13; // w1\n  __int64 v14; // [xsp+60h] [xbp+60h] BYREF\n\n  v7 = a4;\n  if ( !AchievementManager::isAchievementEarned(a1, a2) )\n  {\n    if ( AchievementManager::percentForAchievement(a1, a2) < a3 )\n    {\n      if ( a3 > 100 )\n        a3 = 100;\n      m_reportedAchievements = a1->m_reportedAchievements;\n      v9 = (cocos2d::CCObject *)cocos2d::CCString::createWithFormat(\n                                  (cocos2d::CCString *)\"%i\",\n                                  (const char *)(unsigned int)a3);\n      sub_D153B8((int)&v14, (char *)a2);\n      cocos2d::CCDictionary::setObject((int)m_reportedAchievements, v9);\n      v10 = (void *)(v14 - 24);\n      if ( (__int64 *)(v14 - 24) != &qword_124B6B0 )\n      {\n        if ( &pthread_create )\n        {\n          v12 = (unsigned int *)(v14 - 8);\n          do\n            v13 = __ldaxr(v12);\n          while ( __stlxr(v13 - 1, v12) );\n        }\n        else\n        {\n          v13 = *(_DWORD *)(v14 - 8);\n          *(_DWORD *)(v14 - 8) = v13 - 1;\n        }\n        if ( v13 <= 0 )\n          operator delete(v10);\n      }\n      AchievementManager::reportPlatformAchievementWithID(a1, a2, a3);\n    }\n    if ( (a3 > 99) > v7 )\n    {\n      v11 = AchievementManager::sharedState();\n      AchievementManager::notifyAchievementWithID(v11, a2);\n    }\n  }\n}", "assembly": "; \n; AchievementManager::reportAchievementWithID from 0x553ac8 to 0x553c50 (392 bytes)\n; \n; 2 xrefs:\n; > GameManager::reportAchievementWithID @ 0x5f37a8\n; > <???> @ 0x93630\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_70]!                                ; +0x0, 0x553ac8\nMOV             X29, SP                                                ; +0x4, 0x553acc\nSTP             X19, X20, [SP,#0x70+var_60]                            ; +0x8, 0x553ad0\nADRP            X19, #__stack_chk_guard_ptr@PAGE                       ; +0xc, 0x553ad4\nMOV             W20, W2                                                ; +0x10, 0x553ad8\nSTP             X21, X22, [SP,#0x70+var_50]                            ; +0x14, 0x553adc\nSTP             X23, X24, [SP,#0x70+var_40]                            ; +0x18, 0x553ae0\nLDR             X2, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x1c, 0x553ae4\nMOV             X22, X0                                                ; +0x20, 0x553ae8\nSTP             X25, X26, [SP,#0x70+var_30]                            ; +0x24, 0x553aec\nMOV             X21, X1                                                ; +0x28, 0x553af0\nUXTB            W23, W3                                                ; +0x2c, 0x553af4\nLDR             X2, [X2]                                               ; +0x30, 0x553af8\nSTR             X2, [X29,#0x70+var_8]                                  ; +0x34, 0x553afc\nBL              _ZN18AchievementManager19isAchievementEarnedEPKc; AchievementManager::isAchievementEarned(char const*) ; +0x38, 0x553b00\nUXTB            W0, W0                                                 ; +0x3c, 0x553b04\nCBZ             W0, loc_553B38                                         ; +0x40, 0x553b08\nLDR             X19, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x44, 0x553b0c\nLDR             X1, [X29,#0x70+var_8]                                  ; +0x48, 0x553b10\nLDR             X0, [X19]                                              ; +0x4c, 0x553b14\nCMP             X1, X0                                                 ; +0x50, 0x553b18\nB.NE            loc_553C20                                             ; +0x54, 0x553b1c\nLDP             X19, X20, [SP,#0x70+var_60]                            ; +0x58, 0x553b20\nLDP             X21, X22, [SP,#0x70+var_50]                            ; +0x5c, 0x553b24\nLDP             X23, X24, [SP,#0x70+var_40]                            ; +0x60, 0x553b28\nLDP             X25, X26, [SP,#0x70+var_30]                            ; +0x64, 0x553b2c\nLDP             X29, X30, [SP+0x70+var_70],#0x70                       ; +0x68, 0x553b30\nRET                                                                    ; +0x6c, 0x553b34\nMOV             X0, X22; this                                          ; +0x70, 0x553b38\nMOV             X1, X21; char *                                        ; +0x74, 0x553b3c\nBL              _ZN18AchievementManager21percentForAchievementEPKc; AchievementManager::percentForAchievement(char const*) ; +0x78, 0x553b40\nCMP             W0, W20                                                ; +0x7c, 0x553b44\nB.GE            loc_553BBC                                             ; +0x80, 0x553b48\nCMP             W20, #0x64 ; 'd'                                       ; +0x84, 0x553b4c\nMOV             W0, #0x64 ; 'd'                                        ; +0x88, 0x553b50\nCSEL            W20, W20, W0, LE                                       ; +0x8c, 0x553b54\nADRP            X0, #(aSongidI+8)@PAGE; \"%i\"                           ; +0x90, 0x553b58\nMOV             W1, W20; char *                                        ; +0x94, 0x553b5c\nADD             X0, X0, #(aSongidI+8)@PAGEOFF; this                    ; +0x98, 0x553b60\nLDR             X26, [X22,#0x160]                                      ; +0x9c, 0x553b64\nADD             X24, X29, #0x70+var_10                                 ; +0xa0, 0x553b68\nBL              _ZN7cocos2d8CCString16createWithFormatEPKcz; cocos2d::CCString::createWithFormat(char const*,...) ; +0xa4, 0x553b6c\nMOV             X25, X0                                                ; +0xa8, 0x553b70\nMOV             X1, X21; char *                                        ; +0xac, 0x553b74\nMOV             X0, X24; int                                           ; +0xb0, 0x553b78\nADD             X2, X29, #0x70+var_20                                  ; +0xb4, 0x553b7c\nBL              sub_D153B8                                             ; +0xb8, 0x553b80\nMOV             X0, X26; int                                           ; +0xbc, 0x553b84\nMOV             X1, X25; this                                          ; +0xc0, 0x553b88\nMOV             X2, X24                                                ; +0xc4, 0x553b8c\nBL              _ZN7cocos2d12CCDictionary9setObjectEPNS_8CCObjectERKSs; cocos2d::CCDictionary::setObject(cocos2d::CCObject *,std::string const&) ; +0xc8, 0x553b90\nADRP            X1, #off_122EFE8@PAGE                                  ; +0xcc, 0x553b94\nLDR             X2, [X29,#0x70+var_10]                                 ; +0xd0, 0x553b98\nSUB             X0, X2, #0x18; p                                       ; +0xd4, 0x553b9c\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0xd8, 0x553ba0\nCMP             X0, X1                                                 ; +0xdc, 0x553ba4\nB.NE            loc_553BDC                                             ; +0xe0, 0x553ba8\nMOV             X0, X22; this                                          ; +0xe4, 0x553bac\nMOV             X1, X21; char *                                        ; +0xe8, 0x553bb0\nMOV             W2, W20; int                                           ; +0xec, 0x553bb4\nBL              _ZN18AchievementManager31reportPlatformAchievementWithIDEPKci; AchievementManager::reportPlatformAchievementWithID(char const*,int) ; +0xf0, 0x553bb8\nCMP             W20, #0x63 ; 'c'                                       ; +0xf4, 0x553bbc\nCSET            W0, GT; this                                           ; +0xf8, 0x553bc0\nCMP             W0, W23                                                ; +0xfc, 0x553bc4\nB.LS            loc_553B0C                                             ; +0x100, 0x553bc8\nBL              _ZN18AchievementManager11sharedStateEv; AchievementManager::sharedState(void) ; +0x104, 0x553bcc\nMOV             X1, X21; char *                                        ; +0x108, 0x553bd0\nBL              _ZN18AchievementManager23notifyAchievementWithIDEPKc; AchievementManager::notifyAchievementWithID(char const*) ; +0x10c, 0x553bd4\nB               loc_553B0C                                             ; +0x110, 0x553bd8\nADRP            X1, #pthread_create_ptr_0@PAGE                         ; +0x114, 0x553bdc\nLDR             X1, [X1,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0x118, 0x553be0\nCBZ             X1, loc_553C10                                         ; +0x11c, 0x553be4\nSUB             X2, X2, #8                                             ; +0x120, 0x553be8\nLDAXR           W1, [X2]                                               ; +0x124, 0x553bec\nSUB             W3, W1, #1                                             ; +0x128, 0x553bf0\nSTLXR           W4, W3, [X2]                                           ; +0x12c, 0x553bf4\nCBNZ            W4, loc_553BEC                                         ; +0x130, 0x553bf8\nCMP             W1, WZR                                                ; +0x134, 0x553bfc\nB.GT            loc_553BAC                                             ; +0x138, 0x553c00\nADD             X1, X29, #0x70+var_18                                  ; +0x13c, 0x553c04\nBL              j__ZdlPv; operator delete(void *)                      ; +0x140, 0x553c08\nB               loc_553BAC                                             ; +0x144, 0x553c0c\nLDUR            W1, [X2,#-8]                                           ; +0x148, 0x553c10\nSUB             W3, W1, #1                                             ; +0x14c, 0x553c14\nSTUR            W3, [X2,#-8]                                           ; +0x150, 0x553c18\nB               loc_553BFC                                             ; +0x154, 0x553c1c\nBL              .__stack_chk_fail                                      ; +0x158, 0x553c20\nADRP            X1, #off_122EFE8@PAGE                                  ; +0x15c, 0x553c24\nMOV             X19, X0                                                ; +0x160, 0x553c28\nLDR             X0, [X29,#0x70+var_10]                                 ; +0x164, 0x553c2c\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0x168, 0x553c30\nSUB             X0, X0, #0x18                                          ; +0x16c, 0x553c34\nCMP             X0, X1                                                 ; +0x170, 0x553c38\nB.EQ            loc_553C48                                             ; +0x174, 0x553c3c\nADD             X1, X29, #0x70+var_18                                  ; +0x178, 0x553c40\nBL              sub_4EDFD8                                             ; +0x17c, 0x553c44\nMOV             X0, X19                                                ; +0x180, 0x553c48\nBL              _Unwind_Resume                                         ; +0x184, 0x553c4c", "xrefs": ["GameManager::reportAchievementWithID @ 0x5f37a8", "<???> @ 0x93630"], "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"}