Packet -> Buffer

This commit is contained in:
thedaneeffect committed 2021-03-12 13:46:05 -05:00
1 parent b3329591f7
commit c30bd0f122
37 files changed
+2369 -2271

No files matched your search

+9 -9
View File
@@ -16,33 +16,33 @@ public class FileArchive {
}
public void load(byte[] src) {
Packet packet = new Packet(src);
Buffer buffer = new Buffer(src);
int unpackedSize = packet.get3();
int packedSize = packet.get3();
int unpackedSize = buffer.get3();
int packedSize = buffer.get3();
if (packedSize != unpackedSize) {
data = new byte[unpackedSize];
BZip2.decompress(data, unpackedSize, src, 6, packedSize);
packet = new Packet(data);
buffer = new Buffer(data);
unpacked = true;
} else {
data = src;
unpacked = false;
}
fileCount = packet.get2U();
fileCount = buffer.get2U();
fileHash = new int[fileCount];
fileSizeInflated = new int[fileCount];
fileSizeDeflated = new int[fileCount];
fileOffset = new int[fileCount];
int offset = packet.position + (fileCount * 10);
int offset = buffer.position + (fileCount * 10);
for (int file = 0; file < fileCount; file++) {
fileHash[file] = packet.get4();
fileSizeInflated[file] = packet.get3();
fileSizeDeflated[file] = packet.get3();
fileHash[file] = buffer.get4();
fileSizeInflated[file] = buffer.get3();
fileSizeDeflated[file] = buffer.get3();
fileOffset[file] = offset;
offset += fileSizeDeflated[file];
}