2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2009 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:09:55 +00:00
|
|
|
// Refer to the license.txt file included.
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2017-05-14 10:05:43 +00:00
|
|
|
#include <memory>
|
2009-07-06 02:10:26 +00:00
|
|
|
#include <string>
|
2015-12-19 18:46:01 +00:00
|
|
|
#include <vector>
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2017-02-09 13:07:36 +00:00
|
|
|
#include "Core/IOS/ES/Formats.h"
|
2009-07-06 02:10:26 +00:00
|
|
|
|
|
|
|
namespace DiscIO
|
|
|
|
{
|
2017-06-06 09:49:01 +00:00
|
|
|
class BlobReader;
|
2014-02-21 00:47:53 +00:00
|
|
|
|
2009-07-06 02:10:26 +00:00
|
|
|
class WiiWAD
|
|
|
|
{
|
|
|
|
public:
|
2016-09-25 21:33:43 +00:00
|
|
|
explicit WiiWAD(const std::string& name);
|
2017-07-04 13:37:41 +00:00
|
|
|
explicit WiiWAD(std::unique_ptr<BlobReader> blob_reader);
|
2017-10-01 13:14:53 +00:00
|
|
|
WiiWAD(WiiWAD&&) = default;
|
|
|
|
WiiWAD& operator=(WiiWAD&&) = default;
|
2016-06-24 08:43:46 +00:00
|
|
|
~WiiWAD();
|
|
|
|
|
|
|
|
bool IsValid() const { return m_valid; }
|
|
|
|
const std::vector<u8>& GetCertificateChain() const { return m_certificate_chain; }
|
2017-02-11 07:57:47 +00:00
|
|
|
const IOS::ES::TicketReader& GetTicket() const { return m_ticket; }
|
|
|
|
const IOS::ES::TMDReader& GetTMD() const { return m_tmd; }
|
2016-06-24 08:43:46 +00:00
|
|
|
const std::vector<u8>& GetDataApp() const { return m_data_app; }
|
|
|
|
const std::vector<u8>& GetFooter() const { return m_footer; }
|
2017-05-14 10:05:43 +00:00
|
|
|
std::vector<u8> GetContent(u16 index) const;
|
|
|
|
|
2009-07-06 02:10:26 +00:00
|
|
|
private:
|
2017-05-14 10:05:43 +00:00
|
|
|
bool ParseWAD();
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2017-07-04 13:37:41 +00:00
|
|
|
bool m_valid = false;
|
2009-07-06 02:10:26 +00:00
|
|
|
|
2017-06-06 09:49:01 +00:00
|
|
|
std::unique_ptr<BlobReader> m_reader;
|
2017-05-14 10:05:43 +00:00
|
|
|
|
|
|
|
u64 m_data_app_offset = 0;
|
2016-06-24 08:43:46 +00:00
|
|
|
std::vector<u8> m_certificate_chain;
|
2017-02-11 07:57:47 +00:00
|
|
|
IOS::ES::TicketReader m_ticket;
|
|
|
|
IOS::ES::TMDReader m_tmd;
|
2016-06-24 08:43:46 +00:00
|
|
|
std::vector<u8> m_data_app;
|
|
|
|
std::vector<u8> m_footer;
|
2009-07-06 02:10:26 +00:00
|
|
|
};
|
|
|
|
}
|