use of net.runelite.cache.definitions.loaders.FramemapLoader 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.loaders.FramemapLoader 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);
}
Aggregations