├── README.md ├── AssetDecoder.h ├── CMakeLists.txt ├── install_boost_1.69.0_vs2015.ps1 ├── main.cpp ├── defs.h └── AssetDecoder.cpp /README.md: -------------------------------------------------------------------------------- 1 | # AzurLane5.0-uabDec 2 | The unity asset bundle decoder for AzurLane5.0 3 | 4 | ## Build 5 | * Boost required 6 | * supports x86 only 7 | 8 | ## Usage 9 | 10 | `uabDec "input_file_path" ["output_file_path"]` 11 | -------------------------------------------------------------------------------- /AssetDecoder.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | struct Il2CppObject 5 | { 6 | void *klass; 7 | void *monitor; 8 | }; 9 | 10 | struct Il2CppArray : public Il2CppObject 11 | { 12 | void *bounds; 13 | int32_t max_length; 14 | }; 15 | 16 | struct FByteArray 17 | { 18 | Il2CppObject obj = { 0 }; 19 | void *bounds = nullptr; 20 | int32_t max_length = 0; 21 | char m_Items[65535]; 22 | }; 23 | 24 | Il2CppArray* NewSpecific(size_t element_size, size_t n); 25 | FByteArray* DigitalSea_Scipio(FByteArray* _AssertArrayIn); -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.0) 2 | project(uabDec VERSION 0.1.0) 3 | 4 | set(CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE x86) 5 | 6 | cmake_policy(SET CMP0074 NEW) 7 | find_package(Boost REQUIRED COMPONENTS system filesystem) 8 | 9 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") 10 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") 11 | 12 | add_executable(uabDec main.cpp AssetDecoder.cpp) 13 | include_directories(${Boost_INCLUDE_DIRS}) 14 | target_link_directories(uabDec PUBLIC ${Boost_LIBRARY_DIRS}) 15 | 16 | message(${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}) -------------------------------------------------------------------------------- /install_boost_1.69.0_vs2015.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Installing boost 1.69.0..." -ForegroundColor Cyan 2 | 3 | $StopWatch = New-Object System.Diagnostics.Stopwatch 4 | $StopWatch.Start() 5 | 6 | New-Item 'C:\Libraries' -ItemType Directory -Force 7 | 8 | # 1.69.0 9 | Measure-Command { 10 | Write-Host "Installing boost 1.69.0..." -ForegroundColor Cyan 11 | 12 | Write-Host "Downloading x86..." 13 | $exePath = "$env:TEMP\boost_1_69_0-msvc-14.0-32.exe" 14 | (New-Object Net.WebClient).DownloadFile('https://bintray.com/boostorg/release/download_file?file_path=1.69.0%2Fbinaries%2Fboost_1_69_0-msvc-14.0-32.exe', $exePath) 15 | 16 | Write-Host "Installing x86..." 17 | cmd /c start /wait "$exePath" /verysilent 18 | del $exePath 19 | 20 | [IO.Directory]::Move('C:\local\boost_1_69_0', 'C:\Libraries\boost_1_69_0') 21 | 22 | Remove-Item 'C:\local' -Force -Recurse 23 | 24 | Write-Host "Compressing..." 25 | 26 | Start-ProcessWithOutput "compact /c /i /q /s:C:\Libraries\boost_1_69_0" -IgnoreStdOut 27 | } 28 | 29 | $StopWatch.Stop() 30 | Write-Host "Boost libraries installed in $("{0:hh}:{0:mm}:{0:ss}" -f $StopWatch.elapsed)" -ForegroundColor Green -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "AssetDecoder.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | void DoDecode(const char* _InputFileName, const char* _OutputFileName) 9 | { 10 | std::ifstream ifs; 11 | ifs.open(_InputFileName, std::ios::binary); 12 | ifs.seekg(0, std::ios::end); 13 | size_t sz = (size_t)ifs.tellg(); 14 | ifs.seekg(0, std::ios::beg); 15 | 16 | FByteArray* gcbuffer = (FByteArray*)NewSpecific(sizeof(char), sz); 17 | ifs.read(gcbuffer->m_Items, sz); 18 | ifs.close(); 19 | 20 | FByteArray* out_assert = DigitalSea_Scipio(gcbuffer); 21 | 22 | std::ofstream ofs; 23 | ofs.open(_OutputFileName, std::ios::binary | std::ios::trunc); 24 | ofs.write(out_assert->m_Items, out_assert->max_length); 25 | ofs.close(); 26 | } 27 | 28 | 29 | int main(int _argc, char **_argv) 30 | { 31 | switch (_argc) 32 | { 33 | case 2: 34 | { 35 | boost::filesystem::path InputFilePath(_argv[1]); 36 | std::string filename = InputFilePath.filename().stem().string(); 37 | filename.append("_dec"); 38 | filename.append(InputFilePath.filename().extension().string()); 39 | 40 | std::string OutPath = InputFilePath.parent_path().append(filename).string().c_str(); 41 | DoDecode(_argv[1], OutPath.c_str()); 42 | break; 43 | } 44 | case 3: 45 | { 46 | DoDecode(_argv[1], _argv[2]); 47 | break; 48 | } 49 | default: 50 | { 51 | std::cout << R"(Usage: uabDec "input_file_path" ["output_file_path"] )" << std::endl; 52 | break; 53 | } 54 | } 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file contains definitions used by the Hex-Rays decompiler output. 4 | It has type definitions and convenience macros to make the 5 | output more readable. 6 | 7 | Copyright (c) 2007-2017 Hex-Rays 8 | 9 | */ 10 | #pragma once 11 | 12 | #ifndef HEXRAYS_DEFS_H 13 | #define HEXRAYS_DEFS_H 14 | 15 | #if defined(__GNUC__) 16 | typedef long long ll; 17 | typedef unsigned long long ull; 18 | #define __int64 long long 19 | #define __int32 int 20 | #define __int16 short 21 | #define __int8 char 22 | #define MAKELL(num) num ## LL 23 | #define FMT_64 "ll" 24 | #elif defined(_MSC_VER) 25 | typedef __int64 ll; 26 | typedef unsigned __int64 ull; 27 | #define MAKELL(num) num ## i64 28 | #define FMT_64 "I64" 29 | #elif defined (__BORLANDC__) 30 | typedef __int64 ll; 31 | typedef unsigned __int64 ull; 32 | #define MAKELL(num) num ## i64 33 | #define FMT_64 "L" 34 | #else 35 | #error "unknown compiler" 36 | #endif 37 | typedef unsigned int uint; 38 | typedef unsigned char uchar; 39 | typedef unsigned short ushort; 40 | typedef unsigned long ulong; 41 | 42 | typedef char int8; 43 | typedef signed char sint8; 44 | typedef unsigned char uint8; 45 | typedef short int16; 46 | typedef signed short sint16; 47 | typedef unsigned short uint16; 48 | typedef int int32; 49 | typedef signed int sint32; 50 | typedef unsigned int uint32; 51 | typedef ll int64; 52 | typedef ll sint64; 53 | typedef ull uint64; 54 | 55 | // Partially defined types. They are used when the decompiler does not know 56 | // anything about the type except its size. 57 | #define _BYTE uint8 58 | #define _WORD uint16 59 | #define _DWORD uint32 60 | #define _QWORD uint64 61 | #if !defined(_MSC_VER) 62 | #define _LONGLONG __int128 63 | #endif 64 | 65 | // Non-standard boolean types. They are used when the decompiler can not use 66 | // the standard "bool" type because of the size mistmatch but the possible 67 | // values are only 0 and 1. See also 'BOOL' type below. 68 | typedef int8 _BOOL1; 69 | typedef int16 _BOOL2; 70 | typedef int32 _BOOL4; 71 | 72 | #ifndef _WINDOWS_ 73 | typedef int8 BYTE; 74 | typedef int16 WORD; 75 | typedef int32 DWORD; 76 | typedef int32 LONG; 77 | typedef int BOOL; // uppercase BOOL is usually 4 bytes 78 | #endif 79 | typedef int64 QWORD; 80 | #ifndef __cplusplus 81 | typedef int bool; // we want to use bool in our C programs 82 | #endif 83 | 84 | #define __pure // pure function: always returns the same value, has no 85 | // side effects 86 | 87 | // Non-returning function 88 | #if defined(__GNUC__) 89 | #define __noreturn __attribute__((noreturn)) 90 | #else 91 | #define __noreturn __declspec(noreturn) 92 | #endif 93 | 94 | 95 | #ifndef NULL 96 | #define NULL 0 97 | #endif 98 | 99 | // Some convenience macros to make partial accesses nicer 100 | #define LAST_IND(x,part_type) (sizeof(x)/sizeof(part_type) - 1) 101 | #if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN 102 | # define LOW_IND(x,part_type) LAST_IND(x,part_type) 103 | # define HIGH_IND(x,part_type) 0 104 | #else 105 | # define HIGH_IND(x,part_type) LAST_IND(x,part_type) 106 | # define LOW_IND(x,part_type) 0 107 | #endif 108 | // first unsigned macros: 109 | #define BYTEn(x, n) (*((_BYTE*)&(x)+n)) 110 | #define WORDn(x, n) (*((_WORD*)&(x)+n)) 111 | #define DWORDn(x, n) (*((_DWORD*)&(x)+n)) 112 | 113 | #define LOBYTE(x) BYTEn(x,LOW_IND(x,_BYTE)) 114 | #define LOWORD(x) WORDn(x,LOW_IND(x,_WORD)) 115 | #define LODWORD(x) DWORDn(x,LOW_IND(x,_DWORD)) 116 | #define HIBYTE(x) BYTEn(x,HIGH_IND(x,_BYTE)) 117 | #define HIWORD(x) WORDn(x,HIGH_IND(x,_WORD)) 118 | #define HIDWORD(x) DWORDn(x,HIGH_IND(x,_DWORD)) 119 | #define BYTE1(x) BYTEn(x, 1) // byte 1 (counting from 0) 120 | #define BYTE2(x) BYTEn(x, 2) 121 | #define BYTE3(x) BYTEn(x, 3) 122 | #define BYTE4(x) BYTEn(x, 4) 123 | #define BYTE5(x) BYTEn(x, 5) 124 | #define BYTE6(x) BYTEn(x, 6) 125 | #define BYTE7(x) BYTEn(x, 7) 126 | #define BYTE8(x) BYTEn(x, 8) 127 | #define BYTE9(x) BYTEn(x, 9) 128 | #define BYTE10(x) BYTEn(x, 10) 129 | #define BYTE11(x) BYTEn(x, 11) 130 | #define BYTE12(x) BYTEn(x, 12) 131 | #define BYTE13(x) BYTEn(x, 13) 132 | #define BYTE14(x) BYTEn(x, 14) 133 | #define BYTE15(x) BYTEn(x, 15) 134 | #define WORD1(x) WORDn(x, 1) 135 | #define WORD2(x) WORDn(x, 2) // third word of the object, unsigned 136 | #define WORD3(x) WORDn(x, 3) 137 | #define WORD4(x) WORDn(x, 4) 138 | #define WORD5(x) WORDn(x, 5) 139 | #define WORD6(x) WORDn(x, 6) 140 | #define WORD7(x) WORDn(x, 7) 141 | 142 | // now signed macros (the same but with sign extension) 143 | #define SBYTEn(x, n) (*((int8*)&(x)+n)) 144 | #define SWORDn(x, n) (*((int16*)&(x)+n)) 145 | #define SDWORDn(x, n) (*((int32*)&(x)+n)) 146 | 147 | #define SLOBYTE(x) SBYTEn(x,LOW_IND(x,int8)) 148 | #define SLOWORD(x) SWORDn(x,LOW_IND(x,int16)) 149 | #define SLODWORD(x) SDWORDn(x,LOW_IND(x,int32)) 150 | #define SHIBYTE(x) SBYTEn(x,HIGH_IND(x,int8)) 151 | #define SHIWORD(x) SWORDn(x,HIGH_IND(x,int16)) 152 | #define SHIDWORD(x) SDWORDn(x,HIGH_IND(x,int32)) 153 | #define SBYTE1(x) SBYTEn(x, 1) 154 | #define SBYTE2(x) SBYTEn(x, 2) 155 | #define SBYTE3(x) SBYTEn(x, 3) 156 | #define SBYTE4(x) SBYTEn(x, 4) 157 | #define SBYTE5(x) SBYTEn(x, 5) 158 | #define SBYTE6(x) SBYTEn(x, 6) 159 | #define SBYTE7(x) SBYTEn(x, 7) 160 | #define SBYTE8(x) SBYTEn(x, 8) 161 | #define SBYTE9(x) SBYTEn(x, 9) 162 | #define SBYTE10(x) SBYTEn(x, 10) 163 | #define SBYTE11(x) SBYTEn(x, 11) 164 | #define SBYTE12(x) SBYTEn(x, 12) 165 | #define SBYTE13(x) SBYTEn(x, 13) 166 | #define SBYTE14(x) SBYTEn(x, 14) 167 | #define SBYTE15(x) SBYTEn(x, 15) 168 | #define SWORD1(x) SWORDn(x, 1) 169 | #define SWORD2(x) SWORDn(x, 2) 170 | #define SWORD3(x) SWORDn(x, 3) 171 | #define SWORD4(x) SWORDn(x, 4) 172 | #define SWORD5(x) SWORDn(x, 5) 173 | #define SWORD6(x) SWORDn(x, 6) 174 | #define SWORD7(x) SWORDn(x, 7) 175 | 176 | 177 | // Helper functions to represent some assembly instructions. 178 | 179 | 180 | 181 | // The following definition is not quite correct because it always returns 182 | // uint64. The above C++ functions are good, though. 183 | #define __PAIR__(high, low) (((uint64)(high)<>y) 189 | #define __CFADD__(x, y) invalid_operation // Generate carry flag for (x+y) 190 | #define __CFSUB__(x, y) invalid_operation // Generate carry flag for (x-y) 191 | #define __OFADD__(x, y) invalid_operation // Generate overflow flag for (x+y) 192 | #define __OFSUB__(x, y) invalid_operation // Generate overflow flag for (x-y) 193 | 194 | 195 | 196 | // No definition for rcl/rcr because the carry flag is unknown 197 | #define __RCL__(x, y) invalid_operation // Rotate left thru carry 198 | #define __RCR__(x, y) invalid_operation // Rotate right thru carry 199 | #define __MKCRCL__(x, y) invalid_operation // Generate carry flag for a RCL 200 | #define __MKCRCR__(x, y) invalid_operation // Generate carry flag for a RCR 201 | #define __SETP__(x, y) invalid_operation // Generate parity flag for (x-y) 202 | 203 | // In the decompilation listing there are some objects declarared as _UNKNOWN 204 | // because we could not determine their types. Since the C compiler does not 205 | // accept void item declarations, we replace them by anything of our choice, 206 | // for example a char: 207 | 208 | #define _UNKNOWN char 209 | 210 | #ifdef _MSC_VER 211 | #define snprintf _snprintf 212 | #define vsnprintf _vsnprintf 213 | #endif 214 | 215 | #endif // HEXRAYS_DEFS_H 216 | -------------------------------------------------------------------------------- /AssetDecoder.cpp: -------------------------------------------------------------------------------- 1 | 2 | // 3 | #include "AssetDecoder.h" 4 | #include "defs.h" 5 | #include 6 | #include 7 | #include 8 | 9 | const unsigned char key_bytes[76] = 10 | { 11 | 0xBC, 0x4B, 0x77, 0x1D, 0xE8, 0xC0, 0x96, 0x00, 0x8C, 0xA2, 0x69, 0x00, 0xB9, 0xCB, 0xDA, 0x35, 12 | 0xC2, 0xCE, 0x63, 0x00, 0xA5, 0x6B, 0x5A, 0x00, 0x2E, 0x71, 0x92, 0x14, 0x19, 0xDE, 0x92, 0x00, 13 | 0x93, 0x62, 0x0B, 0x00, 0x46, 0x56, 0xDF, 0x03, 0xC2, 0x63, 0x50, 0x00, 0xD5, 0x93, 0x72, 0x00, 14 | 0xA3, 0x5B, 0x5E, 0x00, 0xCB, 0xAF, 0xC3, 0x30, 0x76, 0xA6, 0x1C, 0x01, 0xAD, 0x4E, 0x78, 0x00, 15 | 0x02, 0xB9, 0x4B, 0x00, 0x8C, 0xF4, 0x49, 0x00, 0x54, 0x39, 0x81, 0x05 16 | }; 17 | 18 | Il2CppArray* NewSpecific(size_t element_size, size_t n) 19 | { 20 | size_t ByteLen = n * element_size; 21 | size_t ByteLenAlloc = ByteLen + 16; 22 | Il2CppArray* arr = (Il2CppArray*)malloc(ByteLenAlloc); 23 | arr->klass = 0; 24 | arr->monitor = 0; 25 | arr->bounds = 0; 26 | memset((char*)arr + 8, 0, ByteLen + 8); 27 | arr->max_length = n; 28 | return arr; 29 | } 30 | 31 | FByteArray* DigitalSea_Scipio(FByteArray* _AssertArrayIn) 32 | { 33 | unsigned int max_length_v1; 34 | uint32_t max_length_v2; 35 | int buf_2ndLast_byte; 36 | int buf_3rdLast_byte; 37 | unsigned int v8; 38 | int wrapper_size; 39 | int dec_buf_size; 40 | int *dec_buf; 41 | FByteArray *dec_buf_1; 42 | int ptr_bytes_array_1; 43 | uintptr_t v21; 44 | uint32_t enc_data_size; 45 | FByteArray *Scipio_GcBuffer; 46 | uint8_t v26; 47 | int v29; 48 | uint32_t i; 49 | FByteArray *Scipio_GcBuffer_2; 50 | int gcbuf_i; 51 | int dec_i; 52 | int v38; 53 | FByteArray *Scipio_GcBuffer_3; 54 | int v41; 55 | unsigned int dec_buf_size_1; 56 | unsigned int v45; 57 | int ptr_bytes_array_2; 58 | int v47; 59 | int v51; 60 | int v53; 61 | int v54; 62 | int v59; 63 | int v61; 64 | int *v62; 65 | int v63; 66 | unsigned int v65; 67 | uint32_t *v66; 68 | unsigned int v68; 69 | unsigned int v70; 70 | unsigned int v71; 71 | int v75; 72 | signed int v77; 73 | unsigned int v78; 74 | int v81; 75 | unsigned int v83; 76 | int v84; 77 | unsigned int v85; 78 | unsigned int v86; 79 | unsigned int v87; 80 | unsigned int v89; 81 | uint32_t *v91; 82 | int v93; 83 | unsigned int v94; 84 | unsigned int v96; 85 | uint32_t *v98; 86 | int v100; 87 | uint32_t *v101; 88 | unsigned int v104; 89 | unsigned int v105; 90 | uint32_t v106; 91 | unsigned int v107; 92 | unsigned int v108; 93 | unsigned int v112; 94 | int v116; 95 | unsigned int v118; 96 | int v121; 97 | int v123; 98 | int v125; 99 | int v128; 100 | int v132; 101 | unsigned int v136; 102 | unsigned int v138; 103 | unsigned int v141; 104 | unsigned int v143; 105 | int v146; 106 | int v150; 107 | unsigned int v154; 108 | unsigned int v156; 109 | unsigned int v159; 110 | unsigned int v161; 111 | uint8_t v164; 112 | unsigned int dec_buf_size_minus8; 113 | unsigned int v169; 114 | unsigned int v170; 115 | unsigned int v171; 116 | unsigned int v172; 117 | unsigned int v173; 118 | unsigned int v174; 119 | unsigned int v175; 120 | FByteArray *dec_buf_2; 121 | unsigned int v177; 122 | unsigned int v178; 123 | unsigned int *p_max_length; 124 | int v180; 125 | int v181; 126 | int v182; 127 | unsigned int v183; 128 | int *v184; 129 | int v185; 130 | unsigned int v186; 131 | int v187; 132 | int v188; 133 | unsigned int v189; 134 | unsigned int v190; 135 | int v191; 136 | unsigned int v193; 137 | int v194; 138 | int v195; 139 | int v196; 140 | unsigned int v197; 141 | unsigned int v198; 142 | int v199; 143 | int v200; 144 | int v201; 145 | unsigned int v202; 146 | unsigned int v203; 147 | int buf_last_byte; 148 | uint32_t *dec_key; 149 | 150 | int ptr_bytes_array = (int)_AssertArrayIn; 151 | FByteArray* pGcBuffer = nullptr; 152 | 153 | if (ptr_bytes_array) 154 | { 155 | p_max_length = (unsigned int *)(ptr_bytes_array + 12); 156 | max_length_v1 = *(_DWORD *)(ptr_bytes_array + 12); 157 | max_length_v2 = *(_DWORD *)(ptr_bytes_array + 12); 158 | } 159 | else 160 | { 161 | assert(false); 162 | } 163 | 164 | if (*p_max_length <= max_length_v2 - 1) 165 | { 166 | assert(false); 167 | } 168 | buf_last_byte = *(unsigned __int8 *)(ptr_bytes_array + max_length_v2 - 1 + 16); 169 | 170 | if (*p_max_length <= max_length_v2 - 2) 171 | { 172 | assert(false); 173 | } 174 | buf_2ndLast_byte = *(unsigned __int8 *)(ptr_bytes_array + max_length_v2 - 2 + 16); 175 | 176 | if (*p_max_length <= max_length_v2 - 3) 177 | { 178 | assert(false); 179 | } 180 | buf_3rdLast_byte = *(unsigned __int8 *)(ptr_bytes_array + max_length_v2 - 3 + 16); 181 | 182 | v8 = max_length_v2 - 4; 183 | if (*p_max_length <= v8) 184 | { 185 | assert(false); 186 | } 187 | 188 | wrapper_size = (buf_last_byte + (buf_2ndLast_byte << 8)) | (buf_3rdLast_byte << 16) | (*(unsigned __int8 *)(ptr_bytes_array + v8 + 16) << 24); 189 | dec_buf_size = *p_max_length - 4 - wrapper_size; 190 | 191 | dec_buf = (int*)NewSpecific(sizeof(char), dec_buf_size); 192 | assert(dec_buf); 193 | dec_buf_1 = (FByteArray *)dec_buf; 194 | dec_buf_2 = (FByteArray *)dec_buf; 195 | 196 | dec_key = (uint32_t*)NewSpecific(sizeof(uint32_t), 19); 197 | assert(dec_key); 198 | 199 | FByteArray* key_array = (FByteArray*)dec_key; 200 | memcpy(key_array->m_Items, key_bytes, 76); 201 | 202 | if (wrapper_size <= 0) 203 | { 204 | pGcBuffer = 0; 205 | } 206 | else 207 | { 208 | dec_buf_2 = dec_buf_1; 209 | pGcBuffer = (FByteArray*)(NewSpecific(sizeof(char), wrapper_size)); 210 | ptr_bytes_array_1 = ptr_bytes_array; 211 | 212 | v187 = *p_max_length - 4 - wrapper_size; 213 | v185 = ptr_bytes_array + *p_max_length + 12 - wrapper_size; 214 | v21 = 0; 215 | while (1) 216 | { 217 | enc_data_size = v187 + v21; 218 | if (enc_data_size >= (signed int)(*p_max_length - 4)) 219 | break; 220 | 221 | Scipio_GcBuffer = pGcBuffer; 222 | 223 | if (*p_max_length <= enc_data_size) 224 | { 225 | assert(false); 226 | } 227 | v26 = *(_BYTE *)(v185 + v21); 228 | 229 | if ((uint32_t)Scipio_GcBuffer->max_length <= v21) 230 | { 231 | assert(false); 232 | } 233 | 234 | Scipio_GcBuffer->m_Items[v21++] = v26; 235 | ptr_bytes_array_1 = ptr_bytes_array; 236 | } 237 | v29 = 235; 238 | for (i = 0; ; ++i) 239 | { 240 | v193 = v29; 241 | Scipio_GcBuffer_2 = pGcBuffer; 242 | if ((signed int)i >= (signed int)Scipio_GcBuffer_2->max_length) 243 | break; 244 | 245 | if ((uint32_t)pGcBuffer->max_length <= i) 246 | { 247 | assert(false); 248 | } 249 | gcbuf_i = pGcBuffer->m_Items[i]; 250 | dec_i = gcbuf_i ^ (v193 >> 8); 251 | v38 = v193 + gcbuf_i; 252 | Scipio_GcBuffer_3 = pGcBuffer; 253 | 254 | v41 = 205 * v38; 255 | if ((uint32_t)Scipio_GcBuffer_3->max_length <= i) 256 | { 257 | assert(false); 258 | } 259 | v29 = v41 + 207; 260 | Scipio_GcBuffer_3->m_Items[i] = dec_i; 261 | } 262 | } 263 | 264 | v184 = (int*)NewSpecific(sizeof(uint32_t), 2); 265 | assert(v184); 266 | dec_buf_size_1 = dec_buf_1->max_length; 267 | dec_buf_size_minus8 = dec_buf_size_1 - 8; 268 | v45 = 0; 269 | ptr_bytes_array_2 = ptr_bytes_array; 270 | if (dec_buf_size_1 != 8) 271 | { 272 | v47 = 0; 273 | v45 = 0; 274 | do 275 | { 276 | v177 = v47; 277 | 278 | if (*p_max_length <= v45) 279 | { 280 | assert(false); 281 | } 282 | v199 = *(unsigned __int8 *)(ptr_bytes_array_2 + v45 + 16); 283 | 284 | if (*p_max_length <= (v45 | 1)) 285 | { 286 | assert(false); 287 | } 288 | v194 = *(unsigned __int8 *)(ptr_bytes_array_2 + (v45 | 1) + 16); 289 | v169 = v45 | 1; 290 | 291 | v178 = v45; 292 | if (*p_max_length <= (v45 | 2)) 293 | { 294 | assert(false); 295 | } 296 | v170 = v45 | 2; 297 | v51 = *(unsigned __int8 *)(ptr_bytes_array_2 + (v45 | 2) + 16); 298 | 299 | if (*p_max_length <= (v45 | 3)) 300 | { 301 | assert(false); 302 | } 303 | v53 = *(unsigned __int8 *)(ptr_bytes_array_2 + (v45 | 3) + 16); 304 | v172 = v45 | 3; 305 | 306 | v54 = (v199 + (v194 << 8)) | (v51 << 16) | (v53 << 24); 307 | if (!v184[3]) 308 | { 309 | assert(false); 310 | } 311 | v184[4] = v54; 312 | 313 | if (*p_max_length <= (v45 | 4)) 314 | { 315 | assert(false); 316 | } 317 | v200 = *(unsigned __int8 *)(ptr_bytes_array + (v45 | 4) + 16); 318 | v171 = v45 | 4; 319 | 320 | if (*p_max_length <= (v45 | 5)) 321 | { 322 | assert(false); 323 | } 324 | v195 = *(unsigned __int8 *)(ptr_bytes_array + (v45 | 5) + 16); 325 | v173 = v45 | 5; 326 | 327 | if (*p_max_length <= (v45 | 6)) 328 | { 329 | assert(false); 330 | } 331 | v59 = *(unsigned __int8 *)(ptr_bytes_array + (v45 | 6) + 16); 332 | v174 = v45 | 6; 333 | 334 | if (*p_max_length <= (v45 | 7)) 335 | { 336 | assert(false); 337 | } 338 | v61 = *(unsigned __int8 *)(ptr_bytes_array + (v45 | 7) + 16); 339 | v175 = v45 | 7; 340 | v62 = v184; 341 | 342 | v63 = (v200 + (v195 << 8)) | (v59 << 16) | (v61 << 24); 343 | if ((unsigned int)v184[3] <= 1) 344 | { 345 | assert(false); 346 | } 347 | v184[5] = v63; 348 | if (v177) 349 | { 350 | if (v177 > 1) 351 | { 352 | v101 = dec_key; 353 | if (!v184[3]) 354 | { 355 | assert(false); 356 | } 357 | if (v177 == 3) 358 | { 359 | v190 = v184[4]; 360 | LOBYTE(v177) = 3; 361 | if ((unsigned int)v184[3] <= 1) 362 | { 363 | assert(false); 364 | } 365 | v104 = v184[5]; 366 | v105 = 234846730; 367 | v106 = 5; 368 | do 369 | { 370 | v198 = v104; 371 | if (!v101) 372 | { 373 | assert(false); 374 | } 375 | v107 = (v105 >> 11) & 3; 376 | v108 = v101[3]; 377 | v203 = v105; 378 | if (v108 <= v107) 379 | { 380 | assert(false); 381 | } 382 | v104 = v198 - ((v190 + (16 * v190 ^ (v190 >> 5))) ^ (v105 + dec_key[v107 + 4])); 383 | if (v108 <= v106 - 4) 384 | { 385 | assert(false); 386 | } 387 | v190 -= (v104 + (16 * v104 ^ (v104 >> 5))) ^ (v105 + dec_key[v106--] - 117423365); 388 | v105 -= 117423365; 389 | v101 = dec_key; 390 | } while (v203 != 117423365); 391 | v62 = v184; 392 | 393 | v112 = v184[3]; 394 | if (!v112) 395 | { 396 | assert(false); 397 | } 398 | v184[4] = v190; 399 | if (v112 <= 1) 400 | { 401 | assert(false); 402 | } 403 | v184[5] = v104; 404 | } 405 | else 406 | { 407 | v191 = v184[4]; 408 | 409 | if ((unsigned int)v101[3] <= 0xD) 410 | { 411 | assert(false); 412 | } 413 | v116 = v101[17]; 414 | 415 | v118 = v62[3]; 416 | if (!v118) 417 | { 418 | assert(false); 419 | } 420 | v62[4] = v116 ^ v178 ^ v191; 421 | if (v118 <= 1) 422 | { 423 | assert(false); 424 | } 425 | v121 = v62[5]; 426 | 427 | if ((unsigned int)v101[3] <= 2) 428 | { 429 | assert(false); 430 | } 431 | v123 = v101[6]; 432 | v62 = v184; 433 | 434 | v125 = v123 ^ v178 ^ v121; 435 | if ((unsigned int)v184[3] <= 1) 436 | { 437 | assert(false); 438 | } 439 | v184[5] = v125; 440 | } 441 | } 442 | else 443 | { 444 | v65 = v184[3]; 445 | v66 = dec_key; 446 | if (!v65) 447 | { 448 | assert(false); 449 | } 450 | v68 = v184[4]; 451 | if (v65 <= 1) 452 | { 453 | assert(false); 454 | } 455 | v70 = v184[5]; 456 | 457 | v71 = v66[3]; 458 | if (!v71) 459 | { 460 | assert(false); 461 | } 462 | v201 = v66[4]; 463 | if (v71 <= 1) 464 | { 465 | assert(false); 466 | } 467 | v196 = v66[5]; 468 | if (v71 <= 2) 469 | { 470 | assert(false); 471 | } 472 | v75 = v66[6]; 473 | if (v71 <= 3) 474 | { 475 | assert(false); 476 | } 477 | v188 = v66[7]; 478 | v77 = 234846730; 479 | do 480 | { 481 | v70 -= (v75 + 16 * v68) ^ (v77 + v68) ^ (v188 + (v68 >> 5)); 482 | v68 -= (v201 + 16 * v70) ^ (v77 + v70) ^ (v196 + (v70 >> 5)); 483 | v77 -= 117423365; 484 | } while (v77); 485 | 486 | v78 = v184[3]; 487 | if (!v78) 488 | { 489 | assert(false); 490 | } 491 | v184[4] = v68; 492 | if (v78 <= 1) 493 | { 494 | assert(false); 495 | } 496 | v184[5] = v70; 497 | v62 = v184; 498 | } 499 | } 500 | else 501 | { 502 | v81 = v184[3]; 503 | if (!v81) 504 | { 505 | assert(false); 506 | } 507 | v202 = v184[4]; 508 | v183 = v81 - 1; 509 | v180 = v81 - 2; 510 | v181 = v184[3]; 511 | v83 = 234846730; 512 | v84 = 2; 513 | do 514 | { 515 | v182 = v84; 516 | v186 = v83; 517 | v189 = (v83 >> 2) & 3; 518 | v85 = v180; 519 | if (v183) 520 | { 521 | do 522 | { 523 | v86 = v85 + 1; 524 | v87 = v62[3]; 525 | if (v87 <= v85) 526 | { 527 | assert(false); 528 | } 529 | v89 = v62[v85 + 4]; 530 | if (v87 <= v86) 531 | { 532 | assert(false); 533 | } 534 | v91 = dec_key; 535 | 536 | v197 = v189 ^ v86 & 3; 537 | if ((uint32_t)v91[3] <= v197) 538 | { 539 | assert(false); 540 | } 541 | v93 = v184[v85 + 5] 542 | - ((((v89 >> 5) ^ 4 * v202) + ((v202 >> 3) ^ 16 * v89)) ^ ((v186 ^ v202) 543 | + (dec_key[v197 + 4] ^ v89))); 544 | v62 = v184; 545 | v184[v85-- + 5] = v93; 546 | v202 = v93; 547 | } while (v85 != -1); 548 | } 549 | v94 = v62[3]; 550 | if (v94 <= v183) 551 | { 552 | assert(false); 553 | } 554 | v96 = v62[v181 + 3]; 555 | if (!v94) 556 | { 557 | assert(false); 558 | } 559 | v98 = dec_key; 560 | 561 | if (v98[3] <= v189) 562 | { 563 | assert(false); 564 | } 565 | v100 = v62[4] 566 | - ((((v96 >> 5) ^ 4 * v202) + ((v202 >> 3) ^ 16 * v96)) ^ ((v186 ^ v202) 567 | + (dec_key[v189 + 4] ^ v96))); 568 | v62[4] = v100; 569 | v83 = v186 - 117423365; 570 | v84 = v182 - 1; 571 | v202 = v100; 572 | } while (v182 != 1); 573 | } 574 | if (!v62[3]) 575 | { 576 | assert(false); 577 | } 578 | v128 = v62[4]; 579 | dec_buf_1 = dec_buf_2; 580 | 581 | if ((uint32_t)dec_buf_2->max_length <= v178) 582 | { 583 | assert(false); 584 | } 585 | dec_buf_2->m_Items[v178] = v128; 586 | 587 | if (!v184[3]) 588 | { 589 | assert(false); 590 | } 591 | v132 = v184[4]; 592 | 593 | if ((uint32_t)dec_buf_2->max_length <= v169) 594 | { 595 | assert(false); 596 | } 597 | dec_buf_2->m_Items[v169] = BYTE1(v132); 598 | 599 | if (!v184[3]) 600 | { 601 | assert(false); 602 | } 603 | v136 = v184[4]; 604 | 605 | v138 = v136 >> 16; 606 | if ((uint32_t)dec_buf_2->max_length <= v170) 607 | { 608 | assert(false); 609 | } 610 | dec_buf_2->m_Items[v170] = v138; 611 | 612 | if (!v184[3]) 613 | { 614 | assert(false); 615 | } 616 | v141 = v184[4]; 617 | 618 | v143 = v141 >> 24; 619 | if ((uint32_t)dec_buf_2->max_length <= v172) 620 | { 621 | assert(false); 622 | } 623 | dec_buf_2->m_Items[v172] = v143; 624 | 625 | if ((unsigned int)v184[3] <= 1) 626 | { 627 | assert(false); 628 | } 629 | v146 = v184[5]; 630 | 631 | if ((uint32_t)dec_buf_2->max_length <= v171) 632 | { 633 | assert(false); 634 | } 635 | dec_buf_2->m_Items[v171] = v146; 636 | 637 | if ((unsigned int)v184[3] <= 1) 638 | { 639 | assert(false); 640 | } 641 | v150 = v184[5]; 642 | 643 | if ((uint32_t)dec_buf_2->max_length <= v173) 644 | { 645 | assert(false); 646 | } 647 | dec_buf_2->m_Items[v173] = BYTE1(v150); 648 | 649 | if ((unsigned int)v184[3] <= 1) 650 | { 651 | assert(false); 652 | } 653 | v154 = v184[5]; 654 | 655 | v156 = v154 >> 16; 656 | if ((uint32_t)dec_buf_2->max_length <= v174) 657 | { 658 | assert(false); 659 | } 660 | dec_buf_2->m_Items[v174] = v156; 661 | 662 | if ((unsigned int)v184[3] <= 1) 663 | { 664 | assert(false); 665 | } 666 | v159 = v184[5]; 667 | 668 | v161 = v159 >> 24; 669 | if ((uint32_t)dec_buf_2->max_length <= v175) 670 | { 671 | assert(false); 672 | } 673 | dec_buf_2->m_Items[v175] = v161; 674 | v47 = ((_BYTE)v177 + 1) & 3; 675 | v45 = v178 + 8; 676 | ptr_bytes_array_2 = ptr_bytes_array; 677 | } while (v178 + 8 < dec_buf_size_minus8); 678 | dec_buf_size_1 = dec_buf_2->max_length; 679 | } 680 | if ((v45 < dec_buf_size_1) + ((signed int)dec_buf_size_1 >> 31) > 0) 681 | { 682 | do 683 | { 684 | if (*p_max_length <= v45) 685 | { 686 | assert(false); 687 | } 688 | v164 = *(_BYTE *)(ptr_bytes_array_2 + v45 + 16); 689 | 690 | if ((uint32_t)dec_buf_1->max_length <= v45) 691 | { 692 | assert(false); 693 | } 694 | dec_buf_1->m_Items[v45++] = v164; 695 | } while ((v45 < (uint32_t)dec_buf_1->max_length) + ((uint32_t)dec_buf_1->max_length >> 31) > 0); 696 | } 697 | return dec_buf_1; 698 | } 699 | 700 | 701 | --------------------------------------------------------------------------------