mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-01-31 19:43:35 +00:00
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...)
53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
// Copyright 2008 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// DiscScrubber removes the pseudorandom padding data from discs
|
|
|
|
// Note: the technique is inspired by Wiiscrubber, but much simpler - intentionally :)
|
|
|
|
#pragma once
|
|
|
|
#include <vector>
|
|
#include "Common/CommonTypes.h"
|
|
|
|
namespace File
|
|
{
|
|
class IOFile;
|
|
}
|
|
|
|
namespace DiscIO
|
|
{
|
|
class FileInfo;
|
|
class Volume;
|
|
struct Partition;
|
|
|
|
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;
|
|
|
|
static constexpr size_t CLUSTER_SIZE = 0x8000;
|
|
|
|
private:
|
|
void MarkAsUsed(u64 offset, u64 size);
|
|
void MarkAsUsedE(u64 partition_data_offset, u64 offset, u64 size);
|
|
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);
|
|
void ParseFileSystemData(u64 partition_data_offset, const FileInfo& directory);
|
|
|
|
std::vector<u8> m_free_table;
|
|
u64 m_file_size = 0;
|
|
bool m_has_wii_hashes = false;
|
|
bool m_is_scrubbing = false;
|
|
};
|
|
|
|
} // namespace DiscIO
|