//
// TextGameObject::updateTextObject from 0x1006a2f20 to 0x1006a32c8 (936 bytes)
//
// 8 xrefs:
// > EditorUI::onCreateObject @ 0x100011217
// > LevelEditorLayer::updateLevelFont @ 0x1000c4cc0
// > LevelEditorLayer::breakApartTextObject @ 0x1000c5120
// > CustomizeObjectLayer::onClear @ 0x1001da5a1
// > CustomizeObjectLayer::textChanged @ 0x1001db9fe
// > EditorUI::getCreateBtn @ 0x1006380f3
// > EditorUI::getCreateBtn @ 0x100638133
// > TextGameObject::customObjectSetup @ 0x1006a33ab
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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 12:35:18 +0000
//
__int64 __fastcall TextGameObject::updateTextObject(__int64 a1, std::string *a2, char a3)
{
char v5; // r15
std::string::pointer data; // r12
std::string::pointer v7; // rdi
void *v8; // rax
std::string::size_type v9; // rsi
unsigned int v10; // eax
std::string::size_type size; // r13
__int64 v12; // rdi
__int64 v13; // rax
__int64 v14; // rax
bool v15; // r13
__int64 v16; // r12
const char *v17; // r14
const std::string::value_type *FontFile; // rsi
__int64 v19; // r15
__int64 v20; // rax
__int64 Batched; // r14
__int64 v22; // rax
unsigned int v23; // r14d
__int64 v24; // r13
__int64 v25; // rax
__int64 result; // rax
std::string __s2; // [rsp+10h] [rbp-50h] BYREF
__int16 v29; // [rsp+34h] [rbp-2Ch] BYREF
char v30; // [rsp+36h] [rbp-2Ah]
v5 = 0;
if ( std::string::find(a2, 0, 0) != -1 )
goto LABEL_36;
data = a2->__r_.__value_.__s.__data_;
v7 = a2->__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
v7 = a2->__r_.__value_.__l.__data_;
v5 = 0;
v8 = (void *)cocos2d::cc_utf8_to_utf16(v7);
if ( !v8 )
goto LABEL_36;
operator delete[](v8);
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) == 0 )
{
__s2 = *a2;
if ( (*(_BYTE *)&__s2.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_23;
LABEL_9:
if ( __s2.__r_.__value_.__l.__size_ >= 0x191 )
{
v9 = 400;
while ( __OFSUB__(-(*(_BYTE *)(__s2.__r_.__value_.__r.__words[2] + v9) & 0xC0), 1) )
{
if ( !__OFSUB__(-(*(_BYTE *)(__s2.__r_.__value_.__r.__words[2] + v9 - 1) & 0xC0), 1) )
{
--v9;
break;
}
if ( !__OFSUB__(-(*(_BYTE *)(__s2.__r_.__value_.__r.__words[2] + v9 - 2) & 0xC0), 1) )
{
v9 -= 2LL;
break;
}
if ( !__OFSUB__(-(*(_BYTE *)(__s2.__r_.__value_.__r.__words[2] + v9 - 3) & 0xC0), 1) )
{
v9 -= 3LL;
break;
}
if ( !__OFSUB__(-(*(_BYTE *)(__s2.__r_.__value_.__r.__words[2] + v9 - 4) & 0xC0), 1) )
{
v9 -= 4LL;
break;
}
v9 -= 5LL;
if ( !v9 )
{
v9 = 0;
break;
}
}
std::string::resize(&__s2, v9, 0);
}
goto LABEL_23;
}
sub_10001AD30(&__s2, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_);
if ( (*(_BYTE *)&__s2.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_9;
LABEL_23:
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
operator delete(a2->__r_.__value_.__l.__data_);
*a2 = __s2;
v10 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v10 & 1) != 0 )
{
if ( !a2->__r_.__value_.__l.__size_ )
{
LABEL_35:
std::string::assign(a2, "A");
v5 = 1;
goto LABEL_36;
}
}
else if ( !(v10 >> 1) )
{
goto LABEL_35;
}
*(_WORD *)((char *)&__s2.__r_.__value_.__l.0 + 1) = 32;
if ( (v10 & 1) != 0 )
data = a2->__r_.__value_.__l.__data_;
size = (unsigned __int8)v10 >> 1;
if ( (v10 & 1) != 0 )
size = a2->__r_.__value_.__l.__size_;
v5 = 1;
if ( !memcmp(data, (char *)&__s2.__r_.__value_.__l.0 + 1, size != 0) && size == 1 )
goto LABEL_35;
LABEL_36:
std::string::operator=((std::string *)(a1 + 1352), a2);
v30 = -1;
v29 = -1;
v12 = *(_QWORD *)(a1 + 208);
if ( v12 && (unsigned int)sub_1007FEF90(v12) )
{
v13 = sub_1007FEFE0(*(_QWORD *)(a1 + 208), 0);
v14 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 944LL))(v13);
v29 = *(_WORD *)v14;
v30 = *(_BYTE *)(v14 + 2);
}
if ( *(_BYTE *)(a1 + 1133) == 1 )
{
v15 = 1;
if ( v29 == -1 )
v15 = v30 != -1;
}
else
{
v15 = 0;
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 584LL))(a1, 1);
v16 = sub_1007FE900(a1);
if ( v5 )
{
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) == 0 )
{
v17 = a2->__r_.__value_.__s.__data_;
if ( !a3 )
goto LABEL_50;
LABEL_48:
FontFile = "bigFont.fnt";
goto LABEL_51;
}
v17 = a2->__r_.__value_.__l.__data_;
if ( a3 )
goto LABEL_48;
}
else
{
v17 = "";
if ( a3 )
goto LABEL_48;
}
LABEL_50:
v19 = GameManager::sharedState();
v20 = GameManager::sharedState();
FontFile = GameManager::getFontFile(v19, *(_DWORD *)(v20 + 992));
LABEL_51:
Batched = cocos2d::CCLabelBMFont::createBatched(v17, FontFile, v16, *(unsigned int *)(a1 + 1376));
v22 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)Batched + 328LL))(Batched);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 320LL))(a1, v22);
cocos2d::CCNode::convertToNodeSpace((double *)&__s2, a1, (unsigned int *)&qword_100BE5C00);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)Batched + 184LL))(Batched, &__s2);
if ( (unsigned int)sub_1007FEF90(v16) )
{
v23 = 0;
if ( v15 )
{
do
{
v24 = sub_1007FEFE0(v16, v23);
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v24 + 960LL))(v24, &v29);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 456LL))(a1, v24);
++v23;
}
while ( v23 < (unsigned int)sub_1007FEF90(v16) );
}
else
{
do
{
v25 = sub_1007FEFE0(v16, v23);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 456LL))(a1, v25);
++v23;
}
while ( v23 < (unsigned int)sub_1007FEF90(v16) );
}
}
*(_BYTE *)(a1 + 886) = 1;
*(_WORD *)(a1 + 864) = 257;
*(_BYTE *)(a1 + 840) = 1;
result = (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1200LL))(a1, 1);
*(_BYTE *)(a1 + 559) = 1;
return result;
}