{"type": "func", "start": 8757988, "end": 8758260, "name": "GJBaseGameLayer::hasItem", "pseudocode": "// \n// GJBaseGameLayer::hasItem from 0x85a2e4 to 0x85a3f4 (272 bytes)\n// \n// 2 xrefs:\n// > EndLevelLayer::customSetup @ 0x7d63ac\n// > <???> @ 0xb4ed0\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// local variable allocation has failed, the output may be wrong!\nbool GJBaseGameLayer::hasItem(GJBaseGameLayer *a1, int a2)\n{\n  cocos2d::CCDictionary *m_collectedItems; // x21\n  cocos2d::CCString *v3; // x0\n  char *CString; // x0\n  bool v5; // zf\n  __int64 *v6; // x0\n  bool v7; // w20\n  unsigned int *v9; // x2\n  int v10; // w1\n  std::string v11; // [xsp+40h] [xbp+40h] BYREF\n\n  m_collectedItems = a1->m_collectedItems;\n  v3 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)\"%i\", *(const char **)&a2);\n  CString = (char *)cocos2d::CCString::getCString(v3);\n  sub_D153B8((int)&v11, CString);\n  v5 = cocos2d::CCDictionary::objectForKey(m_collectedItems, &v11) == 0;\n  v6 = (__int64 *)((char *)v11.m_data.m_data - 24);\n  v7 = !v5;\n  if ( v6 != &qword_124B6B0 )\n  {\n    if ( &pthread_create )\n    {\n      v9 = (unsigned int *)((char *)v11.m_data.m_data - 8);\n      do\n        v10 = __ldaxr(v9);\n      while ( __stlxr(v10 - 1, v9) );\n    }\n    else\n    {\n      v10 = *((_DWORD *)v11.m_data.m_data - 2);\n      *((_DWORD *)v11.m_data.m_data - 2) = v10 - 1;\n    }\n    if ( v10 <= 0 )\n      operator delete(v6);\n  }\n  return v7;\n}", "assembly": "; \n; GJBaseGameLayer::hasItem from 0x85a2e4 to 0x85a3f4 (272 bytes)\n; \n; 2 xrefs:\n; > EndLevelLayer::customSetup @ 0x7d63ac\n; > <???> @ 0xb4ed0\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, 0x85a2e4\nMOV             X29, SP                                                ; +0x4, 0x85a2e8\nSTP             X19, X20, [SP,#0x50+var_40]                            ; +0x8, 0x85a2ec\nADRP            X19, #__stack_chk_guard_ptr@PAGE                       ; +0xc, 0x85a2f0\nSTR             X21, [SP,#0x50+var_30]                                 ; +0x10, 0x85a2f4\nLDR             X21, [X0,#0x3278]                                      ; +0x14, 0x85a2f8\nADRL            X0, (aSongidI+8); this                                 ; +0x18, 0x85a2fc\nADD             X20, X29, #0x50+var_10                                 ; +0x20, 0x85a304\nLDR             X2, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x24, 0x85a308\nLDR             X2, [X2]                                               ; +0x28, 0x85a30c\nSTR             X2, [X29,#0x50+var_8]                                  ; +0x2c, 0x85a310\nBL              _ZN7cocos2d8CCString16createWithFormatEPKcz; cocos2d::CCString::createWithFormat(char const*,...) ; +0x30, 0x85a314\nBL              _ZNK7cocos2d8CCString10getCStringEv; cocos2d::CCString::getCString(void) ; +0x34, 0x85a318\nMOV             X1, X0; char *                                         ; +0x38, 0x85a31c\nADD             X2, X29, #0x50+var_20                                  ; +0x3c, 0x85a320\nMOV             X0, X20; int                                           ; +0x40, 0x85a324\nBL              sub_D153B8                                             ; +0x44, 0x85a328\nMOV             X0, X21                                                ; +0x48, 0x85a32c\nMOV             X1, X20                                                ; +0x4c, 0x85a330\nBL              _ZN7cocos2d12CCDictionary12objectForKeyERKSs; cocos2d::CCDictionary::objectForKey(std::string const&) ; +0x50, 0x85a334\nADRP            X1, #off_122EFE8@PAGE                                  ; +0x54, 0x85a338\nLDR             X2, [X29,#0x50+var_10]                                 ; +0x58, 0x85a33c\nCMP             X0, XZR                                                ; +0x5c, 0x85a340\nSUB             X0, X2, #0x18; p                                       ; +0x60, 0x85a344\nCSET            W20, NE                                                ; +0x64, 0x85a348\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0x68, 0x85a34c\nCMP             X0, X1                                                 ; +0x6c, 0x85a350\nB.NE            loc_85A380                                             ; +0x70, 0x85a354\nLDR             X19, [X19,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x74, 0x85a358\nMOV             W0, W20                                                ; +0x78, 0x85a35c\nLDR             X2, [X29,#0x50+var_8]                                  ; +0x7c, 0x85a360\nLDR             X1, [X19]                                              ; +0x80, 0x85a364\nCMP             X2, X1                                                 ; +0x84, 0x85a368\nB.NE            loc_85A3C4                                             ; +0x88, 0x85a36c\nLDP             X19, X20, [SP,#0x50+var_40]                            ; +0x8c, 0x85a370\nLDR             X21, [SP,#0x50+var_30]                                 ; +0x90, 0x85a374\nLDP             X29, X30, [SP+0x50+var_50],#0x50                       ; +0x94, 0x85a378\nRET                                                                    ; +0x98, 0x85a37c\nADRP            X1, #pthread_create_ptr_0@PAGE                         ; +0x9c, 0x85a380\nLDR             X1, [X1,#pthread_create_ptr_0@PAGEOFF]; pthread_create ; +0xa0, 0x85a384\nCBZ             X1, loc_85A3B4                                         ; +0xa4, 0x85a388\nSUB             X2, X2, #8                                             ; +0xa8, 0x85a38c\nLDAXR           W1, [X2]                                               ; +0xac, 0x85a390\nSUB             W3, W1, #1                                             ; +0xb0, 0x85a394\nSTLXR           W4, W3, [X2]                                           ; +0xb4, 0x85a398\nCBNZ            W4, loc_85A390                                         ; +0xb8, 0x85a39c\nCMP             W1, WZR                                                ; +0xbc, 0x85a3a0\nB.GT            loc_85A358                                             ; +0xc0, 0x85a3a4\nADD             X1, X29, #0x50+var_18                                  ; +0xc4, 0x85a3a8\nBL              j__ZdlPv; operator delete(void *)                      ; +0xc8, 0x85a3ac\nB               loc_85A358                                             ; +0xcc, 0x85a3b0\nLDUR            W1, [X2,#-8]                                           ; +0xd0, 0x85a3b4\nSUB             W3, W1, #1                                             ; +0xd4, 0x85a3b8\nSTUR            W3, [X2,#-8]                                           ; +0xd8, 0x85a3bc\nB               loc_85A3A0                                             ; +0xdc, 0x85a3c0\nBL              .__stack_chk_fail                                      ; +0xe0, 0x85a3c4\nADRP            X1, #off_122EFE8@PAGE                                  ; +0xe4, 0x85a3c8\nMOV             X19, X0                                                ; +0xe8, 0x85a3cc\nLDR             X0, [X29,#0x50+var_10]                                 ; +0xec, 0x85a3d0\nLDR             X1, [X1,#off_122EFE8@PAGEOFF]; qword_124B6B0           ; +0xf0, 0x85a3d4\nSUB             X0, X0, #0x18                                          ; +0xf4, 0x85a3d8\nCMP             X0, X1                                                 ; +0xf8, 0x85a3dc\nB.EQ            loc_85A3EC                                             ; +0xfc, 0x85a3e0\nADD             X1, X29, #0x50+var_18                                  ; +0x100, 0x85a3e4\nBL              sub_4DC320                                             ; +0x104, 0x85a3e8\nMOV             X0, X19                                                ; +0x108, 0x85a3ec\nBL              _Unwind_Resume                                         ; +0x10c, 0x85a3f0", "xrefs": ["EndLevelLayer::customSetup @ 0x7d63ac", "<???> @ 0xb4ed0"], "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"}