//
// CCTextInputNode::onTextFieldAttachWithIME from 0x10016db84 to 0x10016dd98 (532 bytes)
//
// 2 xrefs:
// > sub_10016DDDC @ 0x10016dde8
// > ??> @ 0x10079fa88
//
// 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
//
bool __fastcall CCTextInputNode::onTextFieldAttachWithIME(CCTextInputNode *a1, cocos2d::CCTextFieldTTF *a2)
{
cocos2d::CCLabelBMFont *m_cursor; // x0
const char *v4; // x0
char *v5; // x0
_BOOL4 v6; // w20
cocos2d::CCLabelBMFont *m_textLabel; // x0
TextInputDelegate *m_delegate; // x0
cocos2d::CCDirector *v9; // x0
__int64 *v10; // x0
float v11; // s8
float v12; // s0
TextInputDelegate *v13; // x0
TextArea *m_textArea; // x20
float32x2_t v16; // [xsp+8h] [xbp-88h] BYREF
void *v17[2]; // [xsp+10h] [xbp-80h] BYREF
char v18; // [xsp+27h] [xbp-69h]
void *__p[2]; // [xsp+28h] [xbp-68h] BYREF
char v20; // [xsp+3Fh] [xbp-51h]
void *v21[2]; // [xsp+40h] [xbp-50h] BYREF
char v22; // [xsp+57h] [xbp-39h]
__int64 *v23[2]; // [xsp+58h] [xbp-38h] BYREF
char v24; // [xsp+6Fh] [xbp-21h]
cocos2d::CCSize WinSize; // 0:kr00_8.8
m_cursor = a1->m_cursor;
if ( m_cursor )
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))m_cursor->setVisible)(m_cursor, 1);
a1->m_selected = 1;
PlatformToolbox::setKeyboardState(1);
if ( a1->m_numberInput )
{
v4 = (const char *)((__int64 (__fastcall *)(cocos2d::CCTextFieldTTF *))a1->m_textField->getString)(a1->m_textField);
if ( atof(v4) == 0.0 )
{
sub_100009900(v23, "");
CCTextInputNode::setString(a1, v23);
if ( v24 < 0 )
operator delete(v23[0]);
}
}
v5 = (char *)((__int64 (__fastcall *)(cocos2d::CCTextFieldTTF *))a1->m_textField->getString)(a1->m_textField);
sub_100009900(v21, v5);
sub_100009900(__p, "");
v6 = sub_1000045BC(v21, __p);
if ( v20 < 0 )
operator delete(__p[0]);
if ( v22 < 0 )
{
operator delete(v21[0]);
if ( !v6 )
goto LABEL_16;
}
else if ( !v6 )
{
goto LABEL_16;
}
m_textLabel = a1->m_textLabel;
if ( m_textLabel )
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))m_textLabel->setString)(m_textLabel, " ");
}
else
{
m_textArea = a1->m_textArea;
if ( m_textArea )
{
sub_100009900(v17, " ");
TextArea::setString((__int64)m_textArea, (const void **)v17);
if ( v18 < 0 )
operator delete(v17[0]);
}
}
CCTextInputNode::updateBlinkLabelToChar(a1, a1->m_textField->m_uCursorPos);
LABEL_16:
m_delegate = a1->m_delegate;
if ( m_delegate )
((void (__fastcall *)(TextInputDelegate *, CCTextInputNode *))m_delegate->textInputOpened)(m_delegate, a1);
if ( a1->m_forceOffset )
{
v9 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v9);
v10 = (__int64 *)((__int64 (__fastcall *)(cocos2d::CCTextFieldTTF *, float, float))a1->m_textField->getAnchorPoint)(
a1->m_textField,
WinSize.width,
WinSize.height);
sub_1000229B8((__int64 *)&v16, v10);
sub_10016D5C8((__int64)a1, &v16, (float32x2_t *)v21);
*((float *)v21 + 1) = *((float *)v21 + 1) + -4.0;
v11 = *((float *)__p + 1);
v12 = sub_100022C58((__int64)v21);
v13 = a1->m_delegate;
if ( v13 )
((void (__fastcall *)(TextInputDelegate *, CCTextInputNode *, float))v13->textInputShouldOffset)(
v13,
a1,
(float)(v11 * 0.5) - v12);
}
return 0;
}