//
// EditorUI::constrainGameLayerPosition from 0x484608 to 0x4847c6 (446 bytes)
//
// 2 xrefs:
// > EditorUI::constrainGameLayerPosition @ 0x4847dc
// > EditorUI::init @ 0x48b2a8
//
// 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:49:24 +0000
//
int __fastcall EditorUI::constrainGameLayerPosition(EditorUI *this, float a2, float a3)
{
const cocos2d::CCPoint *v6; // r0
cocos2d::CCDirector *v7; // r0
cocos2d::CCDirector *v8; // r0
float v9; // r0
const cocos2d::CCPoint *v10; // r9
cocos2d::CCDirector *v11; // r0
cocos2d::CCDirector *v12; // r0
cocos2d::CCDirector *ScreenRight; // r7
cocos2d::CCDirector *v14; // r0
float v15; // r0
int v16; // r3
const cocos2d::CCPoint *v17; // r9
int v18; // r2
int v19; // r0
float v20; // s15
float v21; // s14
float v22; // s15
float v23; // s14
float v25; // [sp+4h] [bp-10h] BYREF
float v26; // [sp+8h] [bp-Ch]
float v27; // [sp+Ch] [bp-8h] BYREF
float v28; // [sp+10h] [bp-4h]
float v29; // [sp+14h] [bp+0h] BYREF
float v30; // [sp+18h] [bp+4h]
float v31; // [sp+1Ch] [bp+8h] BYREF
float v32; // [sp+20h] [bp+Ch]
float v33; // [sp+24h] [bp+10h] BYREF
float v34; // [sp+28h] [bp+14h]
_BYTE v35[8]; // [sp+2Ch] [bp+18h] BYREF
v6 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD, _DWORD, _DWORD))(**(_DWORD **)(*((_DWORD *)this + 236)
+ 2436)
+ 96))(
*(_DWORD *)(*((_DWORD *)this + 236) + 2436),
LODWORD(a2),
LODWORD(a3));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, v6);
v7 = (cocos2d::CCDirector *)(*(int (__fastcall **)(_DWORD, float *))(**(_DWORD **)(*((_DWORD *)this + 236) + 2436) + 92))(
*(_DWORD *)(*((_DWORD *)this + 236) + 2436),
&flt_D2B938);
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v7);
v9 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v8));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v27, v9, *((float *)this + 157));
v10 = *(const cocos2d::CCPoint **)(*((_DWORD *)this + 236) + 2436);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v35, (float)(a2 * 30.0) - 30.0, (float)(a3 * 30.0) + 90.0);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v29, v10);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v35, *((const cocos2d::CCPoint **)this + 236));
v11 = (cocos2d::CCDirector *)cocos2d::CCPoint::operator=(&v29, v35);
v12 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v11);
ScreenRight = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenRight(v12);
v14 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(ScreenRight);
v15 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v14));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, *(float *)&ScreenRight, v15);
v16 = *((_DWORD *)this + 236);
v17 = *(const cocos2d::CCPoint **)(v16 + 2436);
if ( *(_BYTE *)(*(_DWORD *)(v16 + 2084) + 373) )
v18 = 1000;
else
v18 = 80;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v35, 240030.0, (float)((float)((float)v18 * 30.0) + 90.0) + 30.0);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v33, v17);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v35, *((const cocos2d::CCPoint **)this + 236));
cocos2d::CCPoint::operator=(&v33, v35);
v19 = *(_DWORD *)(*((_DWORD *)this + 236) + 2436);
v20 = v27 - v29;
if ( v25 <= (float)(v27 - v29) )
v20 = v25;
v21 = v31 - v33;
if ( v20 >= (float)(v31 - v33) )
v21 = v20;
v25 = v21;
v22 = v28 - v30;
if ( v26 <= (float)(v28 - v30) )
v22 = v26;
v23 = v32 - v34;
if ( v22 >= (float)(v32 - v34) )
v23 = v22;
v26 = v23;
return (*(int (__fastcall **)(int, float *))(*(_DWORD *)v19 + 92))(v19, &v25);
}