//
// CCTextInputMenu::init from 0x3dbb64 to 0x3dc05c (1272 bytes)
//
// 1 xrefs:
// > CCTextInputMenu::create @ 0x3dc0e8
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:46:48 +0000
//
cocos2d::CCMenu *__fastcall CCTextInputMenu::init(cocos2d::CCLayer *a1, CCTextInputNode *a2, float *a3)
{
cocos2d::CCMenu *v5; // r0
cocos2d::CCMenu *v6; // r4
cocos2d::CCDirector *v7; // r0
void (__fastcall *v8)(cocos2d::CCMenu *, int); // r6
int v9; // r0
int v10; // r0
void (__fastcall *v11)(cocos2d::CCMenu *, int); // r6
int v12; // r0
int v13; // r6
void (__fastcall *v14)(cocos2d::CCMenu *, int); // r6
int v15; // r0
void (__fastcall *v16)(cocos2d::CCMenu *, int); // r6
int v17; // r0
float v18; // s16
int v19; // r6
int *v20; // r7
int v21; // t1
float v22; // s19
float v23; // s19
float v24; // s17
float v25; // s20
float v26; // s15
int v27; // r0
float v28; // s17
float v29; // s20
int v30; // r11
int v31; // r11
int v32; // r6
void (__fastcall *v33)(int, _BYTE *); // r10
cocos2d::CCDirector *v34; // r0
float v35; // r8
float v36; // r0
float v37; // s19
float v38; // s17
float v39; // s19
float v40; // s17
float v41; // s19
float v42; // s17
float v43; // s15
float v44; // s13
int v46; // r10
cocos2d::CCMenu *v47; // [sp+Ch] [bp-70h]
unsigned int v48; // [sp+10h] [bp-6Ch]
void (__fastcall *v50)(int, _BYTE *); // [sp+1Ch] [bp-60h]
float v51[2]; // [sp+20h] [bp-5Ch] BYREF
float v52; // [sp+28h] [bp-54h] BYREF
float v53; // [sp+2Ch] [bp-50h]
int (__fastcall *v54)(CCTextInputMenu *, cocos2d::CCObject *); // [sp+30h] [bp-4Ch]
int v55; // [sp+34h] [bp-48h]
int (__fastcall *v56)(CCTextInputMenu *, cocos2d::CCObject *); // [sp+38h] [bp-44h]
int v57; // [sp+3Ch] [bp-40h]
int (__fastcall *v58)(CCTextInputMenu *, cocos2d::CCObject *); // [sp+40h] [bp-3Ch]
int v59; // [sp+44h] [bp-38h]
char v60[4]; // [sp+48h] [bp-34h] BYREF
int v61; // [sp+4Ch] [bp-30h]
void *v62; // [sp+50h] [bp-2Ch]
_BYTE v63[8]; // [sp+54h] [bp-28h] BYREF
float v64; // [sp+5Ch] [bp-20h]
_BYTE v65[16]; // [sp+64h] [bp-18h] BYREF
v5 = (cocos2d::CCMenu *)cocos2d::CCLayer::init(a1);
v47 = v5;
if ( !v5 )
return nullptr;
*((_DWORD *)a1 + 79) = a2;
v6 = (cocos2d::CCMenu *)cocos2d::CCMenu::create(v5);
v7 = (cocos2d::CCDirector *)(*(int (__fastcall **)(cocos2d::CCMenu *, void *))(*(_DWORD *)v6 + 92))(v6, &unk_D2B328);
v8 = *(void (__fastcall **)(cocos2d::CCMenu *, int))(*(_DWORD *)v6 + 512);
v9 = cocos2d::CCDirector::sharedDirector(v7);
v10 = (*(int (__fastcall **)(int))(*(_DWORD *)v9 + 80))(v9);
v8(v6, *(_DWORD *)(v10 + 100) - 2);
if ( CCTextInputNode::canCopyText(a2) )
{
v11 = *(void (__fastcall **)(cocos2d::CCMenu *, int))(*(_DWORD *)v6 + 228);
v54 = CCTextInputMenu::onCopy;
v55 = 0;
v12 = sub_3DBB18((int)a1, (cocos2d::CCLabelBMFont *)"Copy", (const char *)CCTextInputMenu::onCopy, 0);
v11(v6, v12);
}
PlatformToolbox::getClipboardString((PlatformToolbox *)v60);
if ( (v60[0] & 1) != 0 )
{
v13 = v61;
operator delete(v62);
}
else
{
v13 = (int)(unsigned __int8)v60[0] >> 1;
}
if ( v13 )
{
v14 = *(void (__fastcall **)(cocos2d::CCMenu *, int))(*(_DWORD *)v6 + 228);
v56 = CCTextInputMenu::onPaste;
v57 = 0;
v15 = sub_3DBB18((int)a1, (cocos2d::CCLabelBMFont *)"Paste", (const char *)CCTextInputMenu::onPaste, 0);
v14(v6, v15);
}
if ( CCTextInputNode::canClearText(a2) )
{
v16 = *(void (__fastcall **)(cocos2d::CCMenu *, int))(*(_DWORD *)v6 + 228);
v58 = CCTextInputMenu::onClear;
v59 = 0;
v17 = sub_3DBB18((int)a1, (cocos2d::CCLabelBMFont *)"Clear", (const char *)CCTextInputMenu::onClear, 0);
v16(v6, v17);
}
if ( !(*(int (__fastcall **)(cocos2d::CCMenu *))(*(_DWORD *)v6 + 248))(v6) )
return nullptr;
cocos2d::CCMenu::alignItemsHorizontallyWithPadding(v6, 20.0);
v18 = (float)(unsigned int)(*(int (__fastcall **)(cocos2d::CCMenu *))(*(_DWORD *)v6 + 248))(v6) * 20.0;
if ( (*(int (__fastcall **)(cocos2d::CCMenu *))(*(_DWORD *)v6 + 244))(v6)
&& **(_DWORD **)((*(int (__fastcall **)(cocos2d::CCMenu *))(*(_DWORD *)v6 + 244))(v6) + 52) )
{
v31 = 0;
v20 = *(int **)(*(_DWORD *)((*(int (__fastcall **)(cocos2d::CCMenu *))(*(_DWORD *)v6 + 244))(v6) + 52) + 12);
v46 = *(_DWORD *)(*(_DWORD *)((*(int (__fastcall **)(cocos2d::CCMenu *))(*(_DWORD *)v6 + 244))(v6) + 52) + 12);
v48 = v46
+ 4 * (**(_DWORD **)((*(int (__fastcall **)(cocos2d::CCMenu *))(*(_DWORD *)v6 + 244))(v6) + 52) + 0x3FFFFFFF);
while ( (unsigned int)v20 <= v48 )
{
v21 = *v20++;
v19 = v21;
if ( !v21 )
break;
v22 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v19 + 164))(v19);
v23 = v22 * (*(float (__fastcall **)(int))(*(_DWORD *)v19 + 68))(v19);
v18 = v18 + v23;
if ( v31 )
{
v24 = COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)v31 + 112))(v31));
v25 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v31 + 164))(v31);
v26 = COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)v31 + 68))(v31));
*(float *)&v27 = COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)v19 + 112))(v19));
v65[0] = -1;
v65[3] = 60;
v65[1] = -1;
v65[2] = -1;
v28 = v24 + (float)((float)(v25 * v26) * 0.5);
v29 = *(float *)&v27;
v30 = cocos2d::CCLayerColor::create(v65, 1065353216, 1096810496);
v50 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v30 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v65,
(float)((float)((float)(v28 + v29) - (float)(v23 * 0.5)) * 0.5) - 0.5,
-7.0);
v50(v30, v65);
(*(void (__fastcall **)(cocos2d::CCLayer *, int))(*(_DWORD *)a1 + 228))(a1, v30);
}
v31 = v19;
}
}
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v65, 0.0, 0.0, 40.0, 40.0);
v32 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v65);
v33 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v32 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v65, v18 + v18, 44.0);
v33(v32, v65);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v32 + 80))(v32, 1056964608);
(*(void (__fastcall **)(int, void *))(*(_DWORD *)v32 + 480))(v32, &unk_BEAF84);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v32 + 456))(v32, 170);
(*(void (__fastcall **)(int, void *))(*(_DWORD *)v32 + 92))(v32, &unk_D2B328);
(*(void (__fastcall **)(cocos2d::CCLayer *, int, int))(*(_DWORD *)a1 + 232))(a1, v32, -1);
v34 = (cocos2d::CCDirector *)(*(int (__fastcall **)(cocos2d::CCLayer *, cocos2d::CCMenu *))(*(_DWORD *)a1 + 228))(
a1,
v6);
cocos2d::CCDirector::sharedDirector(v34);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v51);
CCTextInputNode::getBoxRect((CCTextInputNode *)v63);
v35 = *a3;
v36 = COERCE_FLOAT(cocos2d::CCRect::getMaxY((cocos2d::CCRect *)v63));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v35, (float)(v36 + 5.0) + 11.0);
if ( v64 < v18 )
{
v52 = COERCE_FLOAT(cocos2d::CCRect::getMidX((cocos2d::CCRect *)v63));
}
else
{
v37 = v52;
v38 = v18 * 0.5;
if ( v37 >= (float)(COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)v63)) + (float)(v18 * 0.5)) )
v39 = v52;
else
v39 = COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)v63)) + v38;
if ( v39 <= (float)(COERCE_FLOAT(cocos2d::CCRect::getMaxX((cocos2d::CCRect *)v63)) - v38) )
{
v41 = v52;
if ( v41 >= (float)(COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)v63)) + v38) )
v40 = v52;
else
v40 = COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)v63)) + v38;
}
else
{
v40 = COERCE_FLOAT(cocos2d::CCRect::getMaxX((cocos2d::CCRect *)v63)) - v38;
}
v52 = v40;
}
v42 = v18 * 0.5;
v43 = v51[0] - (float)(v18 * 0.5);
if ( v52 < (float)(v18 * 0.5) )
v44 = v18 * 0.5;
else
v44 = v52;
if ( v44 <= v43 )
{
if ( v52 < v42 )
v43 = v18 * 0.5;
else
v43 = v52;
}
v52 = v43;
if ( (float)(v53 + 11.0) > v51[1] )
v53 = (float)(COERCE_FLOAT(cocos2d::CCRect::getMinY((cocos2d::CCRect *)v63)) - 5.0) - 11.0;
(*(void (__fastcall **)(cocos2d::CCLayer *, float *))(*(_DWORD *)a1 + 92))(a1, &v52);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v65, v52 - v42, v53 - 11.0, v18, 22.0);
cocos2d::CCRect::operator=((char *)a1 + 320, v65);
(*(void (__fastcall **)(cocos2d::CCLayer *, int))(*(_DWORD *)a1 + 500))(a1, 1);
(*(void (__fastcall **)(cocos2d::CCLayer *, int))(*(_DWORD *)a1 + 552))(a1, 1);
return v47;
}