//
// cocos2d::CCTextFieldTTF::deleteBackward from 0x1800b51e0 to 0x1800b551d (829 bytes)
//
// 3 xrefs:
// > ??> @ 0x180106ce8
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b8a6c
//
// 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
//
// Hidden C++ exception states: #wind=1
void __fastcall cocos2d::CCTextFieldTTF::deleteBackward(cocos2d::CCTextFieldTTF *this)
{
__int64 *v2; // r9
__int64 v3; // rsi
int v4; // edi
int v5; // edx
unsigned __int64 v6; // rcx
_QWORD *v7; // rax
__int64 v8; // rcx
_QWORD *v9; // rdi
unsigned __int64 v10; // rdx
_QWORD *v11; // rcx
_QWORD *v12; // rax
char *v13; // rdx
__int64 v14; // rcx
int v15; // eax
_QWORD *v16; // rdx
size_t v17; // r8
unsigned __int64 v18; // r9
__int64 v19; // rdx
void **v20; // rcx
__int64 v21; // rsi
void **v22; // rdx
void *v23; // rcx
_QWORD *v24; // rdx
void **v25; // rdx
void *Block[2]; // [rsp+20h] [rbp-38h] BYREF
__int128 v27; // [rsp+30h] [rbp-28h]
v2 = *(__int64 **)&this->m_uAutoReleaseCount;
v3 = *((int *)v2 + 4);
if ( (_DWORD)v3 && LODWORD(this->m_fRotationX) )
{
v4 = 1;
v5 = v3 - 1;
v6 = (int)v3 - 1;
v7 = v2;
if ( v2[2] <= v6 )
LABEL_57:
std::vector::_Xlen();
while ( 1 )
{
if ( v7[3] > 0xFu )
v7 = (_QWORD *)*v7;
if ( (*((_BYTE *)v7 + v6) & 0xC0) != 0x80 )
break;
++v4;
v6 = --v5;
v7 = v2;
if ( v2[2] <= (unsigned __int64)v5 )
goto LABEL_57;
}
v8 = *(_QWORD *)&this->m_uID;
if ( !v8 )
goto LABEL_13;
if ( (unsigned __int64)v2[3] > 0xF )
v2 = (__int64 *)*v2;
if ( !(*(unsigned __int8 (__fastcall **)(__int64, char *, __int64, _QWORD))(*(_QWORD *)v8 + 24LL))(
v8,
(char *)this - 704,
(__int64)v2 + v3 - v4,
(unsigned int)v4) )
{
LABEL_13:
if ( (int)v3 <= v4 )
{
v9 = *(_QWORD **)&this->m_uAutoReleaseCount;
if ( v9 )
{
v10 = v9[3];
if ( v10 > 0xF )
{
v11 = (_QWORD *)*v9;
if ( v10 + 1 >= 0x1000 )
{
if ( (unsigned __int64)v11 - *(v11 - 1) - 8 > 0x1F )
invalid_parameter_noinfo_noreturn();
v11 = (_QWORD *)*(v11 - 1);
}
j_j_free_0(v11);
}
v9[2] = 0;
v9[3] = 15;
*(_BYTE *)v9 = 0;
j_j_free_0(v9);
*(_QWORD *)&this->m_uAutoReleaseCount = 0;
}
v12 = operator new(0x20u);
if ( v12 )
{
*(_OWORD *)v12 = 0;
v12[2] = 0;
v12[3] = 15;
*(_BYTE *)v12 = 0;
}
else
{
v12 = nullptr;
}
*(_QWORD *)&this->m_uAutoReleaseCount = v12;
this->m_nTag = 0;
v13 = *(char **)&this->m_uIndexInArray;
if ( *((_QWORD *)v13 + 3) > 0xFu )
v13 = *(char **)v13;
cocos2d::CCLabelTTF::setString((cocos2d::CCTextFieldTTF *)((char *)this - 104), v13);
v14 = *(_QWORD *)&this->m_uID;
if ( v14 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v14 + 40LL))(v14);
return;
}
v15 = LODWORD(this->m_fRotationX) - 1;
if ( v15 < 0 || v15 >= this->m_nTag )
{
v24 = *(_QWORD **)&this->m_uAutoReleaseCount;
if ( v24[3] > 0xFu )
v24 = (_QWORD *)*v24;
*(_OWORD *)Block = 0;
v27 = 0;
sub_18000CE60(Block, v24, (int)v3 - v4);
v25 = Block;
if ( *((_QWORD *)&v27 + 1) > 0xFu )
v25 = (void **)Block[0];
(**((void (__fastcall ***)(char *, void **))this - 13))((char *)this - 104, v25);
if ( *((_QWORD *)&v27 + 1) > 0xFu )
{
v23 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v27 + 1) + 1LL) >= 0x1000 )
{
v23 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v23 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
goto LABEL_47;
}
}
else
{
v16 = *(_QWORD **)&this->m_uAutoReleaseCount;
if ( v16[3] > 0xFu )
v16 = (_QWORD *)*v16;
*(_OWORD *)Block = 0;
v27 = 0u;
v17 = -1;
do
++v17;
while ( *((_BYTE *)v16 + v17) );
sub_18000CE60(Block, v16, v17);
v18 = LODWORD(this->m_fRotationX) - 1;
if ( (unsigned __int64)v27 < v18 )
std::vector::_Xlen();
v19 = v4;
if ( (unsigned __int64)v27 - v18 < v4 )
v19 = v27 - v18;
v20 = Block;
if ( *((_QWORD *)&v27 + 1) > 0xFu )
v20 = (void **)Block[0];
v21 = v27 - v19;
memmove((char *)v20 + v18, (char *)v20 + v18 + v19, v27 - v19 - v18 + 1);
*(_QWORD *)&v27 = v21;
--LODWORD(this->m_fRotationX);
v22 = Block;
if ( *((_QWORD *)&v27 + 1) > 0xFu )
v22 = (void **)Block[0];
(**((void (__fastcall ***)(char *, void **))this - 13))((char *)this - 104, v22);
if ( *((_QWORD *)&v27 + 1) > 0xFu )
{
v23 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v27 + 1) + 1LL) >= 0x1000 )
{
v23 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v23 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
LABEL_47:
j_j_free_0(v23);
}
}
}
}
}