//
// LevelEditorLayer::createObjectsFromString from 0x46e708 to 0x46ea06 (766 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::duplicateKeyframeAnimation @ 0x46ea80
// > EditorUI::pasteObjects @ 0x6f2e04
// > EditorUI::spriteFromObjectString @ 0x6f4f4c
//
// 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:02 +0000
//
cocos2d::CCArray *__fastcall LevelEditorLayer::createObjectsFromString(int a1, unsigned __int8 *a2, int a3, int a4)
{
_BOOL4 v6; // r7
cocos2d::CCArray *v7; // r0
unsigned int v8; // r11
int v9; // r9
int v10; // r7
EditorUI *v11; // r0
int v13; // r3
int v14; // r4
int v15; // r0
int v16; // r3
int v17; // r8
int v18; // r3
unsigned int v19; // r3
const char *v20; // r0
int v21; // r6
int v22; // r1
int v23; // r2
bool v24; // zf
int v25; // r3
int v26; // r1
int v27; // r2
int v28; // r0
GameObject *v29; // r0
cocos2d::CCObject *v30; // r6
__int16 v31; // r1
UndoObject *v32; // r0
int v33; // [sp+Ch] [bp-78h]
int v34; // [sp+14h] [bp-70h]
cocos2d::CCArray *v35; // [sp+18h] [bp-6Ch]
int v36; // [sp+1Ch] [bp-68h]
int v39[3]; // [sp+34h] [bp-50h] BYREF
char *v40[3]; // [sp+40h] [bp-44h] BYREF
int v41; // [sp+4Ch] [bp-38h] BYREF
int v42; // [sp+50h] [bp-34h]
int v43; // [sp+54h] [bp-30h]
int v44[3]; // [sp+58h] [bp-2Ch] BYREF
int v45; // [sp+64h] [bp-20h] BYREF
int v46; // [sp+68h] [bp-1Ch]
int v47; // [sp+6Ch] [bp-18h]
int v48[3]; // [sp+70h] [bp-14h] BYREF
v45 = 0;
v46 = 0;
v47 = 0;
std::string::__init(&v45, " ", 1u);
v6 = sub_45F9A6(a2, (unsigned __int8 *)&v45);
if ( !v6 )
{
memset(v48, 0, sizeof(v48));
std::string::__init(v48, &unk_B6B226, 0);
v6 = sub_45F9A6(a2, (unsigned __int8 *)v48);
std::string::~string((int)v48);
}
std::string::~string((int)&v45);
if ( v6 )
return nullptr;
v7 = (cocos2d::CCArray *)cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(a1 + 11864));
memset(v39, 0, sizeof(v39));
v35 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
std::vector::__append(v39, 0x25Eu);
memset(v40, 0, sizeof(v40));
std::vector::__append((int)v40, 0x25Eu);
v41 = 0;
v42 = 0;
v43 = 0;
sub_469BE4(a2, ";", &v41);
v8 = 0;
v9 = 0;
while ( 1 )
{
v10 = v41;
if ( v8 >= -1431655765 * ((v42 - v41) >> 2) )
break;
if ( !a4 && !*(_BYTE *)(a1 + 11824) && *(_DWORD *)(a1 + 11868) - *(_DWORD *)(a1 + 11872) > 79999 )
{
v11 = *(EditorUI **)(a1 + 11856);
if ( v11 )
EditorUI::showMaxError(v11);
break;
}
v13 = 0;
v14 = v41 + 12 * v8;
do
{
*(_DWORD *)&v40[0][v13] = 0;
v13 += 4;
}
while ( v13 != 2424 );
v15 = std::string::find((unsigned __int8 *)(v10 + 12 * v8), 44, 0);
v16 = *(unsigned __int8 *)(v10 + 12 * v8);
v17 = v15;
if ( (v16 & 1) != 0 )
v18 = *(_DWORD *)(v14 + 4);
else
v18 = v16 >> 1;
v36 = v18;
v33 = 1;
v19 = 0;
while ( 1 )
{
if ( v19 != v36 )
{
if ( v33 )
{
std::string::basic_string(v44, (unsigned __int8 *)(v10 + 12 * v8), v19, v17 - v19);
if ( (v44[0] & 1) != 0 )
v20 = (const char *)v44[2];
else
v20 = (char *)v44 + 1;
v9 = atoi(v20);
std::string::~string((int)v44);
}
else if ( v9 > 0 )
{
v34 = v39[0];
v21 = v39[0] + 12 * v9;
std::string::basic_string(&v45, (unsigned __int8 *)(v10 + 12 * v8), v19, v17 - v19);
v23 = 12 * v9;
v25 = *(_BYTE *)(v34 + 12 * v9) & 1;
v24 = v25 == 0;
if ( (*(_BYTE *)(v34 + 12 * v9) & 1) != 0 )
{
v23 = *(_DWORD *)(v21 + 8);
v25 = 0;
}
else
{
*(_BYTE *)(v21 + 1) = v25;
}
if ( v24 )
{
v23 = v34;
v22 = 12 * v9;
}
else
{
*(_BYTE *)v23 = v25;
*(_DWORD *)(v21 + 4) = v25;
}
if ( v24 )
*(_BYTE *)(v23 + v22) = v25;
std::string::reserve((int *)v21, 0);
v26 = v46;
v27 = v47;
*(_DWORD *)v21 = v45;
*(_DWORD *)(v21 + 4) = v26;
*(_DWORD *)(v21 + 8) = v27;
v45 = 0;
v46 = 0;
v47 = 0;
std::string::~string((int)&v45);
*(_DWORD *)&v40[0][4 * v9] = a1;
}
v33 ^= 1u;
}
if ( v17 == -1 )
break;
v28 = std::string::find((unsigned __int8 *)(v10 + 12 * v8), 44, v17 + 1);
v19 = v17 + 1;
v17 = v28;
}
v29 = LevelEditorLayer::addObjectFromVector((LevelEditorLayer *)a1, v39, (int *)v40);
v30 = v29;
if ( v29 )
{
if ( *((_DWORD *)v29 + 223) == 31 )
{
std::string::basic_string(v48, v10 + 12 * v8);
StartPosObject::loadSettingsFromString(v30, v48);
std::string::~string((int)v48);
}
v31 = *(_WORD *)(a1 + 11826);
if ( v31 != -1 && !*(_BYTE *)(a1 + 11784) && *((__int16 *)v30 + 519) != v31 && *((__int16 *)v30 + 520) != v31 )
*((_WORD *)v30 + 519) = v31;
cocos2d::CCArray::addObject(v35, v30);
if ( !a3 )
{
v32 = UndoObject::create(v30, 2);
LevelEditorLayer::addToUndoList((cocos2d::CCArray **)a1, v32, 0);
}
}
if ( (*(_BYTE *)(v10 + 12 * v8) & 1) != 0 )
{
**(_BYTE **)(v14 + 8) = 0;
*(_DWORD *)(v14 + 4) = 0;
}
else
{
*(_BYTE *)(v14 + 1) = 0;
*(_BYTE *)(v10 + 12 * v8) = 0;
}
++v8;
}
std::__vector_base::~__vector_base((int)&v41);
std::__vector_base::~__vector_base(v40);
std::__vector_base::~__vector_base((int)v39);
return v35;
}