//
// SetupSmartBlockLayer::onCreateTemplate from 0x1404588c0 to 0x1404589b7 (247 bytes)
//
// 2 xrefs:
// > SetupSmartBlockLayer::init @ 0x140456ed2
// > ??> @ 0x1406daa60
//
// 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 SetupSmartBlockLayer::onCreateTemplate(SetupSmartBlockLayer *a1, cocos2d::CCObject *a2)
{
cocos2d::CCArray *v3; // rax
cocos2d::CCArray *v4; // rbx
SmartGameObject *m_gameObject; // rdx
struct cocos2d::CCArray *m_gameObjects; // rdx
__int64 v7; // rax
GJSmartTemplate *v8; // rsi
__int64 v9; // rcx
void *v10; // [rsp+30h] [rbp+8h]
void *v11; // [rsp+30h] [rbp+8h]
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
v4 = v3;
m_gameObject = a1->m_gameObject;
if ( m_gameObject )
{
cocos2d::CCArray::addObject(v3, m_gameObject);
}
else
{
m_gameObjects = a1->m_gameObjects;
if ( m_gameObjects )
cocos2d::CCArray::addObjectsFromArray(v3, m_gameObjects);
}
v7 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v10 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v7 = qword_1406C2EC0;
}
v8 = *(GJSmartTemplate **)(v7 + 960);
v9 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v11 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v9 = qword_1406C2ED8;
}
EditorUI::addObjectsToSmartTemplate(*(EditorUI **)(*(_QWORD *)(v9 + 528) + 14496LL), v8, v4);
SetupSmartBlockLayer::onClose(a1, nullptr);
}