Beginning of work on sprite loading/exporting

This commit is contained in:
Adam
2015-11-12 18:50:38 -05:00
parent 3c5fcc018f
commit a312edd581
19 changed files with 2210 additions and 15 deletions

View File

@@ -0,0 +1,18 @@
package net.runelite.cache;
public enum IndexType
{
SPRITE(8);
private int id;
IndexType(int id)
{
this.id = id;
}
public int getNumber()
{
return id;
}
}

View File

@@ -0,0 +1,38 @@
package net.runelite.cache.definitions;
import net.runelite.cache.io.InputStream;
/**
* Created by Allen Kinzalow on 3/14/2015.
*/
public abstract class Definition {
int definitionID;
public Definition(int definitionID) {
this.definitionID = definitionID;
}
//abstract OutputStream encode(OutputStream stream);
public void decode(InputStream stream) {
while(true) {
int opcode = stream.readUnsignedByte();
if(opcode == 0) {
return;
}
this.decodeValues(opcode, stream);
}
}
abstract void decodeValues(int opcode, InputStream stream);
//public abstract void printDefinition();
public int getDefinitionID() {
return this.definitionID;
}
}

View File

@@ -0,0 +1,191 @@
//package net.runelite.cache.definitions;
//
//import net.runelite.cache.io.InputStream;
//import net.runelite.cache.utils.StringUtilities;
//
///**
// * Created by Allen Kinzalow on 3/14/2015.
// */
//public class ItemDefinition extends Definition {
//
// public final static int INDEX_ID = 2;
// public final static int ARCHIVE_ID = 10;
//
// public int resizeY;
// public int xan2d = 0;
// public int cost = 1;
// public int inventoryModel;
// public int resizeZ;
// public short[] colorFind;
// public short[] colorReplace;
// public short[] textureFind;
// public String name = "null";
// public int zoom2d = 200000;
// public int yan2d = 0;
// public int zan2d = 0;
// public int maleOffset;
// public int yOffset2d = 0;
// public int stackable = 0;
// public int[] countCo;
// public boolean members = false;
// public String[] options;
// public String[] interfaceOptions;
// public int maleModel0;
// public int maleModel1;
// public short[] textureReplace;
// public int femaleModel1;
// public int femaleOffset;
// public int maleModel2;
// public int xOffset2d = 0;
// public int maleHeadModel;
// public int maleHeadModel2;
// public int femaleHeadModel;
// public int femaleHeadModel2;
// public int[] countObj;
// public int femaleModel2;
// public int notedID;
// public int femaleModel0;
// public int resizeX;
// public int notedTemplate;
// public int ambient;
// public int contrast;
// public int team;
//
// public ItemDefinition(int definitionID) {
// super(definitionID);
// this.options = new String[]{null, null, "Take", null, null};
// this.interfaceOptions = new String[]{null, null, null, null, "Drop"};
// this.maleModel0 = -1;
// this.maleModel1 = -1;
// this.maleOffset = 0;
// this.femaleModel0 = -1;
// this.femaleModel1 = -1;
// this.femaleOffset = 0;
// this.maleModel2 = -1;
// this.femaleModel2 = -1;
// this.maleHeadModel = -1;
// this.maleHeadModel2 = -1;
// this.femaleHeadModel = -1;
// this.femaleHeadModel2 = -1;
// this.notedID = -1;
// this.notedTemplate = -1;
// this.resizeX = 0;
// this.resizeY = 0;
// this.resizeZ = 0;
// this.ambient = 0;
// this.contrast = 0;
// this.team = 0;
// }
//
// @Override
// void decodeValues(int opcode, InputStream stream) {
// if (opcode == 1) {
// this.inventoryModel = stream.readUnsignedShort();
// } else if (opcode == 2) {
// this.name = StringUtilities.readString_2(stream);
// } else if (opcode == 4) {
// this.zoom2d = stream.readUnsignedShort();
// } else if (opcode == 5) {
// this.xan2d = stream.readUnsignedShort();
// } else if (opcode == 6) {
// this.yan2d = stream.readUnsignedShort();
// } else if (7 == opcode) {
// this.xOffset2d = stream.readUnsignedShort();
// if (this.xOffset2d > 32767) {
// this.xOffset2d -= 65536;
// }
// } else if (8 == opcode) {
// this.yOffset2d = stream.readUnsignedShort();
// if (this.yOffset2d > 32767) {
// this.yOffset2d -= 65536;
// }
// } else if (11 == opcode) {
// this.stackable = 1;
// } else if (opcode == 12) {
// this.cost = stream.readInt();
// } else if (16 == opcode) {
// this.members = true;
// } else if (opcode == 23) {
// this.maleModel0 = stream.readUnsignedShort();
// this.maleOffset = stream.readUnsignedByte();
// } else if (opcode == 24) {
// this.maleModel1 = stream.readUnsignedShort();
// } else if (25 == opcode) {
// this.femaleModel0 = stream.readUnsignedShort();
// this.femaleOffset = stream.readUnsignedByte();
// } else if (26 == opcode) {
// this.femaleModel1 = stream.readUnsignedShort();
// } else if (opcode >= 30 && opcode < 35) {
// this.options[opcode - 30] = StringUtilities.readString_2(stream);
// if (this.options[opcode - 30].equalsIgnoreCase("Hidden")) {
// this.options[opcode - 30] = null;
// }
// } else if (opcode >= 35 && opcode < 40) {
// this.interfaceOptions[opcode - 35] = StringUtilities.readString_2(stream);
// } else {
// int var4;
// int var5;
// if (opcode == 40) {
// var5 = stream.readUnsignedByte();
// this.colorFind = new short[var5];
// this.colorReplace = new short[var5];
//
// for (var4 = 0; var4 < var5; ++var4) {
// this.colorFind[var4] = (short) stream.readUnsignedShort();
// this.colorReplace[var4] = (short) stream.readUnsignedShort();
// }
//
// } else if (41 != opcode) {
// if (opcode == 78) {
// this.maleModel2 = stream.readUnsignedShort();
// } else if (opcode == 79) {
// this.femaleModel2 = stream.readUnsignedShort();
// } else if (90 == opcode) {
// this.maleHeadModel = stream.readUnsignedShort();
// } else if (91 == opcode) {
// this.femaleHeadModel = stream.readUnsignedShort();
// } else if (92 == opcode) {
// this.maleHeadModel2 = stream.readUnsignedShort();
// } else if (opcode == 93) {
// this.femaleHeadModel2 = stream.readUnsignedShort();
// } else if (opcode == 95) {
// this.zan2d = stream.readUnsignedShort();
// } else if (97 == opcode) {
// this.notedID = stream.readUnsignedShort();
// } else if (98 == opcode) {
// this.notedTemplate = stream.readUnsignedShort();
// } else if (opcode >= 100 && opcode < 110) {
// if (this.countObj == null) {
// this.countObj = new int[10];
// this.countCo = new int[10];
// }
//
// this.countObj[opcode - 100] = stream.readUnsignedShort();
// this.countCo[opcode - 100] = stream.readUnsignedShort();
// } else if (110 == opcode) {
// this.resizeX = stream.readUnsignedShort();
// } else if (opcode == 111) {
// this.resizeY = stream.readUnsignedShort();
// } else if (opcode == 112) {
// this.resizeZ = stream.readUnsignedShort();
// } else if (opcode == 113) {
// this.ambient = stream.readByte();
// } else if (114 == opcode) {
// this.contrast = stream.readByte();
// } else if (115 == opcode) {
// this.team = stream.readUnsignedByte();
// }
// } else {
// var5 = stream.readUnsignedByte();
// this.textureFind = new short[var5];
// this.textureReplace = new short[var5];
//
// for (var4 = 0; var4 < var5; ++var4) {
// this.textureFind[var4] = (short) stream.readUnsignedShort();
// this.textureReplace[var4] = (short) stream.readUnsignedShort();
// }
//
// }
// }
// }
//}

