Search in sources :

Example 1 with TrackLoader

use of net.runelite.cache.definitions.loaders.TrackLoader 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)

Aggregations

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