//
// cocos2d::CCTextureAtlas::initWithTexture from 0x1800a65c0 to 0x1800a66c5 (261 bytes)
//
// 8 xrefs:
// > cocos2d::CCAtlasNode::initWithTexture @ 0x180001c8a
// > cocos2d::CCParticleBatchNode::initWithTexture @ 0x180061740
// > cocos2d::CCSpriteBatchNode::initWithTexture @ 0x18008e6c4
// > cocos2d::CCTextureAtlas::create @ 0x1800a61dc
// > cocos2d::CCTextureAtlas::createWithTexture @ 0x1800a62b4
// > cocos2d::CCTextureAtlas::initWithFile @ 0x1800a65a8
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b7d1c
//
// 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
//
char __fastcall cocos2d::CCTextureAtlas::initWithTexture(
cocos2d::CCTextureAtlas *this,
struct cocos2d::CCTexture2D *a2,
unsigned int a3)
{
GLushort *v4; // rax
cocos2d::ccV3F_C4B_T2F_Quad *m_pQuads; // rcx
GLushort *m_pIndices; // rcx
cocos2d::CCTexture2D *m_pTexture; // rcx
this->m_uCapacity = a3;
this->m_uTotalQuads = 0;
this->m_uMaxQuads = 0;
this->m_pTexture = a2;
if ( a2 )
cocos2d::CCObject::retain(a2);
this->m_pQuads = (cocos2d::ccV3F_C4B_T2F_Quad *)malloc(96LL * this->m_uCapacity);
v4 = (GLushort *)malloc(12LL * this->m_uCapacity);
m_pQuads = this->m_pQuads;
this->m_pIndices = v4;
if ( m_pQuads && v4 || !this->m_uCapacity )
{
memset(m_pQuads, 0, 96LL * this->m_uCapacity);
memset(this->m_pIndices, 0, 12LL * this->m_uCapacity);
cocos2d::CCTextureAtlas::setupIndices(this);
_glewGenBuffers(2, this->m_pBuffersVBO);
cocos2d::CCTextureAtlas::mapBuffers(this);
this->m_bDirty = 1;
return 1;
}
else
{
if ( m_pQuads )
{
free(m_pQuads);
this->m_pQuads = nullptr;
}
m_pIndices = this->m_pIndices;
if ( m_pIndices )
{
free(m_pIndices);
this->m_pIndices = nullptr;
}
m_pTexture = this->m_pTexture;
if ( m_pTexture )
{
cocos2d::CCObject::release(m_pTexture);
this->m_pTexture = nullptr;
}
return 0;
}
}