//
// SetupSmartTemplateLayer::onClick from 0x9e0350 to 0x9e04dc (396 bytes)
//
// 4 xrefs:
// > ??> @ 0x7fe18
// > SetupSmartTemplateLayer::init @ 0x9de294
// > SetupSmartTemplateLayer::init @ 0x9de340
// > ??> @ 0x122c4d8
//
// 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 SetupSmartTemplateLayer::onClick(SetupSmartTemplateLayer *a1, cocos2d::CCObject *a2)
{
int v3; // w0
FLAlertLayer *v4; // x20
void *v5; // x0
BrowseSmartTemplateLayer *v6; // x0
unsigned int *v7; // x2
int v8; // w1
__int64 v9; // [xsp+40h] [xbp+40h] BYREF
v3 = a2->getTag(a2);
if ( v3 )
{
if ( v3 == 5 )
{
sub_D153B8((int)&v9, "Are you sure you want to delete this template?");
v4 = FLAlertLayer::create((int)a1 + 640, (__int64)"Delete Template", (__int64)&v9);
v5 = (void *)(v9 - 24);
if ( (__int64 *)(v9 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v7 = (unsigned int *)(v9 - 8);
do
v8 = __ldaxr(v7);
while ( __stlxr(v8 - 1, v7) );
}
else
{
v8 = *(_DWORD *)(v9 - 8);
*(_DWORD *)(v9 - 8) = v8 - 1;
}
if ( v8 <= 0 )
operator delete(v5);
}
v4->setTag(v4, 5);
v4->show(v4);
}
}
else
{
LOWORD(v9) = 0;
BYTE2(v9) = 0;
v6 = BrowseSmartTemplateLayer::create(a1->m_smartTemplate, (SmartBrowseFilter)v9);
v6->show(v6);
SetupSmartTemplateLayer::onClose(a1, nullptr);
}
}