//
// GJBaseGameLayer::addUIObject from 0x9cc8a4 to 0x9cca1c (376 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::positionUIObjects @ 0x9ccc58
// > GJBaseGameLayer::positionUIObjects @ 0x9ccda8
// > ??> @ 0x91708
//
// 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:37 +0000
//
__int64 __fastcall GJBaseGameLayer::addUIObject(cocos2d::CCArray **this, GameObject *a2)
{
GameObject *v2; // x19
__int64 v5; // x23
__int64 v6; // x3
GameObject **v7; // x2
int v8; // w0
char *v9; // x3
__int64 v10; // x1
int v11; // [xsp+4Ch] [xbp+4Ch] BYREF
GameObject *v12; // [xsp+50h] [xbp+50h] BYREF
v2 = a2;
if ( !*((_BYTE *)a2 + 1345) )
{
v11 = *((_DWORD *)a2 + 229);
v5 = std::unordered_map::operator[]((__int64)(this + 264), &v11);
(*(void (__fastcall **)(GameObject *))(*(_QWORD *)v2 + 1816LL))(v2);
cocos2d::CCPoint::operator=(v5, &v12);
GJBaseGameLayer::removeObjectFromSection((unsigned __int64)this, v2);
(*(void (__fastcall **)(GameObject *, __int64))(*(_QWORD *)v2 + 1312LL))(v2, 1);
*((_DWORD *)v2 + 157) = -1;
*((_BYTE *)v2 + 1345) = 1;
cocos2d::CCArray::addObject(*(this + 1662), v2);
if ( *((_DWORD *)v2 + 257) == 1816 )
{
v6 = (__int64)*(this + 1688);
v7 = (GameObject **)*(this + 1689);
v12 = v2;
v8 = *((_DWORD *)this + 3382);
if ( ((__int64)v7 - v6) >> 3 > (unsigned __int64)v8 )
{
*(_QWORD *)(v6 + 8LL * v8) = v2;
v2 = v12;
v8 = *((_DWORD *)this + 3382);
}
else if ( v7 == (GameObject **)*(this + 1690) )
{
std::vector::__push_back_slow_path((__int64)(this + 1688), &v12);
v2 = v12;
v8 = *((_DWORD *)this + 3382);
}
else
{
if ( v7 )
{
v9 = (char *)(this + 1536);
*v7 = v2;
v2 = v12;
v10 = (__int64)*(this + 1689);
v8 = *((_DWORD *)this + 3382);
}
else
{
v10 = 0;
v9 = (char *)(this + 1536);
}
*((_QWORD *)v9 + 153) = v10 + 8;
}
*((_DWORD *)this + 3382) = v8 + 1;
*((_DWORD *)v2 + 156) = v8;
}
}
return _stack_chk_guard;
}