Commit graph

1139 commits

Author SHA1 Message Date
JosJuice
bdd28c0edf DiscIO: Expand WIA/RVZ header size heuristic comments 2020-08-31 14:46:13 +02:00
JosJuice
f7f0fa2d85 DiscIO: Adjust WIA/RVZ header size heuristic
The heuristic was not allocating enough space for Metroid: Other M,
at least when using the default settings. (This didn't break the
file, it just caused some headers to be placed at the end of the
file instead of at the start and wasted a few hundred kilobytes.)
2020-08-22 22:26:55 +02:00
Tillmann Karras
ca61b6c1ab DiscIO: make use of std::nullopt
This also fixes a bogus GCC warning.
2020-08-08 21:53:27 +01:00
Tillmann Karras
d2b06f4786 Fix various -Wshadow warnings 2020-08-08 21:45:03 +01:00
JosJuice
7ef0bc0359 VolumeVerifier: Split TMD error from ticket error for WADs
When I first made VolumeVerifier, I figured that the distinction
between an unsigned ticket and an unsigned TMD was a technical
detail that users would have no reason to care about. However,
while this might be true for discs, it isn't equally true for
WADs, due to the widespread practice of fakesigning tickets to
set the console ID to 0. This practice does not require
fakesigning the TMD (though apparently people do it anyway,
at least sometimes...), and the presence of a correctly signed
TMD is a useful indicator that the contents have not been
tampered with, even if the ticket isn't correctly signed.
2020-08-08 21:15:51 +02:00
LC
0aaddf8b19
Merge pull request #8990 from JosJuice/wia-conversion-warning
DiscIO: Fix conversion warning
2020-07-30 21:45:24 -04:00
JosJuice
2e8c5b4521 DolphinQt: Show a warning when launching an NKit disc image
It is my opinion that nobody should use NKit disc images without
being aware of the drawbacks of them. Since it seems like almost
nobody who is using NKit disc images knows what NKit is (hmm, now
how could that have happened...?), I am adding a warning to Dolphin
so that you can't run NKit disc images without finding out about the
drawbacks. In case someone really does want to use NKit disc images,
the warning has a "Don't show this again" option. Unfortunately, I
can't retroactively add the warning where it's most needed:
in Dolphin 5.0, which does not support Wii NKit disc images.
2020-07-29 21:05:57 +02:00
JosJuice
a05b1f9ab9 DiscIO: Fix conversion warning
Should fix https://bugs.dolphin-emu.org/issues/12208.
2020-07-29 10:55:02 +02:00
Tillmann Karras
bf5b1092b2 DiscIO: fix -Wreorder warning 2020-07-24 17:41:37 +01:00
JosJuice
f7c32bc04e RVZ: Fix split seed reads
This could cause read errors if chunks were laid out a certain
way in the file and the whole chunk wasn't being read at once.
Should fix https://bugs.dolphin-emu.org/issues/12184.
2020-07-11 17:45:16 +02:00
JosJuice
74f74ac928 DiscIO: Use Volume::IsDatelDisc in VolumeVerifier
I forgot to do this in the PR where I added Volume::IsDatelDisc.
2020-07-04 20:24:26 +02:00
JosJuice
fb922781e7 RedumpVerifier: Treat Datel game IDs as empty
Replacement for the reverted commit
f9705fd117.
2020-07-04 15:00:02 +02:00
JosJuice
f24566bf39 DiscIO: Add Volume::IsDatelDisc 2020-07-04 14:51:13 +02:00
JosJuice
f9aaf8b971 Revert "Return nothing from VolumeWii::GetGameTDBID if Datel"
This reverts commit f9705fd117.
GameTDB.com has covers for non-GNHE5d Datel discs.
2020-07-04 14:45:15 +02:00
JosJuice
d17b801518 DiscIO: Deduplicate some VolumeGC/VolumeWii code 2020-06-25 16:37:21 +02:00
JosJuice
d494e0230c Show file format details in game properties 2020-06-21 20:47:23 +02:00
JosJuice
660d81a10b RVZ: Bump version number to 1.0 2020-06-21 12:38:03 +02:00
JosJuice
224c6e799d RVZ: Extend GroupEntry 2020-06-17 13:48:45 +02:00
JosJuice
f2c38c0e67 RVZ: Make m_rvz a template parameter
Needed for the next commit.
2020-06-17 13:48:45 +02:00
JosJuice
ca4e4a6207 WIA/RVZ: Move (de)compression to a different file 2020-06-17 13:48:45 +02:00
JosJuice
3f753fc87d RVZ: Detect junk data in the same block as a file 2020-06-17 13:48:44 +02:00
JosJuice
4b74993374 RVZ: Store pseudorandom junk data efficiently 2020-06-17 13:48:42 +02:00
JosJuice
1e92b54bf5 WIA/RVZ: Skip some memory allocations when reusing chunks 2020-06-17 13:48:16 +02:00
JosJuice
f5ef70fc76 RVZ: Don't store redundant exceptions when chunk size is < 2 MiB 2020-06-17 13:48:16 +02:00
JosJuice
b06c50ed2e RVZ: Support chunk sizes between 32 KiB and 2 MiB
WIA doesn't support smaller than 2 MiB.
2020-06-17 13:48:15 +02:00
JosJuice
0d433baeb5 RVZ: Remove PURGE support
PURGE isn't especially useful, while requiring some annoying
special handling in the file format. If you want no compression,
use NONE. If you want fast compression, use Zstandard.
2020-06-17 13:48:15 +02:00
JosJuice
1f7c0b636f RVZ: Add Zstandard as a compression method 2020-06-17 13:48:12 +02:00
JosJuice
e2ae2b3b0b Add new file format RVZ based on WIA 2020-06-17 13:47:34 +02:00
JosJuice
f21a254042 WIA: Implement multithreaded compression 2020-06-17 13:47:34 +02:00
JosJuice
9dea8169e0 WIA: Write all headers at the start of the file
Gets rid of the need to seek to the end of the file
when opening a file.

