use of net.runelite.cache.definitions.FramemapDefinition in project runelite by runelite.
the class FrameDumper method extract.
// @Test
public void extract() throws IOException {
File base = StoreLocation.LOCATION, outDir = folder.newFolder();
int count = 0;
try (Store store = new Store(base)) {
store.load();
Storage storage = store.getStorage();
Index frameIndex = store.getIndex(IndexType.FRAMES);
Index framemapIndex = store.getIndex(IndexType.FRAMEMAPS);
for (Archive archive : frameIndex.getArchives()) {
List<FrameDefinition> frames = new ArrayList<>();
byte[] archiveData = storage.loadArchive(archive);
byte[] contents = archive.decompress(archiveData);
int framemapArchiveId = (contents[0] & 0xff) << 8 | contents[1] & 0xff;
Archive framemapArchive = framemapIndex.getArchives().get(framemapArchiveId);
archiveData = storage.loadArchive(framemapArchive);
byte[] framemapContents = framemapArchive.decompress(archiveData);
FramemapLoader fmloader = new FramemapLoader();
FramemapDefinition framemap = fmloader.load(0, framemapContents);
FrameLoader frameLoader = new FrameLoader();
FrameDefinition frame = frameLoader.load(framemap, contents);
frames.add(frame);
Files.write(gson.toJson(frames), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
++count;
}
}
logger.info("Dumped {} frames to {}", count, outDir);
}
use of net.runelite.cache.definitions.FramemapDefinition in project runelite by runelite.
the class FramemapDumper method extract.
@Test
public void extract() throws IOException {
File base = StoreLocation.LOCATION, outDir = folder.newFolder();
int count = 0;
try (Store store = new Store(base)) {
store.load();
Storage storage = store.getStorage();
Index index = store.getIndex(IndexType.FRAMEMAPS);
for (Archive archive : index.getArchives()) {
byte[] archiveData = storage.loadArchive(archive);
byte[] contents = archive.decompress(archiveData);
FramemapLoader loader = new FramemapLoader();
FramemapDefinition framemap = loader.load(0, contents);
Files.write(gson.toJson(framemap), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
++count;
}
}
logger.info("Dumped {} framemaps to {}", count, outDir);
}
use of net.runelite.cache.definitions.FramemapDefinition in project runelite by runelite.
the class FramemapLoader method load.
public FramemapDefinition load(int id, byte[] b) {
FramemapDefinition def = new FramemapDefinition();
InputStream in = new InputStream(b);
def.id = id;
def.length = in.readUnsignedByte();
def.field1456 = new int[def.length];
def.field1457 = new int[def.length][];
for (int i = 0; i < def.length; ++i) {
def.field1456[i] = in.readUnsignedByte();
}
for (int i = 0; i < def.length; ++i) {
def.field1457[i] = new int[in.readUnsignedByte()];
}
for (int i = 0; i < def.length; ++i) {
for (int j = 0; j < def.field1457[i].length; ++j) {
def.field1457[i][j] = in.readUnsignedByte();
}
}
return def;
}
Aggregations