//
// LevelInfoLayer::tryCloneLevel from 0x1402fd400 to 0x1402fd68e (654 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::init @ 0x1402f8bb8
// > ??> @ 0x1406d422c
//
// 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
//
// Hidden C++ exception states: #wind=2
void LevelInfoLayer::tryCloneLevel(LevelInfoLayer *a1, cocos2d::CCObject *a2)
{
GJGameLevel *m_level; // rcx
__int64 v4; // rax
FLAlertLayer *v5; // rbx
NumberInputLayer *v6; // rbx
bool (*init)(NumberInputLayer *); // rdx
bool v8; // al
void (*show)(FLAlertLayer *); // rdx
__int128 v10; // [rsp+50h] [rbp-48h] BYREF
__int64 v11; // [rsp+60h] [rbp-38h]
__int64 v12; // [rsp+68h] [rbp-30h]
char v13[32]; // [rsp+70h] [rbp-28h] BYREF
if ( !a1->m_isBusy )
{
m_level = a1->m_level;
if ( m_level->m_password.random - m_level->m_password.seed == 1 )
{
LevelInfoLayer::confirmClone(a1, nullptr);
}
else if ( m_level->m_failedPasswordAttempts < 5 )
{
v6 = (NumberInputLayer *)operator new(0x2B8u);
FLAlertLayer::FLAlertLayer(v6);
v6->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (NumberInputLayer_vtbl *)&NumberInputLayer::`vftable';
v6->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCTouchDelegate::__vftable = (cocos2d::CCTouchDelegate_vtbl *)&NumberInputLayer::`vftable';
v6->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCAccelerometerDelegate::__vftable = (cocos2d::CCAccelerometerDelegate_vtbl *)&NumberInputLayer::`vftable';
v6->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeypadDelegate::__vftable = (cocos2d::CCKeypadDelegate_vtbl *)&NumberInputLayer::`vftable';
v6->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeyboardDelegate::__vftable = (cocos2d::CCKeyboardDelegate_vtbl *)&NumberInputLayer::`vftable';
v6->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCMouseDelegate::__vftable = (cocos2d::CCMouseDelegate_vtbl *)&NumberInputLayer::`vftable';
v6->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCRGBAProtocol::__vftable = (cocos2d::CCRGBAProtocol_vtbl *)&NumberInputLayer::`vftable';
v6->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCBlendProtocol::__vftable = (cocos2d::CCBlendProtocol_vtbl *)&NumberInputLayer::`vftable';
v6->m_okButton = nullptr;
v6->m_minimum = 4;
v6->m_maximum = 4;
v6->m_inputString.m_data.0 = 0;
v6->m_inputString.m_data.m_size = 0;
v6->m_inputString.m_data.m_capacity = 15;
v6->m_inputString.m_data.m_smallStorage._Elems[0] = 0;
v6->m_delegate = nullptr;
init = (bool (*)(NumberInputLayer *))v6->init;
if ( init == NumberInputLayer::init )
v8 = NumberInputLayer::init(v6);
else
v8 = init(v6);
if ( v8 )
{
cocos2d::CCObject::autorelease(v6);
}
else
{
((void (__fastcall *)(NumberInputLayer *, __int64))v6->~NumberInputLayer)(v6, 1);
v6 = nullptr;
}
v6->m_maximum = 6;
v6->m_delegate = &a1->NumberInputDelegate;
show = (void (*)(FLAlertLayer *))v6->show;
if ( show == FLAlertLayer::show )
FLAlertLayer::show(v6);
else
show(v6);
}
else
{
v10 = 0;
*(_QWORD *)&v10 = sub_14003AA10(0x20u);
v11 = 25;
v12 = 31;
strcpy((char *)v10, "Too many failed attempts!");
v4 = sub_14003BDB0((__int64)v13, (__int64)&v10);
v5 = FLAlertLayer::create(0, (int)"Error", v4, (__int64)"OK", 0, 1133903872, 0, 0, 1065353216);
sub_14003A830((__int64)&v10);
v5->show(v5);
}
}
}