summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/DiscScrubber.cpp
AgeCommit message (Collapse)Author
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...)
2025-04-22DiscIO: Remove redundant qualifiersDr. Dystopia
2023-10-01Added CopyReader to BlobReader and all subclassesLillyJadeKatrin
A deep-copy method CopyReader has been added to BlobReader (virtual) and all of its subclasses (override). This should create a second BlobReader to open the same set of data but with an independent read pointer so that it doesn't interfere with any reads done on the original Reader. As part of this, IOFile has added code to create a deep copy IOFile pointer onto the same file, with code based on the platform in question to find the file ID from the file pointer and open a new one. There has also been a small piece added to FileInfo to enable a deep copy, but its only subclass at this time already had a copy constructor so this was relatively minor.
2023-08-19DiscIO: Don't keep volume pointer in DiscScrubberJosJuice
Keeping the pointer creates use-after-free opportunities, and we don't have much reason to keep it around anyway.
2022-08-04DiscIO: Adjust GetDataSizeType logic for NFSJosJuice
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.
2021-09-19Core/DiscIO: Extract disc and partition constants to DiscUtils.h.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-09DiscIO: Move some code from DiscExtractor to new file DiscUtilsJosJuice
2020-10-22DiscIO: Migrate logging over to fmtLioncash
Eliminates quite a bit of the PRI* macros used for handling 64-bit values.
2020-04-24DiscIO: Move scrubbing code out of ConvertToGCZJosJuice
This way, scrubbing can also be performed when converting to other formats.
2020-04-24DiscIO: Add GameCube disc scrubbing supportJosJuice
The code was actually already rather well adapted for this. We more or less just have to skip ParseDisc and run ParsePartitionData directly. This required the PartitionHeader struct to be removed (which wasn't that useful anyway).
2020-04-24DiscIO: Fix edge case where blocks could get scrubbed accidentallyJosJuice
If we start 31 KiB into a 32 KiB block and want to mark 2 KiB of data as used, we need to mark 2 blocks as used, not just 1. This problem is avoided when calling MarkAsUsed from MarkAsUsedE, since MarkAsUsedE aligns to 32 KiB on its own. Most calls to MarkAsUsed are from MarkAsUsedE, which is why this hasn't been a noticeable problem in the past.
2020-04-24DiscIO: Allow converting from formats other than ISO and GCZJosJuice
The constant DESIRED_BUFFER_SIZE was determined by multiplying the old hardcoded value 32 with the default GCZ block size 16 KiB. Not sure if it actually is the best value, but it seems fine.
2019-12-08Fix scrubbing unencrypted Wii disc images (for real this time)JosJuice
Unlike what my past self apparently thought, % is in fact not the "round down" operator. https://bugs.dolphin-emu.org/issues/11906
2019-10-25VolumeVerifier: Don't show problems with good dumps of Wii FreeloadersJosJuice
2019-08-07Fix problems with running VolumeVerifier on very small disc imagesJosJuice
2019-04-09VolumeVerifier: Check whether invalid blocks are unusedJosJuice
2018-09-20Fix scrubbing unencrypted Wii disc imagesJosJuice
Untested with unencrypted Wii disc images, because I don't have any. I tested that normal Wii disc images still work, though.
2018-09-20Refactor DiscScrubber::MarkAsUsedEJosJuice
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-06-28DiscIO: Move parts of Filesystem to the new file DiscExtractorJosJuice
2017-06-15Merge pull request #5611 from JosJuice/reorganize-file-namespaceLeo Lam
Reorganize File namespace
2017-06-15Move IOFile to a separate fileJosJuice
Reduces the number of files that need to be recompiled when making changes to FileUtil.h.
2017-06-14Filesystem: Replace GetFileList()JosJuice
Instead of expecting callers to know how the size of directory file infos relates to which files are in which directories, filesystems now offer a GetRoot() method, and file infos offer a way to get their children. As a bonus, m_FileInfoVector no longer has to be created and kept around in RAM. Only the file info objects that actually are used are created.
2017-06-13Filesystem: Replace file info's full path with nameJosJuice
Some callers (i.e. ISOProperties) don't want the full path, so giving them it is unnecessary. Those that do want it can use GetPathFromFSTOffset. Not storing full paths everywhere also saves a small bit of RAM and is necessary for a later commit. The code isn't especially pretty right now (callers need to use FST offsets...) but it'll become better later.
2017-06-13Filesystem: Replace FileInfo struct with interfaceJosJuice
GC/Wii filesystem internals shouldn't be exposed to other classes. This change isn't especially useful by itself, but it opens up the way for some neat stuff in the following commits.
2017-06-13DiscScrubber: Use FileInfo::IsDirectory instead of bit magicJosJuice
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-05-19DiscIO: Remove VolumeCreatorJosJuice
This file is pretty small now that it doesn't handle Wii partitions anymore, so let's move its contents to Volume.cpp. This is also more consistent with how blob creation works.
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-01-04DiscScrubber: Don't take SFileInfo instances by valueLioncash
Avoids unnecessary copies.
2017-01-04DiscScrubber: Use an unsigned loop index in ParseDiscLioncash
Prevents an implicit signed to unsigned conversion when assigning a partition's group number.
2017-01-04DiscScrubber: Correct printf specifiersLioncash
2017-01-04DiscScrubber: Convert a #define into a typed constantLioncash
2017-01-04DiscScrubber: Make struct and variable names conformant to the coding styleLioncash
2017-01-04DiscScrubber: Convert into a classLioncash
Allows potential multiple scrubbers to run at once. Also gets rid of the need to explicitly clean up resources.
2016-07-11DiscScrubber: Fix issue 9356JosJuice
2016-07-07DiscScrubber: Replace unused blocks with 0x00 instead of 0xFFJosJuice
2016-06-24Reformat all the things. Have fun with merge conflicts.Pierre Bourdon
2015-12-14DiscIO: Improve DiscScrubber::ReadFromVolume error handlingJosJuice
2015-12-07DiscIO: Make factory methods return unique_ptrsLioncash
Rather than rely on the developer to do the right thing, just make the default behavior safely deallocate resources. If shared semantics are ever needed in the future, the constructor that takes a unique_ptr for shared_ptr can be used.
2015-11-17Merge pull request #3181 from JosJuice/scrub-directoriesScott Mansell
Don't reserve space for directories when scrubbing
2015-11-01DiscScrubber: Add another nullptr checkJosJuice
2015-10-18Remove length parameter from DiscScrubber::ReadFromVolumeJosJuice
The function only makes sense when the length is 4. All current callers use the length 4, so this change doesn't affect any behavior.
2015-10-17Remove DiscScrubber::GetDOLSize in favor of IFileSystem::GetBootDOLSizeJosJuice
IFileSystem::GetBootDOLSize acts the same. The only difference is that it reads the DOL offset on its own, but this change makes that optional.
2015-10-17Don't reserve space for directories when scrubbingJosJuice
The offset in a directory FileInfo is an FST offset, not a disc offset. Treating it as a disc offset doesn't make sense. Directories don't take up space outside of the FST, so they don't need to be marked as used. The old behavior may have prevented some scrubbable areas from being scrubbed.