//
// cocos2d::CCTextureAtlas::resizeCapacity from 0x1800aa7f0 to 0x1800aa9f2 (514 bytes)
//
// 9 xrefs:
// > cocos2d::CCLabelAtlas::setString @ 0x180047f18
// > cocos2d::CCParticleBatchNode::increaseAtlasCapacityTo @ 0x180063aa7
// > cocos2d::CCParticleBatchNode::insertChild @ 0x180063c60
// > cocos2d::CCSpriteBatchNode::increaseAtlasCapacity @ 0x180091769
// > cocos2d::CCSpriteBatchNode::increaseAtlasCapacity @ 0x1800917c6
// > cocos2d::CCSpriteBatchNode::insertQuadFromSprite @ 0x180091d1c
// > cocos2d::CCSpriteBatchNode::updateQuadFromSprite @ 0x18009277c
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c2058
//
// 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::resizeCapacity(cocos2d::CCTextureAtlas *this, unsigned int a2)
{
float v2; // xmm1_4
__int64 v3; // rbp
unsigned int v6; // ecx
__int64 v7; // rax
void *v8; // rcx
size_t v9; // rdx
char *v10; // rax
char *v11; // rsi
__int64 v12; // r8
char *v13; // rcx
unsigned int v14; // eax
void *v15; // rcx
__int64 v16; // rax
char *v17; // rax
char *v18; // rdi
char *v19; // rcx
__int64 v20; // r8
unsigned int v21; // eax
int v22; // eax
unsigned int v23; // edi
__int64 v24; // r9
__int16 v25; // r10
void *v26; // rcx
void *v27; // rcx
void *v28; // rcx
v3 = *((unsigned int *)this + 20);
if ( a2 == (_DWORD)v3 )
return 1;
v6 = a2;
v7 = a2;
if ( *((_DWORD *)this + 19) < a2 )
v6 = *((_DWORD *)this + 19);
*((_DWORD *)this + 20) = a2;
*((_DWORD *)this + 19) = v6;
v8 = *((void **)this + 12);
v9 = 96LL * a2;
if ( !v8 )
{
v10 = (char *)malloc(96 * v7);
v11 = v10;
if ( !v10 )
goto LABEL_12;
v12 = 3LL * *((unsigned int *)this + 20);
v13 = v10;
goto LABEL_11;
}
v11 = (char *)realloc(v8, v9);
if ( v11 )
{
v14 = *((_DWORD *)this + 20);
if ( v14 > (unsigned int)v3 )
{
v13 = &v11[96 * v3];
v12 = 3LL * (v14 - (unsigned int)v3);
LABEL_11:
memset(v13, 0, 32 * v12);
}
}
LABEL_12:
v15 = *((void **)this + 7);
v16 = *((unsigned int *)this + 20);
if ( !v15 )
{
v17 = (char *)malloc(2LL * (unsigned int)(6 * v16));
v18 = v17;
if ( !v17 )
goto LABEL_19;
v19 = v17;
v20 = (unsigned int)(6 * *((_DWORD *)this + 20));
goto LABEL_18;
}
v18 = (char *)realloc(v15, 12 * v16);
if ( v18 )
{
v21 = *((_DWORD *)this + 20);
if ( v21 > (unsigned int)v3 )
{
v19 = &v18[2 * v3];
v20 = 6 * (v21 - (unsigned int)v3);
LABEL_18:
memset(v19, 0, 2 * v20);
}
}
LABEL_19:
if ( v11 )
{
if ( v18 )
{
v22 = *((_DWORD *)this + 20);
*((_QWORD *)this + 12) = v11;
*((_QWORD *)this + 7) = v18;
if ( v22 )
{
v23 = 0;
do
{
v24 = 6 * v23;
v25 = 4 * v23++;
*(_WORD *)(*((_QWORD *)this + 7) + 2 * v24) = v25;
*(_WORD *)(*((_QWORD *)this + 7) + 2LL * (unsigned int)(v24 + 1)) = v25 + 1;
*(_WORD *)(*((_QWORD *)this + 7) + 2LL * (unsigned int)(v24 + 2)) = v25 + 2;
*(_WORD *)(*((_QWORD *)this + 7) + 2LL * (unsigned int)(v24 + 3)) = v25 + 3;
*(_WORD *)(*((_QWORD *)this + 7) + 2LL * (unsigned int)(v24 + 4)) = v25 + 2;
*(_WORD *)(*((_QWORD *)this + 7) + 2LL * (unsigned int)(v24 + 5)) = v25 + 1;
}
while ( v23 < *((_DWORD *)this + 20) );
}
cocos2d::CCTextureAtlas::mapBuffers(this, v2);
*((_BYTE *)this + 72) = 1;
return 1;
}
v26 = v11;
goto LABEL_28;
}
if ( v18 )
{
v26 = v18;
LABEL_28:
free(v26);
}
v27 = *((void **)this + 12);
if ( v27 )
{
free(v27);
*((_QWORD *)this + 12) = 0;
}
v28 = *((void **)this + 7);
if ( v28 )
{
free(v28);
*((_QWORD *)this + 7) = 0;
}
*(_QWORD *)((char *)this + 76) = 0;
return 0;
}