//
// GameObject::addMainSpriteToParent from 0x76f820 to 0x76f930 (272 bytes)
//
// 49 xrefs:
// > ParticleGameObject::addMainSpriteToParent @ 0x86f4d8
// > LabelGameObject::addMainSpriteToParent @ 0x870054
// > ??> @ 0xa5388
// > ??> @ 0x14337a0
// > ??> @ 0x1434590
// > ??> @ 0x1434d70
// > ??> @ 0x1435580
// > ??> @ 0x14438e0
// > ??> @ 0x14440f0
// > ??> @ 0x1444900
// > ??> @ 0x1445110
// > ??> @ 0x1445920
// > ??> @ 0x1446130
// > ??> @ 0x1446940
// > ??> @ 0x1447150
// > ??> @ 0x1448140
// > ??> @ 0x1448950
// > ??> @ 0x1449160
// > ??> @ 0x1449970
// > ??> @ 0x144a1c0
// > ??> @ 0x144a9d0
// > ??> @ 0x144b1e0
// > ??> @ 0x144b9f0
// > ??> @ 0x144c200
// > ??> @ 0x144d230
// > ??> @ 0x144da40
// > ??> @ 0x144e250
// > ??> @ 0x144ea60
// > ??> @ 0x144f270
// > ??> @ 0x144fa80
// > ??> @ 0x1450290
// > ??> @ 0x1450aa0
// > ??> @ 0x14512b0
// > ??> @ 0x1451ac0
// > ??> @ 0x14522d0
// > ??> @ 0x1452ae0
// > ??> @ 0x14532f0
// > ??> @ 0x1453b00
// > ??> @ 0x1454310
// > ??> @ 0x1454b20
// > ??> @ 0x1455330
// > ??> @ 0x1455b40
// > ??> @ 0x1456350
// > ??> @ 0x1456b60
// > ??> @ 0x1457370
// > ??> @ 0x1457b80
// > ??> @ 0x1458390
// > ??> @ 0x1458ba0
// > ??> @ 0x14593d0
//
// 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:53:12 +0000
//
__int64 __fastcall GameObject::addMainSpriteToParent(int **this, unsigned __int8 a2)
{
int v3; // w22
__int64 v4; // x21
int ObjectZLayer; // w0
char v6; // w20
int v7; // w1
int ParentMode; // w0
__int64 v9; // x20
GameObject *v10; // x0
void (__fastcall *v11)(__int64, int **, _QWORD); // x21
unsigned int ObjectZOrder; // w0
__int64 result; // x0
int v14; // w1
int v15; // [xsp+38h] [xbp+38h]
v3 = a2;
GameObject::updateBlendMode(this);
v4 = (__int64)*(this + 111);
ObjectZLayer = GameObject::getObjectZLayer((GameObject *)this);
v6 = *((_BYTE *)this + 884);
v7 = ObjectZLayer;
if ( v4 && *((_BYTE *)this + 884) && !*((_BYTE *)this + 885) && !*((_BYTE *)this + 1053) )
v7 = ObjectZLayer + 1;
v15 = v7;
ParentMode = GameObject::getParentMode((GameObject *)this);
v9 = GameObject::parentForZLayer((GameObject *)this, v15, v6, ParentMode);
if ( v9 != (*((__int64 (__fastcall **)(int **))*this + 64))(this) )
{
(*((void (__fastcall **)(int **, _QWORD))*this + 66))(this, 0);
v10 = (GameObject *)this;
v11 = *(void (__fastcall **)(__int64, int **, _QWORD))(*(_QWORD *)v9 + 464LL);
LABEL_6:
ObjectZOrder = GameObject::getObjectZOrder(v10);
v11(v9, this, ObjectZOrder);
goto LABEL_7;
}
if ( v3 )
{
v10 = (GameObject *)this;
v11 = *(void (__fastcall **)(__int64, int **, _QWORD))(*(_QWORD *)v9 + 592LL);
goto LABEL_6;
}
LABEL_7:
result = *((unsigned __int8 *)this + 884);
v14 = *((unsigned __int8 *)this + 1112);
if ( !*((_BYTE *)this + 884) )
result = *((unsigned __int8 *)this + 885);
*((_BYTE *)this + 1112) = result;
if ( (_DWORD)result != v14 )
return (*((__int64 (__fastcall **)(int **))*this + 205))(this);
return result;
}