//
// SetupCameraModePopup::init from 0x140414140 to 0x140414bea (2730 bytes)
//
// 2 xrefs:
// > SetupCameraModePopup::create @ 0x1404140f5
// > ??> @ 0x1406d8e04
//
// 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 SetupCameraModePopup::init(SetupCameraModePopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool result; // al
__int64 v5; // rcx
cocos2d::CCArray *v6; // rax
__int64 v7; // rcx
cocos2d::CCArray *v8; // rax
__int64 v9; // rcx
cocos2d::CCDirector *v10; // rax
struct cocos2d::CCLabelBMFont *v11; // rdi
cocos2d::CCLabelBMFont_vtbl *v12; // rbx
const cocos2d::CCPoint *v13; // rax
ButtonSprite *v14; // rbx
CCMenuItemSpriteExtra *v15; // rax
_QWORD *v16; // rax
_QWORD *v17; // rcx
const char *v18; // rdx
__int64 v19; // r8
char *v20; // rdi
__int64 v21; // rbx
struct cocos2d::CCPoint v22; // rax
float v23; // xmm0_4
float *v24; // rax
float *v25; // rbx
struct cocos2d::CCPoint v26; // rax
double v27; // xmm0_8
float *v28; // rax
int v29; // eax
cocos2d::CCLabelBMFont *v30; // rax
float v31; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v32; // rbx
const cocos2d::CCPoint *v33; // rax
const char *v34; // r8
Slider *v35; // rax
float v36; // xmm0_4
const cocos2d::CCPoint *v37; // rax
SliderThumb *m_thumb; // rcx
Slider *m_cameraEasingSlider; // rdi
float Value; // xmm0_4
float m_width; // xmm3_4
cocos2d::CCSprite_vtbl *v42; // rbx
const cocos2d::CCRect *v43; // rax
cocos2d::CCLabelBMFont *v44; // rax
float v45; // xmm0_4
const cocos2d::CCPoint *v46; // rax
const char *v47; // r8
Slider *v48; // rax
float v49; // xmm0_4
const cocos2d::CCPoint *v50; // rax
SliderThumb *v51; // rcx
Slider *m_cameraPaddingSlider; // rdi
float v53; // xmm0_4
float v54; // xmm3_4
cocos2d::CCSprite_vtbl *v55; // rbx
const cocos2d::CCRect *v56; // rax
ButtonSprite *v57; // [rsp+88h] [rbp-80h] BYREF
cocos2d::CCRect v58; // [rsp+90h] [rbp-78h] BYREF
__int64 v59; // [rsp+A0h] [rbp-68h]
__int64 v60; // [rsp+A8h] [rbp-60h]
__int128 v61; // [rsp+B0h] [rbp-58h] BYREF
__int64 v62; // [rsp+C0h] [rbp-48h]
__int64 v63; // [rsp+C8h] [rbp-40h]
char v64[8]; // [rsp+D0h] [rbp-38h] BYREF
cocos2d::CCRect *v65; // [rsp+D8h] [rbp-30h] BYREF
__int128 *v66; // [rsp+E0h] [rbp-28h] BYREF
float v67; // [rsp+180h] [rbp+78h]
float v68; // [rsp+184h] [rbp+7Ch]
result = SetupTriggerPopup::init(a1, a2, a3, 400.0, 280.0, 1);
if ( result )
{
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
a1->m_freeModeObjects = v6;
cocos2d::CCObject::retain(v6);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
a1->m_cameraSettingsObjects = v8;
cocos2d::CCObject::retain(v8);
a1->determineStartValues(a1);
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::getWinSize(v10);
v11 = cocos2d::CCLabelBMFont::create("Camera Mode", "goldFont.fnt");
a1->addChild_1(a1, v11);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v11->setScale_0)(v11);
v12 = v11->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v68 * 0.5, v67 * 0.5);
v12->setPosition_0(v11, v13);
v57 = (ButtonSprite *)operator new(0x2C0u);
v14 = ButtonSprite::ButtonSprite(v57);
if ( v14 )
{
if ( ButtonSprite::init_1(v14, "OK", 40, 0, 0.80000001, 1, "goldFont.fnt", "GJ_button_01.png", 30.0) )
{
cocos2d::CCObject::autorelease(v14);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v14->~ButtonSprite)(v14, 1);
v14 = nullptr;
}
}
v15 = CCMenuItemSpriteExtra::create(v14, nullptr, a1, (cocos2d::SEL_MenuHandler *)sub_14009BEF0);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v15);
v57 = (ButtonSprite *)&v58;
v58 = 0;
v59 = 0;
v60 = 15;
v16 = sub_14003AA10(0x160u);
v58.origin = (cocos2d::CCPoint)v16;
v59 = 345;
v60 = 351;
v17 = v16;
v18 = "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.";
v19 = 2;
do
{
*(_OWORD *)v17 = *(_OWORD *)v18;
*((_OWORD *)v17 + 1) = *((_OWORD *)v18 + 1);
*((_OWORD *)v17 + 2) = *((_OWORD *)v18 + 2);
*((_OWORD *)v17 + 3) = *((_OWORD *)v18 + 3);
*((_OWORD *)v17 + 4) = *((_OWORD *)v18 + 4);
*((_OWORD *)v17 + 5) = *((_OWORD *)v18 + 5);
*((_OWORD *)v17 + 6) = *((_OWORD *)v18 + 6);
v17 += 16;
*((_OWORD *)v17 - 1) = *((_OWORD *)v18 + 7);
v18 += 128;
--v19;
}
while ( v19 );
*(_OWORD *)v17 = *(_OWORD *)v18;
*((_OWORD *)v17 + 1) = *((_OWORD *)v18 + 1);
*((_OWORD *)v17 + 2) = *((_OWORD *)v18 + 2);
*((_OWORD *)v17 + 3) = *((_OWORD *)v18 + 3);
*((_OWORD *)v17 + 4) = *((_OWORD *)v18 + 4);
v17[10] = *((_QWORD *)v18 + 10);
*((_BYTE *)v17 + 88) = v18[88];
*((_BYTE *)v16 + 345) = 0;
v61 = 0;
v62 = 4;
v63 = 15;
strcpy((char *)&v61, "Help");
v20 = InfoAlertButton::create((__int64)&v61, (__int64)&v58);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, (cocos2d::CCNode *)v20);
v21 = *(_QWORD *)v20;
cocos2d::CCPoint::CCPoint(a1->m_width * 0.5, (float)((float)(v67 * 0.5) - (float)(a1->m_width * 0.5)) + 18.0);
v22 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v65);
v23 = (*(float (__fastcall **)(char *, struct cocos2d::CCPoint))(v21 + 184))(v20, v22);
a1->m_joystickConnected = -1;
cocos2d::CCPoint::CCPoint(v23, (float)(v67 * 0.5) - 120.0);
v65 = &v58;
v58.size = (cocos2d::CCSize)101LL;
v59 = 9;
v60 = 15;
v58.origin = (cocos2d::CCPoint)0x646F4D2065657246LL;
cocos2d::CCPoint::CCPoint(6.7720619e22, 8.0);
v25 = v24;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v66);
GameToolbox::createToggleButton(
(const char *)&v58,
(cocos2d::SEL_MenuHandler *)SetupCameraModePopup::onUnboundMode,
a1->m_freeMode,
a1->m_buttonMenu,
v26,
a1,
a1->m_mainLayer,
0.80000001,
0.44999999,
0.0,
v25,
(const char *)&qword_14052A4D8,
0,
0,
nullptr);
v66 = &v61;
v61 = 0;
v62 = 0;
v63 = 15;
*(_QWORD *)&v61 = sub_14003AA10(0x20u);
v62 = 20;
v63 = 31;
strcpy((char *)v61, "Edit Camera\nSettings");
cocos2d::CCPoint::CCPoint(7.3964775e31, 150.0);
v27 = cocos2d::CCPoint::operator+(v64, &v57);
cocos2d::CCPoint::CCPoint(*(float *)&v27, 8.0);
GameToolbox::createToggleButton(
(const char *)&v61,
(cocos2d::SEL_MenuHandler *)SetupCameraModePopup::onEditCameraSettings,
a1->m_cameraSettingsEnabled,
a1->m_buttonMenu,
(struct cocos2d::CCPoint)&v57,
a1,
a1->m_mainLayer,
0.80000001,
0.44999999,
0.0,
v28,
(const char *)&qword_14052A4D8,
0,
0,
a1->m_freeModeObjects);
v58.origin = (cocos2d::CCPoint)&v61;
v61 = 0;
v62 = 0;
v63 = 15;
*(_QWORD *)&v61 = sub_14003AA10(0x20u);
v62 = 16;
v63 = 31;
strcpy((char *)v61, "Disable\nGridSnap");
cocos2d::CCPoint::CCPoint(a1->m_width * 0.5, (float)((float)(v67 * 0.5) + (float)(a1->m_width * 0.5)) - 90.0);
SetupTriggerPopup::createToggleValueControl((_DWORD)a1, 370, (unsigned int)&v61, v29, 0, 0, 1, 1065353216);
v30 = cocos2d::CCLabelBMFont::create(" ", "goldFont.fnt");
a1->m_cameraEasingLabel = v30;
v31 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild_1)(
a1->m_mainLayer,
v30);
v32 = a1->m_cameraEasingLabel->__vftable;
cocos2d::CCPoint::CCPoint(v31, v67 * 0.5);
v32->setPosition_0(a1->m_cameraEasingLabel, v33);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_cameraEasingLabel->setScale_0)(a1->m_cameraEasingLabel);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraEasingLabel);
v35 = Slider::create(
a1,
(cocos2d::SEL_MenuHandler *)SetupCameraModePopup::sliderChanged,
v34,
"slidergroove.png",
"sliderthumb.png",
"sliderthumbsel.png",
1.0);
a1->m_cameraEasingSlider = v35;
v36 = ((float (__fastcall *)(cocos2d::CCLayer *, Slider *))a1->m_mainLayer->addChild_1)(a1->m_mainLayer, v35);
cocos2d::CCPoint::CCPoint(v36, 0.0);
v37 = a1->m_cameraEasingLabel->getPosition_0(a1->m_cameraEasingLabel);
cocos2d::CCPoint::operator+(v37, &v57);
a1->m_cameraEasingSlider->setPosition_0(a1->m_cameraEasingSlider, (const cocos2d::CCPoint *)&v57);
m_thumb = a1->m_cameraEasingSlider->m_touchLogic->m_thumb;
m_thumb->setTag(m_thumb, 0);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraEasingSlider);
SetupCameraModePopup::updateCameraEasingLabel(a1);
m_cameraEasingSlider = a1->m_cameraEasingSlider;
SliderThumb::setValue(m_cameraEasingSlider->m_touchLogic->m_thumb, (float)((float)a1->m_cameraEasing - 1.0) / 39.0);
Value = SliderThumb::getValue(m_cameraEasingSlider->m_touchLogic->m_thumb);
m_width = m_cameraEasingSlider->m_width;
if ( (float)(m_width * Value) <= m_width )
m_width = Value * m_width;
v42 = m_cameraEasingSlider->m_sliderBar->__vftable;
cocos2d::CCRect::CCRect(&v58, 0.0, 0.0, m_width, m_cameraEasingSlider->m_height);
v42->setTextureRect_0(m_cameraEasingSlider->m_sliderBar, v43);
v44 = cocos2d::CCLabelBMFont::create(" ", "goldFont.fnt");
a1->m_cameraPaddingLabel = v44;
v45 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild_1)(
a1->m_mainLayer,
v44);
cocos2d::CCPoint::CCPoint(v45, 0.0);
v46 = a1->m_cameraEasingLabel->getPosition_0(a1->m_cameraEasingLabel);
cocos2d::CCPoint::operator+(v46, &v57);
a1->m_cameraPaddingLabel->setPosition_0(a1->m_cameraPaddingLabel, (const cocos2d::CCPoint *)&v57);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_cameraPaddingLabel->setScale_0)(a1->m_cameraPaddingLabel);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraPaddingLabel);
v48 = Slider::create(
a1,
(cocos2d::SEL_MenuHandler *)SetupCameraModePopup::sliderChanged,
v47,
"slidergroove.png",
"sliderthumb.png",
"sliderthumbsel.png",
1.0);
a1->m_cameraPaddingSlider = v48;
v49 = ((float (__fastcall *)(cocos2d::CCLayer *, Slider *))a1->m_mainLayer->addChild_1)(a1->m_mainLayer, v48);
cocos2d::CCPoint::CCPoint(v49, 0.0);
v50 = a1->m_cameraPaddingLabel->getPosition_0(a1->m_cameraPaddingLabel);
cocos2d::CCPoint::operator+(v50, &v57);
a1->m_cameraPaddingSlider->setPosition_0(a1->m_cameraPaddingSlider, (const cocos2d::CCPoint *)&v57);
v51 = a1->m_cameraPaddingSlider->m_touchLogic->m_thumb;
v51->setTag(v51, 1);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraPaddingSlider);
SetupCameraModePopup::updateCameraPaddingLabel(a1);
m_cameraPaddingSlider = a1->m_cameraPaddingSlider;
SliderThumb::setValue(m_cameraPaddingSlider->m_touchLogic->m_thumb, a1->m_cameraPadding);
v53 = SliderThumb::getValue(m_cameraPaddingSlider->m_touchLogic->m_thumb);
v54 = m_cameraPaddingSlider->m_width;
if ( (float)(v53 * v54) <= v54 )
v54 = v54 * v53;
v55 = m_cameraPaddingSlider->m_sliderBar->__vftable;
cocos2d::CCRect::CCRect(&v58, 0.0, 0.0, v54, m_cameraPaddingSlider->m_height);
v55->setTextureRect_0(m_cameraPaddingSlider->m_sliderBar, v56);
SetupCameraModePopup::updateItemVisibility(a1);
a1->updateDefaultTriggerValues(a1);
if ( a1->m_cameraModeObjects )
SetupTriggerPopup::createMultiTriggerItemsDefaultVertical(a1);
a1->m_disableTextDelegate = 0;
return 1;
}
return result;
}