//
// GJSmartBlockPreview::addTemplateGuide from 0x1000089ec to 0x100008c4c (608 bytes)
//
// 2 xrefs:
// > BrowseSmartKeyLayer::init @ 0x100072d94
// > BrowseSmartKeyLayer::init @ 0x100072e70
//
// 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 GJSmartBlockPreview::addTemplateGuide(GJSmartBlockPreview *a1, const std::string *a2, int a3)
{
cocos2d::CCArray *v6; // x19
__int64 j; // x20
__int64 v8; // x23
int v9; // w0
__int64 v10; // x1
__int64 i; // x20
__int64 v12; // x22
SmartPrefabResult v13; // [xsp+0h] [xbp-C0h] BYREF
GJSmartPrefab *v14; // [xsp+48h] [xbp-78h] BYREF
std::string v15; // [xsp+50h] [xbp-70h] BYREF
std::string v16; // [xsp+68h] [xbp-58h] BYREF
_QWORD v17[2]; // [xsp+80h] [xbp-40h]
sub_100009754(&v14);
std::string::operator=((std::string *)&v15, a2);
std::string::operator=((std::string *)&v16, a2);
v13.m_smartPrefab = v14;
if ( v15.m_data.m_short.shortStorage.__elems_[22] < 0 )
sub_1000097D0(&v13.m_binaryKey, (void *)v15.m_data.m_long.capacitym1);
else
v13.m_binaryKey = v15;
if ( v16.m_data.m_short.shortStorage.__elems_[22] < 0 )
sub_1000097D0(&v13.m_prefabKey, (void *)v16.m_data.m_long.capacitym1);
else
v13.m_prefabKey = v16;
*(_QWORD *)&v13.m_prefabCount = v17[0];
*(_QWORD *)(&v13.m_unrequired + 3) = *(_QWORD *)((char *)v17 + 7);
v6 = GJSmartBlockPreview::addTemplateGuide_1(a1, &v13, 1.0);
if ( v13.m_prefabKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
operator delete((void *)v13.m_prefabKey.m_data.m_long.capacitym1);
if ( v13.m_binaryKey.m_data.m_short.shortStorage.__elems_[22] < 0 )
operator delete((void *)v13.m_binaryKey.m_data.m_long.capacitym1);
if ( a3 == 1 )
{
for ( i = 0; (unsigned int)i < (unsigned int)sub_10024A36C(v6); i = (unsigned int)(i + 1) )
{
v12 = sub_10024A388(v6, i);
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v12 + 64LL))(v12) < 3 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v12 + 896LL))(v12, 50);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v12 + 944LL))(v12, &unk_100635117);
}
}
else if ( a3 == 2 )
{
for ( j = 0; (unsigned int)j < (unsigned int)sub_10024A36C(v6); j = (unsigned int)(j + 1) )
{
v8 = sub_10024A388(v6, j);
v9 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 64LL))(v8);
if ( v9 )
{
if ( v9 == 1 )
{
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v8 + 944LL))(v8, &unk_10063511A);
v10 = 200;
}
else
{
if ( v9 != 2 )
continue;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v8 + 944LL))(v8, &unk_100635117);
v10 = 100;
}
}
else
{
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v8 + 944LL))(v8, &unk_10063511A);
v10 = 255;
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v8 + 896LL))(v8, v10);
}
}
if ( v16.m_data.m_short.shortStorage.__elems_[22] < 0 )
operator delete((void *)v16.m_data.m_long.capacitym1);
if ( v15.m_data.m_short.shortStorage.__elems_[22] < 0 )
operator delete((void *)v15.m_data.m_long.capacitym1);
}