//
// CCTextInputMenu::init from 0x6b6d70 to 0x6b73fc (1676 bytes)
//
// 2 xrefs:
// > CCTextInputMenu::create @ 0x6b74b0
// > ??> @ 0x846d0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:50:53 +0000
//
__int64 __fastcall CCTextInputMenu::init(cocos2d::CCLayer *a1, CCTextInputNode *a2, float *a3)
{
cocos2d::CCMenu *v5; // x0
unsigned int v6; // w22
cocos2d::CCDirector **v8; // x20
void (__fastcall *v9)(cocos2d::CCDirector **, _QWORD); // x23
__int64 v10; // x0
__int64 v11; // x0
float v12; // s11
__int64 **v13; // x27
__int64 v14; // x28
__int64 *v15; // x28
float v16; // s8
__int64 *v17; // x26
float v18; // s10
float v19; // s10
float v20; // s8
float *v21; // x0
__int64 v22; // x3
float v23; // s9
__int64 *v24; // x0
float v25; // s8
float v26; // s0
float v27; // s8
__int64 v28; // x26
__int64 v29; // x23
void (__fastcall *v30)(cocos2d::CCDirector **, __int64); // x23
__int64 v31; // x0
void (__fastcall *v32)(cocos2d::CCDirector **, __int64); // x23
__int64 v33; // x0
__int64 v34; // x27
cocos2d::CCDirector *v35; // x0
cocos2d::CCDirector *v36; // x0
float v37; // s9
float v38; // s0
float v39; // s9
float v40; // s8
float v41; // s0
float v42; // s9
float v43; // s0
float v44; // s9
float v45; // s0
float v46; // s0
void (__fastcall *v47)(cocos2d::CCDirector **, __int64); // x23
__int64 v48; // x0
float v49; // s2
float v50; // s1
float v51; // s0
float v52; // s0
float v53; // s0
float v54; // s0
unsigned __int64 v55; // [xsp+98h] [xbp+98h]
void (__fastcall *v56)(__int64, _BYTE *); // [xsp+A0h] [xbp+A0h]
void (__fastcall *v57)(__int64, _BYTE *); // [xsp+A0h] [xbp+A0h]
__int64 v59; // [xsp+B0h] [xbp+B0h] BYREF
float v60; // [xsp+B8h] [xbp+B8h] BYREF
float v61; // [xsp+BCh] [xbp+BCh]
__int64 v62; // [xsp+C0h] [xbp+C0h] BYREF
float v63; // [xsp+C8h] [xbp+C8h]
_BYTE v64[16]; // [xsp+D0h] [xbp+D0h] BYREF
_BYTE v65[8]; // [xsp+E0h] [xbp+E0h] BYREF
__int64 v66; // [xsp+E8h] [xbp+E8h]
void *v67; // [xsp+F0h] [xbp+F0h]
v5 = (cocos2d::CCMenu *)cocos2d::CCLayer::init(a1);
v6 = (unsigned __int8)v5;
if ( !(_BYTE)v5 )
return 0;
*((_QWORD *)a1 + 51) = a2;
v8 = (cocos2d::CCDirector **)cocos2d::CCMenu::create(v5);
(*((void (__fastcall **)(cocos2d::CCDirector **, void *))*v8 + 23))(v8, &unk_155C0B0);
v9 = *((void (__fastcall **)(cocos2d::CCDirector **, _QWORD))*v8 + 128);
v10 = cocos2d::CCDirector::sharedDirector(*v8);
v11 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 160LL))(v10);
v9(v8, (unsigned int)(*(_DWORD *)(v11 + 128) - 2));
if ( (unsigned __int8)CCTextInputNode::canCopyText(a2) )
{
v47 = *((void (__fastcall **)(cocos2d::CCDirector **, __int64))*v8 + 57);
v48 = sub_6B6CF8((__int64)a1, (cocos2d::CCLabelBMFont *)"Copy", (const char *)CCTextInputMenu::onCopy, 0);
v47(v8, v48);
}
PlatformToolbox::getClipboardString((__int64)v65);
if ( (v65[0] & 1) == 0 )
{
if ( !(v65[0] >> 1) )
goto LABEL_8;
LABEL_20:
v30 = *((void (__fastcall **)(cocos2d::CCDirector **, __int64))*v8 + 57);
v31 = sub_6B6CF8((__int64)a1, (cocos2d::CCLabelBMFont *)"Paste", (const char *)CCTextInputMenu::onPaste, 0);
v30(v8, v31);
if ( !(unsigned __int8)CCTextInputNode::canClearText(a2) )
goto LABEL_9;
goto LABEL_21;
}
v29 = v66;
operator delete(v67);
if ( v29 )
goto LABEL_20;
LABEL_8:
if ( !(unsigned __int8)CCTextInputNode::canClearText(a2) )
goto LABEL_9;
LABEL_21:
v32 = *((void (__fastcall **)(cocos2d::CCDirector **, __int64))*v8 + 57);
v33 = sub_6B6CF8((__int64)a1, (cocos2d::CCLabelBMFont *)"Clear", (const char *)CCTextInputMenu::onClear, 0);
v32(v8, v33);
LABEL_9:
if ( !(*((unsigned int (__fastcall **)(cocos2d::CCDirector **))*v8 + 62))(v8) )
return 0;
cocos2d::CCMenu::alignItemsHorizontallyWithPadding((cocos2d::CCMenu *)v8, 20.0);
v12 = (float)(*((unsigned int (__fastcall **)(cocos2d::CCDirector **))*v8 + 62))(v8) * 20.0;
if ( (*((__int64 (__fastcall **)(cocos2d::CCDirector **))*v8 + 61))(v8) )
{
if ( **(_DWORD **)((*((__int64 (__fastcall **)(cocos2d::CCDirector **))*v8 + 61))(v8) + 56) )
{
v13 = *(__int64 ***)(*(_QWORD *)((*((__int64 (__fastcall **)(cocos2d::CCDirector **))*v8 + 61))(v8) + 56) + 16LL);
v14 = *(_QWORD *)(*(_QWORD *)((*((__int64 (__fastcall **)(cocos2d::CCDirector **))*v8 + 61))(v8) + 56) + 16LL);
v55 = v14 + 8LL * **(unsigned int **)((*((__int64 (__fastcall **)(cocos2d::CCDirector **))*v8 + 61))(v8) + 56) - 8;
if ( (unsigned __int64)v13 <= v55 )
{
v15 = *v13;
if ( *v13 )
{
v16 = *(float *)(*(__int64 (__fastcall **)(__int64 *))(*v15 + 328))(*v13);
v12 = v12 + (float)(v16 * (*(float (__fastcall **)(__int64 *))(*v15 + 136))(v15));
while ( v55 >= (unsigned __int64)++v13 )
{
v17 = *v13;
if ( !*v13 )
break;
v18 = *(float *)(*(__int64 (__fastcall **)(__int64 *))(*v17 + 328))(*v13);
v19 = v18 * (*(float (__fastcall **)(__int64 *))(*v17 + 136))(v17);
v12 = v12 + v19;
v20 = (*(float (__fastcall **)(__int64 *))(*v15 + 224))(v15);
v21 = (float *)(*(__int64 (__fastcall **)(__int64 *))(*v15 + 328))(v15);
v22 = *v15;
v23 = *v21;
v24 = v15;
v15 = v17;
v25 = v20 + (float)((float)(v23 * (*(float (__fastcall **)(__int64 *))(v22 + 136))(v24)) * 0.5);
v26 = (*(float (__fastcall **)(__int64 *))(*v17 + 224))(v17);
v64[0] = -1;
v27 = v25 + v26;
v64[3] = 60;
v64[1] = -1;
v64[2] = -1;
v28 = cocos2d::CCLayerColor::create(v64, 1.0, 14.0);
v56 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v28 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v64,
(float)((float)(v27 - (float)(v19 * 0.5)) * 0.5) + -0.5,
-7.0);
v56(v28, v64);
(*(void (__fastcall **)(cocos2d::CCLayer *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v28);
}
}
}
}
}
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v64, 0.0, 0.0, 40.0, 40.0);
v34 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v64);
v57 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v34 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v64, v12 + v12, 44.0);
v57(v34, v64);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v34 + 160LL))(v34, 0.5);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v34 + 960LL))(v34, &unk_111CC80);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v34 + 912LL))(v34, 4294967210LL);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v34 + 184LL))(v34, &unk_155C0B0);
(*(void (__fastcall **)(cocos2d::CCLayer *, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v34, 0xFFFFFFFFLL);
v35 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(cocos2d::CCLayer *, cocos2d::CCDirector **))(*(_QWORD *)a1 + 456LL))(
a1,
v8);
v36 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v35);
cocos2d::CCDirector::getWinSize(&v59, v36);
CCTextInputNode::getBoxRect(&v62, a2);
v37 = *a3;
cocos2d::CCRect::getMaxY((cocos2d::CCRect *)&v62);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v60, v37, (float)(v38 + 5.0) + 11.0);
if ( v12 > v63 )
{
cocos2d::CCRect::getMidX((cocos2d::CCRect *)&v62);
v40 = v12 * 0.5;
}
else
{
v39 = v60;
cocos2d::CCRect::getMinX((cocos2d::CCRect *)&v62);
v40 = v12 * 0.5;
if ( v39 < (float)(v41 + (float)(v12 * 0.5)) )
{
cocos2d::CCRect::getMinX((cocos2d::CCRect *)&v62);
v42 = v40 + v53;
}
else
{
v42 = v60;
}
cocos2d::CCRect::getMaxX((cocos2d::CCRect *)&v62);
if ( v42 > (float)(v43 - v40) )
{
cocos2d::CCRect::getMaxX((cocos2d::CCRect *)&v62);
v46 = v51 - v40;
}
else
{
v44 = v60;
cocos2d::CCRect::getMinX((cocos2d::CCRect *)&v62);
if ( v44 < (float)(v40 + v45) )
{
cocos2d::CCRect::getMinX((cocos2d::CCRect *)&v62);
v46 = v40 + v54;
}
else
{
v46 = v60;
}
}
}
v49 = v40;
if ( v40 <= v46 )
v49 = v46;
v50 = *(float *)&v59 - v40;
if ( v49 <= (float)(*(float *)&v59 - v40) )
{
v50 = v40;
if ( v40 <= v46 )
v50 = v46;
}
v60 = v50;
if ( (float)(v61 + 11.0) > *((float *)&v59 + 1) )
{
cocos2d::CCRect::getMinY((cocos2d::CCRect *)&v62);
v61 = (float)(v52 - 5.0) - 11.0;
}
(*(void (__fastcall **)(cocos2d::CCLayer *, float *))(*(_QWORD *)a1 + 184LL))(a1, &v60);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v64, v60 - v40, v61 - 11.0, v12, 22.0);
cocos2d::CCRect::operator=((char *)a1 + 416, v64);
(*(void (__fastcall **)(cocos2d::CCLayer *, __int64))(*(_QWORD *)a1 + 1000LL))(a1, 1);
(*(void (__fastcall **)(cocos2d::CCLayer *, __int64))(*(_QWORD *)a1 + 1104LL))(a1, 1);
return v6;
}