Graham
bc907d5309
Add support for reading existing .dat2m caches
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
ce741279b4
Add read-only Js5Index.{Group,File} types
...
These will be used by the high-level cache API, where we don't want to
expose mutable versions of the group/file types as that would allow the
index/cache to get out of sync.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
b0f1632105
Improve Js5MasterIndex code coverage
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
eca3a90c78
Improve Js5Compression code coverage
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
7d041e6e22
Replace readAllBytes() with readBytes()
...
It's more concise and I suspect Kotlin's implementation is better than
Java's, as it seems to take available() into account.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
6aea0cfc8e
Add FlatFileStoreZipWriter
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
b067020cad
Ignore trailing blocks with a non-zero next block pointer
...
While the client doesn't appear to be capable of producing a trailing
block with a non-zero next block pointer (though I may have misread the
code), there are caches out there in the wild with trailing non-zero
next block pointers.
When it is reading a group, the client ignores these.
Therefore, for compatibility with the client and existing caches, this
commit removes the StoreCorruptException thrown in this case.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
416dabec4c
Include empty loc groups in the total number of known keys
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
bdaf5aae2c
Rename WHIRLPOOL to DIGESTS for consistency with the Js5Index flags
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
53db5b3314
Add support for the current master index format
...
I'm not sure if the auto-detection code works: I'm assuming that the new
format was introduced at the same time as the lengths flag in Js5Index,
but I haven't confirmed this.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
e8fd432f14
Combine key validation with uncompression
...
As key validation has to uncompress the data anyway to confirm the key
is valid, it seems silly to uncompress twice given everywhere we
performed key validation immediately uncompressed the container
afterwards.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
359891c01e
Convert all test objects to classes
...
This is required for IDEA to display the run test icon in the gutter.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
5d7bd5b5c7
Add support for signed master indexes
...
This commit also changes the way the master index format detection
works, as the previous scheme could not distinguish VERSIONED from
WHIRLPOOL.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
4ccebc7ef8
Replace assertThrows with assertFailsWith
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
8fcf7cae46
Test the master index length validation code
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
4126abfaad
Add support for unversioned master indexes
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
d5d76f9301
Add DiskStoreZipWriter
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
f90b9df505
Replace Paths.get() with Path.of()
...
Paths.get() may be deprecated in a future release.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
918f8ab379
Remove redundant visibility modifier
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
ab3300a8c7
Return old NamedEntry after removal from NamedEntryCollection
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
af0a1e7457
Fix DiskStoreTest and FlatFileStoreTest on Windows
...
As we're comparing a real directory tree with Jimfs, we need to ensure
the platform matches - otherwise it gets confused, and thinks \ is part
of a UNIX file name.
4 years ago
Graham
6023569ce0
Add code for packing and unpacking groups
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
fa20f1e118
Fix Js5MasterIndex::create
...
It didn't uncompress the index files before parsing them.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
30828308b2
Replace assertThrows with assertFailsWith
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
32fe61bd7d
Replace org.junit.jupiter.api.Test with kotlin.test.Test
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
9ddce82df4
Format code
...
This new indentation style for nested calls is annoying, I need to see
if it can be turned off somehow...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
4aa75c8fee
Improve Js5MasterIndex test coverage
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
f1433ec97f
Add method for creating a Js5MasterIndex
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
d78c382ea7
Add in operator support to NamedEntryCollection
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
76977303b2
Add shorthand methods for creating ByteBufs from ByteArrays and Strings
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
f143eef142
Move Kotlin files from src/{main,test}/java to src/{main,test}/kotlin
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
ce5b76ef0f
Rename dev.openrs2 package to org.openrs2
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
efc7ba9d2b
Add underflow/overflow tests
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
107c432e65
Rename NONE to UNCOMPRESSED
...
This is the name used by Jagex.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
8d35b5010a
Add functions for quickly checking if a XTEA key is valid
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
88175e798f
Remove debug println from Js5IndexTest
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
89accc8b26
Rename root to ROOT
...
Path is immutable.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
0afc7a563d
Add Store.open() method
...
It automatically determines whether to use a DiskStore or FlatFileStore.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
d2ee9d3b8b
Check that all decompression algorithms throw IOException on failure
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
0d384fa8f2
Throw IOException for all JS5 decompression errors
...
Should be nicer than the mixture of exception types we used before.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
78f8069177
Add method for stripping the version trailer from a ByteBuf
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
e764403cb2
Add tests for corrupt containers
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
ec4f8b59c9
Use default ByteBufAllocator in unit tests
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
4fdedf298b
Add support for colliding name hashes to Js5Index
...
Annoyingly, the 876 and latest RuneScape 3 cache both have collisions.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
f984f357d8
Add Js5Index implementation
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
0af11d75c3
Add flag to disable encryption of uncompressed containers by default
...
These don't work in the 550 client due to a bug.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
e5e9ece098
Fix JS5 uncompression of large GZIP-compressed files
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
3f8e1a1951
Add FlatFileStoreTest
...
This commit fixes some bugs in FlatFileStore at the same time.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
9f1b2dbc29
Add BufferedFileChannel
...
Similar to the equivalent class in the client.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
2dda87fa4a
Improve testListGroups()
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago