//
// SetupPortalPopup::init from 0x503434 to 0x503a96 (1634 bytes)
//
// 1 xrefs:
// > SetupPortalPopup::create @ 0x503b7a
//
// 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 SetupPortalPopup::init(SetupPortalPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCObject *v6; // r0
cocos2d::CCArray *v7; // r0
cocos2d::CCArray *v8; // r0
cocos2d::CCArray *v9; // r0
cocos2d::CCArray *v10; // r0
cocos2d::CCDirector *v11; // r0
cocos2d::CCNode *v12; // r6
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r7
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCLabelBMFont *v15; // r6
void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCMenu *v17; // r0
const char *v18; // r1
ButtonSprite *v19; // r0
CCMenuItemSpriteExtra *v20; // r0
cocos2d::CCMenu *m_buttonMenu; // r6
void (__fastcall *v22)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
CCMenuItemSpriteExtra *v23; // r6
cocos2d::CCMenu *v24; // r10
void (__fastcall *v25)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCMenu *v26; // r11
cocos2d::CCLayer *m_mainLayer; // r10
cocos2d::CCMenu *v28; // r11
cocos2d::CCLabelBMFont *v29; // r1
cocos2d::CCLabelBMFont *m_cameraEasingLabel; // r11
void (__fastcall *v31)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
Slider *v32; // r0
Slider *m_cameraEasingSlider; // r11
const cocos2d::CCPoint *v34; // r8
SliderThumb *Thumb; // r0
cocos2d::CCLabelBMFont *v36; // r0
cocos2d::CCLabelBMFont *m_cameraPaddingLabel; // r9
void (__fastcall *v38)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
const cocos2d::CCPoint *v39; // r11
Slider *v40; // r0
Slider *m_cameraPaddingSlider; // r5
void (__fastcall *v42)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
const cocos2d::CCPoint *v43; // r10
SliderThumb *v44; // r0
float v46; // r2
float v47; // r3
int v48; // [sp+30h] [bp-64h]
bool m_freeMode; // [sp+34h] [bp-60h]
cocos2d::CCLayer *v50; // [sp+34h] [bp-60h]
void (__fastcall *v51)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+3Ch] [bp-58h]
cocos2d::CCSize v52; // [sp+44h] [bp-50h] BYREF
cocos2d::CCPoint v53; // [sp+4Ch] [bp-48h] BYREF
cocos2d::CCPoint v54; // [sp+54h] [bp-40h] BYREF
void (*v55)(SetupPortalPopup *, cocos2d::CCObject *); // [sp+5Ch] [bp-38h]
int v56; // [sp+60h] [bp-34h]
void (*v57)(SetupPortalPopup *, cocos2d::CCObject *); // [sp+64h] [bp-30h]
unsigned int v58; // [sp+68h] [bp-2Ch]
void (*v59)(SetupPortalPopup *, cocos2d::CCObject *); // [sp+6Ch] [bp-28h] BYREF
unsigned int v60; // [sp+70h] [bp-24h]
cocos2d::CCPoint v61; // [sp+74h] [bp-20h] BYREF
cocos2d::CCRect v62; // [sp+7Ch] [bp-18h] BYREF
cocos2d::CCSize v63; // 0:^0.8
cocos2d::CCRect v64; // 0:kr00_16.16
v48 = FLAlertLayer::init(a1, (cocos2d::_ccColor4B)200);
if ( v48 )
{
if ( a2 )
{
a1->m_gameObjects = (cocos2d::CCArray *)a2;
v6 = a2;
}
else
{
v6 = a3;
a1->m_gameObject = (EffectGameObject *)a3;
}
cocos2d::CCObject::retain(v6);
a1->m_noElasticity = 1;
a1->m_disableDelegate = 1;
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
a1->m_freeModeObjects = v8;
cocos2d::CCObject::retain(v8);
v10 = (cocos2d::CCArray *)cocos2d::CCArray::create(v9);
a1->m_cameraSettingsObjects = v10;
cocos2d::CCObject::retain(v10);
v11 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v52, v11);
cocos2d::CCRect::CCRect(&v62, 0.0, 0.0, 80.0, 80.0);
v64.origin.x = v46;
v64.origin.y = v47;
v64.size = v63;
v12 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v62,
v64);
setContentSize = v12->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v62, 430.0, 310.0);
setContentSize(v12, (const cocos2d::CCSize *)&v62);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v12, -1);
setPosition = v12->setPosition;
cocos2d::CCPoint::CCPoint(&v62.origin, v52.width * 0.5, v52.height * 0.5);
setPosition(v12, &v62.origin);
v15 = cocos2d::CCLabelBMFont::create();
v16 = v15->setPosition;
cocos2d::CCPoint::CCPoint(&v62.origin, v52.width * 0.5, (float)((float)(v52.height * 0.5) + 155.0) - 15.0);
v16(v15, &v62.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v15);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v15->setScale)(v15, 1058642330);
v17 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v17;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v17, 10);
a1->m_joystickConnected = -1;
v19 = ButtonSprite::create((ButtonSprite *)"OK", v18);
v56 = 0;
v55 = SetupPortalPopup::onClose;
v20 = CCMenuItemSpriteExtra::create(
v19,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SetupPortalPopup::onClose, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v20);
m_buttonMenu = a1->m_buttonMenu;
v22 = m_buttonMenu->setPosition;
cocos2d::CCPoint::CCPoint(&v62.origin, v52.width * 0.5, (float)((float)(v52.height * 0.5) - 155.0) + 25.0);
v22(m_buttonMenu, &v62.origin);
sub_776584((int)&v61, "Portal Help");
sub_776584((int)&v62, "No time for help.");
v23 = InfoAlertButton::create((int)&v61, (int)&v62, 1065353216);
sub_774008(&v62);
sub_774008(&v61);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v23);
v24 = a1->m_buttonMenu;
v25 = v23->setPosition;
cocos2d::CCPoint::CCPoint(
&v61,
(float)((float)(v52.width * 0.5) + 215.0) - 18.0,
(float)((float)(v52.height * 0.5) + 155.0) - 18.0);
cocos2d::CCNode::convertToNodeSpace(&v62.origin, v24, &v61);
v25(v23, &v62.origin);
SetupPortalPopup::determineStartValues(a1);
sub_776584((int)&v59, "Free Mode");
v26 = a1->m_buttonMenu;
v57 = SetupPortalPopup::onUnboundMode;
v58 = 0;
m_freeMode = a1->m_freeMode;
cocos2d::CCPoint::CCPoint(
&v61,
(float)((float)(v52.width * 0.5) - 215.0) + 20.0,
(float)((float)(v52.height * 0.5) + 155.0) - 20.0);
m_mainLayer = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v62.origin, 8.0, 0.0);
GameToolbox::createToggleButton(
(int)&v59,
(unsigned int)v57,
v58,
m_freeMode,
v26,
&v61,
a1,
m_mainLayer,
0.8,
0.45,
0.0,
(int)&v62,
(int)"bigFont.fnt",
0,
0,
nullptr);
sub_774008(&v59);
sub_776584((int)&v54, "Edit Camera\nSettings");
LOBYTE(m_mainLayer) = a1->m_cameraSettingsEnabled;
v28 = a1->m_buttonMenu;
v59 = SetupPortalPopup::onEditCameraSettings;
v60 = 0;
cocos2d::CCPoint::CCPoint(
&v61,
(float)((float)(v52.width * 0.5) - 215.0) + 20.0,
(float)((float)(v52.height * 0.5) + 155.0) - 60.0);
v50 = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v62.origin, 8.0, 0.0);
GameToolbox::createToggleButton(
(int)&v54,
(unsigned int)v59,
v60,
(bool)m_mainLayer,
v28,
&v61,
a1,
v50,
0.8,
0.45,
0.0,
(int)&v62,
(int)"bigFont.fnt",
0,
0,
a1->m_freeModeObjects);
sub_774008(&v54);
v29 = cocos2d::CCLabelBMFont::create();
a1->m_cameraEasingLabel = v29;
a1->m_mainLayer->addChild(a1->m_mainLayer, v29);
m_cameraEasingLabel = a1->m_cameraEasingLabel;
v31 = m_cameraEasingLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v62.origin, v52.width * 0.5, v52.height * 0.5);
v31(m_cameraEasingLabel, &v62.origin);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_cameraEasingLabel->setScale)(
a1->m_cameraEasingLabel,
1061997773);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraEasingLabel);
v61.y = 0.0;
LODWORD(v61.x) = SetupPortalPopup::sliderChanged;
v32 = Slider::create(a1, (cocos2d::SEL_MenuHandler)(unsigned int)SetupPortalPopup::sliderChanged);
a1->m_cameraEasingSlider = v32;
a1->m_mainLayer->addChild(a1->m_mainLayer, v32);
m_cameraEasingSlider = a1->m_cameraEasingSlider;
v51 = m_cameraEasingSlider->setPosition;
v34 = a1->m_cameraEasingLabel->getPosition(a1->m_cameraEasingLabel);
cocos2d::CCPoint::CCPoint(&v54, 0.0, -30.0);
cocos2d::CCPoint::operator+(&v62, v34, &v54);
v51(m_cameraEasingSlider, &v62.origin);
Thumb = Slider::getThumb(a1->m_cameraEasingSlider);
Thumb->setTag(Thumb, 0);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraEasingSlider);
SetupPortalPopup::updateCameraEasingLabel(a1);
Slider::setValue(a1->m_cameraEasingSlider, (float)((float)a1->m_cameraEasing - 1.0) / 39.0);
v36 = cocos2d::CCLabelBMFont::create();
a1->m_cameraPaddingLabel = v36;
a1->m_mainLayer->addChild(a1->m_mainLayer, v36);
m_cameraPaddingLabel = a1->m_cameraPaddingLabel;
v38 = m_cameraPaddingLabel->setPosition;
v39 = a1->m_cameraEasingLabel->getPosition(a1->m_cameraEasingLabel);
cocos2d::CCPoint::CCPoint(&v54, 0.0, -50.0);
cocos2d::CCPoint::operator+(&v62, v39, &v54);
v38(m_cameraPaddingLabel, &v62.origin);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_cameraPaddingLabel->setScale)(
a1->m_cameraPaddingLabel,
1061997773);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraPaddingLabel);
v62.origin.y = 0.0;
LODWORD(v62.origin.x) = SetupPortalPopup::sliderChanged;
v40 = Slider::create(a1, (cocos2d::SEL_MenuHandler)(unsigned int)SetupPortalPopup::sliderChanged);
a1->m_cameraPaddingSlider = v40;
a1->m_mainLayer->addChild(a1->m_mainLayer, v40);
m_cameraPaddingSlider = a1->m_cameraPaddingSlider;
v42 = m_cameraPaddingSlider->setPosition;
v43 = a1->m_cameraPaddingLabel->getPosition(a1->m_cameraPaddingLabel);
cocos2d::CCPoint::CCPoint(&v53, 0.0, -30.0);
cocos2d::CCPoint::operator+(&v54, v43, &v53);
v42(m_cameraPaddingSlider, &v54);
v44 = Slider::getThumb(a1->m_cameraPaddingSlider);
v44->setTag(v44, 1);
cocos2d::CCArray::addObject(a1->m_cameraSettingsObjects, a1->m_cameraPaddingSlider);
SetupPortalPopup::updateCameraPaddingLabel(a1);
Slider::setValue(a1->m_cameraPaddingSlider, a1->m_cameraPadding);
SetupPortalPopup::updateItemVisibility(a1);
a1->m_disableDelegate = 0;
}
return v48;
}