Git Product home page Git Product logo

runescape-cache-tools's Introduction

Viller's RuneScape Cache Tools

A .NET library and command-line interface for manipulating RuneScape's cache.

A precompiled executable of the latest release is available from the releases page on GitHub. Extract the archive and run rsct.exe to list available options.

Features

  • Extract the entire cache or single indexes into separate files in a given directory (rsct.exe extract). Decompressing and handing out extensions where appropriate.
  • Combine sound chunks into full-fledged, named tracks (rsct.exe audio). By default the lossy OGG format is used, but there is also an option to combine the tracks into FLAC files without (minor) loss of quality.
  • Download files straight from Jagex's servers instead of your own incomplete cache.

"The program opens and closes right after"

RSCT is a command-line application. That means it is a text-only application that should be run from your terminal with arguments. Running it directly will only show the manual and exit again. If you're not familiar with the command-line give this page on getting started a read.

Example commands

  • Extract and save files 1-100 from the soundtrack index (40) of your java client's cache: rsct.exe extract --java 40/1-100.
  • Download and combine the track "Soundscape": rsct.exe audio --download --filter=soundscape.
  • Download and print all items that start with "kwuarm": rsct.exe items --download --print="name:kwuarm*"

Soundtrack

I've uploaded all named tracks to YouTube. Their playlist can be found here. You can download the soundtrack we have created together with the tool from my website. It's as complete as possible and is usually updated within one day after updates.

External dependencies

SoX - Sound eXchange, a command-line audio editing tool, is used by the cache tools to stitch soundtrack files together. If you plan on combining soundtrack files SoX needs to be available. On non-Windows platforms this can be accomplished by installing the sox package using something similar to sudo apt install sox on Debian-based platforms. For Windows, either put the SoX binary and its dependencies (dlls) into the same directory as the cache tools, or install the application and add it to your PATH.

Credits

Thanks to all the great community members who helped me in getting the cache figured out and making this a better tool. I'm not listing you here for privacy reasons (unless you want to), but you know who you are!

If you have any remaining questions feel free to send me an email.

runescape-cache-tools's People

Contributors

villermen avatar wertercatt avatar windwakr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

runescape-cache-tools's Issues

Lossless concatenation into OGG file format

Theoretically easy: Concatenate the files into one file, or concatenate all Vorbis packets into one stream and fix the granule positions of the generated pages.

Practically not so much. The audio chunks from the cache are different. When the packets are concatenated, silence appears at the end of every chunk that isn't there when just reading one chunk on its own. This can be made visible by converting to a lossless format from FFmpeg, and opening both files in Audacity. FFmpeg in particular tries to demux instead of decode the audio for as long as possible, thus exposing this issue the easiest. The extra silence is arbitrary in length, so my best guess is that it fills out space that is reserved for the length of the chunk or a rounding error or something. I have not been able to remove the silence without re-encoding the file.

System.ArgumentException: The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)'

I don't know if I'm doing anything wrong but when I try to execute the soundtracks from the cache it throws me an error, I'm executing

rsct.exe --output-directory out --soundtrack-combine

And it throws me the following error:

`System.ArgumentException: The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'.
Parameter name: chars

in System.Text.Encoding.ThrowCharsOverflow()

in System.Text.Encoding.ThrowCharsOverflow(DecoderNLS decoder, Boolean nothingDecoded)

in System.Text.UTF8Encoding.GetChars(Byte* bytes, Int32 byteCount, Char* chars, Int32 charCount, DecoderNLS baseDecoder)

in System.Text.DecoderNLS.GetChars(Byte* bytes, Int32 byteCount, Char* chars, Int32 charCount, Boolean flush)

in System.Text.DecoderNLS.GetChars(Byte[] bytes, Int32 byteIndex, Int32 byteCount, Char[] chars, Int32 charIndex, Boolean flush)

in System.Text.DecoderNLS.GetChars(Byte[] bytes, Int32 byteIndex, Int32 byteCount, Char[] chars, Int32 charIndex)

in System.IO.BinaryReader.InternalReadOneChar()

in System.IO.BinaryReader.Read()

in System.IO.BinaryReader.ReadChar()

in Villermen.RuneScapeCacheTools.Extensions.BinaryStreamExtensions.ReadNullTerminatedString(BinaryReader reader)

in Villermen.RuneScapeCacheTools.Enums.EnumFile.Decode(Byte[] data)

in Villermen.RuneScapeCacheTools.Cache.CacheFile.FromDataFile(DataCacheFile dataFile)

in Villermen.RuneScapeCacheTools.Cache.CacheBase.GetFile[T](Index index, Int32 fileId, Int32 entryId)

in Villermen.RuneScapeCacheTools.Audio.Soundtrack.GetTrackNames(Boolean includeUnnamed)

in Villermen.RuneScapeCacheTools.Audio.Soundtrack.Extract(Boolean overwriteExisting, Boolean lossless, Boolean includeUnnamed, String[] nameFilters)

in Villermen.RuneScapeCacheTools.CLI.Program.CombineSoundtrack()

in Villermen.RuneScapeCacheTools.CLI.Program.Main(String[] args)
`
Sorry if it's not exactly the same names, but my OS it's in Portuguese and it throws me the error in Portuguese.

