//
// GJBaseGameLayer::positionUIObjects from 0x14032edb0 to 0x14032f276 (1222 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::updateSpecialGroupData @ 0x1403140f0
// > ??> @ 0x1408b64b4
// > ??> @ 0x1408b64f4
// > ??> @ 0x14091f49c
//
// This function is hookable on this platform (idp: pc, 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 11:30:31 +0000
//
unsigned __int64 __fastcall GJBaseGameLayer::positionUIObjects(__int64 a1)
{
__int64 v2; // rax
float v3; // xmm11_4
float v4; // xmm10_4
float v5; // xmm7_4
float v6; // xmm6_4
__int64 v7; // rcx
unsigned __int64 result; // rax
__int64 v9; // rcx
cocos2d::CCArray *v10; // r15
unsigned int *v11; // rcx
__int64 v12; // rdx
_QWORD *v13; // r14
__int64 v14; // r14
struct cocos2d::CCObject *Group; // rbx
cocos2d::CCArray *v16; // rax
cocos2d::CCArray *v17; // rdi
struct cocos2d::CCObject *v18; // rax
int v19; // edx
struct cocos2d::CCObject *v20; // rsi
struct cocos2d::CCObject *MainObject; // rdi
struct cocos2d::CCObject *v22; // r12
int v23; // edx
unsigned int *v24; // rax
__int64 v25; // rcx
struct cocos2d::CCObject **v26; // r15
struct cocos2d::CCObject **v27; // rax
struct cocos2d::CCObject *v28; // rdi
unsigned int v29; // eax
int v30; // ecx
float v31; // xmm1_4
float v32; // xmm1_4
float v33; // xmm1_4
float v34; // xmm0_4
float v35; // xmm0_4
float v36; // xmm0_4
__int64 v37; // rbx
__int64 v38; // rax
unsigned int *v39; // rbx
__int64 v40; // rax
_DWORD **v41; // rbx
_DWORD **j; // rsi
_BYTE *v43; // rdi
__int64 v44; // rax
float v45; // [rsp+28h] [rbp-99h] BYREF
float v46; // [rsp+2Ch] [rbp-95h]
struct cocos2d::CCObject *v47; // [rsp+30h] [rbp-91h]
float v48; // [rsp+38h] [rbp-89h] BYREF
float v49; // [rsp+3Ch] [rbp-85h]
cocos2d::CCArray *v50; // [rsp+40h] [rbp-81h]
_QWORD *v51; // [rsp+48h] [rbp-79h]
char v52[8]; // [rsp+50h] [rbp-71h] BYREF
char v53[8]; // [rsp+58h] [rbp-69h] BYREF
char v54[8]; // [rsp+60h] [rbp-61h] BYREF
char v55[8]; // [rsp+68h] [rbp-59h] BYREF
__int128 v56[7]; // [rsp+70h] [rbp-51h] BYREF
float v57; // [rsp+128h] [rbp+67h] BYREF
float v58; // [rsp+12Ch] [rbp+6Bh]
float v59; // [rsp+130h] [rbp+6Fh] BYREF
float v60; // [rsp+134h] [rbp+73h]
struct cocos2d::CCObject **v61; // [rsp+138h] [rbp+77h]
unsigned __int64 i; // [rsp+140h] [rbp+7Fh]
v2 = cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v2, &v59);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v54, v59 * 0.5, v60 * 0.5);
v3 = v59 * 0.5;
v4 = v60 * 0.5;
v5 = (float)(v59 * 0.5) / 240.0;
v6 = (float)(v60 * 0.5) / 160.0;
result = cocos2d::CCArray::create(v7);
v9 = *(_QWORD *)(a1 + 3536);
v10 = (cocos2d::CCArray *)result;
v50 = (cocos2d::CCArray *)result;
if ( v9 )
{
v11 = *(unsigned int **)(v9 + 56);
v12 = *v11;
if ( (_DWORD)v12 )
{
v13 = *((_QWORD **)v11 + 2);
v51 = v13;
result = (unsigned __int64)&v13[v12 - 1];
for ( i = result; (unsigned __int64)v13 <= result; v51 = v13 )
{
v14 = *v13;
if ( !v14 )
return result;
if ( *(_DWORD *)(v14 + 1036) == 3613 )
{
Group = GJBaseGameLayer::getGroup(a1, *(unsigned int *)(v14 + 1480));
v16 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 3968), *(int *)(v14 + 1480));
v17 = v16;
if ( v16 && cocos2d::CCArray::count(v16) )
{
v18 = cocos2d::CCArray::objectAtIndex(v17, 0);
v19 = *(_DWORD *)(v14 + 1484);
v20 = v18;
v47 = v18;
MainObject = GJBaseGameLayer::tryGetMainObject(a1, v19);
v22 = Group;
if ( v20 )
{
cocos2d::CCArray::removeAllObjects(v10);
cocos2d::CCArray::addObject(v10, v20);
Group = v10;
v47 = v20;
}
}
else
{
v23 = *(_DWORD *)(v14 + 1484);
v20 = nullptr;
v47 = nullptr;
MainObject = GJBaseGameLayer::tryGetMainObject(a1, v23);
v22 = Group;
}
if ( MainObject )
{
if ( Group )
{
(*(void (__fastcall **)(struct cocos2d::CCObject *, float *))(*(_QWORD *)MainObject + 1664LL))(
MainObject,
&v48);
v24 = *((unsigned int **)Group + 7);
v25 = *v24;
if ( (_DWORD)v25 )
{
v26 = *((struct cocos2d::CCObject ***)v24 + 2);
v61 = &v26[v25 - 1];
if ( v26 <= v61 )
{
v27 = &v26[v25 - 1];
while ( 1 )
{
v28 = *v26;
if ( !*v26 )
goto LABEL_57;
if ( !*((_BYTE *)v28 + 1353) )
break;
LABEL_56:
v20 = v47;
if ( ++v26 > v27 )
goto LABEL_57;
}
GJBaseGameLayer::addUIObject(a1, *v26);
(*(void (__fastcall **)(struct cocos2d::CCObject *, float *))(*(_QWORD *)v28 + 1664LL))(v28, &v45);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, (const struct cocos2d::CCPoint *)&v45);
v29 = *(_DWORD *)(v14 + 1856);
v30 = *(_DWORD *)(v14 + 1860);
if ( v29 <= 1 )
v29 = (v48 <= v45) + 3;
if ( v30 == 5 || !v30 )
v30 = (v49 <= v46) + 7;
switch ( v29 )
{
case 2u:
v31 = v45 - v48;
if ( *(_BYTE *)(v14 + 1864) )
v31 = v31 * v5;
v32 = v31 + v3;
goto LABEL_34;
case 3u:
v32 = v45 - (float)(v48 - 240.0);
if ( *(_BYTE *)(v14 + 1864) )
v32 = v32 * v5;
goto LABEL_34;
case 4u:
v33 = v45 - (float)(v48 + 240.0);
if ( *(_BYTE *)(v14 + 1864) )
v33 = v33 * v5;
v32 = v33 + v59;
LABEL_34:
v57 = v32;
break;
}
switch ( v30 )
{
case 6:
v34 = v46 - v49;
if ( *(_BYTE *)(v14 + 1865) )
v34 = v34 * v6;
v35 = v34 + v4;
goto LABEL_46;
case 7:
v35 = v46 - (float)(v49 - 160.0);
if ( *(_BYTE *)(v14 + 1865) )
v35 = v35 * v6;
goto LABEL_46;
case 8:
v36 = v46 - (float)(v49 + 160.0);
if ( *(_BYTE *)(v14 + 1865) )
v36 = v36 * v6;
v35 = v36 + v60;
LABEL_46:
v58 = v35;
break;
}
v37 = *(_QWORD *)v28;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, (const struct cocos2d::CCPoint *)&v57);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v37 + 1216))(v28, v38);
if ( v28 == v20 )
{
if ( v22 )
{
cocos2d::CCPoint::operator-(&v57, v52, &v45);
v39 = *((unsigned int **)v22 + 7);
v40 = *v39;
if ( (_DWORD)v40 )
{
v41 = *((_DWORD ***)v39 + 2);
for ( j = &v41[v40 - 1]; v41 <= j; ++v41 )
{
v43 = *v41;
if ( !*v41 )
break;
if ( !v43[1353] )
{
GJBaseGameLayer::addUIObject(a1, *v41);
v44 = (*(__int64 (__fastcall **)(_BYTE *, __int128 *))(*(_QWORD *)v43 + 1664LL))(v43, v56);
cocos2d::CCPoint::operator+(v44, v53, v52);
(*(void (__fastcall **)(_BYTE *, char *))(*(_QWORD *)v43 + 1216LL))(v43, v53);
}
}
}
}
}
v27 = v61;
goto LABEL_56;
}
LABEL_57:
v10 = v50;
}
}
}
result = i;
}
v13 = v51 + 1;
}
}
}
return result;
}