//
// KeybindCapturePopup::init from 0x79a8e8 to 0x79afc0 (1752 bytes)
//
// 1 xrefs:
// > KeybindCapturePopup::create @ 0x79b258
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:59:49 +0000
//
GameManager *__fastcall KeybindCapturePopup::init(int a1, int a2, int a3, int a4, int a5, int a6)
{
float v10; // s15
GameManager *v11; // r8
cocos2d::CCDirector *v12; // r0
int v13; // r0
cocos2d::CCDirector *v14; // r0
int v15; // r1
int v16; // r3
float v17; // s17
float v18; // s18
const char *v19; // r0
const char *v20; // r7
size_t v21; // r0
const char *v22; // r2
int v23; // r1
cocos2d::CCLabelBMFont *v24; // r0
const char *v25; // r2
int v26; // r6
void (__fastcall *v27)(int, _DWORD *); // r3
void (__fastcall *v28)(int, _DWORD *); // r7
int v29; // r0
int v30; // r6
void (__fastcall *v31)(int, _DWORD *); // r9
float v32; // s15
const char *v33; // r2
int v34; // r0
int v35; // r0
void (__fastcall *v36)(int, _DWORD *); // r3
int v37; // r7
void (__fastcall *v38)(int, _DWORD *); // r9
float v39; // s15
InputCaptureDelegate *v40; // r1
float v41; // s19
float v42; // s20
float v43; // s19
const cocos2d::CCSize *v44; // r2
int *v45; // r0
int v46; // r7
void (__fastcall *v47)(int, _DWORD *); // r9
ButtonSprite *v48; // r9
ButtonSprite *v49; // r0
cocos2d::CCNodeRGBA *v50; // r0
int v51; // r7
const cocos2d::CCPoint *v52; // r10
void (__fastcall *v53)(int, _DWORD *); // r9
int v54; // r1
GJKeybindManager *v55; // r0
int v56; // r0
int v57; // r6
void (__fastcall *v58)(int, _DWORD *); // r7
float v59; // s19
ButtonSprite *v60; // r0
int v61; // r0
void (__fastcall *v62)(int, _DWORD *); // r11
ButtonSprite *v63; // r0
int v64; // r0
int v65; // r9
const cocos2d::CCPoint *v66; // r11
void (__fastcall *v67)(int, _DWORD *); // r10
const char *v68; // r1
int v69; // r9
int v70; // r6
const cocos2d::CCPoint *v71; // r10
void (__fastcall *v72)(int, _BYTE *); // r9
int v74; // r5
int v75; // r1
float v76; // [sp+10h] [bp-5Ch]
float v77; // [sp+10h] [bp-5Ch]
float v78; // [sp+10h] [bp-5Ch]
cocos2d::CCPoint *v79; // [sp+14h] [bp-58h]
int v80; // [sp+1Ch] [bp-50h]
float v81[2]; // [sp+20h] [bp-4Ch] BYREF
_BYTE v82[8]; // [sp+28h] [bp-44h] BYREF
_BYTE v83[8]; // [sp+30h] [bp-3Ch] BYREF
_DWORD (*v84)(KeybindCapturePopup *__hidden, cocos2d::CCObject *); // [sp+38h] [bp-34h]
int v85; // [sp+3Ch] [bp-30h]
_DWORD *(__fastcall *v86)(_DWORD *, cocos2d::CCObject *); // [sp+40h] [bp-2Ch]
int v87; // [sp+44h] [bp-28h]
_DWORD v88[2]; // [sp+48h] [bp-24h] BYREF
_DWORD v89[2]; // [sp+50h] [bp-1Ch] BYREF
int v90; // [sp+58h] [bp-14h] BYREF
int v91; // [sp+5Ch] [bp-10h]
int v92; // [sp+60h] [bp-Ch]
v10 = 280.0;
if ( a6 != 1 )
v10 = 290.0;
v11 = SetupTriggerPopup::init((SetupTriggerPopup *)a1, nullptr, nullptr, 420.0, v10, &byte_7, 0.0);
if ( v11 )
{
SetupTriggerPopup::preSetup((SetupTriggerPopup *)a1);
qmemcpy(v89, "PWi", 3);
SetupTriggerPopup::setCustomBGColor(a1, (int)v89);
v12 = (cocos2d::CCDirector *)(*(int (__fastcall **)(int, int))(*(_DWORD *)a1 + 544))(a1, 1);
v13 = cocos2d::CCDirector::sharedDirector(v12);
*(_BYTE *)((*(int (__fastcall **)(int))(*(_DWORD *)v13 + 96))(v13) + 94) = 1;
*(_DWORD *)(a1 + 728) = a4;
*(_DWORD *)(a1 + 732) = a4;
*(_DWORD *)(a1 + 716) = a2;
*(_DWORD *)(a1 + 720) = a5;
*(_DWORD *)(a1 + 724) = a3;
*(_BYTE *)(a1 + 736) = a4 == 0;
*(_BYTE *)(a1 + 738) = a6 == 1;
if ( a2 )
v14 = (cocos2d::CCDirector *)(*(int (__fastcall **)(int))(*(_DWORD *)a2 + 24))(a2);
else
v14 = nullptr;
*(_BYTE *)(a1 + 739) = (_BYTE)v14;
cocos2d::CCDirector::sharedDirector(v14);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v81);
v16 = *(unsigned __int8 *)(a1 + 738);
v17 = v81[0] * 0.5;
v18 = v81[1] * 0.5;
if ( *(_BYTE *)(a1 + 738) )
{
v19 = GJKeybindManager::actionToString(*(GJKeybindManager **)(a1 + 724), v15);
v90 = 0;
v91 = 0;
v92 = 0;
v20 = v19;
v21 = strlen(v19);
std::string::__init(&v90, v20, v21);
SetupTriggerPopup::addTitle(a1, (unsigned __int8 *)&v90);
std::string::~string((int)&v90);
}
else
{
v90 = *(unsigned __int8 *)(a1 + 738);
v91 = v16;
v92 = v16;
std::string::__init(&v90, "Edit Keybind", 0xCu);
SetupTriggerPopup::addTitle(a1, (unsigned __int8 *)&v90);
std::string::~string((int)&v90);
v24 = (cocos2d::CCLabelBMFont *)GJKeybindManager::actionToString(*(GJKeybindManager **)(a1 + 724), v23);
v26 = cocos2d::CCLabelBMFont::create(v24, "bigFont.fnt", v25);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v26 + 80))(v26, 1058642330);
v27 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v26 + 536);
LOWORD(v89[0]) = -14236;
BYTE2(v89[0]) = -1;
v27(v26, v89);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 460) + 228))(*(_DWORD *)(a1 + 460), v26);
v28 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v26 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v89, v17, (float)(v18 + (float)(*(float *)(a1 + 560) * 0.5)) - 36.0);
v28(v26, v89);
}
v29 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)" ", "goldFont.fnt", v22);
*(_DWORD *)(a1 + 756) = v29;
(*(void (__fastcall **)(int, int))(*(_DWORD *)v29 + 80))(v29, 1061997773);
(*(void (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(a1 + 460) + 228))(
*(_DWORD *)(a1 + 460),
*(_DWORD *)(a1 + 756));
v30 = *(_DWORD *)(a1 + 756);
v31 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v30 + 92);
v32 = 40.0;
if ( !*(_BYTE *)(a1 + 738) )
v32 = 64.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v89, v17, (float)(v18 + (float)(*(float *)(a1 + 560) * 0.5)) - v32);
v31(v30, v89);
v34 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)" ", "bigFont.fnt", v33);
*(_DWORD *)(a1 + 764) = v34;
(*(void (__fastcall **)(int, int))(*(_DWORD *)v34 + 80))(v34, 1056964608);
v35 = *(_DWORD *)(a1 + 764);
v36 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v35 + 536);
LOWORD(v89[0]) = -26881;
BYTE2(v89[0]) = 50;
v36(v35, v89);
(*(void (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(a1 + 460) + 228))(
*(_DWORD *)(a1 + 460),
*(_DWORD *)(a1 + 764));
v37 = *(_DWORD *)(a1 + 764);
v38 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v37 + 92);
v39 = 58.0;
if ( !*(_BYTE *)(a1 + 738) )
v39 = 86.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v89, v17, (float)(v18 + (float)(*(float *)(a1 + 560) * 0.5)) - v39);
v38(v37, v89);
if ( *(_BYTE *)(a1 + 738) )
{
v41 = *(float *)(a1 + 560) * 0.5;
v42 = (float)(v18 + v41) - 70.0;
v43 = (float)(v18 - v41) + 50.0;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v89, *(float *)(a1 + 556) - 30.0, v42 - v43);
v45 = ControllerInputNode::create((ControllerInputNode *)(a1 + 712), (InputCaptureDelegate *)v89, v44);
*(_DWORD *)(a1 + 748) = v45;
(*(void (__fastcall **)(_DWORD, int *))(**(_DWORD **)(a1 + 460) + 228))(*(_DWORD *)(a1 + 460), v45);
v46 = *(_DWORD *)(a1 + 748);
v47 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v46 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v89, v17, (float)((float)(v42 + v43) * 0.5) - 20.0);
v47(v46, v89);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 748) + 80))(*(_DWORD *)(a1 + 748), 1066192077);
v48 = ButtonSprite::create(
(ButtonSprite *)"Controller 1",
(const char *)&dword_58 + 2,
0,
0.45,
1,
"bigFont.fnt",
"GJ_button_01.png",
(const char *)0x41B00000,
v76);
v49 = ButtonSprite::create(
(ButtonSprite *)"Controller 2",
(const char *)&dword_58 + 2,
0,
0.45,
1,
"bigFont.fnt",
"GJ_button_02.png",
(const char *)0x41B00000,
v77);
v85 = 0;
v84 = KeybindCapturePopup::onToggleController;
v50 = CCMenuItemToggler::create((int)v48, (int)v49, a1, (int)KeybindCapturePopup::onToggleController, 0);
*(_DWORD *)(a1 + 752) = v50;
(*(void (__fastcall **)(_DWORD, cocos2d::CCNodeRGBA *))(**(_DWORD **)(a1 + 444) + 228))(
*(_DWORD *)(a1 + 444),
v50);
v51 = *(_DWORD *)(a1 + 752);
v52 = *(const cocos2d::CCPoint **)(a1 + 444);
v53 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v51 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v88,
(float)(v17 + (float)(*(float *)(a1 + 556) * 0.5)) - 62.0,
(float)(v18 + (float)(*(float *)(a1 + 560) * 0.5)) - 25.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v89, v52);
v53(v51, v89);
v55 = *(GJKeybindManager **)(a1 + 728);
if ( v55 && GJKeybindManager::isControllerChord(v55, v54) )
{
v74 = *(unsigned __int16 *)(a1 + 728);
ControllerInputNode::setController2(*(ControllerInputNode **)(a1 + 748), !(v74 & 1));
if ( (v74 & 1) != 0 )
v75 = v74;
else
v75 = v74 - 1;
ControllerInputNode::setActiveKey(*(ControllerInputNode **)(a1 + 748), v75);
CCMenuItemToggler::toggle(*(CCMenuItemToggler **)(a1 + 752), !(v74 & 1));
}
}
else
{
v56 = VirtualKeyboardNode::create((VirtualKeyboardNode *)(a1 + 712), v40);
*(_DWORD *)(a1 + 744) = v56;
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 460) + 228))(*(_DWORD *)(a1 + 460), v56);
v57 = *(_DWORD *)(a1 + 744);
v58 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v57 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v89, v17, v18 - 2.0);
v58(v57, v89);
}
v59 = (float)(v18 - (float)(*(float *)(a1 + 560) * 0.5)) + 16.0;
v60 = ButtonSprite::create(
(ButtonSprite *)"Set",
(const char *)&word_30,
0,
0.56,
1,
"bigFont.fnt",
"GJ_button_01.png",
COERCE_CONST_CHAR_(22.0),
v76);
v87 = 0;
v86 = KeybindCapturePopup::onSet;
*(_DWORD *)(a1 + 776) = v60;
v61 = CCMenuItemSpriteExtra::create((int)v60, 0, a1, (int)KeybindCapturePopup::onSet, 0);
*(_DWORD *)(a1 + 768) = v61;
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v61);
v80 = *(_DWORD *)(a1 + 768);
v62 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v80 + 92);
v79 = *(cocos2d::CCPoint **)(a1 + 444);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v88, v17 - 48.0, v59);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v89, v79);
v62(v80, v89);
v63 = ButtonSprite::create(
(ButtonSprite *)"Remove",
(const char *)&dword_40,
0,
0.56,
1,
"bigFont.fnt",
"GJ_button_06.png",
COERCE_CONST_CHAR_(22.0),
v78);
v88[0] = KeybindCapturePopup::onRemove;
v88[1] = 0;
*(_DWORD *)(a1 + 780) = v63;
v64 = CCMenuItemSpriteExtra::create((int)v63, 0, a1, (int)KeybindCapturePopup::onRemove, 0);
*(_DWORD *)(a1 + 772) = v64;
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v64);
v65 = *(_DWORD *)(a1 + 772);
v66 = *(const cocos2d::CCPoint **)(a1 + 444);
v67 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v65 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v83, v17 + 48.0, v59);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v89, v66);
v67(v65, v89);
v69 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v68);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v69 + 80))(v69, 1060320051);
v89[0] = 684;
v89[1] = 1;
v70 = CCMenuItemSpriteExtra::create(v69, 0, a1, 684, 1);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v70);
v71 = *(const cocos2d::CCPoint **)(a1 + 444);
v72 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v70 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v82,
v17 - (float)(*(float *)(a1 + 556) * 0.5),
v18 + (float)(*(float *)(a1 + 560) * 0.5));
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v83, v71);
v72(v70, v83);
KeybindCapturePopup::updateChordDisplay((KeybindCapturePopup *)a1);
SetupTriggerPopup::postSetup((SetupTriggerPopup *)a1);
}
return v11;
}