//
// cocos2d::CCTextureAtlas::initWithTexture from 0x1800aa110 to 0x1800aa219 (265 bytes)
//
// 8 xrefs:
// > cocos2d::CCAtlasNode::initWithTexture @ 0x180001c4a
// > cocos2d::CCParticleBatchNode::initWithTexture @ 0x180063b50
// > cocos2d::CCSpriteBatchNode::initWithTexture @ 0x1800918f5
// > cocos2d::CCTextureAtlas::create @ 0x1800a9cfc
// > cocos2d::CCTextureAtlas::createWithTexture @ 0x1800a9dd4
// > cocos2d::CCTextureAtlas::initWithFile @ 0x1800aa0f8
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c1fd4
//
// 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:17 +0000
//
char __fastcall cocos2d::CCTextureAtlas::initWithTexture(
cocos2d::CCTextureAtlas *this,
struct cocos2d::CCTexture2D *a2,
int a3)
{
void *v4; // rax
void *v5; // rcx
void *v6; // rcx
cocos2d::CCObject *v7; // rcx
*((_DWORD *)this + 20) = a3;
*((_DWORD *)this + 19) = 0;
*((_DWORD *)this + 26) = 0;
*((_QWORD *)this + 11) = a2;
if ( a2 )
cocos2d::CCObject::retain(a2);
*((_QWORD *)this + 12) = malloc(96LL * *((unsigned int *)this + 20));
v4 = malloc(2LL * (unsigned int)(6 * *((_DWORD *)this + 20)));
v5 = *((void **)this + 12);
*((_QWORD *)this + 7) = v4;
if ( v5 && v4 || !*((_DWORD *)this + 20) )
{
memset(v5, 0, 96LL * *((unsigned int *)this + 20));
memset(*((void **)this + 7), 0, 2LL * (unsigned int)(6 * *((_DWORD *)this + 20)));
cocos2d::CCTextureAtlas::setupIndices(this);
_glewGenBuffers(2, (char *)this + 64);
cocos2d::CCTextureAtlas::mapBuffers(this);
*((_BYTE *)this + 72) = 1;
return 1;
}
else
{
if ( v5 )
{
free(v5);
*((_QWORD *)this + 12) = 0;
}
v6 = *((void **)this + 7);
if ( v6 )
{
free(v6);
*((_QWORD *)this + 7) = 0;
}
v7 = *((cocos2d::CCObject **)this + 11);
if ( v7 )
{
cocos2d::CCObject::release(v7);
*((_QWORD *)this + 11) = 0;
}
return 0;
}
}