//
// LevelEditorLayer::createObjectsFromSetup from 0x47583c to 0x475af8 (700 bytes)
//
// 1 xrefs:
// > LevelEditorLayer::init @ 0x476342
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:49:09 +0000
//
int __fastcall LevelEditorLayer::createObjectsFromSetup(int a1, int a2)
{
_BOOL4 v4; // r5
int result; // r0
cocos2d::CCNode *v6; // r0
int v7; // r3
GameManager *LevelSettings; // r0
int v9; // r0
unsigned int v10; // r8
int v11; // r7
int i; // r3
int v13; // r5
int v14; // r3
unsigned int v15; // r3
const char *v16; // r0
int v17; // r11
int v18; // r6
int v19; // r1
int v20; // r2
GameObject *v21; // r0
GameObject *v22; // r6
int v23; // [sp+Ch] [bp-60h]
int v24; // [sp+10h] [bp-5Ch]
int v25; // [sp+14h] [bp-58h]
unsigned int v26; // [sp+1Ch] [bp-50h]
int v27[3]; // [sp+24h] [bp-48h] BYREF
char *v28[3]; // [sp+30h] [bp-3Ch] BYREF
_DWORD v29[3]; // [sp+3Ch] [bp-30h] BYREF
int v30; // [sp+48h] [bp-24h] BYREF
int v31; // [sp+4Ch] [bp-20h]
int v32; // [sp+50h] [bp-1Ch]
cocos2d::CCDictionary *v33; // [sp+54h] [bp-18h] BYREF
int v34; // [sp+58h] [bp-14h]
int v35; // [sp+5Ch] [bp-10h]
int v36[3]; // [sp+60h] [bp-Ch] BYREF
int v37; // [sp+6Ch] [bp+0h] BYREF
int v38; // [sp+70h] [bp+4h]
int v39; // [sp+74h] [bp+8h]
int v40[3]; // [sp+78h] [bp+Ch] BYREF
v37 = 0;
v38 = 0;
v39 = 0;
std::string::__init(&v37, " ", 1u);
v4 = sub_45F9A6((unsigned __int8 *)a2, (unsigned __int8 *)&v37);
if ( !v4 )
{
memset(v40, 0, sizeof(v40));
std::string::__init(v40, &unk_B6B226, 0);
v4 = sub_45F9A6((unsigned __int8 *)a2, (unsigned __int8 *)v40);
std::string::~string((int)v40);
}
result = std::string::~string((int)&v37);
if ( !v4 )
{
memset(v27, 0, sizeof(v27));
std::vector::__append(v27, 0x25Eu);
memset(v28, 0, sizeof(v28));
std::vector::__append((int)v28, 0x25Eu);
memset(v29, 0, sizeof(v29));
v30 = 0;
v31 = 0;
v32 = 0;
v33 = nullptr;
v34 = 0;
v35 = 0;
sub_469BE4((unsigned __int8 *)a2, ";", (int *)&v33);
if ( (*(_BYTE *)a2 & 1) != 0 )
{
**(_BYTE **)(a2 + 8) = 0;
*(_DWORD *)(a2 + 4) = 0;
}
else
{
*(_BYTE *)(a2 + 1) = 0;
*(_BYTE *)a2 = 0;
}
v6 = LevelSettingsObject::objectFromString(v33);
v7 = *(_DWORD *)(a1 + 1408);
*(_DWORD *)(a1 + 2084) = v6;
*((_DWORD *)v6 + 80) = v7;
cocos2d::CCObject::retain(*(cocos2d::CCObject **)(a1 + 2084));
LevelSettings = (GameManager *)GJBaseGameLayer::loadLevelSettings((GJBaseGameLayer *)a1);
v9 = GameManager::sharedState(LevelSettings);
GameManager::loadFont(v9, *(_DWORD *)(*(_DWORD *)(a1 + 2084) + 300));
v10 = 1;
v11 = 0;
while ( v10 < -1431655765 * ((v34 - (int)v33) >> 2) )
{
std::string::operator=((unsigned __int8 *)&v30, (unsigned __int8 *)v33 + 12 * v10);
for ( i = 0; i != 2424; i += 4 )
*(_DWORD *)&v28[0][i] = 0;
v13 = std::string::find((unsigned __int8 *)&v30, 44, 0);
if ( (v30 & 1) != 0 )
v14 = v31;
else
v14 = (int)(unsigned __int8)v30 >> 1;
v25 = v14;
if ( v13 != -1 )
{
v24 = 0;
v23 = 1;
v15 = 0;
while ( 1 )
{
if ( v15 != v25 )
{
if ( v23 )
{
std::string::basic_string(v36, (unsigned __int8 *)&v30, v15, v13 - v15);
if ( (v36[0] & 1) != 0 )
v16 = (const char *)v36[2];
else
v16 = (char *)v36 + 1;
v11 = atoi(v16);
std::string::~string((int)v36);
}
else if ( (unsigned int)(v11 - 1) <= 0x25C )
{
v17 = v27[0];
v18 = v27[0] + 12 * v11;
std::string::basic_string(&v37, (unsigned __int8 *)&v30, v15, v13 - v15);
if ( (*(_BYTE *)(v17 + 12 * v11) & 1) != 0 )
{
**(_BYTE **)(v18 + 8) = 0;
*(_DWORD *)(v18 + 4) = 0;
}
else
{
*(_BYTE *)(v18 + 1) = 0;
*(_BYTE *)(v17 + 12 * v11) = 0;
}
std::string::reserve((int *)v18, 0);
v19 = v38;
v20 = v39;
*(_DWORD *)v18 = v37;
*(_DWORD *)(v18 + 4) = v19;
*(_DWORD *)(v18 + 8) = v20;
v37 = 0;
v38 = 0;
v39 = 0;
std::string::~string((int)&v37);
*(_DWORD *)&v28[0][4 * v11] = a1;
}
v23 ^= 1u;
}
if ( v24 )
break;
v26 = v13 + 1;
v13 = std::string::find((unsigned __int8 *)&v30, 44, v13 + 1);
v15 = v26;
if ( v13 == -1 )
{
v13 = v25;
v24 = 1;
}
}
}
v21 = LevelEditorLayer::addObjectFromVector((LevelEditorLayer *)a1, v27, (int *)v28);
v22 = v21;
if ( v21 && *((_DWORD *)v21 + 223) == 31 )
{
std::string::basic_string(v40, (int)&v30);
StartPosObject::loadSettingsFromString(v22, v40);
std::string::~string((int)v40);
}
++v10;
}
std::__vector_base::~__vector_base((int)&v33);
std::string::~string((int)&v30);
std::string::~string((int)v29);
std::__vector_base::~__vector_base(v28);
return std::__vector_base::~__vector_base((int)v27);
}
return result;
}