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