//
// SetupSmartBlockLayer::onCreateAll from 0xb15e64 to 0xb160b8 (596 bytes)
//
// 3 xrefs:
// > ??> @ 0x81868
// > SetupSmartBlockLayer::init @ 0xb151d8
// > ??> @ 0x15435d0
//
// 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:31 +0000
//
__int64 __fastcall SetupSmartBlockLayer::onCreateAll(SetupSmartBlockLayer *this, cocos2d::CCObject *a2)
{
GameLevelManager *v2; // x0
__int64 ActiveSmartTemplate; // x0
__int64 v4; // x27
cocos2d::CCDictionary *v5; // x0
cocos2d::CCString *v6; // x0
const char *CString; // x0
size_t v8; // x0
cocos2d::CCArray *v9; // x22
unsigned int i; // w20
int *v11; // x24
__int64 v12; // x1
__int64 v13; // x23
size_t v14; // x25
void *v15; // x28
char *v16; // x3
cocos2d::CCDictionary *v18; // [xsp+60h] [xbp+60h]
char *v19; // [xsp+68h] [xbp+68h]
cocos2d::CCArray *v20; // [xsp+70h] [xbp+70h]
unsigned int v21; // [xsp+7Ch] [xbp+7Ch]
unsigned __int64 v22; // [xsp+88h] [xbp+88h] BYREF
unsigned __int64 v23; // [xsp+90h] [xbp+90h]
void *v24; // [xsp+98h] [xbp+98h]
unsigned __int64 v25; // [xsp+A0h] [xbp+A0h] BYREF
size_t v26; // [xsp+A8h] [xbp+A8h]
void *v27; // [xsp+B0h] [xbp+B0h]
v2 = (GameLevelManager *)GameLevelManager::sharedState(_stack_chk_guard);
ActiveSmartTemplate = GameLevelManager::getActiveSmartTemplate(v2);
v4 = ActiveSmartTemplate;
if ( !ActiveSmartTemplate )
return _stack_chk_guard;
v5 = *(cocos2d::CCDictionary **)(ActiveSmartTemplate + 56);
v18 = v5;
*(_DWORD *)(v4 + 196) = 0;
if ( !v5 )
return _stack_chk_guard;
v21 = 0;
v20 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v5);
if ( !(unsigned int)cocos2d::CCArray::count(v20) )
return _stack_chk_guard;
do
{
v6 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v20, v21);
CString = (const char *)cocos2d::CCString::getCString(v6);
v22 = 0;
v19 = (char *)CString;
v23 = 0;
v24 = nullptr;
v8 = strlen(CString);
std::string::__init((__int64 *)&v22, v19, v8);
v9 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v18, &v22);
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(v9); ++i )
{
v11 = (int *)cocos2d::CCArray::objectAtIndex(v9, i);
v12 = *(_QWORD *)(GameManager::sharedState((GameManager *)v11) + 552);
v25 = 0;
v26 = 0;
v27 = nullptr;
v13 = *(_QWORD *)(v12 + 14248);
if ( (v22 & 1) != 0 )
{
v14 = v23;
v15 = v24;
if ( v23 > 0xFFFFFFFFFFFFFFEFLL )
sub_62ED1C();
if ( v23 > 0x16 )
{
v16 = (char *)operator new((v23 + 16) & 0xFFFFFFFFFFFFFFF0LL);
v27 = v16;
v26 = v14;
v25 = (v14 + 16) & 0xFFFFFFFFFFFFFFF0LL | 1;
LABEL_15:
*((_BYTE *)memcpy(v16, v15, v14) + v14) = 0;
goto LABEL_8;
}
LOBYTE(v25) = 2 * v23;
v16 = (char *)&v25 + 1;
if ( v23 )
goto LABEL_15;
BYTE1(v25) = 0;
}
else
{
v27 = v24;
v25 = v22;
v26 = v23;
}
LABEL_8:
EditorUI::createPrefab(v13, v4, (char *)&v25, v11[26]);
if ( (v25 & 1) != 0 )
operator delete(v27);
}
if ( (v22 & 1) != 0 )
operator delete(v24);
++v21;
}
while ( v21 < (unsigned int)cocos2d::CCArray::count(v20) );
return _stack_chk_guard;
}