//
// TextGameObject::updateTextObject from 0x1005d17e0 to 0x1005d1a48 (616 bytes)
//
// 8 xrefs:
// > EditorUI::getCreateBtn @ 0x100033910
// > EditorUI::getCreateBtn @ 0x100033950
// > EditorUI::onCreateObject @ 0x100035084
// > LevelEditorLayer::updateLevelFont @ 0x1000f1570
// > LevelEditorLayer::breakApartTextObject @ 0x1000f18e5
// > CustomizeObjectLayer::onClear @ 0x1001f8091
// > CustomizeObjectLayer::textChanged @ 0x1001f95de
// > TextGameObject::customObjectSetup @ 0x1005d1b0b
//
// 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, std::string *a2, char a3)
{
unsigned int v5; // eax
std::string::pointer data; // rdi
std::string::size_type size; // r12
__int64 v8; // rdi
__int64 v9; // rax
__int64 v10; // rax
bool v11; // r13
cocos2d::CCArray *v12; // r12
const char *v13; // r14
GameManager *v14; // r15
GameManager *v15; // rax
const std::string::value_type *FontFile; // rsi
cocos2d::CCLabelBMFont *Batched; // r14
__int64 v18; // rax
unsigned int v19; // r14d
__int64 v20; // r13
__int64 v21; // rax
__int64 result; // rax
char v23; // [rsp+8h] [rbp-48h] BYREF
__int16 __s2[13]; // [rsp+9h] [rbp-47h] BYREF
__int16 v25; // [rsp+24h] [rbp-2Ch] BYREF
char v26; // [rsp+26h] [rbp-2Ah]
double v27; // 0:xmm0_8.8
v5 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v5 & 1) != 0 )
{
if ( !a2->__r_.__value_.__l.__size_ )
{
LABEL_11:
std::string::assign(a2, "A");
goto LABEL_12;
}
}
else if ( !(v5 >> 1) )
{
goto LABEL_11;
}
data = a2->__r_.__value_.__s.__data_;
__s2[0] = 32;
if ( (v5 & 1) != 0 )
data = a2->__r_.__value_.__l.__data_;
size = (unsigned __int8)v5 >> 1;
if ( (v5 & 1) != 0 )
size = a2->__r_.__value_.__l.__size_;
if ( !memcmp(data, __s2, size != 0) && size == 1 )
goto LABEL_11;
LABEL_12:
std::string::operator=((std::string *)(a1 + 1352), a2);
v26 = -1;
v25 = -1;
v8 = *(_QWORD *)(a1 + 208);
if ( v8 && (unsigned int)sub_100720070(v8) )
{
v9 = sub_1007200C0(*(_QWORD *)(a1 + 208), 0);
v10 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 928LL))(v9);
v25 = *(_WORD *)v10;
v26 = *(_BYTE *)(v10 + 2);
}
if ( *(_BYTE *)(a1 + 1133) == 1 )
{
v11 = 1;
if ( v25 == -1 )
v11 = v26 != -1;
}
else
{
v11 = 0;
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 568LL))(a1, 1);
v12 = (cocos2d::CCArray *)sub_10071F9E0(a1, 1);
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
v13 = a2->__r_.__value_.__l.__data_;
if ( !a3 )
goto LABEL_21;
}
else
{
v13 = a2->__r_.__value_.__s.__data_;
if ( !a3 )
{
LABEL_21:
v14 = GameManager::sharedState();
v15 = GameManager::sharedState();
FontFile = GameManager::getFontFile(v14, v15->m_loadedFont);
goto LABEL_24;
}
}
FontFile = "bigFont.fnt";
LABEL_24:
Batched = cocos2d::CCLabelBMFont::createBatched(v13, FontFile, v12, *(_DWORD *)(a1 + 1376));
v18 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))Batched->getContentSize)(Batched);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 304LL))(a1, v18);
*(cocos2d::CCPoint *)&v27 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v23, (const cocos2d::CCPoint *)a1);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *, double))Batched->setPosition)(Batched, &v23, v27);
if ( (unsigned int)sub_100720070(v12) )
{
v19 = 0;
if ( v11 )
{
do
{
v20 = sub_1007200C0(v12, v19);
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v20 + 944LL))(v20, &v25);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 440LL))(a1, v20);
++v19;
}
while ( v19 < (unsigned int)sub_100720070(v12) );
}
else
{
do
{
v21 = sub_1007200C0(v12, v19);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 440LL))(a1, v21);
++v19;
}
while ( v19 < (unsigned int)sub_100720070(v12) );
}
}
*(_BYTE *)(a1 + 886) = 1;
*(_WORD *)(a1 + 864) = 257;
*(_BYTE *)(a1 + 840) = 1;
result = (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1184LL))(a1, 1);
*(_BYTE *)(a1 + 559) = 1;
return result;
}