use of net.runelite.cache.fs.Storage in project runelite by runelite.
the class ItemManager method load.
public void load() throws IOException {
ItemLoader loader = new ItemLoader();
Storage storage = store.getStorage();
Index index = store.getIndex(IndexType.CONFIGS);
Archive archive = index.getArchive(ConfigType.ITEM.getId());
byte[] archiveData = storage.loadArchive(archive);
ArchiveFiles files = archive.getFiles(archiveData);
for (FSFile f : files.getFiles()) {
ItemDefinition def = loader.load(f.getFileId(), f.getContents());
items.put(f.getFileId(), def);
}
}
use of net.runelite.cache.fs.Storage in project runelite by runelite.
the class MapImageDumper method loadUnderlays.
private void loadUnderlays(Store store) throws IOException {
Storage storage = store.getStorage();
Index index = store.getIndex(IndexType.CONFIGS);
Archive archive = index.getArchive(ConfigType.UNDERLAY.getId());
byte[] archiveData = storage.loadArchive(archive);
ArchiveFiles files = archive.getFiles(archiveData);
for (FSFile file : files.getFiles()) {
UnderlayLoader loader = new UnderlayLoader();
UnderlayDefinition underlay = loader.load(file.getFileId(), file.getContents());
underlays.put(underlay.getId(), underlay);
}
}
use of net.runelite.cache.fs.Storage in project runelite by runelite.
the class MapImageDumper method loadOverlays.
private void loadOverlays(Store store) throws IOException {
Storage storage = store.getStorage();
Index index = store.getIndex(IndexType.CONFIGS);
Archive archive = index.getArchive(ConfigType.OVERLAY.getId());
byte[] archiveData = storage.loadArchive(archive);
ArchiveFiles files = archive.getFiles(archiveData);
for (FSFile file : files.getFiles()) {
OverlayLoader loader = new OverlayLoader();
OverlayDefinition overlay = loader.load(file.getFileId(), file.getContents());
overlays.put(overlay.getId(), overlay);
}
}
use of net.runelite.cache.fs.Storage in project runelite by runelite.
the class MapImageDumper method loadSprites.
private void loadSprites() throws IOException {
Storage storage = store.getStorage();
Index index = store.getIndex(IndexType.SPRITES);
final int mapsceneHash = Djb2.hash("mapscene");
for (Archive a : index.getArchives()) {
byte[] contents = a.decompress(storage.loadArchive(a));
SpriteLoader loader = new SpriteLoader();
SpriteDefinition[] sprites = loader.load(a.getArchiveId(), contents);
for (SpriteDefinition sprite : sprites) {
if (sprite.getHeight() <= 0 || sprite.getWidth() <= 0) {
continue;
}
if (a.getNameHash() == mapsceneHash) {
BufferedImage spriteImage = new BufferedImage(sprite.getWidth(), sprite.getHeight(), BufferedImage.TYPE_INT_ARGB);
spriteImage.setRGB(0, 0, sprite.getWidth(), sprite.getHeight(), sprite.getPixels(), 0, sprite.getWidth());
// scale image down so it fits
Image scaledImage = spriteImage.getScaledInstance(MAPICON_MAX_WIDTH, MAPICON_MAX_HEIGHT, 0);
assert scaledMapIcons.containsKey(sprite.getFrame()) == false;
scaledMapIcons.put(sprite.getFrame(), scaledImage);
}
}
}
}
use of net.runelite.cache.fs.Storage in project runelite by runelite.
the class CacheServerTest method addInitialFilesToStore.
private void addInitialFilesToStore(Store store) throws FileNotFoundException, IOException {
Storage storage = store.getStorage();
Index index = store.addIndex(0);
Archive archive = index.addArchive(0);
FileData[] files = new FileData[1];
archive.setFileData(files);
FileData file = files[0] = new FileData();
file.setNameHash(7);
byte[] data = "test".getBytes();
Container container = new Container(archive.getCompression(), -1);
container.compress(data, null);
byte[] compressedData = container.data;
storage.saveArchive(archive, compressedData);
}
Aggregations