The downside of this is that we waste a little space,
since we can't know in advance exactly how much
space the compressed parts of the headers will need.
2020-06-17 13:47:34 +02:00
JosJuice
e5b9e1ba1f WIA: Reuse groups when writing
This is useful for the way Dolphin scrubs Wii discs.
The encrypted data is what gets zeroed out, but this
zeroed out data then gets decrypted before being stored,
and the resulting data does not compress well.
However, each block of decrypted scrubbed data is
identical given the same encryption key, and there's
nothing stopping us from making multiple group entries
point to the same offset in the file, so we only have
to store one copy of this data per partition.

For reference, wit zeroes out the decrypted data,
but Dolphin's WIA writer can't do this because it currently
doesn't know which parts of the disc are scrubbed.

This is also useful for things such as storing Datel discs
full of 0x55 blocks (repesenting unreadable blocks)
without compression enabled.
2020-06-17 13:47:34 +02:00
JosJuice
40e46aee57 WIA: Store all-zero data efficiently 2020-06-17 13:47:34 +02:00
JosJuice
e8b019ac29 WIA: Implement compression 2020-06-17 13:47:30 +02:00
JosJuice
e936c4acd8 WIA: Write hash exceptions 2020-06-17 13:43:54 +02:00
JosJuice
3b8c44fd0e WIA: Decrypt Wii data when writing 2020-06-17 13:43:54 +02:00
JosJuice
115edea34e WIA: Add early support for WIA writing 2020-06-17 13:43:54 +02:00
JosJuice
791e363c9a WIA: Make use of the exception lists 2020-06-17 13:43:54 +02:00
JosJuice
47067f661a WIA: Properly check for overlapping data 2020-06-17 13:43:53 +02:00
JosJuice
04089f24f9 WIA: Implement re-encryption of Wii partition data 2020-06-17 13:43:53 +02:00
JosJuice
e3d291a529 WIA: Check the internal WIA hashes 2020-06-17 13:43:53 +02:00
JosJuice
827437c036 WIA: Fix the handling of chunk sizes larger than 2 MiB 2020-06-17 13:43:53 +02:00
JosJuice
0b407228b7 WIA: Add documentation 2020-06-17 13:43:53 +02:00
JosJuice
01a77ae8a1 WIA: Implement caching and partial decompression 2020-06-17 13:43:53 +02:00
JosJuice
b59ef81a7e WIA: Implement bzip2, LZMA, and LZMA2 decompression 2020-06-17 13:43:52 +02:00
JosJuice
1579e061a3 WIA: Correctly handle data with size not divisible by chunk size 2020-06-17 13:43:52 +02:00
JosJuice
3c373c8aa8 WIA: Treat groups with size 0 as containing only zeroes 2020-06-17 13:43:52 +02:00
JosJuice
36991e2dde WIA: Implement PURGE decompression 2020-06-17 13:43:52 +02:00
JosJuice
3672bd79f3 WIA: Implement ReadWiiDecrypted 2020-06-17 13:43:52 +02:00
JosJuice
2a5fcc9c25 WIA: Add reading raw data 2020-06-17 13:43:51 +02:00
JosJuice
8da5d0c4fe Add an early version of WIABlobReader
It can currently only read the first 0x80 bytes of a disc image,
which is enough for identifying it but not for doing anything else.
2020-06-17 13:43:51 +02:00