//
// KeybindCapturePopup::keyDown from 0x1005b5ab0 to 0x1005b5caa (506 bytes)
//
// 2 xrefs:
// > sub_1005B5CB0 @ 0x1005b5cbc
// > ??> @ 0x100b7dba0
//
// 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 12:32:41 +0000
//
__int64 __fastcall KeybindCapturePopup::keyDown(__int64 a1, unsigned int a2)
{
__int64 result; // rax
__int64 v3; // rax
unsigned int v4; // r14d
__int64 v5; // rax
unsigned int v6; // r15d
__int64 v7; // rax
__int64 v8; // rax
unsigned int v9; // ebx
__int64 v10; // rsi
int v11; // r14d
int v12; // ebx
result = a2 - 160;
if ( (unsigned int)result < 4 )
return result;
result = a2 - 16;
if ( (unsigned int)result < 3 )
return result;
if ( a2 == 27 )
return (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1368LL))(a1, 0);
v3 = cocos2d::CCDirector::sharedDirector();
v4 = *(unsigned __int8 *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 192LL))(v3) + 129);
v5 = cocos2d::CCDirector::sharedDirector();
v6 = *(unsigned __int8 *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 192LL))(v5) + 130);
v7 = cocos2d::CCDirector::sharedDirector();
v8 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 192LL))(v7);
result = GJKeybindManager::encodeChord(a2, v4, v6, *(unsigned __int8 *)(v8 + 128));
v9 = result;
if ( *(_BYTE *)(a1 + 1055) == 1 )
{
result = GJKeybindManager::isControllerChord((unsigned int)result);
if ( *(_BYTE *)(a1 + 1054) != (_BYTE)result )
return result;
}
if ( *(_BYTE *)(a1 + 1053) == 1 && v9 == *(_DWORD *)(a1 + 1048) )
{
if ( !v9 )
return result;
result = *(_QWORD *)(a1 + 1024);
if ( !result || *(_BYTE *)(a1 + 1056) )
return result;
if ( !*(_BYTE *)(a1 + 1052) )
{
v10 = *(unsigned int *)(a1 + 1044);
if ( (_DWORD)v10 )
{
if ( (_DWORD)v10 != v9 )
{
(*(void (__fastcall **)(_QWORD, __int64, _QWORD))(*(_QWORD *)result + 40LL))(
*(_QWORD *)(a1 + 1024),
v10,
*(unsigned int *)(a1 + 1040));
result = *(_QWORD *)(a1 + 1024);
v9 = *(_DWORD *)(a1 + 1048);
}
}
}
(*(void (__fastcall **)(__int64, _QWORD, _QWORD))(*(_QWORD *)result + 32LL))(
result,
v9,
*(unsigned int *)(a1 + 1040));
if ( *(_QWORD *)(a1 + 1064) )
sub_10097D2E0(*(_QWORD *)(a1 + 1064));
if ( *(_QWORD *)(a1 + 1032) )
sub_100495650(*(_QWORD *)(a1 + 1032));
return (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1368LL))(a1, 0);
}
*(_DWORD *)(a1 + 1048) = v9;
*(_BYTE *)(a1 + 1053) = 0;
if ( *(_QWORD *)(a1 + 1072) )
{
v11 = (unsigned __int16)v9;
v12 = v9 & 1;
sub_1008B6210(*(_QWORD *)(a1 + 1072), v12 == 0);
sub_1008B6200(*(_QWORD *)(a1 + 1072), (unsigned int)(v11 + v12 - 1));
if ( *(_QWORD *)(a1 + 1080) )
CCMenuItemToggler::toggle(*(_QWORD *)(a1 + 1080), v12 == 0);
}
return KeybindCapturePopup::updateChordDisplay(a1);
}