//
// KeybindCapturePopup::keyDown from 0x1001a58a4 to 0x1001a59fc (344 bytes)
//
// 2 xrefs:
// > sub_1001A59FC @ 0x1001a5a00
// > ??> @ 0x1008e5618
//
// 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 11:00:03 +0000
//
__int64 __fastcall KeybindCapturePopup::keyDown(__int64 result, __int64 a2)
{
__int64 v3; // x19
__int64 v4; // x0
__int64 v5; // x0
int v6; // w21
__int64 v7; // x0
__int64 v8; // x0
int v9; // w22
__int64 v10; // x0
__int64 v11; // x0
int v12; // w0
int v13; // w20
__int64 v14; // x0
__int64 v15; // x0
if ( (unsigned int)(a2 - 160) >= 4 && (unsigned int)(a2 - 16) >= 3 )
{
v3 = result;
if ( (_DWORD)a2 == 27 )
{
return (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)result + 1368LL))(result, 0);
}
else
{
v4 = cocos2d::CCDirector::sharedDirector(result);
v5 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 192LL))(v4);
v6 = *(unsigned __int8 *)(v5 + 129);
v7 = cocos2d::CCDirector::sharedDirector(v5);
v8 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 192LL))(v7);
v9 = *(unsigned __int8 *)(v8 + 130);
v10 = cocos2d::CCDirector::sharedDirector(v8);
v11 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 192LL))(v10);
v12 = GJKeybindManager::encodeChord(a2, v6, v9, *(unsigned __int8 *)(v11 + 128));
v13 = v12;
if ( *(_BYTE *)(v3 + 1055) != 1
|| (result = GJKeybindManager::isControllerChord(v12), *(unsigned __int8 *)(v3 + 1054) == (_DWORD)result) )
{
if ( *(_BYTE *)(v3 + 1053) == 1 && v13 == *(_DWORD *)(v3 + 1048) )
{
return KeybindCapturePopup::onSet(v3);
}
else
{
*(_DWORD *)(v3 + 1048) = v13;
*(_BYTE *)(v3 + 1053) = 0;
v14 = *(_QWORD *)(v3 + 1072);
if ( v14 )
{
sub_1004AB5FC(v14, (v13 & 1) == 0);
sub_1004AB5F4(*(_QWORD *)(v3 + 1072), (v13 & 1) + (unsigned int)(unsigned __int16)v13 - 1);
v15 = *(_QWORD *)(v3 + 1080);
if ( v15 )
CCMenuItemToggler::toggle(v15, (v13 & 1) == 0);
}
return KeybindCapturePopup::updateChordDisplay(v3);
}
}
}
}
return result;
}