//
// SetupCameraModePopup::init from 0x1405ab580 to 0x1405ac036 (2742 bytes)
//
// 2 xrefs:
// > SetupCameraModePopup::create @ 0x1405ab535
// > ??> @ 0x14092d788
//
// 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 SetupCameraModePopup::init(_QWORD *a1, int a2, int a3, int a4)
{
char result; // al
__int64 v6; // rcx
cocos2d::CCObject *v7; // rax
__int64 v8; // rcx
cocos2d::CCObject *v9; // rax
__int64 v10; // rcx
__int64 v11; // rax
struct cocos2d::CCLabelBMFont *v12; // rdi
__int64 v13; // rbx
__int64 v14; // rax
cocos2d::CCObject *v15; // rbx
cocos2d::CCObject *v16; // rax
_QWORD *v17; // rax
_QWORD *v18; // rcx
const char *v19; // rdx
__int64 v20; // r8
char *v21; // rsi
__int64 v22; // rdi
__int64 v23; // rbx
__int64 v24; // rax
__int64 v25; // rax
float *v26; // rax
float *v27; // rbx
__int64 v28; // rdi
__int64 v29; // rsi
unsigned __int8 v30; // r14
__int64 v31; // rax
__int64 v32; // rax
cocos2d::CCArray *v33; // rbx
__int64 v34; // rdi
__int64 v35; // rsi
unsigned __int8 v36; // r14
float *v37; // rax
int v38; // eax
struct cocos2d::CCLabelBMFont *v39; // rax
__int64 v40; // rdi
__int64 v41; // rbx
__int64 v42; // rax
__int64 v43; // r8
cocos2d::CCLayer *v44; // rax
__int64 v45; // rax
__int64 v46; // rbx
__int64 v47; // rax
__int64 v48; // rcx
void (__fastcall **v49)(__int64, const char *); // rdi
__int64 v50; // rbx
cocos2d::CCString *v51; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v53; // rax
__int64 v54; // rax
__int64 v55; // rbx
__int64 v56; // rax
__int64 v57; // r8
cocos2d::CCLayer *v58; // rax
__int64 v59; // rax
__int64 v60; // rbx
__int64 v61; // rax
__int64 v62; // rcx
__int64 v63; // rsi
float Value; // xmm0_4
float v65; // xmm3_4
__int64 v66; // rdi
__int64 v67; // rbx
__int64 v68; // rax
__int128 *v69; // [rsp+88h] [rbp-80h] BYREF
__int128 v70; // [rsp+90h] [rbp-78h] BYREF
__int64 v71; // [rsp+A0h] [rbp-68h]
__int64 v72; // [rsp+A8h] [rbp-60h]
__int128 v73; // [rsp+B0h] [rbp-58h] BYREF
__int64 v74; // [rsp+C0h] [rbp-48h]
__int64 v75; // [rsp+C8h] [rbp-40h]
_BYTE v76[8]; // [rsp+D0h] [rbp-38h] BYREF
__int128 *v77; // [rsp+D8h] [rbp-30h] BYREF
_QWORD v78[11]; // [rsp+E0h] [rbp-28h] BYREF
float v79; // [rsp+180h] [rbp+78h] BYREF
float v80; // [rsp+184h] [rbp+7Ch]
result = SetupTriggerPopup::init((_DWORD)a1, a2, a3, a4, 1133248512, 1, 0);
if ( result )
{
v7 = (cocos2d::CCObject *)cocos2d::CCArray::create(v6);
a1[125] = v7;
cocos2d::CCObject::retain(v7);
v9 = (cocos2d::CCObject *)cocos2d::CCArray::create(v8);
a1[126] = v9;
cocos2d::CCObject::retain(v9);
(*(void (__fastcall **)(_QWORD *))(*a1 + 1096LL))(a1);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, &v79);
v12 = cocos2d::CCLabelBMFont::create("Camera Mode", "goldFont.fnt");
(*(void (__fastcall **)(_QWORD *, struct cocos2d::CCLabelBMFont *))(*a1 + 464LL))(a1, v12);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v12 + 160LL))(v12);
v13 = *(_QWORD *)v12;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v69,
v79 * 0.5,
(float)((float)(*((float *)a1 + 184) * 0.5) + (float)(v80 * 0.5)) - 18.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v13 + 184))(v12, v14);
v69 = (__int128 *)operator new(0x2C8u);
v15 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v69);
if ( v15 )
{
if ( ButtonSprite::init_1(
(__int64)v15,
(__int64)"OK",
40,
0,
1061997773,
1,
"goldFont.fnt",
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v15);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v15 + 8LL))(v15, 1);
LODWORD(v15) = 0;
}
}
v16 = CCMenuItemSpriteExtra::create((int)v15, 0, (int)a1, (__int64)sub_14009D628);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(*(_QWORD *)a1[69] + 464LL))(a1[69], v16);
v69 = &v70;
v70 = 0;
v71 = 0;
v72 = 0;
v17 = sub_14003D460(0x160u);
*(_QWORD *)&v70 = v17;
v71 = 345;
v72 = 351;
v18 = v17;
v19 = "Toggles Free Mode. This removes the borders for certain game modes.\n"
"Edit Camera Settings allows you to edit camera movement in Free Mode. Padding is how close the"
" player has to be to the top or bottom for the camera to follow.\n"
"Disable GridSnap removes default snapping to nearest grid space for the camera center.";
v20 = 2;
do
{
*(_OWORD *)v18 = *(_OWORD *)v19;
*((_OWORD *)v18 + 1) = *((_OWORD *)v19 + 1);
*((_OWORD *)v18 + 2) = *((_OWORD *)v19 + 2);
*((_OWORD *)v18 + 3) = *((_OWORD *)v19 + 3);
*((_OWORD *)v18 + 4) = *((_OWORD *)v19 + 4);
*((_OWORD *)v18 + 5) = *((_OWORD *)v19 + 5);
*((_OWORD *)v18 + 6) = *((_OWORD *)v19 + 6);
v18 += 16;
*((_OWORD *)v18 - 1) = *((_OWORD *)v19 + 7);
v19 += 128;
--v20;
}
while ( v20 );
*(_OWORD *)v18 = *(_OWORD *)v19;
*((_OWORD *)v18 + 1) = *((_OWORD *)v19 + 1);
*((_OWORD *)v18 + 2) = *((_OWORD *)v19 + 2);
*((_OWORD *)v18 + 3) = *((_OWORD *)v19 + 3);
*((_OWORD *)v18 + 4) = *((_OWORD *)v19 + 4);
v18[10] = *((_QWORD *)v19 + 10);
*((_BYTE *)v18 + 88) = v19[88];
*((_BYTE *)v17 + 345) = 0;
v73 = 0;
v74 = 4;
v75 = 15;
strcpy((char *)&v73, "Help");
v21 = InfoAlertButton::create((__int64)&v73, (__int64)&v70);
(*(void (__fastcall **)(_QWORD, char *))(*(_QWORD *)a1[69] + 464LL))(a1[69], v21);
v22 = *(_QWORD *)v21;
v23 = a1[69];
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v69,
(float)((float)(v79 * 0.5) - (float)(*((float *)a1 + 183) * 0.5)) + 18.0,
(float)((float)(*((float *)a1 + 184) * 0.5) + (float)(v80 * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(v23, &v77, v24);
(*(void (__fastcall **)(char *, __int64))(v22 + 184))(v21, v25);
*((_DWORD *)a1 + 160) = -1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v76, (float)(v79 * 0.5) - 120.0, (float)(v80 * 0.5) + 70.0);
v77 = &v70;
*((_QWORD *)&v70 + 1) = 101;
v71 = 9;
v72 = 15;
*(_QWORD *)&v70 = 0x646F4D2065657246LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v69, 8.0, 0.0);
v27 = v26;
v28 = a1[73];
v29 = a1[69];
v30 = *((_BYTE *)a1 + 1060);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v78, (const struct cocos2d::CCPoint *)v76);
GameToolbox::createToggleButton(
(const char *)&v70,
(__int64)SetupCameraModePopup::onUnboundMode,
v30,
v29,
v31,
(__int64)a1,
v28,
0.80000001,
0.44999999,
0.0,
v27,
(const char *)&qword_140704F78,
0,
0,
nullptr);
v78[0] = &v73;
v73 = 0;
v74 = 0;
v75 = 0;
*(_QWORD *)&v73 = sub_14003D460(0x20u);
v74 = 20;
v75 = 31;
strcpy((char *)v73, "Edit Camera\nSettings");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v77, 150.0, 0.0);
cocos2d::CCPoint::operator+(v76, &v69, v32);
v33 = (cocos2d::CCArray *)a1[125];
v34 = a1[73];
v35 = a1[69];
v36 = *((_BYTE *)a1 + 1061);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v70, 8.0, 0.0);
GameToolbox::createToggleButton(
(const char *)&v73,
(__int64)SetupCameraModePopup::onEditCameraSettings,
v36,
v35,
(__int64)&v69,
(__int64)a1,
v34,
0.80000001,
0.44999999,
0.0,
v37,
(const char *)&qword_140704F78,
0,
0,
v33);
*(_QWORD *)&v70 = &v73;
v73 = 0;
v74 = 0;
v75 = 0;
*(_QWORD *)&v73 = sub_14003D460(0x20u);
v74 = 16;
v75 = 31;
strcpy((char *)v73, "Disable\nGridSnap");
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v78,
(float)((float)(*((float *)a1 + 183) * 0.5) + (float)(v79 * 0.5)) - 90.0,
(float)((float)(*((float *)a1 + 184) * 0.5) + (float)(v80 * 0.5)) - 20.0);
SetupTriggerPopup::createToggleValueControl((_DWORD)a1, 370, (unsigned int)&v73, v38, 0, 0, 1, 1065353216);
v39 = cocos2d::CCLabelBMFont::create(" ", "goldFont.fnt");
a1[128] = v39;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)a1[73] + 464LL))(a1[73], v39);
v40 = *(_QWORD *)a1[128];
v41 = a1[128];
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v70, v79 * 0.5, (float)(v80 * 0.5) + 20.0);
(*(void (__fastcall **)(__int64, __int64))(v40 + 184))(v41, v42);
(*(void (__fastcall **)(_QWORD))(*(_QWORD *)a1[128] + 160LL))(a1[128]);
cocos2d::CCArray::addObject((cocos2d::CCArray *)a1[126], (struct cocos2d::CCObject *)a1[128]);
v44 = Slider::create(
(__int64)a1,
(__int64)SetupCameraModePopup::sliderChanged,
v43,
"slidergroove.png",
(__int64)"sliderthumb.png",
(__int64)"sliderthumbsel.png",
1.0);
a1[127] = v44;
(*(void (__fastcall **)(_QWORD, cocos2d::CCLayer *))(*(_QWORD *)a1[73] + 464LL))(a1[73], v44);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v70, 0.0, -30.0);
v46 = v45;
v47 = (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)a1[128] + 200LL))(a1[128]);
cocos2d::CCPoint::operator+(v47, &v69, v46);
(*(void (__fastcall **)(_QWORD, __int128 **))(*(_QWORD *)a1[127] + 184LL))(a1[127], &v69);
v48 = *(_QWORD *)(*(_QWORD *)(a1[127] + 408LL) + 456LL);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v48 + 64LL))(v48, 0);
cocos2d::CCArray::addObject((cocos2d::CCArray *)a1[126], (struct cocos2d::CCObject *)a1[127]);
v49 = *(void (__fastcall ***)(__int64, const char *))(a1[128] + 360LL);
v50 = a1[128];
v51 = cocos2d::CCString::createWithFormat("Easing: %i", *((_DWORD *)a1 + 258));
CString = cocos2d::CCString::getCString(v51);
(*v49)(v50 + 360, CString);
Slider::setValue(a1[127], (float)((float)*((int *)a1 + 258) - 1.0) / 39.0);
v53 = cocos2d::CCLabelBMFont::create(" ", "goldFont.fnt");
a1[131] = v53;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)a1[73] + 464LL))(a1[73], v53);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v70, 0.0, -60.0);
v55 = v54;
v56 = (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)a1[128] + 200LL))(a1[128]);
cocos2d::CCPoint::operator+(v56, &v69, v55);
(*(void (__fastcall **)(_QWORD, __int128 **))(*(_QWORD *)a1[131] + 184LL))(a1[131], &v69);
(*(void (__fastcall **)(_QWORD))(*(_QWORD *)a1[131] + 160LL))(a1[131]);
cocos2d::CCArray::addObject((cocos2d::CCArray *)a1[126], (struct cocos2d::CCObject *)a1[131]);
v58 = Slider::create(
(__int64)a1,
(__int64)SetupCameraModePopup::sliderChanged,
v57,
"slidergroove.png",
(__int64)"sliderthumb.png",
(__int64)"sliderthumbsel.png",
1.0);
a1[130] = v58;
(*(void (__fastcall **)(_QWORD, cocos2d::CCLayer *))(*(_QWORD *)a1[73] + 464LL))(a1[73], v58);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v70, 0.0, -30.0);
v60 = v59;
v61 = (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)a1[131] + 200LL))(a1[131]);
cocos2d::CCPoint::operator+(v61, &v69, v60);
(*(void (__fastcall **)(_QWORD, __int128 **))(*(_QWORD *)a1[130] + 184LL))(a1[130], &v69);
v62 = *(_QWORD *)(*(_QWORD *)(a1[130] + 408LL) + 456LL);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v62 + 64LL))(v62, 1);
cocos2d::CCArray::addObject((cocos2d::CCArray *)a1[126], (struct cocos2d::CCObject *)a1[130]);
SetupCameraModePopup::updateCameraPaddingLabel(a1);
v63 = a1[130];
SliderThumb::setValue(*(float **)(*(_QWORD *)(v63 + 408) + 456LL), *((float *)a1 + 264));
Value = SliderThumb::getValue(*(float **)(*(_QWORD *)(v63 + 408) + 456LL));
v65 = *(float *)(v63 + 432);
if ( (float)(v65 * Value) <= v65 )
v65 = v65 * Value;
v66 = **(_QWORD **)(v63 + 416);
v67 = *(_QWORD *)(v63 + 416);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v70, 0.0, 0.0, v65, *(float *)(v63 + 436));
(*(void (__fastcall **)(__int64, __int64))(v66 + 992))(v67, v68);
SetupCameraModePopup::updateItemVisibility(a1);
(*(void (__fastcall **)(_QWORD *))(*a1 + 1136LL))(a1);
if ( *((_BYTE *)a1 + 1062) )
SetupTriggerPopup::createMultiTriggerItemsDefaultVertical(a1);
*((_BYTE *)a1 + 744) = 0;
return 1;
}
return result;
}