//
// cocos2d::CCSpriteBatchNode::insertQuadFromSprite from 0x18008ea50 to 0x18008eba7 (343 bytes)
//
// 4 xrefs:
// > cocos2d::CCTMXLayer::appendTileForGID @ 0x1800abf0a
// > cocos2d::CCTMXLayer::insertTileForGID @ 0x1800ac564
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b603c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall cocos2d::CCSpriteBatchNode::insertQuadFromSprite(
cocos2d::CCSpriteBatchNode *this,
struct cocos2d::CCSprite *a2,
unsigned int a3)
{
int v6; // edi
unsigned int v7; // edi
__int128 v8; // xmm0
__int128 v9; // xmm1
cocos2d::CCTextureAtlas *m_pobTextureAtlas; // rcx
__int128 v11; // xmm0
__int128 v12; // xmm1
__int128 v13; // xmm0
__int128 v14; // xmm1
__int64 v15; // rdx
struct cocos2d::_ccV3F_C4B_T2F_Quad v16; // [rsp+20h] [rbp-88h] BYREF
while ( 1 )
{
if ( a3 < ((unsigned int (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pobTextureAtlas->getCapacity)(this->m_pobTextureAtlas) )
{
v6 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pobTextureAtlas->getCapacity)(this->m_pobTextureAtlas);
if ( v6 != ((unsigned int (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pobTextureAtlas->getTotalQuads)(this->m_pobTextureAtlas) )
break;
}
v7 = (4
* ((unsigned int (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pobTextureAtlas->getCapacity)(this->m_pobTextureAtlas)
+ 4)
/ 3;
if ( ((unsigned int (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pobTextureAtlas->getCapacity)(this->m_pobTextureAtlas) < v7 )
cocos2d::CCTextureAtlas::resizeCapacity(this->m_pobTextureAtlas, v7);
}
((void (__fastcall *)(struct cocos2d::CCSprite *, cocos2d::CCSpriteBatchNode *))a2->setBatchNode)(a2, this);
v8 = *(_OWORD *)&a2->m_sQuad.tl.vertices.x;
a2->m_uAtlasIndex = a3;
v9 = *(_OWORD *)&a2->m_sQuad.tl.texCoords.u;
m_pobTextureAtlas = this->m_pobTextureAtlas;
*(_OWORD *)&v16.tl.vertices.x = v8;
v11 = *(_OWORD *)&a2->m_sQuad.bl.vertices.z;
*(_OWORD *)&v16.tl.texCoords.u = v9;
v12 = *(_OWORD *)&a2->m_sQuad.tr.vertices.x;
*(_OWORD *)&v16.bl.vertices.z = v11;
v13 = *(_OWORD *)&a2->m_sQuad.tr.texCoords.u;
*(_OWORD *)&v16.tr.vertices.x = v12;
v14 = *(_OWORD *)&a2->m_sQuad.br.vertices.z;
*(_OWORD *)&v16.tr.texCoords.u = v13;
*(_OWORD *)&v16.br.vertices.z = v14;
cocos2d::CCTextureAtlas::insertQuad(m_pobTextureAtlas, &v16, a3);
LOBYTE(v15) = 1;
((void (__fastcall *)(struct cocos2d::CCSprite *, __int64))a2->setDirty)(a2, v15);
((void (__fastcall *)(struct cocos2d::CCSprite *))a2->updateTransform)(a2);
}