| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <map> |
| 7 |
#include <memory> |
| 8 |
#include <optional> |
| 9 |
#include <span> |
| 10 |
#include <string> |
| 11 |
#include <vector> |
| 12 |
|
| 13 |
#include "Common/CommonTypes.h" |
| 14 |
#include "Core/IOS/ES/Formats.h" |
| 15 |
#include "DiscIO/Volume.h" |
| 16 |
|
| 17 |
namespace DiscIO |
| 18 |
{ |
| 19 |
class BlobReader; |
| 20 |
enum class BlobType; |
| 21 |
enum class Country; |
| 22 |
class FileSystem; |
| 23 |
enum class Language; |
| 24 |
enum class Region; |
| 25 |
enum class Platform; |
| 26 |
|
| 27 |
class VolumeWAD final : public Volume |
| 28 |
{ |
| 29 |
public: |
| 30 |
VolumeWAD(std::unique_ptr<BlobReader> reader); |
| 31 |
bool Read(u64 offset, u64 length, u8* buffer, |
| 32 |
const Partition& partition = PARTITION_NONE) const override; |
| 33 |
const FileSystem* GetFileSystem(const Partition& partition = PARTITION_NONE) const override; |
| 34 |
std::optional<u64> GetTitleID(const Partition& partition = PARTITION_NONE) const override; |
| 35 |
const IOS::ES::TicketReader& |
| 36 |
GetTicket(const Partition& partition = PARTITION_NONE) const override; |
| 37 |
const IOS::ES::TMDReader& GetTMD(const Partition& partition = PARTITION_NONE) const override; |
| 38 |
const std::vector<u8>& |
| 39 |
GetCertificateChain(const Partition& partition = PARTITION_NONE) const override; |
| 40 |
std::vector<u8> GetContent(u16 index) const override; |
| 41 |
std::vector<u64> GetContentOffsets() const override; |
| 42 |
bool CheckContentIntegrity(const IOS::ES::Content& content, std::span<const u8> encrypted_data, |
| 43 |
const IOS::ES::TicketReader& ticket) const override; |
| 44 |
IOS::ES::TicketReader GetTicketWithFixedCommonKey() const override; |
| 45 |
std::string GetGameID(const Partition& partition = PARTITION_NONE) const override; |
| 46 |
std::string GetGameTDBID(const Partition& partition = PARTITION_NONE) const override; |
| 47 |
std::string GetMakerID(const Partition& partition = PARTITION_NONE) const override; |
| 48 |
std::optional<u16> GetRevision(const Partition& partition = PARTITION_NONE) const override; |
| 49 |
std::string GetInternalName(const Partition& partition = PARTITION_NONE) const override |
| 50 |
{ |
| 51 |
return ""; |
| 52 |
} |
| 53 |
std::map<Language, std::string> GetLongNames() const override; |
| 54 |
std::vector<u32> GetBanner(u32* width, u32* height) const override; |
| 55 |
std::string GetApploaderDate(const Partition& partition = PARTITION_NONE) const override |
| 56 |
{ |
| 57 |
return ""; |
| 58 |
} |
| 59 |
Platform GetVolumeType() const override; |
| 60 |
bool IsDatelDisc() const override; |
| 61 |
bool IsNKit() const override; |
| 62 |
Region GetRegion() const override; |
| 63 |
Country GetCountry(const Partition& partition = PARTITION_NONE) const override; |
| 64 |
|
| 65 |
BlobType GetBlobType() const override; |
| 66 |
u64 GetDataSize() const override; |
| 67 |
DataSizeType GetDataSizeType() const override; |
| 68 |
u64 GetRawSize() const override; |
| 69 |
const BlobReader& GetBlobReader() const override; |
| 70 |
|
| 71 |
std::array<u8, 20> GetSyncHash() const override; |
| 72 |
|
| 73 |
private: |
| 74 |
std::unique_ptr<BlobReader> m_reader; |
| 75 |
IOS::ES::TicketReader m_ticket; |
| 76 |
IOS::ES::TMDReader m_tmd; |
| 77 |
std::vector<u8> m_cert_chain; |
| 78 |
u32 m_cert_chain_offset = 0; |
| 79 |
u32 m_ticket_offset = 0; |
| 80 |
u32 m_tmd_offset = 0; |
| 81 |
u32 m_data_offset = 0; |
| 82 |
u32 m_opening_bnr_offset = 0; |
| 83 |
u32 m_hdr_size = 0; |
| 84 |
u32 m_cert_chain_size = 0; |
| 85 |
u32 m_ticket_size = 0; |
| 86 |
u32 m_tmd_size = 0; |
| 87 |
u32 m_data_size = 0; |
| 88 |
u32 m_opening_bnr_size = 0; |
| 89 |
}; |
| 90 |
|
| 91 |
} |