//
// cocos2d::CCIMEDelegate::attachWithIME from 0x1004bbfa0 to 0x1004bc0c4 (292 bytes)
//
// 5 xrefs:
// > cocos2d::CCTextFieldTTF::attachWithIME @ 0x10027c2ed
// > sub_10027C320 @ 0x10027c326
// > ??> @ 0x1008b6d38
// > ??> @ 0x100947b18
// > ??> @ 0x10094cde0
//
// 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 cocos2d::CCIMEDelegate::attachWithIME(cocos2d::CCIMEDelegate *a1)
{
__int64 v2; // r14
__int64 v3; // rdi
__int64 v4; // rdi
_QWORD *v6; // rax
if ( !(_BYTE)byte_1009A1EE0 && __cxa_guard_acquire(&byte_1009A1EE0) )
{
v6 = operator new(0x20u);
*v6 = v6;
v6[1] = v6;
v6[2] = 0;
qword_1009A1ED8 = (__int64)v6;
v6[3] = 0;
__cxa_atexit(func, &qword_1009A1ED8, (void *)&_mh_execute_header);
__cxa_guard_release(&byte_1009A1EE0);
}
if ( qword_1009A1ED8 != 0 && a1 != nullptr )
{
v2 = qword_1009A1ED8;
do
{
v2 = *(_QWORD *)(v2 + 8);
if ( v2 == qword_1009A1ED8 )
return 0;
}
while ( *(cocos2d::CCIMEDelegate **)(v2 + 16) != a1 );
v3 = *(_QWORD *)(qword_1009A1ED8 + 24);
if ( !v3 )
{
if ( !((unsigned __int8 (__fastcall *)(cocos2d::CCIMEDelegate *))a1->canAttachWithIME)(a1) )
return 0;
goto LABEL_11;
}
if ( (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v3 + 48LL))(v3)
&& ((unsigned __int8 (__fastcall *)(cocos2d::CCIMEDelegate *))a1->canAttachWithIME)(a1) )
{
v4 = *(_QWORD *)(qword_1009A1ED8 + 24);
*(_QWORD *)(qword_1009A1ED8 + 24) = 0;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v4 + 56LL))(v4);
LABEL_11:
*(_QWORD *)(qword_1009A1ED8 + 24) = *(_QWORD *)(v2 + 16);
((void (__fastcall *)(cocos2d::CCIMEDelegate *))a1->didAttachWithIME)(a1);
return 1;
}
}
return 0;
}