1 // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
2 // Jad home page: http://www.kpdus.com/jad.html
3 // Decompiler options: packimports(3) fieldsfirst nonlb space
7 import java.awt.image.MemoryImageSource;
9 import java.util.logging.Level;
10 import java.util.logging.Logger;
12 // Referenced classes of package mcsClient:
15 public final class Decompress {
18 private static final byte BF = 96;
19 private static final byte NC = 0;
20 private static final byte CA = 64;
21 private static final byte CB = 32;
22 private static final byte MM = 96;
23 private static final byte WP = -128;
24 private static final byte EF = 112;
25 private static final byte CMD_MASK = -32;
26 private static final byte RC_MASK = 31;
27 private static final byte RC_SIZE = 5;
34 public static boolean PRINT_DATA = false;
35 private byte imageData[];
36 boolean pixelsInParts;
38 private static Logger logger = Logger.getAnonymousLogger();
40 public Decompress(byte abyte0[]) {
43 logger.setLevel(Level.WARNING);
44 String s = System.getProperty("mcs.debug");
45 if (s != null && s.equalsIgnoreCase("true"))
46 logger.setLevel(Level.ALL);
49 public void doDecompress(DataInputStream datainputstream, int i, int j, int k, MemoryImageSource memoryimagesource, int l, int i1) throws ArrayIndexOutOfBoundsException {
58 boolean flag1 = false;
59 boolean flag2 = false;
60 boolean flag3 = false;
61 boolean flag4 = false;
63 int i3 = ((j1 + k + l) - 1) / l;
65 pixelsInParts = false;
69 boolean flag5 = false;
73 logger.info("ERROR0: imageDataIndex = " + j1 + ", videoRamOffset = " + j + ", videoRamCount = " + k);
75 memoryimagesource.newPixels(0, oldY, l - 1, i3 - oldY, false);
80 logger.warning("ERROR: bytesRead > datagramLength, bytesRead = " + j3 + ", datagramLength = " + i);
92 l1 = datainputstream.readUnsignedByte();
94 System.out.print(" " + HexConversion.toString(l1));
101 catch (IOException ioexception) {
102 logger.info("Decompress - error reading datagram byte " + ioexception);
106 byte byte0 = (byte)(l1 & 0xffffffe0);
108 if (byte0 == byte1) {
110 i2 |= (l1 & 0x1f) << byte3 * 5;
112 logger.info("Bad repeat count " + i2);
113 if (j1 + i2 + 3 >= j + k) {
133 if (byte0 != byte1) {
145 if ((l1 & 0x80) != 0) {
149 logger.severe("Unknown video command received, got: " + byte0);
151 datainputstream.close();
153 catch (IOException ioexception1) {
154 logger.info(ioexception1.toString());
167 int l2 = ((j1 + l) - 1) / l;
168 memoryimagesource.newPixels(0, oldY, l - 1, l2 - oldY, false);
169 oldY = ((j1 + j2) - (l - 1)) / l;
170 pixelsInParts = true;
177 logger.warning("Error: copy above index = " + (j1 - j));
180 imageData[j1] = imageData[j1 - l];
184 catch (ArrayIndexOutOfBoundsException arrayindexoutofboundsexception) {
185 logger.warning("imageDataIndex: " + j1);
186 throw arrayindexoutofboundsexception;
192 logger.warning("Error: copy left index = " + (j1 - j));
193 byte byte4 = imageData[j1 - 1];
196 imageData[j1] = byte4;
200 catch (ArrayIndexOutOfBoundsException arrayindexoutofboundsexception1) {
201 logger.info("imageDataIndex: " + j1);
202 throw arrayindexoutofboundsexception1;
210 memoryimagesource.newPixels(0, oldY, l - 1, i3 - oldY, false);
216 byte byte5 = imageData[j1 - 1];
219 if (imageData[k3] == byte5) {
223 byte6 = imageData[k3];
227 imageData[j1++] = (l1 & 8) == 0 ? byte5 : byte6;
228 imageData[j1++] = (l1 & 4) == 0 ? byte5 : byte6;
229 imageData[j1++] = (l1 & 2) == 0 ? byte5 : byte6;
230 imageData[j1++] = (l1 & 1) == 0 ? byte5 : byte6;
232 catch (ArrayIndexOutOfBoundsException arrayindexoutofboundsexception2) {
233 logger.info("imageDataIndex: " + j1);
234 throw arrayindexoutofboundsexception2;
236 if ((l1 & 0x10) != 0)
239 l1 = datainputstream.readUnsignedByte();
241 System.out.print(" " + HexConversion.toString(l1));
244 System.out.println();
248 catch (IOException ioexception2) {
249 logger.info("Decompress - error reading monochrome byte");
254 imageData[j1++] = (l1 & 0x40) == 0 ? byte5 : byte6;
255 imageData[j1++] = (l1 & 0x20) == 0 ? byte5 : byte6;
256 imageData[j1++] = (l1 & 0x10) == 0 ? byte5 : byte6;
257 imageData[j1++] = (l1 & 8) == 0 ? byte5 : byte6;
258 imageData[j1++] = (l1 & 4) == 0 ? byte5 : byte6;
259 imageData[j1++] = (l1 & 2) == 0 ? byte5 : byte6;
260 imageData[j1++] = (l1 & 1) == 0 ? byte5 : byte6;
262 catch (ArrayIndexOutOfBoundsException arrayindexoutofboundsexception3) {
263 logger.info("imageDataIndex: " + j1);
264 throw arrayindexoutofboundsexception3;
266 } while ((l1 & 0x80) != 0);
271 logger.info("ERROR2: imageDataIndex = " + j1 + ", videoRamOffset = " + j + ", videoRamCount = " + k);
273 memoryimagesource.newPixels(0, oldY, l - 1, i3 - oldY, false);
277 imageData[j1++] = (byte)(l1 & 0x7f);
283 logger.info("ERROR3: imageDataIndex = " + j1 + ", videoRamOffset = " + j + ", videoRamCount = " + k);
285 memoryimagesource.newPixels(0, oldY, l - 1, i3 - oldY, false);