//
// cocos2d::CCTextFieldTTF::insertText from 0x5f2f38 to 0x5f3052 (282 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'cocos2d::CCTextFieldTTF::insertText @ 0x5f3060
//
// 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
//
void cocos2d::CCTextFieldTTF::insertText(cocos2d::CCTextFieldTTF *a1, const char *a2, int a3, cocos2d::enumKeyCodes a4)
{
int v6; // r10
int v7; // r7
cocos2d::CCTextFieldDelegate *m_pDelegate; // r0
cocos2d::CCTextFieldDelegate *v9; // r0
int v10; // r3
int v11; // r2
char v12; // r1
int v13; // t1
int m_uCursorPos; // r1
int m_nCharCount; // r3
cocos2d::enumKeyCodes v16; // [sp+0h] [bp-18h]
int v17; // [sp+Ch] [bp-Ch] BYREF
const unsigned __int8 *v18; // [sp+10h] [bp-8h] BYREF
v6 = a3;
sub_7762B0(&v17, a2, a3, &v18);
v7 = sub_774910(&v17, 10, 0);
if ( v7 == -1 )
{
if ( v6 <= 0 )
goto LABEL_23;
}
else
{
sub_7751B8(&v17, v7, -1);
if ( v7 <= 0 )
{
LABEL_3:
m_pDelegate = a1->m_pDelegate;
if ( !m_pDelegate
|| !((int (__fastcall *)(cocos2d::CCTextFieldDelegate *, cocos2d::CCTextFieldTTF *, const char *, int, cocos2d::enumKeyCodes))m_pDelegate->onTextFieldInsertText)(
m_pDelegate,
a1,
"\n",
1,
a4) )
{
a1->detachWithIME(a1);
}
goto LABEL_23;
}
v6 = v7;
}
v9 = a1->m_pDelegate;
if ( !v9
|| (v16 = a4,
!((int (__fastcall *)(cocos2d::CCTextFieldDelegate *, cocos2d::CCTextFieldTTF *, int, int))v9->onTextFieldInsertText)(
v9,
a1,
v17,
v6)) )
{
v10 = 0;
v11 = v17 - 1;
while ( 1 )
{
v13 = *(unsigned __int8 *)++v11;
v12 = v13;
if ( !v13 )
break;
if ( (v12 & 0xC0) != 0x80 )
++v10;
}
a1->m_nCharCount += v10;
sub_775C20(&v18);
m_uCursorPos = a1->m_uCursorPos;
if ( m_uCursorPos >= 0 && (m_nCharCount = a1->m_nCharCount, m_uCursorPos < m_nCharCount) )
{
sub_775590(&v18, m_uCursorPos, &v17, m_nCharCount, v16);
++a1->m_uCursorPos;
}
else
{
sub_77441C(&v18, &v17);
}
a1->setString(a1, v18);
sub_774008(&v18);
if ( v7 != -1 )
goto LABEL_3;
}
LABEL_23:
sub_774008(&v17);
}