//
// cocos2d::CCTextureAtlas::initWithTexture from 0x5f4564 to 0x5f4628 (196 bytes)
//
// 5 xrefs:
// > cocos2d::CCAtlasNode::initWithTexture @ 0x5bc796
// > cocos2d::CCParticleBatchNode::initWithTexture @ 0x5dd1d6
// > cocos2d::CCSpriteBatchNode::initWithTexture @ 0x5e83c8
// > cocos2d::CCTextureAtlas::createWithTexture @ 0x5f4648
// > cocos2d::CCTextureAtlas::initWithFile @ 0x5f4686
//
// 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; // r9
cocos2d::ccV3F_C4B_T2F_Quad *v5; // r0
cocos2d::ccV3F_C4B_T2F_Quad *v6; // r5
GLushort *v7; // r0
cocos2d::ccV3F_C4B_T2F_Quad *v8; // r6
cocos2d::CCNotificationCenter *v9; // r0
cocos2d::CCTexture2D *m_pTexture; // r0
a1->m_uCapacity = a3;
a1->m_uTotalQuads = 0;
a1->m_uMaxQuads = 0;
a1->m_pTexture = a2;
if ( a2 )
cocos2d::CCObject::retain(a2);
m_uCapacity = a1->m_uCapacity;
v5 = (cocos2d::ccV3F_C4B_T2F_Quad *)malloc(96 * m_uCapacity);
a1->m_pQuads = v5;
v6 = v5;
v7 = (GLushort *)malloc(12 * m_uCapacity);
v8 = (cocos2d::ccV3F_C4B_T2F_Quad *)v7;
a1->m_pIndices = v7;
if ( !v6 )
{
if ( m_uCapacity )
{
if ( v7 )
{
free(v7);
a1->m_pIndices = nullptr;
}
goto LABEL_12;
}
LABEL_7:
memset(v6, 0, 96 * m_uCapacity);
memset(v8, 0, 12 * m_uCapacity);
v9 = cocos2d::CCNotificationCenter::sharedNotificationCenter();
cocos2d::CCNotificationCenter::addObserver(
v9,
a1,
(cocos2d::SEL_CallFuncO)(unsigned int)cocos2d::CCTextureAtlas::listenBackToForeground,
"event_come_to_foreground",
nullptr);
cocos2d::CCTextureAtlas::setupIndices(a1);
cocos2d::CCTextureAtlas::setupVBO(a1);
a1->m_bDirty = 1;
LOBYTE(m_pTexture) = 1;
return (char)m_pTexture;
}
if ( v7 || !m_uCapacity )
goto LABEL_7;
free(v6);
a1->m_pQuads = v8;
LABEL_12:
m_pTexture = a1->m_pTexture;
if ( m_pTexture )
{
cocos2d::CCObject::release(m_pTexture);
a1->m_pTexture = nullptr;
LOBYTE(m_pTexture) = 0;
}
return (char)m_pTexture;
}