{"type": "func", "start": 4298263440, "end": 4298263674, "name": "GJShopLayer::onSelectItem", "pseudocode": "// \n// GJShopLayer::onSelectItem from 0x100324b90 to 0x100324c7a (234 bytes)\n// \n// 1 xrefs:\n// > GJShopLayer::init @ 0x10032403f\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 __fastcall GJShopLayer::onSelectItem(GJShopLayer *a1, cocos2d::CCObject *a2)\n{\n  int v2; // r14d\n  GameStatsManager *v3; // rax\n  GameStatsManager *v4; // rax\n  GJStoreItem *StoreItem_1; // r14\n  int random; // r12d\n  int seed; // r13d\n  GameStatsManager *v8; // r15\n  const char *v9; // rsi\n  int Stat; // r15d\n  int v11; // r12d\n  PurchaseItemPopup *v12; // rax\n  char v13; // [rsp+0h] [rbp-40h] BYREF\n  char v14; // [rsp+1h] [rbp-3Fh] BYREF\n  void *__p; // [rsp+10h] [rbp-30h]\n\n  if ( !a1->m_closing )\n  {\n    v2 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);\n    v3 = GameStatsManager::sharedState();\n    if ( !GameStatsManager::isStoreItemUnlocked(v3, v2) )\n    {\n      v4 = GameStatsManager::sharedState();\n      StoreItem_1 = GameStatsManager::getStoreItem_1(v4, v2);\n      random = StoreItem_1->m_price.random;\n      seed = StoreItem_1->m_price.seed;\n      v8 = GameStatsManager::sharedState();\n      GJStoreItem::getCurrencyKey((__int64)&v13, (__int64)StoreItem_1);\n      if ( (v13 & 1) != 0 )\n        v9 = (const char *)__p;\n      else\n        v9 = &v14;\n      Stat = GameStatsManager::getStat(v8, v9);\n      v11 = random - seed;\n      if ( (v13 & 1) != 0 )\n        operator delete(__p);\n      if ( v11 <= Stat )\n      {\n        v12 = PurchaseItemPopup::create(StoreItem_1);\n        v12->m_delegate = &a1->GJPurchaseDelegate;\n        ((void (__fastcall *)(PurchaseItemPopup *))v12->show)(v12);\n      }\n      else\n      {\n        GJShopLayer::showCantAffordMessage(a1, StoreItem_1);\n      }\n    }\n  }\n}", "assembly": "; \n; GJShopLayer::onSelectItem from 0x100324b90 to 0x100324c7a (234 bytes)\n; \n; 1 xrefs:\n; > GJShopLayer::init @ 0x10032403f\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\npush    rbp                                                            ; +0x0, 0x100324b90\nmov     rbp, rsp                                                       ; +0x1, 0x100324b91\npush    r15                                                            ; +0x4, 0x100324b94\npush    r14                                                            ; +0x6, 0x100324b96\npush    r13                                                            ; +0x8, 0x100324b98\npush    r12                                                            ; +0xa, 0x100324b9a\npush    rbx                                                            ; +0xc, 0x100324b9c\nsub     rsp, 18h                                                       ; +0xd, 0x100324b9d\ncmp     byte ptr [rdi+1B0h], 0                                         ; +0x11, 0x100324ba1\njnz     loc_100324C6B                                                  ; +0x18, 0x100324ba8\nmov     rbx, rdi                                                       ; +0x1e, 0x100324bae\nmov     rax, [rsi]                                                     ; +0x21, 0x100324bb1\nmov     rdi, rsi                                                       ; +0x24, 0x100324bb4\ncall    qword ptr [rax+40h]                                            ; +0x27, 0x100324bb7\nmov     r14d, eax                                                      ; +0x2a, 0x100324bba\ncall    GameStatsManager__sharedState                                  ; +0x2d, 0x100324bbd\nmov     rdi, rax                                                       ; +0x32, 0x100324bc2\nmov     esi, r14d                                                      ; +0x35, 0x100324bc5\ncall    GameStatsManager__isStoreItemUnlocked                          ; +0x38, 0x100324bc8\ntest    al, al                                                         ; +0x3d, 0x100324bcd\njnz     loc_100324C6B                                                  ; +0x3f, 0x100324bcf\ncall    GameStatsManager__sharedState                                  ; +0x45, 0x100324bd5\nmov     rdi, rax                                                       ; +0x4a, 0x100324bda\nmov     esi, r14d                                                      ; +0x4d, 0x100324bdd\ncall    GameStatsManager__getStoreItem_1                               ; +0x50, 0x100324be0\nmov     r14, rax                                                       ; +0x55, 0x100324be5\nmov     r12d, [rax+160h]                                               ; +0x58, 0x100324be8\nmov     r13d, [rax+164h]                                               ; +0x5f, 0x100324bef\ncall    GameStatsManager__sharedState                                  ; +0x66, 0x100324bf6\nmov     r15, rax                                                       ; +0x6b, 0x100324bfb\nlea     rdi, [rbp+var_40]                                              ; +0x6e, 0x100324bfe\nmov     rsi, r14                                                       ; +0x72, 0x100324c02\ncall    GJStoreItem__getCurrencyKey                                    ; +0x75, 0x100324c05\ntest    [rbp+var_40], 1                                                ; +0x7a, 0x100324c0a\njz      short loc_100324C16                                            ; +0x7e, 0x100324c0e\nmov     rsi, [rbp+__p]                                                 ; +0x80, 0x100324c10\njmp     short loc_100324C1A                                            ; +0x84, 0x100324c14\nlea     rsi, [rbp+var_3F]                                              ; +0x86, 0x100324c16\nmov     rdi, r15                                                       ; +0x8a, 0x100324c1a\ncall    GameStatsManager__getStat                                      ; +0x8d, 0x100324c1d\nmov     r15d, eax                                                      ; +0x92, 0x100324c22\nsub     r12d, r13d                                                     ; +0x95, 0x100324c25\ntest    [rbp+var_40], 1                                                ; +0x98, 0x100324c28\njz      short loc_100324C37                                            ; +0x9c, 0x100324c2c\nmov     rdi, [rbp+__p]; __p                                            ; +0x9e, 0x100324c2e\ncall    __ZdlPv; operator delete(void *)                               ; +0xa2, 0x100324c32\ncmp     r12d, r15d                                                     ; +0xa7, 0x100324c37\njle     short loc_100324C49                                            ; +0xaa, 0x100324c3a\nmov     rdi, rbx                                                       ; +0xac, 0x100324c3c\nmov     rsi, r14                                                       ; +0xaf, 0x100324c3f\ncall    GJShopLayer__showCantAffordMessage                             ; +0xb2, 0x100324c42\njmp     short loc_100324C6B                                            ; +0xb7, 0x100324c47\nmov     rdi, r14                                                       ; +0xb9, 0x100324c49\ncall    PurchaseItemPopup__create                                      ; +0xbc, 0x100324c4c\nadd     rbx, 198h                                                      ; +0xc1, 0x100324c51\nmov     [rax+280h], rbx                                                ; +0xc8, 0x100324c58\nmov     rcx, [rax]                                                     ; +0xcf, 0x100324c5f\nmov     rdi, rax                                                       ; +0xd2, 0x100324c62\ncall    qword ptr [rcx+508h]                                           ; +0xd5, 0x100324c65\nadd     rsp, 18h                                                       ; +0xdb, 0x100324c6b\npop     rbx                                                            ; +0xdf, 0x100324c6f\npop     r12                                                            ; +0xe0, 0x100324c70\npop     r13                                                            ; +0xe2, 0x100324c72\npop     r14                                                            ; +0xe4, 0x100324c74\npop     r15                                                            ; +0xe6, 0x100324c76\npop     rbp                                                            ; +0xe8, 0x100324c78\nretn                                                                   ; +0xe9, 0x100324c79", "xrefs": ["GJShopLayer::init @ 0x10032403f"], "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"}