//
// LevelSelectLayer::keyDown from 0x140442ec0 to 0x140442f9c (220 bytes)
//
// 4 xrefs:
// > ??> @ 0x140792078
// > ??> @ 0x1408cb708
// > ??> @ 0x1408cb718
// > ??> @ 0x140927158
//
// 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:22 +0000
//
void __fastcall LevelSelectLayer::keyDown(__int64 a1, int a2)
{
bool v2; // zf
__int64 v3; // rdi
signed int v4; // ebx
cocos2d::CCArray *v5; // rcx
signed int v6; // ecx
struct cocos2d::CCObject *v7; // rax
if ( a2 > 1001 )
{
if ( a2 != 1009 )
{
if ( a2 != 1025 )
{
v2 = a2 == 1027;
LABEL_10:
if ( v2 )
LevelSelectLayer::onNext(a1 - 344);
else
cocos2d::CCLayer::keyDown(a1);
return;
}
LABEL_13:
LevelSelectLayer::onPrev(a1 - 344);
return;
}
}
else if ( a2 != 1001 && a2 != 13 && a2 != 32 )
{
if ( a2 != 37 )
{
v2 = a2 == 39;
goto LABEL_10;
}
goto LABEL_13;
}
if ( !byte_1409097A4 )
{
v3 = *(_QWORD *)(a1 + 104);
v4 = *(_DWORD *)(v3 + 588);
v5 = *(cocos2d::CCArray **)(v3 + 480);
if ( *(_BYTE *)(v3 + 456) )
{
v6 = cocos2d::CCArray::count(v5);
if ( v4 <= 0 )
{
for ( ; v4 < 0; v4 += v6 )
;
}
else
{
v4 %= v6;
}
v5 = *(cocos2d::CCArray **)(v3 + 480);
}
v7 = cocos2d::CCArray::objectAtIndex(v5, v4);
LevelPage::onPlay(v7, 0);
}
}