//
// SetupCameraModePopup::init from 0xa1643c to 0xa16e08 (2508 bytes)
//
// 2 xrefs:
// > SetupCameraModePopup::create @ 0xa16fc8
// > ??> @ 0xbf6d0
//
// 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
//
bool SetupCameraModePopup::init(SetupCameraModePopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
_BOOL8 v4; // x0
bool v5; // w24
cocos2d::CCArray *v7; // x0
cocos2d::CCArray *v8; // x0
cocos2d::CCDirector *v9; // x0
cocos2d::CCLabelBMFont *v10; // x23
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28
const char *v12; // x6
cocos2d::CCNode *v13; // x0
CCMenuItemSpriteExtra *v14; // x0
cocos2d::CCNode *v15; // x25
void *v16; // x0
void *v17; // x0
float v18; // s0
float v19; // s1
void (__fastcall *v20)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28
float v21; // s1
float v22; // s2
cocos2d::CCMenu *v23; // x3
void *v24; // x0
cocos2d::CCMenu *v25; // x2
cocos2d::CCLayer *v26; // x26
void *v27; // x0
void *v28; // x0
cocos2d::CCLabelBMFont *v29; // x0
cocos2d::CCLayer *v30; // x2
cocos2d::CCLabelBMFont *m_cameraEasingLabel; // x26
void (__fastcall *v32)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
Slider *v33; // x0
cocos2d::CCLayer *v34; // x2
Slider *m_cameraEasingSlider; // x26
void (__fastcall *v36)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
SliderThumb *Thumb; // x0
cocos2d::CCLabelBMFont *v38; // x0
cocos2d::CCLayer *v39; // x2
cocos2d::CCLabelBMFont *m_cameraPaddingLabel; // x23
void (__fastcall *v41)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
const cocos2d::CCPoint *v42; // x26
Slider *v43; // x0
cocos2d::CCLayer *v44; // x2
Slider *m_cameraPaddingSlider; // x23
void (__fastcall *v46)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
const cocos2d::CCPoint *v47; // x26
SliderThumb *v48; // x0
unsigned int *v49; // x1
int v50; // w2
unsigned int *v51; // x1
int v52; // w2
unsigned int *v53; // x1
int v54; // w2
unsigned int *v55; // x1
int v56; // w2
unsigned int *v57; // x1
int v58; // w2
_QWORD v59[2]; // [xsp+30h] [xbp+0h] BYREF
cocos2d::CCLayer *m_mainLayer; // [xsp+A8h] [xbp+78h]
cocos2d::CCMenu *v61; // [xsp+B0h] [xbp+80h]
cocos2d::CCNode *m_buttonMenu; // [xsp+B8h] [xbp+88h]
float v63; // [xsp+C8h] [xbp+98h]
float v64; // [xsp+CCh] [xbp+9Ch]
cocos2d::CCPoint v65; // [xsp+D0h] [xbp+A0h] BYREF
cocos2d::CCPoint v66; // [xsp+D8h] [xbp+A8h] BYREF
cocos2d::CCPoint v67; // [xsp+E0h] [xbp+B0h] BYREF
cocos2d::CCPoint v68; // [xsp+E8h] [xbp+B8h] BYREF
cocos2d::CCPoint v69; // [xsp+F0h] [xbp+C0h] BYREF
cocos2d::CCPoint v70; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v71; // 0:x1.16
cocos2d::SEL_MenuHandler v72; // 0:x1.16
cocos2d::SEL_MenuHandler v73; // 0:x2.16
v4 = SetupTriggerPopup::init(a1, a2, a3, 400.0, 280.0, 1);
v5 = v4;
if ( v4 )
{
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v4);
a1->m_freeModeObjects = v7;
cocos2d::CCObject::retain(v7);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)"icon_299");
a1->m_cameraSettingsObjects = v8;
cocos2d::CCObject::retain(v8);
a1->determineStartValues(a1);
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
v10 = cocos2d::CCLabelBMFont::create();
a1->addChild(a1, v10);
v10->setScale(v10, 0.7);
setPosition = v10->setPosition;
cocos2d::CCPoint::CCPoint(&v69, v63 * 0.5, (float)((float)(a1->m_height * 0.5) + (float)(v64 * 0.5)) - 18.0);
setPosition(v10, &v69);
v13 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v12,
30.0);
v73.adj = 1320;
v73.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v14 = CCMenuItemSpriteExtra::create(v13, nullptr, v73);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v14);
sub_D153B8((unsigned int)v59 + 184, "Help");
sub_D153B8(
(unsigned int)v59 + 192,
"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 pla"
"yer 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.");
v15 = (cocos2d::CCNode *)InfoAlertButton::create(1.0);
v16 = (void *)(*(_QWORD *)&v69 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v69 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v51 = (unsigned int *)(*(_QWORD *)&v69 - 8LL);
do
v52 = __ldaxr(v51);
while ( __stlxr(v52 - 1, v51) );
}
else
{
v52 = *(_DWORD *)(*(_QWORD *)&v69 - 8LL);
*(_DWORD *)(*(_QWORD *)&v69 - 8LL) = v52 - 1;
}
if ( v52 <= 0 )
operator delete(v16);
}
v17 = (void *)(*(_QWORD *)&v68 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v68 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v55 = (unsigned int *)(*(_QWORD *)&v68 - 8LL);
do
v56 = __ldaxr(v55);
while ( __stlxr(v56 - 1, v55) );
}
else
{
v56 = *(_DWORD *)(*(_QWORD *)&v68 - 8LL);
*(_DWORD *)(*(_QWORD *)&v68 - 8LL) = v56 - 1;
}
if ( v56 <= 0 )
operator delete(v17);
}
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v15);
v18 = a1->m_width * 0.5;
v19 = a1->m_height * 0.5;
v20 = v15->setPosition;
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v68, 18.0 - (float)(v18 - (float)(v63 * 0.5)), (float)(v19 + (float)(v64 * 0.5)) - 18.0);
v70 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v68);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCPoint *, float, float))v20)(v15, &v69, v70.x, v70.y);
v21 = v63;
v22 = v64;
a1->m_joystickConnected = -1;
cocos2d::CCPoint::CCPoint(&v65, (float)(v21 * 0.5) + -120.0, (float)(v22 * 0.5) + 70.0);
sub_D153B8((unsigned int)v59 + 184, "Free Mode");
v23 = a1->m_buttonMenu;
LODWORD(m_buttonMenu) = a1->m_freeMode;
v61 = v23;
cocos2d::CCPoint::CCPoint(&v69, &v65);
m_mainLayer = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v67, 8.0, 0.0);
GameToolbox::createToggleButton(
0.8,
0.45,
0.0,
(__int64)&v68,
(void (__cdecl *)(cocos2d::CCObject *))SetupCameraModePopup::onUnboundMode,
0,
(bool)m_buttonMenu,
v61,
&v69,
a1,
m_mainLayer,
(float *)&v67,
(__int64)"bigFont.fnt",
0,
0,
nullptr);
v24 = (void *)(*(_QWORD *)&v68 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v68 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v53 = (unsigned int *)(*(_QWORD *)&v68 - 8LL);
do
v54 = __ldaxr(v53);
while ( __stlxr(v54 - 1, v53) );
}
else
{
v54 = *(_DWORD *)(*(_QWORD *)&v68 - 8LL);
*(_DWORD *)(*(_QWORD *)&v68 - 8LL) = v54 - 1;
}
if ( v54 <= 0 )
operator delete(v24);
}
sub_D153B8((int)&v69, "Edit Camera\nSettings");
v25 = a1->m_buttonMenu;
LODWORD(m_buttonMenu) = a1->m_cameraSettingsEnabled;
v61 = v25;
cocos2d::CCPoint::CCPoint(&v66, 150.0, 0.0);
cocos2d::CCPoint::operator+(&v67, &v65, &v66);
v26 = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v68, 8.0, 0.0);
GameToolbox::createToggleButton(
0.8,
0.45,
0.0,
(__int64)&v69,
(void (__cdecl *)(cocos2d::CCObject *))SetupCameraModePopup::onEditCameraSettings,
0,
(bool)m_buttonMenu,
v61,
&v67,
a1,
v26,
(float *)&v68,
(__int64)"bigFont.fnt",
0,
0,
a1->m_freeModeObjects);
v27 = (void *)(*(_QWORD *)&v69 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v69 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v57 = (unsigned int *)(*(_QWORD *)&v69 - 8LL);
do
v58 = __ldaxr(v57);
while ( __stlxr(v58 - 1, v57) );
}
else
{
v58 = *(_DWORD *)(*(_QWORD *)&v69 - 8LL);
*(_DWORD *)(*(_QWORD *)&v69 - 8LL) = v58 - 1;
}
if ( v58 <= 0 )
operator delete(v27);
}
sub_D153B8((unsigned int)v59 + 192, "Disable\nGridSnap");
cocos2d::CCPoint::CCPoint(
&v68,
(float)((float)(a1->m_width * 0.5) + (float)(v63 * 0.5)) - 90.0,
(float)((float)(a1->m_height * 0.5) + (float)(v64 * 0.5)) - 20.0);
SetupTriggerPopup::createToggleValueControl(a1, 370, 1.0, (__int64)&v69, &v68, 0, 0, 1);
v28 = (void *)(*(_QWORD *)&v69 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v69 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v49 = (unsigned int *)(*(_QWORD *)&v69 - 8LL);
do
v50 = __ldaxr(v49);
while ( __stlxr(v50 - 1, v49) );
}
else
{
v50 = *(_DWORD *)(*(_QWORD *)&v69 - 8LL);
*(_DWORD *)(*(_QWORD *)&v69 - 8LL) = v50 - 1;
}
if ( v50 <= 0 )
operator delete(v28);
}
v29 = cocos2d::CCLabelBMFont::create();
v30 = a1->m_mainLayer;
a1->m_cameraEasingLabel = v29;
v30->addChild(v30, v29);
m_cameraEasingLabel = a1->m_cameraEasingLabel;
v32 = m_cameraEasingLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v69, v63 * 0.5, (float)(v64 * 0.5) + 20.0);
v32(m_cameraEasingLabel, &v69);
a1->m_cameraEasingLabel->setScale(a1->m_cameraEasingLabel, 0.8);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraEasingLabel);
v71.ptr = (void (__cdecl *)(cocos2d::CCObject *))SetupCameraModePopup::sliderChanged;
v71.adj = 0;
v33 = Slider::create(a1, v71);
v34 = a1->m_mainLayer;
a1->m_cameraEasingSlider = v33;
v34->addChild(v34, v33);
m_cameraEasingSlider = a1->m_cameraEasingSlider;
v36 = m_cameraEasingSlider->setPosition;
m_buttonMenu = (cocos2d::CCNode *)a1->m_cameraEasingLabel->getPosition(a1->m_cameraEasingLabel);
cocos2d::CCPoint::CCPoint(&v68, 0.0, -30.0);
cocos2d::CCPoint::operator+(&v69, m_buttonMenu, &v68);
v36(m_cameraEasingSlider, &v69);
Thumb = Slider::getThumb(a1->m_cameraEasingSlider);
Thumb->setTag(Thumb, 0);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraEasingSlider);
SetupCameraModePopup::updateCameraEasingLabel(a1);
Slider::setValue(a1->m_cameraEasingSlider, (float)((float)a1->m_cameraEasing - 1.0) / 39.0);
v38 = cocos2d::CCLabelBMFont::create();
v39 = a1->m_mainLayer;
a1->m_cameraPaddingLabel = v38;
v39->addChild(v39, v38);
m_cameraPaddingLabel = a1->m_cameraPaddingLabel;
v41 = m_cameraPaddingLabel->setPosition;
v42 = a1->m_cameraEasingLabel->getPosition(a1->m_cameraEasingLabel);
cocos2d::CCPoint::CCPoint(&v68, 0.0, -60.0);
cocos2d::CCPoint::operator+(&v69, v42, &v68);
v41(m_cameraPaddingLabel, &v69);
a1->m_cameraPaddingLabel->setScale(a1->m_cameraPaddingLabel, 0.8);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraPaddingLabel);
v72.ptr = (void (__cdecl *)(cocos2d::CCObject *))SetupCameraModePopup::sliderChanged;
v72.adj = 0;
v43 = Slider::create(a1, v72);
v44 = a1->m_mainLayer;
a1->m_cameraPaddingSlider = v43;
v44->addChild(v44, v43);
m_cameraPaddingSlider = a1->m_cameraPaddingSlider;
v46 = m_cameraPaddingSlider->setPosition;
v47 = a1->m_cameraPaddingLabel->getPosition(a1->m_cameraPaddingLabel);
cocos2d::CCPoint::CCPoint(&v68, 0.0, -30.0);
cocos2d::CCPoint::operator+(&v69, v47, &v68);
v46(m_cameraPaddingSlider, &v69);
v48 = Slider::getThumb(a1->m_cameraPaddingSlider);
v48->setTag(v48, 1);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraPaddingSlider);
SetupCameraModePopup::updateCameraPaddingLabel(a1);
Slider::setValue(a1->m_cameraPaddingSlider, a1->m_cameraPadding);
SetupCameraModePopup::updateItemVisibility(a1);
a1->updateDefaultTriggerValues(a1);
if ( a1->m_cameraModeObjects )
SetupTriggerPopup::createMultiTriggerItemsDefaultVertical(a1);
a1->m_disableTextDelegate = 0;
}
return v5;
}