//
// SetupCameraEdgePopup::init from 0x1405aa400 to 0x1405aae37 (2615 bytes)
//
// 2 xrefs:
// > SetupCameraEdgePopup::create @ 0x1405aa3ba
// > ??> @ 0x14092d6e0
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:34:40 +0000
//
// Hidden C++ exception states: #wind=5
char __fastcall SetupCameraEdgePopup::init(__int64 a1, int a2, int a3, int a4)
{
char result; // al
__int64 v6; // rcx
__int64 v7; // rax
cocos2d::CCObject *v8; // rbx
cocos2d::CCObject *v9; // rax
char *v10; // rsi
__int64 v11; // rdi
__int64 v12; // rbx
__int64 v13; // rax
__int64 v14; // rax
const struct cocos2d::CCPoint *v15; // rax
char *v16; // rbx
void *v17; // r8
__int64 v18; // rax
__int64 v19; // rcx
cocos2d::CCObject *v20; // rax
int v21; // ebx
__int64 v22; // rax
float *v23; // rax
struct cocos2d::CCObject *ToggleButton; // r12
int v25; // esi
__int64 v26; // rax
__int64 v27; // rbx
__int64 v28; // rdi
float *v29; // rax
struct cocos2d::CCObject *v30; // r15
int v31; // esi
__int64 v32; // rax
__int64 v33; // rbx
__int64 v34; // rdi
float *v35; // rax
struct cocos2d::CCObject *v36; // r14
int v37; // esi
__int64 v38; // rax
__int64 v39; // rbx
__int64 v40; // rdi
float *v41; // rax
struct cocos2d::CCObject *v42; // rbx
cocos2d::CCObject *v43; // rbx
cocos2d::CCObject *v44; // rsi
__int64 v45; // rdi
__int64 v46; // rbx
__int64 v47; // rax
__int64 v48; // rax
void **v49; // [rsp+88h] [rbp-80h] BYREF
float v50; // [rsp+90h] [rbp-78h] BYREF
float v51; // [rsp+94h] [rbp-74h]
_BYTE v52[8]; // [rsp+98h] [rbp-70h] BYREF
__int128 v53; // [rsp+A0h] [rbp-68h] BYREF
__int64 v54; // [rsp+B0h] [rbp-58h]
__int64 v55; // [rsp+B8h] [rbp-50h]
_BYTE v56[8]; // [rsp+C0h] [rbp-48h] BYREF
void *v57; // [rsp+C8h] [rbp-40h] BYREF
_BYTE v58[8]; // [rsp+D0h] [rbp-38h] BYREF
_BYTE v59[8]; // [rsp+D8h] [rbp-30h] BYREF
_BYTE v60[8]; // [rsp+E0h] [rbp-28h] BYREF
_BYTE v61[8]; // [rsp+E8h] [rbp-20h] BYREF
__int128 v62; // [rsp+F0h] [rbp-18h] BYREF
__int64 v63; // [rsp+100h] [rbp-8h]
__int64 v64; // [rsp+108h] [rbp+0h]
__int128 v65; // [rsp+110h] [rbp+8h] BYREF
__int64 v66; // [rsp+120h] [rbp+18h]
__int64 v67; // [rsp+128h] [rbp+20h]
_BYTE v68[8]; // [rsp+130h] [rbp+28h] BYREF
_BYTE v69[8]; // [rsp+138h] [rbp+30h] BYREF
_BYTE v70[8]; // [rsp+140h] [rbp+38h] BYREF
_BYTE v71[8]; // [rsp+148h] [rbp+40h] BYREF
_BYTE v72[8]; // [rsp+150h] [rbp+48h] BYREF
_BYTE v73[8]; // [rsp+158h] [rbp+50h] BYREF
__int128 *v74; // [rsp+160h] [rbp+58h]
void *Block[2]; // [rsp+168h] [rbp+60h] BYREF
__int64 v76; // [rsp+178h] [rbp+70h]
unsigned __int64 v77; // [rsp+180h] [rbp+78h]
result = SetupTriggerPopup::init(a1, a2, a3, a4, 1131413504, 1, 0);
if ( result )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, &v50);
*(_OWORD *)Block = 0;
v76 = 0;
v77 = 0;
Block[0] = sub_14003D460(0x20u);
v76 = 17;
v77 = 31;
strcpy((char *)Block[0], "Setup Camera Edge");
SetupTriggerPopup::addTitle(a1, Block);
v49 = (void **)operator new(0x2C8u);
v8 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v49);
if ( v8 )
{
if ( ButtonSprite::init_1(
(__int64)v8,
(__int64)"OK",
40,
0,
1061997773,
1,
"goldFont.fnt",
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v8);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v8 + 8LL))(v8, 1);
LODWORD(v8) = 0;
}
}
v9 = CCMenuItemSpriteExtra::create((int)v8, 0, a1, (__int64)sub_14009D628);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v9);
v49 = Block;
*(_OWORD *)Block = 0;
v76 = 0;
v77 = 0;
Block[0] = sub_14003D460(0x90u);
v76 = 130;
v77 = 143;
strcpy(
(char *)Block[0],
"Makes one of the camera's edges a specified target object.\n"
"Use another trigger with Unlock (Target ID 0) to reset.");
v53 = 0;
v54 = 4;
v55 = 15;
strcpy((char *)&v53, "Help");
v10 = InfoAlertButton::create((__int64)&v53, (__int64)Block);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v10);
v11 = *(_QWORD *)v10;
v12 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v49,
(float)((float)(v50 * 0.5) - (float)(*(float *)(a1 + 732) * 0.5)) + 18.0,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(v51 * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(v12, v56, v13);
(*(void (__fastcall **)(char *, __int64))(v11 + 184))(v10, v14);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, (float)(v50 * 0.5) - 30.0, (float)(v51 * 0.5) - 20.0);
Block[1] = (void *)68;
v76 = 9;
v77 = 15;
Block[0] = (void *)0x4920746567726154LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, (const struct cocos2d::CCPoint *)v58);
v16 = IDNameInput::create(a1, a1 + 544, 1, 51, (__int64)Block, v15, 1065353216, 6, 0, 0, 0);
if ( v77 > 0xF )
{
v17 = Block[0];
if ( v77 + 1 >= 0x1000 )
{
v17 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
}
v76 = 0;
v77 = 15;
LOBYTE(Block[0]) = 0;
if ( v16 )
v18 = *((_QWORD *)v16 + 48);
else
v18 = 0;
*(_QWORD *)(a1 + 1000) = v18;
SetupCameraEdgePopup::updateTextInputLabel(a1);
v20 = (cocos2d::CCObject *)cocos2d::CCArray::create(v19);
*(_QWORD *)(a1 + 1016) = v20;
cocos2d::CCObject::retain(v20);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v52, v50 * 0.5, (float)(v51 * 0.5) + 50.0);
v49 = (void **)&v53;
v21 = *(_DWORD *)(a1 + 1012);
v53 = 0;
v54 = 4;
v55 = 15;
strcpy((char *)&v53, "Left");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, -75.0, 0.0);
cocos2d::CCPoint::operator+(v52, v59, v22);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v69, 0.0, 2.0);
ToggleButton = GameToolbox::createToggleButton(
(const char *)&v53,
(__int64)SetupCameraEdgePopup::onCameraEdge,
v21 == 1,
*(_QWORD *)(a1 + 552),
(__int64)v59,
a1,
*(_QWORD *)(a1 + 584),
0.60000002,
0.34999999,
0.0,
v23,
(const char *)&qword_140704F78,
1,
0,
nullptr);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)ToggleButton + 64LL))(ToggleButton, 1);
*((_BYTE *)ToggleButton + 393) = 1;
v49 = Block;
v25 = *(_DWORD *)(a1 + 1012);
*(_OWORD *)Block = 0;
v76 = 5;
v77 = 15;
strcpy((char *)Block, "Right");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, -25.0, 0.0);
cocos2d::CCPoint::operator+(v52, v60, v26);
v27 = *(_QWORD *)(a1 + 584);
v28 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v71, 0.0, 2.0);
v30 = GameToolbox::createToggleButton(
(const char *)Block,
(__int64)SetupCameraEdgePopup::onCameraEdge,
v25 == 2,
v28,
(__int64)v60,
a1,
v27,
0.60000002,
0.34999999,
0.0,
v29,
(const char *)&qword_140704F78,
1,
0,
nullptr);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v30 + 64LL))(v30, 2);
*((_BYTE *)v30 + 393) = 1;
v49 = (void **)&v62;
v31 = *(_DWORD *)(a1 + 1012);
v62 = 0;
v63 = 2;
v64 = 15;
strcpy((char *)&v62, "Up");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v72, 25.0, 0.0);
cocos2d::CCPoint::operator+(v52, v56, v32);
v33 = *(_QWORD *)(a1 + 584);
v34 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, 0.0, 2.0);
v36 = GameToolbox::createToggleButton(
(const char *)&v62,
(__int64)SetupCameraEdgePopup::onCameraEdge,
v31 == 3,
v34,
(__int64)v56,
a1,
v33,
0.60000002,
0.34999999,
0.0,
v35,
(const char *)&qword_140704F78,
1,
0,
nullptr);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v36 + 64LL))(v36, 3);
*((_BYTE *)v36 + 393) = 1;
v74 = &v65;
v37 = *(_DWORD *)(a1 + 1012);
v65 = 0;
v66 = 4;
v67 = 15;
strcpy((char *)&v65, "Down");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, 75.0, 0.0);
cocos2d::CCPoint::operator+(v52, &v49, v38);
v39 = *(_QWORD *)(a1 + 584);
v40 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, 0.0, 2.0);
v42 = GameToolbox::createToggleButton(
(const char *)&v65,
(__int64)SetupCameraEdgePopup::onCameraEdge,
v37 == 4,
v40,
(__int64)&v49,
a1,
v39,
0.60000002,
0.34999999,
0.0,
v41,
(const char *)&qword_140704F78,
1,
0,
nullptr);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v42 + 64LL))(v42, 4);
*((_BYTE *)v42 + 393) = 1;
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 1016), ToggleButton);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 1016), v30);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 1016), v36);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 1016), v42);
v57 = operator new(0x2C8u);
v43 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v57);
if ( v43 )
{
if ( ButtonSprite::init_1(
(__int64)v43,
(__int64)"Unlock",
35,
0,
1061997773,
1,
"goldFont.fnt",
(__int64)"GJ_button_05.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v43);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v43 + 8LL))(v43, 1);
LODWORD(v43) = 0;
}
}
v44 = CCMenuItemSpriteExtra::create((int)v43, 0, a1, (__int64)SetupCameraEdgePopup::onUnlockEdge);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v44);
v45 = *(_QWORD *)v44;
v46 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, (float)(v50 * 0.5) + 100.0, (float)(v51 * 0.5) - 20.0);
cocos2d::CCNode::convertToNodeSpace(v46, v61, v47);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v45 + 184))(v44, v48);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
*(_BYTE *)(a1 + 744) = 0;
return 1;
}
return result;
}