//
// SetupCameraEdgePopup::init from 0x140412c90 to 0x1404139cb (3387 bytes)
//
// 2 xrefs:
// > SetupCameraEdgePopup::create @ 0x140412c4a
// > ??> @ 0x1406d8d50
//
// 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=5
bool SetupCameraEdgePopup::init(SetupCameraEdgePopup *a1, CameraTriggerGameObject *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
char *v12; // rdi
__int64 v13; // rbx
struct cocos2d::CCPoint v14; // rax
float v15; // xmm0_4
struct cocos2d::CCLabelBMFont *v16; // rbx
float v17; // xmm0_4
struct cocos2d::CCRect *v18; // rax
struct cocos2d::extension::CCScale9Sprite *v19; // rdi
__int64 v20; // rdx
const char *v21; // r9
CCTextInputNode *v22; // rax
CCTextInputNode *m_targetIDInput; // rcx
CCTextInputNode *v24; // rcx
std::string *p_m_allowedChars; // rcx
CCTextInputNode *v26; // rcx
CCTextInputNode *v27; // rcx
struct cocos2d::CCSprite *v28; // rbx
cocos2d::CCNode *v29; // rbx
float v30; // xmm0_4
struct cocos2d::CCSprite *v31; // rbx
cocos2d::CCNode *v32; // rbx
float v33; // xmm0_4
double v34; // xmm0_8
__int64 v35; // rcx
cocos2d::CCArray *v36; // rax
double v37; // xmm0_8
float *v38; // rax
CCMenuItemToggler *ToggleButton; // r14
double v40; // xmm0_8
float *v41; // rax
CCMenuItemToggler *v42; // rsi
double v43; // xmm0_8
float *v44; // rax
CCMenuItemToggler *v45; // rdi
double v46; // xmm0_8
float *v47; // rax
CCMenuItemToggler *v48; // rbx
ButtonSprite *v49; // rbx
CCMenuItemSpriteExtra *v50; // rdi
float v51; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v52; // rbx
struct cocos2d::CCPoint v53; // rax
int v54; // [rsp+28h] [rbp-E0h]
float v55; // [rsp+88h] [rbp-80h]
__int128 *v56; // [rsp+90h] [rbp-78h] BYREF
cocos2d::CCPoint v57; // [rsp+98h] [rbp-70h] BYREF
char v58[8]; // [rsp+A0h] [rbp-68h] BYREF
__int128 v59; // [rsp+A8h] [rbp-60h] BYREF
__int64 v60; // [rsp+B8h] [rbp-50h]
__int64 v61; // [rsp+C0h] [rbp-48h]
struct cocos2d::CCPoint v62; // [rsp+C8h] [rbp-40h] BYREF
_QWORD Src[4]; // [rsp+D0h] [rbp-38h] BYREF
cocos2d::CCRect v64; // [rsp+F0h] [rbp-18h] BYREF
__int64 v65; // [rsp+100h] [rbp-8h]
__int64 v66; // [rsp+108h] [rbp+0h]
cocos2d::CCSize v67; // [rsp+110h] [rbp+8h] BYREF
char v68[8]; // [rsp+118h] [rbp+10h] BYREF
char v69[8]; // [rsp+120h] [rbp+18h] BYREF
__int128 v70; // [rsp+128h] [rbp+20h] BYREF
__int64 v71; // [rsp+138h] [rbp+30h]
__int64 v72; // [rsp+140h] [rbp+38h]
__int128 v73; // [rsp+148h] [rbp+40h] BYREF
__int64 v74; // [rsp+158h] [rbp+50h]
__int64 v75; // [rsp+160h] [rbp+58h]
__int128 v76; // [rsp+168h] [rbp+60h] BYREF
__int64 v77; // [rsp+178h] [rbp+70h]
__int64 v78; // [rsp+180h] [rbp+78h]
__int128 *v79; // [rsp+1B8h] [rbp+B0h]
cocos2d::CCRect v80[8]; // [rsp+1C8h] [rbp+C0h] BYREF
ButtonSprite *v81; // [rsp+290h] [rbp+188h] BYREF
result = SetupTriggerPopup::init(a1, a2, a3, 300.0, 240.0, 1);
if ( result )
{
a1->determineStartValues(a1);
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6);
v7 = cocos2d::CCLabelBMFont::create("Setup Camera Edge", "goldFont.fnt");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v7);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v7->setScale_0)(v7);
v8 = v7->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(a1->m_height * 0.5, v55 * 0.5);
v8->setPosition_0(v7, v9);
v81 = (ButtonSprite *)operator new(0x2C0u);
v10 = ButtonSprite::ButtonSprite(v81);
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);
v81 = (ButtonSprite *)&v64;
v64 = 0;
v65 = 0;
v66 = 15;
v64.origin = (cocos2d::CCPoint)sub_14003AA10(0x90u);
v65 = 130;
v66 = 143;
strcpy(
*(char **)&v64.origin,
"Makes one of the camera's edges a specified target object.\n"
"Use another trigger with Unlock (Target ID 0) to reset.");
v59 = 0;
v60 = 4;
v61 = 15;
strcpy((char *)&v59, "Help");
v12 = InfoAlertButton::create((__int64)&v59, (__int64)&v64);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, (cocos2d::CCNode *)v12);
v13 = *(_QWORD *)v12;
cocos2d::CCPoint::CCPoint(a1->m_width * 0.5, (float)((float)(v55 * 0.5) - (float)(a1->m_width * 0.5)) + 18.0);
v14 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v56);
v15 = (*(float (__fastcall **)(char *, struct cocos2d::CCPoint))(v13 + 184))(v12, v14);
cocos2d::CCPoint::CCPoint(v15, v55 * 0.5);
v16 = cocos2d::CCLabelBMFont::create("Target ID", "goldFont.fnt");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v16);
v17 = ((float (__fastcall *)(struct cocos2d::CCLabelBMFont *))v16->setScale_0)(v16);
cocos2d::CCPoint::CCPoint(v17, 0.0);
cocos2d::CCPoint::operator+(&v57, &v81);
v16->setPosition_0(v16, (const cocos2d::CCPoint *)&v81);
cocos2d::CCRect::CCRect(v80, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v64, v80);
v19 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v18);
LOBYTE(v20) = 100;
v19->setOpacity(&v19->cocos2d::CCRGBAProtocol, v20);
LOWORD(v81) = 0;
BYTE2(v81) = 0;
v19->setColor(&v19->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v81);
cocos2d::CCSize::CCSize(&v67, 50.0, 30.0);
v19->setContentSize(v19, &v67);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v19, -1);
v19->setPosition_0(v19, &v57);
v22 = CCTextInputNode::create(50.0, 40.0, "Num", v21, v54, (const char *)&qword_14052A4D8);
a1->m_targetIDInput = v22;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v22, 20);
a1->m_targetIDInput->setPosition_0(a1->m_targetIDInput, &v57);
m_targetIDInput = a1->m_targetIDInput;
m_targetIDInput->m_maxLabelScale = 0.60000002;
CCTextInputNode::refreshLabel(m_targetIDInput);
v24 = a1->m_targetIDInput;
v24->m_maxLabelWidth = 200.0;
CCTextInputNode::refreshLabel(v24);
a1->m_targetIDInput->m_textField->setVisible(a1->m_targetIDInput->m_textField, 0);
a1->m_targetIDInput->m_maxLabelLength = 6;
Src[1] = 14648;
Src[2] = 10;
Src[3] = 15;
Src[0] = 0x3736353433323130LL;
v81 = (ButtonSprite *)Src;
p_m_allowedChars = &a1->m_targetIDInput->m_allowedChars;
if ( p_m_allowedChars != (std::string *)Src )
sub_14003CCE0((void **)p_m_allowedChars, Src, 0xAu);
sub_14003A830((__int64)Src);
LOWORD(v81) = -21896;
v26 = a1->m_targetIDInput;
*(_WORD *)&v26->m_placeholderColor.r = -21896;
v26->m_placeholderColor.b = -16;
CCTextInputNode::refreshLabel(v26);
v27 = a1->m_targetIDInput;
v27->m_placeholderScale = 0.5;
CCTextInputNode::refreshLabel(v27);
a1->m_targetIDInput->m_delegate = &a1->TextInputDelegate;
a1->m_targetIDInput->m_numberInput = 1;
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v62);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v28->setScale_0)(v28);
v29 = CCMenuItemSpriteExtra::create(
v28,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SetupCameraEdgePopup::onTargetIDArrow);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v29);
v30 = ((float (__fastcall *)(cocos2d::CCNode *, __int64))v29->setTag)(v29, 1);
cocos2d::CCPoint::CCPoint(v30, -50.0);
cocos2d::CCPoint::operator+(&v62, &v81);
v29->setPosition_0(v29, (const cocos2d::CCPoint *)&v81);
v29[1].m_unknown5 = 0x40000000;
v31 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v31->setScale_0)(v31);
v32 = CCMenuItemSpriteExtra::create(
v31,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SetupCameraEdgePopup::onTargetIDArrow);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v32);
v33 = ((float (__fastcall *)(cocos2d::CCNode *, __int64))v32->setTag)(v32, 2);
cocos2d::CCPoint::CCPoint(v33, 50.0);
v34 = cocos2d::CCPoint::operator+(&v62, &v81);
v32->setPosition_0(v32, (const cocos2d::CCPoint *)&v81);
v32[1].m_unknown5 = 0x40000000;
SetupCameraEdgePopup::updateTextInputLabel(a1);
v36 = (cocos2d::CCArray *)cocos2d::CCArray::create(v35);
a1->m_directionToggles = v36;
cocos2d::CCObject::retain(v36);
cocos2d::CCPoint::CCPoint(*(float *)&v34, v55 * 0.5);
v56 = &v70;
v70 = 0;
v71 = 4;
v72 = 15;
strcpy((char *)&v70, "Left");
cocos2d::CCPoint::CCPoint(0.0, -75.0);
v37 = cocos2d::CCPoint::operator+(v58, &v81);
cocos2d::CCPoint::CCPoint(*(float *)&v37, 0.0);
ToggleButton = GameToolbox::createToggleButton(
(const char *)&v70,
(cocos2d::SEL_MenuHandler *)SetupCameraEdgePopup::onCameraEdge,
a1->m_edgeDirection == 1,
a1->m_buttonMenu,
(struct cocos2d::CCPoint)&v81,
a1,
a1->m_mainLayer,
0.60000002,
0.34999999,
0.0,
v38,
(const char *)&qword_14052A4D8,
1,
0,
nullptr);
ToggleButton->setTag(ToggleButton, 1);
BYTE1(ToggleButton->m_onButton) = 1;
v56 = &v59;
v59 = 0;
v60 = 5;
v61 = 15;
strcpy((char *)&v59, "Right");
cocos2d::CCPoint::CCPoint(0.0, -25.0);
v40 = cocos2d::CCPoint::operator+(v58, v68);
cocos2d::CCPoint::CCPoint(*(float *)&v40, 0.0);
v42 = GameToolbox::createToggleButton(
(const char *)&v59,
(cocos2d::SEL_MenuHandler *)SetupCameraEdgePopup::onCameraEdge,
a1->m_edgeDirection == 2,
a1->m_buttonMenu,
(struct cocos2d::CCPoint)v68,
a1,
a1->m_mainLayer,
0.60000002,
0.34999999,
0.0,
v41,
(const char *)&qword_14052A4D8,
1,
0,
nullptr);
v42->setTag(v42, 2);
BYTE1(v42->m_onButton) = 1;
v56 = &v73;
v73 = 0;
v74 = 2;
v75 = 15;
strcpy((char *)&v73, "Up");
cocos2d::CCPoint::CCPoint(0.0, 25.0);
v43 = cocos2d::CCPoint::operator+(v58, v69);
cocos2d::CCPoint::CCPoint(*(float *)&v43, 0.0);
v45 = GameToolbox::createToggleButton(
(const char *)&v73,
(cocos2d::SEL_MenuHandler *)SetupCameraEdgePopup::onCameraEdge,
a1->m_edgeDirection == 3,
a1->m_buttonMenu,
(struct cocos2d::CCPoint)v69,
a1,
a1->m_mainLayer,
0.60000002,
0.34999999,
0.0,
v44,
(const char *)&qword_14052A4D8,
1,
0,
nullptr);
v45->setTag(v45, 3);
BYTE1(v45->m_onButton) = 1;
v79 = &v76;
v76 = 0;
v77 = 4;
v78 = 15;
strcpy((char *)&v76, "Down");
cocos2d::CCPoint::CCPoint(0.0, 75.0);
v46 = cocos2d::CCPoint::operator+(v58, &v56);
cocos2d::CCPoint::CCPoint(*(float *)&v46, 0.0);
v48 = GameToolbox::createToggleButton(
(const char *)&v76,
(cocos2d::SEL_MenuHandler *)SetupCameraEdgePopup::onCameraEdge,
a1->m_edgeDirection == 4,
a1->m_buttonMenu,
(struct cocos2d::CCPoint)&v56,
a1,
a1->m_mainLayer,
0.60000002,
0.34999999,
0.0,
v47,
(const char *)&qword_14052A4D8,
1,
0,
nullptr);
v48->setTag(v48, 4);
BYTE1(v48->m_onButton) = 1;
cocos2d::CCArray::addObject(a1->m_directionToggles, ToggleButton);
cocos2d::CCArray::addObject(a1->m_directionToggles, v42);
cocos2d::CCArray::addObject(a1->m_directionToggles, v45);
cocos2d::CCArray::addObject(a1->m_directionToggles, v48);
v81 = (ButtonSprite *)operator new(0x2C0u);
v49 = ButtonSprite::ButtonSprite(v81);
if ( v49 )
{
if ( ButtonSprite::init_1(v49, "Unlock", 35, 0, 0.80000001, 1, "goldFont.fnt", "GJ_button_05.png", 30.0) )
{
cocos2d::CCObject::autorelease(v49);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v49->~ButtonSprite)(v49, 1);
v49 = nullptr;
}
}
v50 = CCMenuItemSpriteExtra::create(
v49,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SetupCameraEdgePopup::onUnlockEdge);
v51 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v50);
v52 = v50->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v51, (float)(v55 * 0.5) + 100.0);
v53 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v64.origin);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v52->setPosition_0)(v50, v53);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
a1->m_disableTextDelegate = 0;
return 1;
}
return result;
}