//
// EditorWindowPopup::clampWindowOnScreen from 0x14017eaa0 to 0x14017ec3b (411 bytes)
//
// 2 xrefs:
// > EmotePickerPopup::init @ 0x140123bea
// > ??> @ 0x140918a4c
//
// This function is hookable on this platform (idp: pc, 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 11:27:36 +0000
//
cocos2d::CCPoint *__fastcall EditorWindowPopup::clampWindowOnScreen(__int64 a1, cocos2d::CCPoint *a2, float *a3)
{
float v5; // xmm9_4
__int64 v6; // rax
float v7; // xmm11_4
float v8; // xmm8_4
cocos2d::CCDirector *v9; // rax
float v10; // xmm10_4
__int64 v11; // rcx
cocos2d::CCDirector *v12; // rax
float v13; // xmm9_4
float v14; // xmm7_4
__int64 v15; // rcx
cocos2d::CCDirector *v16; // rax
float v17; // xmm8_4
__int64 v18; // rcx
cocos2d::CCDirector *v19; // rax
float v20; // xmm0_4
float v21; // xmm1_4
v5 = *(float *)(a1 + 1048) * *(float *)(a1 + 1044);
v6 = *(_QWORD *)(a1 + 1000);
if ( v6 )
v7 = *(float *)(v6 + 904);
else
v7 = 0.0;
v8 = (float)(*(float *)(a1 + 1048) * *(float *)(a1 + 1040)) * 0.5;
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
v10 = (float)(cocos2d::CCDirector::getScreenLeft(v9) + 6.0) + v8;
v12 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v11);
v13 = v5 * 0.5;
v14 = (float)(cocos2d::CCDirector::getScreenRight(v12) - 6.0) - v8;
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v15);
v17 = (float)((float)(cocos2d::CCDirector::getScreenBottom(v16) + v7) + 6.0) + v13;
v19 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v18);
v20 = (float)(cocos2d::CCDirector::getScreenTop(v19) - 6.0) - v13;
if ( v10 > v14 )
{
v14 = (float)(v14 + v10) * 0.5;
LABEL_9:
*a3 = v14;
goto LABEL_10;
}
if ( v10 > *a3 )
{
*a3 = v10;
goto LABEL_10;
}
if ( *a3 > v14 )
goto LABEL_9;
LABEL_10:
if ( v17 > v20 )
{
v20 = (float)(v20 + v17) * 0.5;
LABEL_15:
a3[1] = v20;
goto LABEL_16;
}
v21 = a3[1];
if ( v17 <= v21 )
{
if ( v21 > v20 )
goto LABEL_15;
}
else
{
a3[1] = v17;
}
LABEL_16:
cocos2d::CCPoint::CCPoint(a2, (const struct cocos2d::CCPoint *)a3);
return a2;
}