Commit graph

11 commits

Author SHA1 Message Date
Gered 20a838abd3 add initial packet stuff, including quest header/data packets 2021-05-18 18:00:47 -04:00
Gered 7f8a8f75e0 allow non-dword-sized data to be passed in to crypt()
this is not actually recommended, as it _technically_ does "mess up"
the sequence (1-3 zero-bytes are being encrypted along with your 1-3
remaining bytes in non-dword-sized data buffers, but those additional
encrypted zero-bytes are not being given back to you at the end).

however, in my opinion, this is quite unlikely to pose a problem for
anyone. for dealing with PSO packets, i'm pretty sure all of those end
up being dword-sized anyway, so no issue there. for encrypting and
decrypting offline quest data, the compressed bin/dat data _could_
technically be non-dword-sized (as i actually encountered today) so you
would otherwise need to pad the input data before calling crypt()
anyway. and in this case you are not going to be using that very same
Crypter instance to do any further encrypting/decrypting ... so it's
actually no problem at all.

so, to me, the convenience of having crypt() just automatically be able
to deal with any arbitrary size of data was worthwhile.

meh.
2021-05-18 15:05:00 -04:00
Gered c59d115aba add helper trait for reading fixed-length byte arrays
a minor thing, but helps turn this pattern into a nice 1-liner
2021-05-17 13:57:08 -04:00
Gered f2ec776d3f unit test cleanups
test using the safe getter methods, instead of directly accessing the
union fields
2021-05-16 20:47:23 -04:00
Gered 4bcc7904c2 minor method naming adjustments 2021-05-16 20:46:21 -04:00
Gered 2ceca5e673 some re-working of quest bin/dat reading/writing methods
get rid of the generalized traits that the read/write methods were
located in. now those methods are just located directly in the struct
impl itself

also cleaned up quest bin/dat errors

added validation checks in quest bin/dat reading
2021-05-16 19:10:06 -04:00
Gered 54a707f860 add to_array helper method 2021-05-16 16:31:14 -04:00
Gered 93c2180da2 call memcmp directly during prs_compress
since we're doing offset/length checks regardless, calling memcmp here
instead of doing a slice comparison is at least twice as fast during
non-release builds. this is nice, as prs_compress can be quite slow
during non-release builds. and obviously during release builds, this
would be compiled down to a memcmp-equivalent anyway.
2021-05-16 16:31:00 -04:00
Gered c84142dfe9 re-work quest errors
use individual error types for both bin and dat modules instead of
all three modules sharing the same error type. maybe marginally better
this way? at least should generally be more clear about whether the
error is related to a bin, dat or general quest processing now
2021-05-15 15:24:49 -04:00
Gered 6c672f3d27 initial quest file bin/dat support
includes loading as compressed/uncompressed. no saving support yet.
2021-05-15 14:48:33 -04:00
Gered c71f9997bd initial commit
starting conversion of these tools over to rust. ported fuzziqer
encryption and prs compression routines over
2021-05-15 14:47:19 -04:00