//
// cocos2d::CCTextureAtlas::resizeCapacity from 0x100308100 to 0x10030825c (348 bytes)
//
// 2 xrefs:
// > cocos2d::CCSpriteBatchNode::increaseAtlasCapacity_1 @ 0x100270248
// > cocos2d::CCSpriteBatchNode::increaseAtlasCapacity @ 0x100270294
//
// This function is hookable on this platform (idp: arm, 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:03:09 +0000
//
__int64 __fastcall cocos2d::CCTextureAtlas::resizeCapacity(__int64 a1, unsigned int a2)
{
__int64 v2; // x22
unsigned int v5; // w8
void *v6; // x0
size_t v7; // x1
char *v8; // x0
void *v9; // x20
unsigned int v10; // w8
void *v11; // x0
__int64 v12; // x8
char *v13; // x0
void *v14; // x21
unsigned int v15; // w8
void *v16; // x0
void *v17; // x0
v2 = *(unsigned int *)(a1 + 84);
if ( (_DWORD)v2 == a2 )
return 1;
v5 = *(_DWORD *)(a1 + 80);
if ( v5 >= a2 )
v5 = a2;
*(_DWORD *)(a1 + 80) = v5;
*(_DWORD *)(a1 + 84) = a2;
v6 = *(void **)(a1 + 96);
v7 = 96LL * a2;
if ( v6 )
{
v8 = (char *)realloc(v6, v7);
v9 = v8;
if ( v8 )
{
v10 = *(_DWORD *)(a1 + 84);
if ( v10 > (unsigned int)v2 )
bzero(&v8[96 * (unsigned int)v2], 96LL * (v10 - (unsigned int)v2));
}
}
else
{
v9 = calloc(1u, v7);
}
v11 = *(void **)(a1 + 56);
v12 = *(unsigned int *)(a1 + 84);
if ( v11 )
{
v13 = (char *)realloc(v11, 12 * v12);
if ( v13 )
{
v14 = v13;
v15 = *(_DWORD *)(a1 + 84);
if ( v15 > (unsigned int)v2 )
bzero(&v13[2 * v2], 12LL * (v15 - (unsigned int)v2));
goto LABEL_15;
}
LABEL_17:
if ( !v9 )
goto LABEL_21;
goto LABEL_20;
}
v14 = calloc(1u, 2LL * (unsigned int)(6 * v12));
if ( !v14 )
goto LABEL_17;
LABEL_15:
if ( v9 )
{
*(_QWORD *)(a1 + 96) = v9;
*(_QWORD *)(a1 + 56) = v14;
cocos2d::CCTextureAtlas::setupIndices(a1);
cocos2d::CCTextureAtlas::mapBuffers(a1);
*(_BYTE *)(a1 + 76) = 1;
return 1;
}
v9 = v14;
LABEL_20:
free(v9);
LABEL_21:
v16 = *(void **)(a1 + 96);
if ( v16 )
{
free(v16);
*(_QWORD *)(a1 + 96) = 0;
}
v17 = *(void **)(a1 + 56);
if ( v17 )
{
free(v17);
*(_QWORD *)(a1 + 56) = 0;
}
*(_QWORD *)(a1 + 80) = 0;
return 0;
}