//
// SmartTemplateCell::loadFromObject from 0x10010b1bc to 0x10010b4b0 (756 bytes)
//
// 2 xrefs:
// > CustomListView::loadCell @ 0x1001012b0
// > CustomListView::reloadAll @ 0x10010bda8
//
// 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 __fastcall SmartTemplateCell::loadFromObject(SmartTemplateCell *a1, GJSmartTemplate *a2)
{
void **v4; // x0
cocos2d::CCLabelBMFont *v5; // x20
__n128 v6; // q0
__n128 v7; // q1
__n128 v8; // q0
__n128 v9; // q1
GJSmartTemplate *m_smartTemplate; // x8
const char *v11; // x5
ButtonSprite *v12; // x0
CCMenuItemSpriteExtra *v13; // x20
ButtonSprite *v14; // x0
CCMenuItemSpriteExtra *v15; // x21
cocos2d::CCNode *v16; // x22
__n128 v17; // q0
__n128 v18; // q1
__n128 v19; // q0
__n128 v20; // q1
double v21; // d0
__n128 v22; // q0
__n128 v23; // q1
double v24; // d0
float32x2_t v25; // [xsp+10h] [xbp-60h] BYREF
float32x2_t v26; // [xsp+18h] [xbp-58h] BYREF
void *__p[2]; // [xsp+20h] [xbp-50h] BYREF
char *longStorage; // [xsp+30h] [xbp-40h]
cocos2d::SEL_MenuHandler v29; // 0:x3.16
cocos2d::SEL_MenuHandler v30; // 0:x3.16
((void (__fastcall *)(cocos2d::CCLayer *, __int64))a1->m_mainLayer->removeAllChildrenWithCleanup)(a1->m_mainLayer, 1);
a1->m_smartTemplate = a2;
if ( a2->m_templateName.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(__p, (void *)a2->m_templateName.m_data.m_long.capacitym1, a2->m_templateName.m_data.m_long.size);
}
else
{
*(_OWORD *)__p = *(_OWORD *)&a2->m_templateName.m_data.m_short.sizex2;
longStorage = a2->m_templateName.m_data.m_long.longStorage;
}
if ( SHIBYTE(longStorage) >= 0 )
v4 = __p;
else
v4 = (void **)__p[0];
v5 = cocos2d::CCLabelBMFont::create_1((const char *)v4, "bigFont.fnt");
if ( SHIBYTE(longStorage) < 0 )
operator delete(__p[0]);
v6 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
v5);
v6.n128_u32[0] = 0;
v7.n128_u32[0] = 0.5;
sub_100022980(v6, v7, __p);
v8 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, void **))v5->setAnchorPoint)(v5, __p);
v9.n128_f32[0] = a1->m_height * 0.5;
v8.n128_u32[0] = 12.0;
sub_100022980(v8, v9, __p);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **))v5->setPosition)(v5, __p);
cocos2d::CCLabelBMFont::limitLabelWidth(v5, 200.0, 0.8, 0.0);
m_smartTemplate = GameLevelManager::sharedState()->m_smartTemplate;
v11 = "GJ_button_01.png";
if ( m_smartTemplate && m_smartTemplate->m_nameIndex == a1->m_smartTemplate->m_nameIndex )
v11 = "GJ_button_02.png";
v12 = ButtonSprite::create_1("Use", 50, 0, 0.5, 0, "bigFont.fnt", v11, 30.0);
v29.ptr = (void (__cdecl *)(cocos2d::CCObject *))SmartTemplateCell::onClick;
v29.adj = 0;
v13 = CCMenuItemSpriteExtra::create(v12, nullptr, a1, v29);
CCMenuItemSpriteExtra::setSizeMult(v13, 1.5);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v13->setTag)(v13, 0);
v14 = ButtonSprite::create_1("Edit", 50, 0, 0.5, 0, "bigFont.fnt", "GJ_button_03.png", 30.0);
v30.ptr = (void (__cdecl *)(cocos2d::CCObject *))SmartTemplateCell::onClick;
v30.adj = 0;
v15 = CCMenuItemSpriteExtra::create(v14, nullptr, a1, v30);
CCMenuItemSpriteExtra::setSizeMult(v15, 1.5);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v15->setTag)(v15, 1);
v16 = (cocos2d::CCNode *)sub_1001D7ED0(v13);
v17.n128_f32[0] = (float)((float)(a1->m_width + -55.0) + -25.0) + -10.0;
v18.n128_f32[0] = a1->m_height * 0.5;
sub_100022980(v17, v18, &v26);
cocos2d::CCNode::convertToNodeSpace(v16, (const cocos2d::CCPoint *)&v26);
v19.n128_u32[0] = 0;
v20.n128_u32[0] = 0;
sub_100022980(v19, v20, &v25);
*(float32x2_t *)&v21 = sub_1000229DC((float32x2_t *)__p, &v25, &v26);
v22 = ((__n128 (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v13->setPosition)(v13, &v26, v21);
v22.n128_u32[0] = 1113325568;
v23.n128_u32[0] = 0;
sub_100022980(v22, v23, &v25);
*(float32x2_t *)&v24 = sub_1000229DC((float32x2_t *)__p, &v25, &v26);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v15->setPosition)(v15, &v26, v24);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCNode *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v16);
}