mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
add *.user, Win32, and x64 build dir to ignore list for DebuggerUICommon and Unit Tests
add *.aps to ignore list for DolphinWX dir add eol-style native to 120 or so files git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3689 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,100 +1,100 @@
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _NAND_CONTENT_LOADER_H
|
||||
#define _NAND_CONTENT_LOADER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Blob.h"
|
||||
#include "Volume.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
struct SNANDContent
|
||||
{
|
||||
u32 m_ContentID;
|
||||
u16 m_Index;
|
||||
u16 m_Type;
|
||||
u32 m_Size;
|
||||
u8 m_SHA1Hash[20];
|
||||
u8 m_Header[36]; //all of the above
|
||||
|
||||
u8* m_pData;
|
||||
};
|
||||
|
||||
// pure virtual interface so just the NANDContentManager can create these files only
|
||||
class INANDContentLoader
|
||||
{
|
||||
public:
|
||||
|
||||
INANDContentLoader() {}
|
||||
|
||||
virtual ~INANDContentLoader() {}
|
||||
|
||||
virtual bool IsValid() const = 0;
|
||||
virtual u64 GetTitleID() const = 0;
|
||||
virtual u16 GetIosVersion() const = 0;
|
||||
virtual u32 GetBootIndex() const = 0;
|
||||
virtual size_t GetContentSize() const = 0;
|
||||
virtual const SNANDContent* GetContentByIndex(int _Index) const = 0;
|
||||
virtual const u8* GetTicketView() const = 0;
|
||||
virtual const u8* GetTmdHeader() const = 0;
|
||||
virtual const std::vector<SNANDContent>& GetContent() const = 0;
|
||||
virtual const u16 GetTitleVersion() const = 0;
|
||||
virtual const u16 GetNumEntries() const = 0;
|
||||
virtual const DiscIO::IVolume::ECountry GetCountry() const = 0;
|
||||
|
||||
enum
|
||||
{
|
||||
TICKET_VIEW_SIZE = 0x58,
|
||||
TMD_HEADER_SIZE = 0x1e4,
|
||||
CONTENT_HEADER_SIZE = 0x24
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// we open the NAND Content files to often... lets cache them
|
||||
class CNANDContentManager
|
||||
{
|
||||
public:
|
||||
|
||||
static CNANDContentManager& Access() { return m_Instance; }
|
||||
|
||||
const INANDContentLoader& GetNANDLoader(const std::string& _rName);
|
||||
|
||||
private:
|
||||
|
||||
CNANDContentManager() {};
|
||||
|
||||
~CNANDContentManager();
|
||||
|
||||
static CNANDContentManager m_Instance;
|
||||
|
||||
typedef std::map<std::string, INANDContentLoader*> CNANDContentMap;
|
||||
CNANDContentMap m_Map;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _NAND_CONTENT_LOADER_H
|
||||
#define _NAND_CONTENT_LOADER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Blob.h"
|
||||
#include "Volume.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
struct SNANDContent
|
||||
{
|
||||
u32 m_ContentID;
|
||||
u16 m_Index;
|
||||
u16 m_Type;
|
||||
u32 m_Size;
|
||||
u8 m_SHA1Hash[20];
|
||||
u8 m_Header[36]; //all of the above
|
||||
|
||||
u8* m_pData;
|
||||
};
|
||||
|
||||
// pure virtual interface so just the NANDContentManager can create these files only
|
||||
class INANDContentLoader
|
||||
{
|
||||
public:
|
||||
|
||||
INANDContentLoader() {}
|
||||
|
||||
virtual ~INANDContentLoader() {}
|
||||
|
||||
virtual bool IsValid() const = 0;
|
||||
virtual u64 GetTitleID() const = 0;
|
||||
virtual u16 GetIosVersion() const = 0;
|
||||
virtual u32 GetBootIndex() const = 0;
|
||||
virtual size_t GetContentSize() const = 0;
|
||||
virtual const SNANDContent* GetContentByIndex(int _Index) const = 0;
|
||||
virtual const u8* GetTicketView() const = 0;
|
||||
virtual const u8* GetTmdHeader() const = 0;
|
||||
virtual const std::vector<SNANDContent>& GetContent() const = 0;
|
||||
virtual const u16 GetTitleVersion() const = 0;
|
||||
virtual const u16 GetNumEntries() const = 0;
|
||||
virtual const DiscIO::IVolume::ECountry GetCountry() const = 0;
|
||||
|
||||
enum
|
||||
{
|
||||
TICKET_VIEW_SIZE = 0x58,
|
||||
TMD_HEADER_SIZE = 0x1e4,
|
||||
CONTENT_HEADER_SIZE = 0x24
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// we open the NAND Content files to often... lets cache them
|
||||
class CNANDContentManager
|
||||
{
|
||||
public:
|
||||
|
||||
static CNANDContentManager& Access() { return m_Instance; }
|
||||
|
||||
const INANDContentLoader& GetNANDLoader(const std::string& _rName);
|
||||
|
||||
private:
|
||||
|
||||
CNANDContentManager() {};
|
||||
|
||||
~CNANDContentManager();
|
||||
|
||||
static CNANDContentManager m_Instance;
|
||||
|
||||
typedef std::map<std::string, INANDContentLoader*> CNANDContentMap;
|
||||
CNANDContentMap m_Map;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,52 +1,52 @@
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Volume.h"
|
||||
#include "Blob.h"
|
||||
#include "NANDContentLoader.h"
|
||||
|
||||
// --- this volume type is used for Wad files ---
|
||||
// Some of this code might look redundant with the CNANDContentLoader class, however,
|
||||
// We do not do any decryption here, we do raw read, so things are -Faster-
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
class CVolumeWAD : public IVolume
|
||||
{
|
||||
public:
|
||||
CVolumeWAD(IBlobReader* _pReader);
|
||||
~CVolumeWAD();
|
||||
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
|
||||
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const { return false; }
|
||||
bool GetTitleID(u8* _pBuffer) const;
|
||||
std::string GetUniqueID() const;
|
||||
std::string GetMakerID() const;
|
||||
std::string GetName() const;
|
||||
u32 GetFSTSize() const { return 0; }
|
||||
std::string GetApploaderDate() const { return "0"; }
|
||||
ECountry GetCountry() const;
|
||||
u64 GetSize() const;
|
||||
|
||||
private:
|
||||
IBlobReader* m_pReader;
|
||||
u64 m_titleID;
|
||||
u32 OpeningBnrOffset, hdr_size, cert_size, tick_size, tmd_size, data_size;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Volume.h"
|
||||
#include "Blob.h"
|
||||
#include "NANDContentLoader.h"
|
||||
|
||||
// --- this volume type is used for Wad files ---
|
||||
// Some of this code might look redundant with the CNANDContentLoader class, however,
|
||||
// We do not do any decryption here, we do raw read, so things are -Faster-
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
class CVolumeWAD : public IVolume
|
||||
{
|
||||
public:
|
||||
CVolumeWAD(IBlobReader* _pReader);
|
||||
~CVolumeWAD();
|
||||
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
|
||||
bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const { return false; }
|
||||
bool GetTitleID(u8* _pBuffer) const;
|
||||
std::string GetUniqueID() const;
|
||||
std::string GetMakerID() const;
|
||||
std::string GetName() const;
|
||||
u32 GetFSTSize() const { return 0; }
|
||||
std::string GetApploaderDate() const { return "0"; }
|
||||
ECountry GetCountry() const;
|
||||
u64 GetSize() const;
|
||||
|
||||
private:
|
||||
IBlobReader* m_pReader;
|
||||
u64 m_titleID;
|
||||
u32 OpeningBnrOffset, hdr_size, cert_size, tick_size, tmd_size, data_size;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
@ -1,156 +1,156 @@
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "NANDContentLoader.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include "MathUtil.h"
|
||||
#include "FileUtil.h"
|
||||
#include "Log.h"
|
||||
#include "WiiWad.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
class CBlobBigEndianReader
|
||||
{
|
||||
public:
|
||||
CBlobBigEndianReader(DiscIO::IBlobReader& _rReader) : m_rReader(_rReader) {}
|
||||
|
||||
u32 Read32(u64 _Offset)
|
||||
{
|
||||
u32 Temp;
|
||||
m_rReader.Read(_Offset, 4, (u8*)&Temp);
|
||||
return(Common::swap32(Temp));
|
||||
}
|
||||
|
||||
private:
|
||||
DiscIO::IBlobReader& m_rReader;
|
||||
};
|
||||
|
||||
WiiWAD::WiiWAD(const std::string& _rName)
|
||||
{
|
||||
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str());
|
||||
if (pReader == NULL)
|
||||
{
|
||||
m_Valid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_Valid = ParseWAD(*pReader);
|
||||
delete pReader;
|
||||
}
|
||||
|
||||
WiiWAD::~WiiWAD()
|
||||
{
|
||||
if (m_Valid)
|
||||
{
|
||||
delete m_pCertificateChain;
|
||||
delete m_pTicket;
|
||||
delete m_pTMD;
|
||||
delete m_pDataApp;
|
||||
delete m_pFooter;
|
||||
}
|
||||
}
|
||||
|
||||
u8* WiiWAD::CreateWADEntry(DiscIO::IBlobReader& _rReader, u32 _Size, u64 _Offset)
|
||||
{
|
||||
if (_Size > 0)
|
||||
{
|
||||
u8* pTmpBuffer = new u8[_Size];
|
||||
_dbg_assert_msg_(BOOT, pTmpBuffer!=0, "WiiWAD: Cant allocate memory for WAD entry");
|
||||
|
||||
if (!_rReader.Read(_Offset, _Size, pTmpBuffer))
|
||||
{
|
||||
ERROR_LOG(DISCIO, "WiiWAD: Could not read from file");
|
||||
PanicAlert("WiiWAD: Could not read from file");
|
||||
}
|
||||
return pTmpBuffer;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
bool WiiWAD::ParseWAD(DiscIO::IBlobReader& _rReader)
|
||||
{
|
||||
CBlobBigEndianReader ReaderBig(_rReader);
|
||||
|
||||
// get header size
|
||||
u32 HeaderSize = ReaderBig.Read32(0);
|
||||
if (HeaderSize != 0x20)
|
||||
{
|
||||
_dbg_assert_msg_(BOOT, (HeaderSize==0x20), "WiiWAD: Header size != 0x20");
|
||||
return false;
|
||||
}
|
||||
|
||||
// get header
|
||||
u8 Header[0x20];
|
||||
_rReader.Read(0, HeaderSize, Header);
|
||||
u32 HeaderType = ReaderBig.Read32(0x4);
|
||||
if ((0x49730000 != HeaderType) && (0x69620000 != HeaderType))
|
||||
return false;
|
||||
|
||||
m_CertificateChainSize = ReaderBig.Read32(0x8);
|
||||
u32 Reserved = ReaderBig.Read32(0xC);
|
||||
m_TicketSize = ReaderBig.Read32(0x10);
|
||||
m_TMDSize = ReaderBig.Read32(0x14);
|
||||
m_DataAppSize = ReaderBig.Read32(0x18);
|
||||
m_FooterSize = ReaderBig.Read32(0x1C);
|
||||
_dbg_assert_msg_(BOOT, Reserved==0x00, "WiiWAD: Reserved must be 0x00");
|
||||
|
||||
u32 Offset = 0x40;
|
||||
m_pCertificateChain = CreateWADEntry(_rReader, m_CertificateChainSize, Offset); Offset += ROUND_UP(m_CertificateChainSize, 0x40);
|
||||
m_pTicket = CreateWADEntry(_rReader, m_TicketSize, Offset); Offset += ROUND_UP(m_TicketSize, 0x40);
|
||||
m_pTMD = CreateWADEntry(_rReader, m_TMDSize, Offset); Offset += ROUND_UP(m_TMDSize, 0x40);
|
||||
m_pDataApp = CreateWADEntry(_rReader, m_DataAppSize, Offset); Offset += ROUND_UP(m_DataAppSize, 0x40);
|
||||
m_pFooter = CreateWADEntry(_rReader, m_FooterSize, Offset); Offset += ROUND_UP(m_FooterSize, 0x40);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WiiWAD::IsWiiWAD(const std::string& _rName)
|
||||
{
|
||||
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str());
|
||||
if (pReader == NULL)
|
||||
return false;
|
||||
|
||||
CBlobBigEndianReader Reader(*pReader);
|
||||
bool Result = false;
|
||||
|
||||
// check for wii wad
|
||||
if (Reader.Read32(0x00) == 0x20)
|
||||
{
|
||||
u32 WADTYpe = Reader.Read32(0x04);
|
||||
switch(WADTYpe)
|
||||
{
|
||||
case 0x49730000:
|
||||
case 0x69620000:
|
||||
Result = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete pReader;
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace end
|
||||
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "NANDContentLoader.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include "MathUtil.h"
|
||||
#include "FileUtil.h"
|
||||
#include "Log.h"
|
||||
#include "WiiWad.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
class CBlobBigEndianReader
|
||||
{
|
||||
public:
|
||||
CBlobBigEndianReader(DiscIO::IBlobReader& _rReader) : m_rReader(_rReader) {}
|
||||
|
||||
u32 Read32(u64 _Offset)
|
||||
{
|
||||
u32 Temp;
|
||||
m_rReader.Read(_Offset, 4, (u8*)&Temp);
|
||||
return(Common::swap32(Temp));
|
||||
}
|
||||
|
||||
private:
|
||||
DiscIO::IBlobReader& m_rReader;
|
||||
};
|
||||
|
||||
WiiWAD::WiiWAD(const std::string& _rName)
|
||||
{
|
||||
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str());
|
||||
if (pReader == NULL)
|
||||
{
|
||||
m_Valid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_Valid = ParseWAD(*pReader);
|
||||
delete pReader;
|
||||
}
|
||||
|
||||
WiiWAD::~WiiWAD()
|
||||
{
|
||||
if (m_Valid)
|
||||
{
|
||||
delete m_pCertificateChain;
|
||||
delete m_pTicket;
|
||||
delete m_pTMD;
|
||||
delete m_pDataApp;
|
||||
delete m_pFooter;
|
||||
}
|
||||
}
|
||||
|
||||
u8* WiiWAD::CreateWADEntry(DiscIO::IBlobReader& _rReader, u32 _Size, u64 _Offset)
|
||||
{
|
||||
if (_Size > 0)
|
||||
{
|
||||
u8* pTmpBuffer = new u8[_Size];
|
||||
_dbg_assert_msg_(BOOT, pTmpBuffer!=0, "WiiWAD: Cant allocate memory for WAD entry");
|
||||
|
||||
if (!_rReader.Read(_Offset, _Size, pTmpBuffer))
|
||||
{
|
||||
ERROR_LOG(DISCIO, "WiiWAD: Could not read from file");
|
||||
PanicAlert("WiiWAD: Could not read from file");
|
||||
}
|
||||
return pTmpBuffer;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
bool WiiWAD::ParseWAD(DiscIO::IBlobReader& _rReader)
|
||||
{
|
||||
CBlobBigEndianReader ReaderBig(_rReader);
|
||||
|
||||
// get header size
|
||||
u32 HeaderSize = ReaderBig.Read32(0);
|
||||
if (HeaderSize != 0x20)
|
||||
{
|
||||
_dbg_assert_msg_(BOOT, (HeaderSize==0x20), "WiiWAD: Header size != 0x20");
|
||||
return false;
|
||||
}
|
||||
|
||||
// get header
|
||||
u8 Header[0x20];
|
||||
_rReader.Read(0, HeaderSize, Header);
|
||||
u32 HeaderType = ReaderBig.Read32(0x4);
|
||||
if ((0x49730000 != HeaderType) && (0x69620000 != HeaderType))
|
||||
return false;
|
||||
|
||||
m_CertificateChainSize = ReaderBig.Read32(0x8);
|
||||
u32 Reserved = ReaderBig.Read32(0xC);
|
||||
m_TicketSize = ReaderBig.Read32(0x10);
|
||||
m_TMDSize = ReaderBig.Read32(0x14);
|
||||
m_DataAppSize = ReaderBig.Read32(0x18);
|
||||
m_FooterSize = ReaderBig.Read32(0x1C);
|
||||
_dbg_assert_msg_(BOOT, Reserved==0x00, "WiiWAD: Reserved must be 0x00");
|
||||
|
||||
u32 Offset = 0x40;
|
||||
m_pCertificateChain = CreateWADEntry(_rReader, m_CertificateChainSize, Offset); Offset += ROUND_UP(m_CertificateChainSize, 0x40);
|
||||
m_pTicket = CreateWADEntry(_rReader, m_TicketSize, Offset); Offset += ROUND_UP(m_TicketSize, 0x40);
|
||||
m_pTMD = CreateWADEntry(_rReader, m_TMDSize, Offset); Offset += ROUND_UP(m_TMDSize, 0x40);
|
||||
m_pDataApp = CreateWADEntry(_rReader, m_DataAppSize, Offset); Offset += ROUND_UP(m_DataAppSize, 0x40);
|
||||
m_pFooter = CreateWADEntry(_rReader, m_FooterSize, Offset); Offset += ROUND_UP(m_FooterSize, 0x40);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WiiWAD::IsWiiWAD(const std::string& _rName)
|
||||
{
|
||||
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str());
|
||||
if (pReader == NULL)
|
||||
return false;
|
||||
|
||||
CBlobBigEndianReader Reader(*pReader);
|
||||
bool Result = false;
|
||||
|
||||
// check for wii wad
|
||||
if (Reader.Read32(0x00) == 0x20)
|
||||
{
|
||||
u32 WADTYpe = Reader.Read32(0x04);
|
||||
switch(WADTYpe)
|
||||
{
|
||||
case 0x49730000:
|
||||
case 0x69620000:
|
||||
Result = true;
|
||||
}
|
||||
}
|
||||
|
||||
delete pReader;
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace end
|
||||
|
||||
|
@ -1,78 +1,78 @@
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _WII_WAD_H
|
||||
#define _WII_WAD_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Blob.h"
|
||||
#include "Volume.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
class WiiWAD
|
||||
{
|
||||
public:
|
||||
|
||||
WiiWAD(const std::string& _rName);
|
||||
|
||||
~WiiWAD();
|
||||
|
||||
bool IsValid() const { return m_Valid; }
|
||||
u32 GetCertificateChainSize() const { return m_CertificateChainSize; }
|
||||
u32 GetTicketSize() const { return m_TicketSize; }
|
||||
u32 GetTMDSize() const { return m_TMDSize; }
|
||||
u32 GetDataAppSize() const { return m_DataAppSize; }
|
||||
u32 GetFooterSize() const { return m_FooterSize; }
|
||||
|
||||
u8* GetCertificateChain() const { return m_pCertificateChain; }
|
||||
u8* GetTicket() const { return m_pTicket; }
|
||||
u8* GetTMD() const { return m_pTMD; }
|
||||
u8* GetDataApp() const { return m_pDataApp; }
|
||||
u8* GetFooter() const { return m_pFooter; }
|
||||
|
||||
static bool IsWiiWAD(const std::string& _rName);
|
||||
|
||||
private:
|
||||
|
||||
bool m_Valid;
|
||||
|
||||
u32 m_CertificateChainSize;
|
||||
u32 m_TicketSize;
|
||||
u32 m_TMDSize;
|
||||
u32 m_DataAppSize;
|
||||
u32 m_FooterSize;
|
||||
|
||||
u8* m_pCertificateChain;
|
||||
u8* m_pTicket;
|
||||
u8* m_pTMD;
|
||||
u8* m_pDataApp;
|
||||
u8* m_pFooter;
|
||||
|
||||
u8* CreateWADEntry(DiscIO::IBlobReader& _rReader, u32 _Size, u64 _Offset);
|
||||
bool ParseWAD(DiscIO::IBlobReader& _rReader);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _WII_WAD_H
|
||||
#define _WII_WAD_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Blob.h"
|
||||
#include "Volume.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
class WiiWAD
|
||||
{
|
||||
public:
|
||||
|
||||
WiiWAD(const std::string& _rName);
|
||||
|
||||
~WiiWAD();
|
||||
|
||||
bool IsValid() const { return m_Valid; }
|
||||
u32 GetCertificateChainSize() const { return m_CertificateChainSize; }
|
||||
u32 GetTicketSize() const { return m_TicketSize; }
|
||||
u32 GetTMDSize() const { return m_TMDSize; }
|
||||
u32 GetDataAppSize() const { return m_DataAppSize; }
|
||||
u32 GetFooterSize() const { return m_FooterSize; }
|
||||
|
||||
u8* GetCertificateChain() const { return m_pCertificateChain; }
|
||||
u8* GetTicket() const { return m_pTicket; }
|
||||
u8* GetTMD() const { return m_pTMD; }
|
||||
u8* GetDataApp() const { return m_pDataApp; }
|
||||
u8* GetFooter() const { return m_pFooter; }
|
||||
|
||||
static bool IsWiiWAD(const std::string& _rName);
|
||||
|
||||
private:
|
||||
|
||||
bool m_Valid;
|
||||
|
||||
u32 m_CertificateChainSize;
|
||||
u32 m_TicketSize;
|
||||
u32 m_TMDSize;
|
||||
u32 m_DataAppSize;
|
||||
u32 m_FooterSize;
|
||||
|
||||
u8* m_pCertificateChain;
|
||||
u8* m_pTicket;
|
||||
u8* m_pTMD;
|
||||
u8* m_pDataApp;
|
||||
u8* m_pFooter;
|
||||
|
||||
u8* CreateWADEntry(DiscIO::IBlobReader& _rReader, u32 _Size, u64 _Offset);
|
||||
bool ParseWAD(DiscIO::IBlobReader& _rReader);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user