//
// EditorUI::spriteFromObjectString from 0x1003ea840 to 0x1003eae00 (1472 bytes)
//
// 3 xrefs:
// > GJSmartBlockPreview::addPreview @ 0x1000091fc
// > KeyframeGameObject::updateShadowObjects @ 0x10038b128
// > EditorUI::menuItemFromObjectString @ 0x1003e8f38
//
// 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
//
cocos2d::CCSprite *__fastcall EditorUI::spriteFromObjectString(
__int64 a1,
std::string *a2,
__int64 a3,
int a4,
int a5,
__int64 a6,
__int64 a7,
__int64 a8)
{
cocos2d::CCSprite *v13; // x19
__int64 ObjectsFromString; // x0
__n128 v15; // q0
__n128 v16; // q1
cocos2d::CCArray *v17; // x20
__int64 v18; // x23
unsigned int v19; // w27
__int64 v20; // x28
GameObject *v21; // x24
int MainColorMode; // w25
ColorAction *ColorAction; // x25
__int16 v24; // w8
int SecondaryColorMode; // w0
ColorAction *v26; // x25
__int16 v27; // w8
GameObject *v28; // x0
unsigned int v29; // w23
float32x2_t v30; // d8
float32x2_t v31; // d9
GameObject *v32; // x24
float32x2_t *v33; // x0
double v34; // d0
int ObjectZOrder; // w25
ZLayer ObjectZLayer; // w0
__int64 v37; // x1
cocos2d::CCSprite *m_colorSprite; // x0
__int64 v39; // x1
ZLayer v40; // w0
ZLayer v41; // w25
__int64 v42; // x25
cocos2d::CCSprite *v43; // x26
cocos2d::CCSprite *v44; // x26
cocos2d::CCSprite *v45; // x26
cocos2d::CCSprite *v46; // x26
__int64 v47; // x0
__int64 *v48; // x0
float v49; // s0
float *v50; // x24
float v51; // s0
float32x2_t v52; // d0
unsigned int v53; // w21
_BYTE *v54; // x22
const cocos2d::CCPoint *v55; // x0
float v58; // [xsp+10h] [xbp-A0h]
float v59; // [xsp+20h] [xbp-90h]
float v61; // [xsp+30h] [xbp-80h]
float32x2_t v62; // [xsp+40h] [xbp-70h] BYREF
float32x2_t v63; // [xsp+48h] [xbp-68h] BYREF
cocos2d::CCPoint v64; // 0:kr00_8.8
cocos2d::CCPoint v65; // 0:s0.4,4:s1.4
v13 = cocos2d::CCSprite::create_1();
ObjectsFromString = LevelEditorLayer::createObjectsFromString(*(_QWORD *)(a1 + 1256), a2, 1, 1);
v17 = (cocos2d::CCArray *)ObjectsFromString;
if ( a7 )
{
if ( a4 )
{
v18 = *(_QWORD *)(*(_QWORD *)(a1 + 1256) + 3288LL);
if ( (unsigned int)sub_10024A36C(ObjectsFromString) )
{
v19 = 0;
do
{
if ( v19 >= (unsigned int)sub_10024A36C(a7) )
break;
v20 = sub_10024A388(a7, v19);
v21 = (GameObject *)sub_10024A388((__int64)v17, v19);
MainColorMode = GameObject::getMainColorMode(v21);
if ( GJEffectManager::colorExists(*(GJEffectManager **)(v18 + 320), MainColorMode) )
{
ColorAction = GJEffectManager::getColorAction(*(GJEffectManager **)(v18 + 320), MainColorMode);
v24 = *(_WORD *)&ColorAction->m_fromColor.r;
v63.i8[2] = ColorAction->m_fromColor.b;
v63.i16[0] = v24;
((void (__fastcall *)(GameObject *, float32x2_t *))v21->updateMainColor)(v21, &v63);
v21->m_baseColor->m_opacity = ColorAction->m_fromOpacity;
}
if ( *(_QWORD *)(v20 + 888) )
{
SecondaryColorMode = GameObject::getSecondaryColorMode(v21);
v26 = GJEffectManager::getColorAction(*(GJEffectManager **)(v18 + 320), SecondaryColorMode);
v27 = *(_WORD *)&v26->m_fromColor.r;
v63.i8[2] = v26->m_fromColor.b;
v63.i16[0] = v27;
((void (__fastcall *)(GameObject *, float32x2_t *))v21->updateSecondaryColor)(v21, &v63);
v21->m_detailColor->m_opacity = v26->m_fromOpacity;
}
((void (__fastcall *)(GameObject *, __int64))v21->setOpacity)(v21, 255);
if ( a8 )
v21->m_hasGroupParent = v20 == a8;
++v19;
}
while ( v19 < (unsigned int)sub_10024A36C((__int64)v17) );
}
}
}
v15.n128_u32[0] = 1148846080;
v16.n128_u32[0] = 1148846080;
sub_100022980(v15, v16, &v63);
v65.x = sub_1000229B8((__int64 *)&v62, (__int64 *)&v63);
EditorUI::repositionObjectsToCenter((EditorUI *)a1, v17, v65, (bool)&v62);
EditorUI::deleteSmartBlocksFromObjects((EditorUI *)a1, v17);
EditorUI::deleteTypeFromObjects((EditorUI *)a1, 2065, v17);
if ( a5 >= 1 )
{
while ( (unsigned int)sub_10024A36C((__int64)v17) > a5 )
{
v28 = (GameObject *)sub_10024A398((__int64)v17);
LevelEditorLayer::removeObject(*(LevelEditorLayer **)(a1 + 1256), v28, 1);
sub_10024A430((__int64)v17, 1);
}
}
if ( (unsigned int)sub_10024A36C((__int64)v17) )
{
v29 = 0;
v30 = 0;
v31 = 0;
do
{
v32 = (GameObject *)sub_10024A388((__int64)v17, v29);
LevelEditorLayer::removeObject(*(LevelEditorLayer **)(a1 + 1256), v32, 1);
v33 = (float32x2_t *)((__int64 (__fastcall *)(GameObject *))v32->getPosition)(v32);
*(float32x2_t *)&v34 = sub_1000229F0(v33, &v63, &v62);
((void (__fastcall *)(GameObject *, float32x2_t *, double))v32->setPosition)(v32, &v62, v34);
ObjectZOrder = GameObject::getObjectZOrder(v32);
ObjectZLayer = GameObject::getObjectZLayer(v32);
((void (__fastcall *)(cocos2d::CCSprite *, GameObject *, _QWORD))v13->addChild_0)(
v13,
v32,
(unsigned int)(ObjectZOrder + 10000 * ObjectZLayer));
if ( a6 )
sub_10024A2D0(a6);
GameObject::updateBlendMode(v32);
if ( v32->m_shouldBlendBase )
v37 = 0x100000302LL;
else
v37 = 0x30300000001LL;
((void (__fastcall *)(GameObject *, __int64))v32->setBlendFunc)(v32, v37);
m_colorSprite = v32->m_colorSprite;
if ( m_colorSprite && !v32->m_unk28c )
{
if ( v32->m_shouldBlendDetail )
v39 = 0x100000302LL;
else
v39 = 0x30300000001LL;
((void (__fastcall *)(cocos2d::CCSprite *, __int64))m_colorSprite->setBlendFunc)(m_colorSprite, v39);
if ( v32->m_shouldBlendBase == v32->m_shouldBlendDetail )
{
GameObject::addColorSpriteToSelf(v32);
}
else
{
v40 = GameObject::getObjectZLayer(v32);
v41 = v40;
if ( v32->m_shouldBlendDetail )
v41 = v40 + v32->m_colorZLayerRelated;
v42 = (unsigned int)(GameObject::getObjectZOrder(v32) + 10000 * v41);
v32->m_colorSpriteLocked = 0;
v43 = v32->m_colorSprite;
((void (__fastcall *)(GameObject *))v32->getScaleX)(v32);
((void (__fastcall *)(cocos2d::CCSprite *))v43->setScaleX)(v43);
v44 = v32->m_colorSprite;
((void (__fastcall *)(GameObject *))v32->getScaleY)(v32);
((void (__fastcall *)(cocos2d::CCSprite *))v44->setScaleY)(v44);
v45 = v32->m_colorSprite;
((void (__fastcall *)(GameObject *))v32->getRotation)(v32);
((void (__fastcall *)(cocos2d::CCSprite *))v45->setRotation)(v45);
v46 = v32->m_colorSprite;
v47 = ((__int64 (__fastcall *)(GameObject *))v32->getPosition)(v32);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v46->setPosition)(v46, v47);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v32->m_colorSprite->removeFromParentAndCleanup)(
v32->m_colorSprite,
0);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))v13->addChild_0)(
v13,
v32->m_colorSprite,
v42);
}
}
v48 = (__int64 *)((__int64 (__fastcall *)(GameObject *))v32->getPosition)(v32);
v49 = sub_1000229B8((__int64 *)&v62, v48);
((void (__fastcall *)(GameObject *, float32x2_t *, float))v32->setStartPos)(v32, &v62, v49);
v50 = (float *)((__int64 (__fastcall *)(GameObject *))v32->getObjectTextureRect)(v32);
v59 = sub_100022C40((__int64)v50);
v61 = sub_100022C30(v50);
v58 = sub_100022C58((__int64)v50);
v51 = sub_100022C48((__int64)v50);
v31 = (float32x2_t)vbsl_s8(
vorr_s8(
(int8x8_t)vceqz_f32(v31),
(int8x8_t)vcgt_f32(v31, (float32x2_t)__PAIR64__(LODWORD(v58), LODWORD(v59)))),
(int8x8_t)__PAIR64__(LODWORD(v58), LODWORD(v59)),
(int8x8_t)v31);
v30 = (float32x2_t)vbsl_s8(
vorr_s8(
(int8x8_t)vceqz_f32(v30),
(int8x8_t)vcgt_f32((float32x2_t)__PAIR64__(LODWORD(v51), LODWORD(v61)), v30)),
(int8x8_t)__PAIR64__(LODWORD(v51), LODWORD(v61)),
(int8x8_t)v30);
++v29;
}
while ( v29 < (unsigned int)sub_10024A36C((__int64)v17) );
v52 = vsub_f32(v30, v31);
}
else
{
v52 = 0;
}
sub_100022988((float *)&v62, v52.f32[0], v52.f32[1]);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *))v13->setContentSize)(v13, &v62);
if ( (unsigned int)sub_10024A36C((__int64)v17) )
{
v53 = 0;
do
{
v54 = (_BYTE *)sub_10024A388((__int64)v17, v53);
v55 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_BYTE *))(*(_QWORD *)v54 + 192LL))(v54);
v64 = cocos2d::CCNode::convertToNodeSpace(v13, v55);
(*(void (__fastcall **)(_BYTE *, float32x2_t *, float, float))(*(_QWORD *)v54 + 184LL))(v54, &v62, v64.x, v64.y);
(*(void (__fastcall **)(_BYTE *, bool))(*(_QWORD *)v54 + 328LL))(v54, (v54[1294] & 1) == 0);
++v53;
}
while ( v53 < (unsigned int)sub_10024A36C((__int64)v17) );
}
return v13;
}