//
// cocos2d::unzOpenCurrentFilePassword from 0x1800a1780 to 0x1800a1995 (533 bytes)
//
// 6 xrefs:
// > ??> @ 0x18013f3c4
// > ??> @ 0x18013f3dc
// > ??> @ 0x18013f3f8
// > ??> @ 0x18013f414
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b792c
//
// 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::unzOpenCurrentFilePassword(cocos2d *this, void *a2, const char *a3)
{
__int64 result; // rax
char *v5; // rbx
void *v6; // rax
__int128 v7; // xmm0
__int128 v8; // xmm1
int v9; // ecx
__int64 v10; // rax
__int128 v11; // xmm0
__int128 v12; // xmm1
__int128 v13; // xmm0
__int64 v14; // rdx
__int64 v15; // rcx
unsigned int v16; // esi
unsigned int v17; // [rsp+48h] [rbp+10h] BYREF
unsigned int v18; // [rsp+50h] [rbp+18h] BYREF
__int64 v19; // [rsp+58h] [rbp+20h] BYREF
if ( a2 || !this || !*((_QWORD *)this + 18) )
return 4294967194LL;
if ( *((_QWORD *)this + 34) )
cocos2d::unzCloseCurrentFile(this, nullptr);
if ( (unsigned int)sub_18009FA30((__int64)this, &v18, &v19, &v17) )
return 4294967193LL;
v5 = (char *)malloc(0x120u);
if ( !v5 )
return 4294967192LL;
v6 = malloc(0x4000u);
*((_QWORD *)v5 + 14) = v19;
*((_DWORD *)v5 + 30) = v17;
*(_QWORD *)v5 = v6;
*((_QWORD *)v5 + 16) = 0;
*((_DWORD *)v5 + 70) = 0;
if ( !v6 )
{
free(v5);
return 4294967192LL;
}
v7 = *(_OWORD *)this;
v8 = *((_OWORD *)this + 1);
v9 = *((_DWORD *)this + 47);
*((_DWORD *)v5 + 37) = *((_DWORD *)this + 49);
*((_QWORD *)v5 + 32) = *((_QWORD *)this + 12);
v10 = *((_QWORD *)this + 15);
*((_DWORD *)v5 + 26) = 0;
*((_DWORD *)v5 + 36) = 0;
*((_QWORD *)v5 + 17) = 0;
*((_DWORD *)v5 + 66) = v9;
*((_QWORD *)v5 + 34) = v10;
*((_DWORD *)v5 + 9) = 0;
*(_OWORD *)(v5 + 168) = v7;
v11 = *((_OWORD *)this + 2);
*(_OWORD *)(v5 + 184) = v8;
v12 = *((_OWORD *)this + 3);
*(_OWORD *)(v5 + 200) = v11;
v13 = *((_OWORD *)this + 4);
*(_OWORD *)(v5 + 216) = v12;
*(_QWORD *)&v12 = *((_QWORD *)this + 10);
*(_OWORD *)(v5 + 232) = v13;
*((_QWORD *)v5 + 31) = v12;
if ( v9 == 12 )
{
*((_DWORD *)v5 + 70) = 1;
}
else if ( v9 == 8 )
{
*((_QWORD *)v5 + 7) = 0;
*((_QWORD *)v5 + 8) = 0;
*((_QWORD *)v5 + 9) = 0;
*((_QWORD *)v5 + 1) = 0;
*((_DWORD *)v5 + 4) = 0;
v16 = inflateInit2_(v5 + 8, 4294967281LL, "1.3.0", 88);
if ( v16 )
{
free(v5);
return v16;
}
*((_DWORD *)v5 + 26) = 8;
}
result = 0;
v14 = v18 + 30LL;
*((_QWORD *)v5 + 19) = *((_QWORD *)this + 25);
v15 = *((_QWORD *)this + 26);
*((_QWORD *)v5 + 12) = *((_QWORD *)this + 33) + v14;
*((_QWORD *)v5 + 20) = v15;
*((_DWORD *)v5 + 4) = 0;
*((_QWORD *)this + 34) = v5;
*((_DWORD *)this + 70) = 0;
return result;
}