//
// KeybindingsSettingsPopup::init from 0x1403d8e80 to 0x1403d93be (1342 bytes)
//
// 2 xrefs:
// > KeybindingsLayer::onSettings @ 0x1403d8360
// > ??> @ 0x140924ba8
//
// 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:31:38 +0000
//
// Hidden C++ exception states: #wind=3
bool __fastcall KeybindingsSettingsPopup::init(__int64 a1, __int64 a2, __int64 a3)
{
bool result; // al
__int64 v7; // rcx
__int64 *v8; // r15
__int64 v9; // rax
__int64 v10; // rdx
float v11; // xmm7_4
float v12; // xmm7_4
__int64 v13; // rax
__int64 *v14; // rdi
__int64 v15; // rbx
__int64 v16; // rax
__int64 v17; // rbx
__int64 v18; // rax
struct cocos2d::CCLabelBMFont *v19; // rdi
__int64 v20; // rbx
float v21; // xmm7_4
__int64 v22; // rax
__int64 v23; // rcx
__int64 v24; // rax
__int64 v25; // rdi
__int64 v26; // rbx
__int64 v27; // rax
unsigned __int64 v28; // rdi
__int64 v29; // r8
__int64 v30; // r14
__int64 v31; // rbx
__int64 v32; // r12
cocos2d::CCObject *v33; // rsi
__int64 *v34; // rbx
__int64 v35; // rsi
float v36; // xmm0_4
__int64 v37; // rax
__int64 *v38; // rbx
cocos2d::CCObject *v39; // rdi
__int64 v40; // rbx
__int64 v41; // rax
void *v42; // [rsp+50h] [rbp-98h] BYREF
void *v43; // [rsp+58h] [rbp-90h]
__int64 v44[12]; // [rsp+60h] [rbp-88h] BYREF
float v45; // [rsp+108h] [rbp+20h] BYREF
float v46; // [rsp+10Ch] [rbp+24h]
result = FLAlertLayer::init_1(a1, 150);
if ( result )
{
*(_QWORD *)(a1 + 672) = a2;
v8 = (__int64 *)(a1 + 680);
if ( a1 + 680 != a3 )
sub_1403D8B00((char **)(a1 + 680), *(char **)a3, (*(_QWORD *)(a3 + 8) - *(_QWORD *)a3) / 40LL);
*(_BYTE *)(a1 + 596) = 1;
v9 = cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v9, &v45);
v10 = (*(_QWORD *)(a1 + 688) - *(_QWORD *)(a1 + 680)) / 40LL;
if ( v10 < 0 )
v11 = (float)(v10 & 1 | (unsigned int)((unsigned __int64)v10 >> 1))
+ (float)(v10 & 1 | (unsigned int)((unsigned __int64)v10 >> 1));
else
v11 = (float)(int)v10;
v12 = (float)(v11 * 38.0) + 66.0;
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v44, 0.0, 0.0, 80.0, 80.0);
v14 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v13);
v15 = *v14;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v42, 260.0, v12);
(*(void (__fastcall **)(__int64 *, __int64))(v15 + 312))(v14, v16);
v17 = *v14;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v42, v45 * 0.5, v46 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v17 + 184))(v14, v18);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v14,
4294967294LL);
v19 = cocos2d::CCLabelBMFont::create("Keybind Settings", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v19 + 160LL))(v19);
v20 = *(_QWORD *)v19;
v21 = v12 * 0.5;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v42, v45 * 0.5, (float)((float)(v46 * 0.5) + v21) - 20.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v20 + 184))(v19, v22);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v19);
v24 = cocos2d::CCMenu::create(v23);
*(_QWORD *)(a1 + 552) = v24;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v24, 10);
v25 = **(_QWORD **)(a1 + 552);
v26 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v42, v45 * 0.5, v46 * 0.5);
(*(void (__fastcall **)(__int64, __int64))(v25 + 184))(v26, v27);
v28 = 0;
v29 = *v8;
if ( (*(_QWORD *)(a1 + 688) - *(_QWORD *)(a1 + 680)) / 40LL )
{
v30 = 0;
while ( 1 )
{
v31 = *(_QWORD *)(v30 + v29 + 8);
v32 = *(_QWORD *)(v30 + v29);
v42 = operator new(0x2C8u);
v33 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v42);
if ( v33 )
{
if ( ButtonSprite::init_1((__int64)v33, v32, 130, 0, 1060320051, 1, &qword_140704F78, v31, 1105199104) )
{
cocos2d::CCObject::autorelease(v33);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v33 + 8LL))(v33, 1);
v33 = nullptr;
}
}
v43 = operator new(0x208u);
v34 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v43);
if ( !v34 )
goto LABEL_17;
if ( !CCMenuItemSpriteExtra::init(v34, (__int64 *)v33, 0, a1, (__int64)KeybindingsSettingsPopup::onEntry) )
break;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v34);
LABEL_18:
(*(void (__fastcall **)(__int64 *, _QWORD))(*v34 + 64))(v34, (unsigned int)v28);
v35 = *v34;
if ( (v28 & 0x8000000000000000uLL) != 0LL )
v36 = (float)(int)(v28 & 1 | (v28 >> 1)) + (float)(int)(v28 & 1 | (v28 >> 1));
else
v36 = (float)(int)v28;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v44, 0.0, (float)(v21 - 62.0) - (float)(v36 * 38.0));
(*(void (__fastcall **)(__int64 *, __int64))(v35 + 184))(v34, v37);
(*(void (__fastcall **)(_QWORD, __int64 *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v34);
++v28;
v30 += 40;
v29 = *v8;
if ( v28 >= (*(_QWORD *)(a1 + 688) - *(_QWORD *)(a1 + 680)) / 40LL )
goto LABEL_22;
}
(*(void (__fastcall **)(__int64 *, __int64))(*v34 + 8))(v34, 1);
LABEL_17:
v34 = nullptr;
goto LABEL_18;
}
LABEL_22:
v38 = (__int64 *)cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v44[0] = (__int64)operator new(0x208u);
v39 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v44[0]);
if ( v39 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v39, v38, 0, a1, (__int64)PagedListPopup::onClose) )
{
cocos2d::CCObject::autorelease(v39);
LABEL_27:
*((_DWORD *)v39 + 93) = 1069547520;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v39);
v40 = *(_QWORD *)v39;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v44, -120.0, v21 - 10.0);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v40 + 184))(v39, v41);
return 1;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v39 + 8LL))(v39, 1);
}
v39 = nullptr;
goto LABEL_27;
}
return result;
}