//
// EditorWindowPopup::clampWindowOnScreen from 0x78ccb8 to 0x78cdc6 (270 bytes)
//
// 2 xrefs:
// > EmotePickerPopup::init @ 0x77929a
// > EmotePickerPopup::init @ 0x7792fe
//
// 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:37 +0000
//
cocos2d::CCDirector *__fastcall EditorWindowPopup::clampWindowOnScreen(cocos2d::CCDirector *a1, int a2, float *a3)
{
float v5; // s18
int v6; // r3
float v7; // s21
float v8; // s19
float v9; // s16
cocos2d::CCDirector *v10; // r0
float v11; // r0
float v12; // s21
float v13; // s18
cocos2d::CCDirector *v14; // r0
float v15; // r0
float v16; // s18
float v17; // s21
cocos2d::CCDirector *v18; // r0
float v19; // r0
float v20; // s19
float v21; // s16
cocos2d::CCDirector *v22; // r0
float v23; // s16
float v24; // s17
float v25; // s15
v5 = *(float *)(a2 + 740);
v6 = *(_DWORD *)(a2 + 712);
v7 = v5 * *(float *)(a2 + 732);
v8 = v5 * *(float *)(a2 + 736);
if ( v6 )
v9 = *(float *)(v6 + 632);
else
v9 = 0.0;
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
v11 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v10));
v12 = v7 * 0.5;
v13 = v11 + 6.0;
v14 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v11));
v15 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v14));
v16 = v13 + v12;
v17 = (float)(v15 - 6.0) - v12;
v18 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v15));
v19 = COERCE_FLOAT(cocos2d::CCDirector::getScreenBottom(v18));
v20 = v8 * 0.5;
v21 = v19 + v9;
v22 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v19));
v23 = (float)(v21 + 6.0) + v20;
v24 = (float)(COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v22)) - 6.0) - v20;
if ( v16 > v17 )
{
v16 = (float)(v16 + v17) * 0.5;
LABEL_7:
*a3 = v16;
goto LABEL_10;
}
if ( *a3 < v16 )
goto LABEL_7;
if ( *a3 > v17 )
*a3 = v17;
LABEL_10:
if ( v23 > v24 )
{
v23 = (float)(v23 + v24) * 0.5;
LABEL_13:
a3[1] = v23;
goto LABEL_16;
}
v25 = a3[1];
if ( v25 < v23 )
goto LABEL_13;
if ( v25 > v24 )
a3[1] = v24;
LABEL_16:
cocos2d::CCPoint::CCPoint(a1, (const cocos2d::CCPoint *)a3);
return a1;
}