//
// GJSmartBlockPreview::addPreview from 0x100415ef0 to 0x10041604f (351 bytes)
//
// 2 xrefs:
// > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0x1004e4767
// > BrowseSmartKeyLayer::init @ 0x1004e5c93
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:30:11 +0000
//
__int64 __fastcall GJSmartBlockPreview::addPreview(__int64 a1, std::string *a2, unsigned __int8 *a3, __int64 a4)
{
unsigned int v6; // eax
__int64 result; // rax
__int64 v8; // r14
__int64 v9; // rbx
__int64 v10; // r13
int v11; // r12d
__int64 v12; // rax
double v13; // [rsp+10h] [rbp-70h] BYREF
unsigned __int64 v14; // [rsp+18h] [rbp-68h] BYREF
unsigned __int64 v15; // [rsp+20h] [rbp-60h] BYREF
__int64 v16; // [rsp+28h] [rbp-58h]
__int128 v17; // [rsp+30h] [rbp-50h] BYREF
void *__p; // [rsp+40h] [rbp-40h]
float v19; // [rsp+54h] [rbp-2Ch]
v6 = *a3;
if ( (v6 & 1) != 0 )
{
result = *((_QWORD *)a3 + 1);
if ( !result )
return result;
}
else
{
result = v6 >> 1;
if ( !result )
return result;
}
v8 = sub_1007FE900(a1);
v16 = a4;
v9 = *(_QWORD *)(a4 + 14248);
if ( (*a3 & 1) != 0 )
{
sub_10001AD30(&v17, *((const void **)a3 + 2), *((_QWORD *)a3 + 1));
}
else
{
__p = *((void **)a3 + 2);
v17 = *(_OWORD *)a3;
}
v10 = EditorUI::spriteFromObjectString(v9, (unsigned int)&v17, 0, 0, 0, v8, 0, 0);
if ( (v17 & 1) != 0 )
operator delete(__p);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v10, 10);
v11 = *std::string::at(a2, 0);
v19 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 328LL))(a1) * 0.5;
v12 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 328LL))(a1);
sub_100278250((float *)&v14, v19, 0.5 * *(float *)(v12 + 4));
GJSmartTemplate::offsetForType((float *)&v15, v11);
sub_100278350(&v13, &v14, &v15);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v10 + 184LL))(v10, &v13);
return LevelEditorLayer::updateObjectColors(v16, v8);
}