//
// SetupSmartTemplateLayer::onClick from 0x140459580 to 0x14045973b (443 bytes)
//
// 3 xrefs:
// > SetupSmartTemplateLayer::init @ 0x140459397
// > SetupSmartTemplateLayer::init @ 0x14045947d
// > ??> @ 0x1406daa9c
//
// 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 SetupSmartTemplateLayer::onClick(SetupSmartTemplateLayer *a1, cocos2d::CCObject *a2)
{
int v3; // eax
int v4; // ebx
__int64 v5; // rax
FLAlertLayer *v6; // rbx
GJSmartTemplate *m_smartTemplate; // rbx
BrowseSmartTemplateLayer *v8; // rax
SmartBrowseFilter v9; // r8d
cocos2d::CCObject *v10; // rdi
cocos2d::CCObject *v11; // rdx
__int128 v12; // [rsp+50h] [rbp-48h] BYREF
__int64 v13; // [rsp+60h] [rbp-38h]
__int64 v14; // [rsp+68h] [rbp-30h]
_BYTE v15[32]; // [rsp+70h] [rbp-28h] BYREF
BrowseSmartTemplateLayer *v16; // [rsp+A8h] [rbp+10h]
v3 = a2->getTag(a2);
if ( v3 )
{
if ( v3 == 5 )
{
v4 = (_DWORD)a1 + 640;
if ( !a1 )
v4 = 0;
v12 = 0;
*(_QWORD *)&v12 = sub_14003AA10(0x40u);
v13 = 54;
v14 = 63;
strcpy((char *)v12, "Are you sure you want to delete this template?");
v5 = sub_14003BDB0((__int64)v15, (__int64)&v12);
v6 = FLAlertLayer::create(
v4,
(int)"Delete Template",
v5,
(__int64)&unk_140547160,
(__int64)"YES",
1133903872,
0,
0,
1065353216);
sub_14003A830((__int64)&v12);
v6->setTag(v6, 5);
v6->show(v6);
}
}
else
{
m_smartTemplate = a1->m_smartTemplate;
v16 = (BrowseSmartTemplateLayer *)operator new(0x2A8u);
v8 = BrowseSmartTemplateLayer::BrowseSmartTemplateLayer(v16);
v10 = v8;
if ( v8 )
{
if ( BrowseSmartTemplateLayer::init(v8, m_smartTemplate, v9) )
{
cocos2d::CCObject::autorelease(v10);
}
else
{
((void (__fastcall *)(cocos2d::CCObject *, __int64))v10->~CCObject)(v10, 1);
v10 = nullptr;
}
}
((void (__fastcall *)(cocos2d::CCObject *))v10->__vftable[14].update)(v10);
SetupSmartTemplateLayer::onClose(a1, v11);
}
}