Search in sources :

Example 1 with TrackDefinition

use of net.runelite.cache.definitions.TrackDefinition in project runelite by runelite.

the class TrackDumperTest method dumpTrackArchive.

private void dumpTrackArchive(File dumpDir, Storage storage, Archive archive) throws IOException {
    byte[] contents = archive.decompress(storage.loadArchive(archive));
    if (contents == null) {
        return;
    }
    TrackLoader loader = new TrackLoader();
    TrackDefinition def = loader.load(contents);
    String name;
    if (archive.getNameHash() != 0) {
        name = djb2.getName(archive.getNameHash());
        if (name == null) {
            name = "name-" + archive.getNameHash();
        }
    } else {
        name = "archive-" + archive.getArchiveId();
    }
    File dest = new File(dumpDir, name + ".midi");
    assert !dest.exists();
    Files.write(def.midi, dest);
}
Also used : TrackDefinition(net.runelite.cache.definitions.TrackDefinition) TrackLoader(net.runelite.cache.definitions.loaders.TrackLoader) File(java.io.File)

Example 2 with TrackDefinition

use of net.runelite.cache.definitions.TrackDefinition in project runelite by runelite.

the class TrackLoader method load.

public TrackDefinition load(byte[] b) {
    TrackDefinition def = new TrackDefinition();
    load(def, new InputStream(b));
    return def;
}
Also used : TrackDefinition(net.runelite.cache.definitions.TrackDefinition) InputStream(net.runelite.cache.io.InputStream)

Aggregations

TrackDefinition (net.runelite.cache.definitions.TrackDefinition)2 File (java.io.File)1 TrackLoader (net.runelite.cache.definitions.loaders.TrackLoader)1 InputStream (net.runelite.cache.io.InputStream)1