View File

@@ -0,0 +1,164 @@
//package net.runelite.cache.definitions;
//
//import net.runelite.cache.io.InputStream;
//import net.runelite.cache.utils.StringUtilities;
//
///**
// * Created by Allen Kinzalow on 3/15/2015.
// */
//public class NPCDefinition extends Definition {
//
// public final static int INDEX_ID = 2;
// public final static int ARCHIVE_ID = 9;
//
// public short[] recolorToFind;
// public int anInt2156 = 32;
// public String name = "null";
// public short[] recolorToReplace;
// public int[] models;
// public int[] models_2;
// public int stanceAnimation = -1;
// public int anInt2165 = -1;
// public int tileSpacesOccupied = 1;
// public int walkAnimation = -1;
// public short[] retextureToReplace;
// public int rotate90RightAnimation = -1;
// public boolean aBool2170 = true;
// public int resizeX = 128;
// public int contrast = 0;
// public int rotate180Animation = -1;
// public int anInt2174 = -1;
// public String[] options = new String[5];
// public boolean renderOnMinimap = true;
// public int combatLevel = -1;
// public int rotate90LeftAnimation = -1;
// public int resizeY = 128;
// public boolean hasRenderPriority = false;
// public int ambient = 0;
// public int headIcon = -1;
// public int anInt2184 = 30;
// public int[] anIntArray2185;
// public short[] retextureToFind;
// public int anInt2187 = -1;
// public boolean isClickable = true;
// public int anInt2189 = -1;
// public boolean aBool2190 = false;
//
// public NPCDefinition(int definitionID) {
// super(definitionID);
// }
//
// @Override
// void decodeValues(int opcode, InputStream stream) {
// int length;
// int index;
// if(1 == opcode) {
// length = stream.readUnsignedByte();
// this.models = new int[length];
//
// for(index = 0; index < length; ++index) {
// this.models[index] = stream.readUnsignedShort();
// }
//
// } else if(2 == opcode) {
// this.name = StringUtilities.readString_2(stream);
// } else if(12 == opcode) {
// this.tileSpacesOccupied = stream.readUnsignedShort();
// } else if(opcode == 13) {
// this.stanceAnimation = stream.readUnsignedShort();
// } else if(opcode == 14) {
// this.walkAnimation = stream.readUnsignedShort();
// } else if(15 == opcode) {
// this.anInt2165 = stream.readUnsignedShort();
// } else if(opcode == 16) {
// this.anInt2189 = stream.readUnsignedShort();
// } else if(17 == opcode) {
// this.walkAnimation = stream.readUnsignedShort();
// this.rotate180Animation = stream.readUnsignedShort();
// this.rotate90RightAnimation = stream.readUnsignedShort();
// this.rotate90LeftAnimation = stream.readUnsignedShort();
// } else if(opcode >= 30 && opcode < 35) {
// this.options[opcode - 30] = StringUtilities.readString_2(stream);
// if(this.options[opcode - 30].equalsIgnoreCase("Hidden")) {
// this.options[opcode - 30] = null;
// }
// } else if(opcode == 40) {
// length = stream.readUnsignedByte();
// this.recolorToFind = new short[length];
// this.recolorToReplace = new short[length];
//
// for(index = 0; index < length; ++index) {
// this.recolorToFind[index] = (short)stream.readUnsignedShort();
// this.recolorToReplace[index] = (short)stream.readUnsignedShort();
// }
//
// } else if(opcode == 41) {
// length = stream.readUnsignedByte();
// this.retextureToFind = new short[length];
// this.retextureToReplace = new short[length];
//
// for(index = 0; index < length; ++index) {
// this.retextureToFind[index] = (short)stream.readUnsignedShort();
// this.retextureToReplace[index] = (short)stream.readUnsignedShort();
// }
//
// } else if(60 != opcode) {
// if(opcode == 93) {
// this.renderOnMinimap = false;
// } else if(95 == opcode) {
// this.combatLevel = stream.readUnsignedShort();
// } else if(97 == opcode) {
// this.resizeX = stream.readUnsignedShort();
// } else if(98 == opcode) {
// this.resizeY = stream.readUnsignedShort();
// } else if(opcode == 99) {
// this.hasRenderPriority = true;
// } else if(100 == opcode) {
// this.ambient = stream.readByte();
// } else if(101 == opcode) {
// this.contrast = stream.readByte();
// } else if(opcode == 102) {
// this.headIcon = stream.readUnsignedShort();
// } else if(103 == opcode) {
// this.anInt2156 = stream.readUnsignedShort();
// } else if(opcode == 106) {
// this.anInt2174 = stream.readUnsignedShort();
// if('\uffff' == this.anInt2174) {
// this.anInt2174 = -1;
// }
//
// this.anInt2187 = stream.readUnsignedShort();
// if('\uffff' == this.anInt2187) {
// this.anInt2187 = -40212193;
// }
//
// length = stream.readUnsignedByte();
// this.anIntArray2185 = new int[length + 1];
//
// for(index = 0; index <= length; ++index) {
// this.anIntArray2185[index] = stream.readUnsignedShort();
// if(this.anIntArray2185[index] == '\uffff') {
// this.anIntArray2185[index] = -1;
// }
// }
//
// } else if(107 == opcode) {
// this.isClickable = false;
// } else if(opcode == 109) {
// this.aBool2170 = false;
// } else if(opcode == 111) {
// this.aBool2190 = true;
// } else if(opcode == 112) {
// this.anInt2184 = stream.readUnsignedByte();
// }
// } else {
// length = stream.readUnsignedByte();
// this.models_2 = new int[length];
//
// for(index = 0; index < length; ++index) {
// this.models_2[index] = stream.readUnsignedShort();
// }
//
// }
// }
//}

