//
// cocos2d::CCIMEDispatcher::attachDelegateWithIME from 0xb2f6a8 to 0xb2f7b0 (264 bytes)
//
// 2 xrefs:
// > cocos2d::CCIMEDelegate::attachWithIME @ 0xb2fc44
// > ??> @ 0xbc898
//
// 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 cocos2d::CCIMEDispatcher::attachDelegateWithIME(cocos2d::CCIMEDispatcher *a1, cocos2d::CCIMEDelegate *a2)
{
cocos2d::CCIMEDispatcher::Impl *m_pImpl; // x3
cocos2d::CCIMEDelegate **v3; // x19
__int64 v5; // x0
__int64 v8; // x1
cocos2d::CCIMEDispatcher::Impl *v9; // x2
cocos2d::CCIMEDelegate *v10; // x0
cocos2d::CCIMEDelegate *v11; // x3
cocos2d::CCIMEDelegate_vtbl *v12; // x1
m_pImpl = a1->m_pImpl;
if ( !a2 )
return 0;
if ( !m_pImpl )
return 0;
v3 = *(cocos2d::CCIMEDelegate ***)m_pImpl;
if ( m_pImpl == *(cocos2d::CCIMEDispatcher::Impl **)m_pImpl )
return 0;
while ( a2 != v3[2] )
{
v3 = (cocos2d::CCIMEDelegate **)*v3;
if ( m_pImpl == (cocos2d::CCIMEDispatcher::Impl *)v3 )
return 0;
}
v5 = *((_QWORD *)m_pImpl + 2);
if ( !v5 )
{
if ( a2->canAttachWithIME(a2) )
{
v9 = a1->m_pImpl;
v10 = a2;
v11 = v3[2];
goto LABEL_12;
}
return 0;
}
if ( !(*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v5 + 48LL))(v5) || !a2->canAttachWithIME(a2) )
return 0;
v8 = *((_QWORD *)a1->m_pImpl + 2);
*((_QWORD *)a1->m_pImpl + 2) = 0;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v8 + 56LL))(v8);
v9 = a1->m_pImpl;
v10 = a2;
v11 = v3[2];
LABEL_12:
v12 = a2->__vftable;
*((_QWORD *)v9 + 2) = v11;
v12->didAttachWithIME(v10);
return 1;
}