Skip to content

Commit

Permalink
cache: update worldmap dumper test for new index
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed May 18, 2024
1 parent e817ad7 commit 7a9a58e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 22 deletions.
1 change: 0 additions & 1 deletion cache/src/main/java/net/runelite/cache/IndexType.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public enum IndexType
FONTS(13),
MUSIC_SAMPLES(14),
MUSIC_PATCHES(15),
WORLDMAP_OLD(16), // looks unused
WORLDMAP_GEOGRAPHY(18),
WORLDMAP(19),
WORLDMAP_GROUND(20),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@
public class WorldMapDefinition
{
public String name;
public int field450;
public int emptyTileColor;
public int backgroundColor;
public int defaultZoom;
public int fileId;
public int field453;
public int field454;
public int field456;
public boolean isSurface;
public List regionList;
public List<WorldMapTypeBase> regionList;
public String safeName;
public Position position;
public int field463;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,15 @@ public WorldMapDefinition load(byte[] b, int fileId)
def.name = in.readString();

int packedPos = in.readInt();
if (packedPos == -1)
{
def.position = new Position(-1, -1, -1);
}
else
{
int y = packedPos >> 28 & 3;
int x = packedPos >> 14 & 16383;
int z = packedPos & 16383;
def.position = new Position(x, y, z);
}
def.position = Position.fromPacked(packedPos);

def.field450 = in.readInt();
def.emptyTileColor = in.readInt();
def.backgroundColor = in.readInt();
in.readUnsignedByte();
def.isSurface = in.readUnsignedByte() == 1;
def.defaultZoom = in.readUnsignedByte();
int var3 = in.readUnsignedByte();
def.regionList = new LinkedList();
def.regionList = new LinkedList<>();

for (int var4 = 0; var4 < var3; ++var4)
{
Expand All @@ -76,10 +67,6 @@ public WorldMapDefinition load(byte[] b, int fileId)
private WorldMapTypeBase loadType(InputStream var1)
{
int var2 = var1.readUnsignedByte();
// field397 = new class27(1, (byte)0);
// field390 = new class27(2, (byte)1);
// field399 = new class27(3, (byte)2);
// field393 = new class27(0, (byte)3);
WorldMapTypeBase base;
switch (var2)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import net.runelite.cache.fs.Index;
import net.runelite.cache.fs.Storage;
import net.runelite.cache.fs.Store;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
Expand All @@ -54,6 +55,7 @@ public class WorldMapDumperTest
private final Gson gson = new GsonBuilder().setPrettyPrinting().create();

@Test
@Ignore
public void extract() throws IOException
{
File base = StoreLocation.LOCATION,
Expand All @@ -66,8 +68,8 @@ public void extract() throws IOException
store.load();

Storage storage = store.getStorage();
Index index = store.getIndex(IndexType.WORLDMAP_OLD);
Archive archive = index.getArchive(0); // there is also archive 1/2, but their data format is not this
Index index = store.getIndex(IndexType.WORLDMAP);
Archive archive = index.findArchiveByName("details");

byte[] archiveData = storage.loadArchive(archive);
ArchiveFiles files = archive.getFiles(archiveData);
Expand Down

0 comments on commit 7a9a58e

Please sign in to comment.