Commit graph

57 commits

Author SHA1 Message Date
Gered ccd61e685b tweak format string a bit 2021-11-26 12:05:59 -05:00
Gered d9e9d70bc6 add comments linking original source for encryption and prs compression 2021-11-25 20:40:43 -05:00
Gered 3a5ecb9df5 update README.md 2021-11-25 20:27:13 -05:00
Gered 4229bd54ca add a bunch of README files 2021-11-25 18:37:21 -05:00
Gered a8866064a5 add nicer packet timestamp display in logging output 2021-11-25 17:08:51 -05:00
Gered fa3b26285b lots of rework. handles things way better now
- println output cleaned up a fair bit
- now actually handles scenarios where multiple PSO packets are sent in
  single TCP packets. whoops!
- removed intermediate PsoPacket struct ... just use GenericPacket
- somewhat better way of managing changing client/server "peers" as
  the client connects to different servers within the same pcap capture
2021-11-25 16:53:48 -05:00
Gered 8e64e7059a update help text 2021-11-24 21:41:14 -05:00
Gered c90fed35be fix panic when no arguments provided 2021-11-24 21:29:19 -05:00
Gered 9f0180d610 quickly address some compiler warnings
- removing some old unused functions
- not borrowing fields from a packed struct (PacketHeader)
- minor things that will likely be changed again when i clean things up
  more later on ...
2021-11-24 21:26:21 -05:00
Gered 0f02aa4493 add initial mostly-sorta-working decrypt_packets tool 2021-11-24 21:04:56 -05:00
Gered 3ea12afda2 add InitEncryptionPacket struct 2021-11-24 21:03:48 -05:00
Gered 78fd0f2bda add GenericPacket struct 2021-11-24 21:03:20 -05:00
Gered dadaf27765 add default language constant for packets 2021-11-24 21:01:39 -05:00
Gered fed7cf0272 remove opt-level config
was originally added to speed up some prs compression stuff during
debug builds. don't really want this here all the time though ...
2021-11-24 20:59:53 -05:00
Gered 53c0a7f537 add gci_quest_extract tool 2021-05-25 18:45:36 -04:00
Gered bb82496b65 move actual quest info display functions to psoutils
doing this because i figure this quest info display stuff is _probably_
generally useful, and at the very least i will be re-using it for the
separate gci extraction tool that is going to be committed here next ...
2021-05-25 18:36:29 -04:00
Gered e54bdc600b move test assets to top-level since they're used by multiple crates now 2021-05-25 16:12:56 -04:00
Gered 67bdb76c52 implement quest conversion 2021-05-25 15:46:52 -04:00
Gered f00b007e35 add unit tests for quest info 2021-05-25 14:42:20 -04:00
Gered 1c825e561a clean up some error handling stuff 2021-05-25 14:41:44 -04:00
Gered ae4fc8e9bf also show encoder name associated with the quest's language value 2021-05-25 11:23:43 -04:00
Gered c49f4bcaa9 small touch-ups of quest info display 2021-05-25 11:23:07 -04:00
Gered 5bc061be5f show crc32 for some pieces of .bin and .dat data in quest info display 2021-05-25 11:22:22 -04:00
Gered 7fd21a493c minor cleanups 2021-05-25 10:54:38 -04:00
Gered bf62db4507 add extra validation for .bin function_offset_table_offset 2021-05-25 10:51:45 -04:00
Gered d9e13fade0 add table area validation 2021-05-25 10:46:39 -04:00
Gered d27d9ad072 use wrapping_add here so this doesn't panic when loading non-.dat data 2021-05-25 10:45:28 -04:00
Gered 9dc6e0815e split main into crates for each command available 2021-05-24 19:00:32 -04:00
Gered 4f9ff44be9 add initial psogc_quest_tool utility
only supports showing quest file information
2021-05-24 18:49:41 -04:00
Gered 2da64f97e7 add Display impl for QuestArea 2021-05-24 18:49:02 -04:00
Gered 8a88429250 finish implementing the Quest struct 2021-05-24 16:16:40 -04:00
Gered 6874ed7a8c minor cleanup 2021-05-20 19:33:20 -04:00
Gered aade06d9a9 re-organize some unit tests 2021-05-20 19:32:09 -04:00
Gered 247e2f7482 add unit tests for quest qst loading from bad data 2021-05-20 18:54:48 -04:00
Gered 745c6703c8 switch these checks around so they are run in all cases 2021-05-20 18:54:33 -04:00
Gered 53d2658ea2 minor formatting cleanups 2021-05-20 17:09:22 -04:00
Gered 8aa4fa7c2d add unit tests for quest dat loading from bad data 2021-05-20 17:07:31 -04:00
Gered 8e93f4a3a2 add unit tests for quest bin loading from bad data 2021-05-20 14:21:05 -04:00
Gered 53ec92865b fix up LanguageError 2021-05-20 14:13:22 -04:00
Gered f055daa73d update prs compression functions to catch and return errors
this is probably not an exhaustive set of potential errors, but it
accounts for all the possible ones i've seen as i've been working on
this, that are basically always a result of "bad data".

still a bit worried about potential panics also resulting from bad data
related to overflows and such things ...but have not seen any so far
2021-05-20 13:49:01 -04:00
Gered 5e6dd30fd4 fix offset/len check. oops 2021-05-20 13:45:46 -04:00
Gered 0c57dcb1dd relax ReadFixedLengthByteArray generic constraint a bit
probably not a big deal, but meh, why not
2021-05-20 13:44:15 -04:00
Gered 7850c468ea remove to_fixed_length(), replace usages with to_array()
i don't know how much better or worse either one is really, but i think
i like to_array() better overall. guessing to_array() is probably a bit
better overall, as it should only be one allocation in all cases
2021-05-20 13:37:29 -04:00
Gered 36309879ce add unit tests for writing quest bin/dat/qst to files 2021-05-19 18:50:55 -04:00
Gered 142b03a39b move test assets into test-assets/
i like this better than `assets/tests/`. meh.
2021-05-19 17:58:02 -04:00
Gered 9f60802d37 add qst file support 2021-05-19 17:53:18 -04:00
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