//
// ControllerInputNode::refreshVisuals from 0x1404480d0 to 0x14044841b (843 bytes)
//
// 5 xrefs:
// > ControllerInputNode::init @ 0x140448059
// > ControllerInputNode::onButton @ 0x140448452
// > KeybindCapturePopup::init @ 0x14044db85
// > KeybindCapturePopup::keyDown @ 0x14044efe3
// > ??> @ 0x140927290
//
// 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::refreshVisuals(__int64 a1, __int64 a2)
{
int *v2; // rbx
__int64 v3; // rdi
int v5; // ebp
int v6; // esi
__int64 v7; // rdx
__int64 v8; // rcx
__int16 *v9; // rdx
void (__fastcall ***v10)(_QWORD, __int16 *); // rcx
__int64 v11; // rdx
__int64 v12; // rcx
__int64 v13; // r8
__int64 v14; // r13
char *result; // rax
__int64 v16; // rsi
struct cocos2d::CCSprite **v17; // r14
int v18; // r15d
struct cocos2d::CCSprite *v19; // rax
struct cocos2d::CCSprite *v20; // rdi
__int64 v21; // rbx
_QWORD *v22; // rbx
unsigned __int8 v23; // bp
__int64 v24; // rax
unsigned int *v25; // rbx
__int64 v26; // rax
unsigned __int64 v27; // rbx
unsigned __int64 i; // rsi
__int16 v29; // ax
char v30; // cl
void (__fastcall **v31)(_QWORD *, __int16 *); // rax
__int64 v32; // rax
unsigned int *v33; // rbx
__int64 v34; // rax
unsigned __int64 v35; // rbx
unsigned __int64 j; // rsi
bool v37; // [rsp+20h] [rbp-88h] BYREF
__int16 v38; // [rsp+30h] [rbp-78h] BYREF
char v39; // [rsp+32h] [rbp-76h]
__int64 v40; // [rsp+40h] [rbp-68h]
__int64 v41; // [rsp+48h] [rbp-60h]
char *v42; // [rsp+50h] [rbp-58h]
__int64 v43; // [rsp+58h] [rbp-50h]
__int128 v44; // [rsp+60h] [rbp-48h]
v2 = (int *)&unk_140703C04;
v43 = 0;
v3 = 0;
v44 = 0;
do
{
v5 = *(_DWORD *)(a1 + 332);
v6 = *(v2 - 1);
if ( *v2 )
{
if ( *v2 != 1 )
{
v11 = 80;
if ( v6 == v5 )
v11 = 255;
v12 = *(_QWORD *)(*(_QWORD *)(a1 + 352) + v3) + 320LL;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v12 + 40LL))(v12, v11, 255);
}
if ( v6 == v5 )
*((_DWORD *)&v44 + *v2) = *(v2 - 1);
}
else
{
v7 = 50;
if ( v6 == v5 )
v7 = 255;
v8 = *(_QWORD *)(v3 + *(_QWORD *)(a1 + 352)) + 320LL;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v8 + 40LL))(v8, v7, 255);
v9 = &word_140703EA0;
if ( v6 == v5 )
v9 = &word_140703EC8;
v10 = (void (__fastcall ***)(_QWORD, __int16 *))(*(_QWORD *)(v3 + *(_QWORD *)(a1 + 352)) + 320LL);
(**v10)(v10, v9);
}
v3 += 8;
v2 += 8;
v13 = 255;
}
while ( (__int64)v2 < (__int64)dword_140703EA4 );
v14 = v43;
result = (char *)off_140703EB0 - a1;
v40 = 3;
v16 = a1 + 8;
v42 = (char *)off_140703EB0 - a1;
v17 = (struct cocos2d::CCSprite **)(a1 + 384);
v41 = a1 + 8;
do
{
if ( *v17 )
{
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64, __int64))(*(_QWORD *)*v17 + 512LL))(*v17, a2, v13);
result = v42;
}
v18 = *(_DWORD *)((char *)&v44 + v14 + 4);
v37 = 0;
if ( v18 )
v19 = KeybindingsLayer::buildControllerGlyph(v18, &v37);
else
v19 = cocos2d::CCSprite::createWithSpriteFrameName(*(const char **)((char *)v17 + (_QWORD)result - 384));
*v17 = v19;
v20 = v19;
if ( v19 )
{
v21 = *(_QWORD *)v19;
(*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v19 + 320LL))(v19);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(v21 + 160))(v20);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v20 + 184LL))(v20, v16 + 408);
v22 = (_QWORD *)((char *)v20 + 320);
v23 = 50;
if ( v18 )
v23 = -1;
(*(void (__fastcall **)(_QWORD *, _QWORD))(*v22 + 40LL))((_QWORD *)v20 + 40, v23);
v24 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v20 + 480LL))(v20);
if ( v24 )
{
v25 = *(unsigned int **)(v24 + 56);
v26 = *v25;
if ( (_DWORD)v26 )
{
v27 = *((_QWORD *)v25 + 2);
for ( i = v27 + 8 * (v26 - 1); v27 <= i; v27 += 8LL )
{
if ( !*(_QWORD *)v27 )
break;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)(*(_QWORD *)v27 + 320LL) + 40LL))(
*(_QWORD *)v27 + 320LL,
v23);
}
}
v22 = (_QWORD *)((char *)v20 + 320);
}
if ( v18 )
{
v29 = -1;
v30 = -1;
}
else
{
v29 = -26986;
v30 = -106;
}
v38 = v29;
v31 = *((void (__fastcall ***)(_QWORD *, __int16 *))v20 + 40);
v39 = v30;
(*v31)(v22, &v38);
v32 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v20 + 480LL))(v20);
if ( v32 )
{
v33 = *(unsigned int **)(v32 + 56);
v34 = *v33;
if ( (_DWORD)v34 )
{
v35 = *((_QWORD *)v33 + 2);
for ( j = v35 + 8 * (v34 - 1); v35 <= j; v35 += 8LL )
{
if ( !*(_QWORD *)v35 )
break;
(**(void (__fastcall ***)(__int64, __int16 *))(*(_QWORD *)v35 + 320LL))(*(_QWORD *)v35 + 320LL, &v38);
}
}
}
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v20, 1);
v16 = v41;
}
result = v42;
v16 += 8;
++v17;
v41 = v16;
v14 += 4;
--v40;
}
while ( v40 );
return result;
}