//
// CCTextInputNode::onTextFieldAttachWithIME from 0x1400508f0 to 0x140050c1d (813 bytes)
//
// 2 xrefs:
// > ??> @ 0x140532320
// > ??> @ 0x1406c4d70
//
// 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
bool CCTextInputNode::onTextFieldAttachWithIME(CCTextInputNode *a1, cocos2d::CCTextFieldTTF *a2)
{
__int64 v3; // rcx
const char *v4; // rax
_BYTE *v5; // rax
size_t v6; // r8
void **v7; // rcx
char *v8; // rbx
unsigned __int64 v9; // r14
size_t v10; // r8
__int64 v11; // rsi
char *v12; // rax
__int64 v13; // rcx
__int64 v14; // rcx
__int64 v15; // rcx
cocos2d::CCDirector *v16; // rax
const struct cocos2d::CCPoint *v17; // rax
float *v18; // rbx
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rcx
cocos2d::CCPoint v23; // [rsp+30h] [rbp-21h] BYREF
void *Buf1[2]; // [rsp+38h] [rbp-19h] BYREF
__int64 v25; // [rsp+48h] [rbp-9h]
unsigned __int64 v26; // [rsp+50h] [rbp-1h]
__int128 Buf2; // [rsp+58h] [rbp+7h] BYREF
__int64 v28; // [rsp+68h] [rbp+17h]
__int64 v29; // [rsp+70h] [rbp+1Fh]
v3 = *(_QWORD *)&a1->m_sAdditionalTransform.d;
if ( v3 )
{
LOBYTE(a2) = 1;
(*(void (__fastcall **)(__int64, cocos2d::CCTextFieldTTF *))(*(_QWORD *)v3 + 320LL))(v3, a2);
}
LOBYTE(a1->m_unknown5) = 1;
if ( LOBYTE(a1->m_uID) )
{
v4 = (const char *)(*(__int64 (__fastcall **)(__int64, cocos2d::CCTextFieldTTF *))(*(_QWORD *)(*(_QWORD *)&a1->m_sAdditionalTransform.ty
+ 600LL)
+ 8LL))(
*(_QWORD *)&a1->m_sAdditionalTransform.ty + 600LL,
a2);
if ( atof(v4) == 0.0 )
{
*(_OWORD *)Buf1 = 0;
v25 = 0;
v26 = 15;
LOBYTE(Buf1[0]) = 0;
CCTextInputNode::setString((__int64)&a1[-1].m_pGrid, Buf1);
}
}
Buf2 = 0;
v28 = 0;
v29 = 15;
LOBYTE(Buf2) = 0;
v5 = (_BYTE *)(*(__int64 (__fastcall **)(__int64, cocos2d::CCTextFieldTTF *))(*(_QWORD *)(*(_QWORD *)&a1->m_sAdditionalTransform.ty
+ 600LL)
+ 8LL))(
*(_QWORD *)&a1->m_sAdditionalTransform.ty + 600LL,
a2);
*(_OWORD *)Buf1 = 0;
v25 = 0;
v26 = 0;
v6 = -1;
do
++v6;
while ( v5[v6] );
sub_14003A930(Buf1, v5, v6);
v7 = Buf1;
v8 = (char *)Buf1[0];
v9 = v26;
if ( v26 > 0xF )
v7 = (void **)Buf1[0];
v10 = v25;
if ( v25 )
v10 = 0;
LODWORD(v11) = memcmp(v7, &Buf2, v10);
if ( !(_DWORD)v11 )
v11 = v25 != 0;
if ( v9 > 0xF )
{
v12 = v8;
if ( v9 + 1 >= 0x1000 )
{
v8 = *((char **)v8 - 1);
if ( (unsigned __int64)(v12 - v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
if ( !(_DWORD)v11 )
{
v13 = *(_QWORD *)&a1->m_sTransform.ty;
if ( v13 )
{
(**(void (__fastcall ***)(__int64, const char *))(v13 + 360))(v13 + 360, " ");
}
else
{
v14 = *(_QWORD *)&a1->m_sInverse.d;
if ( v14 )
{
*(_OWORD *)Buf1 = 0;
v25 = 1;
v26 = 15;
LOWORD(Buf1[0]) = 32;
TextArea::setString(v14, Buf1);
}
}
CCTextInputNode::updateBlinkLabelToChar(
(CCTextInputNode *)((char *)a1 - 416),
*(_DWORD *)(*((_QWORD *)&a1[-1].m_pGrid + 69) + 760LL));
}
v15 = *(_QWORD *)&a1->m_sTransform.b;
if ( v15 )
(*(void (__fastcall **)(__int64, cocos2d::CCGridBase **))(*(_QWORD *)v15 + 8LL))(v15, &a1[-1].m_pGrid);
if ( BYTE2(a1->m_sInverse.b) )
{
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v16);
v17 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)&a1->m_sAdditionalTransform.ty
+ 280LL))(*(_QWORD *)&a1->m_sAdditionalTransform.ty);
v18 = (float *)cocos2d::CCPoint::CCPoint(&v23, v17);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)Buf1);
v19 = ((__int64 (__fastcall *)(cocos2d::CCGridBase **))a1[-1].m_pGrid[1].m_obStep)(&a1[-1].m_pGrid);
cocos2d::CCPoint::operator=(Buf1, v19);
v20 = ((__int64 (__fastcall *)(cocos2d::CCGridBase **))a1[-1].m_pGrid[2].m_sGridSize)(&a1[-1].m_pGrid);
cocos2d::CCSize::operator=(&Buf1[1], v20);
*(float *)Buf1 = *(float *)Buf1 - (float)(*(float *)&Buf1[1] * *v18);
*((float *)Buf1 + 1) = (float)(*((float *)Buf1 + 1) - (float)(*((float *)&Buf1[1] + 1) * v18[1])) - 4.0;
cocos2d::CCRect::getMinY((cocos2d::CCRect *)Buf1);
v21 = *(_QWORD *)&a1->m_sTransform.b;
if ( v21 )
(*(void (__fastcall **)(__int64, cocos2d::CCGridBase **))(*(_QWORD *)v21 + 24LL))(v21, &a1[-1].m_pGrid);
}
return 0;
}