summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeWad.cpp
AgeCommit message (Collapse)Author
2026-02-24DiscIO: Only allow alphanumeric ASCII in game IDsJosJuice
We often use game IDs in paths, so we should try to make sure path traversal is impossible in game IDs. Admittedly, doing any kind of real attack using the six bytes available in game IDs is unrealistic, but no game ID should contain non-alphanumeric or non-ASCII characters anyway. Might also fix https://bugs.dolphin-emu.org/issues/13982 by skipping converting between encodings for game IDs.
2026-01-25Remove unused importsMartino Fontana
Yellow squiggly lines begone! Done automatically on .cpp files through `run-clang-tidy`, with manual corrections to the mistakes. If an import is directly used, but is technically unnecessary since it's recursively imported by something else, it is *not* removed. The tool doesn't touch .h files, so I did some of them by hand while fixing errors due to old recursive imports. Not everything is removed, but the cleanup should be substantial enough. Because this done on Linux, code that isn't used on it is mostly untouched. (Hopefully no open PR is depending on these imports...)
2024-12-15Modernize `std::all_of` with rangesmitaclaw
In DITSpecification.cpp, MaterialAsset.cpp, and ShaderAsset.cpp, lambda predicates were replaced by pointers to member functions because ranges algorithms are able invoke those. In NetPlayClient.cpp, the non-trivial `NetPlay::Player` elements were being passed by value in `NetPlayClient::DoAllPlayersHaveGame()`. This has been fixed. In WIABlob.cpp, the second example's predicate was returning the `std::optional` by value instead of implicitly converting it to a bool. This has been fixed.
2024-05-26DiscIO: drop unused Volume::CheckContentIntegrity() overloadTillmann Karras
The offset-based overload hasn't been in use since f754a1a548f2e599e4cc2d1d799f2d21b520076f.
2023-05-16StringUtil: Move IsPrintableCharacter() into Common namespaceLioncash
2022-08-04DiscIO: Replace IsDataSizeAccurate with GetDataSizeTypeJosJuice
Previously, we had WBFS and CISO which both returned an upper bound of the size, and other formats which returned an accurate size. But now we also have NFS, which returns a lower bound of the size. To allow VolumeVerifier to make better informed decisions for NFS, let's use an enum instead of a bool for the type of data size a blob has.
2022-08-01Implement hw accelerated AESShawn Hoffman
2022-07-26introduce wrapper for SHA1 functionalityShawn Hoffman
2021-12-10Treewide: Adjust order of includesPokechu22
2021-07-05treewide: convert GPLv2+ license info to SPDX tagsPierre Bourdon
SPDX standardizes how source code conveys its copyright and licensing information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX tags are adopted in many large projects, including things like the Linux kernel.
2020-10-22DiscIO: Migrate logging over to fmtLioncash
Eliminates quite a bit of the PRI* macros used for handling 64-bit values.
2020-08-02Make netplay's "same game" check more robustJosJuice
Instead of comparing the game ID, revision, disc number and name, we can compare a hash of important parts of the disc including all the aforementioned data but also additional data such as the FST. The primary reason why I'm making this change is to let us catch more desyncs before they happen, but this should also fix https://bugs.dolphin-emu.org/issues/12115. As a bonus, the UI can now distinguish the case where a client doesn't have the game at all from the case where a client has the wrong version of the game.
2020-07-29DolphinQt: Show a warning when launching an NKit disc imageJosJuice
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-04DiscIO: Add Volume::IsDatelDiscJosJuice
2020-06-07Show an OSD message when running a disc image with a large block sizeJosJuice
This is intended to catch WIA files which have been created using wit's default parameters (40 MiB block size), once the WIA PR is merged. The check does however also work for GCZ files – not that I think anyone has a GCZ file with a block size that large.
2020-01-16StringUtil: Add IsPrintableCharacter and use itLéo Lam
Add a function that safely returns whether a character is printable i.e. whether 0x20 <= c <= 0x7e is true. This is done in several places in our codebase and it's easy to run into undefined behaviour if the C version defined in <cctype> is used instead of this one, since its behaviour is undefined if the character is not representable as an unsigned char. This fixes MemoryViewWidget.
2019-08-06VolumeVerifier: Don't read data multiple timesJosJuice
2019-07-21Re-implement FixCommonKeyIndex for WAD filesJosJuice
The old implementation of this was not able to distinguish between a title that had the common key index set to 1 because it actually was Korean and a title that had the common key index set to 1 due to fakesigning. This new implementation solves the problem by decrypting a content with each possible common key and checking which result matches the provided SHA-1 hash. The problem that the old implementation causes has only been reported to affect a certain pirated WAD of Chronos Twins DX (WC6EUP), but it's possible that the problem would start affecting more WADs if we add support for the vWii common key (which uses index 2). Adding support for the vWii common key would also prevent us from using the simpler solution of always forcing the index to 0 if the title is not Korean.
2019-07-18DiscIO: Merge WiiWAD into VolumeWADJosJuice
These two classes are very similar, so let's merge them.
2019-05-06Reformat repo to clang-format 7.0 rulesTechjar
2019-04-09VolumeVerifier: Verify WAD contentsJosJuice
2019-03-30DiscIO: Make Korean GC checks in Enums.cpp less fragileJosJuice
2019-03-30Volume: Add a GetCertificateChain functionJosJuice
2019-03-30VolumeWad: Implement GetTicketJosJuice
2019-03-30DiscIO: Add way of checking whether blob data size is accurateJosJuice
2019-02-25Keep track of GameTDB ID separately from game IDJosJuice
The difference between Dolphin's game IDs and GameTDB's game IDs is that GameTDB uses four characters for non-disc titles, whereas Dolphin uses six characters for all titles. This fixes: - TitleDatabase considering Datel discs to be NHL Hitz 2002 - Gecko code downloading not working for discs with IDs starting with P - Cover downloading mixing up discs with channels (e.g. Mario Kart Wii and Mario Kart Channel) and making extra HTTP requests. (Android was actually doing a better job at this than DolphinQt!)
2018-10-28Accurate region detection for NAND titlesJosJuice
2018-10-12DiscIO: Rename RegionSwitch/CountrySwitchJosJuice
Callers don't need to know that these functions are implemented with a switch statement.
2018-10-08DiscIO: Move the Korean GC mess out of VolumeGCJosJuice
2018-05-20Reimplement custom PNG banners in game listJosJuice
Fixes https://bugs.dolphin-emu.org/issues/10938 and makes PNG banners available in DolphinQt2 for the first time.
2018-03-31DiscIO: Don't use all uppercase for enum valuesJosJuice
Also removing some prefixes that we don't need now that we're using enum classes instead of plain enums.
2018-03-14Assert: Uppercase assertion macrosLioncash
Macros should be all upper-cased. This is also kind of a wart that's been sticking out for quite a while now (we avoid prefixing underscores).
2017-11-03Avoid UB when reading Wii volume namesJosJuice
2017-11-03Add WiiSaveBanner classJosJuice
This class is similar to the BannerLoaderWii class that was removed in ee694e32.
2017-09-15DiscIO: Use Common::Lazy for loading filesystemsJosJuice
This simplifies FileMonitor a lot and also lets us clean up FilesystemPanel.
2017-06-06DiscIO: Remove C/I/S prefixes from class namesJosJuice
These prefixes were inconsistent with the rest of Dolphin. I'm also renaming VolumeWiiCrypted to VolumeWii because of 1113b13.
2017-06-05DiscIO: Use std::optional in Volume and BlobJosJuice
2017-06-03DiscIO: Use std::optional for GetTitleID instead of pointerLéo Lam
This makes the interface slightly cleaner and a bit more consistent with the other getters. Still not fully the same, since the others don't really handle failures with std::optional; but at least the value is returned by value now, as opposed to having the function take a pointer to a u64.
2017-05-26Check TMD sizes using the actual constantLéo Lam
0x49e4 is the actual maximum TMD size (which is checked against in ES). IsValidTMDSize is added to ESFormats to avoid duplicating the constant.
2017-05-20VolumeWiiCrypted: Cache TMDs and ticketsJosJuice
2017-05-19Replace some usages of IVolume::ReadSwapped with IBlobReader::ReadSwappedJosJuice
Skips needing to specify PARTITION_NONE.
2017-05-16VolumeWiiCrypted: Replace ChangePartition with a partition parameterJosJuice
By removing mutable state in VolumeWiiCrypted, this change makes partition-related code simpler. It also gets rid of other ugly things, like ISOProperties's "over 9000" loop that creates a list of partitions by trying possible combinations, and DiscScrubber's volume swapping that recreates the entire volume when it needs to change partition.
2017-03-20Merge pull request #5099 from JosJuice/wii-menu-stringsMatthew Parlane
Display nicer version strings for the Wii Menu
2017-03-20Merge pull request #5093 from JosJuice/six-char-game-idsMatthew Parlane
Use 6-char game IDs for NAND tiles (if they are printable)
2017-03-18Check whether WAD is a channel before reading namesLéo Lam
Dolphin assumes that content 0 is opening.bnr, without checking whether content 0 exists or if it is even supposed to be there (it's only there for channels). This results in sometimes reading garbage. This adds a check to only try to read names from content 0's header if the title is a channel (channel, system channel or game channel).
2017-03-18Return a more meaningful type from GetSysMenuRegionJosJuice
2017-03-16Use 6-char game IDs for NAND tiles (if they are printable)JosJuice
5.0-2712 made ES's code for setting the game ID use the title ID converted to hex (except for disc titles) instead of using a 6-char game ID like before. Then, 5.0-2830 made us use that code even when loading game INIs. This breaks the expectations of both users and the game INIs we ship with. This commit makes Dolphin use 6-char game IDs for all titles (unless the 6-char ID would contain unprintable characters, which is the case with e.g. the Wii Menu). I'm also putting unprintability checks in VolumeWad for consistency.
2017-03-13Remove Blob nullptr checks from Volume codeJosJuice
There's no point in creating a volume without a blob, since essentially all the functionality of a volume requires a blob to be used. Also, VolumeCreator doesn't support creating volumes without blobs (it can't even figure out the volume type unless it gets a blob), so it's currently impossible for a volume to be created without a blob.
2017-03-09Volume: Use ReadSwapped moreJosJuice
Most of the Volume code was written before this convenience function was added. Let's use it more. Also deleting m_pReader nullptr checks that are unnecessary because of Read (which ReadSwapped calls) already having a nullptr check.
2017-02-26Use ESFormats for TMDsLéo Lam
We already have a TMDReader, so let's actually use it. And move ESFormats to IOS::ES, since it's definitely part of IOS. This adds a DiscIO dependency on Core which will be fixed in a follow-up PR.