//
// cocos2d::CCSpriteBatchNode::appendChild from 0x180091170 to 0x180091314 (420 bytes)
//
// 5 xrefs:
// > cocos2d::CCSprite::addChild @ 0x18008e623
// > cocos2d::CCSpriteBatchNode::addChild @ 0x1800910ba
// > cocos2d::CCSpriteBatchNode::appendChild @ 0x1800912e3
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c0234
//
// 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:22:08 +0000
//
void __fastcall cocos2d::CCSpriteBatchNode::appendChild(cocos2d::CCSpriteBatchNode *this, struct cocos2d::CCSprite *a2)
{
__int64 v4; // rdx
__int64 v5; // rdi
int v6; // ebx
_DWORD *v7; // rbx
__int128 v8; // xmm0
unsigned int v9; // r8d
__int128 v10; // xmm1
cocos2d::CCTextureAtlas *v11; // rcx
__int128 v12; // xmm0
__int128 v13; // xmm1
__int128 v14; // xmm0
__int128 v15; // xmm1
struct cocos2d::CCSprite **v16; // rbx
__int64 v17; // rdi
unsigned __int64 i; // rdi
_OWORD v19[6]; // [rsp+20h] [rbp-88h] BYREF
*((_BYTE *)this + 288) = 1;
(*(void (__fastcall **)(struct cocos2d::CCSprite *, cocos2d::CCSpriteBatchNode *))(*(_QWORD *)a2 + 968LL))(a2, this);
LOBYTE(v4) = 1;
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)a2 + 1048LL))(a2, v4);
if ( !*((_BYTE *)a2 + 559) )
{
v5 = *((_QWORD *)this + 41);
v6 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 72LL))(v5);
if ( v6 == (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v5 + 80LL))(v5) )
cocos2d::CCSpriteBatchNode::increaseAtlasCapacity(this);
v7 = *(_DWORD **)(*((_QWORD *)this + 43) + 56LL);
sub_1800A1310(v7, a2);
v8 = *(_OWORD *)((char *)a2 + 460);
v9 = *v7 - 1;
v10 = *(_OWORD *)((char *)a2 + 476);
*((_DWORD *)a2 + 90) = v9;
v11 = *((cocos2d::CCTextureAtlas **)this + 41);
v19[0] = v8;
v12 = *(_OWORD *)((char *)a2 + 492);
v19[1] = v10;
v13 = *(_OWORD *)((char *)a2 + 508);
v19[2] = v12;
v14 = *(_OWORD *)((char *)a2 + 524);
v19[3] = v13;
v15 = *(_OWORD *)((char *)a2 + 540);
v19[4] = v14;
v19[5] = v15;
cocos2d::CCTextureAtlas::insertQuad(v11, (struct cocos2d::_ccV3F_C4B_T2F_Quad *)v19, v9);
}
if ( (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2) )
{
if ( **(_DWORD **)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2) + 56) )
{
v16 = *(struct cocos2d::CCSprite ***)(*(_QWORD *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2)
+ 56)
+ 16LL);
v17 = *(_QWORD *)(*(_QWORD *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2)
+ 56)
+ 16LL);
for ( i = v17
+ 8LL
* **(unsigned int **)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 480LL))(a2)
+ 56)
- 8; (unsigned __int64)v16 <= i; ++v16 )
{
if ( !*v16 )
break;
cocos2d::CCSpriteBatchNode::appendChild(this, *v16);
}
}
}
}