//
// LevelEditorLayer::objectsAtPosition from 0x78aa64 to 0x78ae0c (936 bytes)
//
// 5 xrefs:
// > EditorUI::onDelete @ 0x7d17f8
// > EditorUI::startFreeMoveTouch @ 0xbd5058
// > EditorUI::ccTouchEnded @ 0xbd6574
// > EditorUI::ccTouchEnded @ 0xbd6658
// > ??> @ 0x4be38
//
// 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 12:53:26 +0000
//
cocos2d::CCArray *__fastcall LevelEditorLayer::objectsAtPosition(__int64 a1, float *a2)
{
cocos2d::CCArray *updated; // x0
float v5; // s0
int v6; // w19
float v7; // s0
int v8; // w21
unsigned __int64 v9; // x24
int v10; // w22
int v11; // w0
__int64 v12; // x21
__int64 v13; // x1
__int64 v14; // x0
unsigned __int64 v15; // x2
int v16; // w0
__int64 v17; // x19
_BYTE *v18; // x27
_QWORD *v19; // x19
int v20; // w24
__int64 v21; // x0
unsigned __int64 v22; // x1
int v23; // w0
__int64 v24; // x26
__int64 v25; // x25
_QWORD *v26; // x22
int v27; // w21
__int64 v28; // x28
__int64 v29; // x21
GameObject *v30; // x19
int v32; // [xsp+84h] [xbp+84h]
int v33; // [xsp+88h] [xbp+88h]
int v34; // [xsp+8Ch] [xbp+8Ch]
int v35; // [xsp+8Ch] [xbp+8Ch]
int v37; // [xsp+98h] [xbp+98h]
int v38; // [xsp+9Ch] [xbp+9Ch]
cocos2d::CCArray *v39; // [xsp+A0h] [xbp+A0h]
__int64 v40; // [xsp+A8h] [xbp+A8h]
_BYTE v41[16]; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v41, *a2, a2[1], 1.0, 1.0);
updated = (cocos2d::CCArray *)GJBaseGameLayer::updateOBB2(a1, v41);
v39 = (cocos2d::CCArray *)cocos2d::CCArray::create(updated);
v5 = *a2;
if ( *a2 > 0.0 )
{
if ( v5 < 10000000.0 )
{
v6 = (int)(float)(v5 * *(float *)(a1 + 13632));
v7 = a2[1];
v8 = v6 + 1;
v9 = v6 + 1;
if ( v7 > 0.0 )
goto LABEL_4;
LABEL_31:
v11 = 1;
v10 = 0;
v9 = v8;
if ( v6 > 1 )
{
LABEL_7:
v33 = v11;
v37 = v6 - 1;
v34 = v8;
goto LABEL_8;
}
goto LABEL_32;
}
v6 = (int)(float)(*(float *)(a1 + 13632) * 10000000.0);
v7 = a2[1];
v8 = v6 + 1;
v9 = v6 + 1;
if ( v7 <= 0.0 )
goto LABEL_31;
LABEL_4:
if ( v7 < 10000000.0 )
v10 = (int)(float)(v7 * *(float *)(a1 + 13636));
else
v10 = (int)(float)(*(float *)(a1 + 13636) * 10000000.0);
v11 = v10 + 1;
if ( v6 > 1 )
goto LABEL_7;
LABEL_32:
v33 = v11;
v34 = v8;
v37 = 0;
goto LABEL_8;
}
v9 = 1;
v7 = a2[1];
if ( v7 > 0.0 )
{
v6 = 0;
v8 = 1;
goto LABEL_4;
}
v34 = 1;
v33 = 1;
v10 = 0;
v37 = 0;
LABEL_8:
v12 = *(_QWORD *)(a1 + 13368);
v13 = *(_QWORD *)(a1 + 13376);
v14 = (v13 - v12) >> 3;
v15 = v14 - 1;
v16 = v14 - 1;
if ( v15 >= v9 )
v16 = v34;
v35 = v16;
if ( v10 <= 1 )
v32 = 0;
else
v32 = v10 - 1;
if ( v12 != v13 && v37 <= v16 )
{
v40 = 8LL * v37;
v17 = *(_QWORD *)(a1 + 13368);
v18 = (_BYTE *)(a1 + 14245);
while ( 1 )
{
v19 = *(_QWORD **)(v17 + v40);
if ( v19 )
{
v20 = v32;
v21 = (__int64)(v19[1] - *v19) >> 3;
v22 = v21 - 1;
v23 = v21 - 1;
if ( v33 <= v22 )
v23 = v33;
v38 = v23;
if ( v32 <= v23 )
break;
}
LABEL_36:
v40 += 8;
if ( v35 < ++v37 )
return v39;
v17 = *(_QWORD *)(a1 + 13368);
}
v24 = 4LL * v32;
v25 = 8LL * v32;
while ( 1 )
{
v26 = *(_QWORD **)(*v19 + v25);
if ( v26 )
{
v27 = *(_DWORD *)(**(_QWORD **)(*(_QWORD *)(a1 + 13536) + v40) + v24);
if ( v27 > 0 )
break;
}
LABEL_28:
++v20;
v25 += 8;
v24 += 4;
if ( v38 < v20 )
goto LABEL_36;
v19 = *(_QWORD **)(*(_QWORD *)(a1 + 13368) + v40);
}
v28 = 0;
v29 = 8 * ((unsigned int)(v27 - 1) + 1LL);
while ( 1 )
{
v30 = *(GameObject **)(*v26 + v28);
if ( !LevelEditorLayer::validGroup((LevelEditorLayer *)a1, v30, 1) )
goto LABEL_23;
LevelEditorLayer::getObjectRect((LevelEditorLayer *)a1, v30, 0, 0, (cocos2d::CCRect *)v41);
if ( !*v18 )
{
if ( (unsigned __int8)cocos2d::CCRect::containsPoint((cocos2d::CCRect *)v41, (const cocos2d::CCPoint *)a2) )
goto LABEL_27;
if ( !*v18 )
goto LABEL_23;
}
if ( OBB2D::overlaps(*(float **)(a1 + 14216), *(float **)(a1 + 2080)) )
{
LABEL_27:
v28 += 8;
cocos2d::CCArray::addObject(v39, v30);
if ( v28 == v29 )
goto LABEL_28;
}
else
{
LABEL_23:
v28 += 8;
if ( v28 == v29 )
goto LABEL_28;
}
}
}
return v39;
}