//
// cocos2d::CCTextureAtlas::resizeCapacity from 0x8003e6 to 0x8004d0 (234 bytes)
//
// 3 xrefs:
// > cocos2d::CCLabelAtlas::setString @ 0x7d287c
// > cocos2d::CCParticleBatchNode::increaseAtlasCapacityTo @ 0x7e5bd6
// > cocos2d::CCSpriteBatchNode::increaseAtlasCapacity @ 0x7f2680
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:01:19 +0000
//
int __fastcall cocos2d::CCTextureAtlas::resizeCapacity(cocos2d::CCTextureAtlas *this, unsigned int a2)
{
unsigned int v3; // r6
unsigned int v4; // r3
void *v5; // r8
unsigned int v6; // r7
char *v7; // r0
char *v8; // r5
size_t v9; // r2
char *v10; // r0
unsigned int v11; // r2
int v12; // r1
int v13; // r7
char *v14; // r0
char *v15; // r8
size_t v16; // r2
char *v17; // r0
unsigned int v18; // r2
char *v20; // r0
void *v21; // r0
void *v22; // r0
unsigned int v23; // r1
v3 = *((_DWORD *)this + 18);
if ( a2 == v3 )
return 1;
v4 = *((_DWORD *)this + 17);
v5 = *((void **)this + 20);
*((_DWORD *)this + 18) = a2;
if ( v4 > a2 )
*((_DWORD *)this + 17) = a2;
else
*((_DWORD *)this + 17) = v4;
if ( !v5 )
{
v6 = 96 * a2;
v7 = (char *)malloc(96 * a2);
v8 = v7;
if ( !v7 )
goto LABEL_12;
v9 = v6;
goto LABEL_11;
}
v10 = (char *)realloc(v5, 96 * a2);
v8 = v10;
if ( v10 )
{
v11 = *((_DWORD *)this + 18);
if ( v11 > v3 )
{
v7 = &v10[96 * v3];
v9 = 96 * (v11 - v3);
LABEL_11:
memset(v7, 0, v9);
}
}
LABEL_12:
v12 = *((_DWORD *)this + 18);
if ( *((_DWORD *)this + 13) )
{
v17 = (char *)realloc(*((void **)this + 13), 12 * v12);
v15 = v17;
if ( v17 )
{
v18 = *((_DWORD *)this + 18);
if ( v18 <= v3 )
{
LABEL_28:
if ( v8 )
{
*((_DWORD *)this + 20) = v8;
*((_DWORD *)this + 13) = v15;
cocos2d::CCTextureAtlas::setupIndices((int)this);
cocos2d::CCTextureAtlas::mapBuffers(this, v23);
*((_BYTE *)this + 64) = 1;
return 1;
}
v20 = v15;
goto LABEL_22;
}
v14 = &v17[2 * v3];
v16 = 12 * (v18 - v3);
LABEL_18:
memset(v14, 0, v16);
goto LABEL_28;
}
}
else
{
v13 = 12 * v12;
v14 = (char *)malloc(12 * v12);
v15 = v14;
if ( v14 )
{
v16 = v13;
goto LABEL_18;
}
}
if ( v8 )
{
v20 = v8;
LABEL_22:
free(v20);
}
v21 = *((void **)this + 20);
if ( v21 )
{
free(v21);
*((_DWORD *)this + 20) = 0;
}
v22 = *((void **)this + 13);
if ( v22 )
{
free(v22);
*((_DWORD *)this + 13) = 0;
}
*((_DWORD *)this + 17) = 0;
*((_DWORD *)this + 18) = 0;
return 0;
}