//
// KeybindCapturePopup::init from 0xcf71d0 to 0xcf7a58 (2184 bytes)
//
// 2 xrefs:
// > KeybindCapturePopup::create @ 0xcf7d3c
// > ??> @ 0x90c28
//
// 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:49 +0000
//
__int64 __fastcall KeybindCapturePopup::init(
ControllerInputNode **this,
ControllerInputNode *a2,
int a3,
int a4,
ControllerInputNode *a5,
int a6)
{
bool v7; // w22
float v12; // s1
unsigned __int8 v13; // w0
unsigned int v14; // w23
cocos2d::CCDirector *v16; // x0
__int64 v17; // x0
cocos2d::CCDirector *v18; // x0
cocos2d::CCDirector *v19; // x0
float v20; // s8
float v21; // s9
char *v22; // x0
const char *v23; // x2
__int64 v24; // x22
void (__fastcall *v25)(__int64, __int64 *); // x2
void (__fastcall *v26)(__int64, __int64 *); // x25
const char *v27; // x2
__int64 v28; // x0
__int64 v29; // x25
void (__fastcall *v30)(__int64, __int64 *); // x26
float v31; // s1
const char *v32; // x2
__int64 v33; // x0
__int64 v34; // x0
void (__fastcall *v35)(__int64, __int64 *); // x2
__int64 v36; // x22
void (__fastcall *v37)(__int64, __int64 *); // x25
float v38; // s2
InputCaptureDelegate *v39; // x1
float v40; // s0
float v41; // s11
float v42; // s10
const cocos2d::CCSize *v43; // x2
__int64 v44; // x0
__int64 v45; // x27
void (__fastcall *v46)(__int64, __int64 *); // x28
const char *v47; // x6
__int64 v48; // x27
const char *v49; // x6
__int64 v50; // x0
__int64 v51; // x0
__int64 v52; // x26
cocos2d::CCNode *v53; // x28
void (__fastcall *v54)(__int64, __int64 *); // x27
const char *v55; // x6
GJKeybindManager *v56; // x0
float v57; // s10
__int64 v58; // x0
__int64 v59; // x0
__int64 v60; // x25
cocos2d::CCNode *v61; // x27
void (__fastcall *v62)(__int64, __int64 *); // x26
const char *v63; // x6
__int64 v64; // x0
__int64 v65; // x0
__int64 v66; // x24
cocos2d::CCNode *v67; // x26
void (__fastcall *v68)(__int64, __int64 *); // x25
const char *v69; // x1
__int64 v70; // x24
__int64 v71; // x24
cocos2d::CCNode *v72; // x26
void (__fastcall *v73)(__int64, __int64 *); // x25
char *v74; // x0
size_t v75; // x0
__int64 v76; // x0
__int64 v77; // x26
void (__fastcall *v78)(__int64, __int64 *); // x27
int v79; // w28
unsigned int v80; // w27
bool v81; // w26
bool *v82; // x2
__int64 v83; // x1
char *v84; // [xsp+98h] [xbp+98h]
__int64 v85; // [xsp+A8h] [xbp+A8h] BYREF
_BYTE v86[8]; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v87; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v88; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v89; // [xsp+C8h] [xbp+C8h]
void *v90; // [xsp+D0h] [xbp+D0h]
v7 = a6 == 1;
if ( a6 == 1 )
v12 = 280.0;
else
v12 = 290.0;
v13 = SetupTriggerPopup::init((SetupTriggerPopup *)this, nullptr, nullptr, 420.0, v12, 7u, 0.0);
v14 = v13;
if ( v13 )
{
SetupTriggerPopup::preSetup((SetupTriggerPopup *)this);
qmemcpy(&v87, "PWi", 3);
SetupTriggerPopup::setCustomBGColor((__int64)this, (__int64)&v87);
v16 = (cocos2d::CCDirector *)(*((__int64 (__fastcall **)(ControllerInputNode **, __int64))*this + 136))(this, 1);
v17 = cocos2d::CCDirector::sharedDirector(v16);
*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v17 + 192LL))(v17) + 134) = 1;
*(this + 128) = a2;
*(this + 129) = a5;
*((_DWORD *)this + 260) = a3;
*((_DWORD *)this + 261) = a4;
*((_DWORD *)this + 262) = a4;
*((_BYTE *)this + 1052) = a4 == 0;
*((_BYTE *)this + 1054) = v7;
if ( a2 )
v18 = (cocos2d::CCDirector *)(*(unsigned __int8 (__fastcall **)(ControllerInputNode *))(*(_QWORD *)a2 + 48LL))(a2);
else
v18 = nullptr;
*((_BYTE *)this + 1055) = (_BYTE)v18;
v19 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v18);
cocos2d::CCDirector::getWinSize(&v85, v19);
v20 = *(float *)&v85 * 0.5;
v21 = *((float *)&v85 + 1) * 0.5;
if ( *((_BYTE *)this + 1054) )
{
v74 = GJKeybindManager::actionToString((GJKeybindManager *)*((unsigned int *)this + 260));
v88 = 0;
v84 = v74;
v89 = 0;
v90 = nullptr;
v75 = strlen(v74);
std::string::__init(&v88, v84, v75);
SetupTriggerPopup::addTitle((__int64)this, (__int64)&v88);
if ( (v88 & 1) != 0 )
operator delete(v90);
}
else
{
v88 = 0;
v89 = 0;
v90 = nullptr;
std::string::__init(&v88, "Edit Keybind", 0xCu);
SetupTriggerPopup::addTitle((__int64)this, (__int64)&v88);
if ( (v88 & 1) != 0 )
operator delete(v90);
v22 = GJKeybindManager::actionToString((GJKeybindManager *)*((unsigned int *)this + 260));
v24 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)v22, "bigFont.fnt", v23);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v24 + 160LL))(v24, 0.6);
v25 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v24 + 1072LL);
LOWORD(v87) = -14236;
BYTE2(v87) = -1;
v25(v24, &v87);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 73) + 456LL))(*(this + 73), v24);
v26 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v24 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v87,
v20,
(float)(v21 + (float)(*((float *)this + 184) * 0.5)) - 36.0);
v26(v24, &v87);
}
v28 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)&byte_11E1A70, "goldFont.fnt", v27);
*(this + 136) = (ControllerInputNode *)v28;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v28 + 160LL))(v28, 0.8);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)*(this + 73) + 456LL))(*(this + 73), *(this + 136));
v29 = (__int64)*(this + 136);
v30 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v29 + 184LL);
if ( *((_BYTE *)this + 1054) )
v31 = 40.0;
else
v31 = 64.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v87, v20, (float)(v21 + (float)(*((float *)this + 184) * 0.5)) - v31);
v30(v29, &v87);
v33 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)&byte_11E1A70, "bigFont.fnt", v32);
*(this + 138) = (ControllerInputNode *)v33;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v33 + 160LL))(v33, 0.5);
v34 = (__int64)*(this + 138);
v35 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v34 + 1072LL);
LOWORD(v87) = -26881;
BYTE2(v87) = 50;
v35(v34, &v87);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)*(this + 73) + 456LL))(*(this + 73), *(this + 138));
v36 = (__int64)*(this + 138);
v37 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v36 + 184LL);
if ( *((_BYTE *)this + 1054) )
v38 = 58.0;
else
v38 = 86.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v87, v20, (float)(v21 + (float)(*((float *)this + 184) * 0.5)) - v38);
v37(v36, &v87);
if ( *((_BYTE *)this + 1054) )
{
v40 = *((float *)this + 184);
v41 = (float)(v21 + (float)(v40 * 0.5)) - 70.0;
v42 = (float)(v21 - (float)(v40 * 0.5)) + 50.0;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v87, *((float *)this + 183) - 30.0, v41 - v42);
v44 = ControllerInputNode::create((ControllerInputNode *)(this + 127), (InputCaptureDelegate *)&v87, v43);
*(this + 134) = (ControllerInputNode *)v44;
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 73) + 456LL))(*(this + 73), v44);
v45 = (__int64)*(this + 134);
v46 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v45 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v87, v20, (float)((float)(v41 + v42) * 0.5) + -20.0);
v46(v45, &v87);
(*(void (__fastcall **)(_QWORD, float))(*(_QWORD *)*(this + 134) + 160LL))(*(this + 134), 1.1);
v48 = ButtonSprite::create(
(ButtonSprite *)"Controller 1",
(const char *)&qword_58 + 2,
0,
1,
0.45,
"bigFont.fnt",
"GJ_button_01.png",
v47,
22.0);
v50 = ButtonSprite::create(
(ButtonSprite *)"Controller 2",
(const char *)&qword_58 + 2,
0,
1,
0.45,
"bigFont.fnt",
"GJ_button_02.png",
v49,
22.0);
v51 = CCMenuItemToggler::create(v48, v50, (__int64)this, (__int64)KeybindCapturePopup::onToggleController, 0);
*(this + 135) = (ControllerInputNode *)v51;
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v51);
v52 = (__int64)*(this + 135);
v53 = *(this + 69);
v54 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v52 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v86,
(float)(v20 + (float)(*((float *)this + 183) * 0.5)) - 62.0,
(float)(v21 + (float)(*((float *)this + 184) * 0.5)) - 25.0);
cocos2d::CCNode::convertToNodeSpace(&v87, v53, (const cocos2d::CCPoint *)v86);
v54(v52, &v87);
v56 = (GJKeybindManager *)*((unsigned int *)this + 261);
if ( (_DWORD)v56 && GJKeybindManager::isControllerChord(v56) )
{
v79 = *((_DWORD *)this + 261) & 1;
v80 = (unsigned __int16)*((_DWORD *)this + 261);
v81 = !(*((_DWORD *)this + 261) & 1);
ControllerInputNode::setController2(*(this + 134), v81);
v83 = v80;
if ( !v79 )
v83 = v80 - 1;
ControllerInputNode::setActiveKey(*(this + 134), v83, v82);
CCMenuItemToggler::toggle(*(this + 135), v81);
}
}
else
{
v76 = VirtualKeyboardNode::create((VirtualKeyboardNode *)(this + 127), v39);
*(this + 133) = (ControllerInputNode *)v76;
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 73) + 456LL))(*(this + 73), v76);
v77 = (__int64)*(this + 133);
v78 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v77 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v87, v20, v21 - 2.0);
v78(v77, &v87);
}
v57 = (float)(v21 - (float)(*((float *)this + 184) * 0.5)) + 16.0;
v58 = ButtonSprite::create(
(ButtonSprite *)"Set",
(const char *)&dword_30,
0,
1,
0.56,
"bigFont.fnt",
"GJ_button_01.png",
v55,
22.0);
*(this + 141) = (ControllerInputNode *)v58;
v59 = CCMenuItemSpriteExtra::create(v58, 0, (__int64)this, (__int64)KeybindCapturePopup::onSet, 0);
*(this + 139) = (ControllerInputNode *)v59;
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v59);
v60 = (__int64)*(this + 139);
v61 = *(this + 69);
v62 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v60 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v86, v20 - 48.0, v57);
cocos2d::CCNode::convertToNodeSpace(&v87, v61, (const cocos2d::CCPoint *)v86);
v62(v60, &v87);
v64 = ButtonSprite::create(
(ButtonSprite *)"Remove",
(const char *)&dword_40,
0,
1,
0.56,
"bigFont.fnt",
"GJ_button_06.png",
v63,
22.0);
*(this + 142) = (ControllerInputNode *)v64;
v65 = CCMenuItemSpriteExtra::create(v64, 0, (__int64)this, (__int64)KeybindCapturePopup::onRemove, 0);
*(this + 140) = (ControllerInputNode *)v65;
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v65);
v66 = (__int64)*(this + 140);
v67 = *(this + 69);
v68 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v66 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v86, v20 + 48.0, v57);
cocos2d::CCNode::convertToNodeSpace(&v87, v67, (const cocos2d::CCPoint *)v86);
v68(v66, &v87);
v70 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v69);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v70 + 160LL))(v70, 0.7);
v71 = CCMenuItemSpriteExtra::create(v70, 0, (__int64)this, 1368, 1);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v71);
v72 = *(this + 69);
v73 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v71 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v86,
v20 - (float)(*((float *)this + 183) * 0.5),
v21 + (float)(*((float *)this + 184) * 0.5));
cocos2d::CCNode::convertToNodeSpace(&v87, v72, (const cocos2d::CCPoint *)v86);
v73(v71, &v87);
KeybindCapturePopup::updateChordDisplay((KeybindCapturePopup *)this);
SetupTriggerPopup::postSetup((SetupTriggerPopup *)this);
}
return v14;
}