//
// cocos2d::ZipUtils::ccInflateCCZFile from 0x1800a36e0 to 0x1800a3835 (341 bytes)
//
// 6 xrefs:
// > sub_1800AA090 @ 0x1800aa2ec
// > ??> @ 0x18013f9ec
// > ??> @ 0x18013fa00
// > ??> @ 0x18013fa10
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b7ab8
//
// 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
//
__int64 __fastcall cocos2d::ZipUtils::ccInflateCCZFile(const char *a1, unsigned __int8 **a2)
{
struct cocos2d::CCFileUtils *v4; // rax
__int64 v5; // rax
unsigned int *v6; // rdi
unsigned __int32 v8; // esi
unsigned __int8 *v9; // rax
int v10; // ebx
int v11; // [rsp+60h] [rbp+18h] BYREF
unsigned __int32 v12; // [rsp+68h] [rbp+20h] BYREF
v11 = 0;
v4 = cocos2d::CCFileUtils::sharedFileUtils();
v5 = ((__int64 (__fastcall *)(struct cocos2d::CCFileUtils *, const char *, const char *, int *))v4->addSearchResolutionsOrder)(
v4,
a1,
"rb",
&v11);
v6 = (unsigned int *)v5;
if ( !v5 || !v11 )
return 0xFFFFFFFFLL;
if ( *(_BYTE *)v5 != 67 || *(_BYTE *)(v5 + 1) != 67 || *(_BYTE *)(v5 + 2) != 90 )
goto LABEL_9;
if ( *(_BYTE *)(v5 + 3) == 33 )
{
if ( (HIBYTE(*(unsigned __int16 *)(v5 + 6)) | ((unsigned __int8)*(_WORD *)(v5 + 6) << 8)) > 2u
|| HIBYTE(*(unsigned __int16 *)(v5 + 4)) | ((unsigned __int8)*(_WORD *)(v5 + 4) << 8) )
{
goto LABEL_9;
}
}
else
{
if ( *(_BYTE *)(v5 + 3) != 112
|| HIBYTE(*(unsigned __int16 *)(v5 + 6)) | ((unsigned __int8)*(_WORD *)(v5 + 6) << 8)
|| HIBYTE(*(unsigned __int16 *)(v5 + 4)) | ((unsigned __int8)*(_WORD *)(v5 + 4) << 8) )
{
goto LABEL_9;
}
cocos2d::ZipUtils::ccDecodeEncodedPvr((unsigned int *)(v5 + 12), (unsigned int)(v11 - 12) >> 2);
}
v8 = _byteswap_ulong(v6[3]);
v9 = (unsigned __int8 *)malloc(v8);
*a2 = v9;
if ( !v9 )
{
LABEL_9:
j_j_free_0(v6);
return 0xFFFFFFFFLL;
}
v12 = v8;
v10 = uncompress(v9, &v12, (unsigned int)((_DWORD)v6 + 16), (unsigned int)(v11 - 16));
j_j_free_0(v6);
if ( v10 )
{
free(*a2);
*a2 = nullptr;
return 0xFFFFFFFFLL;
}
return v8;
}