//
// SetupSmartBlockLayer::onCreateAll from 0x1004e7130 to 0x1004e731c (492 bytes)
//
// 1 xrefs:
// > SetupSmartBlockLayer::init @ 0x1004e6139
//
// 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 SetupSmartBlockLayer::onCreateAll(SetupSmartBlockLayer *a1, cocos2d::CCObject *a2)
{
double v2; // xmm0_8
GameLevelManager *v3; // rax
GJSmartTemplate *v4; // rax
cocos2d::CCArray *v5; // r13
unsigned int v6; // r14d
cocos2d::CCArray *v7; // rbx
cocos2d::CCString *v8; // rax
const char *CString; // r15
size_t v10; // rax
size_t v11; // r14
char *v12; // r12
size_t v13; // r13
__int64 v14; // r14
unsigned int i; // r15d
__int64 v16; // r12
EditorUI *m_editorUI; // r13
std::string v18; // [rsp+0h] [rbp-70h] BYREF
GJSmartTemplate *ActiveSmartTemplate; // [rsp+18h] [rbp-58h]
cocos2d::CCDictionary *m_prefabArrays; // [rsp+20h] [rbp-50h]
unsigned int v21; // [rsp+2Ch] [rbp-44h]
__int128 __dst; // [rsp+30h] [rbp-40h] BYREF
void *v23; // [rsp+40h] [rbp-30h]
v3 = GameLevelManager::sharedState();
ActiveSmartTemplate = GameLevelManager::getActiveSmartTemplate(v3);
if ( ActiveSmartTemplate )
{
v4 = ActiveSmartTemplate;
ActiveSmartTemplate->m_prefabIndex = 0;
m_prefabArrays = v4->m_prefabArrays;
if ( m_prefabArrays )
{
v5 = cocos2d::CCDictionary::allKeys(m_prefabArrays);
if ( (unsigned int)sub_100720070(v5) )
{
v6 = 0;
v7 = v5;
while ( 1 )
{
v21 = v6;
v8 = cocos2d::CCArray::stringAtIndex(v5, v6);
CString = cocos2d::CCString::getCString(v8);
v10 = strlen(CString);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v11 = v10;
if ( v10 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v10;
v12 = (char *)&__dst + 1;
if ( v10 )
goto LABEL_13;
LABEL_14:
v12[v11] = 0;
v14 = cocos2d::CCDictionary::objectForKey_1((__int64)m_prefabArrays, (char *)&__dst);
for ( i = 0; i < (unsigned int)sub_100720070(v14); ++i )
{
v16 = sub_1007200C0(v14, i);
m_editorUI = GameManager::sharedState()->m_levelEditorLayer->m_editorUI;
if ( (__dst & 1) != 0 )
{
sub_100006B70(&v18, v23, *((unsigned __int64 *)&__dst + 1), v2);
}
else
{
v18.__r_.__value_.__r.__words[2] = (std::string::size_type)v23;
v2 = *(double *)&__dst;
*(_OWORD *)&v18.__r_.__value_.__l.0 = __dst;
}
EditorUI::createPrefab(m_editorUI, (__int64)ActiveSmartTemplate, &v18, *(_DWORD *)(v16 + 104));
if ( (*(_BYTE *)&v18.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v18.__r_.__value_.__l.__data_);
v5 = v7;
}
if ( (__dst & 1) != 0 )
operator delete(v23);
v6 = v21 + 1;
if ( v6 >= (unsigned int)sub_100720070(v5) )
return;
}
v13 = (v10 | 7) + 1;
if ( (v10 | 7) == 0x17 )
v13 = 26;
v12 = (char *)operator new(v13);
v23 = v12;
*(_QWORD *)&__dst = v13 + 1;
v5 = v7;
*((_QWORD *)&__dst + 1) = v11;
LABEL_13:
memmove(v12, CString, v11);
goto LABEL_14;
}
}
}
}