//
// TextGameObject::updateTextObject from 0x100302194 to 0x100302504 (880 bytes)
//
// 8 xrefs:
// > CustomizeObjectLayer::onClear @ 0x1000586b4
// > CustomizeObjectLayer::textChanged @ 0x1000593d8
// > EditorUI::getCreateBtn @ 0x10018454c
// > EditorUI::getCreateBtn @ 0x100184588
// > TextGameObject::customObjectSetup @ 0x1003025f4
// > LevelEditorLayer::updateLevelFont @ 0x100403cf8
// > sub_100403E28 @ 0x1004040c8
// > EditorUI::onCreateObject @ 0x100477384
//
// This function is hookable on this platform (idp: arm, 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 11:03:05 +0000
//
__int64 __fastcall TextGameObject::updateTextObject(__int64 a1, std::string *this, char a3)
{
std::string *v4; // x20
int v6; // w24
char *v7; // x0
_WORD *v8; // x0
std::string::size_type v9; // x1
__int64 v10; // x24
std::string::size_type size; // x8
void *v12; // x22
size_t v13; // x9
int v14; // w10
std::string *v15; // x0
std::string *p_dst; // x1
size_t v17; // x2
_BOOL4 v18; // w23
__int64 v19; // x0
__int64 v20; // x0
__int64 v21; // x0
unsigned __int8 v22; // w8
_BOOL4 v23; // w23
_QWORD *v24; // x0
__int64 v25; // x22
const char *v26; // x1
__int64 v27; // x21
__int64 v28; // x0
__int64 Batched; // x20
__int64 v30; // x0
unsigned int v31; // w20
__int64 v32; // x0
__int64 v33; // x21
__int64 result; // x0
__int16 v35; // [xsp+Ch] [xbp-54h] BYREF
unsigned __int8 v36; // [xsp+Eh] [xbp-52h]
std::string __dst; // [xsp+10h] [xbp-50h] BYREF
v4 = this;
if ( std::string::find(this, 0, 0) == -1 )
{
v7 = (v4->__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL
? (char *)v4
: (char *)v4->__r_.__value_.__r.__words[0];
v8 = cocos2d::cc_utf8_to_utf16(v7, nullptr);
if ( v8 )
{
operator delete[](v8);
if ( SHIBYTE(v4->__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__dst, v4->__r_.__value_.__l.__data_, v4->__r_.__value_.__l.__size_);
else
__dst = *v4;
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 && __dst.__r_.__value_.__l.__size_ >= 0x191 )
{
v9 = 400;
do
{
if ( (*(_BYTE *)(__dst.__r_.__value_.__r.__words[0] + v9) & 0xC0) != 0x80 )
break;
--v9;
}
while ( v9 );
std::string::resize(&__dst, v9, 0);
}
if ( SHIBYTE(v4->__r_.__value_.__r.__words[2]) < 0 )
operator delete(v4->__r_.__value_.__l.__data_);
*v4 = __dst;
if ( (SHIBYTE(v4->__r_.__value_.__r.__words[2]) & 0x8000000000000000LL) != 0 )
{
if ( !v4->__r_.__value_.__l.__size_ )
{
LABEL_38:
std::string::assign(v4, "A");
LABEL_39:
v6 = 1;
goto LABEL_40;
}
}
else if ( !*((_BYTE *)&v4->__r_.__value_.__s + 23) )
{
goto LABEL_38;
}
sub_100009900(&__dst, " ");
v10 = SHIBYTE(__dst.__r_.__value_.__r.__words[2]);
size = __dst.__r_.__value_.__l.__size_;
v12 = (void *)__dst.__r_.__value_.__r.__words[0];
v13 = HIBYTE(v4->__r_.__value_.__r.__words[2]);
v14 = (char)v13;
if ( (v13 & 0x80u) != 0LL )
v13 = v4->__r_.__value_.__l.__size_;
if ( v14 >= 0 )
v15 = v4;
else
v15 = (std::string *)v4->__r_.__value_.__r.__words[0];
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
{
p_dst = (std::string *)__dst.__r_.__value_.__r.__words[0];
}
else
{
size = SHIBYTE(__dst.__r_.__value_.__r.__words[2]);
p_dst = &__dst;
}
if ( size >= v13 )
v17 = v13;
else
v17 = size;
v18 = size == v13;
if ( memcmp(v15, p_dst, v17) )
v18 = 0;
if ( v10 < 0 )
operator delete(v12);
if ( !v18 )
goto LABEL_39;
goto LABEL_38;
}
}
v6 = 0;
LABEL_40:
std::string::operator=((std::string *)(a1 + 1352), v4);
v36 = -1;
v35 = -1;
v19 = *(_QWORD *)(a1 + 208);
if ( v19 && (unsigned int)sub_1002E757C(v19) )
{
v20 = sub_1002E75A0(*(_QWORD *)(a1 + 208), 0);
v21 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 944LL))(v20);
v22 = *(_BYTE *)(v21 + 2);
v35 = *(_WORD *)v21;
v36 = v22;
}
if ( *(_BYTE *)(a1 + 1133) == 1 )
{
v23 = 1;
if ( (unsigned __int8)v35 == 255 && HIBYTE(v35) == 255 )
v23 = v36 != 255;
}
else
{
v23 = 0;
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 584LL))(a1, 1);
v24 = sub_1002E736C();
v25 = (__int64)v24;
if ( v6 )
{
if ( SHIBYTE(v4->__r_.__value_.__r.__words[2]) < 0 )
v4 = (std::string *)v4->__r_.__value_.__r.__words[0];
if ( (a3 & 1) != 0 )
goto LABEL_52;
}
else
{
v4 = (std::string *)"";
if ( (a3 & 1) != 0 )
{
LABEL_52:
v26 = "bigFont.fnt";
goto LABEL_55;
}
}
v27 = GameManager::sharedState(v24);
v28 = GameManager::sharedState(v27);
v26 = (const char *)sub_1003B4F54(v27, *(unsigned int *)(v28 + 992));
LABEL_55:
Batched = cocos2d::CCLabelBMFont::createBatched(v4, v26, v25, *(unsigned int *)(a1 + 1376));
v30 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)Batched + 328LL))(Batched);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 320LL))(a1, v30);
cocos2d::CCNode::convertToNodeSpace(a1, (__int64)flt_1009F63A0, &__dst);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)Batched + 184LL))(Batched, &__dst);
if ( (unsigned int)sub_1002E757C(v25) )
{
v31 = 0;
do
{
v32 = sub_1002E75A0(v25, v31);
v33 = v32;
if ( v23 )
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v32 + 960LL))(v32, &v35);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 456LL))(a1, v33);
++v31;
}
while ( v31 < (unsigned int)sub_1002E757C(v25) );
}
*(_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;
}