mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Add a Verify tab to game properties
This commit is contained in:
@@ -16,6 +16,7 @@ add_library(discio
|
||||
Volume.cpp
|
||||
VolumeFileBlobReader.cpp
|
||||
VolumeGC.cpp
|
||||
VolumeVerifier.cpp
|
||||
VolumeWad.cpp
|
||||
VolumeWii.cpp
|
||||
WiiSaveBanner.cpp
|
||||
|
||||
@@ -29,6 +29,11 @@ std::string NameForPartitionType(u32 partition_type, bool include_prefix)
|
||||
return "UPDATE";
|
||||
case PARTITION_CHANNEL:
|
||||
return "CHANNEL";
|
||||
case PARTITION_INSTALL:
|
||||
// wit doesn't recognize the name "INSTALL", so we can't use it when naming partition folders
|
||||
if (!include_prefix)
|
||||
return "INSTALL";
|
||||
// [[fallthrough]]
|
||||
default:
|
||||
const std::string type_as_game_id{static_cast<char>((partition_type >> 24) & 0xFF),
|
||||
static_cast<char>((partition_type >> 16) & 0xFF),
|
||||
|
||||
@@ -17,7 +17,8 @@ class Volume;
|
||||
|
||||
constexpr u32 PARTITION_DATA = 0;
|
||||
constexpr u32 PARTITION_UPDATE = 1;
|
||||
constexpr u32 PARTITION_CHANNEL = 2;
|
||||
constexpr u32 PARTITION_CHANNEL = 2; // Mario Kart Wii, Wii Fit, Wii Fit Plus, Rabbids Go Home
|
||||
constexpr u32 PARTITION_INSTALL = 3; // Dragon Quest X only
|
||||
|
||||
std::string NameForPartitionType(u32 partition_type, bool include_prefix);
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
<ClCompile Include="Volume.cpp" />
|
||||
<ClCompile Include="VolumeFileBlobReader.cpp" />
|
||||
<ClCompile Include="VolumeGC.cpp" />
|
||||
<ClCompile Include="VolumeVerifier.cpp" />
|
||||
<ClCompile Include="VolumeWad.cpp" />
|
||||
<ClCompile Include="VolumeWii.cpp" />
|
||||
<ClCompile Include="WbfsBlob.cpp" />
|
||||
@@ -75,6 +76,7 @@
|
||||
<ClInclude Include="Volume.h" />
|
||||
<ClInclude Include="VolumeFileBlobReader.h" />
|
||||
<ClInclude Include="VolumeGC.h" />
|
||||
<ClInclude Include="VolumeVerifier.h" />
|
||||
<ClInclude Include="VolumeWad.h" />
|
||||
<ClInclude Include="VolumeWii.h" />
|
||||
<ClInclude Include="WbfsBlob.h" />
|
||||
|
||||
@@ -84,6 +84,9 @@
|
||||
<ClCompile Include="WiiSaveBanner.cpp">
|
||||
<Filter>NAND</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VolumeVerifier.cpp">
|
||||
<Filter>Volume</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DiscScrubber.h">
|
||||
@@ -149,6 +152,9 @@
|
||||
<ClInclude Include="WiiSaveBanner.h">
|
||||
<Filter>NAND</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VolumeVerifier.h">
|
||||
<Filter>Volume</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="CMakeLists.txt" />
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,94 @@
|
||||
// Copyright 2019 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
|
||||
// To be used as follows:
|
||||
//
|
||||
// VolumeVerifier verifier(volume);
|
||||
// verifier.Start();
|
||||
// while (verifier.GetBytesProcessed() != verifier.GetTotalBytes())
|
||||
// verifier.Process();
|
||||
// verifier.Finish();
|
||||
// auto result = verifier.GetResult();
|
||||
//
|
||||
// Start, Process and Finish may take some time to run.
|
||||
//
|
||||
// GetResult() can be called before the processing is finished, but the result will be incomplete.
|
||||
|
||||
namespace IOS::ES
|
||||
{
|
||||
class SignedBlobReader;
|
||||
}
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
class FileInfo;
|
||||
|
||||
class VolumeVerifier final
|
||||
{
|
||||
public:
|
||||
enum class Severity
|
||||
{
|
||||
None, // Only used internally
|
||||
Low,
|
||||
Medium,
|
||||
High,
|
||||
};
|
||||
|
||||
struct Problem
|
||||
{
|
||||
Severity severity;
|
||||
std::string text;
|
||||
};
|
||||
|
||||
struct Result
|
||||
{
|
||||
std::string summary_text;
|
||||
std::vector<Problem> problems;
|
||||
};
|
||||
|
||||
VolumeVerifier(const Volume& volume);
|
||||
void Start();
|
||||
void Process();
|
||||
u64 GetBytesProcessed() const;
|
||||
u64 GetTotalBytes() const;
|
||||
void Finish();
|
||||
const Result& GetResult() const;
|
||||
|
||||
private:
|
||||
void CheckPartitions();
|
||||
bool CheckPartition(const Partition& partition); // Returns false if partition should be ignored
|
||||
void CheckCorrectlySigned(const Partition& partition, const std::string& error_text);
|
||||
bool IsDebugSigned() const;
|
||||
bool ShouldHaveChannelPartition() const;
|
||||
bool ShouldHaveInstallPartition() const;
|
||||
bool ShouldHaveMasterpiecePartitions() const;
|
||||
bool ShouldBeDualLayer() const;
|
||||
void CheckDiscSize();
|
||||
u64 GetBiggestUsedOffset();
|
||||
u64 GetBiggestUsedOffset(const FileInfo& file_info) const;
|
||||
void CheckMisc();
|
||||
|
||||
void AddProblem(Severity severity, const std::string& text);
|
||||
|
||||
const Volume& m_volume;
|
||||
Result m_result;
|
||||
bool m_is_tgc;
|
||||
bool m_is_datel;
|
||||
bool m_is_not_retail;
|
||||
|
||||
bool m_started;
|
||||
bool m_done;
|
||||
u64 m_progress;
|
||||
u64 m_max_progress;
|
||||
};
|
||||
|
||||
} // namespace DiscIO
|
||||
Reference in New Issue
Block a user