//
// EmotePickerPopup::init from 0x779134 to 0x77935a (550 bytes)
//
// 2 xrefs:
// > EmotePickerPopup::create @ 0x7793c0
// > EmotePickerPopup::createPicker @ 0x7794a2
//
// 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:59:22 +0000
//
cocos2d::CCDirector *__fastcall EmotePickerPopup::init(int a1, int a2, float *a3, int a4, int a5)
{
GameManager *WinSize; // r0
float v8; // s17
float v9; // s16
int v10; // r0
_DWORD *v11; // r3
int v12; // r0
_DWORD *v13; // r2
_DWORD *v14; // r1
_BOOL4 v15; // r5
int v16; // r3
cocos2d::CCDirector *inited; // r0
int v18; // r1
int v19; // r2
cocos2d::CCDirector *v20; // r8
cocos2d::CCDirector *v21; // r0
float v22; // r0
float v23; // s16
cocos2d::CCDirector *v24; // r0
float v25; // r0
int v26; // r0
float v27; // s15
float v28; // s12
float v29; // s14
bool v30; // nf
float v31; // s15
float v32; // s14
float v33; // s15
int v34; // r3
char v36[4]; // [sp+Ch] [bp-20h] BYREF
float v37; // [sp+10h] [bp-1Ch]
_BYTE v38[8]; // [sp+14h] [bp-18h] BYREF
_BYTE v39[8]; // [sp+1Ch] [bp-10h] BYREF
*(_DWORD *)(a1 + 844) = a4;
*(_DWORD *)(a1 + 840) = a2;
*(_DWORD *)(a1 + 848) = a5;
cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)a1);
WinSize = (GameManager *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v36);
v8 = *(float *)&CCTextInputNode::s_keyboardTop;
if ( *(float *)&CCTextInputNode::s_keyboardTop <= 0.0 )
{
v9 = 94.0;
}
else
{
v9 = (float)(v37 - *(float *)&CCTextInputNode::s_keyboardTop) - 24.0;
if ( v9 >= 94.0 )
v9 = 94.0;
if ( *(float *)&CCTextInputNode::s_keyboardTop > 0.0 )
{
v15 = 0;
EditorWindowPopup::setWindowSizeBounds((EditorWindowPopup *)a1, 112.0, 64.0, 340.0, 300.0);
*(_BYTE *)(a1 + 836) = 1;
v16 = 0;
goto LABEL_20;
}
}
v10 = GameManager::sharedState(WinSize);
v11 = *(_DWORD **)(v10 + 896);
v12 = v10 + 896;
v13 = (_DWORD *)v12;
while ( v11 )
{
if ( (int)v11[4] > 1 )
{
v14 = (_DWORD *)*v11;
}
else
{
v14 = (_DWORD *)v11[1];
v11 = v13;
}
v13 = v11;
v11 = v14;
}
v15 = v13 != (_DWORD *)v12 && (int)v13[4] <= 2 && v13[11] == 1;
EditorWindowPopup::setWindowSizeBounds((EditorWindowPopup *)a1, 112.0, 64.0, 340.0, 300.0);
*(_BYTE *)(a1 + 836) = 1;
if ( v8 <= 0.0 )
v16 = 2;
else
v16 = 0;
LABEL_20:
inited = (cocos2d::CCDirector *)EditorWindowPopup::initWindow((EditorWindowPopup *)a1, nullptr, 224.0, v9, v16, 1);
v20 = inited;
if ( !inited )
return v20;
if ( v8 <= 0.0 )
{
if ( v15 )
goto LABEL_32;
v27 = a3[1];
v28 = *(float *)(a1 + 740);
v29 = *(float *)(a1 + 736);
v30 = v27 < (float)(v37 * 0.5);
if ( v27 >= (float)(v37 * 0.5) )
{
v32 = v29 * v28;
v31 = v27 - 14.0;
}
else
{
v31 = v27 + 14.0;
v32 = v29 * v28;
}
if ( v30 )
v33 = v31 + (float)(v32 * 0.5);
else
v33 = v31 - (float)(v32 * 0.5);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, *a3, v33);
EditorWindowPopup::clampWindowOnScreen(v39, a1, v38);
v26 = a1;
}
else
{
v21 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(inited);
v22 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v21));
v23 = (float)(v22 - 10.0) - (float)((float)(*(float *)(a1 + 732) * *(float *)(a1 + 740)) * 0.5);
v24 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v22));
v25 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v24));
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v38,
v23,
(float)(v25 - 6.0) - (float)((float)(*(float *)(a1 + 736) * *(float *)(a1 + 740)) * 0.5));
EditorWindowPopup::clampWindowOnScreen(v39, a1, v38);
v26 = a1;
}
EditorWindowPopup::moveWindowTo(v26, v39);
LABEL_32:
*(_BYTE *)(a1 + 469) = 1;
EmotePickerPopup::refreshEnabled(a1, v18, v19);
v34 = *(_DWORD *)(a1 + 840);
if ( v34 )
*(_DWORD *)(v34 + 368) = a1 + 440;
return v20;
}