//
// ControllerInputNode::refreshVisuals from 0xc96068 to 0xc9637c (788 bytes)
//
// 4 xrefs:
// > ControllerInputNode::onButton @ 0xc963b4
// > ControllerInputNode::setActiveKey @ 0xc96408
// > ControllerInputNode::init @ 0xc96a5c
// > ??> @ 0x6ee90
//
// This function is hookable on this platform (idp: arm, 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 13:05:53 +0000
//
__int64 __fastcall ControllerInputNode::refreshVisuals(ControllerInputNode *this, __int64 a2, bool *a3)
{
const char *v3; // x1
__int64 v5; // x22
int *v6; // x23
int v7; // w24
int v8; // w26
_BOOL4 v9; // w28
char *v10; // x23
unsigned __int64 i; // x22
__int64 v12; // x0
unsigned int v13; // w21
__int64 v14; // x19
float v15; // s8
void (__fastcall *v16)(__int64, float); // x20
__int64 v17; // x0
__int64 v18; // x0
int *v19; // x1
unsigned int v20; // w24
unsigned int v21; // w0
char *v22; // x28
__int64 v23; // x0
char *v24; // x20
__int64 v25; // x0
__int64 *v26; // x0
__int64 v28; // x1
__int64 v29; // x0
char v30; // [xsp+97h] [xbp+97h] BYREF
_DWORD v31[4]; // [xsp+98h] [xbp+98h] BYREF
v3 = (const char *)&off_13FB000;
v5 = 0;
v6 = (int *)&unk_13FB144;
v31[0] = 0;
v31[1] = 0;
v31[2] = 0;
v31[3] = 0;
do
{
v7 = *(v6 - 1);
v8 = *v6;
v9 = v7 == *((_DWORD *)this + 83);
if ( *v6 )
{
if ( v8 != 1 )
{
if ( v7 == *((_DWORD *)this + 83) )
v28 = 255;
else
v28 = 80;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(*((_QWORD *)this + 44) + v5) + 912LL))(
*(_QWORD *)(*((_QWORD *)this + 44) + v5),
v28);
}
if ( v9 )
v31[v8] = v7;
}
else
{
(*(void (**)(void))(**(_QWORD **)(*((_QWORD *)this + 44) + v5) + 912LL))();
(*(void (**)(void))(**(_QWORD **)(*((_QWORD *)this + 44) + v5) + 960LL))();
}
v5 += 8;
v6 += 8;
}
while ( v5 != 168 );
v10 = (char *)this + 416;
for ( i = 0; i != 12; i += 4LL )
{
v12 = *((_QWORD *)v10 - 4);
if ( v12 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 520LL))(v12);
v30 = 0;
v13 = v31[i / 4 + 1];
if ( v13 )
v14 = KeybindingsLayer::buildControllerGlyph((KeybindingsLayer *)v13, &v30, a3);
else
v14 = cocos2d::CCSprite::createWithSpriteFrameName(*(cocos2d::CCSprite **)((char *)&unk_13FB3E0 + 2 * i + 8), v3);
*((_QWORD *)v10 - 4) = v14;
if ( v14 )
{
v15 = *(float *)((char *)&unk_11A1BC0 + i + 4);
v16 = *(void (__fastcall **)(__int64, float))(*(_QWORD *)v14 + 160LL);
v17 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 328LL))(v14);
v16(v14, v15 / *(float *)(v17 + 4));
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v14 + 184LL))(v14, v10);
if ( v13 )
{
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v14 + 912LL))(v14, 0xFFFFFFFFLL);
v18 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 488LL))(v14);
if ( !v18 )
goto LABEL_22;
v19 = *(int **)(v18 + 56);
v20 = 255;
v21 = *v19;
if ( !*v19 )
goto LABEL_22;
}
else
{
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v14 + 912LL))(v14, 50);
v29 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 488LL))(v14);
if ( !v29 || (v19 = *(int **)(v29 + 56), v20 = 50, (v21 = *v19) == 0) )
{
LABEL_18:
v26 = &qword_11A1BB0;
LABEL_19:
KeybindingsLayer::tintGlyph(v14, *v26);
(*(void (__fastcall **)(ControllerInputNode *, __int64, __int64))(*(_QWORD *)this + 464LL))(this, v14, 1);
goto LABEL_20;
}
}
v22 = *((char **)v19 + 2);
v23 = 8LL * v21 - 8;
v24 = &v22[v23];
while ( v24 >= v22 )
{
v25 = *(_QWORD *)v22;
if ( !*(_QWORD *)v22 )
break;
v22 += 8;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v25 + 912LL))(v25, v20);
}
if ( !v13 )
goto LABEL_18;
LABEL_22:
v26 = &qword_11A1BB8;
goto LABEL_19;
}
LABEL_20:
v10 += 8;
}
return _stack_chk_guard;
}