//
// cocos2d::CCTextureAtlas::initWithTexture from 0xb33004 to 0xb33140 (316 bytes)
//
// 6 xrefs:
// > cocos2d::CCAtlasNode::initWithTexture @ 0xaca430
// > cocos2d::CCParticleBatchNode::initWithTexture @ 0xb02048
// > cocos2d::CCSpriteBatchNode::initWithTexture @ 0xb18228
// > cocos2d::CCTextureAtlas::createWithTexture @ 0xb33174
// > cocos2d::CCTextureAtlas::initWithFile @ 0xb331f8
// > ??> @ 0x67b48
//
// 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
//
bool cocos2d::CCTextureAtlas::initWithTexture(cocos2d::CCTextureAtlas *a1, cocos2d::CCTexture2D *a2, unsigned int a3)
{
unsigned int m_uCapacity; // w21
cocos2d::ccV3F_C4B_T2F_Quad *v5; // x0
cocos2d::ccV3F_C4B_T2F_Quad *v6; // x22
GLushort *v7; // x0
GLushort *v8; // x23
cocos2d::CCNotificationCenter *v9; // x0
cocos2d::CCTexture2D *m_pTexture; // x0
cocos2d::SEL_CallFuncO v12; // 0:x2.16
a1->m_uTotalQuads = 0;
a1->m_uCapacity = a3;
a1->m_uMaxQuads = 0;
a1->m_pTexture = a2;
if ( a2 )
{
cocos2d::CCObject::retain(a2);
m_uCapacity = a1->m_uCapacity;
}
else
{
m_uCapacity = a3;
}
v5 = (cocos2d::ccV3F_C4B_T2F_Quad *)malloc(96LL * m_uCapacity);
a1->m_pQuads = v5;
v6 = v5;
v7 = (GLushort *)malloc(12LL * m_uCapacity);
a1->m_pIndices = v7;
v8 = v7;
if ( v6 && v7 || !m_uCapacity )
{
memset(v6, 0, 96LL * m_uCapacity);
memset(v8, 0, 12LL * m_uCapacity);
v9 = cocos2d::CCNotificationCenter::sharedNotificationCenter();
v12.adj = 0;
v12.ptr = (void (__cdecl *)(cocos2d::CCObject *))cocos2d::CCTextureAtlas::listenBackToForeground;
cocos2d::CCNotificationCenter::addObserver(v9, a1, v12, "event_come_to_foreground", nullptr);
cocos2d::CCTextureAtlas::setupIndices(a1);
cocos2d::CCTextureAtlas::setupVBO(a1);
a1->m_bDirty = 1;
return 1;
}
else
{
if ( v6 )
{
free(v6);
a1->m_pQuads = nullptr;
}
if ( v8 )
{
free(v8);
a1->m_pIndices = nullptr;
}
m_pTexture = a1->m_pTexture;
if ( m_pTexture )
{
cocos2d::CCObject::release(m_pTexture);
a1->m_pTexture = nullptr;
}
return 0;
}
}