File class

To decentralize the extracting process. File will allow decrypting/type recognition. Maybe add originating archive to make an educated guess of the type.

RT7 implementation

Started working on it a long time ago, but decided it was better if I fully finished RT5 first.

Names are important, and 2167

[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting 2167 with 2167
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting 2167 with 2167
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting The Desert with 18109
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Scape Wild with 24630
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Insect Queen with 34235
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Deadlands with 15383
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Desert Voyage with 17737
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Tribal with 31058
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Poles Apart with 14948
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Fruits de Mer with 6556
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Woe of the Wyvern with 17653
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Stagnant with 16150
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Jungle Island with 17253
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Gnome Village I with 34480
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Attack I with 32162
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Distant Land with Distant Land
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Castle Wars with Castle Wars
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Pest Control with Pest Control
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Competition with Competition
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting 14948 with Poles Apart
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Hell's Bells with Hell's Bells
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting 2167 with 2167
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting 2167 with 2167
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting 2167 with 2167
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Zaros Stirs with 2511
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting Citadel Theme with 4274
[2016-12-21 15:18:09 WARN Soundtrack (1)] - A soundtrack name pointing to the same file has already been added, overwriting 2167 with 2167

If I remember correctly, 2167 is the default value for one of the enums used.

Download cache directly from servers

Port over RSCD, and add an extra entry in the menu to download. Downloads will go to the rscache folder, as downloading them directly to the actual cache location doesn't seem to work (investigating this one).

Don't crash to desktop

Show a more descriptive error when RuneScape is still using the cache, and move DisplayError higher up the stack.

Index mismatch is still a thing

manpaint99 via reddit:

When i try to extract my live game music (with the command rsct -e -i=40) i get:[18:32:21 INFO CacheBase] Skipped Music/76741 because it was not foun [18:32:21 INFO CacheBase] Skipped Music/41807 because it was not foun [18:32:21 INFO CacheBase] Skipped Music/59397 because it was not foun [18:32:21 INFO CacheBase] Extracted Music/16075.ogg. Villermen.RuneScapeCacheTools.Cache.DecodeException: Index id mismatc Music, got AnimationFrames. à Villermen.RuneScapeCacheTools.Cache.CacheBase.Extract(Index inde ble`1 fileIds, Boolean overwrite, ExtendedProgress progress) à Villermen.RuneScapeCacheTools.Cache.CacheBase.Extract(IEnumerabl , Boolean overwrite, ExtendedProgress progress) à Villermen.RuneScapeCacheTools.CLI.Program.Extract() à Villermen.RuneScapeCacheTools.CLI.Program.Main(String[] args)

Use dedicated cache for extracting/importing

Would make more sense to have a "FlatFileCache" and a way to rapidly exchange data between cache types.

This would allow immediate conversion of a any type of cache to any other type of cache,

Spasms on first chunk

It seems to happen right after the initial chunk.

Is the index file too big? If so how can the extra length be calculated?
Can't sox handle one file and do we have to just run it through it without telling it to combine?
It might also be me interpreting the index of .jaga files wrong...

Please provide a way to losslessly concatenate the ogg vorbis chunks

Currently, when concatenating the individual ogg vorbis chunks that make a music track, sox is used. This will lead to the audio stream being re-encoded into ogg vorbis. This in turn will lead to a tiny loss in quality. Thus, this is not a good way to archive the runescape music as one will not end up with the truly original music but a slightly modified version. There are two solutions:

  1. provide an alternative method where the ogg vorbis chunks are just concatenated into a single file by writing them to the out file one after another. The ogg format supports this simple concatenation of files and most players support it, too.
  2. provide a way to let sox not save the output in ogg vorbis format but in a lossless format like flac. This will result in bigger files than with the first option but is useful for players which do not support concatenated ogg vorbis files (windows media player for example).

Having both options would be useful, too.

Able to extract data from FunOrb/Arcanists?

It's technically still possible to play the game and I seem to still have all spellbooks fully unlocked.

Arcanists doesn't seem to produce the same cache folders however.

Progress reporting

  • Creating and implementing a progress type that logs last action and total work count.
  • Using it in CLI.

Add a better way to handle cache files and their info

RuneTek5CacheFile : CacheFile with the info built in? No, because then classes like JagaFile can't refer back to their own info unless they inherit RuneTek5CacheFile.

RuneTek5CacheFileInfo : CacheFileInfo? better I guess...

JagaFile should be able to inherit CacheFile. How do we convert the data on creation? Just copy over the info and data of a DataCacheFile?

Handling cache on Mac

I'm exploring the cache on Mac OSX, located in ~/Jagex/Runescape, and I believe the file format has changed. They have switched over to sqlite3 databases, is this the NXT format you refer to?

I found OGG files in "js5-14.jcache" and "js5-40.jcache"

Re-create the GUI

It's now a disabled project that will not work on the new cache system.

please provide copyright information

Hi,

I do not see any declaration of copyright anywhere in the code or the surrounding files. This means that by default your code right now is "all rights reserved" which means that nobody is allowed to either modify or distribute it. I assume this is not your intention.

Could you please clarify the copyright situation by stating under what conditions your work can be redistributed and/or modified?

A very simple (but permissive) license is MIT/Expat. If you prefer a more restrictive license, then have a look at the GPL licenses.

Importing files back into cache

Perfect reverse of CacheBase.Extract.

  • #40 probably needs to be fixed in order to make this actually bearable.
  • Library functionality.
  • CLI option.

Lossless soundtrack download from Jagex's servers is unstable and fails often

Upon running the following command, the output terminates in failure either immediately or a random interval into the download.
.\rsct.exe -d -o=C:\Extract1 -s --lossless
[17:25:04 INFO DownloaderCache] Requested connection used outdated version 878. Retrying with higher major version.
[17:25:06 INFO DownloaderCache] Requested connection used outdated version 879. Retrying with higher major version.
System.TimeoutException: The file request was not fulfilled within 10 seconds.
at Villermen.RuneScapeCacheTools.Cache.Downloader.FileRequest.WaitForCompletion()
at Villermen.RuneScapeCacheTools.Cache.Downloader.DownloaderCache.FetchFile(Index index, Int32 fileId)
at Villermen.RuneScapeCacheTools.Cache.CacheBase.GetFile(Index index, Int32 fileId, Int32 entryId)
at Villermen.RuneScapeCacheTools.Cache.CacheBase.GetFile[T](Index index, Int32 fileId, Int32 entryId)
at Villermen.RuneScapeCacheTools.Cache.Downloader.DownloaderCache.<>c__DisplayClass74_0.b__0(Index index2)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at Villermen.RuneScapeCacheTools.Cache.Downloader.DownloaderCache.GetReferenceTable(Index index)
at Villermen.RuneScapeCacheTools.Cache.Downloader.DownloaderCache.FetchFile(Index index, Int32 fileId)
at Villermen.RuneScapeCacheTools.Cache.CacheBase.GetFile(Index index, Int32 fileId, Int32 entryId)
at Villermen.RuneScapeCacheTools.Cache.CacheBase.GetFile[T](Index index, Int32 fileId, Int32 entryId)
at Villermen.RuneScapeCacheTools.Audio.Soundtrack.GetTrackNames(Boolean includeUnnamed)
at Villermen.RuneScapeCacheTools.Audio.Soundtrack.Extract(Boolean overwriteExisting, Boolean lossless, Boolean includeUnnamed, String[] nameFilters)
at Villermen.RuneScapeCacheTools.CLI.Program.CombineSoundtrack()
at Villermen.RuneScapeCacheTools.CLI.Program.Main(String[] args)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.