{"type": "func", "start": 5371509936, "end": 5371510459, "name": "GJShopLayer::onSelectItem", "pseudocode": "// \n// GJShopLayer::onSelectItem from 0x1402abcb0 to 0x1402abebb (523 bytes)\n// \n// 2 xrefs:\n// > GJShopLayer::init @ 0x1402ab27d\n// > <???> @ 0x1406d2240\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// Hidden C++ exception states: #wind=4\nvoid GJShopLayer::onSelectItem(GJShopLayer *a1, cocos2d::CCObject *a2)\n{\n  __int64 v3; // rbx\n  GameStatsManager *v4; // rcx\n  __int64 v5; // rcx\n  struct cocos2d::CCObject *v6; // rbx\n  __int16 *v7; // rdx\n  size_t v8; // r8\n  void **v9; // rbp\n  GameStatsManager *v10; // rcx\n  int v11; // edi\n  int Stat; // ebp\n  void *v13; // rcx\n  PurchaseItemPopup *v14; // rax\n  void *v15; // [rsp+20h] [rbp-48h]\n  void *v16; // [rsp+20h] [rbp-48h]\n  void *v17; // [rsp+20h] [rbp-48h]\n  void *Block[2]; // [rsp+28h] [rbp-40h] BYREF\n  __int64 v19; // [rsp+38h] [rbp-30h]\n  unsigned __int64 v20; // [rsp+40h] [rbp-28h]\n\n  if ( !a1->m_closing )\n  {\n    v3 = a2->getTag(a2);\n    v4 = (GameStatsManager *)qword_1406C2EE8;\n    if ( !qword_1406C2EE8 )\n    {\n      v15 = operator new(0x3E0u);\n      qword_1406C2EE8 = sub_1401D0AE0((__int64)v15);\n      (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);\n      v4 = (GameStatsManager *)qword_1406C2EE8;\n    }\n    if ( !GameStatsManager::isStoreItemUnlocked(v4, v3) )\n    {\n      v5 = qword_1406C2EE8;\n      if ( !qword_1406C2EE8 )\n      {\n        v16 = operator new(0x3E0u);\n        qword_1406C2EE8 = sub_1401D0AE0((__int64)v16);\n        (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);\n        v5 = qword_1406C2EE8;\n      }\n      v6 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v5 + 344), v3);\n      v7 = (__int16 *)\"14\";\n      if ( v6[6].m_uIndexInArray == 4 )\n        v7 = &word_14055A524;\n      *(_OWORD *)Block = 0;\n      v19 = 0;\n      v20 = 0;\n      v8 = -1;\n      do\n        ++v8;\n      while ( *((_BYTE *)v7 + v8) );\n      sub_14003A930(Block, v7, v8);\n      v9 = Block;\n      if ( v20 > 0xF )\n        v9 = (void **)Block[0];\n      v10 = (GameStatsManager *)qword_1406C2EE8;\n      if ( !qword_1406C2EE8 )\n      {\n        v17 = operator new(0x3E0u);\n        qword_1406C2EE8 = sub_1401D0AE0((__int64)v17);\n        (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);\n        v10 = (GameStatsManager *)qword_1406C2EE8;\n      }\n      v11 = v6[6].m_uReference - v6[6].m_uAutoReleaseCount;\n      Stat = GameStatsManager::getStat(v10, (const char *)v9);\n      if ( v20 > 0xF )\n      {\n        v13 = Block[0];\n        if ( v20 + 1 >= 0x1000 )\n        {\n          v13 = *((void **)Block[0] - 1);\n          if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F )\n            invalid_parameter_noinfo_noreturn();\n        }\n        j_j_free(v13);\n      }\n      if ( v11 <= Stat )\n      {\n        v14 = PurchaseItemPopup::create((GJStoreItem *)v6);\n        v14->m_delegate = &a1->GJPurchaseDelegate;\n        v14->show(v14);\n      }\n      else\n      {\n        GJShopLayer::showCantAffordMessage(a1, (GJStoreItem *)v6);\n      }\n    }\n  }\n}", "assembly": "; \n; GJShopLayer::onSelectItem from 0x1402abcb0 to 0x1402abebb (523 bytes)\n; \n; 2 xrefs:\n; > GJShopLayer::init @ 0x1402ab27d\n; > <???> @ 0x1406d2240\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\nmov     [rsp+arg_10], rbx                                              ; +0x0, 0x1402abcb0\npush    rbp                                                            ; +0x5, 0x1402abcb5\npush    rsi                                                            ; +0x6, 0x1402abcb6\npush    rdi                                                            ; +0x7, 0x1402abcb7\nsub     rsp, 50h                                                       ; +0x8, 0x1402abcb8\nmov     rax, cs:__security_cookie                                      ; +0xc, 0x1402abcbc\nxor     rax, rsp                                                       ; +0x13, 0x1402abcc3\nmov     [rsp+68h+var_20], rax                                          ; +0x16, 0x1402abcc6\nmov     rsi, rcx                                                       ; +0x1b, 0x1402abccb\nxor     edi, edi                                                       ; +0x1e, 0x1402abcce\ncmp     [rcx+1B0h], dil                                                ; +0x20, 0x1402abcd0\njnz     loc_1402ABE9E                                                  ; +0x27, 0x1402abcd7\nmov     rax, [rdx]                                                     ; +0x2d, 0x1402abcdd\nmov     rcx, rdx                                                       ; +0x30, 0x1402abce0\ncall    qword ptr [rax+38h]                                            ; +0x33, 0x1402abce3\nmovsxd  rbx, eax                                                       ; +0x36, 0x1402abce6\nmov     rcx, cs:qword_1406C2EE8                                        ; +0x39, 0x1402abce9\ntest    rcx, rcx                                                       ; +0x40, 0x1402abcf0\njnz     short loc_1402ABD24                                            ; +0x43, 0x1402abcf3\nmov     ecx, 3E0h; Size                                                ; +0x45, 0x1402abcf5\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x4a, 0x1402abcfa\nmov     [rsp+68h+var_48], rax                                          ; +0x4f, 0x1402abcff\nmov     rcx, rax                                                       ; +0x54, 0x1402abd04\ncall    sub_1401D0AE0                                                  ; +0x57, 0x1402abd07\nnop                                                                    ; +0x5c, 0x1402abd0c\nmov     cs:qword_1406C2EE8, rax                                        ; +0x5d, 0x1402abd0d\nmov     rdx, [rax]                                                     ; +0x64, 0x1402abd14\nmov     rcx, rax                                                       ; +0x67, 0x1402abd17\ncall    qword ptr [rdx+48h]                                            ; +0x6a, 0x1402abd1a\nmov     rcx, cs:qword_1406C2EE8                                        ; +0x6d, 0x1402abd1d\nmov     edx, ebx                                                       ; +0x74, 0x1402abd24\ncall    GameStatsManager__isStoreItemUnlocked                          ; +0x76, 0x1402abd26\ntest    al, al                                                         ; +0x7b, 0x1402abd2b\njnz     loc_1402ABE9E                                                  ; +0x7d, 0x1402abd2d\nmov     rcx, cs:qword_1406C2EE8                                        ; +0x83, 0x1402abd33\ntest    rcx, rcx                                                       ; +0x8a, 0x1402abd3a\njnz     short loc_1402ABD6E                                            ; +0x8d, 0x1402abd3d\nmov     ecx, 3E0h; Size                                                ; +0x8f, 0x1402abd3f\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x94, 0x1402abd44\nmov     [rsp+68h+var_48], rax                                          ; +0x99, 0x1402abd49\nmov     rcx, rax                                                       ; +0x9e, 0x1402abd4e\ncall    sub_1401D0AE0                                                  ; +0xa1, 0x1402abd51\nnop                                                                    ; +0xa6, 0x1402abd56\nmov     cs:qword_1406C2EE8, rax                                        ; +0xa7, 0x1402abd57\nmov     rdx, [rax]                                                     ; +0xae, 0x1402abd5e\nmov     rcx, rax                                                       ; +0xb1, 0x1402abd61\ncall    qword ptr [rdx+48h]                                            ; +0xb4, 0x1402abd64\nmov     rcx, cs:qword_1406C2EE8                                        ; +0xb7, 0x1402abd67\nmov     rdx, rbx                                                       ; +0xbe, 0x1402abd6e\nmov     rcx, [rcx+158h]                                                ; +0xc1, 0x1402abd71\ncall    cs:?objectForKey@CCDictionary@cocos2d@@QEAAPEAVCCObject@2@_J@Z; cocos2d::CCDictionary::objectForKey(__int64) ; +0xc8, 0x1402abd78\nmov     rbx, rax                                                       ; +0xce, 0x1402abd7e\nlea     rax, word_14055A524                                            ; +0xd1, 0x1402abd81\nlea     rdx, a14; \"14\"                                                 ; +0xd8, 0x1402abd88\ncmp     dword ptr [rbx+170h], 4                                        ; +0xdf, 0x1402abd8f\ncmovz   rdx, rax                                                       ; +0xe6, 0x1402abd96\nxorps   xmm0, xmm0                                                     ; +0xea, 0x1402abd9a\nmovups  xmmword ptr [rsp+68h+Block], xmm0                              ; +0xed, 0x1402abd9d\nmov     [rsp+68h+var_30], rdi                                          ; +0xf2, 0x1402abda2\nmov     [rsp+68h+var_28], rdi                                          ; +0xf7, 0x1402abda7\nmov     r8, 0FFFFFFFFFFFFFFFFh                                         ; +0xfc, 0x1402abdac\ninc     r8                                                             ; +0x103, 0x1402abdb3\ncmp     byte ptr [rdx+r8], 0                                           ; +0x106, 0x1402abdb6\njnz     short loc_1402ABDB3                                            ; +0x10b, 0x1402abdbb\nlea     rcx, [rsp+68h+Block]                                           ; +0x10d, 0x1402abdbd\ncall    sub_14003A930                                                  ; +0x112, 0x1402abdc2\nnop                                                                    ; +0x117, 0x1402abdc7\nlea     rbp, [rsp+68h+Block]                                           ; +0x118, 0x1402abdc8\ncmp     [rsp+68h+var_28], 0Fh                                          ; +0x11d, 0x1402abdcd\ncmova   rbp, [rsp+68h+Block]                                           ; +0x123, 0x1402abdd3\nmov     rcx, cs:qword_1406C2EE8                                        ; +0x129, 0x1402abdd9\ntest    rcx, rcx                                                       ; +0x130, 0x1402abde0\njnz     short loc_1402ABE15                                            ; +0x133, 0x1402abde3\nmov     ecx, 3E0h; Size                                                ; +0x135, 0x1402abde5\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x13a, 0x1402abdea\nmov     [rsp+68h+var_48], rax                                          ; +0x13f, 0x1402abdef\nmov     rcx, rax                                                       ; +0x144, 0x1402abdf4\ncall    sub_1401D0AE0                                                  ; +0x147, 0x1402abdf7\nnop                                                                    ; +0x14c, 0x1402abdfc\nmov     cs:qword_1406C2EE8, rax                                        ; +0x14d, 0x1402abdfd\nmov     r8, [rax]                                                      ; +0x154, 0x1402abe04\nmov     rcx, rax                                                       ; +0x157, 0x1402abe07\ncall    qword ptr [r8+48h]                                             ; +0x15a, 0x1402abe0a\nmov     rcx, cs:qword_1406C2EE8                                        ; +0x15e, 0x1402abe0e\nmov     edi, [rbx+164h]                                                ; +0x165, 0x1402abe15\nsub     edi, [rbx+168h]                                                ; +0x16b, 0x1402abe1b\nmov     rdx, rbp                                                       ; +0x171, 0x1402abe21\ncall    GameStatsManager__getStat                                      ; +0x174, 0x1402abe24\nmov     ebp, eax                                                       ; +0x179, 0x1402abe29\nmov     rdx, [rsp+68h+var_28]                                          ; +0x17b, 0x1402abe2b\ncmp     rdx, 0Fh                                                       ; +0x180, 0x1402abe30\njbe     short loc_1402ABE6B                                            ; +0x184, 0x1402abe34\ninc     rdx                                                            ; +0x186, 0x1402abe36\nmov     rcx, [rsp+68h+Block]; Block                                    ; +0x189, 0x1402abe39\nmov     rax, rcx                                                       ; +0x18e, 0x1402abe3e\ncmp     rdx, 1000h                                                     ; +0x191, 0x1402abe41\njb      short loc_1402ABE66                                            ; +0x198, 0x1402abe48\nadd     rdx, 27h ; '''                                                 ; +0x19a, 0x1402abe4a\nmov     rcx, [rcx-8]                                                   ; +0x19e, 0x1402abe4e\nsub     rax, rcx                                                       ; +0x1a2, 0x1402abe52\nadd     rax, 0FFFFFFFFFFFFFFF8h                                        ; +0x1a5, 0x1402abe55\ncmp     rax, 1Fh                                                       ; +0x1a9, 0x1402abe59\njbe     short loc_1402ABE66                                            ; +0x1ad, 0x1402abe5d\ncall    cs:_invalid_parameter_noinfo_noreturn                          ; +0x1af, 0x1402abe5f\nalign 2                                                                ; +0x1b5, 0x1402abe65\ncall    j_j_free                                                       ; +0x1b6, 0x1402abe66\ncmp     edi, ebp                                                       ; +0x1bb, 0x1402abe6b\njle     short loc_1402ABE7C                                            ; +0x1bd, 0x1402abe6d\nmov     rdx, rbx                                                       ; +0x1bf, 0x1402abe6f\nmov     rcx, rsi                                                       ; +0x1c2, 0x1402abe72\ncall    GJShopLayer__showCantAffordMessage                             ; +0x1c5, 0x1402abe75\njmp     short loc_1402ABE9E                                            ; +0x1ca, 0x1402abe7a\nmov     rcx, rbx                                                       ; +0x1cc, 0x1402abe7c\ncall    PurchaseItemPopup__create                                      ; +0x1cf, 0x1402abe7f\nlea     rcx, [rsi+198h]                                                ; +0x1d4, 0x1402abe84\nmov     [rax+280h], rcx                                                ; +0x1db, 0x1402abe8b\nmov     rdx, [rax]                                                     ; +0x1e2, 0x1402abe92\nmov     rcx, rax                                                       ; +0x1e5, 0x1402abe95\ncall    qword ptr [rdx+410h]                                           ; +0x1e8, 0x1402abe98\nmov     rcx, [rsp+68h+var_20]                                          ; +0x1ee, 0x1402abe9e\nxor     rcx, rsp; StackCookie                                          ; +0x1f3, 0x1402abea3\ncall    __security_check_cookie                                        ; +0x1f6, 0x1402abea6\nmov     rbx, [rsp+68h+arg_10]                                          ; +0x1fb, 0x1402abeab\nadd     rsp, 50h                                                       ; +0x203, 0x1402abeb3\npop     rdi                                                            ; +0x207, 0x1402abeb7\npop     rsi                                                            ; +0x208, 0x1402abeb8\npop     rbp                                                            ; +0x209, 0x1402abeb9\nretn                                                                   ; +0x20a, 0x1402abeba", "xrefs": ["GJShopLayer::init @ 0x1402ab27d", "<???> @ 0x1406d2240"], "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"}