//
// CCTextInputNode::onTextFieldInsertText from 0x3e4178 to 0x3e45a6 (1070 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'CCTextInputNode::onTextFieldInsertText @ 0x3e45b0
//
// 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 11:47:03 +0000
//
bool __fastcall CCTextInputNode::onTextFieldInsertText(
CCTextInputNode *this,
_DWORD *a2,
unsigned __int8 *a3,
int a4,
int a5)
{
unsigned __int8 *v6; // r1
int v7; // r6
int v9; // r1
unsigned int v10; // r2
_DWORD *v11; // r0
int v12; // r5
const char *v13; // r0
const char *v14; // r9
size_t v15; // r0
int v16; // r0
int *v17; // r0
int v18; // r1
int v19; // r5
int v20; // r0
signed int v21; // r1
_BYTE *v22; // r2
int v23; // r3
const char *v24; // r5
size_t v25; // r0
int v26; // r10
int v27; // r1
signed int v28; // r5
int v29; // r3
int v30; // r3
bool v31; // cc
int v33; // r3
char *v34; // r2
size_t v35; // r3
int v36; // r10
int v37; // r10
int v38; // r1
int v39; // r1
int v40; // r2
int v41; // r8
_BOOL4 v42; // r3
int v43; // r0
unsigned int v45; // r0
int v46; // r6
int v47; // r6
int v48; // r3
int v49; // r2
int v50; // r6
_BYTE *v51; // r0
_BYTE *v52; // r0
int v53; // r3
int v54; // t1
int v55; // [sp+Ch] [bp-34h] BYREF
signed int v56; // [sp+10h] [bp-30h]
_BYTE *v57; // [sp+14h] [bp-2Ch]
int v58; // [sp+18h] [bp-28h] BYREF
size_t v59; // [sp+1Ch] [bp-24h]
char *v60; // [sp+20h] [bp-20h]
int v61; // [sp+24h] [bp-1Ch] BYREF
signed int v62; // [sp+28h] [bp-18h]
_BYTE *v63; // [sp+2Ch] [bp-14h]
int v64; // [sp+30h] [bp-10h] BYREF
int v65; // [sp+34h] [bp-Ch]
int v66; // [sp+38h] [bp-8h]
v6 = a3;
v7 = a5;
switch ( a5 )
{
case 285:
v7 = 37;
break;
case 286:
v7 = 39;
break;
case 283:
goto LABEL_8;
case 284:
LABEL_7:
v9 = 1;
LABEL_9:
CCTextInputNode::moveCursorVertical(*(float *)&this, v9);
return 1;
case 38:
LABEL_8:
v9 = -1;
goto LABEL_9;
case 40:
goto LABEL_7;
}
*((_DWORD *)this + 114) = -1082130432;
v10 = v7 & 0xFFFFFFFD;
if ( (v7 & 0xFFFFFFFD) == 0x25 )
{
v11 = *((_DWORD **)this + 104);
v12 = v11[152];
if ( v7 != 37 )
{
if ( v12 < 0 )
v12 = -1;
else
++v12;
if ( v11[147] <= v12 )
v12 = -1;
goto LABEL_22;
}
if ( v12 >= 0 )
{
if ( !v12 )
goto LABEL_22;
}
else
{
v12 = v11[147];
}
--v12;
LABEL_22:
if ( *((int *)this + 93) > 0 && v12 >= 0 )
{
v13 = (const char *)(*(int (__fastcall **)(_DWORD *, unsigned __int8 *))(*v11 + 624))(v11, v6);
v64 = 0;
v65 = 0;
v66 = 0;
v14 = v13;
v15 = strlen(v13);
std::string::__init(&v64, v14, v15);
v16 = sub_3DC656((unsigned __int8 *)&v64, v12);
v17 = CCTextInputNode::emoteTokenContaining(this, v16);
if ( v17 )
{
v18 = *v17;
if ( v7 != 37 )
v18 += v17[1];
v12 = sub_3DC19C((unsigned __int8 *)&v64, v18);
}
std::string::~string((int)&v64);
}
*(_DWORD *)(*((_DWORD *)this + 104) + 608) = v12;
CCTextInputNode::updateBlinkLabel(this, (int)v6, v10);
return 1;
}
if ( v6 && a4 > 1 )
{
v55 = 0;
v56 = 0;
v57 = nullptr;
std::string::__init(&v55, v6, a4);
if ( *((int *)this + 93) > 0 )
{
EmoteSprite::translateUnicodeEmoji(&v61);
if ( (v55 & 1) != 0 )
{
*v57 = 0;
v56 = 0;
}
else
{
LOWORD(v55) = 0;
}
std::string::reserve(&v55, 0);
v20 = v61;
v21 = v62;
v22 = v63;
v61 = 0;
v62 = 0;
v63 = nullptr;
v55 = v20;
v56 = v21;
v57 = v22;
std::string::~string((int)&v61);
}
sub_3E3C78(
&v58,
(unsigned __int8 *)&v55,
*((unsigned __int8 *)this + 441),
(unsigned __int8 *)this + 356,
*((_BYTE *)this + 440));
if ( (v58 & 1) != 0 )
v23 = v59;
else
v23 = (int)(unsigned __int8)v58 >> 1;
if ( v23 )
{
v24 = (const char *)(*(int (__fastcall **)(_DWORD *, int))(*a2 + 624))(a2, (unsigned __int8)v58 << 31);
v61 = 0;
v62 = 0;
v63 = nullptr;
v25 = strlen(v24);
std::string::__init(&v61, v24, v25);
v26 = (unsigned __int8)v61;
v27 = *(_DWORD *)(*((_DWORD *)this + 104) + 608);
if ( v27 >= 0 )
{
v28 = sub_3DC656((unsigned __int8 *)&v61, v27);
}
else if ( (v61 & 1) != 0 )
{
v28 = v62;
}
else
{
v28 = (int)(unsigned __int8)v61 >> 1;
}
if ( (v26 & 1) != 0 )
v29 = v62;
else
v29 = v26 >> 1;
if ( v28 <= v29 )
{
v31 = v28 <= 0;
}
else
{
if ( (v26 & 1) != 0 )
v30 = v62;
else
v30 = v26 >> 1;
v31 = v30 <= 0;
}
if ( !v31 )
{
if ( (v26 & 1) != 0 )
v33 = v62;
else
v33 = v26 >> 1;
if ( v28 > v33 )
{
if ( (v26 & 1) != 0 )
v28 = v62;
else
v28 = v26 >> 1;
}
}
else
{
v28 = 0;
}
if ( (v58 & 1) != 0 )
{
v34 = v60;
v35 = v59;
}
else
{
v35 = (int)(unsigned __int8)v58 >> 1;
v34 = (char *)&v58 + 1;
}
std::string::insert(&v61, v28, v34, v35);
v36 = *((_DWORD *)this + 106);
if ( v36 > 0 && sub_3DC602((unsigned __int8 *)&v61) > v36 )
{
v45 = sub_3DC656((unsigned __int8 *)&v61, v36);
std::string::resize((unsigned __int8 *)&v61, v45, 0);
}
std::string::basic_string(&v64, (int)&v61);
CCTextInputNode::setString((int)this, (int)&v64);
std::string::~string((int)&v64);
v37 = *((_DWORD *)this + 104);
if ( *(int *)(v37 + 608) >= 0 )
{
if ( (v58 & 1) != 0 )
v38 = v59;
else
v38 = (int)(unsigned __int8)v58 >> 1;
*(_DWORD *)(v37 + 608) = sub_3DC19C((unsigned __int8 *)&v61, v38 + v28);
CCTextInputNode::updateBlinkLabel(this, v39, v40);
}
std::string::~string((int)&v61);
}
std::string::~string((int)&v58);
std::string::~string((int)&v55);
return 1;
}
v41 = *v6;
if ( v41 == 10 )
{
v19 = *((unsigned __int8 *)this + 440);
if ( *((_BYTE *)this + 440) )
{
if ( v7 != 13
|| (v43 = cocos2d::CCDirector::sharedDirector(this),
*(_BYTE *)((*(int (__fastcall **)(int))(*(_DWORD *)v43 + 96))(v43) + 88)) )
{
v64 = 0;
v65 = 0;
v66 = 0;
std::string::__init(&v64, "\n", 1u);
CCTextInputNode::insertAtCursor((int)this, (int)&v64);
std::string::~string((int)&v64);
return v19;
}
return 1;
}
v42 = v7 != 13 || *((_DWORD *)this + 126) == 5;
*((_BYTE *)this + 484) = v42;
if ( v42 && v7 == 13 )
(*(void (__fastcall **)(CCTextInputNode *, _DWORD))(*(_DWORD *)this + 580))(this, 0);
return v7 == 13;
}
else
{
if ( *((_BYTE *)this + 441) && ((v41 & 0x80) != 0 || sub_3DC4B8(*v6, *((unsigned __int8 *)this + 440))) )
return 1;
v46 = *((unsigned __int8 *)this + 356);
v47 = (v46 & 1) != 0 ? *((_DWORD *)this + 90) : v46 >> 1;
if ( v47 && std::string::find((unsigned __int8 *)this + 356, v41, 0) == -1 )
return 1;
v48 = a2[147];
v49 = *((_DWORD *)this + 106);
if ( v48 >= v49 && v49 > 0 )
return 1;
v50 = *((_DWORD *)this + 120);
if ( v50 <= 0 || (unsigned int)(v41 - 48) > 9 || v48 < v50 )
return 0;
v51 = (_BYTE *)(*(int (__fastcall **)(_DWORD *))(*a2 + 624))(a2);
if ( !v51 )
return 0;
v19 = (unsigned __int8)*v51;
if ( *v51 )
{
v52 = v51 - 1;
while ( 1 )
{
v54 = (unsigned __int8)*++v52;
v53 = v54;
if ( !v54 )
break;
if ( (unsigned int)(v53 - 48) > 9 )
return 0;
}
return 1;
}
}
return v19;
}