//
// SetupTouchTogglePopup::init from 0x140463d30 to 0x140464958 (3112 bytes)
//
// 2 xrefs:
// > SetupTouchTogglePopup::create @ 0x140463ceb
// > ??> @ 0x1406daf94
//
// 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=4
bool SetupTouchTogglePopup::init(SetupTouchTogglePopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool result; // al
__int64 v5; // rcx
cocos2d::CCDirector *v6; // rax
struct cocos2d::CCLabelBMFont *v7; // rdi
cocos2d::CCLabelBMFont_vtbl *v8; // rbx
const cocos2d::CCPoint *v9; // rax
ButtonSprite *v10; // rbx
CCMenuItemSpriteExtra *v11; // rax
_QWORD *v12; // rax
_QWORD *v13; // rcx
const char *v14; // rdx
__int64 v15; // r8
char *v16; // rdi
__int64 v17; // rbx
struct cocos2d::CCPoint v18; // rax
float v19; // xmm0_4
struct cocos2d::CCLabelBMFont *v20; // rbx
float v21; // xmm0_4
struct cocos2d::CCRect *v22; // rax
struct cocos2d::extension::CCScale9Sprite *v23; // rdi
__int64 v24; // rdx
const char *v25; // r9
CCTextInputNode *v26; // rax
CCTextInputNode *m_groupIDInput; // rcx
CCTextInputNode *v28; // rcx
std::string *p_m_allowedChars; // rcx
CCTextInputNode *v30; // rcx
CCTextInputNode *v31; // rcx
struct cocos2d::CCSprite *v32; // rbx
cocos2d::CCNode *v33; // rbx
float v34; // xmm0_4
struct cocos2d::CCSprite *v35; // rbx
cocos2d::CCNode *v36; // rbx
float v37; // xmm0_4
__int64 v38; // rax
int v39; // r9d
__int64 v40; // rax
__int64 v41; // rax
int v42; // r9d
__int64 v43; // rax
__int128 v44; // xmm0
__int64 v45; // rax
int v46; // r9d
__int64 v47; // rax
__int64 v48; // rax
int v49; // r9d
__int64 v50; // rax
int v51; // [rsp+28h] [rbp-E0h]
_QWORD v52[3]; // [rsp+50h] [rbp-B8h] BYREF
__int64 v53; // [rsp+68h] [rbp-A0h]
__int64 v54; // [rsp+70h] [rbp-98h]
_QWORD *v55; // [rsp+78h] [rbp-90h] BYREF
cocos2d::CCPoint v56; // [rsp+80h] [rbp-88h] BYREF
struct cocos2d::CCPoint v57; // [rsp+88h] [rbp-80h] BYREF
char v58[8]; // [rsp+90h] [rbp-78h] BYREF
char v59[8]; // [rsp+98h] [rbp-70h] BYREF
cocos2d::CCRect v60; // [rsp+A0h] [rbp-68h] BYREF
__int64 v61; // [rsp+B0h] [rbp-58h]
__int64 v62; // [rsp+B8h] [rbp-50h]
_QWORD Src[4]; // [rsp+C0h] [rbp-48h] BYREF
cocos2d::CCSize v64; // [rsp+E0h] [rbp-28h] BYREF
cocos2d::CCRect v65[5]; // [rsp+E8h] [rbp-20h] BYREF
cocos2d::CCArray *v66; // [rsp+178h] [rbp+70h] BYREF
float v67; // [rsp+180h] [rbp+78h]
float v68; // [rsp+184h] [rbp+7Ch]
v66 = a3;
result = SetupTriggerPopup::init(a1, a2, nullptr, 320.0, 260.0, 1);
if ( result )
{
a1->determineStartValues(a1);
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6);
v7 = cocos2d::CCLabelBMFont::create("Touch Toggle", &qword_14052A4D8);
a1->addChild_1(a1, v7);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v7->setScale_0)(v7);
v8 = v7->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v68 * 0.5, v67 * 0.5);
v8->setPosition_0(v7, v9);
v66 = (cocos2d::CCArray *)operator new(0x2C0u);
v10 = ButtonSprite::ButtonSprite((ButtonSprite *)v66);
if ( v10 )
{
if ( ButtonSprite::init_1(v10, "OK", 40, 0, 0.80000001, 1, "goldFont.fnt", "GJ_button_01.png", 30.0) )
{
cocos2d::CCObject::autorelease(v10);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v10->~ButtonSprite)(v10, 1);
v10 = nullptr;
}
}
v11 = CCMenuItemSpriteExtra::create(v10, nullptr, a1, (cocos2d::SEL_MenuHandler *)sub_14009BEF0);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v11);
v66 = (cocos2d::CCArray *)&v52[1];
*(_OWORD *)&v52[1] = 0;
v53 = 0;
v54 = 15;
v12 = sub_14003AA10(0x160u);
v52[1] = v12;
v53 = 339;
v54 = 351;
v13 = v12;
v14 = "Toggles a group of objects when the player clicks.\n"
"It also functions as a Spawn trigger.\n"
"Alternates between toggling on and off for each click by default. Use Toggle On or Off to limit to eit"
"her.\n"
"Hold Mode toggles on and off for holding and releasing instead of clicking.\n"
"Dual Mode blocks player 2's clicks.";
v15 = 2;
do
{
*(_OWORD *)v13 = *(_OWORD *)v14;
*((_OWORD *)v13 + 1) = *((_OWORD *)v14 + 1);
*((_OWORD *)v13 + 2) = *((_OWORD *)v14 + 2);
*((_OWORD *)v13 + 3) = *((_OWORD *)v14 + 3);
*((_OWORD *)v13 + 4) = *((_OWORD *)v14 + 4);
*((_OWORD *)v13 + 5) = *((_OWORD *)v14 + 5);
*((_OWORD *)v13 + 6) = *((_OWORD *)v14 + 6);
v13 += 16;
*((_OWORD *)v13 - 1) = *((_OWORD *)v14 + 7);
v14 += 128;
--v15;
}
while ( v15 );
*(_OWORD *)v13 = *(_OWORD *)v14;
*((_OWORD *)v13 + 1) = *((_OWORD *)v14 + 1);
*((_OWORD *)v13 + 2) = *((_OWORD *)v14 + 2);
*((_OWORD *)v13 + 3) = *((_OWORD *)v14 + 3);
*((_OWORD *)v13 + 4) = *((_OWORD *)v14 + 4);
*((_WORD *)v13 + 40) = *((_WORD *)v14 + 40);
*((_BYTE *)v13 + 82) = v14[82];
*((_BYTE *)v12 + 339) = 0;
v60 = 0;
v61 = 4;
v62 = 15;
strcpy((char *)&v60, "Help");
v16 = InfoAlertButton::create((__int64)&v60, (__int64)&v52[1]);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, (cocos2d::CCNode *)v16);
v17 = *(_QWORD *)v16;
cocos2d::CCPoint::CCPoint(a1->m_width * 0.5, (float)((float)(v67 * 0.5) - (float)(a1->m_width * 0.5)) + 18.0);
v18 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v55);
v19 = (*(float (__fastcall **)(char *, struct cocos2d::CCPoint))(v17 + 184))(v16, v18);
cocos2d::CCPoint::CCPoint(v19, (float)(v67 * 0.5) - 50.0);
v20 = cocos2d::CCLabelBMFont::create((const char *)&qword_1405DA090, "goldFont.fnt");
a1->addChild_1(a1, v20);
v21 = ((float (__fastcall *)(struct cocos2d::CCLabelBMFont *))v20->setScale_0)(v20);
cocos2d::CCPoint::CCPoint(v21, 0.0);
cocos2d::CCPoint::operator+(&v56, &v66);
v20->setPosition_0(v20, (const cocos2d::CCPoint *)&v66);
cocos2d::CCRect::CCRect(v65, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v60, v65);
v23 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v22);
LOBYTE(v24) = 100;
v23->setOpacity(&v23->cocos2d::CCRGBAProtocol, v24);
LOWORD(v66) = 0;
BYTE2(v66) = 0;
v23->setColor(&v23->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v66);
cocos2d::CCSize::CCSize(&v64, 50.0, 30.0);
v23->setContentSize(v23, &v64);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v23, -1);
v23->setPosition_0(v23, &v56);
v26 = CCTextInputNode::create(50.0, 40.0, "Num", v25, v51, (const char *)&qword_14052A4D8);
a1->m_groupIDInput = v26;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v26, 20);
a1->m_groupIDInput->setPosition_0(a1->m_groupIDInput, &v56);
m_groupIDInput = a1->m_groupIDInput;
m_groupIDInput->m_maxLabelScale = 0.60000002;
CCTextInputNode::refreshLabel(m_groupIDInput);
v28 = a1->m_groupIDInput;
v28->m_maxLabelWidth = 200.0;
CCTextInputNode::refreshLabel(v28);
a1->m_groupIDInput->m_textField->setVisible(a1->m_groupIDInput->m_textField, 0);
a1->m_groupIDInput->m_maxLabelLength = 6;
Src[1] = 14648;
Src[2] = 10;
Src[3] = 15;
Src[0] = 0x3736353433323130LL;
v66 = (cocos2d::CCArray *)Src;
p_m_allowedChars = &a1->m_groupIDInput->m_allowedChars;
if ( p_m_allowedChars != (std::string *)Src )
sub_14003CCE0((void **)p_m_allowedChars, Src, 0xAu);
sub_14003A830((__int64)Src);
LOWORD(v66) = -21896;
v30 = a1->m_groupIDInput;
*(_WORD *)&v30->m_placeholderColor.r = -21896;
v30->m_placeholderColor.b = -16;
CCTextInputNode::refreshLabel(v30);
v31 = a1->m_groupIDInput;
v31->m_placeholderScale = 0.5;
CCTextInputNode::refreshLabel(v31);
a1->m_groupIDInput->m_delegate = &a1->TextInputDelegate;
a1->m_groupIDInput->m_numberInput = 1;
a1->m_groupIDInput->setTag(a1->m_groupIDInput, 3);
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v57);
v32 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v32->setScale_0)(v32);
v33 = CCMenuItemSpriteExtra::create(
v32,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SetupCameraEdgePopup::onTargetIDArrow);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v33);
v34 = ((float (__fastcall *)(cocos2d::CCNode *, __int64))v33->setTag)(v33, 1);
cocos2d::CCPoint::CCPoint(v34, -50.0);
cocos2d::CCPoint::operator+(&v57, &v66);
v33->setPosition_0(v33, (const cocos2d::CCPoint *)&v66);
v33[1].m_unknown5 = 0x40000000;
v35 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v35->setScale_0)(v35);
v36 = CCMenuItemSpriteExtra::create(
v35,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SetupCameraEdgePopup::onTargetIDArrow);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v36);
v37 = ((float (__fastcall *)(cocos2d::CCNode *, __int64))v36->setTag)(v36, 2);
cocos2d::CCPoint::CCPoint(v37, 50.0);
cocos2d::CCPoint::operator+(&v57, &v66);
v36->setPosition_0(v36, (const cocos2d::CCPoint *)&v66);
v36[1].m_unknown5 = 0x40000000;
SetupCameraEdgePopup::updateTextInputLabel((__int64)a1);
SetupTriggerPopup::createMultiTriggerItemsDefaultVertical(a1);
v66 = (cocos2d::CCArray *)&v52[1];
WORD1(v52[2]) = 0;
HIDWORD(v52[2]) = 0;
v53 = 9;
v54 = 15;
strcpy((char *)&v52[1], "Hold Mode");
cocos2d::CCPoint::CCPoint(1.7445801e22, (float)(v67 * 0.5) + 50.0);
SetupTriggerPopup::createToggleButton(
(_DWORD)a1,
(unsigned int)&v52[1],
(unsigned int)SetupTouchTogglePopup::onHoldMode,
a1->m_holdMode,
v38);
cocos2d::CCPoint::CCPoint(a1->m_width * 0.5, (float)((float)(v67 * 0.5) + (float)(a1->m_width * 0.5)) - 70.0);
v66 = (cocos2d::CCArray *)&v52[1];
WORD1(v52[2]) = 0;
HIDWORD(v52[2]) = 0;
v53 = 9;
v54 = 15;
strcpy((char *)&v52[1], "Toggle\nOn");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v55);
LOBYTE(v39) = a1->m_toggleMode == 1;
SetupTriggerPopup::createToggleButton(
(_DWORD)a1,
(unsigned int)&v52[1],
(unsigned int)SetupTouchTogglePopup::onTouchMode,
v39,
v40);
a1->m_toggleOnToggler = (CCMenuItemToggler *)v41;
*(_BYTE *)(v41 + 393) = 1;
a1->m_toggleOnToggler->setTag(a1->m_toggleOnToggler, 1);
v55 = &v52[1];
BYTE3(v52[2]) = 0;
HIDWORD(v52[2]) = 0;
v53 = 10;
v54 = 15;
strcpy((char *)&v52[1], "Toggle\nOff");
cocos2d::CCPoint::CCPoint(1.0929203e24, 0.0);
cocos2d::CCPoint::operator+(v58, &v66);
LOBYTE(v42) = a1->m_toggleMode == 2;
SetupTriggerPopup::createToggleButton(
(_DWORD)a1,
(unsigned int)&v52[1],
(unsigned int)SetupTouchTogglePopup::onTouchMode,
v42,
(__int64)&v66);
a1->m_toggleOffToggler = (CCMenuItemToggler *)v43;
*(_BYTE *)(v43 + 393) = 1;
a1->m_toggleOffToggler->setTag(a1->m_toggleOffToggler, 2);
v66 = (cocos2d::CCArray *)&v52[1];
v44 = 0;
v53 = 9;
v54 = 15;
*(_QWORD *)&v44 = 0x646F4D0A6C617544LL;
*(_OWORD *)&v52[1] = v44;
strcpy((char *)&v52[2], "e");
cocos2d::CCPoint::CCPoint(a1->m_width * 0.5, (float)((float)(v67 * 0.5) + (float)(a1->m_width * 0.5)) - 60.0);
*(double *)&v44 = SetupTriggerPopup::createToggleButton(
(_DWORD)a1,
(unsigned int)&v52[1],
(unsigned int)SetupTouchTogglePopup::onDualTouchMode,
a1->m_dualMode,
v45);
cocos2d::CCPoint::CCPoint(*(float *)&v44, (float)(v67 * 0.5) - 50.0);
v66 = (cocos2d::CCArray *)&v52[1];
v52[2] = 0;
v53 = 7;
v54 = 15;
strcpy((char *)&v52[1], "P1\nOnly");
cocos2d::CCPoint::CCPoint(&v60.origin);
LOBYTE(v46) = a1->m_playerMode == 1;
SetupTriggerPopup::createToggleButton(
(_DWORD)a1,
(unsigned int)&v52[1],
(unsigned int)SetupTouchTogglePopup::onControlMode,
v46,
v47);
a1->m_p1OnlyToggler = (CCMenuItemToggler *)v48;
*(_BYTE *)(v48 + 393) = 1;
*(float *)&v44 = ((float (__fastcall *)(CCMenuItemToggler *, __int64))a1->m_p1OnlyToggler->setTag)(
a1->m_p1OnlyToggler,
1);
v60.origin = (cocos2d::CCPoint)&v52[1];
v52[2] = 0;
v53 = 7;
v54 = 15;
strcpy((char *)&v52[1], "P2\nOnly");
cocos2d::CCPoint::CCPoint(*(float *)&v44, 100.0);
cocos2d::CCPoint::operator+(v59, &v66);
LOBYTE(v49) = a1->m_playerMode == 2;
SetupTriggerPopup::createToggleButton(
(_DWORD)a1,
(unsigned int)&v52[1],
(unsigned int)SetupTouchTogglePopup::onControlMode,
v49,
(__int64)&v66);
a1->m_p2OnlyToggler = (CCMenuItemToggler *)v50;
*(_BYTE *)(v50 + 393) = 1;
a1->m_p2OnlyToggler->setTag(a1->m_p2OnlyToggler, 2);
a1->m_disableTextDelegate = 0;
return 1;
}
return result;
}