//
// cocos2d::unzReadCurrentFile from 0xd9ef94 to 0xd9f294 (768 bytes)
//
// 4 xrefs:
// > cocos2d::extension::AssetsManager::uncompress @ 0xd09fac
// > cocos2d::CCFileUtils::getFileDataFromZip @ 0xd74820
// > cocos2d::ZipFile::getFileData @ 0xd9b36c
// > ??> @ 0xca060
//
// 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 13:08:28 +0000
//
__int64 __fastcall cocos2d::unzReadCurrentFile(cocos2d *this, __int64 a2, void *a3)
{
__int64 *v3; // x19
__int64 result; // x0
unsigned __int64 v5; // x0
__int64 v6; // x0
unsigned int v7; // w20
unsigned int v8; // w20
unsigned int v9; // w21
unsigned int v10; // w1
unsigned __int64 v11; // x4
unsigned int v12; // w20
__int64 v13; // x3
__int64 v14; // x2
__int64 v15; // x0
__int64 v16; // x25
__int64 v17; // x1
__int64 v18; // x0
unsigned int v19; // w4
__int64 v20; // x2
__int64 v21; // x3
__int64 v22; // x1
__int64 v23; // x1
__int64 v24; // x26
__int64 v25; // x27
unsigned int v26; // w25
__int64 v27; // x20
__int64 v28; // x0
if ( !this )
return 4294967194LL;
v3 = *((__int64 **)this + 40);
if ( !v3 )
return 4294967194LL;
if ( !*v3 )
return 4294967196LL;
result = 0;
if ( (_DWORD)a3 )
{
v5 = v3[24];
v3[4] = a2;
*((_DWORD *)v3 + 10) = (_DWORD)a3;
if ( (unsigned int)a3 > v5 )
{
if ( *((_DWORD *)v3 + 78) )
{
v6 = v3[23];
v7 = *((_DWORD *)v3 + 4);
if ( v6 + (unsigned __int64)v7 >= (unsigned int)a3 )
{
v8 = (unsigned int)a3;
LABEL_12:
v9 = 0;
while ( 2 )
{
if ( !v8 )
return v9;
while ( 1 )
{
v10 = *((_DWORD *)v3 + 4);
if ( !v10 )
break;
v14 = v3[37];
if ( v14 )
goto LABEL_22;
LABEL_32:
if ( v8 > v10 )
v8 = v10;
if ( v8 )
{
v23 = 0;
do
{
*(_BYTE *)(v3[4] + v23) = *(_BYTE *)(v3[1] + v23);
++v23;
}
while ( v8 > (unsigned int)v23 );
}
LABEL_26:
v16 = v8;
v17 = v3[4];
v18 = v3[21];
v3[20] += v8;
v9 += v8;
v3[21] = crc32(v18, v17, v8);
v19 = *((_DWORD *)v3 + 4) - v8;
v8 = *((_DWORD *)v3 + 10) - v8;
v20 = v3[6];
v21 = v3[4] + v16;
v22 = v3[1] + v16;
v3[24] -= v16;
*((_DWORD *)v3 + 4) = v19;
*((_DWORD *)v3 + 10) = v8;
v3[4] = v21;
v3[1] = v22;
v3[6] = v20 + v16;
if ( !v8 )
return v9;
}
v11 = v3[23];
if ( v11 )
{
if ( v11 > 0x3FFF )
v12 = 0x4000;
else
v12 = v3[23];
if ( cocos2d::call_zseek64((__int64)(v3 + 25))
|| v12 != ((__int64 (__fastcall *)(__int64, __int64, _QWORD, _QWORD))v3[26])(v3[32], v3[36], *v3, v12) )
{
return 0xFFFFFFFFLL;
}
v13 = *v3;
v14 = v3[37];
v15 = v3[23] - v12;
v3[15] += v12;
v3[23] = v15;
v3[1] = v13;
*((_DWORD *)v3 + 4) = v12;
if ( !v14 )
{
v10 = v12;
LABEL_39:
v8 = *((_DWORD *)v3 + 10);
goto LABEL_32;
}
}
else
{
v14 = v3[37];
if ( !v14 )
return v9;
}
LABEL_22:
if ( !*((_DWORD *)v3 + 78) )
{
if ( v14 == 12 )
{
LABEL_48:
v8 = *((_DWORD *)v3 + 10);
continue;
}
v24 = v3[6];
v25 = v3[4];
v26 = inflate(v3 + 1, 2);
if ( (v26 & 0x80000000) == 0 && v3[7] )
v26 = -3;
v27 = v3[6];
v28 = v3[21];
v3[20] += v27 - v24;
v9 += v27 - v24;
v3[21] = crc32(v28, v25, (unsigned int)(v27 - v24));
v3[24] -= v27 - v24;
if ( v26 != 1 )
{
if ( !v26 )
goto LABEL_48;
return v26;
}
return v9;
}
break;
}
v10 = *((_DWORD *)v3 + 4);
if ( !v10 )
{
if ( !v3[23] )
return v9;
v8 = 0;
goto LABEL_26;
}
goto LABEL_39;
}
goto LABEL_30;
}
*((_DWORD *)v3 + 10) = v5;
}
v6 = v3[23];
v7 = *((_DWORD *)v3 + 4);
if ( (unsigned int)a3 <= v6 + (unsigned __int64)v7 || !*((_DWORD *)v3 + 78) )
{
v8 = *((_DWORD *)v3 + 10);
goto LABEL_12;
}
LABEL_30:
v8 = v7 + v6;
*((_DWORD *)v3 + 10) = v8;
goto LABEL_12;
}
return result;
}