| 
									
										
										
										
											2013-04-17 23:09:55 -04: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 13:54:46 -05:00
										 |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-21 01:47:53 +01: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 01:47:53 +01:00
										 |  |  | #include "Common/CommonTypes.h"
 | 
					
						
							| 
									
										
										
										
											2014-02-17 05:18:15 -05: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 01:47:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | class IBlobReader; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-16 23:51:41 -05: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 01:54:44 +01: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 12:49:10 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | private: | 
					
						
							|  |  |  | 	IBlobReader* m_pReader; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	u8* m_pBuffer; | 
					
						
							| 
									
										
										
										
											2013-10-27 18:27:07 +00:00
										 |  |  | 	aes_context* m_AES_ctx; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	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
 |