//
// LevelEditorLayer::breakApartTextObject from 0x46ec30 to 0x46eed4 (676 bytes)
//
// 1 xrefs:
// > CustomizeObjectLayer::onBreakApart @ 0x57e05a
//
// 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:03 +0000
//
int __fastcall LevelEditorLayer::breakApartTextObject(int this, TextGameObject *a2)
{
int v2; // r6
EditorUI *v4; // r0
cocos2d::CCArray *v5; // r10
unsigned int v6; // r11
_DWORD *v7; // r5
char *v8; // r3
char *v9; // r7
int v10; // r0
int v11; // lr
signed int i; // r2
EditorUI *v13; // r0
char v14; // r3
size_t v15; // r3
const cocos2d::CCPoint *v16; // r0
const cocos2d::CCPoint *v17; // r9
cocos2d::CCObject **Object; // r5
cocos2d::CCArray *v19; // r0
int v20; // r0
int v21; // r8
int v22; // r0
char v23; // r1
int v24; // r1
int v25; // r8
char *v26; // r0
cocos2d::CCArray *v27; // [sp+Ch] [bp-68h]
void (__fastcall *v28)(cocos2d::CCObject **, _BYTE *); // [sp+10h] [bp-64h]
cocos2d::CCPoint *v29; // [sp+14h] [bp-60h]
_BYTE v30[8]; // [sp+20h] [bp-54h] BYREF
_BYTE v31[8]; // [sp+28h] [bp-4Ch] BYREF
_BYTE v32[8]; // [sp+30h] [bp-44h] BYREF
_BYTE v33[8]; // [sp+38h] [bp-3Ch] BYREF
_BYTE v34[8]; // [sp+40h] [bp-34h] BYREF
int v35[2]; // [sp+48h] [bp-2Ch] BYREF
char *v36; // [sp+50h] [bp-24h]
int v37[3]; // [sp+54h] [bp-20h] BYREF
int v38[3]; // [sp+60h] [bp-14h] BYREF
v2 = this;
if ( !a2 || *((_DWORD *)a2 + 223) != 914 )
return this;
v4 = *(EditorUI **)(this + 11856);
if ( v4 )
EditorUI::deselectAll(v4);
LevelEditorLayer::removeObject(v2, a2, 0);
(*(void (__fastcall **)(_DWORD, TextGameObject *))(**(_DWORD **)(v2 + 1812) + 228))(*(_DWORD *)(v2 + 1812), a2);
std::string::basic_string(v35, (int)a2 + 1168);
v5 = (cocos2d::CCArray *)(*(int (__fastcall **)(TextGameObject *))(*(_DWORD *)a2 + 244))(a2);
v6 = 0;
v27 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
LABEL_6:
if ( v6 < cocos2d::CCArray::count(v5) )
{
v7 = (_DWORD *)cocos2d::CCArray::objectAtIndex(v5, v6);
v8 = v36;
v9 = (char *)v35 + 1;
v10 = 0;
v11 = (int)LOBYTE(v35[0]) >> 1;
if ( (v35[0] & 1) != 0 )
{
v9 = v36;
v11 = v35[1];
}
for ( i = 0; ; i += v24 )
{
if ( v10 >= v7[138] || i >= v11 )
{
if ( (v35[0] & 1) == 0 )
v8 = (char *)v35 + 1;
v14 = v8[i];
if ( (v14 & 0xE0) == 0xC0 )
{
v15 = 2;
}
else if ( (v14 & 0xF0) == 0xE0 )
{
v15 = 3;
}
else if ( (v14 & 0xF8) == 0xF0 )
{
v15 = 4;
}
else
{
v15 = 1;
}
std::string::basic_string(v37, (unsigned __int8 *)v35, i, v15);
if ( (v37[0] & 1) != 0 )
{
if ( v37[1] == 1 )
{
v26 = (char *)v37[2];
goto LABEL_30;
}
goto LABEL_31;
}
if ( (int)LOBYTE(v37[0]) >> 1 != 1 )
goto LABEL_31;
v26 = (char *)v37 + 1;
LABEL_30:
if ( std::char_traits::compare(v26, " ", 1u) )
{
LABEL_31:
v16 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD *))(*v7 + 96))(v7);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v30, v16);
v17 = *(const cocos2d::CCPoint **)(v2 + 1812);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v33, a2);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v34, v17);
Object = LevelEditorLayer::createObject(
(cocos2d::CCArray **)v2,
(GameObject *)((char *)&stru_38C.st_value + 2),
(const cocos2d::CCPoint *)v34,
0);
GameObject::duplicateValues((GameObject *)Object, a2);
std::string::basic_string(v38, (int)v37);
TextGameObject::updateTextObject(Object, (unsigned __int8 *)v38, 0);
std::string::~string((int)v38);
*((_BYTE *)Object + 1005) = 1;
v19 = (cocos2d::CCArray *)(*((int (__fastcall **)(cocos2d::CCObject **))*Object + 61))(Object);
v20 = cocos2d::CCArray::objectAtIndex(v19, 0);
v21 = (*(int (__fastcall **)(int))(*(_DWORD *)v20 + 96))(v20);
v22 = (*((int (__fastcall **)(cocos2d::CCObject **))*Object + 39))(Object);
cocos2d::CCPoint::operator-(v31, v21, v22);
v28 = *((void (__fastcall **)(cocos2d::CCObject **, _BYTE *))*Object + 171);
v29 = *(cocos2d::CCPoint **)(v2 + 1812);
cocos2d::CCPoint::operator-(v32, v30, v31);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v33, a2);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v34, v29);
v28(Object, v34);
GJBaseGameLayer::reorderObjectSection((GJBaseGameLayer *)v2, (GameObject *)Object);
cocos2d::CCArray::addObject(v27, (cocos2d::CCObject *)Object);
}
++v6;
std::string::~string((int)v37);
goto LABEL_6;
}
v23 = v9[i];
if ( (v23 & 0xE0) == 0xC0 )
{
v24 = 2;
}
else if ( (v23 & 0xF0) == 0xE0 )
{
v24 = 3;
}
else
{
if ( (v23 & 0xF8) == 0xF0 )
{
v24 = 4;
v25 = 2;
goto LABEL_37;
}
v24 = 1;
}
v25 = 1;
LABEL_37:
v10 += v25;
}
}
(*(void (__fastcall **)(TextGameObject *, _DWORD))(*(_DWORD *)a2 + 264))(a2, 0);
v13 = *(EditorUI **)(v2 + 11856);
if ( v13 )
EditorUI::selectObjects(v13, v27, 1);
return std::string::~string((int)v35);
}