//
// PlatformerControlsPopup::init from 0xcface0 to 0xcfb760 (2688 bytes)
//
// 2 xrefs:
// > PlatformerControlsPopup::create @ 0xcfba5c
// > ??> @ 0xd6150
//
// This function is hookable on this platform (idp: arm, 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 13:06:51 +0000
//
__int64 __fastcall PlatformerControlsPopup::init(PlatformerControlsPopup *this, GJGameLevel *a2, char a3)
{
_BOOL4 v5; // w24
float v7; // s1
bool isPlatformer; // w0
unsigned __int8 v9; // w0
unsigned int v10; // w23
char *v12; // x0
__int64 v13; // x2
LevelControlConfig *v14; // x0
cocos2d::CCDirector *v15; // x0
float v16; // s9
float v17; // s10
float v18; // s8
float v19; // s9
const char *v20; // x1
const char *v21; // x1
__int64 v22; // x0
CCMenuItemToggler *v23; // x25
unsigned __int8 IsCustom; // w0
__int64 v25; // x25
void (__fastcall *v26)(__int64, __int64 *); // x27
const char *v27; // x2
__int64 v28; // x25
void (__fastcall *v29)(__int64, __int64 *); // x27
void (__fastcall *v30)(__int64, __int64 *); // x27
const char *v31; // x2
__int64 v32; // x0
__int64 v33; // x25
void (__fastcall *v34)(__int64, __int64 *); // x27
const char *v35; // x6
__int64 v36; // x0
__int64 v37; // x0
const char *v38; // x6
__int64 v39; // x0
__int64 v40; // x0
const char *v41; // x6
__int64 v42; // x0
__int64 v43; // x0
const char *v44; // x1
const char *v45; // x6
__int64 v46; // x0
float v47; // s9
__int64 v48; // x0
__int64 v49; // x0
__int64 v50; // x24
cocos2d::CCNode *v51; // x26
void (__fastcall *v52)(__int64, __int64 *); // x25
float v53; // s12
float *v54; // x0
__int64 v55; // x24
__int64 v56; // x24
cocos2d::CCNode *v57; // x26
void (__fastcall *v58)(__int64, __int64 *); // x25
const char *v59; // x1
__int64 v60; // x24
__int64 v61; // x24
cocos2d::CCNode *v62; // x26
void (__fastcall *v63)(__int64, __int64 *); // x25
char *v64; // x24
__int64 *v65; // x27
__int64 v66; // x0
__int64 v67; // x25
__int64 v68; // x0
__int64 v69; // x26
const char *v70; // x1
__int64 v71; // x0
__int64 v72; // t1
float v73; // s1
__int64 v74; // x0
int v75; // w0
__int64 v76; // x24
__int64 v77; // x0
__int64 v78; // x24
cocos2d::CCNode *v79; // x26
__int64 (__fastcall *v80)(__int64, __int64 *); // x25
LoadingCircleSprite *v81; // x0
cocos2d::CCSprite *v82; // x0
__int64 v83; // x24
void (__fastcall *v84)(__int64, __int64 *); // x25
cocos2d::CCNode *v85; // [xsp+B8h] [xbp+B8h]
cocos2d::CCNode *v86; // [xsp+C0h] [xbp+C0h]
cocos2d::CCNode *v87; // [xsp+C8h] [xbp+C8h]
cocos2d::CCNode *v88; // [xsp+C8h] [xbp+C8h]
cocos2d::CCNode *v89; // [xsp+C8h] [xbp+C8h]
cocos2d::CCNode *v90; // [xsp+C8h] [xbp+C8h]
__int64 v91; // [xsp+D8h] [xbp+D8h] BYREF
char v92[8]; // [xsp+E0h] [xbp+E0h] BYREF
__int64 v93; // [xsp+E8h] [xbp+E8h] BYREF
__int64 v94[2]; // [xsp+F0h] [xbp+F0h] BYREF
void *v95; // [xsp+100h] [xbp+100h]
v5 = a2 != nullptr;
if ( a2 && a3 && (isPlatformer = GJGameLevel::isPlatformer(a2)) && *((_BYTE *)a2 + 1000) )
{
v7 = 228.0;
}
else
{
v7 = 226.0;
isPlatformer = 0;
}
*((_BYTE *)this + 1200) = isPlatformer;
v9 = SetupTriggerPopup::init(this, nullptr, nullptr, 320.0, v7, 7u, 0.0);
v10 = v9;
if ( v9 )
{
SetupTriggerPopup::preSetup(this);
qmemcpy(&v93, "PWi", 3);
v12 = (char *)SetupTriggerPopup::setCustomBGColor((__int64)this, (__int64)&v93);
*((_QWORD *)this + 131) = a2;
*((_BYTE *)this + 1056) = a3;
if ( v5 )
{
if ( *((_BYTE *)a2 + 1000) )
*((_BYTE *)this + 1057) = 1;
else
*((_BYTE *)this + 1057) = 0;
v12 = (char *)a2 + 1816;
v13 = *((_BYTE *)a2 + 1816) >> 1;
if ( (*((_BYTE *)a2 + 1816) & 1) != 0 )
v13 = *((_QWORD *)a2 + 228);
if ( v13 )
{
v14 = (LevelControlConfig *)LevelControlConfig::createFromB64(v12);
v12 = (char *)LevelControlConfig::presentClasses(v14);
*((_DWORD *)this + 324) = (_DWORD)v12;
}
}
else
{
*((_BYTE *)this + 1057) = 0;
}
v15 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)v12);
cocos2d::CCDirector::getWinSize(&v91, v15);
v94[0] = 0;
v16 = *((float *)this + 184);
v17 = *((float *)&v91 + 1) * 0.5;
v94[1] = 0;
v95 = nullptr;
v18 = *(float *)&v91 * 0.5;
v19 = (float)(*((float *)&v91 + 1) * 0.5) + (float)(v16 * 0.5);
std::string::__init(v94, "Controls", 8u);
SetupTriggerPopup::addTitle((__int64)this, (__int64)v94);
if ( (v94[0] & 1) != 0 )
operator delete(v95);
v87 = (cocos2d::CCNode *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"GJ_checkOn_001.png",
v20);
v22 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_checkOff_001.png", v21);
v23 = (CCMenuItemToggler *)CCMenuItemToggler::create(
v22,
(__int64)v87,
(__int64)this,
(__int64)PlatformerControlsPopup::onToggleSource,
0);
*((_QWORD *)this + 138) = v23;
IsCustom = PlatformerControlsPopup::sourceIsCustom(this);
CCMenuItemToggler::toggle(v23, IsCustom);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 69) + 456LL))(
*((_QWORD *)this + 69),
*((_QWORD *)this + 138));
v25 = *((_QWORD *)this + 138);
v88 = *((cocos2d::CCNode **)this + 69);
v26 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v25 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v92, v18 - 95.0, v19 - 44.0);
cocos2d::CCNode::convertToNodeSpace(&v93, v88, (const cocos2d::CCPoint *)v92);
v26(v25, &v93);
v28 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Use Custom Controls", "bigFont.fnt", v27);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v28 + 160LL))(v28, 0.5);
v29 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v28 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, 0.0, 0.5);
v29(v28, &v93);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 73) + 456LL))(*((_QWORD *)this + 73), v28);
v30 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v28 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v18 - 75.0, v19 - 44.0);
v30(v28, &v93);
v32 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)&byte_11B8890, "goldFont.fnt", v31);
*((_QWORD *)this + 139) = v32;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v32 + 160LL))(v32, 0.7);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 73) + 456LL))(
*((_QWORD *)this + 73),
*((_QWORD *)this + 139));
v33 = *((_QWORD *)this + 139);
v34 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v33 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v18, v19 - 78.0);
v34(v33, &v93);
PlatformerControlsPopup::updateEditLabel(this);
v36 = ButtonSprite::create(
(ButtonSprite *)"Keyboard",
(const char *)&dword_78,
0,
1,
0.6,
"bigFont.fnt",
"GJ_button_01.png",
v35,
26.0);
*((_QWORD *)this + 143) = v36;
v37 = CCMenuItemSpriteExtra::create(v36, 0, (__int64)this, (__int64)PlatformerControlsPopup::onKeyboard, 0);
*((_QWORD *)this + 140) = v37;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v37);
v39 = ButtonSprite::create(
(ButtonSprite *)"Touch",
(const char *)&dword_78,
0,
1,
0.6,
"bigFont.fnt",
"GJ_button_01.png",
v38,
26.0);
*((_QWORD *)this + 144) = v39;
v40 = CCMenuItemSpriteExtra::create(v39, 0, (__int64)this, (__int64)PlatformerControlsPopup::onTouch, 0);
*((_QWORD *)this + 141) = v40;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v40);
v42 = ButtonSprite::create(
(ButtonSprite *)"Controller",
(const char *)&dword_78,
0,
1,
0.6,
"bigFont.fnt",
"GJ_button_01.png",
v41,
26.0);
*((_QWORD *)this + 145) = v42;
v43 = CCMenuItemSpriteExtra::create(v42, 0, (__int64)this, (__int64)PlatformerControlsPopup::onController, 0);
*((_QWORD *)this + 142) = v43;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v43);
cocos2d::CCNode::scheduleUpdate(this);
if ( *((_BYTE *)this + 1200) )
{
v64 = (char *)this + 1248;
v65 = (__int64 *)((char *)this + 1224);
v66 = ButtonSprite::create(
(ButtonSprite *)"Upload Selected",
(const char *)&qword_68 + 6,
0,
1,
0.6,
"bigFont.fnt",
"GJ_button_02.png",
v45,
26.0);
*((_QWORD *)this + 152) = v66;
v67 = 0;
v68 = CCMenuItemSpriteExtra::create(v66, 0, (__int64)this, (__int64)PlatformerControlsPopup::onUpload, 0);
*((_QWORD *)this + 151) = v68;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v68);
v69 = *((_QWORD *)this + 151);
v86 = *((cocos2d::CCNode **)this + 69);
v89 = *(cocos2d::CCNode **)(*(_QWORD *)v69 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v92, v18, v19 - 207.0);
cocos2d::CCNode::convertToNodeSpace(&v93, v86, (const cocos2d::CCPoint *)v92);
((void (__fastcall *)(__int64, __int64 *))v89)(v69, &v93);
do
{
v64 += 16;
*((_QWORD *)v64 - 2) = cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"GJ_checkOff_001.png",
v44);
*((_QWORD *)v64 - 1) = cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"GJ_checkOn_001.png",
v70);
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)v64 - 2) + 160LL))(*((_QWORD *)v64 - 2), 0.7);
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)v64 - 1) + 160LL))(*((_QWORD *)v64 - 1), 0.7);
v71 = CCMenuItemToggler::create(
*((_QWORD *)v64 - 2),
*((_QWORD *)v64 - 1),
(__int64)this,
(__int64)PlatformerControlsPopup::onToggleUpload,
0);
*v65 = v71;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v71 + 72LL))(
v71,
*(unsigned int *)((char *)&unk_11A54E0 + v67 * 4));
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), *v65);
v72 = *v65++;
v73 = flt_11A54F0[v67++];
v85 = *((cocos2d::CCNode **)this + 69);
v90 = *(cocos2d::CCNode **)(*(_QWORD *)v72 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v92, v18 + 95.0, v19 - v73);
cocos2d::CCNode::convertToNodeSpace(&v93, v85, (const cocos2d::CCPoint *)v92);
((void (__fastcall *)(__int64, __int64 *))v90)(v72, &v93);
}
while ( v67 != 3 );
v74 = *((_QWORD *)this + 131);
v47 = (float)(v17 - (float)(*((float *)this + 184) * 0.5)) + 22.0;
if ( !v74 )
{
if ( *((_BYTE *)this + 1200) )
goto LABEL_22;
goto LABEL_21;
}
v44 = (const char *)*(unsigned int *)(v74 + 1140);
v75 = *((unsigned __int8 *)this + 1200);
if ( (_DWORD)v44 != 3 )
{
LABEL_30:
if ( v75 )
goto LABEL_22;
goto LABEL_21;
}
if ( *((_BYTE *)this + 1200) )
goto LABEL_22;
}
else
{
v46 = *((_QWORD *)this + 131);
v47 = (float)(v17 - (float)(*((float *)this + 184) * 0.5)) + 22.0;
if ( !v46 || *(_DWORD *)(v46 + 1140) != 3 )
{
LABEL_21:
v48 = ButtonSprite::create(
(ButtonSprite *)"Apply Creator Controls",
(const char *)&qword_90 + 6,
0,
1,
0.6,
"bigFont.fnt",
"GJ_button_04.png",
v45,
26.0);
v49 = CCMenuItemSpriteExtra::create(v48, 0, (__int64)this, (__int64)PlatformerControlsPopup::onApplyCreator, 0);
*((_QWORD *)this + 146) = v49;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v49);
v50 = *((_QWORD *)this + 146);
v51 = *((cocos2d::CCNode **)this + 69);
v52 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v50 + 184LL);
v53 = (float)(v18 + (float)(*((float *)this + 183) * 0.5)) - 50.0;
v54 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v50 + 328LL))(v50);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v92, v53 - (float)(*v54 * 0.5), v47);
cocos2d::CCNode::convertToNodeSpace(&v93, v51, (const cocos2d::CCPoint *)v92);
v52(v50, &v93);
PlatformerControlsPopup::refreshApplyVisible((__int64)this);
LABEL_22:
v55 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_infoIcon_001.png", v44);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v55 + 160LL))(v55, 0.7);
v56 = CCMenuItemSpriteExtra::create(v55, 0, (__int64)this, (__int64)PlatformerControlsPopup::onInfo, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v56);
v57 = *((cocos2d::CCNode **)this + 69);
v58 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v56 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v92,
(float)(v18 + (float)(*((float *)this + 183) * 0.5)) - 18.0,
(float)(v17 + (float)(*((float *)this + 184) * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(&v93, v57, (const cocos2d::CCPoint *)v92);
v58(v56, &v93);
v60 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v59);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v60 + 160LL))(v60, 0.7);
v61 = CCMenuItemSpriteExtra::create(v60, 0, (__int64)this, 1368, 1);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v61);
v62 = *((cocos2d::CCNode **)this + 69);
v63 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v61 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v92,
v18 - (float)(*((float *)this + 183) * 0.5),
v17 + (float)(*((float *)this + 184) * 0.5));
cocos2d::CCNode::convertToNodeSpace(&v93, v62, (const cocos2d::CCPoint *)v92);
v63(v61, &v93);
PlatformerControlsPopup::refreshModeUI((cocos2d::CCNode **)this);
SetupTriggerPopup::postSetup(this);
return v10;
}
}
v76 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_updateBtn_001.png", v44);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v76 + 160LL))(v76, 0.7);
v77 = CCMenuItemSpriteExtra::create(v76, 0, (__int64)this, (__int64)PlatformerControlsPopup::onUpdate, 0);
*((_QWORD *)this + 147) = v77;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v77);
v78 = *((_QWORD *)this + 147);
v79 = *((cocos2d::CCNode **)this + 69);
v80 = *(__int64 (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v78 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v92, (float)(v18 + (float)(*((float *)this + 183) * 0.5)) - 30.0, v47);
cocos2d::CCNode::convertToNodeSpace(&v93, v79, (const cocos2d::CCPoint *)v92);
v81 = (LoadingCircleSprite *)v80(v78, &v93);
v82 = LoadingCircleSprite::create(v81, 1.0);
*((_QWORD *)this + 148) = v82;
(*(void (__fastcall **)(cocos2d::CCSprite *, float))(*(_QWORD *)v82 + 160LL))(v82, 0.6);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
*((_QWORD *)this + 148),
5);
v83 = *((_QWORD *)this + 148);
v84 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v83 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v93,
(float)(v18 + (float)(*((float *)this + 183) * 0.5)) - 30.0,
v47);
v84(v83, &v93);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 148) + 344LL))(*((_QWORD *)this + 148), 0);
v75 = *((unsigned __int8 *)this + 1200);
goto LABEL_30;
}
return v10;
}