//
// EditorWindowPopup::clampWindowOnScreen from 0xcd99d0 to 0xcd9b04 (308 bytes)
//
// 2 xrefs:
// > EmotePickerPopup::init @ 0xcb9830
// > ??> @ 0x4ae48
//
// 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 13:06:32 +0000
//
cocos2d::CCPoint *__usercall EditorWindowPopup::clampWindowOnScreen@(
__int64 a1@,
float *a2@,
cocos2d::CCPoint *a3@)
{
__int64 v4; // x2
float v5; // s8
float v6; // s10
float v7; // s9
float v8; // s8
cocos2d::CCDirector *v9; // x0
cocos2d::CCDirector *ScreenLeft; // x0
float v11; // s0
float v12; // s11
cocos2d::CCDirector *v13; // x0
cocos2d::CCDirector *ScreenRight; // x0
float v15; // s0
float v16; // s10
cocos2d::CCDirector *v17; // x0
cocos2d::CCDirector *ScreenBottom; // x0
float v19; // s0
float v20; // s8
cocos2d::CCDirector *v21; // x0
float v22; // s0
float v23; // s9
float v24; // s0
v4 = *(_QWORD *)(a1 + 1016);
v5 = *(float *)(a1 + 1064);
v6 = v5 * *(float *)(a1 + 1056);
v7 = v5 * *(float *)(a1 + 1060);
if ( v4 )
v8 = *(float *)(v4 + 856);
else
v8 = 0.0;
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)a1);
ScreenLeft = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenLeft(v9);
v12 = (float)(v11 + 6.0) + (float)(v6 * 0.5);
v13 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(ScreenLeft);
ScreenRight = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenRight(v13);
v16 = (float)(v15 - 6.0) - (float)(v6 * 0.5);
v17 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(ScreenRight);
ScreenBottom = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenBottom(v17);
v20 = (float)((float)(v8 + v19) + 6.0) + (float)(v7 * 0.5);
v21 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(ScreenBottom);
cocos2d::CCDirector::getScreenTop(v21);
v23 = (float)(v22 - 6.0) - (float)(v7 * 0.5);
if ( v12 > v16 )
{
*a2 = (float)(v12 + v16) * 0.5;
goto LABEL_5;
}
if ( v12 <= *a2 )
{
if ( v16 < *a2 )
*a2 = v16;
LABEL_5:
if ( v20 <= v23 )
goto LABEL_6;
LABEL_12:
a2[1] = (float)(v20 + v23) * 0.5;
goto LABEL_9;
}
*a2 = v12;
if ( v20 > v23 )
goto LABEL_12;
LABEL_6:
v24 = a2[1];
if ( v20 > v24 )
{
a2[1] = v20;
}
else if ( v23 < v24 )
{
a2[1] = v23;
}
LABEL_9:
cocos2d::CCPoint::CCPoint(a3, (const cocos2d::CCPoint *)a2);
return a3;
}