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
5e6afb88f6
Improve RSA method naming
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
0016b8ab7d
Replace AssertionError with IllegalStateException
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
98d25539b9
Combine RSA encrypt and decrypt methods into a single crypt method
...
This allows us to speed up master index signing with the CRT.
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
7b6c0cf1fd
Use block comments for multi-line comments
...
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
936968363b
Add CacheModule
...
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
451d59b9e6
Add missing retain() call to Group.pack()
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
f8835b7581
Always return a mutable Int2ObjectSortedMap from Group.unpack()
...
Originally I used a singleton map if possible, to reduce overhead in the
common case of a group containing a single file. However, the
work-in-progress Cache class needs to mutate the map.
Eventually my plan is to replace the Int2ObjectSortedMaps in Js5Index
and Group with arrays, solving both the overhead and mutation problems.
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
d0dbf4c58e
Make set subject of when
...
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
186c5930a5
Add Js5Archive and Js5ConfigGroup constants for 550
...
Most of these names come directly from the NXT/TFU clients, though a few
are made up as we don't know the official name.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
e384d634cc
Reduce allocations if a singleton set is already mutable
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
df68f6d801
Add Js5ConfigGroup object
...
Empty so far, mostly serves as a reminder for me to populate it along
with the Js5Archive object.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
6023569ce0
Add code for packing and unpacking groups
...
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
36e4fa474b
Fix comment
...
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
61d525c542
Convert Js5MasterIndex.Entry to a data class
...
Spotted by Desetude.
I think this was an accident, as the similar Js5Index.Entry class can't
be a data class (as it contains an array).
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
62271878b6
Replace check with require in Js5MasterIndex::read
...
It makes more sense to throw an IllegalArgumentException here.
Signed-off-by: Graham <gpe@openrs2.org>
4 years ago
Graham
1c13fec91f
Replace `?: throw AssertionError()` with `!!`
...
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
0b43e26d36
Remove redundant toList() calls after sorted()
...
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
06cad72eaa
Add Js5Archive object
...
This will eventually hold the names of each JS5 archive in 550, as and
when I confirm the names from the NXT beta client still match up with
the functionality of each archive in 550.
Currently it only holds then name of index 255.
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
977dd0bd93
Check that we read exactly uncompressedLen bytes
...
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
15d359429e
Add alloc parameter to Store.open()
...
Signed-off-by: Graham <gpe@openrs2.dev>
4 years ago
Graham
a2d41d924f
Change cache's crypto dependency to an API dependency
...
The XteaKey class is used in method signatures.
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