//
// LevelEditorLayer::createObjectsFromSetup from 0x100357db0 to 0x100358140 (912 bytes)
//
// 1 xrefs:
// > LevelEditorLayer::init @ 0x1003574c0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall LevelEditorLayer::createObjectsFromSetup(LevelEditorLayer *a1, __int64 a2)
{
bool v4; // w21
cocos2d::CCDictionary *v5; // x0
LevelSettingsObject *v6; // x0
GameManager *v7; // x0
char *v8; // x8
int v9; // w20
unsigned __int64 v10; // x24
__int64 i; // x8
std::string::size_type v12; // x0
std::string::size_type v13; // x21
std::string::size_type v14; // x22
bool v15; // w28
int v16; // w8
std::string::size_type v17; // x26
char v18; // w27
std::string *v19; // x22
__int128 v20; // q0
void *v21; // x22
std::string::size_type v22; // x0
GameObject *v23; // x0
GameObject *v24; // x21
std::string v25; // [xsp+0h] [xbp-F0h] BYREF
std::string v26; // [xsp+18h] [xbp-D8h] BYREF
char *v27; // [xsp+30h] [xbp-C0h] BYREF
__int64 v28; // [xsp+38h] [xbp-B8h]
__int64 v29; // [xsp+40h] [xbp-B0h]
std::string __str; // [xsp+48h] [xbp-A8h] BYREF
std::vector __p; // [xsp+60h] [xbp-90h] BYREF
std::vector v32; // [xsp+78h] [xbp-78h] BYREF
std::allocator __a; // [xsp+97h] [xbp-59h] BYREF
sub_100009900(&v32, " ");
if ( sub_1000045BC((_QWORD *)a2, &v32) )
{
v4 = 1;
}
else
{
sub_100009900(&__p, "");
v4 = sub_1000045BC((_QWORD *)a2, &__p);
if ( SHIBYTE(__p.__end_cap_.__value_) < 0 )
operator delete(__p.__begin_);
}
if ( SHIBYTE(v32.__end_cap_.__value_) < 0 )
{
operator delete(v32.__begin_);
if ( v4 )
return;
}
else if ( v4 )
{
return;
}
memset(&v32, 0, sizeof(v32));
sub_10011BFA4(&v32, 0x259u);
memset(&__p, 0, sizeof(__p));
sub_10000EC70(&__p, 0x259u);
memset(&__str, 0, sizeof(__str));
v27 = nullptr;
v28 = 0;
v29 = 0;
sub_100357AB0((std::string *)a2, ";", (__int64)&v27);
if ( *(char *)(a2 + 23) < 0 )
{
**(_BYTE **)a2 = 0;
*(_QWORD *)(a2 + 8) = 0;
}
else
{
*(_BYTE *)a2 = 0;
*(_BYTE *)(a2 + 23) = 0;
}
v5 = GameToolbox::stringSetupToDict(v27, ",");
v6 = LevelSettingsObject::objectFromDict(v5);
a1->m_levelSettings = v6;
v6->m_level = a1->m_level;
cocos2d::CCObject::retain(v6);
GJBaseGameLayer::loadLevelSettings(a1);
v7 = GameManager::sharedState();
GameManager::loadFont(v7, a1->m_levelSettings->m_fontIndex);
v8 = v27;
if ( 0xAAAAAAAAAAAAAAABLL * ((v28 - (__int64)v27) >> 3) >= 2 )
{
v9 = 0;
v10 = 1;
do
{
std::string::operator=(&__str, (const std::string *)&v8[24 * v10]);
for ( i = 0; i != 601; ++i )
__p.__begin_[i] = nullptr;
v12 = std::string::find(&__str, 44, 0);
if ( v12 != -1 )
{
v13 = v12;
v14 = 0;
v15 = 0;
v16 = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v16 = __str.__r_.__value_.__r.__words[1];
v17 = v16;
v18 = 1;
while ( 1 )
{
if ( v14 != v17 )
{
if ( (v18 & 1) != 0 )
{
std::string::basic_string(&v26, &__str, v14, v13 - v14, &__a);
if ( SHIBYTE(v26.__r_.__value_.__r.__words[2]) < 0 )
{
v21 = (void *)v26.__r_.__value_.__r.__words[0];
v9 = atoi(v26.__r_.__value_.__l.__data_);
operator delete(v21);
}
else
{
v9 = atoi((const char *)&v26);
}
}
else if ( (unsigned int)(v9 - 1) <= 0x257 )
{
std::string::basic_string(&v26, &__str, v14, v13 - v14, &__a);
v19 = &v32.__begin_[v9];
if ( v19->m_data.m_short.shortStorage.__elems_[22] < 0 )
operator delete((void *)v19->m_data.m_long.capacitym1);
v20 = *(_OWORD *)&v26.__r_.__value_.__l.__data_;
v19->m_data.m_long.longStorage = (char *)v26.__r_.__value_.__r.__words[2];
*(_OWORD *)&v19->m_data.m_short.sizex2 = v20;
__p.__begin_[v9] = a1;
}
v18 ^= 1u;
}
if ( v15 )
break;
v14 = v13 + 1;
v22 = std::string::find(&__str, 44, v13 + 1);
v15 = v22 == -1;
if ( v22 == -1 )
v13 = v17;
else
v13 = v22;
}
}
v23 = LevelEditorLayer::addObjectFromVector(a1, &v32, &__p);
v24 = v23;
if ( v23 && v23->m_objectID == 31 )
{
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v25, __str.__r_.__value_.__l.__data_, __str.__r_.__value_.__l.__size_);
else
v25 = __str;
StartPosObject::loadSettingsFromString(v24, &v25);
if ( SHIBYTE(v25.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v25.__r_.__value_.__l.__data_);
}
++v10;
v8 = v27;
}
while ( 0xAAAAAAAAAAAAAAABLL * ((v28 - (__int64)v27) >> 3) > v10 );
}
v26.__r_.__value_.__r.__words[0] = (std::string::size_type)&v27;
sub_1000177FC((void ***)&v26);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( __p.__begin_ )
{
__p.__end_ = __p.__begin_;
operator delete(__p.__begin_);
}
__p.__begin_ = (std::__vector_base::pointer)&v32;
sub_1000177FC(&__p.__begin_);
}