//
// GJBaseGameLayer::positionUIObjects from 0x140226070 to 0x1402264fb (1163 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::updateSpecialGroupData @ 0x14020e070
// > ??> @ 0x140680264
// > ??> @ 0x1406802a4
// > ??> @ 0x1406cd818
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void GJBaseGameLayer::positionUIObjects(GJBaseGameLayer *a1)
{
float v1; // xmm0_4
cocos2d::CCDirector *v3; // rax
float v4; // xmm11_4
float v5; // xmm10_4
float v6; // xmm7_4
float v7; // xmm6_4
__int64 v8; // rcx
cocos2d::CCArray *v9; // rax
cocos2d::CCArray *m_objects; // rcx
cocos2d::ccArray *data; // rcx
__int64 num; // rdx
cocos2d::CCObject **arr; // rsi
cocos2d::CCObject **v14; // rax
cocos2d::CCObject *v15; // r14
cocos2d::CCArray *Group; // rbx
struct cocos2d::CCObject *v17; // rax
int m_eObjType; // edx
struct cocos2d::CCObject *v19; // r15
GameObject *MainObject; // rdi
cocos2d::CCArray *v21; // r12
cocos2d::ccArray *v22; // rax
__int64 v23; // rcx
GameObject **v24; // r15
GameObject **v25; // rax
GameObject *v26; // rdi
unsigned int m_uID; // eax
int m_nLuaID; // ecx
float v29; // xmm1_4
float v30; // xmm1_4
float v31; // xmm1_4
float v32; // xmm0_4
float v33; // xmm0_4
float v34; // xmm0_4
GameObject_vtbl *v35; // rbx
__int64 v36; // rax
cocos2d::ccArray *v37; // rbx
__int64 v38; // rax
GameObject **v39; // rbx
GameObject **i; // rsi
GameObject *v41; // rdi
__int64 v42; // rax
float v43; // [rsp+28h] [rbp-E0h] BYREF
float v44; // [rsp+2Ch] [rbp-DCh]
float v45; // [rsp+30h] [rbp-D8h] BYREF
float v46; // [rsp+34h] [rbp-D4h]
cocos2d::CCObject **v47; // [rsp+38h] [rbp-D0h]
cocos2d::CCArray *v48; // [rsp+40h] [rbp-C8h]
GameObject *v49; // [rsp+48h] [rbp-C0h]
char v50[8]; // [rsp+50h] [rbp-B8h] BYREF
char v51[8]; // [rsp+58h] [rbp-B0h] BYREF
cocos2d::CCPoint v52; // [rsp+68h] [rbp-A0h] BYREF
__int128 v53[7]; // [rsp+70h] [rbp-98h] BYREF
cocos2d::CCPoint v54; // [rsp+128h] [rbp+20h] BYREF
float v55; // [rsp+130h] [rbp+28h]
float v56; // [rsp+134h] [rbp+2Ch]
GameObject **v57; // [rsp+138h] [rbp+30h]
cocos2d::CCObject **v58; // [rsp+140h] [rbp+38h]
v3 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v3);
cocos2d::CCPoint::CCPoint(v1, v55 * 0.5);
v4 = v55 * 0.5;
v5 = v56 * 0.5;
v6 = (float)(v55 * 0.5) / 240.0;
v7 = (float)(v56 * 0.5) / 160.0;
v9 = (cocos2d::CCArray *)cocos2d::CCArray::create(v8);
m_objects = a1->m_objects;
v48 = v9;
if ( m_objects )
{
data = m_objects->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
v47 = arr;
v58 = &arr[num - 1];
if ( arr <= v58 )
{
v14 = &arr[num - 1];
do
{
v15 = *arr;
if ( !*arr )
return;
if ( v15[18].m_eObjType == 3613 )
{
Group = GJBaseGameLayer::getGroup(a1, v15[26].m_uAutoReleaseCount);
v17 = cocos2d::CCDictionary::objectForKey(a1->m_parentGroupsDict, (int)v15[26].m_uAutoReleaseCount);
m_eObjType = v15[26].m_eObjType;
v19 = v17;
v49 = (GameObject *)v17;
MainObject = GJBaseGameLayer::tryGetMainObject(a1, m_eObjType);
v21 = Group;
if ( v19 )
{
Group = v48;
cocos2d::CCArray::removeAllObjects(v48);
cocos2d::CCArray::addObject(Group, v19);
}
if ( MainObject )
{
if ( Group )
{
((void (__fastcall *)(GameObject *, float *))MainObject->getStartPos)(MainObject, &v45);
v22 = Group->data;
v23 = v22->num;
if ( (_DWORD)v23 )
{
v24 = (GameObject **)v22->arr;
v57 = &v24[v23 - 1];
if ( v24 <= v57 )
{
v25 = &v24[v23 - 1];
while ( 1 )
{
v26 = *v24;
if ( !*v24 )
{
LABEL_55:
arr = v47;
goto LABEL_56;
}
if ( !v26->m_isUIObject )
break;
LABEL_54:
if ( ++v24 > v25 )
goto LABEL_55;
}
GJBaseGameLayer::addUIObject(a1, *v24);
((void (__fastcall *)(GameObject *, float *))v26->getStartPos)(v26, &v43);
cocos2d::CCPoint::CCPoint(&v54);
m_uID = v15[33].m_uID;
m_nLuaID = v15[33].m_nLuaID;
if ( m_uID <= 1 )
m_uID = (v45 <= v43) + 3;
if ( m_nLuaID == 5 || !m_nLuaID )
m_nLuaID = (v46 <= v44) + 7;
switch ( m_uID )
{
case 2u:
v29 = v43 - v45;
if ( LOBYTE(v15[33].m_nTag) )
v29 = v29 * v6;
v30 = v29 + v4;
goto LABEL_32;
case 3u:
v30 = v43 - (float)(v45 - 240.0);
if ( LOBYTE(v15[33].m_nTag) )
v30 = v30 * v6;
goto LABEL_32;
case 4u:
v31 = v43 - (float)(v45 + 240.0);
if ( LOBYTE(v15[33].m_nTag) )
v31 = v31 * v6;
v30 = v31 + v55;
LABEL_32:
v54.x = v30;
break;
}
switch ( m_nLuaID )
{
case 6:
v32 = v44 - v46;
if ( BYTE1(v15[33].m_nTag) )
v32 = v32 * v7;
v33 = v32 + v5;
goto LABEL_44;
case 7:
v33 = v44 - (float)(v46 - 160.0);
if ( BYTE1(v15[33].m_nTag) )
v33 = v33 * v7;
goto LABEL_44;
case 8:
v34 = v44 - (float)(v46 + 160.0);
if ( BYTE1(v15[33].m_nTag) )
v34 = v34 * v7;
v33 = v34 + v56;
LABEL_44:
v54.y = v33;
break;
}
v35 = v26->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v52);
((void (__fastcall *)(GameObject *, __int64))v35->setStartPos)(v26, v36);
if ( v26 == v49 )
{
if ( v21 )
{
cocos2d::CCPoint::operator-(&v54, v50, &v43);
v37 = v21->data;
v38 = v37->num;
if ( (_DWORD)v38 )
{
v39 = (GameObject **)v37->arr;
for ( i = &v39[v38 - 1]; v39 <= i; ++v39 )
{
v41 = *v39;
if ( !*v39 )
break;
if ( !v41->m_isUIObject )
{
GJBaseGameLayer::addUIObject(a1, *v39);
v42 = ((__int64 (__fastcall *)(GameObject *, __int128 *))v41->getStartPos)(v41, v53);
cocos2d::CCPoint::operator+(v42, v51);
((void (__fastcall *)(GameObject *, char *))v41->setStartPos)(v41, v51);
}
}
}
}
}
v25 = v57;
goto LABEL_54;
}
}
}
}
LABEL_56:
v14 = v58;
}
v47 = ++arr;
}
while ( arr <= v14 );
}
}
}
}