Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- signed int __fastcall cocos2d::ZipUtils::inflateCCZBuffer(cocos2d::ZipUtils *this, const unsigned __int8 *a2, int a3, unsigned __int8 **a4)
- {
- cocos2d::ZipUtils *v4; // r7@1
- int v5; // r12@1
- unsigned int v6; // r8@4
- const unsigned __int8 *v7; // r3@5
- unsigned int v8; // r3@8
- _UNKNOWN *v9; // r5@9
- int v10; // r4@9
- unsigned int v11; // r6@9
- int v12; // r1@10
- int v13; // r0@14
- signed int v14; // r3@14
- signed int v15; // r2@14
- int v16; // r1@15
- int v17; // r1@19
- int v18; // r1@23
- int v19; // r12@23
- int v20; // r3@23
- unsigned int v21; // r12@23
- int v22; // r0@24
- void *v23; // r0@29
- signed int result; // r0@31
- size_t v25; // r4@37
- signed int v26; // [sp+4h] [bp-54h]@7
- void **v27; // [sp+14h] [bp-44h]@1
- size_t v28; // [sp+28h] [bp-30h]@30
- int v29; // [sp+2Ch] [bp-2Ch]@1
- v4 = this;
- v5 = *(_DWORD *)this;
- v27 = (void **)a3;
- v29 = _stack_chk_guard;
- if ( v5 == 559563587 )
- {
- if ( (signed int)((unsigned __int16)(*((_WORD *)this + 3) << 8) | ((unsigned int)*((_WORD *)this + 3) >> 8)) > 2
- || (unsigned __int16)(*((_WORD *)this + 2) << 8) | ((unsigned int)*((_WORD *)this + 2) >> 8) )
- {
- goto LABEL_38;
- }
- }
- else
- {
- if ( v5 != 1884963651 )
- goto LABEL_38;
- if ( (unsigned __int16)(*((_WORD *)this + 3) << 8) | ((unsigned int)*((_WORD *)this + 3) >> 8) )
- goto LABEL_38;
- v6 = ((unsigned __int16)(*((_WORD *)this + 2) << 8) | ((unsigned int)*((_WORD *)this + 2) >> 8)) != 0;
- if ( ((unsigned __int16)(*((_WORD *)this + 2) << 8) | ((unsigned int)*((_WORD *)this + 2) >> 8)) != 0 )
- goto LABEL_38;
- v7 = a2 - 12;
- if ( (signed int)(a2 - 12) < 0 )
- v7 = a2 - 9;
- v26 = (signed int)v7 >> 2;
- if ( !cocos2d::ZipUtils::s_bEncryptionKeyIsValid )
- {
- v8 = cocos2d::ZipUtils::s_uEncryptionKey[1023];
- do
- {
- v9 = (_UNKNOWN *)cocos2d::ZipUtils::s_uEncryptionKey;
- v10 = 0;
- v6 -= 1640531527;
- v11 = v6 >> 2;
- do
- {
- v12 = ((unsigned __int8)v10++ ^ (unsigned __int8)v11) & 3;
- v8 = (((16 * v8 ^ (*((_DWORD *)v9 + 1) >> 3)) + ((v8 >> 5) ^ 4 * *((_DWORD *)v9 + 1))) ^ ((cocos2d::ZipUtils::s_uEncryptedPvrKeyParts[v12] ^ v8)
- + (*((_DWORD *)v9 + 1) ^ v6)))
- + *(_DWORD *)v9;
- *(_DWORD *)v9 = v8;
- v9 = (_UNKNOWN *)((char *)v9 + 4);
- }
- while ( v10 != 1023 );
- v8 = ((((cocos2d::ZipUtils::s_uEncryptionKey[0] >> 3) ^ 16 * v8)
- + (4 * cocos2d::ZipUtils::s_uEncryptionKey[0] ^ (v8 >> 5))) ^ ((cocos2d::ZipUtils::s_uEncryptedPvrKeyParts[~(_BYTE)v11 & 3] ^ v8)
- + (v6 ^ cocos2d::ZipUtils::s_uEncryptionKey[0])))
- + cocos2d::ZipUtils::s_uEncryptionKey[1023];
- cocos2d::ZipUtils::s_uEncryptionKey[1023] = v8;
- }
- while ( v6 != -1253254570 );
- v4 = this;
- cocos2d::ZipUtils::s_bEncryptionKeyIsValid = 1;
- }
- if ( v26 > 0 )
- {
- v13 = (int)((char *)v4 + 16);
- v14 = 0;
- v15 = 1;
- *((_DWORD *)v4 + 3) ^= cocos2d::ZipUtils::s_uEncryptionKey[0];
- while ( 1 )
- {
- v17 = v26 > ++v14;
- if ( v14 > 511 )
- v17 = 0;
- if ( !v17 )
- break;
- v16 = cocos2d::ZipUtils::s_uEncryptionKey[v15];
- if ( v15 + 1 >= 1024 )
- v15 = 0;
- else
- ++v15;
- *(_DWORD *)v13 ^= v16;
- v13 += 4;
- }
- if ( v26 > v14 )
- {
- v18 = v14 + 64;
- v19 = v26 - 1 - v14;
- v20 = (int)((char *)v4 + 4 * v14);
- v21 = (unsigned int)((char *)v4 + 4 * (v18 + (v19 & 0xFFFFFFC0)));
- do
- {
- v22 = *(_DWORD *)(v20 + 12);
- v20 += 256;
- *(_DWORD *)(v20 - 244) = cocos2d::ZipUtils::s_uEncryptionKey[v15] ^ v22;
- if ( v15 + 1 >= 1024 )
- v15 = 0;
- else
- ++v15;
- }
- while ( v20 != v21 );
- }
- }
- }
- v25 = __rev(*((_DWORD *)v4 + 3));
- v23 = malloc(v25);
- *v27 = v23;
- if ( v23 )
- {
- v28 = v25;
- if ( j_uncompress() )
- {
- free(*v27);
- result = -1;
- *v27 = 0;
- }
- else
- {
- result = v25;
- }
- goto LABEL_33;
- }
- LABEL_38:
- result = -1;
- LABEL_33:
- if ( v29 != _stack_chk_guard )
- _stack_chk_fail(result);
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement