//
// cocos2d::unzOpenCurrentFile3 from 0xb2e190 to 0xb2e6b0 (1312 bytes)
//
// 4 xrefs:
// > cocos2d::unzOpenCurrentFile @ 0xb2e6c0
// > cocos2d::unzOpenCurrentFilePassword @ 0xb2e6d4
// > cocos2d::unzOpenCurrentFile2 @ 0xb2e6dc
// > ??> @ 0xa6a40
//
// 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::unzOpenCurrentFile3(
cocos2d *this,
_DWORD *a2,
int *a3,
int *a4,
__int64 a5,
const char *a6)
{
int v9; // w23
void *v10; // x1
int v11; // w24
int v12; // w0
__int64 v13; // x1
int v14; // w0
__int64 v15; // x1
int v16; // w20
unsigned int v17; // w21
int v18; // w28
__int64 v19; // x26
__int64 v20; // x20
_QWORD *v21; // x24
void *v22; // x0
__int64 v23; // x12
__int64 v24; // x0
__int64 v25; // x0
__int64 v26; // x13
__int64 v27; // x5
__int64 v28; // x3
__int64 v29; // x0
__int64 v30; // x1
__int64 v31; // x6
__int64 v32; // x7
__int64 v33; // x8
__int64 v34; // x9
__int64 v35; // x0
__int64 v37; // x0
int v38; // w0
unsigned int v39; // w1
__int64 v40; // [xsp+68h] [xbp+68h]
__int64 v41; // [xsp+70h] [xbp+70h] BYREF
__int64 v42; // [xsp+78h] [xbp+78h] BYREF
__int64 v43; // [xsp+80h] [xbp+80h] BYREF
__int64 v44; // [xsp+88h] [xbp+88h] BYREF
__int64 v45; // [xsp+90h] [xbp+90h] BYREF
v9 = (int)a4;
if ( a5 || !this || !*((_QWORD *)this + 18) )
return (unsigned int)-102;
v10 = *((void **)this + 40);
if ( v10 )
cocos2d::unzCloseCurrentFile(this, v10);
if ( cocos2d::call_zseek64((__int64)this) )
return (unsigned int)-103;
v11 = -1;
if ( !(unsigned int)sub_B2C394((__int64)this, *((_QWORD *)this + 12), &v41) )
{
if ( v41 == 67324752 )
v11 = 0;
else
v11 = -103;
}
if ( (unsigned int)sub_B2C2CC((__int64)this, *((_QWORD *)this + 12), &v42) )
v11 = -1;
v12 = sub_B2C2CC((__int64)this, *((_QWORD *)this + 12), &v43);
v13 = *((_QWORD *)this + 12);
if ( v12 )
{
v11 = -1;
if ( (unsigned int)sub_B2C2CC((__int64)this, v13, &v42) )
goto LABEL_13;
goto LABEL_12;
}
if ( (unsigned int)sub_B2C2CC((__int64)this, v13, &v42) )
{
LABEL_12:
v11 = -1;
goto LABEL_13;
}
if ( !v11 )
{
v37 = *((_QWORD *)this + 25);
if ( v37 != v42 )
{
v11 = -103;
v38 = sub_B2C394((__int64)this, *((_QWORD *)this + 12), &v42);
v15 = *((_QWORD *)this + 12);
if ( v38 )
goto LABEL_14;
goto LABEL_46;
}
if ( (v37 & 0xFFFFFFFFFFFFFFF7LL) != 0 )
{
if ( v37 == 12 )
v11 = 0;
else
v11 = -103;
}
}
LABEL_13:
v14 = sub_B2C394((__int64)this, *((_QWORD *)this + 12), &v42);
v15 = *((_QWORD *)this + 12);
if ( v14 )
{
LABEL_14:
sub_B2C394((__int64)this, v15, &v42);
LABEL_15:
v11 = -1;
goto LABEL_16;
}
LABEL_46:
if ( (unsigned int)sub_B2C394((__int64)this, v15, &v42) )
goto LABEL_15;
if ( !v11 && *((_QWORD *)this + 27) != v42 )
{
if ( (v43 & 8) != 0 )
v11 = 0;
else
v11 = -103;
if ( (unsigned int)sub_B2C394((__int64)this, *((_QWORD *)this + 12), &v42) )
goto LABEL_17;
goto LABEL_53;
}
LABEL_16:
if ( (unsigned int)sub_B2C394((__int64)this, *((_QWORD *)this + 12), &v42) )
{
LABEL_17:
v11 = -1;
goto LABEL_18;
}
LABEL_53:
if ( !v11 && v42 != 0xFFFFFFFFLL )
{
if ( v42 == *((_QWORD *)this + 28) )
{
v11 = 0;
}
else if ( (v43 & 8) != 0 )
{
v11 = 0;
}
else
{
v11 = -103;
}
}
LABEL_18:
if ( (unsigned int)sub_B2C394((__int64)this, *((_QWORD *)this + 12), &v42) )
{
v11 = -1;
if ( (unsigned int)sub_B2C2CC((__int64)this, *((_QWORD *)this + 12), &v44) )
goto LABEL_25;
goto LABEL_70;
}
if ( v42 != 0xFFFFFFFFLL )
{
if ( v11 )
goto LABEL_24;
if ( v42 != *((_QWORD *)this + 29) && (v43 & 8) == 0 )
{
v11 = -103;
LABEL_24:
if ( (unsigned int)sub_B2C2CC((__int64)this, *((_QWORD *)this + 12), &v44) )
{
LABEL_25:
v16 = v44;
v11 = -1;
goto LABEL_26;
}
goto LABEL_70;
}
if ( (unsigned int)sub_B2C2CC((__int64)this, *((_QWORD *)this + 12), &v44) )
goto LABEL_25;
LABEL_64:
v16 = v44;
if ( *((_QWORD *)this + 30) == v44 )
v11 = 0;
else
v11 = -103;
v17 = sub_B2C2CC((__int64)this, *((_QWORD *)this + 12), &v45);
if ( v17 )
return (unsigned int)-103;
goto LABEL_27;
}
if ( (unsigned int)sub_B2C2CC((__int64)this, *((_QWORD *)this + 12), &v44) )
goto LABEL_25;
if ( !v11 )
goto LABEL_64;
LABEL_70:
v16 = v44;
LABEL_26:
v17 = sub_B2C2CC((__int64)this, *((_QWORD *)this + 12), &v45);
if ( v17 )
return (unsigned int)-103;
LABEL_27:
v18 = v45;
v40 = *((_QWORD *)this + 39);
v19 = v40 + v44 + 30;
v20 = (unsigned int)(v45 + v16);
if ( v11 )
return (unsigned int)-103;
v21 = malloc(0x140u);
if ( !v21 )
return (unsigned int)-104;
v22 = malloc(0x4000u);
v21[17] = v19;
*v21 = v22;
*((_DWORD *)v21 + 36) = v18;
v21[19] = 0;
*((_DWORD *)v21 + 78) = v9;
if ( v22 )
{
v21[16] = 0;
v23 = *((_QWORD *)this + 25);
if ( a2 )
*a2 = v23;
if ( a3 )
{
v24 = *((_QWORD *)this + 24);
*a3 = 6;
v25 = v24 & 6;
switch ( v25 )
{
case 4LL:
*a3 = 2;
break;
case 6LL:
*a3 = 1;
break;
case 2LL:
*a3 = 9;
break;
}
}
v26 = *((_QWORD *)this + 12);
v21[22] = *((_QWORD *)this + 27);
v21[36] = v26;
v21[21] = 0;
v21[20] = 0;
v21[37] = v23;
v27 = *((_QWORD *)this + 1);
v21[25] = *(_QWORD *)this;
v21[26] = v27;
v21[35] = *((_QWORD *)this + 10);
v28 = *((_QWORD *)this + 3);
v29 = *((_QWORD *)this + 4);
v30 = *((_QWORD *)this + 5);
v31 = *((_QWORD *)this + 6);
v32 = *((_QWORD *)this + 7);
v33 = *((_QWORD *)this + 8);
v34 = *((_QWORD *)this + 9);
v21[27] = *((_QWORD *)this + 2);
v21[28] = v28;
v21[29] = v29;
v21[30] = v30;
v21[31] = v31;
v21[32] = v32;
v21[33] = v33;
v21[34] = v34;
v21[38] = *((_QWORD *)this + 15);
v21[6] = 0;
if ( v23 == 12 )
{
if ( !v9 )
*((_DWORD *)v21 + 78) = 1;
}
else if ( v23 == 8 && !v9 )
{
v21[9] = 0;
v21[10] = 0;
v21[11] = 0;
v21[1] = 0;
*((_DWORD *)v21 + 4) = 0;
v39 = inflateInit2_(v21 + 1, 4294967281LL, "1.2.8", 112);
if ( v39 )
{
v17 = v39;
free(v21);
return v17;
}
v40 = *((_QWORD *)this + 39);
v21[16] = 8;
}
v35 = *((_QWORD *)this + 29);
v21[23] = *((_QWORD *)this + 28);
v21[24] = v35;
v21[15] = v20 + 30 + v40;
*((_DWORD *)v21 + 4) = 0;
*((_QWORD *)this + 40) = v21;
*((_DWORD *)this + 82) = 0;
}
else
{
v17 = -104;
free(v21);
}
return v17;
}