villermen / runescape-cache-tools

A .NET library and command-line interface to interact with RuneScape's cache.
MIT License
78 stars 17 forks source link

Include unlisted tracks with --unnamed-tracks option #65

Closed villermen closed 4 years ago

villermen commented 5 years ago

The current approach to combining the soundtrack works great for all audio listed in-game. A few (200-ish) tracks that are not listed in-game can also be extracted because they are mapped in 17/5. This makes targeted downloads possible, but there are tons of other unlisted tracks and jingles that don't see the light of day this way.

There needs to be a better way to extract exactly what you want.

Maybe through filtering?

While I'm at it I could divide the CLI into separate binaries. That probably requires more maintenance, but makes it more intuitive to use. Doing this has the disadvantage of having to extract files first though... Unless rsct-audio.exe would have all the options of rsct-extract.exe which would kinda defeat the purpose of splitting it up in the first place. A first argument like git does to split it up in modules internally would work better.

villermen commented 5 years ago

Combining any JAGA file

Keep the existing functionality of combining the listed tracks by name in the optimal way utilizing enum files 17/5/65 & 17/5/71:

> rsct soundtrack --source="download" --filter="scape" --flac

An additional "audio" module that can perform a dumb scrape on files:

> rsct audio --source="download" --filter="14/1-1000"

This will just go through all the specified files. If it finds any JAGA files, it will request the additional files it lists and combine the fragments. This will request non-JAGA files multiple times which is pretty inefficient in a downloading context. ¯\_(ツ)_/¯

New CLI layout

Example usages:

> rsct extract --source="C:\Users\Villermen\jagexcache\runescape\LIVE" --files="17/*' --output-directory="over/here"
> rsct import --source="download" --output-directory="C:\Users\Villermen\jagexcache\runescape\LIVE"

Help rendering:

> rstc.exe help -> overview of available modules
> rsct.exe help audio -> available options for audio module

Other fabrications of my brain while thinking this through

A --verbose (-v) option to include debug messages in output instead of checking build type to achieve the same.

Also. I now think it's way better to have a FileDecoder class thingy to return a specific instance of a class. Right now you have to know the file type in advance which is annoying for most general cases. So instead of:

// Will throw an error if the file is not of the generic type
var file = cache.GetFile<EnumFile>(Index.Enums, 5);

I want:

var file = cache.GetFile(Index.Enums, 5);

if (!(file is EnumFile)) {
    // Oh well, at least we can act on it now
}

And to make this more performant, we can change CacheFile to lazily read in properties. I don't know if that really matters considering that I/O will definitely be the bottleneck anyway.

Extraction needs to handle missing files better. Human-readable reasons instead of exceptions please.

Add --add-comment="ARTIST=Jagex Games Studio" to SoX.

rsct info

Index count:
Total files:
rsct info 47
Type of files: AnimationFrames
Files in index: 238948
villermen commented 4 years ago

Took a few years, but we're all set now. Example command: rsct.exe audio --download --scrape=14/1-100.