mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #4731 from leoetlino/volumewad
Minor cleanup to VolumeWad
This commit is contained in:
commit
d97a2aba8d
@ -22,9 +22,7 @@
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
CVolumeWAD::CVolumeWAD(std::unique_ptr<IBlobReader> reader)
|
||||
: m_pReader(std::move(reader)), m_offset(0), m_tmd_offset(0), m_opening_bnr_offset(0),
|
||||
m_hdr_size(0), m_cert_size(0), m_tick_size(0), m_tmd_size(0), m_data_size(0)
|
||||
CVolumeWAD::CVolumeWAD(std::unique_ptr<IBlobReader> reader) : m_reader(std::move(reader))
|
||||
{
|
||||
// Source: http://wiibrew.org/wiki/WAD_files
|
||||
Read(0x00, 4, (u8*)&m_hdr_size);
|
||||
@ -46,15 +44,15 @@ CVolumeWAD::~CVolumeWAD()
|
||||
{
|
||||
}
|
||||
|
||||
bool CVolumeWAD::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const
|
||||
bool CVolumeWAD::Read(u64 offset, u64 length, u8* buffer, bool decrypt) const
|
||||
{
|
||||
if (decrypt)
|
||||
PanicAlertT("Tried to decrypt data from a non-Wii volume");
|
||||
|
||||
if (m_pReader == nullptr)
|
||||
if (m_reader == nullptr)
|
||||
return false;
|
||||
|
||||
return m_pReader->Read(_Offset, _Length, _pBuffer);
|
||||
return m_reader->Read(offset, length, buffer);
|
||||
}
|
||||
|
||||
Region CVolumeWAD::GetRegion() const
|
||||
@ -118,7 +116,7 @@ bool CVolumeWAD::GetTitleID(u64* buffer) const
|
||||
u16 CVolumeWAD::GetRevision() const
|
||||
{
|
||||
u16 revision;
|
||||
if (!m_pReader->Read(m_tmd_offset + 0x1dc, 2, (u8*)&revision))
|
||||
if (!m_reader->Read(m_tmd_offset + 0x1dc, 2, (u8*)&revision))
|
||||
return 0;
|
||||
|
||||
return Common::swap16(revision);
|
||||
@ -151,23 +149,17 @@ std::vector<u32> CVolumeWAD::GetBanner(int* width, int* height) const
|
||||
|
||||
BlobType CVolumeWAD::GetBlobType() const
|
||||
{
|
||||
return m_pReader ? m_pReader->GetBlobType() : BlobType::PLAIN;
|
||||
return m_reader ? m_reader->GetBlobType() : BlobType::PLAIN;
|
||||
}
|
||||
|
||||
u64 CVolumeWAD::GetSize() const
|
||||
{
|
||||
if (m_pReader)
|
||||
return m_pReader->GetDataSize();
|
||||
else
|
||||
return 0;
|
||||
return m_reader ? m_reader->GetDataSize() : 0;
|
||||
}
|
||||
|
||||
u64 CVolumeWAD::GetRawSize() const
|
||||
{
|
||||
if (m_pReader)
|
||||
return m_pReader->GetRawSize();
|
||||
else
|
||||
return 0;
|
||||
return m_reader ? m_reader->GetRawSize() : 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
class IBlobReader;
|
||||
enum class BlobType;
|
||||
enum class Country;
|
||||
enum class Language;
|
||||
@ -29,7 +30,7 @@ class CVolumeWAD : public IVolume
|
||||
public:
|
||||
CVolumeWAD(std::unique_ptr<IBlobReader> reader);
|
||||
~CVolumeWAD();
|
||||
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt = false) const override;
|
||||
bool Read(u64 offset, u64 length, u8* buffer, bool decrypt = false) const override;
|
||||
bool GetTitleID(u64* buffer) const override;
|
||||
std::string GetGameID() const override;
|
||||
std::string GetMakerID() const override;
|
||||
@ -48,15 +49,15 @@ public:
|
||||
u64 GetRawSize() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<IBlobReader> m_pReader;
|
||||
u32 m_offset;
|
||||
u32 m_tmd_offset;
|
||||
u32 m_opening_bnr_offset;
|
||||
u32 m_hdr_size;
|
||||
u32 m_cert_size;
|
||||
u32 m_tick_size;
|
||||
u32 m_tmd_size;
|
||||
u32 m_data_size;
|
||||
std::unique_ptr<IBlobReader> m_reader;
|
||||
u32 m_offset = 0;
|
||||
u32 m_tmd_offset = 0;
|
||||
u32 m_opening_bnr_offset = 0;
|
||||
u32 m_hdr_size = 0;
|
||||
u32 m_cert_size = 0;
|
||||
u32 m_tick_size = 0;
|
||||
u32 m_tmd_size = 0;
|
||||
u32 m_data_size = 0;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
Loading…
Reference in New Issue
Block a user