//
// EditorUI::spriteFromObjectString from 0x696bec to 0x6972ac (1728 bytes)
//
// 4 xrefs:
// > EditorUI::menuItemFromObjectString @ 0x697314
// > KeyframeGameObject::updateShadowObjects @ 0x763ba8
// > GJSmartBlockPreview::addPreview @ 0x9d6124
// > ??> @ 0x6e070
//
// 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(
EditorUI *a1,
const void **a2,
__int64 a3,
unsigned __int8 a4,
int a5,
cocos2d::CCArray *a6,
cocos2d::CCArray *a7,
__int64 a8)
{
int v9; // w20
cocos2d::CCSprite *v13; // x22
cocos2d::CCArray *ObjectsFromString; // x19
LevelSettingsObject *m_levelSettings; // x26
unsigned int i; // w21
GameObject *Object; // x0
float v18; // s8
unsigned int v19; // w21
float v20; // s9
float v21; // s11
float v22; // s10
cocos2d::CCSprite *m_colorSprite; // x0
GameObject *v24; // x0
ZLayer v25; // w26
int ObjectZOrder; // w0
cocos2d::CCSprite_vtbl *v27; // x1
float (__fastcall *getScaleX)(cocos2d::CCNode *__hidden); // x4
void (__fastcall *setScaleX)(cocos2d::CCSprite *__hidden, float); // x26
void (__fastcall *setScaleY)(cocos2d::CCSprite *__hidden, float); // x26
void (__fastcall *setRotation)(cocos2d::CCSprite *__hidden, float); // x26
void (__fastcall *v32)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
__int64 v33; // x0
void (__fastcall *setStartPos)(GameObject *__hidden, cocos2d::CCPoint); // x26
const cocos2d::CCPoint *v35; // x0
cocos2d::CCRect *v36; // x23
float v37; // s0
float v38; // s12
float v39; // s0
float v40; // s13
float v41; // s0
float v42; // s14
float v43; // s0
GameObject *v44; // x23
void (__fastcall *setPosition)(GameObject *__hidden, const cocos2d::CCPoint *); // x26
__int64 v46; // x0
ZLayer ObjectZLayer; // w0
GameObject_vtbl *v48; // x2
__int64 v49; // x23
GameObject *v50; // x27
int SecondaryColorMode; // w0
GLubyte v52; // w6
GLubyte v53; // w5
void (__fastcall *updateSecondaryColor)(GameObject *__hidden, const cocos2d::ccColor3B *); // x4
GLubyte g; // w6
GLubyte b; // w5
void (__fastcall *updateMainColor)(GameObject *__hidden, const cocos2d::ccColor3B *); // x4
unsigned int v58; // w23
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x21
unsigned int v60; // w1
unsigned __int8 *v61; // x21
void (__fastcall *v62)(unsigned __int8 *, cocos2d::CCPoint *, float, float); // x24
const cocos2d::CCPoint *v63; // x0
cocos2d::CCArray *v66; // [xsp+A8h] [xbp+A8h]
cocos2d::CCSprite *v68; // [xsp+B0h] [xbp+B0h]
cocos2d::CCSprite *v69; // [xsp+B0h] [xbp+B0h]
cocos2d::CCSprite *v70; // [xsp+B0h] [xbp+B0h]
cocos2d::CCSprite *v71; // [xsp+B0h] [xbp+B0h]
int MainColorMode; // [xsp+B8h] [xbp+B8h]
ColorAction *v74; // [xsp+B8h] [xbp+B8h]
ColorAction *ColorAction; // [xsp+B8h] [xbp+B8h]
cocos2d::CCPoint v76; // [xsp+C8h] [xbp+C8h] BYREF
cocos2d::CCPoint v77; // [xsp+D0h] [xbp+D0h] BYREF
cocos2d::CCPoint v78; // 0:kr00_8.8
cocos2d::CCPoint v79; // 0:s0.4,4:s1.4
v9 = a4;
v13 = cocos2d::CCSprite::create();
ObjectsFromString = LevelEditorLayer::createObjectsFromString(a1->m_editorLayer, a2, 1u, 1u);
m_levelSettings = a1->m_editorLayer->m_levelSettings;
if ( a7 && v9 )
{
for ( i = 0;
i < (unsigned int)cocos2d::CCArray::count(ObjectsFromString) && i < (unsigned int)cocos2d::CCArray::count(a7);
++i )
{
v49 = cocos2d::CCArray::objectAtIndex(a7, i);
v50 = (GameObject *)cocos2d::CCArray::objectAtIndex(ObjectsFromString, i);
MainColorMode = GameObject::getMainColorMode(v50);
if ( GJEffectManager::colorExists(m_levelSettings->m_effectManager, MainColorMode) )
{
ColorAction = GJEffectManager::getColorAction(m_levelSettings->m_effectManager, MainColorMode);
g = ColorAction->m_fromColor.g;
b = ColorAction->m_fromColor.b;
updateMainColor = v50->updateMainColor;
LOBYTE(v77.x) = ColorAction->m_fromColor.r;
BYTE1(v77.x) = g;
BYTE2(v77.x) = b;
updateMainColor(v50, (const cocos2d::ccColor3B *)&v77);
v50->m_baseColor->m_opacity = ColorAction->m_fromOpacity;
}
if ( *(_QWORD *)(v49 + 872) )
{
SecondaryColorMode = GameObject::getSecondaryColorMode(v50);
v74 = GJEffectManager::getColorAction(m_levelSettings->m_effectManager, SecondaryColorMode);
v52 = v74->m_fromColor.g;
v53 = v74->m_fromColor.b;
updateSecondaryColor = v50->updateSecondaryColor;
LOBYTE(v77.x) = v74->m_fromColor.r;
BYTE1(v77.x) = v52;
BYTE2(v77.x) = v53;
updateSecondaryColor(v50, (const cocos2d::ccColor3B *)&v77);
v50->m_detailColor->m_opacity = v74->m_fromOpacity;
}
v50->setOpacity(v50, 0xFFFFFFFF);
if ( a8 )
v50->m_hasGroupParent = v49 == a8;
}
}
cocos2d::CCPoint::CCPoint(&v76, 1000.0, 1000.0);
cocos2d::CCPoint::CCPoint(&v77, &v76);
EditorUI::repositionObjectsToCenter(a1, ObjectsFromString, v79, (bool)&v77);
EditorUI::deleteSmartBlocksFromObjects(a1, ObjectsFromString);
EditorUI::deleteTypeFromObjects(a1, 2065, ObjectsFromString);
if ( a5 > 0 )
{
while ( a5 < (unsigned int)cocos2d::CCArray::count(ObjectsFromString) )
{
Object = (GameObject *)cocos2d::CCArray::lastObject(ObjectsFromString);
LevelEditorLayer::removeObject(a1->m_editorLayer, Object, 1);
cocos2d::CCArray::removeLastObject(ObjectsFromString, 1);
}
}
v18 = 0.0;
v19 = 0;
v20 = 0.0;
v21 = 0.0;
v22 = 0.0;
while ( v19 < (unsigned int)cocos2d::CCArray::count(ObjectsFromString) )
{
v44 = (GameObject *)cocos2d::CCArray::objectAtIndex(ObjectsFromString, v19);
LevelEditorLayer::removeObject(a1->m_editorLayer, v44, 1);
setPosition = v44->setPosition;
v46 = (__int64)v44->getPosition(v44);
cocos2d::CCPoint::operator-(&v77, v46, &v76);
setPosition(v44, &v77);
LODWORD(setPosition) = GameObject::getObjectZOrder(v44);
ObjectZLayer = GameObject::getObjectZLayer(v44);
v13->addChild_0(v13, v44, (_DWORD)setPosition + 10000 * ObjectZLayer);
if ( a6 )
cocos2d::CCArray::addObject(a6, v44);
GameObject::updateBlendMode(v44);
v48 = v44->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v44->m_shouldBlendBase )
((void (__fastcall *)(GameObject *, __int64))v48->setBlendFunc)(v44, 0x100000302LL);
else
((void (__fastcall *)(GameObject *, __int64))v48->setBlendFunc)(v44, 0x30300000001LL);
m_colorSprite = v44->m_colorSprite;
if ( m_colorSprite && !v44->m_unk28c )
{
if ( v44->m_shouldBlendDetail )
{
((void (__fastcall *)(cocos2d::CCSprite *, __int64))m_colorSprite->setBlendFunc)(m_colorSprite, 0x100000302LL);
v24 = v44;
if ( v44->m_shouldBlendBase == v44->m_shouldBlendDetail )
goto LABEL_38;
}
else
{
((void (__fastcall *)(cocos2d::CCSprite *, __int64))m_colorSprite->setBlendFunc)(m_colorSprite, 0x30300000001LL);
v24 = v44;
if ( v44->m_shouldBlendBase == v44->m_shouldBlendDetail )
{
LABEL_38:
GameObject::addColorSpriteToSelf(v24);
goto LABEL_19;
}
}
v25 = GameObject::getObjectZLayer(v24);
if ( v44->m_shouldBlendDetail && v44->m_colorZLayerRelated )
++v25;
ObjectZOrder = GameObject::getObjectZOrder(v44);
v27 = v44->m_colorSprite->__vftable;
getScaleX = v44->getScaleX;
v66 = (cocos2d::CCArray *)(unsigned int)(ObjectZOrder + 10000 * v25);
v68 = v44->m_colorSprite;
v44->m_colorSpriteLocked = 0;
setScaleX = v27->setScaleX;
getScaleX(v44);
((void (__fastcall *)(cocos2d::CCSprite *))setScaleX)(v68);
v69 = v44->m_colorSprite;
setScaleY = v69->setScaleY;
v44->getScaleY(v44);
((void (__fastcall *)(cocos2d::CCSprite *))setScaleY)(v69);
v70 = v44->m_colorSprite;
setRotation = v70->setRotation;
v44->getRotation(v44);
((void (__fastcall *)(cocos2d::CCSprite *))setRotation)(v70);
v71 = v44->m_colorSprite;
v32 = v71->setPosition;
v33 = (__int64)v44->getPosition(v44);
v32(v71, (const cocos2d::CCPoint *)v33);
v44->m_colorSprite->removeFromParentAndCleanup(v44->m_colorSprite, 0);
v13->addChild_0(v13, v44->m_colorSprite, (int)v66);
}
LABEL_19:
setStartPos = v44->setStartPos;
v35 = v44->getPosition(v44);
cocos2d::CCPoint::CCPoint(&v77, v35);
((void (__fastcall *)(GameObject *, cocos2d::CCPoint *))setStartPos)(v44, &v77);
v36 = (cocos2d::CCRect *)v44->getObjectTextureRect(v44);
cocos2d::CCRect::getMinX(v36);
v38 = v37;
cocos2d::CCRect::getMaxX(v36);
v40 = v39;
cocos2d::CCRect::getMinY(v36);
v42 = v41;
cocos2d::CCRect::getMaxY(v36);
if ( v22 != 0.0 && v22 <= v38 )
v38 = v22;
if ( v21 != 0.0 && v21 >= v40 )
v40 = v21;
if ( v20 != 0.0 && v20 <= v42 )
v42 = v20;
if ( v18 != 0.0 && v18 >= v43 )
v43 = v18;
v18 = v43;
++v19;
v20 = v42;
v21 = v40;
v22 = v38;
}
v58 = 0;
setContentSize = v13->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v77, v21 - v22, v18 - v20);
setContentSize(v13, (const cocos2d::CCSize *)&v77);
while ( v58 < (unsigned int)cocos2d::CCArray::count(ObjectsFromString) )
{
v60 = v58++;
v61 = (unsigned __int8 *)cocos2d::CCArray::objectAtIndex(ObjectsFromString, v60);
v62 = *(void (__fastcall **)(unsigned __int8 *, cocos2d::CCPoint *, float, float))(*(_QWORD *)v61 + 184LL);
v63 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(unsigned __int8 *))(*(_QWORD *)v61 + 192LL))(v61);
v78 = cocos2d::CCNode::convertToNodeSpace(v13, v63);
v62(v61, &v77, v78.x, v78.y);
(*(void (__fastcall **)(unsigned __int8 *, _QWORD))(*(_QWORD *)v61 + 328LL))(v61, v61[1278] ^ 1u);
}
return v13;
}