Files
dolphin/Source/Core/DiscIO/DiscScrubber.h
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.4 KiB
C++
Raw Normal View History

// Copyright 2008 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2020-04-10 15:53:14 +02:00
// DiscScrubber removes the pseudorandom padding data from discs
// Note: the technique is inspired by Wiiscrubber, but much simpler - intentionally :)
#pragma once
2017-01-04 14:31:38 -05:00
#include <array>
2014-03-12 15:33:41 -04:00
#include <string>
2017-01-04 14:31:38 -05:00
#include <vector>
2014-02-17 05:18:15 -05:00
#include "Common/CommonTypes.h"
namespace File
{
class IOFile;
}
namespace DiscIO
{
2015-08-08 19:59:33 +02:00
class FileInfo;
class Volume;
struct Partition;
2017-01-04 14:31:38 -05:00
class DiscScrubber final
{
public:
DiscScrubber();
bool SetupScrub(const Volume& disc);
// Returns true if the specified 32 KiB block only contains unused data
bool CanBlockBeScrubbed(u64 offset) const;
2017-01-04 14:31:38 -05:00
static constexpr size_t CLUSTER_SIZE = 0x8000;
2017-01-04 14:31:38 -05:00
private:
void MarkAsUsed(u64 offset, u64 size);
void MarkAsUsedE(u64 partition_data_offset, u64 offset, u64 size);
2018-09-20 19:32:52 +02:00
u64 ToClusterOffset(u64 offset) const;
bool ReadFromVolume(const Volume& disc, u64 offset, u32& buffer, const Partition& partition);
bool ReadFromVolume(const Volume& disc, u64 offset, u64& buffer, const Partition& partition);
bool ParseDisc(const Volume& disc);
bool ParsePartitionData(const Volume& disc, const Partition& partition);
2015-08-08 19:59:33 +02:00
void ParseFileSystemData(u64 partition_data_offset, const FileInfo& directory);
2017-01-04 14:31:38 -05:00
std::vector<u8> m_free_table;
u64 m_file_size = 0;
bool m_has_wii_hashes = false;
bool m_is_scrubbing = false;
2017-01-04 14:31:38 -05:00
};
} // namespace DiscIO