//
// MoreSearchLayer::createToggleButton from 0x1403172e0 to 0x140317537 (599 bytes)
//
// 12 xrefs:
// > MoreSearchLayer::init @ 0x1403130f5
// > MoreSearchLayer::init @ 0x140313255
// > MoreSearchLayer::init @ 0x140313399
// > MoreSearchLayer::init @ 0x1403134eb
// > MoreSearchLayer::init @ 0x14031362e
// > MoreSearchLayer::init @ 0x140313788
// > MoreSearchLayer::init @ 0x1403138e0
// > MoreSearchLayer::init @ 0x140313a26
// > MoreSearchLayer::init @ 0x140313b67
// > MoreSearchLayer::init @ 0x140313cc8
// > MoreSearchLayer::init @ 0x140313e11
// > ??> @ 0x1406d49a0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=1
CCMenuItemToggler *__fastcall MoreSearchLayer::createToggleButton(
__int64 a1,
const char *a2,
cocos2d::SEL_MenuHandler *a3,
bool a4,
cocos2d::CCNode *a5,
struct cocos2d::CCPoint a6)
{
struct cocos2d::CCSprite *v10; // r12
struct cocos2d::CCSprite *v11; // rbx
CCMenuItemToggler *v12; // r15
CCMenuItemToggler_vtbl *v13; // rbx
struct cocos2d::CCPoint v14; // rax
const char *v15; // rcx
struct cocos2d::CCLabelBMFont *v16; // rdi
float v17; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v18; // rbx
double v19; // xmm0_8
const cocos2d::CCPoint *v20; // rax
float *v21; // rax
cocos2d::CCLabelBMFont_vtbl *v22; // rbx
struct cocos2d::CCPoint v24[3]; // [rsp+20h] [rbp-78h] BYREF
v24[2] = (struct cocos2d::CCPoint)a2;
v24[0] = a6;
v10 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
v11 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v10->setScale_0)(v10);
((void (__fastcall *)(struct cocos2d::CCSprite *))v11->setScale_0)(v11);
v12 = CCMenuItemToggler::create(v10, v11, (cocos2d::CCObject *)a1, a3);
CCMenuItemToggler::toggle(v12, a4);
a5->addChild_1(a5, v12);
v13 = v12->cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v14 = cocos2d::CCNode::convertToNodeSpace(a5, v24);
((void (__fastcall *)(CCMenuItemToggler *, struct cocos2d::CCPoint))v13->setPosition_0)(v12, v14);
*(_DWORD *)(*(_QWORD *)&v12->m_nScriptTapHandler + 372LL) = 1069547520;
HIDWORD(v12->m_offButton->m_pfnSelector.adj) = 1069547520;
CCMenuItemToggler::toggle(v12, (bool)v12->m_onButton);
v15 = a2;
if ( *((_QWORD *)a2 + 3) > 0xFu )
v15 = *(const char **)a2;
v16 = cocos2d::CCLabelBMFont::create(v15, (const char *)&qword_14052A4D8);
v17 = (*(float (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 576) + 448LL))(
*(_QWORD *)(a1 + 576),
v16);
v18 = v16->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v19 = cocos2d::CCPoint::CCPoint(v17, 0.0);
v18->setAnchorPoint(v16, v20);
v21 = (float *)v10->getContentSize(v10);
cocos2d::CCPoint::CCPoint(*(float *)&v19, (float)((float)(*v21 * 0.5) * 0.80000001) + 8.0);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator+)(a6, v24);
v16->setPosition_0(v16, v24);
if ( v16->getContentSize(v16)->width > 80.0 )
{
v22 = v16->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v16->getContentSize(v16);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v22->setScale_0)(v16);
}
v16->getScale(v16);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v16->setScale_0)(v16);
sub_14003A830((__int64)a2);
return v12;
}