//
// SetupSmartBlockLayer::onCreateAll from 0x1004e1a40 to 0x1004e1c2c (492 bytes)
//
// 1 xrefs:
// > SetupSmartBlockLayer::init @ 0x1004e0a39
//
// 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:31:18 +0000
//
__int64 __fastcall SetupSmartBlockLayer::onCreateAll(double a1)
{
__int64 v1; // rax
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // r13
unsigned int v5; // r14d
__int64 v6; // rbx
__int64 v7; // rax
const char *CString; // r15
size_t v9; // rax
size_t v10; // r14
char *v11; // r12
size_t v12; // r13
__int64 v13; // r14
unsigned int i; // r15d
__int64 v15; // r12
__int64 v16; // r13
std::string v17; // [rsp+0h] [rbp-70h] BYREF
__int64 v18; // [rsp+18h] [rbp-58h]
__int64 v19; // [rsp+20h] [rbp-50h]
unsigned int v20; // [rsp+2Ch] [rbp-44h]
__int128 __dst; // [rsp+30h] [rbp-40h] BYREF
void *v22; // [rsp+40h] [rbp-30h]
v1 = GameLevelManager::sharedState(a1);
result = GameLevelManager::getActiveSmartTemplate(v1);
v18 = result;
if ( result )
{
v3 = v18;
*(_DWORD *)(v18 + 196) = 0;
result = *(_QWORD *)(v3 + 56);
v19 = result;
if ( result )
{
v4 = cocos2d::CCDictionary::allKeys(v19);
result = sub_1007FEF90(v4);
if ( (_DWORD)result )
{
v5 = 0;
v6 = v4;
while ( 1 )
{
v20 = v5;
v7 = cocos2d::CCArray::stringAtIndex(v4, v5);
CString = (const char *)cocos2d::CCString::getCString(v7);
v9 = strlen(CString);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v10 = v9;
if ( v9 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v9;
v11 = (char *)&__dst + 1;
if ( v9 )
goto LABEL_13;
LABEL_14:
v11[v10] = 0;
v13 = cocos2d::CCDictionary::objectForKey(v19, (char *)&__dst);
for ( i = 0; i < (unsigned int)sub_1007FEF90(v13); ++i )
{
v15 = sub_1007FEFE0(v13, i);
v16 = *(_QWORD *)(*(_QWORD *)(GameManager::sharedState() + 552) + 14248LL);
if ( (__dst & 1) != 0 )
{
sub_10001AD30(&v17, v22, *((unsigned __int64 *)&__dst + 1));
}
else
{
v17.__r_.__value_.__r.__words[2] = (std::string::size_type)v22;
*(_OWORD *)&v17.__r_.__value_.__l.0 = __dst;
}
EditorUI::createPrefab(v16, v18, &v17, *(_DWORD *)(v15 + 104));
if ( (*(_BYTE *)&v17.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v17.__r_.__value_.__l.__data_);
v4 = v6;
}
if ( (__dst & 1) != 0 )
operator delete(v22);
v5 = v20 + 1;
result = sub_1007FEF90(v4);
if ( v5 >= (unsigned int)result )
return result;
}
v12 = (v9 | 7) + 1;
if ( (v9 | 7) == 0x17 )
v12 = 26;
v11 = (char *)operator new(v12);
v22 = v11;
*(_QWORD *)&__dst = v12 + 1;
v4 = v6;
*((_QWORD *)&__dst + 1) = v10;
LABEL_13:
memmove(v11, CString, v10);
goto LABEL_14;
}
}
}
return result;
}