//
// KeybindCapturePopup::init from 0x14044d2c0 to 0x14044e089 (3529 bytes)
//
// 2 xrefs:
// > KeybindCapturePopup::create @ 0x14044e209
// > ??> @ 0x1409275c0
//
// This function is hookable on this platform (idp: pc, 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 11:32:26 +0000
//
// Hidden C++ exception states: #wind=11
char __fastcall KeybindCapturePopup::init(__int64 a1, __int64 a2, int a3, int a4, __int64 a5, int a6)
{
bool v10; // r15
char v11; // r12
int v12; // xmm1_4
char result; // al
__int64 v14; // rax
__int64 v15; // rdx
__int64 v16; // rcx
__int64 v17; // rax
__int64 v18; // rcx
bool v19; // al
__int64 v20; // rax
float v21; // xmm9_4
float v22; // xmm6_4
const char *v23; // rax
size_t v24; // r8
const char *v25; // rax
cocos2d::CCLabelBMFont *v26; // rax
cocos2d::CCLabelBMFont *v27; // rdi
float v28; // xmm2_4
__int64 v29; // rbx
__int64 v30; // rax
struct cocos2d::CCLabelBMFont *v31; // rax
float v32; // xmm2_4
int v33; // eax
__int64 v34; // rdi
__int64 v35; // rbx
__int64 v36; // rax
struct cocos2d::CCLabelBMFont *v37; // rax
float v38; // xmm2_4
int v39; // eax
__int64 v40; // rdi
__int64 v41; // rbx
__int64 v42; // rax
float v43; // xmm0_4
float v44; // xmm10_4
float v45; // xmm8_4
float *v46; // rax
float *v47; // rdi
char *v48; // r15
__int64 v49; // rdi
__int64 v50; // rbx
__int64 v51; // rax
cocos2d::CCObject *v52; // rdi
cocos2d::CCObject *v53; // rbx
cocos2d::CCMenuItem *v54; // rax
__int64 v55; // rsi
__int64 v56; // rbx
__int64 v57; // rdi
__int64 v58; // rax
__int64 v59; // rax
int v60; // eax
int v61; // edi
bool v62; // si
__int64 v63; // rax
void *v64; // rdx
__int64 v65; // rdx
__int64 v66; // rcx
struct cocos2d::CCLabelBMFont *v67; // rax
__int64 v68; // rdx
__int64 v69; // rdi
__int64 v70; // rbx
__int64 v71; // rax
int v72; // eax
float v73; // xmm14_4
int v74; // eax
float v75; // xmm8_4
__int64 v76; // rax
cocos2d::CCObject *v77; // rbx
bool inited; // al
cocos2d::CCObject *v79; // rcx
__int64 v80; // rax
bool v81; // al
cocos2d::CCObject *v82; // rax
__int64 v83; // rsi
__int64 v84; // rbx
__int64 v85; // rdi
__int64 v86; // rax
__int64 v87; // rax
char *v88; // rax
__int64 v89; // rbx
bool v90; // al
cocos2d::CCObject *v91; // rcx
bool v92; // al
cocos2d::CCObject *v93; // rax
__int64 v94; // rsi
__int64 v95; // rbx
__int64 v96; // rdi
__int64 v97; // rax
__int64 v98; // rax
struct cocos2d::CCSprite *v99; // rax
cocos2d::CCObject *v100; // rsi
__int64 v101; // rdi
__int64 v102; // rbx
__int64 v103; // rax
__int64 v104; // rax
float v105[2]; // [rsp+58h] [rbp-B0h] BYREF
__int64 v106; // [rsp+60h] [rbp-A8h] BYREF
char *v107; // [rsp+68h] [rbp-A0h] BYREF
__int128 v108; // [rsp+70h] [rbp-98h] BYREF
__int64 v109; // [rsp+80h] [rbp-88h]
__int64 v110; // [rsp+88h] [rbp-80h]
v10 = a6 == 1;
if ( a6 == 1 )
{
v11 = 0;
v12 = 1133248512;
}
else
{
v11 = 1;
v12 = 1131413504;
}
result = SetupTriggerPopup::init(a1, 0, 0, a4, v12, 7, 0);
if ( result )
{
*(_BYTE *)(a1 + 744) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
qmemcpy(&a6, "PWi", 3);
v14 = (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 472LL))(*(_QWORD *)(a1 + 584), 3);
if ( v14 )
(**(void (__fastcall ***)(__int64, int *))(v14 + 320))(v14 + 320, &a6);
LOBYTE(v15) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1008LL))(a1, v15);
v17 = cocos2d::CCDirector::sharedDirector(v16);
*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v17 + 176LL))(v17) + 158) = 1;
*(_QWORD *)(a1 + 1008) = a2;
*(_QWORD *)(a1 + 1016) = a5;
*(_DWORD *)(a1 + 1024) = a3;
*(_DWORD *)(a1 + 1028) = a4;
*(_DWORD *)(a1 + 1032) = a4;
*(_BYTE *)(a1 + 1036) = a4 == 0;
*(_BYTE *)(a1 + 1038) = v10;
v19 = a2 && (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)a2 + 40LL))(a2);
*(_BYTE *)(a1 + 1039) = v19;
v20 = cocos2d::CCDirector::sharedDirector(v18);
cocos2d::CCDirector::getWinSize(v20, v105);
v21 = v105[0] * 0.5;
v22 = v105[1] * 0.5;
if ( *(_BYTE *)(a1 + 1038) )
{
v23 = GJKeybindManager::actionToString(*(_DWORD *)(a1 + 1024));
v108 = 0;
v109 = 0;
v110 = 0;
v24 = -1;
do
++v24;
while ( v23[v24] );
sub_14003D230(&v108, v23, v24);
SetupTriggerPopup::addTitle(a1, &v108);
}
else
{
v109 = 12;
v110 = 15;
strcpy((char *)&v108, "Edit Keybind");
BYTE13(v108) = 0;
HIWORD(v108) = 0;
SetupTriggerPopup::addTitle(a1, &v108);
v25 = GJKeybindManager::actionToString(*(_DWORD *)(a1 + 1024));
v26 = cocos2d::CCLabelBMFont::create(v25, (const char *)&qword_140704F78);
v27 = v26;
if ( v11 )
cocos2d::CCLabelBMFont::limitLabelWidth(v26, 260.0, 0.64999998, 0.1);
else
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)v26 + 160LL))(v26);
LOWORD(a6) = -14236;
BYTE2(a6) = -1;
(**((void (__fastcall ***)(__int64, int *))v27 + 46))((__int64)v27 + 368, &a6);
(*(void (__fastcall **)(_QWORD, cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v27);
if ( v11 )
v28 = v22 + 70.0;
else
v28 = (float)((float)(*(float *)(a1 + 736) * 0.5) + v22) - 36.0;
v29 = *(_QWORD *)v27;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v106, v21, v28);
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *, __int64))(v29 + 184))(v27, v30);
}
v31 = cocos2d::CCLabelBMFont::create(" ", "goldFont.fnt");
*(_QWORD *)(a1 + 1072) = v31;
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v31 + 160LL))(v31);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1072));
if ( v11 )
{
v32 = v22 + 30.0;
}
else
{
v33 = 64;
if ( *(_BYTE *)(a1 + 1038) )
v33 = 40;
v32 = (float)((float)(*(float *)(a1 + 736) * 0.5) + v22) - (float)v33;
}
v34 = **(_QWORD **)(a1 + 1072);
v35 = *(_QWORD *)(a1 + 1072);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v106, v21, v32);
(*(void (__fastcall **)(__int64, __int64))(v34 + 184))(v35, v36);
v37 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_140704F78);
*(_QWORD *)(a1 + 1088) = v37;
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v37 + 160LL))(v37);
LOWORD(a6) = -26881;
BYTE2(a6) = 50;
(**(void (__fastcall ***)(__int64, int *))(*(_QWORD *)(a1 + 1088) + 368LL))(*(_QWORD *)(a1 + 1088) + 368LL, &a6);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1088));
if ( v11 )
{
v38 = v22 - 32.0;
}
else
{
v39 = 86;
if ( *(_BYTE *)(a1 + 1038) )
v39 = 58;
v38 = (float)((float)(*(float *)(a1 + 736) * 0.5) + v22) - (float)v39;
}
v40 = **(_QWORD **)(a1 + 1088);
v41 = *(_QWORD *)(a1 + 1088);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v106, v21, v38);
(*(void (__fastcall **)(__int64, __int64))(v40 + 184))(v41, v42);
if ( *(_BYTE *)(a1 + 1038) )
{
v43 = *(float *)(a1 + 736) * 0.5;
v44 = (float)(v43 + v22) - 70.0;
v45 = (float)(v22 - v43) + 50.0;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v106, *(float *)(a1 + 732) - 30.0, v44 - v45);
v47 = v46;
v48 = (char *)operator new(0x1B8u);
v107 = v48;
memset(v48, 0, 0x1B8u);
cocos2d::CCNode::CCNode((cocos2d::CCNode *)v48);
*(_QWORD *)v48 = &ControllerInputNode::`vftable';
*((_QWORD *)v48 + 40) = 0;
v48[328] = 0;
*((_DWORD *)v48 + 83) = 0;
*((_DWORD *)v48 + 84) = 1065353216;
*((_QWORD *)v48 + 43) = 0;
*((_QWORD *)v48 + 44) = 0;
*((_QWORD *)v48 + 45) = 0;
*((_QWORD *)v48 + 46) = 0;
*((_QWORD *)v48 + 47) = 0;
*((_QWORD *)v48 + 48) = 0;
*((_QWORD *)v48 + 49) = 0;
*((_QWORD *)v48 + 50) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v48 + 408));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v48 + 416));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v48 + 424));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v48 + 432));
if ( ControllerInputNode::init((__int64 *)v48, a1 + 1000, v47) )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v48);
}
else
{
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v48 + 8LL))(v48, 1);
v48 = nullptr;
}
*(_QWORD *)(a1 + 1056) = v48;
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v48);
v49 = **(_QWORD **)(a1 + 1056);
v50 = *(_QWORD *)(a1 + 1056);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v107, v21, (float)((float)(v45 + v44) * 0.5) - 20.0);
(*(void (__fastcall **)(__int64, __int64))(v49 + 184))(v50, v51);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1056) + 160LL))(*(_QWORD *)(a1 + 1056));
v107 = (char *)operator new(0x2C8u);
v52 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v107);
if ( v52 )
{
if ( ButtonSprite::init_1(
(__int64)v52,
(__int64)"Controller 1",
90,
0,
1055286886,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1102053376) )
{
cocos2d::CCObject::autorelease(v52);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v52 + 8LL))(v52, 1);
LODWORD(v52) = 0;
}
}
v107 = (char *)operator new(0x2C8u);
v53 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v107);
if ( v53 )
{
if ( ButtonSprite::init_1(
(__int64)v53,
(__int64)"Controller 2",
90,
0,
1055286886,
1,
&qword_140704F78,
(__int64)"GJ_button_02.png",
1102053376) )
{
cocos2d::CCObject::autorelease(v53);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v53 + 8LL))(v53, 1);
LODWORD(v53) = 0;
}
}
v54 = CCMenuItemToggler::create((int)v52, (int)v53, a1, (__int64)KeybindCapturePopup::onToggleController);
*(_QWORD *)(a1 + 1064) = v54;
(*(void (__fastcall **)(_QWORD, cocos2d::CCMenuItem *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v54);
v55 = **(_QWORD **)(a1 + 1064);
v56 = *(_QWORD *)(a1 + 552);
v57 = *(_QWORD *)(a1 + 1064);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v107,
(float)((float)(*(float *)(a1 + 732) * 0.5) + v21) - 62.0,
(float)((float)(*(float *)(a1 + 736) * 0.5) + v22) - 25.0);
cocos2d::CCNode::convertToNodeSpace(v56, &v106, v58);
(*(void (__fastcall **)(__int64, __int64))(v55 + 184))(v57, v59);
v60 = *(_DWORD *)(a1 + 1028);
if ( v60 )
{
v61 = (unsigned __int16)v60;
if ( (unsigned int)(unsigned __int16)v60 - 1001 <= 0x2B )
{
v62 = !(v60 & 1);
v63 = *(_QWORD *)(a1 + 1056);
*(_BYTE *)(v63 + 328) = v62;
v64 = &unk_140703BF0;
if ( (v61 & 1) == 0 )
v64 = &unk_140703BD4;
(**(void (__fastcall ***)(__int64, void *))(*(_QWORD *)(v63 + 344) + 320LL))(
*(_QWORD *)(v63 + 344) + 320LL,
v64);
if ( (v61 & 1) == 0 )
--v61;
v66 = *(_QWORD *)(a1 + 1056);
*(_DWORD *)(v66 + 332) = v61;
ControllerInputNode::refreshVisuals(v66, v65);
CCMenuItemToggler::toggle(*(_QWORD *)(a1 + 1064), v62);
}
}
}
else
{
v67 = cocos2d::CCLabelBMFont::create("Press Keys...", (const char *)&qword_140704F78);
*(_QWORD *)(a1 + 1080) = v67;
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v67 + 160LL))(v67);
LOWORD(a6) = -1;
BYTE2(a6) = -1;
(**(void (__fastcall ***)(__int64, int *))(*(_QWORD *)(a1 + 1080) + 368LL))(*(_QWORD *)(a1 + 1080) + 368LL, &a6);
LOBYTE(v68) = -106;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)(*(_QWORD *)(a1 + 1080) + 368LL) + 40LL))(
*(_QWORD *)(a1 + 1080) + 368LL,
v68);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1080));
v69 = **(_QWORD **)(a1 + 1080);
v70 = *(_QWORD *)(a1 + 1080);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v107, v21, v22 - 4.0);
(*(void (__fastcall **)(__int64, __int64))(v69 + 184))(v70, v71);
}
v72 = 48;
if ( v11 )
v72 = 55;
v73 = (float)v72;
v74 = 16;
if ( v11 )
v74 = 26;
v75 = (float)(v22 - (float)(*(float *)(a1 + 736) * 0.5)) + (float)v74;
if ( v11 )
{
v107 = (char *)operator new(0x2C8u);
v76 = ButtonSprite::ButtonSprite((__int64)v107);
v77 = (cocos2d::CCObject *)v76;
if ( !v76 )
goto LABEL_64;
inited = ButtonSprite::init_1(
v76,
(__int64)"Set",
60,
0,
1060320051,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1105199104);
v79 = v77;
if ( inited )
goto LABEL_60;
}
else
{
v107 = (char *)operator new(0x2C8u);
v80 = ButtonSprite::ButtonSprite((__int64)v107);
v77 = (cocos2d::CCObject *)v80;
if ( !v80 )
goto LABEL_64;
v81 = ButtonSprite::init_1(
v80,
(__int64)"Set",
48,
0,
1057971241,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1102053376);
v79 = v77;
if ( v81 )
{
LABEL_60:
cocos2d::CCObject::autorelease(v79);
goto LABEL_64;
}
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v77 + 8LL))(v79, 1);
v77 = nullptr;
LABEL_64:
*(_QWORD *)(a1 + 1112) = v77;
v82 = CCMenuItemSpriteExtra::create((int)v77, 0, a1, (__int64)KeybindCapturePopup::onSet);
*(_QWORD *)(a1 + 1096) = v82;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v82);
v83 = **(_QWORD **)(a1 + 1096);
v84 = *(_QWORD *)(a1 + 552);
v85 = *(_QWORD *)(a1 + 1096);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v107, v21 - v73, v75);
cocos2d::CCNode::convertToNodeSpace(v84, &v106, v86);
(*(void (__fastcall **)(__int64, __int64))(v83 + 184))(v85, v87);
v88 = (char *)operator new(0x2C8u);
v107 = v88;
if ( v11 )
{
v89 = ButtonSprite::ButtonSprite((__int64)v88);
if ( !v89 )
{
LABEL_71:
*(_QWORD *)(a1 + 1120) = v89;
v93 = CCMenuItemSpriteExtra::create(v89, 0, a1, (__int64)KeybindCapturePopup::onRemove);
*(_QWORD *)(a1 + 1104) = v93;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v93);
v94 = **(_QWORD **)(a1 + 1104);
v95 = *(_QWORD *)(a1 + 552);
v96 = *(_QWORD *)(a1 + 1104);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v107, v73 + v21, v75);
cocos2d::CCNode::convertToNodeSpace(v95, &v106, v97);
(*(void (__fastcall **)(__int64, __int64))(v94 + 184))(v96, v98);
v99 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
LODWORD(v95) = (_DWORD)v99;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v99 + 160LL))(v99);
v100 = CCMenuItemSpriteExtra::create(v95, 0, a1, (__int64)sub_14009D628);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v100);
v101 = *(_QWORD *)v100;
v102 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v107,
v21 - (float)(*(float *)(a1 + 732) * 0.5),
(float)(*(float *)(a1 + 736) * 0.5) + v22);
cocos2d::CCNode::convertToNodeSpace(v102, &v106, v103);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v101 + 184))(v100, v104);
KeybindCapturePopup::updateChordDisplay(a1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1136LL))(a1);
*(_BYTE *)(a1 + 744) = 0;
return 1;
}
v90 = ButtonSprite::init_1(
v89,
(__int64)"Remove",
80,
0,
1060320051,
1,
&qword_140704F78,
(__int64)"GJ_button_06.png",
1105199104);
v91 = (cocos2d::CCObject *)v89;
if ( v90 )
{
LABEL_67:
cocos2d::CCObject::autorelease(v91);
goto LABEL_71;
}
}
else
{
v89 = ButtonSprite::ButtonSprite((__int64)v88);
if ( !v89 )
goto LABEL_71;
v92 = ButtonSprite::init_1(
v89,
(__int64)"Remove",
64,
0,
1057971241,
1,
&qword_140704F78,
(__int64)"GJ_button_06.png",
1102053376);
v91 = (cocos2d::CCObject *)v89;
if ( v92 )
goto LABEL_67;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v89 + 8LL))(v91, 1);
v89 = 0;
goto LABEL_71;
}
return result;
}