Debian Codegraph @

Source/Core/DiscIO/DiscScrubber.h

raw symbols SCIP
1 // Copyright 2008 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 // DiscScrubber removes the pseudorandom padding data from discs
5
6 // Note: the technique is inspired by Wiiscrubber, but much simpler - intentionally :)
7
8 #pragma once
9
10 #include <vector>
11 #include "Common/CommonTypes.h"
12
13 namespace File
14 {
15 class IOFile;
16 }
17
18 namespace DiscIO
19 {
20 class FileInfo;
21 class Volume;
22 struct Partition;
23
24 class DiscScrubber final
25 {
26 public:
27 DiscScrubber();
28
29 bool SetupScrub(const Volume& disc);
30
31 // Returns true if the specified 32 KiB block only contains unused data
32 bool CanBlockBeScrubbed(u64 offset) const;
33
34 static constexpr size_t CLUSTER_SIZE = 0x8000;
35
36 private:
37 void MarkAsUsed(u64 offset, u64 size);
38 void MarkAsUsedE(u64 partition_data_offset, u64 offset, u64 size);
39 u64 ToClusterOffset(u64 offset) const;
40 bool ReadFromVolume(const Volume& disc, u64 offset, u32& buffer, const Partition& partition);
41 bool ReadFromVolume(const Volume& disc, u64 offset, u64& buffer, const Partition& partition);
42 bool ParseDisc(const Volume& disc);
43 bool ParsePartitionData(const Volume& disc, const Partition& partition);
44 void ParseFileSystemData(u64 partition_data_offset, const FileInfo& directory);
45
46 std::vector<u8> m_free_table;
47 u64 m_file_size = 0;
48 bool m_has_wii_hashes = false;
49 bool m_is_scrubbing = false;
50 };
51
52 } // namespace DiscIO