{"type": "func", "start": 5374941584, "end": 5374942179, "name": "BrowseSmartKeyLayer::onButton", "pseudocode": "// \n// BrowseSmartKeyLayer::onButton from 0x1405f1990 to 0x1405f1be3 (595 bytes)\n// \n// 5 xrefs:\n// > BrowseSmartKeyLayer::init @ 0x1405f15b5\n// > BrowseSmartKeyLayer::init @ 0x1405f166a\n// > BrowseSmartKeyLayer::init @ 0x1405f171f\n// > BrowseSmartKeyLayer::init @ 0x1405f17d4\n// > <???> @ 0x14092f294\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 11:35:06 +0000\n// \n\n// Hidden C++ exception states: #wind=1\nunsigned int __fastcall BrowseSmartKeyLayer::onButton(__int64 *a1, __int64 a2)\n{\n  int v3; // eax\n  int v4; // eax\n  unsigned int result; // eax\n  cocos2d::CCArray *AllSelectedBlocks; // r12\n  unsigned int i; // ebp\n  struct cocos2d::CCObject *v8; // rsi\n  __int64 v9; // rdi\n  __int64 v10; // rbx\n  int v11; // eax\n  struct cocos2d::CCObject *PrefabWithID; // rax\n  cocos2d::CCArray *v13; // rbp\n  unsigned int j; // esi\n  __int64 v15; // rdx\n  __int64 v16; // r8\n  struct cocos2d::CCObject *v17; // rdi\n  __int64 v18; // rbx\n  int v19; // eax\n  __int64 v20; // rbx\n  cocos2d::CCNode *v21; // rax\n  char v22[16]; // [rsp+30h] [rbp-68h] BYREF\n  __int64 v23; // [rsp+40h] [rbp-58h]\n  __int64 v24; // [rsp+48h] [rbp-50h]\n  __int128 v25; // [rsp+50h] [rbp-48h] BYREF\n  __int64 v26; // [rsp+60h] [rbp-38h]\n  __int64 v27; // [rsp+68h] [rbp-30h]\n\n  v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2) - 1;\n  if ( v3 )\n  {\n    v4 = v3 - 1;\n    if ( v4 )\n    {\n      result = v4 - 1;\n      if ( result )\n      {\n        if ( result == 1 )\n          return BrowseSmartKeyLayer::addChanceToSelected(a1, 10, 0);\n      }\n      else\n      {\n        AllSelectedBlocks = (cocos2d::CCArray *)BrowseSmartKeyLayer::getAllSelectedBlocks(a1);\n        for ( i = 0; i < cocos2d::CCArray::count(AllSelectedBlocks); ++i )\n        {\n          v8 = cocos2d::CCArray::objectAtIndex(AllSelectedBlocks, i);\n          v9 = sub_14003F4F0((__int64)&v25, (__int64)(a1 + 89));\n          v10 = a1[83];\n          v11 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v8 + 56LL))(v8);\n          PrefabWithID = GJSmartTemplate::getPrefabWithID(v10, v9, v11);\n          if ( PrefabWithID )\n            *((_DWORD *)PrefabWithID + 31) = 0;\n        }\n        return BrowseSmartKeyLayer::updateChanceValues(a1);\n      }\n    }\n    else\n    {\n      return BrowseSmartKeyLayer::deletedSelectedItems(a1);\n    }\n  }\n  else\n  {\n    v13 = (cocos2d::CCArray *)BrowseSmartKeyLayer::getAllSelectedBlocks(a1);\n    result = cocos2d::CCArray::count(v13);\n    if ( result )\n    {\n      for ( j = 0; j < cocos2d::CCArray::count(v13); ++j )\n      {\n        v17 = cocos2d::CCArray::objectAtIndex(v13, j);\n        v18 = sub_14003F4F0((__int64)&v25, (__int64)(a1 + 89));\n        v19 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v17 + 56LL))(v17);\n        BrowseSmartTemplateLayer::createPrefab((__int64)a1, v18, v19);\n      }\n      v25 = 0;\n      v26 = 0;\n      v27 = 15;\n      LOBYTE(v25) = 0;\n      v23 = 15;\n      v24 = 15;\n      strcpy(v22, \"Added to editor\");\n      v20 = *a1;\n      v21 = TextAlertPopup::create((__int64)v22, v15, v16, 150, (__int64)&v25);\n      return (*(__int64 (__fastcall **)(__int64 *, cocos2d::CCNode *, __int64))(v20 + 456))(a1, v21, 100);\n    }\n  }\n  return result;\n}", "assembly": "; \n; BrowseSmartKeyLayer::onButton from 0x1405f1990 to 0x1405f1be3 (595 bytes)\n; \n; 5 xrefs:\n; > BrowseSmartKeyLayer::init @ 0x1405f15b5\n; > BrowseSmartKeyLayer::init @ 0x1405f166a\n; > BrowseSmartKeyLayer::init @ 0x1405f171f\n; > BrowseSmartKeyLayer::init @ 0x1405f17d4\n; > <???> @ 0x14092f294\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 11:35:06 +0000\n; \nmov     [rsp+arg_0], rbx                                               ; +0x0, 0x1405f1990\nmov     [rsp+arg_10], rbp                                              ; +0x5, 0x1405f1995\nmov     [rsp+arg_18], rsi                                              ; +0xa, 0x1405f199a\npush    rdi                                                            ; +0xf, 0x1405f199f\npush    r12                                                            ; +0x10, 0x1405f19a0\npush    r13                                                            ; +0x12, 0x1405f19a2\npush    r14                                                            ; +0x14, 0x1405f19a4\npush    r15                                                            ; +0x16, 0x1405f19a6\nsub     rsp, 70h                                                       ; +0x18, 0x1405f19a8\nmov     r14, rcx                                                       ; +0x1c, 0x1405f19ac\nmov     rax, [rdx]                                                     ; +0x1f, 0x1405f19af\nmov     rcx, rdx                                                       ; +0x22, 0x1405f19b2\ncall    qword ptr [rax+38h]                                            ; +0x25, 0x1405f19b5\nsub     eax, 1                                                         ; +0x28, 0x1405f19b8\njz      loc_1405F1A8F                                                  ; +0x2b, 0x1405f19bb\nsub     eax, 1                                                         ; +0x31, 0x1405f19c1\njz      loc_1405F1A82                                                  ; +0x34, 0x1405f19c4\nsub     eax, 1                                                         ; +0x3a, 0x1405f19ca\njz      short loc_1405F19ED                                            ; +0x3d, 0x1405f19cd\ncmp     eax, 1                                                         ; +0x3f, 0x1405f19cf\njnz     loc_1405F1BC5                                                  ; +0x42, 0x1405f19d2\nxor     r8d, r8d                                                       ; +0x48, 0x1405f19d8\nmov     edx, 0Ah                                                       ; +0x4b, 0x1405f19db\nmov     rcx, r14                                                       ; +0x50, 0x1405f19e0\ncall    BrowseSmartKeyLayer__addChanceToSelected                       ; +0x53, 0x1405f19e3\njmp     loc_1405F1BC5                                                  ; +0x58, 0x1405f19e8\nmov     rcx, r14                                                       ; +0x5d, 0x1405f19ed\ncall    BrowseSmartKeyLayer__getAllSelectedBlocks                      ; +0x60, 0x1405f19f0\nmov     r12, rax                                                       ; +0x65, 0x1405f19f5\nxor     r15d, r15d                                                     ; +0x68, 0x1405f19f8\nmov     ebp, r15d                                                      ; +0x6b, 0x1405f19fb\nmov     rcx, rax                                                       ; +0x6e, 0x1405f19fe\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x71, 0x1405f1a01\ntest    eax, eax                                                       ; +0x77, 0x1405f1a07\njz      short loc_1405F1A75                                            ; +0x79, 0x1405f1a09\nnop     dword ptr [rax+rax+00h]                                        ; +0x7b, 0x1405f1a0b\nmov     edx, ebp                                                       ; +0x80, 0x1405f1a10\nmov     rcx, r12                                                       ; +0x82, 0x1405f1a12\ncall    cs:?objectAtIndex@CCArray@cocos2d@@QEAAPEAVCCObject@2@I@Z; cocos2d::CCArray::objectAtIndex(uint) ; +0x85, 0x1405f1a15\nmov     rsi, rax                                                       ; +0x8b, 0x1405f1a1b\nlea     rax, [rsp+98h+var_48]                                          ; +0x8e, 0x1405f1a1e\nmov     [rsp+98h+arg_8], rax                                           ; +0x93, 0x1405f1a23\nlea     rdx, [r14+2C8h]                                                ; +0x9b, 0x1405f1a2b\nlea     rcx, [rsp+98h+var_48]                                          ; +0xa2, 0x1405f1a32\ncall    sub_14003F4F0                                                  ; +0xa7, 0x1405f1a37\nmov     rdi, rax                                                       ; +0xac, 0x1405f1a3c\nmov     rbx, [r14+298h]                                                ; +0xaf, 0x1405f1a3f\nmov     rdx, [rsi]                                                     ; +0xb6, 0x1405f1a46\nmov     rcx, rsi                                                       ; +0xb9, 0x1405f1a49\ncall    qword ptr [rdx+38h]                                            ; +0xbc, 0x1405f1a4c\nmov     r8d, eax                                                       ; +0xbf, 0x1405f1a4f\nmov     rdx, rdi                                                       ; +0xc2, 0x1405f1a52\nmov     rcx, rbx                                                       ; +0xc5, 0x1405f1a55\ncall    GJSmartTemplate__getPrefabWithID                               ; +0xc8, 0x1405f1a58\ntest    rax, rax                                                       ; +0xcd, 0x1405f1a5d\njz      short loc_1405F1A66                                            ; +0xd0, 0x1405f1a60\nmov     [rax+7Ch], r15d                                                ; +0xd2, 0x1405f1a62\ninc     ebp                                                            ; +0xd6, 0x1405f1a66\nmov     rcx, r12                                                       ; +0xd8, 0x1405f1a68\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0xdb, 0x1405f1a6b\ncmp     ebp, eax                                                       ; +0xe1, 0x1405f1a71\njb      short loc_1405F1A10                                            ; +0xe3, 0x1405f1a73\nmov     rcx, r14                                                       ; +0xe5, 0x1405f1a75\ncall    BrowseSmartKeyLayer__updateChanceValues                        ; +0xe8, 0x1405f1a78\njmp     loc_1405F1BC5                                                  ; +0xed, 0x1405f1a7d\nmov     rcx, r14                                                       ; +0xf2, 0x1405f1a82\ncall    BrowseSmartKeyLayer__deletedSelectedItems                      ; +0xf5, 0x1405f1a85\njmp     loc_1405F1BC5                                                  ; +0xfa, 0x1405f1a8a\nmov     rcx, r14                                                       ; +0xff, 0x1405f1a8f\ncall    BrowseSmartKeyLayer__getAllSelectedBlocks                      ; +0x102, 0x1405f1a92\nmov     rbp, rax                                                       ; +0x107, 0x1405f1a97\nmov     rcx, rax                                                       ; +0x10a, 0x1405f1a9a\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x10d, 0x1405f1a9d\ntest    eax, eax                                                       ; +0x113, 0x1405f1aa3\njz      loc_1405F1BC5                                                  ; +0x115, 0x1405f1aa5\nxor     r15d, r15d                                                     ; +0x11b, 0x1405f1aab\nmov     esi, r15d                                                      ; +0x11e, 0x1405f1aae\nmov     rcx, rbp                                                       ; +0x121, 0x1405f1ab1\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x124, 0x1405f1ab4\ntest    eax, eax                                                       ; +0x12a, 0x1405f1aba\njz      short loc_1405F1B18                                            ; +0x12c, 0x1405f1abc\nxchg    ax, ax                                                         ; +0x12e, 0x1405f1abe\nmov     edx, esi                                                       ; +0x130, 0x1405f1ac0\nmov     rcx, rbp                                                       ; +0x132, 0x1405f1ac2\ncall    cs:?objectAtIndex@CCArray@cocos2d@@QEAAPEAVCCObject@2@I@Z; cocos2d::CCArray::objectAtIndex(uint) ; +0x135, 0x1405f1ac5\nmov     rdi, rax                                                       ; +0x13b, 0x1405f1acb\nlea     rax, [rsp+98h+var_48]                                          ; +0x13e, 0x1405f1ace\nmov     [rsp+98h+arg_8], rax                                           ; +0x143, 0x1405f1ad3\nlea     rdx, [r14+2C8h]                                                ; +0x14b, 0x1405f1adb\nlea     rcx, [rsp+98h+var_48]                                          ; +0x152, 0x1405f1ae2\ncall    sub_14003F4F0                                                  ; +0x157, 0x1405f1ae7\nmov     rbx, rax                                                       ; +0x15c, 0x1405f1aec\nmov     rcx, [rdi]                                                     ; +0x15f, 0x1405f1aef\nmov     rdx, [rcx+38h]                                                 ; +0x162, 0x1405f1af2\nmov     rcx, rdi                                                       ; +0x166, 0x1405f1af6\ncall    rdx                                                            ; +0x169, 0x1405f1af9\nmov     r8d, eax                                                       ; +0x16b, 0x1405f1afb\nmov     rdx, rbx                                                       ; +0x16e, 0x1405f1afe\nmov     rcx, r14                                                       ; +0x171, 0x1405f1b01\ncall    BrowseSmartTemplateLayer__createPrefab                         ; +0x174, 0x1405f1b04\ninc     esi                                                            ; +0x179, 0x1405f1b09\nmov     rcx, rbp                                                       ; +0x17b, 0x1405f1b0b\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x17e, 0x1405f1b0e\ncmp     esi, eax                                                       ; +0x184, 0x1405f1b14\njb      short loc_1405F1AC0                                            ; +0x186, 0x1405f1b16\nlea     rax, [rsp+98h+var_48]                                          ; +0x188, 0x1405f1b18\nmov     [rsp+98h+arg_8], rax                                           ; +0x18d, 0x1405f1b1d\nxorps   xmm0, xmm0                                                     ; +0x195, 0x1405f1b25\nmovups  [rsp+98h+var_48], xmm0                                         ; +0x198, 0x1405f1b28\nmov     [rsp+98h+var_38], r15                                          ; +0x19d, 0x1405f1b2d\nmov     [rsp+98h+var_30], 0Fh                                          ; +0x1a2, 0x1405f1b32\nmov     byte ptr [rsp+98h+var_48], 0                                   ; +0x1ab, 0x1405f1b3b\nmov     [rsp+98h+var_58], 0Fh                                          ; +0x1b0, 0x1405f1b40\nmov     [rsp+98h+var_50], 0Fh                                          ; +0x1b9, 0x1405f1b49\nmovsd   xmm0, cs:qword_140802A10                                       ; +0x1c2, 0x1405f1b52\nmovsd   qword ptr [rsp+98h+var_68], xmm0                               ; +0x1ca, 0x1405f1b5a\nmov     eax, cs:dword_140802A18                                        ; +0x1d0, 0x1405f1b60\nmov     dword ptr [rsp+98h+var_68+8], eax                              ; +0x1d6, 0x1405f1b66\nmovzx   eax, cs:word_140802A1C                                         ; +0x1da, 0x1405f1b6a\nmov     word ptr [rsp+98h+var_68+0Ch], ax                              ; +0x1e1, 0x1405f1b71\nmovzx   eax, cs:byte_140802A1E                                         ; +0x1e6, 0x1405f1b76\nmov     [rsp+98h+var_68+0Eh], al                                       ; +0x1ed, 0x1405f1b7d\nmov     [rsp+98h+var_68+0Fh], 0                                        ; +0x1f1, 0x1405f1b81\nmov     rbx, [r14]                                                     ; +0x1f6, 0x1405f1b86\nlea     rax, [rsp+98h+var_48]                                          ; +0x1f9, 0x1405f1b89\nmov     [rsp+98h+var_78], rax                                          ; +0x1fe, 0x1405f1b8e\nmov     r9d, 96h                                                       ; +0x203, 0x1405f1b93\nmovss   xmm2, cs:dword_140834F64                                       ; +0x209, 0x1405f1b99\nmovss   xmm1, cs:dword_140834F20                                       ; +0x211, 0x1405f1ba1\nlea     rcx, [rsp+98h+var_68]                                          ; +0x219, 0x1405f1ba9\ncall    TextAlertPopup__create                                         ; +0x21e, 0x1405f1bae\nmov     rdx, rax                                                       ; +0x223, 0x1405f1bb3\nmov     r8d, 64h ; 'd'                                                 ; +0x226, 0x1405f1bb6\nmov     rcx, r14                                                       ; +0x22c, 0x1405f1bbc\ncall    qword ptr [rbx+1C8h]                                           ; +0x22f, 0x1405f1bbf\nlea     r11, [rsp+98h+var_28]                                          ; +0x235, 0x1405f1bc5\nmov     rbx, [r11+30h]                                                 ; +0x23a, 0x1405f1bca\nmov     rbp, [r11+40h]                                                 ; +0x23e, 0x1405f1bce\nmov     rsi, [r11+48h]                                                 ; +0x242, 0x1405f1bd2\nmov     rsp, r11                                                       ; +0x246, 0x1405f1bd6\npop     r15                                                            ; +0x249, 0x1405f1bd9\npop     r14                                                            ; +0x24b, 0x1405f1bdb\npop     r13                                                            ; +0x24d, 0x1405f1bdd\npop     r12                                                            ; +0x24f, 0x1405f1bdf\npop     rdi                                                            ; +0x251, 0x1405f1be1\nretn                                                                   ; +0x252, 0x1405f1be2", "xrefs": ["BrowseSmartKeyLayer::init @ 0x1405f15b5", "BrowseSmartKeyLayer::init @ 0x1405f166a", "BrowseSmartKeyLayer::init @ 0x1405f171f", "BrowseSmartKeyLayer::init @ 0x1405f17d4", "<???> @ 0x14092f294"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}