2013-04-17 21:09:55 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2013-10-27 12:27:07 -06:00
|
|
|
#include <polarssl/aes.h>
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "DiscIO/Blob.h"
|
|
|
|
#include "DiscIO/Volume.h"
|
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
// --- this volume type is used for encrypted Wii images ---
|
|
|
|
|
|
|
|
namespace DiscIO
|
|
|
|
{
|
2014-02-16 21:51:41 -07:00
|
|
|
class CVolumeWiiCrypted : public IVolume
|
2008-12-07 21:46:09 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey);
|
|
|
|
~CVolumeWiiCrypted();
|
|
|
|
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
|
2009-02-22 06:59:06 -07:00
|
|
|
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const;
|
2010-01-14 00:19:10 -07:00
|
|
|
bool GetTitleID(u8* _pBuffer) const;
|
2010-09-07 18:20:19 -06:00
|
|
|
void GetTMD(u8* _pBuffer, u32* _sz) const;
|
2008-12-07 21:46:09 -07:00
|
|
|
std::string GetUniqueID() const;
|
|
|
|
std::string GetMakerID() const;
|
2013-03-02 18:46:55 -07:00
|
|
|
std::vector<std::string> GetNames() const;
|
2008-12-07 21:46:09 -07:00
|
|
|
u32 GetFSTSize() const;
|
|
|
|
std::string GetApploaderDate() const;
|
|
|
|
ECountry GetCountry() const;
|
|
|
|
u64 GetSize() const;
|
2013-04-09 11:58:56 -06:00
|
|
|
u64 GetRawSize() const;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2012-05-04 04:49:10 -06:00
|
|
|
bool SupportsIntegrityCheck() const { return true; }
|
|
|
|
bool CheckIntegrity() const;
|
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
private:
|
|
|
|
IBlobReader* m_pReader;
|
|
|
|
|
|
|
|
u8* m_pBuffer;
|
2013-10-27 12:27:07 -06:00
|
|
|
aes_context* m_AES_ctx;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
u64 m_VolumeOffset;
|
2010-09-07 18:20:19 -06:00
|
|
|
u64 dataOffset;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
mutable u64 m_LastDecryptedBlockOffset;
|
|
|
|
mutable unsigned char m_LastDecryptedBlock[0x8000];
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|