//
// TextGameObject::updateTextObject from 0x656210 to 0x65652c (796 bytes)
//
// 9 xrefs:
// > TextGameObject::customObjectSetup @ 0x6565c4
// > LevelEditorLayer::updateLevelFont @ 0x660f40
// > LevelEditorLayer::breakApartTextObject @ 0x67232c
// > EditorUI::getCreateBtn @ 0x694b9c
// > EditorUI::getCreateBtn @ 0x694c18
// > EditorUI::onCreateObject @ 0x6c031c
// > CustomizeObjectLayer::onClear @ 0x83fd5c
// > CustomizeObjectLayer::textChanged @ 0x841400
// > ??> @ 0x8aa98
//
// 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
//
__int64 __fastcall TextGameObject::updateTextObject(__int64 *a1, const void **a2, unsigned __int8 a3)
{
int v5; // w22
cocos2d::CCArray *v6; // x0
_BOOL4 v7; // w23
cocos2d::CCArray *v8; // x0
__int64 v9; // x0
const char *v10; // x19
cocos2d::CCArray *v11; // x21
const char *FontFile; // x1
const char *v13; // x0
unsigned int v14; // w19
cocos2d::CCLabelBMFont *Batched; // x22
void (__fastcall *v16)(__int64 *, __int64); // x27
__int64 v17; // x0
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
__int64 v19; // x0
__int64 v20; // x22
__int64 v21; // x2
void (__fastcall *v22)(__int64 *, __int64); // x2
__int64 v24; // x0
__int64 v25; // x0
GameManager *v26; // x22
GameManager *v27; // x0
_BOOL4 v28; // w27
_DWORD *v29; // x21
unsigned __int64 v30; // x25
unsigned __int64 v31; // x23
size_t v32; // x2
unsigned __int64 v33; // x23
char *v34; // x0
unsigned int *v35; // x21
int v36; // w1
__int16 v37; // [xsp+68h] [xbp+68h] BYREF
unsigned __int8 v38; // [xsp+6Ah] [xbp+6Ah]
void *v39; // [xsp+70h] [xbp+70h] BYREF
cocos2d::CCPoint v40; // 0:kr00_8.8
v5 = a3;
if ( *((_QWORD *)*a2 - 3) )
{
v28 = 0;
sub_D153B8((int)&v39, " ");
v29 = v39;
v30 = *((_QWORD *)v39 - 3);
v31 = *((_QWORD *)*a2 - 3);
if ( v30 > v31 )
v32 = *((_QWORD *)*a2 - 3);
else
v32 = *((_QWORD *)v39 - 3);
if ( !memcmp(*a2, v39, v32) )
{
v33 = v31 - v30;
if ( v33 + 0x80000000 <= 0xFFFFFFFF )
v28 = v33 == 0;
}
v34 = (char *)(v29 - 6);
if ( v29 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_24;
if ( &pthread_create )
{
v35 = v29 - 2;
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *(v29 - 2);
*(v29 - 2) = v36 - 1;
}
if ( v36 > 0 )
{
LABEL_24:
if ( !v28 )
goto LABEL_3;
}
else
{
operator delete(v34);
if ( !v28 )
goto LABEL_3;
}
}
sub_D1798C(a2, "A", 1);
LABEL_3:
sub_D18EA8(a1 + 167, a2);
v6 = (cocos2d::CCArray *)a1[26];
v37 = -1;
v38 = -1;
if ( v6 && (unsigned int)cocos2d::CCArray::count(v6) )
{
v24 = cocos2d::CCArray::objectAtIndex((cocos2d::CCArray *)a1[26], 0);
v25 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v24 + 928LL))(v24);
v37 = *(_WORD *)v25;
v38 = *(_BYTE *)(v25 + 2);
}
v7 = 0;
if ( *((_BYTE *)a1 + 1117) )
{
v7 = 1;
if ( (unsigned __int8)v37 == 255 && HIBYTE(v37) == 255 )
v7 = v38 != 255;
}
v8 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64 *, __int64))(*a1 + 568))(a1, 1);
v9 = cocos2d::CCArray::create(v8);
v10 = (const char *)*a2;
v11 = (cocos2d::CCArray *)v9;
if ( v5 )
{
FontFile = "bigFont.fnt";
}
else
{
v26 = GameManager::sharedState();
v27 = GameManager::sharedState();
FontFile = GameManager::getFontFile(v26, v27->m_loadedFont);
}
v13 = v10;
v14 = 0;
Batched = cocos2d::CCLabelBMFont::createBatched(v13, FontFile, v11, *((_DWORD *)a1 + 336));
v16 = *(void (__fastcall **)(__int64 *, __int64))(*a1 + 304);
v17 = (__int64)Batched->getContentSize(Batched);
v16(a1, v17);
setPosition = Batched->setPosition;
v40 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)a1, &stru_1242068);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **, float, float))setPosition)(Batched, &v39, v40.x, v40.y);
while ( v14 < (unsigned int)cocos2d::CCArray::count(v11) )
{
v19 = cocos2d::CCArray::objectAtIndex(v11, v14);
v20 = v19;
if ( v7 )
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v19 + 944LL))(v19, &v37);
++v14;
(*(void (__fastcall **)(__int64 *, __int64))(*a1 + 440))(a1, v20);
}
v21 = *a1;
*((_BYTE *)a1 + 870) = 1;
*((_BYTE *)a1 + 848) = 1;
v22 = *(void (__fastcall **)(__int64 *, __int64))(v21 + 1184);
*((_BYTE *)a1 + 849) = 1;
*((_BYTE *)a1 + 824) = 1;
v22(a1, 1);
*((_BYTE *)a1 + 559) = 1;
return _stack_chk_guard;
}