//
// cocos2d::CCSpriteBatchNode::atlasIndexForChild from 0x180091320 to 0x180091471 (337 bytes)
//
// 4 xrefs:
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x180091b8e
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x180091c3a
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c0240
//
// 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
//
__int64 __fastcall cocos2d::CCSpriteBatchNode::atlasIndexForChild(
cocos2d::CCSpriteBatchNode *this,
struct cocos2d::CCSprite *a2,
int a3)
{
__int64 v6; // rax
cocos2d::CCArray *v7; // r15
int v8; // r14d
struct cocos2d::CCString *v9; // rbx
cocos2d::CCSpriteBatchNode *v10; // r12
__int64 result; // rax
unsigned int v12; // eax
unsigned int v13; // ecx
cocos2d::CCArray *v14; // rax
cocos2d::CCArray *v15; // rdi
struct cocos2d::CCSprite *Object; // rax
v6 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 504LL))(a2);
v7 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v6 + 480LL))(v6);
v8 = cocos2d::CCArray::indexOfObject(v7, a2);
v9 = nullptr;
v10 = (cocos2d::CCSpriteBatchNode *)(*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 504LL))(a2);
if ( (unsigned int)(v8 - 1) <= 0xFFFFFFFD )
v9 = cocos2d::CCArray::stringAtIndex(v7, v8 - 1);
if ( v10 == this )
{
if ( !v8 )
return 0;
v12 = cocos2d::CCSpriteBatchNode::highestAtlasIndexInChild(this, v9);
return v12 + 1;
}
if ( v8 )
{
if ( ((*(int (__fastcall **)(struct cocos2d::CCString *))(*(_QWORD *)v9 + 96LL))(v9) >= 0 || a3 >= 0)
&& ((*(int (__fastcall **)(struct cocos2d::CCString *))(*(_QWORD *)v9 + 96LL))(v9) < 0 || a3 < 0) )
{
v12 = *(_DWORD *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 504LL))(a2) + 360);
return v12 + 1;
}
v14 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(struct cocos2d::CCString *))(*(_QWORD *)v9 + 480LL))(v9);
v15 = v14;
if ( v14 && (unsigned int)cocos2d::CCArray::count(v14) )
{
Object = cocos2d::CCArray::lastObject(v15);
return cocos2d::CCSpriteBatchNode::highestAtlasIndexInChild(this, Object) + 1;
}
else
{
return (unsigned int)(*((_DWORD *)v9 + 90) + 1);
}
}
else
{
v13 = *(_DWORD *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 504LL))(a2) + 360);
result = v13 + 1;
if ( a3 < 0 )
return v13;
}
return result;
}