//
// SetupCameraModePopup::init from 0x1004a8dc0 to 0x1004a9689 (2249 bytes)
//
// 1 xrefs:
// > SetupCameraModePopup::create @ 0x1004a8d72
//
// 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 __fastcall SetupCameraModePopup::init(SetupCameraModePopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool result; // al
cocos2d::CCArray *v5; // rax
cocos2d::CCArray *v6; // rdi
cocos2d::CCArray *v7; // rax
cocos2d::CCLabelBMFont *v8; // r15
ButtonSprite *v9; // rax
CCMenuItemSpriteExtra *v10; // rax
__int64 v11; // r14
cocos2d::CCMenu *m_buttonMenu; // r15
bool m_freeMode; // r13
cocos2d::CCMenu *v14; // r14
cocos2d::CCLayer *m_mainLayer; // r12
bool m_cameraSettingsEnabled; // r13
cocos2d::CCMenu *v17; // r14
cocos2d::CCLayer *v18; // r12
cocos2d::CCLabelBMFont *v19; // rax
cocos2d::CCLabelBMFont *m_cameraEasingLabel; // r14
Slider *v21; // rax
Slider *m_cameraEasingSlider; // r13
unsigned __int64 *v23; // r14
SliderThumb *Thumb; // rax
cocos2d::CCLabelBMFont *v25; // r14
cocos2d::CCString *v26; // rax
const char *CString; // rax
cocos2d::CCLabelBMFont *v28; // rax
cocos2d::CCLabelBMFont *m_cameraPaddingLabel; // r14
unsigned __int64 *v30; // r15
Slider *v31; // rax
Slider *m_cameraPaddingSlider; // r14
unsigned __int64 *v33; // r15
SliderThumb *v34; // rax
cocos2d::CCLabelBMFont *v35; // r14
double m_cameraPadding; // xmm0_8
cocos2d::CCString *v37; // rax
const char *v38; // rax
char v39; // [rsp+0h] [rbp-110h]
char v40; // [rsp+0h] [rbp-110h]
float v41; // [rsp+38h] [rbp-D8h] BYREF
char v42; // [rsp+40h] [rbp-D0h] BYREF
char v43[15]; // [rsp+41h] [rbp-CFh] BYREF
void *v44; // [rsp+50h] [rbp-C0h]
_QWORD v45[2]; // [rsp+58h] [rbp-B8h] BYREF
void *__p; // [rsp+68h] [rbp-A8h]
char v47; // [rsp+70h] [rbp-A0h] BYREF
char v48[15]; // [rsp+71h] [rbp-9Fh] BYREF
void *v49; // [rsp+80h] [rbp-90h] BYREF
_BYTE v50[24]; // [rsp+88h] [rbp-88h] BYREF
void *v51[3]; // [rsp+A0h] [rbp-70h] BYREF
unsigned __int64 v52; // [rsp+B8h] [rbp-58h] BYREF
void **v53; // [rsp+C0h] [rbp-50h]
unsigned __int64 v54; // [rsp+CCh] [rbp-44h] BYREF
float v55; // [rsp+D4h] [rbp-3Ch] BYREF
float v56; // [rsp+D8h] [rbp-38h]
double v57; // [rsp+DCh] [rbp-34h] BYREF
bool v58; // [rsp+E7h] [rbp-29h]
double v59; // 0:xmm0_8.8
double v60; // 0:xmm0_8.8
result = SetupTriggerPopup::init(a1, a2, a3, 400.0, 280.0, 1);
if ( result )
{
v58 = result;
v5 = (cocos2d::CCArray *)sub_10071F9E0(a1, a2);
a1->m_freeModeObjects = v5;
v6 = v5;
cocos2d::CCObject::retain(v5);
v7 = (cocos2d::CCArray *)sub_10071F9E0(v6, a2);
a1->m_cameraSettingsObjects = v7;
cocos2d::CCObject::retain(v7);
((void (__fastcall *)(SetupCameraModePopup *))a1->determineStartValues)(a1);
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v59 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v55);
v8 = cocos2d::CCLabelBMFont::create_3("Camera Mode", "goldFont.fnt");
((void (__fastcall *)(SetupCameraModePopup *, cocos2d::CCLabelBMFont *, double))a1->addChild)(a1, v8, v59);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v8->setScale)(v8, 0.69999999);
sub_10028CBE0((float *)&v52, v55 * 0.5, (float)((float)(a1->m_height * 0.5) + (float)(v56 * 0.5)) + -18.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))v8->setPosition)(v8, &v52);
v9 = ButtonSprite::create_1("OK", 40, 0, 0.80000001, 1, "goldFont.fnt", "GJ_button_01.png", 30.0);
v10 = CCMenuItemSpriteExtra::create(v9, nullptr, a1, (cocos2d::SEL_MenuHandler)0x529uLL);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v10);
v42 = 8;
strcpy(v43, "Help");
__p = operator new(0x160u);
v45[0] = 353;
v45[1] = 345;
strcpy(
(char *)__p,
"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.");
v11 = InfoAlertButton::create(&v42, v45, 1.0);
if ( (v45[0] & 1) != 0 )
operator delete(__p);
if ( (v42 & 1) != 0 )
operator delete(v44);
v53 = &v49;
((void (__fastcall *)(cocos2d::CCMenu *, __int64))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v11);
m_buttonMenu = a1->m_buttonMenu;
sub_10028CBE0(
(float *)&v57,
(float)((float)(v55 * 0.5) - (float)(a1->m_width * 0.5)) + 18.0,
(float)((float)(a1->m_height * 0.5) + (float)(v56 * 0.5)) + -18.0);
*(cocos2d::CCPoint *)&v60 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)&v52,
(const cocos2d::CCPoint *)m_buttonMenu);
(*(void (__fastcall **)(__int64, unsigned __int64 *, double))(*(_QWORD *)v11 + 184LL))(v11, &v52, v60);
a1->m_joystickConnected = -1;
sub_10028CBE0((float *)&v52, (float)(v55 * 0.5) + -120.0, (float)(v56 * 0.5) + 70.0);
v47 = 18;
strcpy(v48, "Free Mode");
m_freeMode = a1->m_freeMode;
v14 = a1->m_buttonMenu;
sub_10028CC60(&v57, (double *)&v52);
m_mainLayer = a1->m_mainLayer;
sub_10028CBE0((float *)&v54, 8.0, 0.0);
GameToolbox::createToggleButton(
(unsigned int)&v47,
(unsigned int)SetupCameraModePopup::onUnboundMode,
0,
m_freeMode,
(_DWORD)v14,
(unsigned int)&v57,
(__int64)a1,
(__int64)m_mainLayer,
(__int64)&v54,
(__int64)"bigFont.fnt",
0,
0,
0);
if ( (v47 & 1) != 0 )
operator delete(v49);
v53 = &v51[2];
strcpy((char *)v51, "(Edit Camera\nSettings");
m_cameraSettingsEnabled = a1->m_cameraSettingsEnabled;
v17 = a1->m_buttonMenu;
sub_10028CBE0((float *)&v54, 150.0, 0.0);
sub_10028CCE0(&v57, &v52, &v54);
v18 = a1->m_mainLayer;
sub_10028CBE0(&v41, 8.0, 0.0);
GameToolbox::createToggleButton(
(unsigned int)v51,
(unsigned int)SetupCameraModePopup::onEditCameraSettings,
0,
m_cameraSettingsEnabled,
(_DWORD)v17,
(unsigned int)&v57,
(__int64)a1,
(__int64)v18,
(__int64)&v41,
(__int64)"bigFont.fnt",
0,
0,
(__int64)a1->m_freeModeObjects);
if ( ((__int64)v51[0] & 1) != 0 )
operator delete(v51[2]);
strcpy(v50, " Disable\nGridSnap");
sub_10028CBE0(
(float *)&v57,
(float)((float)(a1->m_width * 0.5) + (float)(v55 * 0.5)) + -90.0,
(float)((float)(a1->m_height * 0.5) + (float)(v56 * 0.5)) + -20.0);
SetupTriggerPopup::createToggleValueControl((int)a1, 370, (__int128 *)v50, 1.0, (__int64)&v57, 0, 0, 1);
if ( (v50[0] & 1) != 0 )
operator delete(*(void **)&v50[16]);
v19 = cocos2d::CCLabelBMFont::create_3(" ", "goldFont.fnt");
a1->m_cameraEasingLabel = v19;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v19);
m_cameraEasingLabel = a1->m_cameraEasingLabel;
sub_10028CBE0((float *)&v57, v55 * 0.5, (float)(0.5 * v56) + 20.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))m_cameraEasingLabel->setPosition)(
m_cameraEasingLabel,
&v57);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_cameraEasingLabel->setScale)(
a1->m_cameraEasingLabel,
0.80000001);
sub_10071FCD0(a1->m_cameraSettingsObjects, a1->m_cameraEasingLabel);
v21 = Slider::create_2(a1, (cocos2d::SEL_MenuHandler)(unsigned __int64)SetupCameraModePopup::sliderChanged);
a1->m_cameraEasingSlider = v21;
((void (__fastcall *)(cocos2d::CCLayer *, Slider *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v21);
m_cameraEasingSlider = a1->m_cameraEasingSlider;
v23 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_cameraEasingLabel->getPosition)(a1->m_cameraEasingLabel);
sub_10028CBE0((float *)&v54, 0.0, -30.0);
sub_10028CCE0(&v57, v23, &v54);
((void (__fastcall *)(Slider *, double *))m_cameraEasingSlider->setPosition)(m_cameraEasingSlider, &v57);
Thumb = Slider::getThumb(a1->m_cameraEasingSlider);
((void (__fastcall *)(SliderThumb *, _QWORD))Thumb->setTag)(Thumb, 0);
sub_10071FCD0(a1->m_cameraSettingsObjects, a1->m_cameraEasingSlider);
v25 = a1->m_cameraEasingLabel;
v26 = (cocos2d::CCString *)sub_1007AB580("Easing: %i", v39);
CString = cocos2d::CCString::getCString(v26);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))v25->setString)(v25, CString);
Slider::setValue(a1->m_cameraEasingSlider, (float)((float)a1->m_cameraEasing + -1.0) / 39.0);
v28 = cocos2d::CCLabelBMFont::create_3(" ", "goldFont.fnt");
a1->m_cameraPaddingLabel = v28;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v28);
m_cameraPaddingLabel = a1->m_cameraPaddingLabel;
v30 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_cameraEasingLabel->getPosition)(a1->m_cameraEasingLabel);
sub_10028CBE0((float *)&v54, 0.0, -60.0);
sub_10028CCE0(&v57, v30, &v54);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))m_cameraPaddingLabel->setPosition)(
m_cameraPaddingLabel,
&v57);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_cameraPaddingLabel->setScale)(
a1->m_cameraPaddingLabel,
0.80000001);
sub_10071FCD0(a1->m_cameraSettingsObjects, a1->m_cameraPaddingLabel);
v31 = Slider::create_2(a1, (cocos2d::SEL_MenuHandler)(unsigned __int64)SetupCameraModePopup::sliderChanged);
a1->m_cameraPaddingSlider = v31;
((void (__fastcall *)(cocos2d::CCLayer *, Slider *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v31);
m_cameraPaddingSlider = a1->m_cameraPaddingSlider;
v33 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_cameraPaddingLabel->getPosition)(a1->m_cameraPaddingLabel);
sub_10028CBE0((float *)&v54, 0.0, -30.0);
sub_10028CCE0(&v57, v33, &v54);
((void (__fastcall *)(Slider *, double *))m_cameraPaddingSlider->setPosition)(m_cameraPaddingSlider, &v57);
v34 = Slider::getThumb(a1->m_cameraPaddingSlider);
((void (__fastcall *)(SliderThumb *, __int64))v34->setTag)(v34, 1);
sub_10071FCD0(a1->m_cameraSettingsObjects, a1->m_cameraPaddingSlider);
v35 = a1->m_cameraPaddingLabel;
m_cameraPadding = a1->m_cameraPadding;
v37 = (cocos2d::CCString *)sub_1007AB580("Padding: %.02f", v40);
v38 = cocos2d::CCString::getCString(v37);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *, double))v35->setString)(v35, v38, m_cameraPadding);
Slider::setValue(a1->m_cameraPaddingSlider, a1->m_cameraPadding);
SetupCameraModePopup::updateItemVisibility(a1);
((void (__fastcall *)(SetupCameraModePopup *))a1->updateDefaultTriggerValues)(a1);
if ( a1->m_cameraModeObjects )
SetupTriggerPopup::createMultiTriggerItemsDefaultVertical(a1);
a1->m_disableTextDelegate = 0;
return v58;
}
return result;
}