//
// SmartTemplateCell::loadFromObject from 0x10024d3e0 to 0x10024d701 (801 bytes)
//
// 2 xrefs:
// > CustomListView::loadCell @ 0x10024279a
// > CustomListView::reloadAll @ 0x10024e4ac
//
// 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)
{
double v2; // xmm0_8
const char *v4; // rdi
cocos2d::CCLabelBMFont *v5; // r14
GJSmartTemplate *m_smartTemplate; // rax
const char *v7; // r9
ButtonSprite *v8; // rax
CCMenuItemSpriteExtra *v9; // r14
ButtonSprite *v10; // rax
CCMenuItemSpriteExtra *v11; // r15
int v12; // ecx
int v13; // r8d
int v14; // r9d
_BYTE v15[8]; // [rsp+0h] [rbp-60h] BYREF
const cocos2d::CCPoint *v16; // [rsp+8h] [rbp-58h]
SmartTemplateCell *v17; // [rsp+10h] [rbp-50h]
_BYTE v18[8]; // [rsp+18h] [rbp-48h] BYREF
__int128 v19; // [rsp+20h] [rbp-40h] BYREF
void *__p; // [rsp+30h] [rbp-30h]
((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.sizex2 & 1) != 0 )
{
sub_100006B70(&v19, a2->m_templateName.m_data.m_long.longStorage, a2->m_templateName.m_data.m_long.size, v2);
if ( (v19 & 1) == 0 )
goto LABEL_3;
}
else
{
__p = a2->m_templateName.m_data.m_long.longStorage;
v19 = *(_OWORD *)&a2->m_templateName.m_data.m_short.sizex2;
if ( (v19 & 1) == 0 )
{
LABEL_3:
v4 = (char *)&v19 + 1;
goto LABEL_6;
}
}
v4 = (const char *)__p;
LABEL_6:
v5 = cocos2d::CCLabelBMFont::create_3(v4, "bigFont.fnt");
if ( (v19 & 1) != 0 )
operator delete(__p);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v5);
sub_10028CBE0(&v19, 0.0, 0.5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int128 *))v5->setAnchorPoint)(v5, &v19);
sub_10028CBE0(&v19, 12.0, a1->m_height * 0.5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int128 *))v5->setPosition)(v5, &v19);
cocos2d::CCLabelBMFont::limitLabelWidth(v5, 200.0, 0.80000001, 0.0);
m_smartTemplate = GameLevelManager::sharedState()->m_smartTemplate;
if ( m_smartTemplate )
{
v7 = "GJ_button_01.png";
if ( m_smartTemplate->m_nameIndex == a1->m_smartTemplate->m_nameIndex )
v7 = "GJ_button_02.png";
}
else
{
v7 = "GJ_button_01.png";
}
v8 = ButtonSprite::create_1("Use", 50, 0, 0.5, 0, "bigFont.fnt", v7, 30.0);
v9 = CCMenuItemSpriteExtra::create(
v8,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)SmartTemplateCell::onClick);
CCMenuItemSpriteExtra::setSizeMult(v9, 1.5);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v9->setTag)(v9, 0);
v10 = ButtonSprite::create_1("Edit", 50, 0, 0.5, 0, "bigFont.fnt", "GJ_button_03.png", 30.0);
v11 = CCMenuItemSpriteExtra::create(
v10,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)SmartTemplateCell::onClick);
CCMenuItemSpriteExtra::setSizeMult(v11, 1.5);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v11->setTag)(v11, 1);
v16 = (const cocos2d::CCPoint *)sub_100792C50((_DWORD)v9, (_DWORD)v11, 0, v12, v13, v14);
sub_10028CBE0(v18, (float)((float)(a1->m_width + -55.0) + -25.0) + -10.0, 0.5 * a1->m_height);
v17 = a1;
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v19, v16);
sub_10028CBE0(v15, 0.0, 0.0);
sub_10028CCE0(v18, &v19);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _BYTE *))v9->setPosition)(v9, v18);
sub_10028CBE0(v15, 55.0, 0.0);
sub_10028CCE0(v18, &v19);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _BYTE *))v11->setPosition)(v11, v18);
((void (__fastcall *)(cocos2d::CCLayer *, const cocos2d::CCPoint *))v17->m_mainLayer->addChild)(v17->m_mainLayer, v16);
}