//
// cocos2d::CCTextFieldTTF::deleteBackward from 0xda1e88 to 0xda20fc (628 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'cocos2d::CCTextFieldTTF::deleteBackward @ 0xda2100
// > ??> @ 0x606b8
// > ??> @ 0x15300a0
//
// 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 13:08:30 +0000
//
__int64 __fastcall cocos2d::CCTextFieldTTF::deleteBackward(cocos2d::CCTextFieldTTF *this)
{
char *v2; // x20
int v3; // w24
__int64 v4; // x2
int v5; // w25
int v6; // w1
int v8; // w21
int v9; // w19
__int64 v10; // x0
char *v11; // x1
__int64 v12; // x0
char *v13; // x3
unsigned __int64 v14; // x24
_QWORD *v15; // x0
__int64 v16; // x0
const char *v17; // x1
__int64 v18; // x0
const char *v19; // x1
size_t v20; // x0
int v21; // w0
char *v22; // x1
char *v23; // [xsp+58h] [xbp+58h]
__int64 v24[2]; // [xsp+60h] [xbp+60h] BYREF
void *v25; // [xsp+70h] [xbp+70h]
v2 = *((char **)this + 90);
v3 = *v2 & 1;
LODWORD(v4) = (unsigned __int8)*v2 >> 1;
if ( (*v2 & 1) != 0 )
v4 = *((_QWORD *)v2 + 1);
v5 = v4;
if ( (_DWORD)v4 )
{
v6 = *((_DWORD *)this + 188);
if ( v6 )
{
if ( v6 < 0 )
{
v8 = v4;
}
else
{
v8 = v4;
if ( v6 <= *((_DWORD *)this + 178) )
v8 = sub_DA101C((__int64)v2, v6);
}
if ( v8 > 0 )
{
v9 = 1;
if ( v8 != 1 )
{
v10 = v8 - 1LL;
while ( 1 )
{
v11 = v2 + 1;
if ( v3 )
v11 = *((char **)v2 + 2);
if ( (v11[v10] & 0xC0) != 0x80 )
break;
++v9;
--v10;
if ( v9 == v8 )
{
v12 = *((_QWORD *)this + 88);
if ( v12 )
goto LABEL_16;
goto LABEL_25;
}
}
}
v12 = *((_QWORD *)this + 88);
if ( !v12 )
{
LABEL_25:
v14 = v9;
if ( v5 <= v9 )
goto LABEL_26;
LABEL_33:
v19 = v2 + 1;
if ( (*v2 & 1) != 0 )
v19 = *((const char **)v2 + 2);
v23 = (char *)v19;
v24[0] = 0;
v24[1] = 0;
v25 = nullptr;
v20 = strlen(v19);
std::string::__init(v24, v23, v20);
std::string::erase((char *)v24, v8 - v9, v14);
v21 = *((_DWORD *)this + 188);
if ( v21 > 0 && v21 <= *((_DWORD *)this + 178) )
*((_DWORD *)this + 188) = v21 - 1;
v22 = (char *)v24 + 1;
if ( (v24[0] & 1) != 0 )
v22 = (char *)v25;
(*(void (__fastcall **)(cocos2d::CCTextFieldTTF *, char *))(*(_QWORD *)this + 1240LL))(this, v22);
if ( (v24[0] & 1) != 0 )
operator delete(v25);
return _stack_chk_guard;
}
LABEL_16:
v13 = v2 + 1;
if ( v3 )
v13 = *((char **)v2 + 2);
v14 = v9;
if ( !(*(unsigned __int8 (__fastcall **)(__int64, cocos2d::CCTextFieldTTF *, char *, _QWORD))(*(_QWORD *)v12 + 24LL))(
v12,
this,
&v13[v8 - (__int64)v9],
(unsigned int)v9) )
{
v2 = *((char **)this + 90);
if ( v5 <= v9 )
{
if ( !v2 )
{
LABEL_29:
v15 = (_QWORD *)operator new(0x18u);
*v15 = 0;
v15[1] = 0;
v15[2] = 0;
*((_QWORD *)this + 90) = v15;
v16 = *((_QWORD *)this + 91);
*((_DWORD *)this + 178) = 0;
v17 = (const char *)(v16 + 1);
if ( (*(_BYTE *)v16 & 1) != 0 )
v17 = *(const char **)(v16 + 16);
cocos2d::CCLabelTTF::setString(this, v17);
v18 = *((_QWORD *)this + 88);
if ( v18 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v18 + 40LL))(v18);
return _stack_chk_guard;
}
LABEL_26:
if ( (*v2 & 1) != 0 )
operator delete(*((void **)v2 + 2));
operator delete(v2);
*((_QWORD *)this + 90) = 0;
goto LABEL_29;
}
goto LABEL_33;
}
}
}
}
return _stack_chk_guard;
}