//
// GameObject::addMainSpriteToParent from 0x1002f9f5c to 0x1002fa0b0 (340 bytes)
//
// 48 xrefs:
// > ParticleGameObject::addMainSpriteToParent @ 0x100427140
// > LabelGameObject::addMainSpriteToParent @ 0x10042f950
// > ??> @ 0x10091c5c8
// > ??> @ 0x100928848
// > ??> @ 0x100929040
// > ??> @ 0x100929860
// > ??> @ 0x10094d820
// > ??> @ 0x10094e068
// > ??> @ 0x10094f078
// > ??> @ 0x10094f880
// > ??> @ 0x100950088
// > ??> @ 0x100950890
// > ??> @ 0x100951098
// > ??> @ 0x1009520b0
// > ??> @ 0x100952928
// > ??> @ 0x100953148
// > ??> @ 0x100953968
// > ??> @ 0x100954188
// > ??> @ 0x1009549a8
// > ??> @ 0x1009551c8
// > ??> @ 0x1009559e8
// > ??> @ 0x100956208
// > ??> @ 0x100956a28
// > ??> @ 0x100957248
// > ??> @ 0x100957a80
// > ??> @ 0x1009582e8
// > ??> @ 0x100958b20
// > ??> @ 0x100959358
// > ??> @ 0x100959b90
// > ??> @ 0x10095a3c8
// > ??> @ 0x10095abe8
// > ??> @ 0x10095b408
// > ??> @ 0x10095bc28
// > ??> @ 0x10095c448
// > ??> @ 0x10095cc68
// > ??> @ 0x10095d488
// > ??> @ 0x10095dca8
// > ??> @ 0x10095e4c8
// > ??> @ 0x10095ece8
// > ??> @ 0x10095f508
// > ??> @ 0x10095fd28
// > ??> @ 0x100960548
// > ??> @ 0x100960d68
// > ??> @ 0x100961588
// > ??> @ 0x100961da8
// > ??> @ 0x1009625c8
// > ??> @ 0x100962de8
// > ??> @ 0x10096e1e8
//
// 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 11:03:01 +0000
//
__int64 __fastcall GameObject::addMainSpriteToParent(__int64 a1, int a2)
{
__int64 v4; // x21
unsigned int v5; // w22
bool v6; // zf
__int64 ParentMode; // x23
int v8; // w24
__int64 v9; // x0
__int64 v10; // x8
_OWORD *v11; // x21
__int64 result; // x0
__int64 v13; // x8
int v14; // w8
char v15; // w9
int v16; // w9
sub_1002F9EF8(a1);
v4 = *(unsigned int *)(a1 + 1124);
if ( !(_DWORD)v4 )
v4 = *(unsigned int *)(a1 + 1116);
v5 = *(unsigned __int8 *)(a1 + 884);
v6 = v5 != 1 || *(_QWORD *)(a1 + 888) == 0;
if ( !v6 && (*(_BYTE *)(a1 + 885) & 1) == 0 )
v4 = (unsigned int)v4 + (*(unsigned __int8 *)(a1 + 1053) ^ 1);
ParentMode = GameObject::getParentMode(a1);
v8 = *(unsigned __int8 *)(a1 + 649);
v9 = GameManager::sharedState(ParentMode);
v10 = 544;
if ( v8 )
v10 = 552;
v11 = GJBaseGameLayer::parentForZLayer(*(_QWORD *)(v9 + v10), v4, v5, ParentMode, *(unsigned __int8 *)(a1 + 1345));
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 512LL))(a1);
if ( (_OWORD *)result != v11 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 528LL))(a1, 0);
v13 = 464;
LABEL_13:
result = (*(__int64 (__fastcall **)(_OWORD *, __int64))(*(_QWORD *)v11 + v13))(v11, a1);
goto LABEL_14;
}
if ( a2 )
{
v13 = 592;
goto LABEL_13;
}
LABEL_14:
v14 = *(unsigned __int8 *)(a1 + 1112);
if ( (*(_BYTE *)(a1 + 884) & 1) != 0 )
v15 = 1;
else
v15 = *(_BYTE *)(a1 + 885);
v16 = v15 & 1;
*(_BYTE *)(a1 + 1112) = v16;
if ( v14 != v16 )
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 1640LL))(a1);
return result;
}