View File

@@ -0,0 +1,141 @@
package net.runelite.cache.definitions;
import net.runelite.cache.io.InputStream;
/**
* Created by Allen Kinzalow on 3/15/2015.
*/
public class SpriteDefinition extends Definition {
int offsetX;
int offsetY;
int width;
int height;
int[] palette;
byte[] pixels;
int maxWidth;
int maxHeight;
public static int paletteChildCount;
public static int[] loadedSpriteOffsetX;
public static int[] loadedSpriteOffsetY;
public static int[] loadedSpriteWidth;
public static int[] loadedSpriteHeight;
public static byte[][] loadedSpritePixels;
public static int[] loadedPalette;
public static int loadedSpriteMaxWidth;
public static int loadedSpriteMaxHeight;
public SpriteDefinition(int definitionID) {
super(definitionID);
}
@Override
public void decode(InputStream stream) {
stream.setOffset(stream.getLength() - 2);
paletteChildCount = stream.readUnsignedShort();
loadedSpriteOffsetX = new int[paletteChildCount ];
loadedSpriteOffsetY = new int[paletteChildCount];
loadedSpriteWidth = new int[paletteChildCount];
loadedSpriteHeight = new int[paletteChildCount];
loadedSpritePixels = new byte[paletteChildCount][];
stream.setOffset(stream.getLength() - 7 - paletteChildCount * 8);
loadedSpriteMaxWidth = stream.readUnsignedShort();
loadedSpriteMaxHeight = stream.readUnsignedShort();
int var3 = (stream.readUnsignedByte() & 255) + 1;
int spriteIndex;
for(spriteIndex = 0; spriteIndex < paletteChildCount; ++spriteIndex) {
loadedSpriteOffsetX[spriteIndex] = stream.readUnsignedShort();
}
for(spriteIndex = 0; spriteIndex < paletteChildCount; ++spriteIndex) {
loadedSpriteOffsetY[spriteIndex] = stream.readUnsignedShort();
}
for(spriteIndex = 0; spriteIndex < paletteChildCount; ++spriteIndex) {
loadedSpriteWidth[spriteIndex] = stream.readUnsignedShort();
}
for(spriteIndex = 0; spriteIndex < paletteChildCount; ++spriteIndex) {
loadedSpriteHeight[spriteIndex] = stream.readUnsignedShort();
}
stream.setOffset(stream.getLength() - 7 - paletteChildCount * 8 - (var3 - 1) * 3);
loadedPalette = new int[var3];
for(spriteIndex = 1; spriteIndex < var3; ++spriteIndex) {
loadedPalette[spriteIndex] = stream.read24BitInt();
if(0 == loadedPalette[spriteIndex]) {
loadedPalette[spriteIndex] = 1;
}
}
stream.setOffset(0);
for(spriteIndex = 0; spriteIndex < paletteChildCount; ++spriteIndex) {
int width = loadedSpriteWidth[spriteIndex];
int height = loadedSpriteHeight[spriteIndex];
int dimmension = width * height;
byte[] loadPixels = new byte[dimmension];
loadedSpritePixels[spriteIndex] = loadPixels;
int var4 = stream.readUnsignedByte();
int var5;
if(var4 == 0) {
for(var5 = 0; var5 < dimmension; ++var5) {
loadPixels[var5] = (byte)stream.readByte();
}
} else if(1 == var4) {
for(var5 = 0; var5 < width; ++var5) {
for(int var8 = 0; var8 < height; ++var8) {
loadPixels[width * var8 + var5] = (byte)stream.readByte();
}
}
}
}
}
public static SpriteDefinition getLastLoadedPaletteSprite() {
SpriteDefinition paletteSprite = new SpriteDefinition(0);
paletteSprite.maxWidth = loadedSpriteMaxWidth;
paletteSprite.maxHeight = loadedSpriteMaxHeight;
paletteSprite.offsetX = loadedSpriteOffsetX[0];
paletteSprite.offsetY = loadedSpriteOffsetY[0];
paletteSprite.width = loadedSpriteWidth[0];
paletteSprite.height = loadedSpriteHeight[0];
paletteSprite.palette = loadedPalette;
paletteSprite.pixels = loadedSpritePixels[0];
resetLastPaletteValues();
return paletteSprite;
}
public static void resetLastPaletteValues() {
loadedSpriteOffsetX = null;
loadedSpriteOffsetY = null;
loadedSpriteWidth = null;
loadedSpriteHeight = null;
loadedPalette = null;
loadedSpritePixels = null;
}
public static SpriteDefinition[] loadPaletteSpriteSet() {
SpriteDefinition[] palettes = new SpriteDefinition[paletteChildCount];
for (int paletteIndex = 0; paletteIndex < paletteChildCount; ++paletteIndex) {
SpriteDefinition palette = palettes[paletteIndex] = new SpriteDefinition(0);
palette.maxWidth = loadedSpriteMaxWidth;
palette.maxHeight = loadedSpriteMaxHeight;
palette.offsetX = loadedSpriteOffsetX[paletteIndex];
palette.offsetY = loadedSpriteOffsetY[paletteIndex];
palette.width = loadedSpriteWidth[paletteIndex];
palette.height = loadedSpriteHeight[paletteIndex];
palette.palette = loadedPalette;
palette.pixels = loadedSpritePixels[paletteIndex];
}
resetLastPaletteValues();
return palettes;
}
@Override
void decodeValues(int opcode, InputStream stream) { }
}

