{"type": "func", "start": 5371525936, "end": 5371526102, "name": "PurchaseItemPopup::onPurchase", "pseudocode": "// \n// PurchaseItemPopup::onPurchase from 0x1402afb30 to 0x1402afbd6 (166 bytes)\n// \n// 3 xrefs:\n// > PurchaseItemPopup::init @ 0x1402af53c\n// > <???> @ 0x1406d22a0\n// > <???> @ 0x1406d22ac\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=1\nvoid PurchaseItemPopup::onPurchase(PurchaseItemPopup *a1, cocos2d::CCObject *a2)\n{\n  int v3; // edi\n  GameStatsManager *v4; // rcx\n  GJPurchaseDelegate *m_delegate; // rcx\n  _BOOL8 v6; // rdx\n  void *v7; // [rsp+30h] [rbp+8h]\n\n  v3 = a1->m_storeItem->m_index.random - a1->m_storeItem->m_index.seed;\n  v4 = (GameStatsManager *)qword_1406C2EE8;\n  if ( !qword_1406C2EE8 )\n  {\n    v7 = operator new(0x3E0u);\n    qword_1406C2EE8 = sub_1401D0AE0((__int64)v7);\n    (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);\n    v4 = (GameStatsManager *)qword_1406C2EE8;\n  }\n  if ( GameStatsManager::purchaseItem(v4, v3) )\n  {\n    m_delegate = a1->m_delegate;\n    if ( m_delegate )\n      m_delegate->didPurchaseItem(m_delegate, a1->m_storeItem);\n  }\n  a1->setKeypadEnabled(a1, 0);\n  LOBYTE(v6) = 1;\n  a1->removeFromParentAndCleanup(a1, v6);\n}", "assembly": "; \n; PurchaseItemPopup::onPurchase from 0x1402afb30 to 0x1402afbd6 (166 bytes)\n; \n; 3 xrefs:\n; > PurchaseItemPopup::init @ 0x1402af53c\n; > <???> @ 0x1406d22a0\n; > <???> @ 0x1406d22ac\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_8], rbx                                               ; +0x0, 0x1402afb30\npush    rdi                                                            ; +0x5, 0x1402afb35\nsub     rsp, 20h                                                       ; +0x6, 0x1402afb36\nmov     rbx, rcx                                                       ; +0xa, 0x1402afb3a\nmov     rax, [rcx+278h]                                                ; +0xd, 0x1402afb3d\nmov     edi, [rax+140h]                                                ; +0x14, 0x1402afb44\nsub     edi, [rax+144h]                                                ; +0x1a, 0x1402afb4a\nmov     rcx, cs:qword_1406C2EE8                                        ; +0x20, 0x1402afb50\ntest    rcx, rcx                                                       ; +0x27, 0x1402afb57\njnz     short loc_1402AFB8C                                            ; +0x2a, 0x1402afb5a\nmov     ecx, 3E0h; Size                                                ; +0x2c, 0x1402afb5c\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x31, 0x1402afb61\nmov     [rsp+28h+arg_0], rax                                           ; +0x36, 0x1402afb66\nmov     rcx, rax                                                       ; +0x3b, 0x1402afb6b\ncall    sub_1401D0AE0                                                  ; +0x3e, 0x1402afb6e\nnop                                                                    ; +0x43, 0x1402afb73\nmov     cs:qword_1406C2EE8, rax                                        ; +0x44, 0x1402afb74\nmov     r8, [rax]                                                      ; +0x4b, 0x1402afb7b\nmov     rcx, rax                                                       ; +0x4e, 0x1402afb7e\ncall    qword ptr [r8+48h]                                             ; +0x51, 0x1402afb81\nmov     rcx, cs:qword_1406C2EE8                                        ; +0x55, 0x1402afb85\nmov     edx, edi                                                       ; +0x5c, 0x1402afb8c\ncall    GameStatsManager__purchaseItem                                 ; +0x5e, 0x1402afb8e\ntest    al, al                                                         ; +0x63, 0x1402afb93\njz      short loc_1402AFBAF                                            ; +0x65, 0x1402afb95\nmov     rcx, [rbx+280h]                                                ; +0x67, 0x1402afb97\ntest    rcx, rcx                                                       ; +0x6e, 0x1402afb9e\njz      short loc_1402AFBAF                                            ; +0x71, 0x1402afba1\nmov     rax, [rcx]                                                     ; +0x73, 0x1402afba3\nmov     rdx, [rbx+278h]                                                ; +0x76, 0x1402afba6\ncall    qword ptr [rax]                                                ; +0x7d, 0x1402afbad\nmov     rax, [rbx]                                                     ; +0x7f, 0x1402afbaf\nxor     edx, edx                                                       ; +0x82, 0x1402afbb2\nmov     rcx, rbx                                                       ; +0x84, 0x1402afbb4\ncall    qword ptr [rax+3D0h]                                           ; +0x87, 0x1402afbb7\nmov     rax, [rbx]                                                     ; +0x8d, 0x1402afbbd\nmov     dl, 1                                                          ; +0x90, 0x1402afbc0\nmov     rcx, rbx                                                       ; +0x92, 0x1402afbc2\nmov     rbx, [rsp+28h+arg_8]                                           ; +0x95, 0x1402afbc5\nadd     rsp, 20h                                                       ; +0x9a, 0x1402afbca\npop     rdi                                                            ; +0x9e, 0x1402afbce\njmp     qword ptr [rax+1F8h]                                           ; +0x9f, 0x1402afbcf", "xrefs": ["PurchaseItemPopup::init @ 0x1402af53c", "<???> @ 0x1406d22a0", "<???> @ 0x1406d22ac"], "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"}