//
// GJSmartBlockPreview::addPreview from 0x100429280 to 0x1004293df (351 bytes)
//
// 2 xrefs:
// > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0x1004e9ca7
// > BrowseSmartKeyLayer::init @ 0x1004eb103
//
// 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::addPreview(
__int64 a1,
std::string *a2,
unsigned __int8 *a3,
LevelEditorLayer *a4,
double a5)
{
unsigned int v7; // eax
cocos2d::CCArray *v8; // r14
EditorUI *m_editorUI; // rbx
const cocos2d::CCPoint *v10; // r13
__int64 v11; // rax
double v12; // [rsp+10h] [rbp-70h] BYREF
unsigned __int64 v13; // [rsp+18h] [rbp-68h] BYREF
unsigned __int64 v14; // [rsp+20h] [rbp-60h] BYREF
LevelEditorLayer *v15; // [rsp+28h] [rbp-58h]
__int128 v16; // [rsp+30h] [rbp-50h] BYREF
void *__p; // [rsp+40h] [rbp-40h]
float v18; // [rsp+54h] [rbp-2Ch]
double v19; // 0:xmm0_8.8
v7 = *a3;
if ( (v7 & 1) != 0 )
{
if ( !*((_QWORD *)a3 + 1) )
return;
}
else if ( !(v7 >> 1) )
{
return;
}
v8 = (cocos2d::CCArray *)sub_10071F9E0(a1, a2);
v15 = a4;
m_editorUI = a4->m_editorUI;
if ( (*a3 & 1) != 0 )
{
sub_100006B70(&v16, *((const void **)a3 + 2), *((_QWORD *)a3 + 1), a5);
}
else
{
__p = *((void **)a3 + 2);
v16 = *(_OWORD *)a3;
}
v10 = EditorUI::spriteFromObjectString(m_editorUI, (__int64)&v16, 0, 0, 0, (__int64)v8, 0, 0);
if ( (v16 & 1) != 0 )
operator delete(__p);
(*(void (__fastcall **)(__int64, const cocos2d::CCPoint *, __int64))(*(_QWORD *)a1 + 448LL))(a1, v10, 10);
std::string::at(a2, 0);
v18 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 312LL))(a1) * 0.5;
v11 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 312LL))(a1);
sub_10028CBE0((float *)&v13, v18, 0.5 * *(float *)(v11 + 4));
*(cocos2d::CCPoint *)&v19 = GJSmartTemplate::offsetForType((SmartBlockType)&v14);
sub_10028CCE0(&v12, &v13, &v14);
(*(void (__fastcall **)(const cocos2d::CCPoint *, double *, double))(*(_QWORD *)v10 + 184LL))(v10, &v12, v19);
LevelEditorLayer::updateObjectColors(v15, v8);
}