//
// cocos2d::ZipUtils::ccInflateCCZFile from 0x5f0238 to 0x5f035a (290 bytes)
//
// 1 xrefs:
// > cocos2d::CCTexturePVR::initWithContentsOfFile @ 0x5f6a10
//
// 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
//
int __fastcall cocos2d::ZipUtils::ccInflateCCZFile(cocos2d::ZipUtils *this, char *a2, unsigned __int8 **a3, int a4)
{
cocos2d::CCFileUtils *v6; // r0
unsigned int *v7; // r0
unsigned int *v8; // r4
void *v9; // r0
int v10; // r8
unsigned int v12; // r2
size_t v13; // r5
int v15; // [sp+4h] [bp-Ch] BYREF
_DWORD v16[2]; // [sp+8h] [bp-8h] BYREF
v16[0] = a3;
v16[1] = a4;
v15 = 0;
v6 = cocos2d::CCFileUtils::sharedFileUtils();
v7 = (unsigned int *)((int (__fastcall *)(cocos2d::CCFileUtils *, cocos2d::ZipUtils *, const char *, int *, cocos2d::ZipUtils *))v6->addSearchResolutionsOrder)(
v6,
this,
"rb",
&v15,
this);
v8 = v7;
if ( !v7 || !v15 )
return -1;
if ( *v7 == 559563587 )
{
if ( ((unsigned __int16)(*((_WORD *)v7 + 3) << 8) | HIBYTE(*((unsigned __int16 *)v7 + 3))) > 2
|| (unsigned __int16)(*((_WORD *)v7 + 2) << 8) | HIBYTE(*((unsigned __int16 *)v7 + 2)) )
{
goto LABEL_7;
}
}
else
{
if ( *v7 != 1884963651 )
{
LABEL_8:
operator delete[](v7);
return -1;
}
if ( (unsigned __int16)(*((_WORD *)v7 + 3) << 8) | HIBYTE(*((unsigned __int16 *)v7 + 3))
|| (v12 = *((unsigned __int16 *)v7 + 2), (unsigned __int16)((_WORD)v12 << 8) | (v12 >> 8)) )
{
LABEL_7:
v7 = v8;
goto LABEL_8;
}
cocos2d::ZipUtils::ccDecodeEncodedPvr(
(cocos2d::ZipUtils *)v7 + 12,
(unsigned int *)((unsigned int)(v15 - 12) >> 2),
v12);
}
v13 = bswap32(v8[3]);
v9 = malloc(v13);
*(_DWORD *)a2 = v9;
if ( !v9 )
goto LABEL_7;
v16[0] = v13;
v10 = uncompress(v9, v16, v8 + 4, v15 - 16);
operator delete[](v8);
if ( v10 )
{
free(*(void **)a2);
*(_DWORD *)a2 = 0;
return -1;
}
return v13;
}