//
// GJBaseGameLayer::controlAreaEffect from 0x9b04c4 to 0x9b0870 (940 bytes)
//
// 6 xrefs:
// > GJBaseGameLayer::controlTriggersInGroup @ 0x9e0484
// > GJBaseGameLayer::controlTriggersInGroup @ 0x9e04a4
// > GJBaseGameLayer::controlTriggersInGroup @ 0x9e0558
// > GJBaseGameLayer::controlTriggersInGroup @ 0x9e0570
// > GJBaseGameLayer::controlTriggersInGroup @ 0x9e0588
// > ??> @ 0x101758
//
// 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:58:15 +0000
//
unsigned __int64 __fastcall GJBaseGameLayer::controlAreaEffect(__int64 a1, __int64 a2, __int64 *a3, int a4)
{
__int64 v4; // x19
__int64 v6; // x20
int v7; // w22
unsigned __int64 v8; // x21
__int64 v9; // x1
unsigned __int64 result; // x0
__int64 v11; // x28
__int64 v12; // x24
__int64 v13; // x19
__int64 v14; // x23
_QWORD **v15; // x27
__int64 v16; // x1
__int64 v17; // x0
int v18; // w11
_QWORD *v19; // x1
int v20; // w10
int v21; // w9
int v22; // w8
int v23; // w7
int v24; // w6
int v25; // w5
int v26; // w4
int v27; // w3
int v28; // w18
int v29; // w17
int v30; // w16
int v31; // w15
int v32; // w14
int v33; // w13
int v34; // w2
int v35; // w7
int v36; // w6
int v37; // w5
int v38; // w4
int v39; // w3
int v40; // w2
int v41; // w12
int v42; // w11
int v43; // w10
int v44; // w9
__int64 v45; // x3
int v46; // w2
char v47; // w0
int v48; // w7
int v49; // w6
int v50; // w5
char *v51; // x0
char *v52; // x2
__int64 v53; // x1
__int64 v54; // x0
int v55; // w3
char *v56; // x0
char *v57; // x3
_QWORD **v58; // x19
v4 = *a3;
v6 = a3[1];
v7 = 0;
v8 = 0;
v9 = v6 - *a3;
while ( 1 )
{
result = 0xEEEEEEEEEEEEEEEFLL * (v9 >> 4);
if ( v8 >= result )
return result;
v11 = v4 + 240 * v8;
if ( *(_QWORD *)(v11 + 168) != a2 )
goto LABEL_2;
if ( a4 )
{
if ( a4 == 1 )
{
*(_BYTE *)(v11 + 196) = 1;
*(_BYTE *)(v11 + 197) = 1;
v4 = *a3;
v6 = a3[1];
v9 = v6 - *a3;
}
else if ( a4 == 2 )
{
*(_BYTE *)(v11 + 196) = 0;
*(_BYTE *)(v11 + 197) = 0;
v4 = *a3;
v6 = a3[1];
v9 = v6 - *a3;
}
LABEL_2:
v8 = ++v7;
}
else
{
v12 = v11 + 240;
v13 = v11 + 240;
if ( v11 + 240 != v6 )
{
v14 = v11 + 8;
while ( 1 )
{
v15 = *(_QWORD ***)(v13 - 232);
if ( v15 )
{
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v11,
*v15);
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v11,
v15[1]);
operator delete(v15);
}
v16 = *(_QWORD *)(v13 + 8);
v17 = *(_QWORD *)(v13 + 16);
*(_QWORD *)(v13 - 240) = *(_QWORD *)v13;
*(_QWORD *)(v13 - 232) = v16;
*(_QWORD *)(v13 - 224) = v17;
if ( v17 )
{
*(_QWORD *)(v16 + 16) = v14;
*(_QWORD *)(v13 + 8) = 0;
*(_QWORD *)v13 = v13 + 8;
*(_QWORD *)(v13 + 16) = 0;
}
else
{
*(_QWORD *)(v13 - 240) = v14;
}
v18 = *(_DWORD *)(v13 + 52);
v19 = (_QWORD *)(v13 - 104);
v20 = *(_DWORD *)(v13 + 56);
v21 = *(_DWORD *)(v13 + 60);
v22 = *(_DWORD *)(v13 + 64);
v23 = *(_DWORD *)(v13 + 68);
v24 = *(_DWORD *)(v13 + 72);
v25 = *(_DWORD *)(v13 + 76);
v26 = *(_DWORD *)(v13 + 80);
v27 = *(_DWORD *)(v13 + 84);
v28 = *(_DWORD *)(v13 + 24);
v29 = *(_DWORD *)(v13 + 28);
v30 = *(_DWORD *)(v13 + 32);
v31 = *(_DWORD *)(v13 + 36);
v32 = *(_DWORD *)(v13 + 40);
v33 = *(_DWORD *)(v13 + 44);
v34 = *(_DWORD *)(v13 + 88);
*(_DWORD *)(v13 - 192) = *(_DWORD *)(v13 + 48);
*(_DWORD *)(v13 - 188) = v18;
*(_DWORD *)(v13 - 184) = v20;
*(_DWORD *)(v13 - 180) = v21;
*(_DWORD *)(v13 - 176) = v22;
*(_DWORD *)(v13 - 172) = v23;
*(_DWORD *)(v13 - 168) = v24;
*(_DWORD *)(v13 - 164) = v25;
*(_DWORD *)(v13 - 160) = v26;
*(_DWORD *)(v13 - 156) = v27;
*(_DWORD *)(v13 - 216) = v28;
*(_DWORD *)(v13 - 212) = v29;
*(_DWORD *)(v13 - 208) = v30;
*(_DWORD *)(v13 - 204) = v31;
*(_DWORD *)(v13 - 200) = v32;
*(_DWORD *)(v13 - 196) = v33;
*(_DWORD *)(v13 - 152) = v34;
v35 = *(_DWORD *)(v13 + 112);
v36 = *(_DWORD *)(v13 + 116);
v37 = *(_DWORD *)(v13 + 120);
v38 = *(_DWORD *)(v13 + 124);
v39 = *(_DWORD *)(v13 + 128);
v40 = *(_DWORD *)(v13 + 132);
v41 = *(_DWORD *)(v13 + 92);
v42 = *(_DWORD *)(v13 + 96);
v43 = *(_DWORD *)(v13 + 100);
v44 = *(_DWORD *)(v13 + 104);
*(_DWORD *)(v13 - 132) = *(_DWORD *)(v13 + 108);
*(_DWORD *)(v13 - 128) = v35;
*(_DWORD *)(v13 - 124) = v36;
*(_DWORD *)(v13 - 120) = v37;
*(_DWORD *)(v13 - 116) = v38;
*(_DWORD *)(v13 - 148) = v41;
*(_DWORD *)(v13 - 144) = v42;
*(_DWORD *)(v13 - 140) = v43;
*(_DWORD *)(v13 - 136) = v44;
*(_DWORD *)(v13 - 112) = v39;
*(_DWORD *)(v13 - 108) = v40;
v45 = *(_QWORD *)(v13 + 144);
*v19 = *(_QWORD *)(v13 + 136);
v19[1] = v45;
LODWORD(v45) = *(_DWORD *)(v13 + 152);
v46 = *(_DWORD *)(v13 + 156);
*(_QWORD *)(v13 - 72) = *(_QWORD *)(v13 + 168);
LODWORD(v19) = *(_DWORD *)(v13 + 160);
v47 = *(_BYTE *)(v13 + 176);
*(_DWORD *)(v13 - 88) = v45;
*(_DWORD *)(v13 - 84) = v46;
*(_DWORD *)(v13 - 80) = (_DWORD)v19;
*(_BYTE *)(v13 - 64) = v47;
v48 = *(_DWORD *)(v13 + 184);
v49 = *(_DWORD *)(v13 + 188);
v50 = *(_DWORD *)(v13 + 192);
LOBYTE(v38) = *(_BYTE *)(v13 + 196);
LOBYTE(v45) = *(_BYTE *)(v13 + 197);
LOBYTE(v46) = *(_BYTE *)(v13 + 198);
LODWORD(v19) = *(_DWORD *)(v13 + 200);
v51 = *(char **)(v13 - 32);
*(_DWORD *)(v13 - 60) = *(_DWORD *)(v13 + 180);
*(_DWORD *)(v13 - 56) = v48;
*(_DWORD *)(v13 - 52) = v49;
*(_DWORD *)(v13 - 48) = v50;
*(_BYTE *)(v13 - 44) = v38;
*(_BYTE *)(v13 - 43) = v45;
*(_BYTE *)(v13 - 42) = v46;
*(_DWORD *)(v13 - 40) = (_DWORD)v19;
if ( v51 )
{
v52 = *(char **)(v13 - 24);
if ( v51 != v52 )
*(_QWORD *)(v13 - 24) = &v52[4 * ~((unsigned __int64)(v52 - 4 - v51) >> 2)];
operator delete(v51);
}
v53 = *(_QWORD *)(v13 + 208);
v11 = v12;
v54 = *(_QWORD *)(v13 + 216);
v14 += 240;
v55 = *(_DWORD *)(v13 + 232);
*(_QWORD *)(v13 - 16) = *(_QWORD *)(v13 + 224);
*(_QWORD *)(v13 + 224) = 0;
*(_QWORD *)(v13 + 216) = 0;
*(_QWORD *)(v13 + 208) = 0;
*(_DWORD *)(v13 - 8) = v55;
*(_QWORD *)(v13 - 32) = v53;
*(_QWORD *)(v13 - 24) = v54;
v13 += 240;
if ( v13 == v6 )
break;
v12 += 240;
}
v6 = a3[1];
}
for ( ; v6 != v11; v6 = a3[1] )
{
a3[1] = v6 - 240;
v56 = *(char **)(v6 - 32);
if ( v56 )
{
v57 = *(char **)(v6 - 24);
if ( v56 != v57 )
*(_QWORD *)(v6 - 24) = &v57[4 * ~((unsigned __int64)(v57 - 4 - v56) >> 2)];
operator delete(v56);
}
v58 = *(_QWORD ***)(v6 - 232);
if ( v58 )
{
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v6 - 240,
*v58);
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v6 - 240,
v58[1]);
operator delete(v58);
}
}
v4 = *a3;
v6 = v11;
v9 = v11 - *a3;
}
}
}