//
// SmartTemplateCell::loadFromObject from 0x1400be5e0 to 0x1400be9c2 (994 bytes)
//
// 3 xrefs:
// > CustomListView::loadCell @ 0x1400abbb5
// > CustomListView::reloadAll @ 0x1400ac606
// > ??> @ 0x1406c7e84
//
// 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=4
void SmartTemplateCell::loadFromObject(SmartTemplateCell *a1, GJSmartTemplate *a2)
{
GJSmartTemplate *v2; // rbx
const char *v4; // rcx
struct cocos2d::CCLabelBMFont *v5; // rdi
cocos2d::CCLabelBMFont_vtbl *v6; // rbx
const cocos2d::CCPoint *v7; // rax
cocos2d::CCLabelBMFont_vtbl *v8; // rbx
const cocos2d::CCPoint *v9; // rax
__int64 v10; // rdx
__int64 v11; // rdx
bool v12; // di
ButtonSprite *v13; // rbx
const char *v14; // rax
CCMenuItemSpriteExtra *v15; // rsi
ButtonSprite *v16; // rbx
CCMenuItemSpriteExtra *v17; // rdi
struct cocos2d::CCMenu *v18; // rbx
ButtonSprite *v19; // [rsp+50h] [rbp-78h] BYREF
struct cocos2d::CCPoint v20; // [rsp+58h] [rbp-70h] BYREF
cocos2d::CCPoint v21; // [rsp+60h] [rbp-68h] BYREF
_QWORD v22[4]; // [rsp+68h] [rbp-60h] BYREF
v2 = a2;
LOBYTE(a2) = 1;
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, (bool)a2);
a1->m_smartTemplate = v2;
sub_14003BDB0((__int64)v22, (__int64)&v2->m_templateName);
v4 = (const char *)v22;
if ( v22[3] > 0xFu )
v4 = (const char *)v22[0];
v5 = cocos2d::CCLabelBMFont::create(v4, (const char *)&qword_14052A4D8);
sub_14003A830((__int64)v22);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v5);
v6 = v5->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v19, 0.0, 0.5);
v6->setAnchorPoint(v5, v7);
v8 = v5->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v19, 12.0, a1->m_height * 0.5);
v8->setPosition_0(v5, v9);
cocos2d::CCLabelBMFont::limitLabelWidth(v5, 200.0, 0.80000001, 0.0);
v10 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v19 = (ButtonSprite *)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(v19);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v10 = qword_1406C2EC0;
}
v11 = *(_QWORD *)(v10 + 960);
v12 = v11 && *(_DWORD *)(v11 + 200) == a1->m_smartTemplate->m_nameIndex;
v19 = (ButtonSprite *)operator new(0x2C0u);
v13 = ButtonSprite::ButtonSprite(v19);
if ( v13 )
{
v14 = "GJ_button_01.png";
if ( v12 )
v14 = "GJ_button_02.png";
if ( ButtonSprite::init_1(v13, "Use", 50, 0, 0.5, 0, (const char *)&qword_14052A4D8, v14, 30.0) )
{
cocos2d::CCObject::autorelease(v13);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v13->~ButtonSprite)(v13, 1);
v13 = nullptr;
}
}
v15 = CCMenuItemSpriteExtra::create(v13, nullptr, a1, (cocos2d::SEL_MenuHandler *)SmartTemplateCell::onClick);
HIDWORD(v15->m_pfnSelector.adj) = 1069547520;
v15->setTag(v15, 0);
v19 = (ButtonSprite *)operator new(0x2C0u);
v16 = ButtonSprite::ButtonSprite(v19);
if ( v16 )
{
if ( ButtonSprite::init_1(v16, "Edit", 50, 0, 0.5, 0, (const char *)&qword_14052A4D8, "GJ_button_03.png", 30.0) )
{
cocos2d::CCObject::autorelease(v16);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v16->~ButtonSprite)(v16, 1);
v16 = nullptr;
}
}
v17 = CCMenuItemSpriteExtra::create(v16, nullptr, a1, (cocos2d::SEL_MenuHandler *)SmartTemplateCell::onClick);
HIDWORD(v17->m_pfnSelector.adj) = 1069547520;
v17->setTag(v17, 1);
v18 = cocos2d::CCMenu::create(v15, v17, 0);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v19,
(float)((float)(a1->m_width - 55.0) - 25.0) - 10.0,
a1->m_height * 0.5);
cocos2d::CCNode::convertToNodeSpace(v18, &v20);
cocos2d::CCPoint::CCPoint(&v21, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v20, &v19);
v15->setPosition_0(v15, (const cocos2d::CCPoint *)&v19);
cocos2d::CCPoint::CCPoint(&v21, 55.0, 0.0);
cocos2d::CCPoint::operator+(&v20, &v19);
v17->setPosition_0(v17, (const cocos2d::CCPoint *)&v19);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v18);
}