SHARE
TWEET

Codeedddd

a guest Aug 20th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. signed int __fastcall cocos2d::ZipUtils::inflateCCZBuffer(cocos2d::ZipUtils *this, const unsigned __int8 *a2, int a3, unsigned __int8 **a4)
  2. {
  3.   cocos2d::ZipUtils *v4; // r7@1
  4.   int v5; // r12@1
  5.   unsigned int v6; // r8@4
  6.   const unsigned __int8 *v7; // r3@5
  7.   unsigned int v8; // r3@8
  8.   _UNKNOWN *v9; // r5@9
  9.   int v10; // r4@9
  10.   unsigned int v11; // r6@9
  11.   int v12; // r1@10
  12.   int v13; // r0@14
  13.   signed int v14; // r3@14
  14.   signed int v15; // r2@14
  15.   int v16; // r1@15
  16.   int v17; // r1@19
  17.   int v18; // r1@23
  18.   int v19; // r12@23
  19.   int v20; // r3@23
  20.   unsigned int v21; // r12@23
  21.   int v22; // r0@24
  22.   void *v23; // r0@29
  23.   signed int result; // r0@31
  24.   size_t v25; // r4@37
  25.   signed int v26; // [sp+4h] [bp-54h]@7
  26.   void **v27; // [sp+14h] [bp-44h]@1
  27.   size_t v28; // [sp+28h] [bp-30h]@30
  28.   int v29; // [sp+2Ch] [bp-2Ch]@1
  29.  
  30.   v4 = this;
  31.   v5 = *(_DWORD *)this;
  32.   v27 = (void **)a3;
  33.   v29 = _stack_chk_guard;
  34.   if ( v5 == 559563587 )
  35.   {
  36.     if ( (signed int)((unsigned __int16)(*((_WORD *)this + 3) << 8) | ((unsigned int)*((_WORD *)this + 3) >> 8)) > 2
  37.       || (unsigned __int16)(*((_WORD *)this + 2) << 8) | ((unsigned int)*((_WORD *)this + 2) >> 8) )
  38.     {
  39.       goto LABEL_38;
  40.     }
  41.   }
  42.   else
  43.   {
  44.     if ( v5 != 1884963651 )
  45.       goto LABEL_38;
  46.     if ( (unsigned __int16)(*((_WORD *)this + 3) << 8) | ((unsigned int)*((_WORD *)this + 3) >> 8) )
  47.       goto LABEL_38;
  48.     v6 = ((unsigned __int16)(*((_WORD *)this + 2) << 8) | ((unsigned int)*((_WORD *)this + 2) >> 8)) != 0;
  49.     if ( ((unsigned __int16)(*((_WORD *)this + 2) << 8) | ((unsigned int)*((_WORD *)this + 2) >> 8)) != 0 )
  50.       goto LABEL_38;
  51.     v7 = a2 - 12;
  52.     if ( (signed int)(a2 - 12) < 0 )
  53.       v7 = a2 - 9;
  54.     v26 = (signed int)v7 >> 2;
  55.     if ( !cocos2d::ZipUtils::s_bEncryptionKeyIsValid )
  56.     {
  57.       v8 = cocos2d::ZipUtils::s_uEncryptionKey[1023];
  58.       do
  59.       {
  60.         v9 = (_UNKNOWN *)cocos2d::ZipUtils::s_uEncryptionKey;
  61.         v10 = 0;
  62.         v6 -= 1640531527;
  63.         v11 = v6 >> 2;
  64.         do
  65.         {
  66.           v12 = ((unsigned __int8)v10++ ^ (unsigned __int8)v11) & 3;
  67.           v8 = (((16 * v8 ^ (*((_DWORD *)v9 + 1) >> 3)) + ((v8 >> 5) ^ 4 * *((_DWORD *)v9 + 1))) ^ ((cocos2d::ZipUtils::s_uEncryptedPvrKeyParts[v12] ^ v8)
  68.                                                                                                   + (*((_DWORD *)v9 + 1) ^ v6)))
  69.              + *(_DWORD *)v9;
  70.           *(_DWORD *)v9 = v8;
  71.           v9 = (_UNKNOWN *)((char *)v9 + 4);
  72.         }
  73.         while ( v10 != 1023 );
  74.         v8 = ((((cocos2d::ZipUtils::s_uEncryptionKey[0] >> 3) ^ 16 * v8)
  75.              + (4 * cocos2d::ZipUtils::s_uEncryptionKey[0] ^ (v8 >> 5))) ^ ((cocos2d::ZipUtils::s_uEncryptedPvrKeyParts[~(_BYTE)v11 & 3] ^ v8)
  76.                                                                           + (v6 ^ cocos2d::ZipUtils::s_uEncryptionKey[0])))
  77.            + cocos2d::ZipUtils::s_uEncryptionKey[1023];
  78.         cocos2d::ZipUtils::s_uEncryptionKey[1023] = v8;
  79.       }
  80.       while ( v6 != -1253254570 );
  81.       v4 = this;
  82.       cocos2d::ZipUtils::s_bEncryptionKeyIsValid = 1;
  83.     }
  84.     if ( v26 > 0 )
  85.     {
  86.       v13 = (int)((char *)v4 + 16);
  87.       v14 = 0;
  88.       v15 = 1;
  89.       *((_DWORD *)v4 + 3) ^= cocos2d::ZipUtils::s_uEncryptionKey[0];
  90.       while ( 1 )
  91.       {
  92.         v17 = v26 > ++v14;
  93.         if ( v14 > 511 )
  94.           v17 = 0;
  95.         if ( !v17 )
  96.           break;
  97.         v16 = cocos2d::ZipUtils::s_uEncryptionKey[v15];
  98.         if ( v15 + 1 >= 1024 )
  99.           v15 = 0;
  100.         else
  101.           ++v15;
  102.         *(_DWORD *)v13 ^= v16;
  103.         v13 += 4;
  104.       }
  105.       if ( v26 > v14 )
  106.       {
  107.         v18 = v14 + 64;
  108.         v19 = v26 - 1 - v14;
  109.         v20 = (int)((char *)v4 + 4 * v14);
  110.         v21 = (unsigned int)((char *)v4 + 4 * (v18 + (v19 & 0xFFFFFFC0)));
  111.         do
  112.         {
  113.           v22 = *(_DWORD *)(v20 + 12);
  114.           v20 += 256;
  115.           *(_DWORD *)(v20 - 244) = cocos2d::ZipUtils::s_uEncryptionKey[v15] ^ v22;
  116.           if ( v15 + 1 >= 1024 )
  117.             v15 = 0;
  118.           else
  119.             ++v15;
  120.         }
  121.         while ( v20 != v21 );
  122.       }
  123.     }
  124.   }
  125.   v25 = __rev(*((_DWORD *)v4 + 3));
  126.   v23 = malloc(v25);
  127.   *v27 = v23;
  128.   if ( v23 )
  129.   {
  130.     v28 = v25;
  131.     if ( j_uncompress() )
  132.     {
  133.       free(*v27);
  134.       result = -1;
  135.       *v27 = 0;
  136.     }
  137.     else
  138.     {
  139.       result = v25;
  140.     }
  141.     goto LABEL_33;
  142.   }
  143. LABEL_38:
  144.   result = -1;
  145. LABEL_33:
  146.   if ( v29 != _stack_chk_guard )
  147.     _stack_chk_fail(result);
  148.   return result;
  149. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top