//
// LevelSelectLayer::keyDown from 0x140319ad0 to 0x140319bac (220 bytes)
//
// 4 xrefs:
// > ??> @ 0x14058c988
// > ??> @ 0x140692ee8
// > ??> @ 0x140692ef8
// > ??> @ 0x1406d4a90
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void LevelSelectLayer::keyDown(LevelSelectLayer *a1, cocos2d::enumKeyCodes a2, double a3)
{
bool v3; // zf
__int64 v4; // rdi
signed int v5; // ebx
cocos2d::CCArray *v6; // rcx
signed int v7; // ecx
LevelPage *v8; // rax
if ( a2 > CONTROLLER_A )
{
if ( a2 != CONTROLLER_Start )
{
if ( a2 != CONTROLLER_Left )
{
v3 = a2 == CONTROLLER_Right;
LABEL_10:
if ( v3 )
LevelSelectLayer::onNext((LevelSelectLayer *)((char *)a1 - 344), nullptr);
else
cocos2d::CCLayer::keyDown(a1, a2, a3);
return;
}
LABEL_13:
LevelSelectLayer::onPrev((LevelSelectLayer *)((char *)a1 - 344), nullptr);
return;
}
}
else if ( a2 != CONTROLLER_A && a2 != KEY_Enter && a2 != KEY_Space )
{
if ( a2 != KEY_Left )
{
v3 = a2 == KEY_Right;
goto LABEL_10;
}
goto LABEL_13;
}
if ( !byte_1406C10B8 )
{
v4 = *(_QWORD *)&a1->m_obAnchorPoint.y;
v5 = *(_DWORD *)(v4 + 580);
v6 = *(cocos2d::CCArray **)(v4 + 472);
if ( *(_BYTE *)(v4 + 448) )
{
v7 = cocos2d::CCArray::count(v6);
if ( v5 <= 0 )
{
for ( ; v5 < 0; v5 += v7 )
;
}
else
{
v5 %= v7;
}
v6 = *(cocos2d::CCArray **)(v4 + 472);
}
v8 = (LevelPage *)cocos2d::CCArray::objectAtIndex(v6, v5);
LevelPage::onPlay(v8, nullptr);
}
}