//
// cocos2d::ZipUtils::ccDecodeEncodedPvr from 0x1800a6d30 to 0x1800a6f1b (491 bytes)
//
// 5 xrefs:
// > cocos2d::ZipUtils::ccInflateCCZFile @ 0x1800a716e
// > ??> @ 0x180148cd0
// > ??> @ 0x180148d14
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c1d1c
//
// This function is hookable on this platform (idp: pc, 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 11:22:16 +0000
//
void __fastcall cocos2d::ZipUtils::ccDecodeEncodedPvr(unsigned int *a1, int a2)
{
signed __int64 v3; // r12
unsigned int v4; // eax
unsigned int v5; // ebx
int v6; // r15d
unsigned int *v7; // rsi
unsigned int __near **v8; // r11
__int64 v9; // r10
__int64 v10; // rbp
__int64 v11; // rdi
unsigned int v12; // r8d
__int64 v13; // rcx
int v14; // r9d
int v15; // r11d
unsigned __int64 v16; // rdx
__int64 v17; // r8
__int64 v18; // rcx
int v19; // eax
signed __int64 v20; // rdx
__int64 v21; // rcx
__int64 v22; // rax
v3 = a2;
if ( !cocos2d::ZipUtils::s_bEncryptionKeyIsValid )
{
v4 = dword_1801B3ABC;
v5 = 0;
v6 = 6;
do
{
v5 -= 1640531527;
v7 = (unsigned int *)&unk_1801B2AC4;
v8 = &cocos2d::ZipUtils::s_uEncryptionKey;
v9 = (v5 >> 2) & 3;
v10 = 1023;
v11 = 0;
do
{
v12 = *v7++;
v8 = (unsigned int __near **)((char *)v8 + 4);
v13 = v9 ^ v11++ & 3;
*((_DWORD *)v8 - 1) += ((v5 ^ v12) + (*((_DWORD *)&cocos2d::ZipUtils::s_uEncryptedPvrKeyParts + v13) ^ v4))
^ (((16 * v4) ^ (v12 >> 3)) + ((v4 >> 5) ^ (4 * v12)));
v4 = *((_DWORD *)v8 - 1);
--v10;
}
while ( v10 );
v4 = (((v5 ^ (unsigned int)cocos2d::ZipUtils::s_uEncryptionKey)
+ (*((_DWORD *)&cocos2d::ZipUtils::s_uEncryptedPvrKeyParts + (v9 ^ 3)) ^ v4))
^ (((16 * v4) ^ ((unsigned int)cocos2d::ZipUtils::s_uEncryptionKey >> 3))
+ ((v4 >> 5) ^ (4 * (_DWORD)cocos2d::ZipUtils::s_uEncryptionKey))))
+ dword_1801B3ABC;
dword_1801B3ABC = v4;
--v6;
}
while ( v6 );
cocos2d::ZipUtils::s_bEncryptionKeyIsValid = 1;
}
v14 = 0;
v15 = 0;
if ( a2 > 0LL )
{
v16 = 0;
v17 = 0;
do
{
if ( v16 >= 0x200 )
break;
v18 = v17 + 1;
a1[v16] ^= *((_DWORD *)&cocos2d::ZipUtils::s_uEncryptionKey + v17);
++v15;
++v16;
v19 = v14 + 1;
v14 = 0;
if ( v17 + 1 < 1024 )
v14 = v19;
v17 = 0;
if ( v18 < 1024 )
v17 = v18;
}
while ( (__int64)v16 < v3 );
}
v20 = v15;
if ( v15 < v3 )
{
v21 = v14;
do
{
a1[v20] ^= *((_DWORD *)&cocos2d::ZipUtils::s_uEncryptionKey + v21);
v22 = v21 + 1;
v21 = 0;
v20 += 64LL;
if ( v22 < 1024 )
v21 = v22;
}
while ( v20 < v3 );
}
}