//
// PlayLayer::processCreateObjectsFromSetup from 0x40a904 to 0x40ad90 (1164 bytes)
//
// 2 xrefs:
// > PlayLayer::init @ 0x40b35c
// > LevelInfoLayer::loadLevelStep @ 0x499bbc
//
// 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:47:31 +0000
//
int __fastcall PlayLayer::processCreateObjectsFromSetup(PlayLayer *this)
{
int v2; // r5
_DWORD *v3; // r3
int v4; // r3
int *v5; // r11
float v6; // s15
float v7; // r0
int v8; // s16
unsigned __int8 *v9; // r5
int i; // r3
int v11; // r0
int v12; // r3
int v13; // r6
int v14; // r3
int v15; // r10
unsigned int v16; // r3
const char *v17; // r0
int v18; // r7
int v19; // r2
bool v20; // zf
_BYTE *v21; // r3
int v22; // r1
int v23; // r2
GameObject *v24; // r0
GameObject *v25; // r6
int v26; // r3
GJBaseGameLayer *v27; // r2
float *v28; // r5
unsigned int v29; // r3
float v30; // s15
int v32; // r3
int *v33; // r7
int v34; // r9
int v35; // r3
int v36; // r10
cocos2d::CCObject *v37; // r8
int v38; // r3
unsigned __int8 *v39; // [sp+0h] [bp-68h]
unsigned int v40; // [sp+8h] [bp-60h]
int v41; // [sp+Ch] [bp-5Ch]
int v42; // [sp+10h] [bp-58h]
unsigned int v43; // [sp+14h] [bp-54h]
int v44; // [sp+18h] [bp-50h]
int v45; // [sp+18h] [bp-50h]
int v46; // [sp+1Ch] [bp-4Ch]
int v47; // [sp+20h] [bp-48h]
int v48; // [sp+20h] [bp-48h]
int v49; // [sp+20h] [bp-48h]
int v50; // [sp+28h] [bp-40h]
int v51; // [sp+2Ch] [bp-3Ch]
int v52[2]; // [sp+38h] [bp-30h] BYREF
int v53; // [sp+40h] [bp-28h] BYREF
int v54[3]; // [sp+44h] [bp-24h] BYREF
int v55; // [sp+50h] [bp-18h] BYREF
int v56; // [sp+54h] [bp-14h]
int v57; // [sp+58h] [bp-10h]
int v58[3]; // [sp+5Ch] [bp-Ch] BYREF
cocos2d::CCArray *v59; // [sp+68h] [bp+0h] BYREF
int v60; // [sp+6Ch] [bp+4h]
_DWORD *v61; // [sp+70h] [bp+8h]
v52[0] = 0;
v52[1] = 0;
v53 = 0;
std::__split_buffer::__split_buffer(&v59, 0x25Eu, 0, (int)&v53);
v2 = 606;
do
{
v3 = v61;
if ( v61 )
{
*v61 = 0;
v3[1] = 0;
v3[2] = 0;
}
--v2;
v61 += 3;
}
while ( v2 );
std::vector::__swap_out_circular_buffer(v52, &v59);
std::__split_buffer::~__split_buffer((int)&v59);
v59 = nullptr;
v60 = 0;
v61 = nullptr;
std::vector::__append((int)&v59, 0x25Eu);
v4 = *((_DWORD *)this + 352);
v50 = *(_DWORD *)(v4 + 952);
v51 = *(unsigned __int8 *)(v4 + 593);
v43 = -1431655765 * ((*((_DWORD *)this + 2929) - *((_DWORD *)this + 2928)) >> 2);
v5 = (int *)((char *)this + 12272);
v6 = COERCE_FLOAT(roundf()) + 10.0;
if ( v6 > 100.0 )
v6 = 100.0;
v7 = ceilf((float)v43 / v6);
v40 = *((_DWORD *)this + 2933);
v46 = 12 * v40;
v41 = 0;
v8 = (int)v7;
while ( v40 < v43 && (int)v40 < *((_DWORD *)this + 2933) + v8 )
{
v9 = (unsigned __int8 *)(*((_DWORD *)this + 2928) + v46);
for ( i = 0; i != 2424; i += 4 )
*(_DWORD *)((char *)v59 + i) = 0;
v11 = std::string::find(v9, 44, 0);
v12 = *v9;
v13 = v11;
if ( (v12 & 1) != 0 )
v14 = *((_DWORD *)v9 + 1);
else
v14 = v12 >> 1;
v44 = v14;
if ( v11 != -1 )
{
v15 = 0;
v42 = 1;
v16 = 0;
while ( 1 )
{
if ( v16 != v44 )
{
if ( v42 )
{
v39 = v9;
std::string::basic_string(v54, v9, v16, v13 - v16);
if ( (v54[0] & 1) != 0 )
v17 = (const char *)v54[2];
else
v17 = (char *)v54 + 1;
v41 = atoi(v17);
std::string::~string((int)v54);
}
else if ( (unsigned int)(v41 - 1) <= 0x25C )
{
v39 = v9;
v47 = v52[0];
v18 = v52[0] + 12 * v41;
std::string::basic_string(&v55, v9, v16, v13 - v16);
v21 = (_BYTE *)(*(_BYTE *)(v47 + 12 * v41) & 1);
v20 = v21 == nullptr;
if ( (*(_BYTE *)(v47 + 12 * v41) & 1) != 0 )
v21 = *(_BYTE **)(v18 + 8);
else
*(_BYTE *)(v18 + 1) = (_BYTE)v21;
if ( v20 )
v19 = v47;
else
*v21 = 0;
if ( v20 )
*(_BYTE *)(v19 + 12 * v41) = (_BYTE)v21;
else
*(_DWORD *)(v18 + 4) = 0;
std::string::reserve((int *)v18, 0);
v22 = v56;
v23 = v57;
*(_DWORD *)v18 = v55;
*(_DWORD *)(v18 + 4) = v22;
*(_DWORD *)(v18 + 8) = v23;
v55 = 0;
v56 = 0;
v57 = 0;
std::string::~string((int)&v55);
*((_DWORD *)v59 + v41) = this;
}
v42 ^= 1u;
}
if ( v15 )
break;
v48 = v13 + 1;
v13 = std::string::find(v9, 44, v13 + 1);
v16 = v48;
if ( v13 == -1 )
{
v13 = v44;
v15 = 1;
}
}
}
v24 = (GameObject *)GameObject::objectFromVector(v52, &v59, this, v51, v39);
v25 = v24;
if ( v24 )
{
v26 = *((_DWORD *)v24 + 223);
if ( v26 == 31 )
{
std::string::basic_string(v58, (int)v9);
StartPosObject::loadSettingsFromString(v25, v58);
std::string::~string((int)v58);
}
else if ( v26 == 2065 )
{
ParticleGameObject::updateParticleStruct(v24);
}
if ( (*(int (__fastcall **)(GameObject *))(*(_DWORD *)v25 + 900))(v25) != 22 || v50 == 1 )
{
v32 = *((_DWORD *)v25 + 285);
if ( v32 > 0 )
{
if ( v32 > *v5 )
*v5 = v32;
v38 = *((_DWORD *)v25 + 286);
if ( v38 > *v5 )
*v5 = v38;
}
else
{
v33 = (int *)((char *)this + 12232);
v34 = 0;
if ( GameObject::hasSecondaryColor(v25) )
v35 = 2;
else
v35 = 1;
v45 = v35;
do
{
GameObject::getColorKey((GameObject *)v58, (bool)v25, (v34 ^ 1) & 1);
if ( cocos2d::CCDictionary::objectForKey(*v33, v58) )
{
v36 = *(_DWORD *)(cocos2d::CCDictionary::objectForKey(*v33, v58) + 52);
}
else
{
v36 = *v5;
v49 = *v33;
v37 = (cocos2d::CCObject *)operator new(0x38u);
cocos2d::CCObject::CCObject(v37);
*((_DWORD *)v37 + 13) = v36;
*(_DWORD *)v37 = &off_C8DBE0;
cocos2d::CCObject::autorelease(v37);
cocos2d::CCDictionary::setObject(v49, v37);
++*v5;
}
if ( (((unsigned __int8)v34 ^ 1) & 1) != 0 )
*((_DWORD *)v25 + 285) = v36;
else
*((_DWORD *)v25 + 286) = v36;
++v34;
std::string::~string((int)v58);
}
while ( v34 != v45 );
}
if ( (*(int (__fastcall **)(GameObject *))(*(_DWORD *)v25 + 900))(v25) == 31 )
{
if ( cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 2931)) > 2u )
goto LABEL_39;
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 2931), v25);
}
PlayLayer::addObject((int)this, v25);
}
}
LABEL_39:
if ( (*v9 & 1) != 0 )
{
**((_BYTE **)v9 + 2) = 0;
*((_DWORD *)v9 + 1) = 0;
}
else
{
v9[1] = 0;
*v9 = 0;
}
++v40;
v46 += 12;
}
v27 = *((GJBaseGameLayer **)this + 2933);
v28 = (float *)((char *)this + 10788);
*((_DWORD *)this + 2933) = (char *)v27 + v8;
v29 = -1431655765 * ((*((_DWORD *)this + 2929) - *((_DWORD *)this + 2928)) >> 2);
v30 = (float)((int)v27 + v8 - 1) / (float)v29;
if ( v30 > 1.0 )
v30 = 1.0;
*v28 = v30;
if ( (unsigned int)v27 + v8 >= v29 )
{
PlayLayer::createObjectsFromSetupFinished(this, (int)v27 + v8 - 1, v27);
*v28 = 1.0;
PlayLayer::setupHasCompleted(this);
}
if ( v59 )
{
v60 -= 4 * ((unsigned int)(v60 - (_DWORD)v59) >> 2);
operator delete(v59);
}
return std::__vector_base::~__vector_base((int)v52);
}