Commit Graph

186 Commits

Author SHA1 Message Date
Maschell
59411e4c7d Throw proper exception while hashing 2019-04-19 14:47:39 +02:00
Maschell
9f6f9aaabe Make sure all streams are really closed via try/finally block. Added a "closeAll" function in StreamUtils which helps to close a list of closeables 2019-04-19 11:41:12 +02:00
Maschell
fccd8f8bf4 Throw an Exception when a FSTDataProviderNUSTitle has no FSTEntry root 2019-04-19 11:39:09 +02:00
Maschell
a5929f346d Replace System.exit with throwing an Exception 2019-04-19 11:38:02 +02:00
Maschell
39d10291a2 Fix the warning when you try to decrypt a FSTEntry where the content is empty. 2019-04-19 11:37:22 +02:00
Maschell
dbad684549 Check for execptions when reading an inputstream 2019-04-19 11:36:49 +02:00
Maschell
ef878f7e41 Return an empty HashMap instead of null. 2019-04-19 10:57:18 +02:00
Maschell
1ebe37b77e Adjust log levels 2019-04-19 10:56:59 +02:00
Maschell
4aa6f532f0 Organize imports 2019-04-19 10:56:43 +02:00
Maschell
9b38f9c8c6 The readToFile function of the FSTDataProvider Interface now does return a value value to indicate success 2019-04-19 10:56:24 +02:00
Maschell
194b3084ae Add a missing input.close() when an exception happens. 2019-04-19 10:45:01 +02:00
Maschell
d3f2361803 Throw an exception instead of doing a System.exit when the offset is too big. 2019-04-19 10:44:08 +02:00
Maschell
3a6f592294 Use break on reading error instead of return, this way the streams will be closed properly. 2019-04-19 10:43:32 +02:00
Maschell
c47c9913ac Change the content and parent attribute of a FSTEntry to an Optional 2019-04-19 10:42:33 +02:00
Maschell
75e28a733b Some minor code cleanup for the WUDInfoParser 2019-04-18 23:28:01 +02:00
Maschell
a9fc37244a Only throw an exception when no content was found for files that are actually in the title (and not a directory) 2019-04-18 23:27:39 +02:00
Maschell
f8146ce56b Make SHA2 attribute of ContentInfo Optional 2019-04-18 23:25:20 +02:00
Maschell
7c9fe334a8 The FST and Ticket attribute of the NUSTitle are now optionals 2019-04-18 11:18:32 +02:00
Maschell
73440af121 Return false instead of throwing an exception while trying to extract missing files 2019-04-16 12:59:34 +02:00
Maschell
a521b045ab - Fix non-gm parition with FST > 0x8000 bytes.
- Wrap reading from discReader in WUDInfoParser.
- Only save the complete WUDPartitionHeader in the game partition
- Replace the WUDPartitio.getAbsolutePartitionOffset by getPartitionOffset.
2019-04-14 22:09:15 +02:00
Maschell
54536f29ab Add simple wrapper for the "readFileAsStream" function of the FSTDataProvider 2019-04-14 20:39:37 +02:00
Maschell
151ad6e2a6 Add support for titles without FST. 2019-04-14 14:50:01 +02:00
Maschell
1698acb3f6 Don't swallow the exception on checksum errors. 2019-04-14 14:49:47 +02:00
Maschell
7d8bb58cc4 Make SI partitions optional for Wii U discs 2019-04-14 13:24:35 +02:00
Maschell
cbfe6539a5 Check if the TMD is from a WiiU by checking the titleID 2019-04-11 17:56:59 +02:00
Maschell
2f820bbe17 Add a new DecryptionService using a FSTDataProvider. 2019-04-11 13:29:08 +02:00
Maschell
40f6b2af73 Remove FSTUtil functions from the NUSTitle class, they were just wrappers to the FSTUtils class are now unused. 2019-04-11 13:28:44 +02:00
Maschell
8c75a1a43e Move the decryption of a inputstream into a output stream in the NUSDecryption class. 2019-04-11 13:28:12 +02:00
Maschell
fbceae0558 - Replace the readFileAsStream (to InputStream) function with a default implementation in the FSTDataProvider interface. This way the implementations only need to provide a function to write into a outputstream.
- Optimize the readEncryptedToStream function on the DiscReader. The normal wud reader don't need to pipe the stream anymore.
2019-04-11 13:27:21 +02:00
Maschell
89d5927acd Add a readFileToStream function to the FSTDataProvider interface while allows your to read a file to a outputstream 2019-04-11 13:14:50 +02:00
Maschell
53993dc8c4 Remove DecryptionService for now 2019-04-10 20:13:52 +02:00
Maschell
88c0bb8a9e Add/Update copyright information. Minor cleanup, moved some interfaces 2019-04-10 20:13:38 +02:00
Maschell
c0cdebba97 Add a WUDLoader utility class to load a WUD/WUX and get the Partitions as NUSTitles or FSTDataProvider. 2019-04-10 20:03:48 +02:00
Maschell
4d703d631a Add a FSTDataProvider implementation using a WUDDataPartition. 2019-04-10 20:01:52 +02:00
Maschell
8e4faa58dc Add a NUSTitleLoaderFST which allows you to create a NUSTitle from a FSTDataProvider. Useful for recursive mounting 2019-04-10 20:01:19 +02:00
Maschell
de7909eb34 Throw on IOException if the FST length is not aligned to 16 before decrypting. 2019-04-10 19:59:56 +02:00
Maschell
b836705e92 Add a FSTDataProvider based on NUSTitles. This will replace the DecryptionService in the future 2019-04-10 19:27:29 +02:00
Maschell
aae5feafc0 Add a interface "FSTDataProvider" which helps you getting data for a given FSTEntry 2019-04-10 18:59:39 +02:00
Maschell
44b04ea637 Formatting and organizing imports 2019-04-10 18:57:55 +02:00
Maschell
b6a5946f9e Move some classes and interfaces 2019-04-10 18:55:40 +02:00
Maschell
2913ccf8b2 - Removed the NUSTitlerLoaderWUD
- Instead of just parsing the GI partitions, parse now all non-GM partition as "WUDDataPartition".
- Simplified and optimized the WUDInfoParser
2019-04-10 18:52:01 +02:00
Maschell
422c36dde3 Throw a ParseException instead of returning null in the ContentInfo 2019-04-10 18:47:57 +02:00
Maschell
651e32e7ba - The NUSTitleLoaders now don't inherit anymore from a class, but use a static function from NUSTitleLoader. The NUSDataProvider is supplier by a Supplier argument. This simplifies the config.
- Remove the global common key. Now the common key needs to be provided to every loading instance. This way loading with different common keys is much easier (and more robust)
2019-04-10 18:47:22 +02:00
Maschell
d08a42719a Convert the NUSDataProvider class into an interfacer. All Utility functions are moved to a new DataProviderUtils class.
Changes the return values of the raw TMD/TICKET/CERT to Optionals.
Replacing some more null values with Optionals
2019-04-10 18:43:44 +02:00
Maschell
40cb09873d Close the outputstream after reading from a WUX 2019-04-10 18:13:25 +02:00
Maschell
95c6c085f6 Optimize the getBytesFromStream function StreamUtils 2019-04-10 18:11:54 +02:00
Maschell
536c28a3b1 Throw a ParseException on error in the ContentFSTInfo 2019-04-10 18:08:56 +02:00
Maschell
cf6b52780c Throw a ParseException on error in the FST and FSTService 2019-04-10 18:08:04 +02:00
Maschell
d1fb43bf65 Throw a ParseException on error in the Content. 2019-04-10 18:06:56 +02:00
Maschell
88d9f90735 Returns Optionals instead of null or throw proper Exceptions on WUDService class. 2019-04-10 18:06:02 +02:00
Maschell
9ecd9825b5 Throw a ParseException on error in the TMD. 2019-04-10 18:05:14 +02:00
Maschell
7869fa42b6 Make the WUDPartition class abstract 2019-04-10 18:00:32 +02:00
Maschell
64b6cfed97 Add getAbsolutePartitionOffset function to the WUDPartition class. 2019-04-10 18:00:21 +02:00
Maschell
de322b9ebc Use a lambda expression to simplify the sorting in WUDPartitionHeader 2019-04-10 17:59:02 +02:00
Maschell
d713a3d735 Throw an exception instead of returning null in the WUX DiscReader 2019-04-10 17:58:20 +02:00
Maschell
70d45e80fa Throw exceptions instead returning null in the WoomyParser 2019-04-10 17:57:15 +02:00
Maschell
9cc1a8c948 Update the XMLParser to return Optionals instead of null values. 2019-04-10 17:56:36 +02:00
Maschell
e3dbf81a8e Add try catch arround the output write in decryptFileStreamHashed to check if the output stream was already closed. 2019-04-10 17:54:20 +02:00
Maschell
c2579f1cd8 Add FSTUtils class for common FST operations 2019-04-10 17:48:54 +02:00
Maschell
dd8f7bcb5f Added optional parameter to limit the size of a input stream for content 2019-04-07 14:57:41 +02:00
Maschell
ac1d08645d Add support for the "LocalBackup" format 2019-04-07 14:56:32 +02:00
Maschell
486f146a06 Do not cast when not needed. 2019-04-07 14:54:43 +02:00
Maschell
1f1cd3e64a Return a IOException when parsing a WUD fails 2019-04-07 14:54:02 +02:00
Maschell
7bd424ec42 Fix a bug in the "getChunkOfStream" function 2019-04-07 14:53:35 +02:00
Maschell
31fcc4fc6d Fix the buffer size in the getBytesFromStream function 2019-04-07 00:38:51 +02:00
Maschell
a5bc706cb9 Fixing the IV for certain reads 2019-04-07 00:12:20 +02:00
Maschell
0261e33b80 Fix potential bug 2019-04-07 00:11:13 +02:00
Maschell
48f8629744 Implement random access for non-hashed files 2019-04-07 00:10:36 +02:00
Maschell
57611173b4 Optimize the NUSDataProviderWUDGI implementation 2019-04-06 16:57:12 +02:00
Maschell
a0ce93dc38 Fix the return type of the "getDecryptedOutputAsInputStream" function 2019-04-06 16:56:38 +02:00
Maschell
502acbbf68 Add "getChunkFromFIle" function to the DecryptionService to get portions of a file 2019-04-06 16:55:57 +02:00
Maschell
e8985f0c12 Fix and optimize the getFileEntryDir and getFSTEntryByFullPath functions 2019-04-06 16:51:15 +02:00
Maschell
847ed71ae1 Add wrapper a wrapper function to get chunk of data from a content to the ExtractionsService 2019-04-06 16:50:36 +02:00
Maschell
4f2d811b69 Optimize the getChunkFromContent function for the WUD implementations 2019-04-06 16:48:42 +02:00
Maschell
a0ce50a4b5 Added getChunkFromContent function to "NUSDataProvider" class for getting chunks of a content file 2019-04-06 16:47:02 +02:00
Maschell
8d6c6b8691 Fix just another bug in getFSTEntriesByRegEx 2019-04-04 10:23:04 +02:00
Maschell
671ade1fe0 Fix the getFSTEntriesByRegEx functions 2019-04-04 10:21:43 +02:00
Maschell
9acd11bd11 Optimize getFSTEntryByFullPath 2019-03-01 15:56:15 +01:00
Maschell
9bc418357e [NUSTitle] Improve getFSTEntriesByRegEx 2019-02-28 22:13:52 +01:00
Maschell
89fbc830f1 [NUSTitle] Fix bug. 2019-02-28 21:53:09 +01:00
Maschell
43d9d6f5cc [NUSTitle] Added functions getAllFSTEntriesAsStream and getAllFSTEntryChildrenAsStream 2019-02-28 21:34:41 +01:00
Maschell
9b179f51a6 [NUSTitle] Simplify the getFSTEntriesFlatByContents function 2019-02-28 21:17:18 +01:00
Maschell
2f26e1d39e [NUSTitle] Add function to a dir by name 2019-02-28 21:15:55 +01:00
Maschell
6dbd94c9a0 [FSTEntry] Parse name only when needed. 2019-02-28 21:01:21 +01:00
Maschell
cd58f8b580 [DecryptionService] Stop caching 2019-02-28 21:00:40 +01:00
Maschell
015e3fff18 [FSTEntry] Build path from parents instead of caching it. 2019-02-28 21:00:08 +01:00
Maschell
6d98a8b92c File::listFiles may return null, let's catch that potentional null pointer. 2019-02-28 10:03:11 +01:00
Maschell
73b6787c42 Fix deadlock when trying to get a input stream for file thats not in the current title 2019-02-24 09:33:02 +01:00
Maschell
8124bb28e1 Fixes a little but nasty bug. 2019-01-06 16:43:19 +01:00
Maschell
cd56a50d3f Fix the h3 filename 2018-12-16 19:35:27 +01:00
Maschell
8fcadea631 Fix a missing "!" 2018-12-16 15:25:22 +01:00
Maschell
654e2f38f7 Ignore cases in filenames, EXT4 is case sensitive... 2018-12-16 15:21:16 +01:00
Maschell
f0306b8cce Add warnings when files couldn't be found. 2018-12-16 15:03:46 +01:00
Maschell
fa3b0df7d2 Fix some paths for *nix users. 2018-12-16 13:19:26 +01:00
Maschell
fb670b5217 Rename "decryptFSTEntryToSync" function to "decryptFSTEntryTo" 2018-12-06 17:41:17 +01:00
Maschell
b6c6ae7320 Improved logging 2018-12-06 17:40:11 +01:00
Maschell
ed488d3904 Organize import, formatting. 2018-12-06 17:37:32 +01:00
Maschell
8fffcb1343 Try to parallize decryption if possible 2018-12-06 17:23:09 +01:00
Maschell
a46011c6ea Added options to disable parellelisation 2018-12-06 17:10:15 +01:00
Maschell
8ef84f48dd Extract contents in parallel if supported. 2018-12-06 16:48:36 +01:00