//
// CCTextInputNode::onTextFieldAttachWithIME from 0x2fb010 to 0x2fb1a2 (402 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'CCTextInputNode::onTextFieldAttachWithIME @ 0x2fb1bc
//
// 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 CCTextInputNode::onTextFieldAttachWithIME(CCTextInputNode *a1, cocos2d::CCTextFieldTTF *a2)
{
cocos2d::CCLabelBMFont *m_cursor; // r0
const char *v4; // r0
char *v5; // r2
char *v6; // r0
int v7; // r9
cocos2d::CCLabelBMFont *m_textLabel; // r0
TextArea *m_textArea; // r9
TextInputDelegate *m_delegate; // r0
cocos2d::CCDirector *v11; // r0
const cocos2d::CCPoint *v12; // r0
float height; // s16
float v14; // s15
TextInputDelegate *v15; // r0
cocos2d::CCSize v17; // [sp+4h] [bp-28h] BYREF
cocos2d::CCPoint v18; // [sp+Ch] [bp-20h] BYREF
cocos2d::CCRect v19; // [sp+14h] [bp-18h] BYREF
m_cursor = a1->m_cursor;
if ( m_cursor )
m_cursor->setVisible(m_cursor, 1);
a1->m_selected = (unsigned __int8)&dword_0 + 1;
PlatformToolbox::setKeyboardState((bool)&dword_0 + 1);
if ( a1->m_numberInput )
{
v4 = (const char *)a1->m_textField->getString(a1->m_textField);
if ( atof(v4) == 0.0 )
{
sub_776584((int)&v19, (char *)&unk_939830);
CCTextInputNode::setString((int)a1, (char *)&v19, v5);
sub_774008(&v19);
}
}
v6 = (char *)a1->m_textField->getString(a1->m_textField);
sub_776584((int)&v18, v6);
sub_776584((int)&v19, (char *)&unk_939830);
v7 = sub_774DBC(&v18, &v19);
sub_774008(&v19);
sub_774008(&v18);
if ( !v7 )
{
m_textLabel = a1->m_textLabel;
if ( m_textLabel )
{
m_textLabel->setString(m_textLabel, " ");
}
else
{
m_textArea = a1->m_textArea;
if ( m_textArea )
{
sub_776584((int)&v19, " ");
TextArea::setString((int)m_textArea, &v19);
sub_774008(&v19);
}
}
CCTextInputNode::updateBlinkLabel(a1);
}
m_delegate = a1->m_delegate;
if ( m_delegate )
m_delegate->textInputOpened(m_delegate, a1);
if ( a1->m_forceOffset )
{
v11 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v17, v11);
v12 = a1->m_textField->getAnchorPoint(a1->m_textField);
cocos2d::CCPoint::CCPoint(&v18, v12);
sub_2F62CC(&v19, (int)a1, &v18.x);
height = v17.height;
v19.origin.y = v19.origin.y - 4.0;
v14 = COERCE_FLOAT(cocos2d::CCRect::getMinY(&v19));
v15 = a1->m_delegate;
if ( v15 )
((void (__fastcall *)(TextInputDelegate *, CCTextInputNode *, _DWORD))v15->textInputShouldOffset)(
v15,
a1,
(float)(height * 0.5) - v14);
}
return 0;
}