//
// GJBaseGameLayer::positionUIObjects from 0x5aae7c to 0x5ab1a2 (806 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::updateSpecialGroupData @ 0x5c1526
//
// 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:53:25 +0000
//
int __fastcall GJBaseGameLayer::positionUIObjects(GJBaseGameLayer *this)
{
cocos2d::CCArray *v2; // r0
float v3; // s18
float v4; // s19
int result; // r0
int v6; // r3
cocos2d::CCArray *v7; // r10
_DWORD *v8; // r2
float v9; // s18
int *v10; // r11
float v11; // s19
float v12; // s21
float v13; // s20
int v14; // r4
int v15; // t1
int v16; // r7
cocos2d::CCArray *v17; // r5
_DWORD *v18; // r2
cocos2d::CCObject *v19; // r9
unsigned int v20; // r2
int v21; // r3
float v22; // s15
float v23; // s15
float v24; // s15
float v25; // s15
float v26; // s15
float v27; // s15
int (__fastcall *v28)(cocos2d::CCObject *, _BYTE *); // r7
int v29; // r2
_DWORD *v30; // r3
unsigned __int8 **v31; // r7
unsigned __int8 **v32; // r12
unsigned __int8 *v33; // r5
unsigned __int8 *v34; // t1
cocos2d::CCObject **v35; // [sp+0h] [bp-74h]
cocos2d::CCObject *Group; // [sp+4h] [bp-70h]
cocos2d::CCObject *GroupParent; // [sp+8h] [bp-6Ch]
int *v38; // [sp+14h] [bp-60h]
unsigned int v39; // [sp+18h] [bp-5Ch]
int (__fastcall *v40)(unsigned __int8 *, _BYTE *); // [sp+20h] [bp-54h]
unsigned __int8 **v41; // [sp+24h] [bp-50h]
float v42; // [sp+2Ch] [bp-48h] BYREF
float v43; // [sp+30h] [bp-44h]
char v44[8]; // [sp+34h] [bp-40h] BYREF
float v45; // [sp+3Ch] [bp-38h] BYREF
float v46; // [sp+40h] [bp-34h]
float v47; // [sp+44h] [bp-30h] BYREF
float v48; // [sp+48h] [bp-2Ch]
float v49[2]; // [sp+4Ch] [bp-28h] BYREF
_BYTE v50[8]; // [sp+54h] [bp-20h] BYREF
_BYTE v51[8]; // [sp+5Ch] [bp-18h] BYREF
_BYTE v52[8]; // [sp+64h] [bp-10h] BYREF
cocos2d::CCDirector::sharedDirector(this);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v42);
v2 = (cocos2d::CCArray *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v44, v42 * 0.5, v43 * 0.5);
v3 = v42;
v4 = v43;
result = cocos2d::CCArray::create(v2);
v6 = *((_DWORD *)this + 522);
v7 = (cocos2d::CCArray *)result;
if ( v6 )
{
v8 = *(_DWORD **)(v6 + 52);
if ( *v8 )
{
v9 = v3 * 0.5;
v10 = (int *)v8[3];
v38 = &v10[*v8 - 1];
v11 = v4 * 0.5;
v12 = v11 / 160.0;
v13 = v9 / 240.0;
while ( 1 )
{
LABEL_4:
if ( v10 <= v38 )
{
v15 = *v10++;
v14 = v15;
if ( v15 )
continue;
}
return result;
if ( *(_DWORD *)(v14 + 892) == 3613 )
{
Group = GJBaseGameLayer::getGroup(this, *(_DWORD *)(v14 + 1284));
GroupParent = (cocos2d::CCObject *)GJBaseGameLayer::getGroupParent(
(cocos2d::CCDictionary **)this,
*(_DWORD *)(v14 + 1284));
result = GJBaseGameLayer::tryGetMainObject((cocos2d::CCDictionary **)this, *(_DWORD *)(v14 + 1288));
v16 = result;
if ( GroupParent )
{
v17 = v7;
cocos2d::CCArray::removeAllObjects(v7);
result = cocos2d::CCArray::addObject(v7, GroupParent);
}
else
{
v17 = Group;
}
if ( v16 )
{
if ( v17 )
{
result = (*(int (__fastcall **)(float *, int))(*(_DWORD *)v16 + 908))(&v45, v16);
v18 = *((_DWORD **)v17 + 13);
if ( *v18 )
break;
}
}
}
}
v35 = (cocos2d::CCObject **)v18[3];
v39 = (unsigned int)(&v35[*v18] + 0x3FFFFFFF);
while ( 1 )
{
do
{
if ( (unsigned int)v35 <= v39 )
{
v19 = *v35++;
if ( v19 )
continue;
}
goto LABEL_4;
}
while ( *((_BYTE *)v19 + 1165) );
GJBaseGameLayer::addUIObject((cocos2d::CCArray **)this, v19, v39, *((unsigned __int8 *)v19 + 1165));
(*(void (__fastcall **)(float *, cocos2d::CCObject *))(*(_DWORD *)v19 + 908))(&v47, v19);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, (const cocos2d::CCPoint *)&v47);
v20 = *(_DWORD *)(v14 + 1648);
v21 = *(_DWORD *)(v14 + 1652);
if ( v20 <= 1 )
{
if ( v47 >= v45 )
v20 = 4;
else
v20 = 3;
}
if ( v21 == 5 || !v21 )
{
if ( v48 >= v46 )
v21 = 8;
else
v21 = 7;
}
switch ( v20 )
{
case 2u:
v22 = v47 - v45;
if ( *(_BYTE *)(v14 + 1656) )
v22 = v22 * v13;
v23 = v22 + v9;
break;
case 3u:
v23 = v47 - (float)(v45 - 240.0);
if ( *(_BYTE *)(v14 + 1656) )
v23 = v23 * v13;
break;
case 4u:
v24 = v47 - (float)(v45 + 240.0);
if ( *(_BYTE *)(v14 + 1656) )
v24 = v24 * v13;
v23 = v42 + v24;
break;
default:
goto LABEL_38;
}
v49[0] = v23;
LABEL_38:
switch ( v21 )
{
case 6:
v25 = v48 - v46;
if ( *(_BYTE *)(v14 + 1657) )
v25 = v25 * v12;
v26 = v25 + v11;
break;
case 7:
v26 = v48 - (float)(v46 - 160.0);
if ( *(_BYTE *)(v14 + 1657) )
v26 = v26 * v12;
break;
case 8:
v27 = v48 - (float)(v46 + 160.0);
if ( *(_BYTE *)(v14 + 1657) )
v27 = v27 * v12;
v26 = v43 + v27;
break;
default:
goto LABEL_50;
}
v49[1] = v26;
LABEL_50:
v28 = *(int (__fastcall **)(cocos2d::CCObject *, _BYTE *))(*(_DWORD *)v19 + 684);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v52, (const cocos2d::CCPoint *)v49);
result = v28(v19, v52);
if ( v19 == GroupParent )
{
if ( Group )
{
result = cocos2d::CCPoint::operator-(v50, v49, &v47);
v30 = *((_DWORD **)Group + 13);
if ( *v30 )
{
v31 = (unsigned __int8 **)v30[3];
v32 = &(&v31[*v30])[-1];
while ( v31 <= v32 )
{
v34 = *v31++;
v33 = v34;
if ( !v34 )
break;
if ( !v33[1165] )
{
v41 = v32;
GJBaseGameLayer::addUIObject((cocos2d::CCArray **)this, (GameObject *)v33, v29, v33[1165]);
v40 = *(int (__fastcall **)(unsigned __int8 *, _BYTE *))(*(_DWORD *)v33 + 684);
(*(void (__fastcall **)(_BYTE *, unsigned __int8 *))(*(_DWORD *)v33 + 908))(v51, v33);
cocos2d::CCPoint::operator+(v52, v51, v50);
result = v40(v33, v52);
v32 = v41;
}
}
}
}
}
}
}
}
return result;
}