//
// cocos2d::unzOpenCurrentFile3 from 0xd9f490 to 0xd9f9a8 (1304 bytes)
//
// 4 xrefs:
// > cocos2d::unzOpenCurrentFile @ 0xd9f9b8
// > cocos2d::unzOpenCurrentFilePassword @ 0xd9f9cc
// > cocos2d::unzOpenCurrentFile2 @ 0xd9f9d4
// > ??> @ 0xdad58
//
// 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::unzOpenCurrentFile3(
cocos2d *this,
_DWORD *a2,
int *a3,
int *a4,
__int64 a5,
const char *a6)
{
int v9; // w22
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
unsigned int v20; // w20
_QWORD *v21; // x24
void *v22; // x0
__int64 v23; // x0
__int64 v24; // x11
__int64 v25; // x13
__int64 v26; // x5
__int64 v27; // x3
__int64 v28; // x0
__int64 v29; // x1
__int64 v30; // x6
__int64 v31; // x7
__int64 v32; // x8
__int64 v33; // x9
__int64 v34; // x1
__int64 v35; // x0
__int64 v37; // x0
int v38; // w0
unsigned int v39; // w1
__int64 v40; // [xsp+60h] [xbp+60h] BYREF
__int64 v41; // [xsp+68h] [xbp+68h] BYREF
__int64 v42; // [xsp+70h] [xbp+70h] BYREF
__int64 v43; // [xsp+78h] [xbp+78h] BYREF
__int64 v44; // [xsp+80h] [xbp+80h] 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_D9D694((__int64)this, *((_QWORD *)this + 12), &v40) )
{
if ( v40 == 67324752 )
v11 = 0;
else
v11 = -103;
}
if ( (unsigned int)sub_D9D5CC((__int64)this, *((_QWORD *)this + 12), &v41) )
v11 = -1;
v12 = sub_D9D5CC((__int64)this, *((_QWORD *)this + 12), &v42);
v13 = *((_QWORD *)this + 12);
if ( v12 )
{
v11 = -1;
if ( (unsigned int)sub_D9D5CC((__int64)this, v13, &v41) )
goto LABEL_13;
goto LABEL_12;
}
if ( (unsigned int)sub_D9D5CC((__int64)this, v13, &v41) )
{
LABEL_12:
v11 = -1;
goto LABEL_13;
}
if ( !v11 )
{
v37 = *((_QWORD *)this + 25);
if ( v37 != v41 )
{
v11 = -103;
v38 = sub_D9D694((__int64)this, *((_QWORD *)this + 12), &v41);
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_D9D694((__int64)this, *((_QWORD *)this + 12), &v41);
v15 = *((_QWORD *)this + 12);
if ( v14 )
{
LABEL_14:
sub_D9D694((__int64)this, v15, &v41);
LABEL_15:
v11 = -1;
goto LABEL_16;
}
LABEL_46:
if ( (unsigned int)sub_D9D694((__int64)this, v15, &v41) )
goto LABEL_15;
if ( !v11 && *((_QWORD *)this + 27) != v41 )
{
if ( (v42 & 8) != 0 )
v11 = 0;
else
v11 = -103;
if ( (unsigned int)sub_D9D694((__int64)this, *((_QWORD *)this + 12), &v41) )
goto LABEL_17;
goto LABEL_53;
}
LABEL_16:
if ( (unsigned int)sub_D9D694((__int64)this, *((_QWORD *)this + 12), &v41) )
{
LABEL_17:
v11 = -1;
goto LABEL_18;
}
LABEL_53:
if ( !v11 && v41 != 0xFFFFFFFFLL )
{
if ( v41 == *((_QWORD *)this + 28) )
{
v11 = 0;
}
else if ( (v42 & 8) != 0 )
{
v11 = 0;
}
else
{
v11 = -103;
}
}
LABEL_18:
if ( (unsigned int)sub_D9D694((__int64)this, *((_QWORD *)this + 12), &v41) )
{
v11 = -1;
if ( (unsigned int)sub_D9D5CC((__int64)this, *((_QWORD *)this + 12), &v43) )
goto LABEL_25;
goto LABEL_70;
}
if ( v41 != 0xFFFFFFFFLL )
{
if ( v11 )
goto LABEL_24;
if ( v41 != *((_QWORD *)this + 29) && (v42 & 8) == 0 )
{
v11 = -103;
LABEL_24:
if ( (unsigned int)sub_D9D5CC((__int64)this, *((_QWORD *)this + 12), &v43) )
{
LABEL_25:
v16 = v43;
v11 = -1;
goto LABEL_26;
}
goto LABEL_70;
}
if ( (unsigned int)sub_D9D5CC((__int64)this, *((_QWORD *)this + 12), &v43) )
goto LABEL_25;
LABEL_64:
v16 = v43;
if ( *((_QWORD *)this + 30) == v43 )
v11 = 0;
else
v11 = -103;
v17 = sub_D9D5CC((__int64)this, *((_QWORD *)this + 12), &v44);
if ( v17 )
return (unsigned int)-103;
goto LABEL_27;
}
if ( (unsigned int)sub_D9D5CC((__int64)this, *((_QWORD *)this + 12), &v43) )
goto LABEL_25;
if ( !v11 )
goto LABEL_64;
LABEL_70:
v16 = v43;
LABEL_26:
v17 = sub_D9D5CC((__int64)this, *((_QWORD *)this + 12), &v44);
if ( v17 )
return (unsigned int)-103;
LABEL_27:
v18 = v44;
v19 = *((_QWORD *)this + 39) + v43 + 30;
v20 = v44 + 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;
if ( a2 )
*a2 = *((_QWORD *)this + 25);
if ( a3 )
{
*a3 = 6;
v23 = *((_QWORD *)this + 24) & 6LL;
switch ( v23 )
{
case 4LL:
*a3 = 2;
break;
case 6LL:
*a3 = 1;
break;
case 2LL:
*a3 = 9;
break;
}
}
v24 = *((_QWORD *)this + 25);
v25 = *((_QWORD *)this + 27);
v21[36] = *((_QWORD *)this + 12);
v21[22] = v25;
v21[21] = 0;
v21[20] = 0;
v21[37] = v24;
v26 = *((_QWORD *)this + 1);
v21[25] = *(_QWORD *)this;
v21[26] = v26;
v21[35] = *((_QWORD *)this + 10);
v27 = *((_QWORD *)this + 3);
v28 = *((_QWORD *)this + 4);
v29 = *((_QWORD *)this + 5);
v30 = *((_QWORD *)this + 6);
v31 = *((_QWORD *)this + 7);
v32 = *((_QWORD *)this + 8);
v33 = *((_QWORD *)this + 9);
v21[27] = *((_QWORD *)this + 2);
v21[28] = v27;
v21[29] = v28;
v21[30] = v29;
v21[31] = v30;
v21[32] = v31;
v21[33] = v32;
v21[34] = v33;
v21[38] = *((_QWORD *)this + 15);
v21[6] = 0;
if ( v24 == 12 )
{
if ( !v9 )
*((_DWORD *)v21 + 78) = 1;
}
else if ( !v9 && v24 == 8 )
{
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;
}
v21[16] = 8;
}
v34 = *((_QWORD *)this + 29);
v35 = *((_QWORD *)this + 39) + 30LL;
v21[23] = *((_QWORD *)this + 28);
v21[24] = v34;
v21[15] = v35 + v20;
*((_DWORD *)v21 + 4) = 0;
*((_QWORD *)this + 40) = v21;
*((_DWORD *)this + 82) = 0;
}
else
{
v17 = -104;
free(v21);
}
return v17;
}