//
// BrowseSmartKeyLayer::create from 0x9e11a8 to 0x9e13a8 (512 bytes)
//
// 2 xrefs:
// > BrowseSmartTemplateLayer::onTemplateObject @ 0x9e1454
// > ??> @ 0xb5200
//
// 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
//
BrowseSmartTemplateLayer *__fastcall BrowseSmartKeyLayer::create(cocos2d::CCObject *a1)
{
BrowseSmartTemplateLayer *v2; // x19
int v3; // w22
void *v4; // x0
BrowseSmartTemplateLayer_vtbl *v5; // x1
BrowseSmartTemplateLayer *v6; // x0
unsigned int *v8; // x3
int v9; // w1
__int64 v10; // [xsp+60h] [xbp+60h] BYREF
v2 = (BrowseSmartTemplateLayer *)operator new(0x2B8u);
cocos2d::CCLayerColor::CCLayerColor(v2);
v2->m_controlConnected = -1;
v2->m_joystickConnected = -1;
v2->m_buttonMenu = nullptr;
v2->m_alertProtocol = nullptr;
v2->m_scene = nullptr;
v2->m_reverseKeyBack = 0;
v2->m_mainLayer = nullptr;
v2->m_ZOrder = 0;
v2->m_noElasticity = 0;
v2->m_button1 = nullptr;
v2->m_button2 = nullptr;
v2->m_scrollingLayer = nullptr;
v2->m_containsBorder = 0;
v2->m_noAction = 0;
v2->m_forcePrioRegistered = 0;
v2->m_template = nullptr;
v2->m_pages = nullptr;
v2->m_page = 0;
v2->m_nextPageBtn = nullptr;
v2->m_prevPageBtn = nullptr;
v2->m_dotsArray = nullptr;
v2->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (BrowseSmartTemplateLayer_vtbl *)&off_11CB970;
v2->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCTouchDelegate::__vftable = (cocos2d::CCTouchDelegate_vtbl *)off_11CBE98;
v2->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCAccelerometerDelegate::__vftable = (cocos2d::CCAccelerometerDelegate_vtbl *)&off_11CBF08;
v2->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeypadDelegate::__vftable = (cocos2d::CCKeypadDelegate_vtbl *)&off_11CBF20;
v2->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeyboardDelegate::__vftable = (cocos2d::CCKeyboardDelegate_vtbl *)&off_11CBF40;
v2->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCMouseDelegate::__vftable = (cocos2d::CCMouseDelegate_vtbl *)off_11CBF60;
v2->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCRGBAProtocol::__vftable = (cocos2d::CCRGBAProtocol_vtbl *)&off_11CBF88;
v2->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCBlendProtocol::__vftable = (cocos2d::CCBlendProtocol_vtbl *)&off_11CC008;
v2[1].m_uID = 0;
v2[1].FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (BrowseSmartTemplateLayer_vtbl *)&byte_124B6C8;
sub_D18D28(&v10);
v3 = (unsigned __int8)BrowseSmartKeyLayer::init(v2, a1, (__int64)&v10);
v4 = (void *)(v10 - 24);
if ( (__int64 *)(v10 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = (unsigned int *)(v10 - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *(_DWORD *)(v10 - 8);
*(_DWORD *)(v10 - 8) = v9 - 1;
}
if ( v9 <= 0 )
operator delete(v4);
}
if ( v3 )
{
cocos2d::CCObject::autorelease(v2);
}
else
{
v5 = v2->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v6 = v2;
v2 = nullptr;
v5->~BrowseSmartTemplateLayer_0(v6);
}
return v2;
}