{"type": "func", "start": 5728284, "end": 5728788, "name": "CCMenuItemToggler::init", "pseudocode": "// \n// CCMenuItemToggler::init from 0x57681c to 0x576a14 (504 bytes)\n// \n// 2 xrefs:\n// > CCMenuItemToggler::create @ 0x576aac\n// > <???> @ 0x2b740\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\nbool CCMenuItemToggler::init(\n        CCMenuItemToggler *a1,\n        cocos2d::CCNode *a2,\n        cocos2d::CCNode *a3,\n        cocos2d::CCObject *a4,\n        cocos2d::SEL_MenuHandler a5)\n{\n  bool v8; // w22\n  cocos2d::CCNode *v9; // x23\n  void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24\n  cocos2d::CCNode *v11; // x23\n  void (__fastcall *v12)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24\n  cocos2d::CCNode *v13; // x24\n  void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25\n  cocos2d::CCNode *v15; // x24\n  void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23\n  cocos2d::CCPoint v18; // [xsp+50h] [xbp+50h] BYREF\n  cocos2d::CCPoint v19; // 0:kr00_8.8\n  cocos2d::CCPoint v20; // 0:kr08_8.8\n  cocos2d::SEL_MenuHandler v21; // 0:x2.16\n  cocos2d::SEL_MenuHandler v22; // 0:x2.16\n\n  v8 = cocos2d::CCMenuItem::initWithTarget(a1, a4, a5);\n  if ( v8 )\n  {\n    v21.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;\n    v21.adj = (size_t)CCMenuItemToggler::normalTouch;\n    a1->m_offButton = CCMenuItemSpriteExtra::create(a2, nullptr, v21);\n    v22.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;\n    v22.adj = (size_t)CCMenuItemToggler::selectedTouch;\n    a1->m_onButton = CCMenuItemSpriteExtra::create(a3, nullptr, v22);\n    a1->addChild(a1, a1->m_offButton);\n    a1->addChild(a1, a1->m_onButton);\n    v9 = a1->m_offButton->getNormalImage(a1->m_offButton);\n    setAnchorPoint = v9->setAnchorPoint;\n    cocos2d::CCPoint::CCPoint(&v18, 0.5, 0.5);\n    setAnchorPoint(v9, &v18);\n    v11 = a1->m_onButton->getNormalImage(a1->m_onButton);\n    v12 = v11->setAnchorPoint;\n    cocos2d::CCPoint::CCPoint(&v18, 0.5, 0.5);\n    v12(v11, &v18);\n    v13 = a1->m_offButton->getNormalImage(a1->m_offButton);\n    setPosition = v13->setPosition;\n    v19 = cocos2d::CCNode::convertToNodeSpace(a1->m_offButton, &stru_1241648);\n    ((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCPoint *, float, float))setPosition)(v13, &v18, v19.x, v19.y);\n    v15 = a1->m_onButton->getNormalImage(a1->m_onButton);\n    v16 = v15->setPosition;\n    v20 = cocos2d::CCNode::convertToNodeSpace(a1->m_onButton, &stru_1241648);\n    ((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCPoint *, float, float))v16)(v15, &v18, v20.x, v20.y);\n    a1->m_notClickable = 0;\n    CCMenuItemToggler::toggle(a1, 0);\n  }\n  return v8;\n}", "assembly": "; \n; CCMenuItemToggler::init from 0x57681c to 0x576a14 (504 bytes)\n; \n; 2 xrefs:\n; > CCMenuItemToggler::create @ 0x576aac\n; > <???> @ 0x2b740\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\nSTP             X29, X30, [SP,#var_60]!                                ; +0x0, 0x57681c\nMOV             X29, SP                                                ; +0x4, 0x576820\nSTP             X19, X20, [SP,#0x60+var_50]                            ; +0x8, 0x576824\nADRP            X20, #__stack_chk_guard_ptr@PAGE                       ; +0xc, 0x576828\nSTR             X25, [SP,#0x60+var_20]                                 ; +0x10, 0x57682c\nSTP             X23, X24, [SP,#0x60+var_30]                            ; +0x14, 0x576830\nMOV             X23, X2                                                ; +0x18, 0x576834\nMOV             X2, X4                                                 ; +0x1c, 0x576838\nLDR             X4, [X20,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x20, 0x57683c\nMOV             X19, X0                                                ; +0x24, 0x576840\nSTP             X21, X22, [SP,#0x60+var_40]                            ; +0x28, 0x576844\nMOV             X21, X1                                                ; +0x2c, 0x576848\nMOV             X1, X3                                                 ; +0x30, 0x57684c\nLDR             X4, [X4]                                               ; +0x34, 0x576850\nMOV             X3, X5                                                 ; +0x38, 0x576854\nSTR             X4, [X29,#0x60+var_8]                                  ; +0x3c, 0x576858\nBL              _ZN7cocos2d10CCMenuItem14initWithTargetEPNS_8CCObjectEMS1_FvS2_E; cocos2d::CCMenuItem::initWithTarget(cocos2d::CCObject *,void (cocos2d::CCObject::*)(cocos2d::CCObject *)) ; +0x40, 0x57685c\nUXTB            W0, W0                                                 ; +0x44, 0x576860\nMOV             W22, W0                                                ; +0x48, 0x576864\nCBZ             W0, loc_5769E0                                         ; +0x4c, 0x576868\nADRP            X3, #_ZN17CCMenuItemToggler11normalTouchEPN7cocos2d8CCObjectE_ptr@PAGE ; +0x50, 0x57686c\nMOV             X1, #0                                                 ; +0x54, 0x576870\nMOV             X2, X19                                                ; +0x58, 0x576874\nMOV             X4, #0                                                 ; +0x5c, 0x576878\nMOV             X0, X21                                                ; +0x60, 0x57687c\nADD             X21, X29, #0x60+var_10                                 ; +0x64, 0x576880\nLDR             X3, [X3,#_ZN17CCMenuItemToggler11normalTouchEPN7cocos2d8CCObjectE_ptr@PAGEOFF]; CCMenuItemToggler::normalTouch(cocos2d::CCObject *) ... ; +0x68, 0x576884\nBL              _ZN21CCMenuItemSpriteExtra6createEPN7cocos2d6CCNodeES2_PNS0_8CCObjectEMS3_FvS4_E; CCMenuItemSpriteExtra::create(cocos2d::CCNode *,cocos2d::CCNode *,cocos2d::CCObject *,void (cocos2d::CCObject::*)(cocos2d::CCObject *)) ; +0x6c, 0x576888\nSTR             X0, [X19,#0x178]                                       ; +0x70, 0x57688c\nADRP            X3, #_ZN17CCMenuItemToggler13selectedTouchEPN7cocos2d8CCObjectE_ptr@PAGE ; +0x74, 0x576890\nMOV             X4, #0                                                 ; +0x78, 0x576894\nMOV             X2, X19                                                ; +0x7c, 0x576898\nMOV             X1, #0                                                 ; +0x80, 0x57689c\nMOV             X0, X23                                                ; +0x84, 0x5768a0\nLDR             X3, [X3,#_ZN17CCMenuItemToggler13selectedTouchEPN7cocos2d8CCObjectE_ptr@PAGEOFF]; CCMenuItemToggler::selectedTouch(cocos2d::CCObject *) ... ; +0x88, 0x5768a4\nBL              _ZN21CCMenuItemSpriteExtra6createEPN7cocos2d6CCNodeES2_PNS0_8CCObjectEMS3_FvS4_E; CCMenuItemSpriteExtra::create(cocos2d::CCNode *,cocos2d::CCNode *,cocos2d::CCObject *,void (cocos2d::CCObject::*)(cocos2d::CCObject *)) ; +0x8c, 0x5768a8\nSTR             X0, [X19,#0x180]                                       ; +0x90, 0x5768ac\nLDR             X2, [X19]                                              ; +0x94, 0x5768b0\nMOV             X0, X19                                                ; +0x98, 0x5768b4\nLDR             X1, [X19,#0x178]                                       ; +0x9c, 0x5768b8\nLDR             X2, [X2,#0x1B8]                                        ; +0xa0, 0x5768bc\nBLR             X2                                                     ; +0xa4, 0x5768c0\nLDR             X2, [X19]                                              ; +0xa8, 0x5768c4\nMOV             X0, X19                                                ; +0xac, 0x5768c8\nLDR             X1, [X19,#0x180]                                       ; +0xb0, 0x5768cc\nLDR             X2, [X2,#0x1B8]                                        ; +0xb4, 0x5768d0\nBLR             X2                                                     ; +0xb8, 0x5768d4\nLDR             X1, [X19,#0x178]                                       ; +0xbc, 0x5768d8\nMOV             X0, X1                                                 ; +0xc0, 0x5768dc\nLDR             X1, [X1]                                               ; +0xc4, 0x5768e0\nLDR             X1, [X1,#0x420]                                        ; +0xc8, 0x5768e4\nBLR             X1                                                     ; +0xcc, 0x5768e8\nMOV             X23, X0                                                ; +0xd0, 0x5768ec\nFMOV            S0, #0.5; float                                        ; +0xd4, 0x5768f0\nMOV             X0, X21; this                                          ; +0xd8, 0x5768f4\nFMOV            S1, S0; float                                          ; +0xdc, 0x5768f8\nLDR             X1, [X23]                                              ; +0xe0, 0x5768fc\nLDR             X24, [X1,#0x118]                                       ; +0xe4, 0x576900\nBL              _ZN7cocos2d7CCPointC1Eff; cocos2d::CCPoint::CCPoint(float,float) ; +0xe8, 0x576904\nMOV             X0, X23                                                ; +0xec, 0x576908\nMOV             X1, X21                                                ; +0xf0, 0x57690c\nBLR             X24                                                    ; +0xf4, 0x576910\nLDR             X1, [X19,#0x180]                                       ; +0xf8, 0x576914\nMOV             X0, X1                                                 ; +0xfc, 0x576918\nLDR             X1, [X1]                                               ; +0x100, 0x57691c\nLDR             X1, [X1,#0x420]                                        ; +0x104, 0x576920\nBLR             X1                                                     ; +0x108, 0x576924\nMOV             X23, X0                                                ; +0x10c, 0x576928\nFMOV            S0, #0.5; float                                        ; +0x110, 0x57692c\nMOV             X0, X21; this                                          ; +0x114, 0x576930\nFMOV            S1, S0; float                                          ; +0x118, 0x576934\nLDR             X1, [X23]                                              ; +0x11c, 0x576938\nLDR             X24, [X1,#0x118]                                       ; +0x120, 0x57693c\nBL              _ZN7cocos2d7CCPointC1Eff; cocos2d::CCPoint::CCPoint(float,float) ; +0x124, 0x576940\nMOV             X0, X23                                                ; +0x128, 0x576944\nMOV             X1, X21                                                ; +0x12c, 0x576948\nADRP            X23, #stru_1241648@PAGE                                ; +0x130, 0x57694c\nBLR             X24                                                    ; +0x134, 0x576950\nADD             X23, X23, #stru_1241648@PAGEOFF                        ; +0x138, 0x576954\nLDR             X1, [X19,#0x178]                                       ; +0x13c, 0x576958\nMOV             X0, X1                                                 ; +0x140, 0x57695c\nLDR             X1, [X1]                                               ; +0x144, 0x576960\nLDR             X1, [X1,#0x420]                                        ; +0x148, 0x576964\nBLR             X1                                                     ; +0x14c, 0x576968\nMOV             X24, X0                                                ; +0x150, 0x57696c\nLDR             X0, [X19,#0x178]; this                                 ; +0x154, 0x576970\nMOV             X8, X21                                                ; +0x158, 0x576974\nMOV             X1, X23; cocos2d::CCPoint *                            ; +0x15c, 0x576978\nLDR             X2, [X24]                                              ; +0x160, 0x57697c\nLDR             X25, [X2,#0xB8]                                        ; +0x164, 0x576980\nBL              _ZN7cocos2d6CCNode18convertToNodeSpaceERKNS_7CCPointE; cocos2d::CCNode::convertToNodeSpace(cocos2d::CCPoint const&) ; +0x168, 0x576984\nMOV             X0, X24                                                ; +0x16c, 0x576988\nMOV             X1, X21                                                ; +0x170, 0x57698c\nBLR             X25                                                    ; +0x174, 0x576990\nLDR             X1, [X19,#0x180]                                       ; +0x178, 0x576994\nMOV             X0, X1                                                 ; +0x17c, 0x576998\nLDR             X1, [X1]                                               ; +0x180, 0x57699c\nLDR             X1, [X1,#0x420]                                        ; +0x184, 0x5769a0\nBLR             X1                                                     ; +0x188, 0x5769a4\nMOV             X24, X0                                                ; +0x18c, 0x5769a8\nLDR             X0, [X19,#0x180]; this                                 ; +0x190, 0x5769ac\nMOV             X1, X23; cocos2d::CCPoint *                            ; +0x194, 0x5769b0\nMOV             X8, X21                                                ; +0x198, 0x5769b4\nLDR             X2, [X24]                                              ; +0x19c, 0x5769b8\nLDR             X23, [X2,#0xB8]                                        ; +0x1a0, 0x5769bc\nBL              _ZN7cocos2d6CCNode18convertToNodeSpaceERKNS_7CCPointE; cocos2d::CCNode::convertToNodeSpace(cocos2d::CCPoint const&) ; +0x1a4, 0x5769c0\nMOV             X0, X24                                                ; +0x1a8, 0x5769c4\nMOV             X1, X21                                                ; +0x1ac, 0x5769c8\nBLR             X23                                                    ; +0x1b0, 0x5769cc\nSTRB            WZR, [X19,#0x189]                                      ; +0x1b4, 0x5769d0\nMOV             X0, X19; this                                          ; +0x1b8, 0x5769d4\nMOV             W1, #0; bool                                           ; +0x1bc, 0x5769d8\nBL              _ZN17CCMenuItemToggler6toggleEb; CCMenuItemToggler::toggle(bool) ; +0x1c0, 0x5769dc\nLDR             X20, [X20,#__stack_chk_guard_ptr@PAGEOFF]; __stack_chk_guard ; +0x1c4, 0x5769e0\nMOV             W0, W22                                                ; +0x1c8, 0x5769e4\nLDR             X2, [X29,#0x60+var_8]                                  ; +0x1cc, 0x5769e8\nLDR             X1, [X20]                                              ; +0x1d0, 0x5769ec\nCMP             X2, X1                                                 ; +0x1d4, 0x5769f0\nB.NE            loc_576A10                                             ; +0x1d8, 0x5769f4\nLDP             X19, X20, [SP,#0x60+var_50]                            ; +0x1dc, 0x5769f8\nLDP             X21, X22, [SP,#0x60+var_40]                            ; +0x1e0, 0x5769fc\nLDP             X23, X24, [SP,#0x60+var_30]                            ; +0x1e4, 0x576a00\nLDR             X25, [SP,#0x60+var_20]                                 ; +0x1e8, 0x576a04\nLDP             X29, X30, [SP+0x60+var_60],#0x60                       ; +0x1ec, 0x576a08\nRET                                                                    ; +0x1f0, 0x576a0c\nBL              .__stack_chk_fail                                      ; +0x1f4, 0x576a10", "xrefs": ["CCMenuItemToggler::create @ 0x576aac", "<???> @ 0x2b740"], "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"}