//
// cocos2d::CCTextFieldTTF::setString from 0x100269300 to 0x100269553 (595 bytes)
//
// 2 xrefs:
// > sub_100269580 @ 0x10026958c
// > ??> @ 0x100af6d10
//
// 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:27:34 +0000
//
void __fastcall cocos2d::CCTextFieldTTF::setString(__int64 a1, const char *a2)
{
const char *v2; // r14
void **v3; // r15
std::string *v4; // r15
size_t v5; // rax
size_t v6; // r12
void *v7; // r13
_QWORD *v8; // rax
size_t v9; // r14
unsigned __int8 *v10; // rax
unsigned int v11; // r12d
__int64 v12; // r12
unsigned __int8 *v13; // rcx
unsigned int v14; // eax
std::string *v15; // rsi
__int64 v16; // rax
char *v17; // rax
char v18; // dl
char *v19; // rax
int v20; // ecx
__int64 v21; // rdi
std::string v22; // [rsp+10h] [rbp-40h] BYREF
v2 = a2;
memset(&v22, 0, sizeof(v22));
v3 = *(void ***)(a1 + 720);
if ( v3 )
{
if ( (*(_BYTE *)v3 & 1) != 0 )
operator delete(v3[2]);
operator delete(v3);
*(_QWORD *)(a1 + 720) = 0;
}
if ( !a2 )
{
v8 = operator new(0x18u);
*(_OWORD *)v8 = 0;
v8[2] = 0;
*(_QWORD *)(a1 + 720) = v8;
goto LABEL_21;
}
v4 = (std::string *)operator new(0x18u);
v5 = strlen(a2);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v6 = v5;
if ( v5 >= 0x17 )
{
v9 = 26;
if ( (v5 | 7) != 0x17 )
v9 = (v5 | 7) + 1;
v7 = operator new(v9);
v4->__r_.__value_.__r.__words[2] = (std::string::size_type)v7;
v4->__r_.__value_.__r.__words[0] = v9 | 1;
v4->__r_.__value_.__l.__size_ = v6;
v2 = a2;
goto LABEL_14;
}
v4->__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v5);
v7 = (char *)&v4->__r_.__value_.__l.0 + 1;
if ( v5 )
LABEL_14:
memcpy(v7, v2, v6);
*((_BYTE *)v7 + v6) = 0;
*(_QWORD *)(a1 + 720) = v4;
std::string::operator=(&v22, v4);
if ( *(_BYTE *)(a1 + 739) != 1 )
goto LABEL_21;
std::string::assign(&v22, "");
v10 = *(unsigned __int8 **)(a1 + 720);
v11 = *v10;
if ( (v11 & 1) != 0 )
{
v12 = *((_QWORD *)v10 + 1);
if ( !(_DWORD)v12 )
goto LABEL_21;
}
else
{
LODWORD(v12) = v11 >> 1;
if ( !(_DWORD)v12 )
goto LABEL_21;
}
do
{
std::string::append(&v22, &byte_100BDE86C);
LODWORD(v12) = v12 - 1;
}
while ( (_DWORD)v12 );
LABEL_21:
v13 = *(unsigned __int8 **)(a1 + 720);
v14 = *v13;
if ( (v14 & 1) != 0 )
{
if ( *((_QWORD *)v13 + 1) )
goto LABEL_23;
}
else if ( v14 >> 1 )
{
LABEL_23:
v15 = &v22;
goto LABEL_26;
}
v15 = *(std::string **)(a1 + 728);
LABEL_26:
std::string::operator=((std::string *)(a1 + 640), v15);
v16 = *(_QWORD *)(a1 + 720);
if ( (*(_BYTE *)v16 & 1) != 0 )
{
v17 = *(char **)(v16 + 16);
v18 = *v17;
if ( *v17 )
goto LABEL_28;
LABEL_33:
*(_DWORD *)(a1 + 712) = 0;
v21 = *(_QWORD *)(a1 + 704);
if ( !v21 )
goto LABEL_35;
goto LABEL_34;
}
v17 = (char *)(v16 + 1);
v18 = *v17;
if ( !*v17 )
goto LABEL_33;
LABEL_28:
v19 = v17 + 1;
v20 = 0;
do
{
v20 += !__OFSUB__(-(v18 & 0xC0), 1);
v18 = *v19++;
}
while ( v18 );
*(_DWORD *)(a1 + 712) = v20;
v21 = *(_QWORD *)(a1 + 704);
if ( !v21 )
goto LABEL_35;
LABEL_34:
(*(void (__fastcall **)(__int64))(*(_QWORD *)v21 + 40LL))(v21);
LABEL_35:
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v22.__r_.__value_.__l.__data_);
}