View File

@@ -0,0 +1,6 @@
package net.runelite.cache.definitions.loaders;
public class SpriteLoader
{
fff
}

View File

@@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import net.runelite.cache.fs.io.InputStream;
import net.runelite.cache.io.InputStream;
public class Archive
{

View File

@@ -9,8 +9,8 @@ import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Objects;
import net.runelite.cache.fs.io.InputStream;
import net.runelite.cache.fs.io.OutputStream;
import net.runelite.cache.io.InputStream;
import net.runelite.cache.io.OutputStream;
import net.runelite.cache.fs.util.BZipDecompressor;
import net.runelite.cache.fs.util.CRC32HGenerator;
import net.runelite.cache.fs.util.GZip;

View File

@@ -7,8 +7,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import net.runelite.cache.fs.io.InputStream;
import net.runelite.cache.fs.io.OutputStream;
import net.runelite.cache.io.InputStream;
import net.runelite.cache.io.OutputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@@ -7,6 +7,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import net.runelite.cache.IndexType;
public class Store implements Closeable
{
@@ -127,4 +128,9 @@ public class Store implements Closeable
{
return indexes;
}
public Index getIndex(IndexType type)
{
return indexes.get(type.getNumber());
}
}

View File

@@ -4,7 +4,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.GZIPOutputStream;
import java.util.zip.Inflater;
import net.runelite.cache.fs.io.Stream;
import net.runelite.cache.io.Stream;
public class GZip {
private static final Inflater inflaterInstance = new Inflater(true);

View File

@@ -1,6 +1,6 @@
package net.runelite.cache.fs.io;
package net.runelite.cache.io;
import net.runelite.cache.fs.io.Stream;
import net.runelite.cache.io.Stream;
public final class InputStream extends Stream {
private static final int[] BIT_MASK = new int[]{0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, '\uffff', 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, Integer.MAX_VALUE, -1};

View File

@@ -1,6 +1,6 @@
package net.runelite.cache.fs.io;
package net.runelite.cache.io;
import net.runelite.cache.fs.io.Stream;
import net.runelite.cache.io.Stream;
import java.math.BigInteger;
public final class OutputStream extends Stream {

View File

@@ -1,4 +1,4 @@
package net.runelite.cache.fs.io;
package net.runelite.cache.io;
public abstract class Stream {
protected int offset;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,125 @@
package net.runelite.cache.utils;
import net.runelite.cache.io.InputStream;
/**
* Created by Allen Kinzalow on 3/15/2015.
*
* These are methods from the OSRS Client.
*/
public class StringUtilities {
// public static int method769(CharSequence sequence, int var1) {
// int length = sequence.length();
// int position = 0;
//
// for(int charPosition = 0; charPosition < length; ++charPosition) {
// position = (position << 5) - position + method671(sequence.charAt(charPosition));
// }
//
// return position;
// }
//
// public static byte method671(char var0) {
// byte var2;
// if((var0 <= 0 || var0 >= 128) && (var0 < 160 || var0 > 255)) {
// if(8364 == var0) {
// var2 = -128;
// } else if(var0 == 8218) {
// var2 = -126;
// } else if(402 == var0) {
// var2 = -125;
// } else if(8222 == var0) {
// var2 = -124;
// } else if(var0 == 8230) {
// var2 = -123;
// } else if(8224 == var0) {
// var2 = -122;
// } else if(8225 == var0) {
// var2 = -121;
// } else if(710 == var0) {
// var2 = -120;
// } else if(8240 == var0) {
// var2 = -119;
// } else if(var0 == 352) {
// var2 = -118;
// } else if(8249 == var0) {
// var2 = -117;
// } else if(var0 == 338) {
// var2 = -116;
// } else if(381 == var0) {
// var2 = -114;
// } else if(var0 == 8216) {
// var2 = -111;
// } else if(var0 == 8217) {
// var2 = -110;
// } else if(8220 == var0) {
// var2 = -109;
// } else if(var0 == 8221) {
// var2 = -108;
// } else if(8226 == var0) {
// var2 = -107;
// } else if(8211 == var0) {
// var2 = -106;
// } else if(8212 == var0) {
// var2 = -105;
// } else if(732 == var0) {
// var2 = -104;
// } else if(8482 == var0) {
// var2 = -103;
// } else if(var0 == 353) {
// var2 = -102;
// } else if(8250 == var0) {
// var2 = -101;
// } else if(339 == var0) {
// var2 = -100;
// } else if(var0 == 382) {
// var2 = -98;
// } else if(376 == var0) {
// var2 = -97;
// } else {
// var2 = 63;
// }
// } else {
// var2 = (byte)var0;
// }
//
// return var2;
// }
public static String readString_2(InputStream stream) {
int var2 = stream.getOffset();
while(stream.readByte() != 0) {
;
}
int var3 = stream.getOffset() - var2 - 1;
return var3 == 0? "" : getStringMethod(stream.getBuffer(), var2, var3);
}
public static String getStringMethod(byte[] var0, int var1, int var2) {
char[] aCharArray1496 = new char[]{'\u20ac', '\u0000', '\u201a', '\u0192', '\u201e', '\u2026', '\u2020', '\u2021', '\u02c6', '\u2030', '\u0160', '\u2039', '\u0152', '\u0000', '\u017d', '\u0000', '\u0000', '\u2018', '\u2019', '\u201c', '\u201d', '\u2022', '\u2013', '\u2014', '\u02dc', '\u2122', '\u0161', '\u203a', '\u0153', '\u0000', '\u017e', '\u0178'};
char[] var4 = new char[var2];
int var5 = 0;
for (int var8 = 0; var8 < var2; ++var8) {
int var6 = var0[var1 + var8] & 255;
if (var6 != 0) {
if (var6 >= 128 && var6 < 160) {
char var7 = aCharArray1496[var6 - 128];
if (0 == var7) {
var7 = 63;
}
var6 = var7;
}
var4[var5++] = (char) var6;
}
}
return new String(var4, 0, var5);
}
}

View File

@@ -0,0 +1,8 @@
package net.runelite.cache;
import java.io.File;
public class StoreLocation
{
public static final File LOCATION = new File("c:/rs/cache");
}

View File

@@ -2,22 +2,23 @@ package net.runelite.cache.fs;
import java.io.FileOutputStream;
import java.io.IOException;
import net.runelite.cache.StoreLocation;
import org.junit.Test;
public class StoreLoadTest
{
@Test
//@Test
public void test() throws IOException
{
Store store = new Store(new java.io.File("d:/rs/07/cache"));//c:/rs/cache"));
Store store = new Store(StoreLocation.LOCATION);
store.load();
System.out.println(store);
}
//@Test
@Test
public void unpackStore() throws IOException
{
java.io.File base = new java.io.File("d:/rs/07/cache");
java.io.File base = StoreLocation.LOCATION;
try (Store store = new Store(base))
{
store.load();

View File

@@ -0,0 +1,45 @@
package net.runelite.cache.loaders;
import java.io.IOException;
import java.util.List;
import net.runelite.cache.IndexType;
import net.runelite.cache.StoreLocation;
import net.runelite.cache.definitions.SpriteDefinition;
import net.runelite.cache.fs.Archive;
import net.runelite.cache.fs.File;
import net.runelite.cache.fs.Index;
import net.runelite.cache.fs.Store;
import net.runelite.cache.io.InputStream;
import org.junit.Assert;
import org.junit.Test;
public class SpriteLoaderTest
{
@Test
public void extract() throws IOException
{
java.io.File base = StoreLocation.LOCATION;
try (Store store = new Store(base))
{
store.load();
Index index = store.getIndex(IndexType.SPRITE);
for (Archive a : index.getArchives())
{
List<File> files = a.getFiles();
Assert.assertEquals(1, files.size());
File file = files.get(0);
byte[] contents = file.getContents();
SpriteDefinition def = new SpriteDefinition(42);
def.decode(new InputStream(contents));
SpriteDefinition spr[] = SpriteDefinition.loadPaletteSpriteSet();
int i =5;
}
}
}
}