Merge pull request #1776 from JosJuice/cleanrip-wii-discs

Fix CleanRip reading Wii discs
This commit is contained in:
skidau
2015-01-03 10:42:51 +11:00
19 changed files with 175 additions and 192 deletions

View File

@ -73,10 +73,8 @@ static SPartitionGroup PartitionGroup[4];
void MarkAsUsed(u64 _Offset, u64 _Size);
void MarkAsUsedE(u64 _PartitionDataOffset, u64 _Offset, u64 _Size);
void ReadFromDisc(u64 _Offset, u64 _Length, u32& _Buffer);
void ReadFromDisc(u64 _Offset, u64 _Length, u64& _Buffer);
void ReadFromVolume(u64 _Offset, u64 _Length, u32& _Buffer);
void ReadFromVolume(u64 _Offset, u64 _Length, u64& _Buffer);
void ReadFromVolume(u64 _Offset, u64 _Length, u32& _Buffer, bool _Decrypt);
void ReadFromVolume(u64 _Offset, u64 _Length, u64& _Buffer, bool _Decrypt);
bool ParseDisc();
bool ParsePartitionData(SPartition& _rPartition);
u32 GetDOLSize(u64 _DOLOffset);
@ -190,27 +188,15 @@ void MarkAsUsedE(u64 _PartitionDataOffset, u64 _Offset, u64 _Size)
MarkAsUsed(Offset, Size);
}
// Helper functions for RAW reading the BE discs
void ReadFromDisc(u64 _Offset, u64 _Length, u32& _Buffer)
{
m_Disc->RAWRead(_Offset, _Length, (u8*)&_Buffer);
_Buffer = Common::swap32(_Buffer);
}
void ReadFromDisc(u64 _Offset, u64 _Length, u64& _Buffer)
{
m_Disc->RAWRead(_Offset, _Length, (u8*)&_Buffer);
_Buffer = Common::swap32((u32)_Buffer);
_Buffer <<= 2;
}
// Helper functions for reading the BE volume
void ReadFromVolume(u64 _Offset, u64 _Length, u32& _Buffer)
void ReadFromVolume(u64 _Offset, u64 _Length, u32& _Buffer, bool _Decrypt)
{
m_Disc->Read(_Offset, _Length, (u8*)&_Buffer);
m_Disc->Read(_Offset, _Length, (u8*)&_Buffer, _Decrypt);
_Buffer = Common::swap32(_Buffer);
}
void ReadFromVolume(u64 _Offset, u64 _Length, u64& _Buffer)
void ReadFromVolume(u64 _Offset, u64 _Length, u64& _Buffer, bool _Decrypt)
{
m_Disc->Read(_Offset, _Length, (u8*)&_Buffer);
m_Disc->Read(_Offset, _Length, (u8*)&_Buffer, _Decrypt);
_Buffer = Common::swap32((u32)_Buffer);
_Buffer <<= 2;
}
@ -222,8 +208,8 @@ bool ParseDisc()
for (int x = 0; x < 4; x++)
{
ReadFromDisc(0x40000 + (x * 8) + 0, 4, PartitionGroup[x].numPartitions);
ReadFromDisc(0x40000 + (x * 8) + 4, 4, PartitionGroup[x].PartitionsOffset);
ReadFromVolume(0x40000 + (x * 8) + 0, 4, PartitionGroup[x].numPartitions, false);
ReadFromVolume(0x40000 + (x * 8) + 4, 4, PartitionGroup[x].PartitionsOffset, false);
// Read all partitions
for (u32 i = 0; i < PartitionGroup[x].numPartitions; i++)
@ -233,16 +219,16 @@ bool ParseDisc()
Partition.GroupNumber = x;
Partition.Number = i;
ReadFromDisc(PartitionGroup[x].PartitionsOffset + (i * 8) + 0, 4, Partition.Offset);
ReadFromDisc(PartitionGroup[x].PartitionsOffset + (i * 8) + 4, 4, Partition.Type);
ReadFromVolume(PartitionGroup[x].PartitionsOffset + (i * 8) + 0, 4, Partition.Offset, false);
ReadFromVolume(PartitionGroup[x].PartitionsOffset + (i * 8) + 4, 4, Partition.Type, false);
ReadFromDisc(Partition.Offset + 0x2a4, 4, Partition.Header.TMDSize);
ReadFromDisc(Partition.Offset + 0x2a8, 4, Partition.Header.TMDOffset);
ReadFromDisc(Partition.Offset + 0x2ac, 4, Partition.Header.CertChainSize);
ReadFromDisc(Partition.Offset + 0x2b0, 4, Partition.Header.CertChainOffset);
ReadFromDisc(Partition.Offset + 0x2b4, 4, Partition.Header.H3Offset);
ReadFromDisc(Partition.Offset + 0x2b8, 4, Partition.Header.DataOffset);
ReadFromDisc(Partition.Offset + 0x2bc, 4, Partition.Header.DataSize);
ReadFromVolume(Partition.Offset + 0x2a4, 4, Partition.Header.TMDSize, false);
ReadFromVolume(Partition.Offset + 0x2a8, 4, Partition.Header.TMDOffset, false);
ReadFromVolume(Partition.Offset + 0x2ac, 4, Partition.Header.CertChainSize, false);
ReadFromVolume(Partition.Offset + 0x2b0, 4, Partition.Header.CertChainOffset, false);
ReadFromVolume(Partition.Offset + 0x2b4, 4, Partition.Header.H3Offset, false);
ReadFromVolume(Partition.Offset + 0x2b8, 4, Partition.Header.DataOffset, false);
ReadFromVolume(Partition.Offset + 0x2bc, 4, Partition.Header.DataSize, false);
PartitionGroup[x].PartitionsVec.push_back(Partition);
}
@ -293,8 +279,8 @@ bool ParsePartitionData(SPartition& _rPartition)
// Mark things as used which are not in the filesystem
// Header, Header Information, Apploader
ReadFromVolume(0x2440 + 0x14, 4, _rPartition.Header.ApploaderSize);
ReadFromVolume(0x2440 + 0x18, 4, _rPartition.Header.ApploaderTrailerSize);
ReadFromVolume(0x2440 + 0x14, 4, _rPartition.Header.ApploaderSize, true);
ReadFromVolume(0x2440 + 0x18, 4, _rPartition.Header.ApploaderTrailerSize, true);
MarkAsUsedE(_rPartition.Offset
+ _rPartition.Header.DataOffset
, 0
@ -303,7 +289,7 @@ bool ParsePartitionData(SPartition& _rPartition)
+ _rPartition.Header.ApploaderTrailerSize);
// DOL
ReadFromVolume(0x420, 4, _rPartition.Header.DOLOffset);
ReadFromVolume(0x420, 4, _rPartition.Header.DOLOffset, true);
_rPartition.Header.DOLSize = GetDOLSize(_rPartition.Header.DOLOffset);
MarkAsUsedE(_rPartition.Offset
+ _rPartition.Header.DataOffset
@ -311,8 +297,8 @@ bool ParsePartitionData(SPartition& _rPartition)
, _rPartition.Header.DOLSize);
// FST
ReadFromVolume(0x424, 4, _rPartition.Header.FSTOffset);
ReadFromVolume(0x428, 4, _rPartition.Header.FSTSize);
ReadFromVolume(0x424, 4, _rPartition.Header.FSTOffset, true);
ReadFromVolume(0x428, 4, _rPartition.Header.FSTSize, true);
MarkAsUsedE(_rPartition.Offset
+ _rPartition.Header.DataOffset
, _rPartition.Header.FSTOffset
@ -348,8 +334,8 @@ u32 GetDOLSize(u64 _DOLOffset)
// Iterate through the 7 code segments
for (u8 i = 0; i < 7; i++)
{
ReadFromVolume(_DOLOffset + 0x00 + i * 4, 4, offset);
ReadFromVolume(_DOLOffset + 0x90 + i * 4, 4, size);
ReadFromVolume(_DOLOffset + 0x00 + i * 4, 4, offset, true);
ReadFromVolume(_DOLOffset + 0x90 + i * 4, 4, size, true);
if (offset + size > max)
max = offset + size;
}
@ -357,8 +343,8 @@ u32 GetDOLSize(u64 _DOLOffset)
// Iterate through the 11 data segments
for (u8 i = 0; i < 11; i++)
{
ReadFromVolume(_DOLOffset + 0x1c + i * 4, 4, offset);
ReadFromVolume(_DOLOffset + 0xac + i * 4, 4, size);
ReadFromVolume(_DOLOffset + 0x1c + i * 4, 4, offset, true);
ReadFromVolume(_DOLOffset + 0xac + i * 4, 4, size, true);
if (offset + size > max)
max = offset + size;
}

View File

@ -23,7 +23,7 @@ CFileSystemGCWii::CFileSystemGCWii(const IVolume *_rVolume)
: IFileSystem(_rVolume)
, m_Initialized(false)
, m_Valid(false)
, m_OffsetShift(0)
, m_Wii(false)
{
m_Valid = DetectFileSystem();
}
@ -78,7 +78,7 @@ u64 CFileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, size
DEBUG_LOG(DISCIO, "Filename: %s. Offset: %" PRIx64 ". Size: %" PRIx64, _rFullPath.c_str(),
pFileInfo->m_Offset, pFileInfo->m_FileSize);
m_rVolume->Read(pFileInfo->m_Offset, pFileInfo->m_FileSize, _pBuffer);
m_rVolume->Read(pFileInfo->m_Offset, pFileInfo->m_FileSize, _pBuffer, m_Wii);
return pFileInfo->m_FileSize;
}
@ -108,7 +108,7 @@ bool CFileSystemGCWii::ExportFile(const std::string& _rFullPath, const std::stri
std::vector<u8> buffer(readSize);
result = m_rVolume->Read(fileOffset, readSize, &buffer[0]);
result = m_rVolume->Read(fileOffset, readSize, &buffer[0], m_Wii);
if (!result)
break;
@ -130,7 +130,7 @@ bool CFileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
DEBUG_LOG(DISCIO,"AppSize -> %x", AppSize);
std::vector<u8> buffer(AppSize);
if (m_rVolume->Read(0x2440, AppSize, &buffer[0]))
if (m_rVolume->Read(0x2440, AppSize, &buffer[0], m_Wii))
{
std::string exportName(_rExportFolder + "/apploader.img");
@ -147,7 +147,7 @@ bool CFileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
u32 CFileSystemGCWii::GetBootDOLSize() const
{
u32 DolOffset = Read32(0x420) << m_OffsetShift;
u32 DolOffset = Read32(0x420) << GetOffsetShift();
u32 DolSize = 0, offset = 0, size = 0;
// Iterate through the 7 code segments
@ -172,17 +172,17 @@ u32 CFileSystemGCWii::GetBootDOLSize() const
bool CFileSystemGCWii::GetBootDOL(u8* &buffer, u32 DolSize) const
{
u32 DolOffset = Read32(0x420) << m_OffsetShift;
return m_rVolume->Read(DolOffset, DolSize, buffer);
u32 DolOffset = Read32(0x420) << GetOffsetShift();
return m_rVolume->Read(DolOffset, DolSize, buffer, m_Wii);
}
bool CFileSystemGCWii::ExportDOL(const std::string& _rExportFolder) const
{
u32 DolOffset = Read32(0x420) << m_OffsetShift;
u32 DolOffset = Read32(0x420) << GetOffsetShift();
u32 DolSize = GetBootDOLSize();
std::vector<u8> buffer(DolSize);
if (m_rVolume->Read(DolOffset, DolSize, &buffer[0]))
if (m_rVolume->Read(DolOffset, DolSize, &buffer[0], m_Wii))
{
std::string exportName(_rExportFolder + "/boot.dol");
@ -200,7 +200,7 @@ bool CFileSystemGCWii::ExportDOL(const std::string& _rExportFolder) const
u32 CFileSystemGCWii::Read32(u64 _Offset) const
{
u32 Temp = 0;
m_rVolume->Read(_Offset, 4, (u8*)&Temp);
m_rVolume->Read(_Offset, 4, (u8*)&Temp, m_Wii);
return Common::swap32(Temp);
}
@ -208,7 +208,7 @@ std::string CFileSystemGCWii::GetStringFromOffset(u64 _Offset) const
{
std::string data;
data.resize(255);
m_rVolume->Read(_Offset, data.size(), (u8*)&data[0]);
m_rVolume->Read(_Offset, data.size(), (u8*)&data[0], m_Wii);
data.erase(std::find(data.begin(), data.end(), 0x00), data.end());
// TODO: Should we really always use SHIFT-JIS?
@ -248,12 +248,12 @@ bool CFileSystemGCWii::DetectFileSystem()
{
if (Read32(0x18) == 0x5D1C9EA3)
{
m_OffsetShift = 2; // Wii file system
m_Wii = true;
return true;
}
else if (Read32(0x1c) == 0xC2339F3D)
{
m_OffsetShift = 0; // GC file system
m_Wii = false;
return true;
}
@ -265,7 +265,7 @@ void CFileSystemGCWii::InitFileSystem()
m_Initialized = true;
// read the whole FST
u64 FSTOffset = (u64)Read32(0x424) << m_OffsetShift;
u64 FSTOffset = (u64)Read32(0x424) << GetOffsetShift();
// u32 FSTSize = Read32(0x428);
// u32 FSTMaxSize = Read32(0x42C);
@ -273,7 +273,7 @@ void CFileSystemGCWii::InitFileSystem()
// read all fileinfos
SFileInfo Root;
Root.m_NameOffset = Read32(FSTOffset + 0x0);
Root.m_Offset = (u64)Read32(FSTOffset + 0x4) << m_OffsetShift;
Root.m_Offset = (u64)Read32(FSTOffset + 0x4) << GetOffsetShift();
Root.m_FileSize = Read32(FSTOffset + 0x8);
if (Root.IsDirectory())
@ -288,7 +288,7 @@ void CFileSystemGCWii::InitFileSystem()
SFileInfo sfi;
u64 Offset = FSTOffset + (i * 0xC);
sfi.m_NameOffset = Read32(Offset + 0x0);
sfi.m_Offset = (u64)Read32(Offset + 0x4) << m_OffsetShift;
sfi.m_Offset = (u64)Read32(Offset + 0x4) << GetOffsetShift();
sfi.m_FileSize = Read32(Offset + 0x8);
m_FileInfoVector.push_back(sfi);
@ -325,4 +325,9 @@ size_t CFileSystemGCWii::BuildFilenames(const size_t _FirstIndex, const size_t _
return CurrentIndex;
}
u32 CFileSystemGCWii::GetOffsetShift() const
{
return m_Wii ? 2 : 0;
}
} // namespace

View File

@ -35,7 +35,7 @@ public:
private:
bool m_Initialized;
bool m_Valid;
u32 m_OffsetShift; // WII offsets are all shifted
bool m_Wii;
std::vector <SFileInfo> m_FileInfoVector;
u32 Read32(u64 _Offset) const;
@ -44,6 +44,7 @@ private:
bool DetectFileSystem();
void InitFileSystem();
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const std::string& _szDirectory, u64 _NameTableOffset);
u32 GetOffsetShift() const;
};
} // namespace

View File

@ -18,8 +18,9 @@ public:
IVolume() {}
virtual ~IVolume() {}
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
virtual bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
// decrypt parameter must be false if not reading a Wii disc
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const = 0;
virtual bool GetTitleID(u8*) const { return false; }
virtual std::unique_ptr<u8[]> GetTMD(u32 *_sz) const
{

View File

@ -123,7 +123,7 @@ IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii,
bool IsVolumeWiiDisc(const IVolume *_rVolume)
{
u32 MagicWord = 0;
_rVolume->Read(0x18, 4, (u8*)&MagicWord);
_rVolume->Read(0x18, 4, (u8*)&MagicWord, false);
return (Common::swap32(MagicWord) == 0x5D1C9EA3);
//GameCube 0xc2339f3d
@ -132,7 +132,7 @@ bool IsVolumeWiiDisc(const IVolume *_rVolume)
bool IsVolumeWadFile(const IVolume *_rVolume)
{
u32 MagicWord = 0;
_rVolume->Read(0x02, 4, (u8*)&MagicWord);
_rVolume->Read(0x02, 4, (u8*)&MagicWord, false);
return (Common::swap32(MagicWord) == 0x00204973 || Common::swap32(MagicWord) == 0x00206962);
}

View File

@ -15,6 +15,7 @@
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/MathUtil.h"
#include "Core/VolumeHandler.h"
#include "DiscIO/FileBlob.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeDirectory.h"
@ -63,13 +64,23 @@ bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory)
return File::IsDirectory(directoryName);
}
bool CVolumeDirectory::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const
{
return false;
}
bool wii = VolumeHandler::IsWii();
if (!decrypt && (_Offset + _Length >= 0x400) && wii)
{
// Fully supporting this would require re-encrypting every file that's read.
// Only supporting the areas that IOS allows software to read could be more feasible.
// Currently, only the header (up to 0x400) is supported, though we're cheating a bit
// with it by reading the header inside the current partition instead. Supporting the
// header is enough for booting games, but not for running things like the Disc Channel.
return false;
}
if (decrypt && !wii)
PanicAlertT("Tried to decrypt data from a non-Wii volume");
bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
{
// header
if (_Offset < DISKHEADERINFO_ADDRESS)
{

View File

@ -32,8 +32,7 @@ public:
static bool IsValidDirectory(const std::string& _rDirectory);
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const override;
std::string GetUniqueID() const override;
void SetUniqueID(const std::string& _ID);

View File

@ -24,8 +24,11 @@ CVolumeGC::~CVolumeGC()
{
}
bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const
{
if (decrypt)
PanicAlertT("Tried to decrypt data from a non-Wii volume");
if (m_pReader == nullptr)
return false;
@ -34,11 +37,6 @@ bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
return m_pReader->Read(_Offset, _Length, _pBuffer);
}
bool CVolumeGC::RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const
{
return Read(_Offset, _Length, _pBuffer);
}
std::string CVolumeGC::GetUniqueID() const
{
static const std::string NO_UID("NO_UID");

View File

@ -23,8 +23,7 @@ class CVolumeGC : public IVolume
public:
CVolumeGC(IBlobReader* _pReader);
~CVolumeGC();
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt = false) const override;
std::string GetUniqueID() const override;
std::string GetRevisionSpecificUniqueID() const override;
std::string GetMakerID() const override;

View File

@ -44,8 +44,11 @@ CVolumeWAD::~CVolumeWAD()
{
}
bool CVolumeWAD::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
bool CVolumeWAD::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const
{
if (decrypt)
PanicAlertT("Tried to decrypt data from a non-Wii volume");
if (m_pReader == nullptr)
return false;

View File

@ -25,8 +25,7 @@ class CVolumeWAD : public IVolume
public:
CVolumeWAD(IBlobReader* _pReader);
~CVolumeWAD();
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const override { return false; }
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt = false) const override;
bool GetTitleID(u8* _pBuffer) const override;
std::string GetUniqueID() const override;
std::string GetMakerID() const override;

View File

@ -54,21 +54,13 @@ CVolumeWiiCrypted::~CVolumeWiiCrypted()
m_pBuffer = nullptr;
}
bool CVolumeWiiCrypted::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
{
// HyperIris: hack for DVDLowUnencryptedRead
// Medal Of Honor Heroes 2 read this DVD offset for PartitionsInfo
// and, PartitionsInfo is not encrypted, let's read it directly.
if (!m_pReader->Read(_Offset, _Length, _pBuffer))
return(false);
else
return true;
}
bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer, bool decrypt) const
{
if (m_pReader == nullptr)
return(false);
return false;
if (!decrypt)
return m_pReader->Read(_ReadOffset, _Length, _pBuffer);
FileMon::FindFilename(_ReadOffset);
@ -110,7 +102,7 @@ bool CVolumeWiiCrypted::GetTitleID(u8* _pBuffer) const
{
// Tik is at m_VolumeOffset size 0x2A4
// TitleID offset in tik is 0x1DC
return RAWRead(m_VolumeOffset + 0x1DC, 8, _pBuffer);
return Read(m_VolumeOffset + 0x1DC, 8, _pBuffer, false);
}
std::unique_ptr<u8[]> CVolumeWiiCrypted::GetTMD(u32 *size) const
@ -119,8 +111,8 @@ std::unique_ptr<u8[]> CVolumeWiiCrypted::GetTMD(u32 *size) const
u32 tmd_size;
u32 tmd_address;
RAWRead(m_VolumeOffset + 0x2a4, sizeof(u32), (u8*)&tmd_size);
RAWRead(m_VolumeOffset + 0x2a8, sizeof(u32), (u8*)&tmd_address);
Read(m_VolumeOffset + 0x2a4, sizeof(u32), (u8*)&tmd_size, false);
Read(m_VolumeOffset + 0x2a8, sizeof(u32), (u8*)&tmd_address, false);
tmd_size = Common::swap32(tmd_size);
tmd_address = Common::swap32(tmd_address) << 2;
@ -135,7 +127,7 @@ std::unique_ptr<u8[]> CVolumeWiiCrypted::GetTMD(u32 *size) const
}
std::unique_ptr<u8[]> buf{ new u8[tmd_size] };
RAWRead(m_VolumeOffset + tmd_address, tmd_size, buf.get());
Read(m_VolumeOffset + tmd_address, tmd_size, buf.get(), false);
*size = tmd_size;
return buf;
}
@ -147,7 +139,7 @@ std::string CVolumeWiiCrypted::GetUniqueID() const
char ID[7];
if (!Read(0, 6, (u8*)ID))
if (!Read(0, 6, (u8*)ID, false))
return std::string();
ID[6] = '\0';
@ -174,7 +166,7 @@ std::string CVolumeWiiCrypted::GetMakerID() const
char makerID[3];
if (!Read(0x4, 0x2, (u8*)&makerID))
if (!Read(0x4, 0x2, (u8*)&makerID, false))
return std::string();
makerID[2] = '\0';
@ -201,7 +193,7 @@ std::vector<std::string> CVolumeWiiCrypted::GetNames() const
auto const string_decoder = CVolumeGC::GetStringDecoder(GetCountry());
char name[0xFF] = {};
if (m_pReader != nullptr && Read(0x20, 0x60, (u8*)&name))
if (m_pReader != nullptr && Read(0x20, 0x60, (u8*)&name, true))
names.push_back(string_decoder(name));
return names;
@ -214,7 +206,7 @@ u32 CVolumeWiiCrypted::GetFSTSize() const
u32 size;
if (!Read(0x428, 0x4, (u8*)&size))
if (!Read(0x428, 0x4, (u8*)&size, true))
return 0;
return size;
@ -227,7 +219,7 @@ std::string CVolumeWiiCrypted::GetApploaderDate() const
char date[16];
if (!Read(0x2440, 0x10, (u8*)&date))
if (!Read(0x2440, 0x10, (u8*)&date, true))
return std::string();
date[10] = '\0';
@ -255,7 +247,7 @@ bool CVolumeWiiCrypted::CheckIntegrity() const
{
// Get partition data size
u32 partSizeDiv4;
RAWRead(m_VolumeOffset + 0x2BC, 4, (u8*)&partSizeDiv4);
Read(m_VolumeOffset + 0x2BC, 4, (u8*)&partSizeDiv4, false);
u64 partDataSize = (u64)Common::swap32(partSizeDiv4) * 4;
u32 nClusters = (u32)(partDataSize / 0x8000);
@ -292,7 +284,7 @@ bool CVolumeWiiCrypted::CheckIntegrity() const
continue;
u8 clusterData[0x7C00];
if (!Read((u64)clusterID * 0x7C00, 0x7C00, clusterData))
if (!Read((u64)clusterID * 0x7C00, 0x7C00, clusterData, true))
{
NOTICE_LOG(DISCIO, "Integrity Check: fail at cluster %d: could not read data", clusterID);
return false;

View File

@ -24,8 +24,7 @@ class CVolumeWiiCrypted : public IVolume
public:
CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey);
~CVolumeWiiCrypted();
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const override;
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const override;
bool GetTitleID(u8* _pBuffer) const override;
virtual std::unique_ptr<u8[]> GetTMD(u32 *_sz) const override;
std::string GetUniqueID() const override;