summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/Volume.h
AgeCommit message (Collapse)Author
2026-07-11Core: Add `Volume::GetSimulatedMemorySize()`.cristian64
The data structure of the `bi2.bin` file in which the simulated memory size is set: > **13.2 Disk header Information** > > this is loaded to the Address in `0x800000f4` when a disc is initialized by the IPL > > | offset | end | size | Description | > | :------: | --- | :--: | --------------------- | > | `0x0000` | | 4 | Debug-monitor Size | > | `0x0004` | | 4 | Simulated Memory Size | > | `0x0008` | | 4 | Argument offset | > | `0x000c` | | 4 | Debug flag | > | `0x0010` | | 4 | Track Location | > | `0x0014` | | 4 | Track size | > | `0x0018` | | 4 | Countrycode | > | `0x001c` | | 4 | ? | See https://hitmen.c02.at/files/yagcd/yagcd/chap13.html#sec13.2. Most GameCube games set the value to `24 MiB`, which matches the physical memory size. Most Wii games set the value to `0 MiB` (unset). The debug build of _Mario Kart: Double Dash!!_ is one game that sets the value to `48 MiB`.
2026-03-23Use more std::span argumentsSintendo
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-02-24DiscIO: Move DecodeString to Volume.cppJosJuice
This had to be in the header back when it was templated, but 083faa8b made it not templated.
2026-02-15DiscIO: Make Volume::DecodeString take a std::span so it can work with ↵Jordan Woyak
std::array.
2026-02-15Added Triforce supportcrediar
2025-11-23Core/DiscIO: Add a setting to load the running game into memory via ↵Jordan Woyak
CachedBlobReader.
2025-04-21Implement Triforce ID parsingZopolis4
2025-04-19DiscIO: Make variables constexprDr. Dystopia
2025-04-15DiscIO/Volume: Fix Partition struct comparison operatorsDr. Dystopia
2024-10-10C++20: Synthesize `operator!=` From `operator==`mitaclaw
The inequality operator is automatically generated by the compiler if `operator==` is defined.
2024-05-26DiscIO: drop unused Volume::CheckContentIntegrity() overloadTillmann Karras
The offset-based overload hasn't been in use since f754a1a548f2e599e4cc2d1d799f2d21b520076f.
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-04DiscIO/VolumeWii: Decouple "is encrypted" from "is hashed"JosJuice
Needed for the next commit. NFS disc images are hashed but not encrypted. While we're at it, also get rid of SupportsIntegrityCheck. It does the same thing as old IsEncryptedAndHashed and new HasWiiHashes.
2022-07-26introduce wrapper for SHA1 functionalityShawn Hoffman
2021-10-24DiscIO: Add CreateDisc/WAD/Volume() overloads that take a BlobReader directly.Admiral H. Curtiss
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.
2021-03-22VolumeVerifier: Align partition reads to groupsJosJuice
This improves the speed of verifying Wii WIA/RVZ files. For me, the verification speed for LZMA2-compressed files has gone from 11-12 MiB/s to 13-14 MiB/s. One thing VolumeVerifier does to achieve parallelism is to compute hashes for one chunk of data while reading the next chunk of data. In master, when reading data from a Wii partition, each such chunk is 32 KiB. This is normally fine, but with WIA and RVZ it leads to rather lopsided read times (without the compute times being lopsided): The first 32 KiB of each 2 MiB takes a long time to read, and the remaining part of the 2 MiB can be read nearly instantly. (The WIA/RVZ code has to read the entire 2 MiB in order to compute hashes which appear at the beginning of the 2 MiB, and then caches the result afterwards.) This leads to us at times not doing much reading and at other times not doing much computation. To improve this, this change makes us use 2 MiB chunks instead of 32 KiB chunks when reading from Wii partitions. (block = 32 KiB, group = 2 MiB)
2020-09-06Merge pull request #8861 from JosJuice/netplay-hashJMC47
Make netplay's "same game" check more robust
2020-08-08DiscIO: make use of std::nulloptTillmann Karras
This also fixes a bogus GCC warning.
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-25DiscIO: Deduplicate some VolumeGC/VolumeWii codeJosJuice
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-04Fix several warningsLéo Lam
A small, nonexhaustive set of warning fixes. The DiscIO Volume change is a workaround for a GCC bug [1] that causes returning an unengaged std::optional to emit annoying -Wmaybe-uninitialized warnings. This last change alone fixes pages upon pages of warnings since Volume.h is included from several files. -Wstringop-truncation is another irrelevant warning for us, but unfortunately there seems to be no way to disable it without adding ugly pragmas wherever the warning appears.
2019-08-06VolumeVerifier: Don't read data multiple timesJosJuice
2019-08-02DiscIO/Volume: Make Partition's interface constexprLioncash
PARTITION_NONE technically has a runtime static constructor otherwise. This allows compile-time instances of Partition to be created without the use of a static constructor.
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-07-18DiscIO: Add functions CreateDisc and CreateWADJosJuice
...in addition to the existing function CreateVolume (renamed from CreateVolumeFromFilename). Lets code easily add constraints such as not letting the user select a WAD file when using the disc changing functionality.
2019-04-09VolumeVerifier: Verify WAD contentsJosJuice
2019-04-09VolumeVerifier: Check hashes in Wii partitionsJosJuice
2019-03-30Volume: Add a GetCertificateChain functionJosJuice
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-09-30Fix reading title IDs of Wii discsJosJuice
Partial revert of a1db82a. Should fix https://bugs.dolphin-emu.org/issues/11404.
2018-09-12Read Wii disc metadata from the unencrypted headerJosJuice
The header of a Wii disc can be read from two places: The unencrypted area at the beginning of the disc, or the beginning of the game partition. The two copies are usually identical (except for 0x60 and 0x61), but there are exceptions. For most of Dolphin's history, we have been reading from the header inside the game partition when getting metadata. This was however not the case starting with 4.0-4901 and ending with 5.0-3762. This commit once again makes Dolphin read metadata from the unencrypted header, because of the following reasons that I recently was informed about: - The "pink fish" disc has the game ID 410E01 in the unencrypted header but the placeholder game ID RELSAB in the partition header. - The revisions of some games differ between the two headers, with the unencrypted one making more sense. (See https://bugs.dolphin-emu.org/issues/11387) For better or worse, this also means that sloppily hacked games where only the game ID in the unencrypted header has been changed now will use that modified game ID. And unlike with the partition header, there is no signing or hashing that can tell us whether the unencrypted header has been modified by someone other than Nintendo.
2018-05-30Volume/VolumeGC/VolumeWii: Amend variable namingLioncash
Drops prefixed underscores and normalizes names to follow our coding style.
2018-05-23Make the support for unencrypted Wii disc images less brokenJosJuice
These disc images are only used on dev units and not retail units. There are two important differences compared to normal Wii disc images: - The data starts 0x8000 bytes into each partition instead of 0x20000 - The data of a partition is stored unencrypted and contains no hashes Our old implementation was just guesswork and doesn't work at all. According to testing by GerbilSoft, this commit's implementation is able to read and extract files in the filesystem correctly, but the tested game still isn't able to boot. (It's thanks to their info about unencrypted disc images that I was able to make this commit.)
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.
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-08-02DiscIO: Add a Volume::ReadSwappedAndShifted functionJosJuice
This is a fairly common operation, so let's make a utility function for it to cut down on code duplication.
2017-08-01Turn VolumeDirectory into DirectoryBlobJosJuice
This lets VolumeDirectory/DirectoryBlob skip implementing various volume functions like GetGameID, GetBanner, etc. It also lets us view extracted discs in the game list. This ends up breaking the boot process for Wii DirectoryBlobs due to workarounds being removed from the boot process, but that will be fixed later by adding proper DirectoryBlob support for things like TMDs. We now expect the directories to be laid out in a certain format (based on the format that WIT uses) instead of requiring the user to set the DVD root and apploader path settings.
2017-07-16Add warning comments to RegionSwitch and code that uses itJosJuice
2017-06-28FilesystemPanel: Put partitions in separate folders when extracting all ↵JosJuice
partitions
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.