//
// ControllerInputNode::init from 0x140447b60 to 0x14044807c (1308 bytes)
//
// 4 xrefs:
// > KeybindCapturePopup::init @ 0x14044d8e5
// > ??> @ 0x1408cbbb8
// > ??> @ 0x1408cbbc8
// > ??> @ 0x140927260
//
// 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:24 +0000
//
char __fastcall ControllerInputNode::init(__int64 *a1, __int64 a2, float *a3)
{
struct cocos2d::CCSprite *v6; // rax
__int64 v7; // rbx
float v8; // xmm7_4
__int64 v9; // rax
__int64 v10; // rbx
__int64 v11; // rax
float *v12; // rbx
float *v13; // rax
__int64 v14; // rcx
float *v15; // rbx
__int64 *v16; // rsi
__int64 v17; // rdi
__int64 v18; // rax
__int64 v19; // rax
__int64 v20; // rcx
__int64 v21; // r13
__int64 v22; // rcx
__int64 v23; // rax
cocos2d::CCTouchDispatcher *v24; // rax
__int64 v25; // rcx
__int64 v26; // rax
__int64 v27; // rax
unsigned int v28; // r12d
__int64 i; // rsi
int v30; // eax
struct cocos2d::CCSprite *v31; // rdi
__int64 v32; // rbx
__int64 v33; // rbx
__int64 v34; // rax
__int64 v35; // rax
_BYTE *v36; // rdx
__int64 v37; // rbx
__int64 v38; // rax
_BYTE *v39; // rdx
cocos2d::CCObject *v40; // rbx
struct cocos2d::CCSprite *v42; // [rsp+20h] [rbp-69h] BYREF
_BYTE v43[8]; // [rsp+28h] [rbp-61h] BYREF
_BYTE v44[8]; // [rsp+30h] [rbp-59h] BYREF
_BYTE v45[8]; // [rsp+38h] [rbp-51h] BYREF
_BYTE v46[8]; // [rsp+40h] [rbp-49h] BYREF
_BYTE v47[8]; // [rsp+48h] [rbp-41h] BYREF
_BYTE v48[16]; // [rsp+50h] [rbp-39h] BYREF
char v49; // [rsp+108h] [rbp+7Fh] BYREF
if ( !cocos2d::CCNode::init((cocos2d::CCNode *)a1) )
return 0;
a1[40] = a2;
v6 = cocos2d::CCSprite::create("controller_outline.png");
a1[43] = (__int64)v6;
if ( !v6 )
return 0;
v7 = *a1;
v8 = fminf(*a3 / 400.0, a3[1] / 276.0);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v49, v8 * 400.0, v8 * 276.0);
(*(void (__fastcall **)(__int64 *, __int64))(v7 + 312))(a1, v9);
v10 = *a1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, 0.5, 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v10 + 288))(a1, v11);
v12 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1[43] + 320LL))(a1[43]);
v13 = (float *)(*(__int64 (__fastcall **)(__int64 *))(*a1 + 320))(a1);
v14 = a1[43];
*((float *)a1 + 84) = *v13 / *v12;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v14 + 160LL))(v14);
(**(void (__fastcall ***)(__int64, void *))(a1[43] + 320))(a1[43] + 320, &unk_140703BF0);
v15 = (float *)(*(__int64 (__fastcall **)(__int64 *))(*a1 + 320))(a1);
v16 = (__int64 *)a1[43];
v17 = *v16;
v18 = (*(__int64 (__fastcall **)(__int64 *))(*a1 + 320))(a1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, *v15 * 0.5, (float)(*(float *)(v18 + 4) * 0.5) + 10.0);
(*(void (__fastcall **)(__int64 *, __int64))(v17 + 184))(v16, v19);
(*(void (__fastcall **)(__int64 *, __int64))(*a1 + 464))(a1, a1[43]);
v21 = cocos2d::CCMenu::create(v20);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v21 + 184LL))(v21, &unk_14090B018);
(*(void (__fastcall **)(__int64 *, __int64, __int64))(*a1 + 456))(a1, v21, 2);
v23 = cocos2d::CCDirector::sharedDirector(v22);
v24 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v23 + 144LL))(v23);
if ( cocos2d::CCTouchDispatcher::isUsingForcePrio(v24) )
{
v26 = cocos2d::CCDirector::sharedDirector(v25);
v27 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v26 + 144LL))(v26);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v21 + 944LL))(v21, (unsigned int)(*(_DWORD *)(v27 + 128) - 1));
}
v28 = 0;
for ( i = 0; i < 672; i += 32 )
{
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v49,
v8 * *(float *)((char *)&unk_140703C00 + i + 16),
v8 * *(float *)((char *)&unk_140703C00 + i + 20));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v43, (const struct cocos2d::CCPoint *)&v49);
v30 = *(_DWORD *)((char *)&unk_140703C00 + i + 4);
if ( v30 )
{
if ( v30 == 1 )
{
v42 = (struct cocos2d::CCSprite *)cocos2d::CCSprite::create();
v31 = v42;
v33 = *(_QWORD *)v42;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v46, 17.0, 17.0);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v33 + 312))(v31, v34);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v47,
(float)*(int *)((char *)&unk_140703C00 + i + 24) * 15.0,
(float)*(int *)((char *)&unk_140703C00 + i + 28) * 15.0);
cocos2d::CCPoint::operator+(&v49, v44, v35);
v36 = v44;
}
else
{
v42 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_select_001.png");
v31 = v42;
v37 = *(_QWORD *)v42;
(*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v42 + 320LL))(v42);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(v37 + 160))(v31);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v48,
(float)*(int *)((char *)&unk_140703C00 + i + 24) * 20.0,
(float)*(int *)((char *)&unk_140703C00 + i + 28) * 20.0);
cocos2d::CCPoint::operator+(&v49, v45, v38);
v36 = v45;
}
cocos2d::CCPoint::operator=(v43, v36);
cocos2d::CCPoint::operator=(&a1[*(int *)((char *)&unk_140703C00 + i + 4) + 51], &v49);
}
else
{
v42 = cocos2d::CCSprite::createWithSpriteFrameName(*(const char **)((char *)&unk_140703C00 + i + 8));
v31 = v42;
v32 = *(_QWORD *)v42;
(*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v42 + 320LL))(v42);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(v32 + 160))(v31);
}
v39 = (_BYTE *)a1[45];
if ( v39 == (_BYTE *)a1[46] )
{
sub_1400699B0(a1 + 44, v39, &v42);
}
else
{
*(_QWORD *)v39 = v31;
a1[45] += 8;
}
v40 = CCMenuItemSpriteExtra::create((int)v31, 0, (int)a1, (__int64)ControllerInputNode::onButton);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v40 + 64LL))(v40, v28);
(*(void (__fastcall **)(cocos2d::CCObject *, _BYTE *))(*(_QWORD *)v40 + 184LL))(v40, v43);
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)v21 + 464LL))(v21, v40);
++v28;
}
ControllerInputNode::refreshVisuals(a1);
return 1;
}