//
// TextGameObject::getSaveString from 0x65abdc to 0x65b144 (1384 bytes)
//
// 2 xrefs:
// > ??> @ 0x448f8
// > ??> @ 0x11549e0
//
// 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 __usercall TextGameObject::getSaveString@(
TextGameObject *this@,
GJBaseGameLayer *a2@,
__int64 a3@)
{
const char *v4; // x24
size_t v5; // x20
size_t v6; // x23
unsigned __int64 v7; // x21
char *v8; // x0
size_t v9; // x0
char *v10; // x0
const char *v11; // x1
char *v12; // x0
size_t v13; // x24
size_t v14; // x21
size_t v15; // x24
size_t v16; // x21
size_t v17; // x0
size_t v18; // x28
size_t v19; // x24
unsigned __int64 v20; // x25
char *v21; // x0
void *v22; // x0
size_t v23; // x20
unsigned int *v25; // x1
int v26; // w2
size_t v27; // x22
size_t v28; // x20
char *v29; // x2
size_t v30; // x20
size_t v31; // x22
char *v32; // x1
unsigned int *v33; // x1
int v34; // w2
unsigned int *v35; // x1
int v36; // w2
unsigned __int64 v37; // x0
char *v38; // x0
char *v39; // x24
char *v40; // x1
unsigned __int64 v41; // x0
char *v42; // x0
char *v43; // x24
char *v44; // x1
const char *v45; // [xsp+60h] [xbp+60h]
const char *v47; // [xsp+90h] [xbp+90h] BYREF
__int64 v48; // [xsp+98h] [xbp+98h] BYREF
const char *v49; // [xsp+A0h] [xbp+A0h] BYREF
size_t v50; // [xsp+A8h] [xbp+A8h] BYREF
size_t v51; // [xsp+B0h] [xbp+B0h]
char *v52; // [xsp+B8h] [xbp+B8h]
_BYTE v53[504]; // [xsp+C0h] [xbp+C0h] BYREF
v50 = 0;
v51 = 500;
v52 = v53;
GameObject::getSaveString(this, a2, (__int64)&v47);
v4 = v47;
v5 = *((_QWORD *)v47 - 3);
if ( v5 )
{
v6 = v50;
v7 = v50 + v5;
if ( v51 >= v50 + v5 )
{
v50 += v5;
v8 = &v52[v6];
goto LABEL_29;
}
LABEL_27:
fmt::internal::Array::grow(&v50, v7);
v50 = v7;
v10 = v52;
if ( v5 )
goto LABEL_28;
goto LABEL_6;
}
v9 = strlen(v47);
v6 = v50;
v5 = v9;
v7 = v9 + v50;
if ( v9 + v50 > v51 )
goto LABEL_27;
v50 += v9;
v10 = v52;
if ( v5 )
{
LABEL_28:
v8 = &v10[v6];
LABEL_29:
memmove(v8, v4, v5);
v11 = v47;
v12 = (char *)(v47 - 24);
if ( v47 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_7;
goto LABEL_30;
}
LABEL_6:
v11 = v47;
v12 = (char *)(v47 - 24);
if ( v47 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_7;
LABEL_30:
if ( &pthread_create )
{
v25 = (unsigned int *)(v11 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *((_DWORD *)v11 - 2);
*((_DWORD *)v11 - 2) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v12);
LABEL_7:
v13 = v50;
v14 = v50 + 1;
if ( v50 + 1 > v51 )
fmt::internal::Array::grow(&v50, v50 + 1);
v50 = v14;
v52[v13] = 44;
fmt::BasicWriter::FormatInt,char>>(&v50, 0x1Fu);
v15 = v50;
v16 = v50 + 1;
if ( v50 + 1 > v51 )
fmt::internal::Array::grow(&v50, v50 + 1);
v50 = v16;
v52[v15] = 44;
sub_D18D28(&v48, &this->m_text);
LevelTools::base64EncodeString((cocos2d::ZipUtils *)&v48, &v49);
v45 = v49;
if ( v49 )
{
v17 = strlen(v49);
v18 = v50;
v19 = v17;
v20 = v17 + v50;
if ( v17 + v50 <= v51 )
goto LABEL_13;
}
else
{
v18 = v50;
if ( v50 <= v51 )
goto LABEL_15;
v20 = v50;
v19 = 0;
}
fmt::internal::Array::grow(&v50, v20);
LABEL_13:
v50 = v20;
if ( v19 )
memmove(&v52[v18], v45, v19);
LABEL_15:
v21 = (char *)(v49 - 24);
if ( v49 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)(v49 - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v21);
}
v22 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(v48 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v22);
}
if ( this->m_kerning )
{
v27 = v50;
v28 = v50 + 1;
if ( v50 + 1 > v51 )
{
v41 = v51 + (v51 >> 1);
if ( v41 < v28 )
v41 = v50 + 1;
v51 = v41;
v42 = (char *)operator new[](v41);
v43 = v42;
v44 = v52;
if ( v50 )
{
memmove(v42, v52, v50);
v44 = v52;
}
if ( v44 != v53 && v44 )
operator delete[](v44);
v52 = v43;
v29 = v43;
}
else
{
v29 = v52;
}
v50 = v28;
v29[v27] = 44;
fmt::BasicWriter::FormatInt,char>>(&v50, 0x1E8u);
v30 = v50;
v31 = v50 + 1;
if ( v50 + 1 > v51 )
{
v37 = v51 + (v51 >> 1);
if ( v37 < v31 )
v37 = v50 + 1;
v51 = v37;
v38 = (char *)operator new[](v37);
v39 = v38;
v40 = v52;
if ( v50 )
{
memmove(v38, v52, v50);
v40 = v52;
}
if ( v40 != v53 && v40 )
operator delete[](v40);
v52 = v39;
v32 = v39;
}
else
{
v32 = v52;
}
v50 = v31;
v32[v30] = 44;
fmt::BasicWriter::FormatInt,char>>(&v50, this->m_kerning);
}
v23 = v50;
if ( v51 < v50 + 1 )
fmt::internal::Array::grow(&v50, v50 + 1);
v52[v23] = 0;
sub_D153B8(a3, v52);
if ( v52 != v53 && v52 )
operator delete[](v52);
return a3;
}