//
// GJSmartBlockPreview::addPreview from 0xb0d670 to 0xb0d878 (520 bytes)
//
// 3 xrefs:
// > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0xb17824
// > BrowseSmartKeyLayer::init @ 0xb18160
// > ??> @ 0xa5f10
//
// This function is hookable on this platform (idp: arm, 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 13:01:26 +0000
//
__int64 __fastcall GJSmartBlockPreview::addPreview(
__int64 a1,
unsigned __int8 *a2,
unsigned __int8 *a3,
LevelEditorLayer *a4)
{
cocos2d::CCArray *v7; // x0
__int64 v8; // x1
cocos2d::CCArray *v10; // x23
char v11; // w0
__int64 v12; // x25
__int64 v13; // x0
__int64 v14; // x1
__int64 v15; // x24
int v16; // w0
unsigned __int8 *v17; // x21
int v18; // w26
__int64 v19; // x0
float v21; // [xsp+60h] [xbp+60h]
__int64 v22; // [xsp+78h] [xbp+78h] BYREF
_BYTE v23[8]; // [xsp+80h] [xbp+80h] BYREF
_BYTE v24[8]; // [xsp+88h] [xbp+88h] BYREF
__int64 v25; // [xsp+90h] [xbp+90h] BYREF
__int64 v26; // [xsp+98h] [xbp+98h]
void *v27; // [xsp+A0h] [xbp+A0h]
v7 = (cocos2d::CCArray *)*a3;
v8 = (unsigned __int8)v7 >> 1;
if ( ((unsigned __int8)v7 & 1) != 0 )
v8 = *((_QWORD *)a3 + 1);
if ( v8 )
{
v10 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
v25 = 0;
v26 = 0;
v11 = *a3;
v27 = nullptr;
v12 = *((_QWORD *)a4 + 1781);
if ( (v11 & 1) != 0 )
{
std::string::__init(&v25, *((void **)a3 + 2), *((_QWORD *)a3 + 1));
}
else
{
v13 = *(_QWORD *)a3;
v14 = *((_QWORD *)a3 + 1);
v27 = *((void **)a3 + 2);
v25 = v13;
v26 = v14;
}
v15 = EditorUI::spriteFromObjectString(v12, &v25, 0, 0, 0, v10, 0, 0);
if ( (v25 & 1) != 0 )
operator delete(v27);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v15, 10);
v16 = *a2;
if ( (v16 & 1) != 0 )
{
if ( *((_QWORD *)a2 + 1) )
{
v17 = *((unsigned __int8 **)a2 + 2);
LABEL_13:
v18 = *v17;
v21 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 328LL))(a1) * 0.5;
v19 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 328LL))(a1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, v21, *(float *)(v19 + 4) * 0.5);
GJSmartTemplate::offsetForType(v18, (cocos2d::CCPoint *)v24);
cocos2d::CCPoint::operator+(&v22, v23);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v15 + 184LL))(v15, &v22);
LevelEditorLayer::updateObjectColors(a4, v10);
return _stack_chk_guard;
}
}
else
{
v17 = a2 + 1;
if ( v16 >> 1 )
goto LABEL_13;
}
sub_B0BD50();
}
return _stack_chk_guard;
}