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,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;
}
}
}
}