{"type": "func", "start": 5371295760, "end": 5371296245, "name": "GJGarageLayer::onToggleItem", "pseudocode": "// \n// GJGarageLayer::onToggleItem from 0x140277810 to 0x1402779f5 (485 bytes)\n// \n// 4 xrefs:\n// > GJGarageLayer::setupSpecialPage @ 0x140276e34\n// > GJGarageLayer::setupSpecialPage @ 0x140276f87\n// > GJGarageLayer::setupSpecialPage @ 0x140277112\n// > <???> @ 0x1406d0fb0\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=5\nvoid GJGarageLayer::onToggleItem(GJGarageLayer *a1, cocos2d::CCObject *a2)\n{\n  GameManager *v4; // rcx\n  int v5; // edi\n  IconType m_uID; // ebx\n  UnlockType v7; // esi\n  GameManager *v8; // r9\n  GameStatsManager *v9; // rcx\n  __int64 v10; // rbx\n  __int64 v11; // rcx\n  bool v12; // bl\n  cocos2d::CCString *v13; // rax\n  bool v14; // bl\n  GameStatsManager *v15; // rcx\n  GJItemIcon *v16; // rax\n  void *v17; // [rsp+20h] [rbp-48h]\n  void *v18; // [rsp+20h] [rbp-48h]\n  void *v19; // [rsp+20h] [rbp-48h]\n  void *v20; // [rsp+20h] [rbp-48h]\n  _QWORD v21[4]; // [rsp+28h] [rbp-40h] BYREF\n\n  v5 = a2->getTag(a2);\n  m_uID = a2[9].m_uID;\n  if ( !qword_1406C2ED8 )\n  {\n    v17 = operator new(0x668u);\n    qword_1406C2ED8 = sub_14017AB00((__int64)v17);\n    (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);\n  }\n  v7 = GameManager::iconTypeToUnlockType(v4, m_uID);\n  if ( !v8 )\n  {\n    v18 = operator new(0x668u);\n    qword_1406C2ED8 = sub_14017AB00((__int64)v18);\n    (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);\n    v8 = (GameManager *)qword_1406C2ED8;\n  }\n  if ( GameManager::isIconUnlocked(v8, v5, m_uID) )\n  {\n    v10 = qword_1406C2EE8;\n    if ( !qword_1406C2EE8 )\n    {\n      v19 = operator new(0x3E0u);\n      qword_1406C2EE8 = sub_1401D0AE0((__int64)v19);\n      (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);\n      v10 = qword_1406C2EE8;\n    }\n    if ( GameStatsManager::isItemUnlocked(v9, v7, v5) )\n    {\n      GameStatsManager::getItemKey(v11, v21, v5, v7);\n      v13 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v10 + 888), v21);\n      v12 = cocos2d::CCString::boolValue(v13);\n      sub_14003A830((__int64)v21);\n    }\n    else\n    {\n      v12 = 0;\n    }\n    v14 = !v12;\n    v15 = (GameStatsManager *)qword_1406C2EE8;\n    if ( !qword_1406C2EE8 )\n    {\n      v20 = operator new(0x3E0u);\n      qword_1406C2EE8 = sub_1401D0AE0((__int64)v20);\n      (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);\n      v15 = (GameStatsManager *)qword_1406C2EE8;\n    }\n    GameStatsManager::toggleEnableItem(v15, v7, v5, v14);\n    v16 = (GJItemIcon *)((__int64 (__fastcall *)(cocos2d::CCObject *))a2->__vftable[13].copyWithZone)(a2);\n    GJItemIcon::toggleEnabledState(v16, v14);\n  }\n  else\n  {\n    a1->showUnlockPopup(&a1->CharacterColorDelegate, v5, v7);\n  }\n}", "assembly": "; \n; GJGarageLayer::onToggleItem from 0x140277810 to 0x1402779f5 (485 bytes)\n; \n; 4 xrefs:\n; > GJGarageLayer::setupSpecialPage @ 0x140276e34\n; > GJGarageLayer::setupSpecialPage @ 0x140276f87\n; > GJGarageLayer::setupSpecialPage @ 0x140277112\n; > <???> @ 0x1406d0fb0\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, 0x140277810\nmov     [rsp+arg_18], rbp                                              ; +0x5, 0x140277815\npush    rsi                                                            ; +0xa, 0x14027781a\npush    rdi                                                            ; +0xb, 0x14027781b\npush    r14                                                            ; +0xc, 0x14027781c\nsub     rsp, 50h                                                       ; +0xe, 0x14027781e\nmov     rax, cs:__security_cookie                                      ; +0x12, 0x140277822\nxor     rax, rsp                                                       ; +0x19, 0x140277829\nmov     [rsp+68h+var_20], rax                                          ; +0x1c, 0x14027782c\nmov     r14, rdx                                                       ; +0x21, 0x140277831\nmov     rbp, rcx                                                       ; +0x24, 0x140277834\nmov     rax, [rdx]                                                     ; +0x27, 0x140277837\nmov     rcx, rdx                                                       ; +0x2a, 0x14027783a\ncall    qword ptr [rax+38h]                                            ; +0x2d, 0x14027783d\nmov     edi, eax                                                       ; +0x30, 0x140277840\nmov     ebx, [r14+200h]                                                ; +0x32, 0x140277842\nmov     r9, cs:qword_1406C2ED8                                         ; +0x39, 0x140277849\ntest    r9, r9                                                         ; +0x40, 0x140277850\njnz     short loc_140277884                                            ; +0x43, 0x140277853\nmov     ecx, 668h; Size                                                ; +0x45, 0x140277855\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x4a, 0x14027785a\nmov     [rsp+68h+var_48], rax                                          ; +0x4f, 0x14027785f\nmov     rcx, rax                                                       ; +0x54, 0x140277864\ncall    sub_14017AB00                                                  ; +0x57, 0x140277867\nnop                                                                    ; +0x5c, 0x14027786c\nmov     cs:qword_1406C2ED8, rax                                        ; +0x5d, 0x14027786d\nmov     rdx, [rax]                                                     ; +0x64, 0x140277874\nmov     rcx, rax                                                       ; +0x67, 0x140277877\ncall    qword ptr [rdx+48h]                                            ; +0x6a, 0x14027787a\nmov     r9, cs:qword_1406C2ED8                                         ; +0x6d, 0x14027787d\nmov     edx, ebx                                                       ; +0x74, 0x140277884\ncall    GameManager__iconTypeToUnlockType                              ; +0x76, 0x140277886\nmov     esi, eax                                                       ; +0x7b, 0x14027788b\ntest    r9, r9                                                         ; +0x7d, 0x14027788d\njnz     short loc_1402778C1                                            ; +0x80, 0x140277890\nmov     ecx, 668h; Size                                                ; +0x82, 0x140277892\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x87, 0x140277897\nmov     [rsp+68h+var_48], rax                                          ; +0x8c, 0x14027789c\nmov     rcx, rax                                                       ; +0x91, 0x1402778a1\ncall    sub_14017AB00                                                  ; +0x94, 0x1402778a4\nnop                                                                    ; +0x99, 0x1402778a9\nmov     cs:qword_1406C2ED8, rax                                        ; +0x9a, 0x1402778aa\nmov     rdx, [rax]                                                     ; +0xa1, 0x1402778b1\nmov     rcx, rax                                                       ; +0xa4, 0x1402778b4\ncall    qword ptr [rdx+48h]                                            ; +0xa7, 0x1402778b7\nmov     r9, cs:qword_1406C2ED8                                         ; +0xaa, 0x1402778ba\nmov     r8d, ebx                                                       ; +0xb1, 0x1402778c1\nmov     edx, edi                                                       ; +0xb4, 0x1402778c4\nmov     rcx, r9                                                        ; +0xb6, 0x1402778c6\ncall    GameManager__isIconUnlocked                                    ; +0xb9, 0x1402778c9\ntest    al, al                                                         ; +0xbe, 0x1402778ce\njnz     short loc_1402778E9                                            ; +0xc0, 0x1402778d0\nlea     rcx, [rbp+1C0h]                                                ; +0xc2, 0x1402778d2\nmov     rax, [rcx]                                                     ; +0xc9, 0x1402778d9\nmov     r8d, esi                                                       ; +0xcc, 0x1402778dc\nmov     edx, edi                                                       ; +0xcf, 0x1402778df\ncall    qword ptr [rax+8]                                              ; +0xd1, 0x1402778e1\njmp     loc_1402779D3                                                  ; +0xd4, 0x1402778e4\nmov     rbx, cs:qword_1406C2EE8                                        ; +0xd9, 0x1402778e9\ntest    rbx, rbx                                                       ; +0xe0, 0x1402778f0\njnz     short loc_140277924                                            ; +0xe3, 0x1402778f3\nmov     ecx, 3E0h; Size                                                ; +0xe5, 0x1402778f5\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0xea, 0x1402778fa\nmov     [rsp+68h+var_48], rax                                          ; +0xef, 0x1402778ff\nmov     rcx, rax                                                       ; +0xf4, 0x140277904\ncall    sub_1401D0AE0                                                  ; +0xf7, 0x140277907\nnop                                                                    ; +0xfc, 0x14027790c\nmov     cs:qword_1406C2EE8, rax                                        ; +0xfd, 0x14027790d\nmov     rdx, [rax]                                                     ; +0x104, 0x140277914\nmov     rcx, rax                                                       ; +0x107, 0x140277917\ncall    qword ptr [rdx+48h]                                            ; +0x10a, 0x14027791a\nmov     rbx, cs:qword_1406C2EE8                                        ; +0x10d, 0x14027791d\nmov     r8d, edi                                                       ; +0x114, 0x140277924\nmov     edx, esi                                                       ; +0x117, 0x140277927\ncall    GameStatsManager__isItemUnlocked                               ; +0x119, 0x140277929\ntest    al, al                                                         ; +0x11e, 0x14027792e\njnz     short loc_140277936                                            ; +0x120, 0x140277930\nxor     bl, bl                                                         ; +0x122, 0x140277932\njmp     short loc_14027796F                                            ; +0x124, 0x140277934\nmov     r9d, esi                                                       ; +0x126, 0x140277936\nmov     r8d, edi                                                       ; +0x129, 0x140277939\nlea     rdx, [rsp+68h+var_40]                                          ; +0x12c, 0x14027793c\ncall    GameStatsManager__getItemKey                                   ; +0x131, 0x140277941\nnop                                                                    ; +0x136, 0x140277946\nlea     rdx, [rsp+68h+var_40]                                          ; +0x137, 0x140277947\nmov     rcx, [rbx+378h]                                                ; +0x13c, 0x14027794c\ncall    cs:?valueForKey@CCDictionary@cocos2d@@QEAAPEBVCCString@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z; cocos2d::CCDictionary::valueForKey(std::string const &) ; +0x143, 0x140277953\nmov     rcx, rax                                                       ; +0x149, 0x140277959\ncall    cs:?boolValue@CCString@cocos2d@@QEBA_NXZ; cocos2d::CCString::boolValue(void) ; +0x14c, 0x14027795c\nmovzx   ebx, al                                                        ; +0x152, 0x140277962\nlea     rcx, [rsp+68h+var_40]                                          ; +0x155, 0x140277965\ncall    sub_14003A830                                                  ; +0x15a, 0x14027796a\nxor     bl, 1                                                          ; +0x15f, 0x14027796f\nmov     rcx, cs:qword_1406C2EE8                                        ; +0x162, 0x140277972\ntest    rcx, rcx                                                       ; +0x169, 0x140277979\njnz     short loc_1402779AE                                            ; +0x16c, 0x14027797c\nmov     ecx, 3E0h; Size                                                ; +0x16e, 0x14027797e\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x173, 0x140277983\nmov     [rsp+68h+var_48], rax                                          ; +0x178, 0x140277988\nmov     rcx, rax                                                       ; +0x17d, 0x14027798d\ncall    sub_1401D0AE0                                                  ; +0x180, 0x140277990\nnop                                                                    ; +0x185, 0x140277995\nmov     cs:qword_1406C2EE8, rax                                        ; +0x186, 0x140277996\nmov     r8, [rax]                                                      ; +0x18d, 0x14027799d\nmov     rcx, rax                                                       ; +0x190, 0x1402779a0\ncall    qword ptr [r8+48h]                                             ; +0x193, 0x1402779a3\nmov     rcx, cs:qword_1406C2EE8                                        ; +0x197, 0x1402779a7\nmovzx   r9d, bl                                                        ; +0x19e, 0x1402779ae\nmov     r8d, edi                                                       ; +0x1a2, 0x1402779b2\nmov     edx, esi                                                       ; +0x1a5, 0x1402779b5\ncall    GameStatsManager__toggleEnableItem                             ; +0x1a7, 0x1402779b7\nmov     rax, [r14]                                                     ; +0x1ac, 0x1402779bc\nmov     rcx, r14                                                       ; +0x1af, 0x1402779bf\ncall    qword ptr [rax+3A8h]                                           ; +0x1b2, 0x1402779c2\nmovzx   edx, bl                                                        ; +0x1b8, 0x1402779c8\nmov     rcx, rax                                                       ; +0x1bb, 0x1402779cb\ncall    GJItemIcon__toggleEnabledState                                 ; +0x1be, 0x1402779ce\nmov     rcx, [rsp+68h+var_20]                                          ; +0x1c3, 0x1402779d3\nxor     rcx, rsp; StackCookie                                          ; +0x1c8, 0x1402779d8\ncall    __security_check_cookie                                        ; +0x1cb, 0x1402779db\nlea     r11, [rsp+68h+var_18]                                          ; +0x1d0, 0x1402779e0\nmov     rbx, [r11+30h]                                                 ; +0x1d5, 0x1402779e5\nmov     rbp, [r11+38h]                                                 ; +0x1d9, 0x1402779e9\nmov     rsp, r11                                                       ; +0x1dd, 0x1402779ed\npop     r14                                                            ; +0x1e0, 0x1402779f0\npop     rdi                                                            ; +0x1e2, 0x1402779f2\npop     rsi                                                            ; +0x1e3, 0x1402779f3\nretn                                                                   ; +0x1e4, 0x1402779f4", "xrefs": ["GJGarageLayer::setupSpecialPage @ 0x140276e34", "GJGarageLayer::setupSpecialPage @ 0x140276f87", "GJGarageLayer::setupSpecialPage @ 0x140277112", "<???> @ 0x1406d0fb0"], "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"}