Struct rscache::Cache [−][src]
pub struct Cache { /* fields omitted */ }
Expand description
A parsed Jagex cache.
Implementations
Constructs a new Cache
.
Each valid index is parsed and stored, and in turn all archive references as well. If an index is not present it will simply be skipped. However, the main data file and reference table both are required.
Errors
If this function encounters any form of I/O or other error, a CacheError
is returned which wraps the underlying error.
Reads from the internal data.
A lookup is performed on the specified index to find the sector id and the total length
of the buffer that needs to be read from the main_file_cache.dat2
.
If the lookup is successfull the data is gathered into a Vec<u8>
.
Errors
Returns an IndexNotFound
error if the specified index_id
is not a valid Index
.
Returns an ArchiveNotFound
error if the specified archive_id
is not a valid Archive
.
Creates a Checksum
which can be used to validate the cache data
that the client received during the update protocol.
NOTE: The RuneScape client doesn’t have a valid crc for index 16. This checksum sets the crc and version for index 16 both to 0. The crc for index 16 should be skipped.
Errors
Returns an error when a buffer read from the reference table could not be decoded / decompressed.
Tries to return the huffman table from the cache.
This can be used to (de)compress chat messages, see Huffman
.