//
// cocos2d::CCTextFieldTTF::deleteBackward from 0x7fee40 to 0x7fefb6 (374 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'cocos2d::CCTextFieldTTF::deleteBackward @ 0x7fefc0
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:01:18 +0000
//
int *__fastcall cocos2d::CCTextFieldTTF::deleteBackward(int *this, int a2, char *a3, int a4)
{
cocos2d::CCLabelTTF *v4; // r4
unsigned __int8 *v5; // r5
int v6; // r7
int v7; // r10
int v8; // r7
int v9; // r1
int v10; // r8
signed int i; // r6
unsigned __int8 *v12; // r3
int v13; // r0
unsigned __int8 *v14; // r5
int v15; // r5
_DWORD *v16; // r0
int v17; // r1
char *v18; // r1
bool v19; // nf
size_t v20; // r0
int v21; // r3
char *v22; // r1
int *v23; // [sp+0h] [bp-10h] BYREF
int v24; // [sp+4h] [bp-Ch]
char *v25; // [sp+8h] [bp-8h]
int v26; // [sp+Ch] [bp-4h]
v23 = this;
v24 = a2;
v25 = a3;
v26 = a4;
v4 = (cocos2d::CCLabelTTF *)this;
v5 = (unsigned __int8 *)*(this + 148);
v6 = *v5;
v7 = v6 & 1;
if ( (v6 & 1) != 0 )
v8 = *((_DWORD *)v5 + 1);
else
v8 = v6 >> 1;
if ( v8 )
{
v9 = *(this + 152);
if ( v9 )
{
if ( v9 < 0 || v9 > *(this + 147) )
{
v10 = v8;
}
else
{
this = (int *)sub_7FE640(v5, v9);
v10 = (int)this;
}
if ( v10 > 0 )
{
for ( i = 1; i != v10; ++i )
{
v12 = v7 ? *((unsigned __int8 **)v5 + 2) : v5 + 1;
if ( (v12[v10 - i] & 0xC0) != 0x80 )
break;
}
v13 = *((_DWORD *)v4 + 146);
if ( !v13
|| (!v7 ? (v14 = v5 + 1) : (v14 = *((unsigned __int8 **)v5 + 2)),
(this = (int *)(*(int (__fastcall **)(int, cocos2d::CCLabelTTF *, unsigned __int8 *, signed int, int *, int, char *, int))(*(_DWORD *)v13 + 12))(
v13,
v4,
&v14[v10 - i],
i,
v23,
v24,
v25,
v26)) == nullptr) )
{
v15 = *((_DWORD *)v4 + 148);
if ( v8 > i )
{
v19 = (*(_BYTE *)v15 & 1) != 0;
if ( (*(_BYTE *)v15 & 1) == 0 )
++v15;
v23 = nullptr;
if ( v19 )
v15 = *(_DWORD *)(v15 + 8);
v24 = 0;
v25 = nullptr;
v20 = strlen((const char *)v15);
std::string::__init((int *)&v23, (const void *)v15, v20);
std::string::erase((unsigned __int8 *)&v23, v10 - i, i);
v21 = *((_DWORD *)v4 + 152);
if ( v21 > 0 && v21 <= *((_DWORD *)v4 + 147) )
*((_DWORD *)v4 + 152) = v21 - 1;
if ( ((unsigned __int8)v23 & 1) != 0 )
v22 = v25;
else
v22 = (char *)&v23 + 1;
(*(void (__fastcall **)(cocos2d::CCLabelTTF *, char *, int))(*(_DWORD *)v4 + 620))(
v4,
v22,
(unsigned __int8)v23 << 31);
return (int *)std::string::~string((int)&v23);
}
else
{
if ( v15 )
{
std::string::~string(*((_DWORD *)v4 + 148));
operator delete((void *)v15);
*((_DWORD *)v4 + 148) = 0;
}
v16 = (_DWORD *)operator new(0xCu);
*v16 = 0;
v16[1] = 0;
v16[2] = 0;
v17 = *((_DWORD *)v4 + 149);
*((_DWORD *)v4 + 148) = v16;
*((_DWORD *)v4 + 147) = 0;
if ( (*(_BYTE *)v17 & 1) != 0 )
v18 = *(char **)(v17 + 8);
else
v18 = (char *)(v17 + 1);
cocos2d::CCLabelTTF::setString(v4, v18);
this = *((int **)v4 + 146);
if ( this )
return (int *)(*(int (__fastcall **)(int *))(*this + 20))(this);
}
}
}
}
}
return this;
}