diff --git a/src/unpaker/pak.cpp b/src/unpaker/pak.cpp index bb0db64..ca4dae2 100644 --- a/src/unpaker/pak.cpp +++ b/src/unpaker/pak.cpp @@ -140,18 +140,27 @@ void segment::decompress(int segment_id) { if (algorithm & RLE_2_bytes) { - //static std::vector buf(4194432); - decode_f3((char*)encoded, size1, (char*)decoded/*buf.data()*/); - //decode_rle((short*)encoded, size1, (short*)decoded); - //assert(memcmp(decoded, buf.data(), size1) == 0); + decode_f3((char*)encoded, size1, (char*)decoded); + + /*static std::vector buf(4194432); + decode_f3((char*)encoded, size1, (char*)buf.data()); + decode_rle((short*)encoded, size1, (short*)decoded); + auto sz = 0; + while (sz++ < size1 - 1 && decoded[sz] == buf[sz]); + std::cout << "len = " << sz << "\n"; + assert(memcmp(decoded, buf.data(), size1) == 0);*/ } else { - //static std::vector buf(4194432); - //const int header_size = 0xC; - //decode_f4((char*)encoded, size1, (char*)buf.data(), segment_id * header_size); + //decode_f4((char*)encoded, size1, (char*)decoded); + + /*static std::vector buf(4194432); + const int header_size = 0xC; + decode_f4((char*)encoded, size1, (char*)buf.data(), segment_id * header_size); + decode_rle((char*)encoded, size1, (char*)decoded); + assert(memcmp(decoded, buf.data(), size1) == 0);*/ + decode_rle((char*)encoded, size1, (char*)decoded); - //assert(memcmp(decoded, buf.data(), size1) == 0); } } } diff --git a/src/unpaker/pak.h b/src/unpaker/pak.h index a48f2d7..15d9217 100644 --- a/src/unpaker/pak.h +++ b/src/unpaker/pak.h @@ -55,7 +55,7 @@ struct record struct segment { - enum decode_algorithm + enum decode_algorithm : uint32_t { RLE_2_bytes = 0x1, RLE_1_byte = 0x2, @@ -63,7 +63,7 @@ struct segment DA_2 = 0x8, }; - uint32_t unk1; + uint32_t unk1; // some file offset? trash? decode_algorithm algorithm; uint32_t offset;