mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Run code through the advanced tool 'sed' to remove trailing whitespace.
This commit is contained in:
@ -103,7 +103,7 @@ std::vector<std::string> CBannerLoaderGC::GetNames()
|
||||
names.push_back(GetDecodedString(data));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ class CBannerLoaderGC
|
||||
std::string GetDecodedString(const char (&data)[N])
|
||||
{
|
||||
auto const string_decoder = CVolumeGC::GetStringDecoder(m_country);
|
||||
|
||||
|
||||
// strnlen to trim NULLs
|
||||
return string_decoder(std::string(data, strnlen(data, sizeof(data))));
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume)
|
||||
CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume)
|
||||
: m_pBannerFile(NULL)
|
||||
, m_IsValid(false)
|
||||
{
|
||||
@ -42,7 +42,7 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume)
|
||||
File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(TitleID>>32), (u32)TitleID);
|
||||
if(!File::Exists(titleFolder))
|
||||
File::CreateFullPath(titleFolder);
|
||||
|
||||
|
||||
// Extracting banner.bin from opening.bnr
|
||||
sprintf(bnrFilename, "%stitle/%08x/%08x/data/opening.bnr",
|
||||
File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(TitleID>>32), (u32)TitleID);
|
||||
@ -61,7 +61,7 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume)
|
||||
|
||||
// Now we have an LZ77-compressed file with a short IMD5 header
|
||||
// TODO: Finish the job
|
||||
|
||||
|
||||
File::Delete(bnrFilename);
|
||||
#else
|
||||
m_IsValid = false;
|
||||
@ -115,15 +115,15 @@ bool CBannerLoaderWii::GetStringFromComments(const CommentIndex index, std::stri
|
||||
{
|
||||
auto const banner = reinterpret_cast<const SWiiBanner*>(m_pBannerFile);
|
||||
auto const src_ptr = banner->m_Comment[index];
|
||||
|
||||
|
||||
// Trim at first NULL
|
||||
auto const length = std::find(src_ptr, src_ptr + COMMENT_SIZE, 0x0) - src_ptr;
|
||||
|
||||
|
||||
std::wstring src;
|
||||
src.resize(length);
|
||||
std::transform(src_ptr, src_ptr + src.size(), src.begin(), (u16(&)(u16))Common::swap16);
|
||||
result = UTF16ToUTF8(src);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ bool CBannerLoaderWii::GetStringFromComments(const CommentIndex index, std::stri
|
||||
std::vector<std::string> CBannerLoaderWii::GetNames()
|
||||
{
|
||||
std::vector<std::string> ret(1);
|
||||
|
||||
|
||||
if (!GetStringFromComments(NAME_IDX, ret[0]))
|
||||
ret.clear();
|
||||
|
||||
|
@ -27,7 +27,7 @@ class CBannerLoaderWii
|
||||
virtual std::vector<std::string> GetDescriptions();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
TEXTURE_SIZE = 192 * 64 * 2,
|
||||
|
@ -39,7 +39,7 @@ const u8 *SectorReader::GetBlockData(u64 block_num)
|
||||
{
|
||||
return cache[0];
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
GetBlock(block_num, cache[0]);
|
||||
cache_tags[0] = block_num;
|
||||
|
@ -17,10 +17,10 @@ CISOFileReader::CISOFileReader(std::FILE* file)
|
||||
: m_file(file)
|
||||
{
|
||||
m_size = m_file.GetSize();
|
||||
|
||||
|
||||
CISOHeader header;
|
||||
m_file.ReadArray(&header, 1);
|
||||
|
||||
|
||||
m_block_size = header.block_size;
|
||||
|
||||
MapType count = 0;
|
||||
@ -55,7 +55,7 @@ bool CISOFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
|
||||
{
|
||||
auto const block = offset / m_block_size;
|
||||
auto const data_offset = offset % m_block_size;
|
||||
|
||||
|
||||
auto const bytes_to_read = std::min(m_block_size - data_offset, nbytes);
|
||||
if (block < CISO_MAP_SIZE && UNUSED_BLOCK_ID != m_ciso_map[block])
|
||||
{
|
||||
@ -77,7 +77,7 @@ bool CISOFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
|
||||
nbytes -= bytes_to_read;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,10 @@ struct CISOHeader
|
||||
{
|
||||
// "CISO"
|
||||
char magic[4];
|
||||
|
||||
|
||||
// little endian
|
||||
u32 block_size;
|
||||
|
||||
|
||||
// 0=unused, 1=used, others=invalid
|
||||
u8 map[CISO_MAP_SIZE];
|
||||
};
|
||||
@ -39,10 +39,10 @@ public:
|
||||
|
||||
private:
|
||||
CISOFileReader(std::FILE* file);
|
||||
|
||||
|
||||
typedef u16 MapType;
|
||||
static const MapType UNUSED_BLOCK_ID = -1;
|
||||
|
||||
|
||||
File::IOFile m_file;
|
||||
u64 m_size;
|
||||
u32 m_block_size;
|
||||
|
@ -89,7 +89,7 @@ void CompressedBlobReader::GetBlock(u64 block_num, u8 *out_ptr)
|
||||
|
||||
// clear unused part of zlib buffer. maybe this can be deleted when it works fully.
|
||||
memset(zlib_buffer + comp_block_size, 0, zlib_buffer_size - comp_block_size);
|
||||
|
||||
|
||||
m_file.Seek(offset, SEEK_SET);
|
||||
m_file.ReadBytes(zlib_buffer, comp_block_size);
|
||||
|
||||
|
@ -32,7 +32,7 @@ struct SPartitionHeader
|
||||
u64 TMDOffset;
|
||||
u32 CertChainSize;
|
||||
u64 CertChainOffset;
|
||||
// H3Size is always 0x18000
|
||||
// H3Size is always 0x18000
|
||||
u64 H3Offset;
|
||||
u64 DataOffset;
|
||||
u64 DataSize;
|
||||
|
@ -30,7 +30,7 @@ DriveReader::DriveReader(const char *drive)
|
||||
return;
|
||||
}
|
||||
delete [] buffer;
|
||||
|
||||
|
||||
#ifdef _LOCKDRIVE // Do we want to lock the drive?
|
||||
// Lock the compact disc in the CD-ROM drive to prevent accidental
|
||||
// removal while reading from it.
|
||||
|
@ -134,7 +134,7 @@ void FindFilename(u64 offset)
|
||||
// There's something wrong with the paths
|
||||
if (!fname || (strlen(fname) == 512))
|
||||
return;
|
||||
|
||||
|
||||
CheckFile(fname, pFileSystem->GetFileSize(fname));
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ bool CFileSystemGCWii::ExportDOL(const char* _rExportFolder) const
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -207,14 +207,14 @@ std::string CFileSystemGCWii::GetStringFromOffset(u64 _Offset) const
|
||||
data.resize(255);
|
||||
m_rVolume->Read(_Offset, data.size(), (u8*)&data[0]);
|
||||
data.erase(std::find(data.begin(), data.end(), 0x00), data.end());
|
||||
|
||||
|
||||
// TODO: Should we really always use SHIFT-JIS?
|
||||
// It makes some filenames in Pikmin (NTSC-U) sane, but is it correct?
|
||||
return SHIFTJISToUTF8(data);
|
||||
}
|
||||
|
||||
size_t CFileSystemGCWii::GetFileList(std::vector<const SFileInfo *> &_rFilenames)
|
||||
{
|
||||
{
|
||||
if (!m_Initialized)
|
||||
InitFileSystem();
|
||||
|
||||
|
@ -32,7 +32,7 @@ private:
|
||||
bool m_Initialized;
|
||||
bool m_Valid;
|
||||
u32 m_OffsetShift; // WII offsets are all shifted
|
||||
|
||||
|
||||
std::vector <SFileInfo> m_FileInfoVector;
|
||||
u32 Read32(u64 _Offset) const;
|
||||
std::string GetStringFromOffset(u64 _Offset) const;
|
||||
|
@ -24,7 +24,7 @@ struct SFileInfo
|
||||
memset(m_FullPath, 0, sizeof(m_FullPath));
|
||||
}
|
||||
|
||||
SFileInfo(const SFileInfo &rhs) : m_NameOffset(rhs.m_NameOffset),
|
||||
SFileInfo(const SFileInfo &rhs) : m_NameOffset(rhs.m_NameOffset),
|
||||
m_Offset(rhs.m_Offset), m_FileSize(rhs.m_FileSize) {
|
||||
memcpy(m_FullPath, rhs.m_FullPath, strlen(rhs.m_FullPath) + 1);
|
||||
}
|
||||
|
@ -238,10 +238,10 @@ bool CNANDContentLoader::Initialize(const std::string& _rName)
|
||||
m_Content.resize(m_numEntries);
|
||||
|
||||
|
||||
for (u32 i=0; i<m_numEntries; i++)
|
||||
for (u32 i=0; i<m_numEntries; i++)
|
||||
{
|
||||
SNANDContent& rContent = m_Content[i];
|
||||
|
||||
|
||||
rContent.m_ContentID = Common::swap32(pTMD + 0x01e4 + 0x24*i);
|
||||
rContent.m_Index = Common::swap16(pTMD + 0x01e8 + 0x24*i);
|
||||
rContent.m_Type = Common::swap16(pTMD + 0x01ea + 0x24*i);
|
||||
@ -253,7 +253,7 @@ bool CNANDContentLoader::Initialize(const std::string& _rName)
|
||||
{
|
||||
u32 RoundedSize = ROUND_UP(rContent.m_Size, 0x40);
|
||||
rContent.m_pData = new u8[RoundedSize];
|
||||
|
||||
|
||||
memset(IV, 0, sizeof IV);
|
||||
memcpy(IV, pTMD + 0x01e8 + 0x24*i, 2);
|
||||
AESDecode(DecryptTitleKey, IV, pDataApp, RoundedSize, rContent.m_pData);
|
||||
@ -293,7 +293,7 @@ void CNANDContentLoader::AESDecode(u8* _pKey, u8* _IV, u8* _pSrc, u32 _Size, u8*
|
||||
|
||||
void CNANDContentLoader::GetKeyFromTicket(u8* pTicket, u8* pTicketKey)
|
||||
{
|
||||
u8 CommonKey[16] = {0xeb,0xe4,0x2a,0x22,0x5e,0x85,0x93,0xe4,0x48,0xd9,0xc5,0x45,0x73,0x81,0xaa,0xf7};
|
||||
u8 CommonKey[16] = {0xeb,0xe4,0x2a,0x22,0x5e,0x85,0x93,0xe4,0x48,0xd9,0xc5,0x45,0x73,0x81,0xaa,0xf7};
|
||||
u8 IV[16];
|
||||
memset(IV, 0, sizeof IV);
|
||||
memcpy(IV, pTicket + 0x01dc, 8);
|
||||
@ -385,7 +385,7 @@ void cUIDsys::UpdateLocation()
|
||||
m_Elements.clear();
|
||||
lastUID = 0x00001000;
|
||||
sprintf(uidSys, "%ssys/uid.sys", File::GetUserPath(D_WIIUSER_IDX).c_str());
|
||||
|
||||
|
||||
File::IOFile pFile(uidSys, "rb");
|
||||
SElement Element;
|
||||
while (pFile.ReadArray(&Element, 1))
|
||||
@ -476,7 +476,7 @@ u64 CNANDContentManager::Install_WiiWAD(std::string &fileName)
|
||||
}
|
||||
|
||||
pTMDFile.WriteBytes(ContentLoader.GetTMDHeader(), INANDContentLoader::TMD_HEADER_SIZE);
|
||||
|
||||
|
||||
for (u32 i = 0; i < ContentLoader.GetContentSize(); i++)
|
||||
{
|
||||
const SNANDContent& Content = ContentLoader.GetContent()[i];
|
||||
@ -486,7 +486,7 @@ u64 CNANDContentManager::Install_WiiWAD(std::string &fileName)
|
||||
char APPFileName[1024];
|
||||
if (Content.m_Type & 0x8000) //shared
|
||||
{
|
||||
sprintf(APPFileName, "%s",
|
||||
sprintf(APPFileName, "%s",
|
||||
CSharedContent::AccessInstance().AddSharedContent(Content.m_SHA1Hash).c_str());
|
||||
}
|
||||
else
|
||||
@ -503,7 +503,7 @@ u64 CNANDContentManager::Install_WiiWAD(std::string &fileName)
|
||||
PanicAlertT("WAD installation failed: error creating %s", APPFileName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
pAPPFile.WriteBytes(Content.m_pData, Content.m_Size);
|
||||
}
|
||||
else
|
||||
@ -513,7 +513,7 @@ u64 CNANDContentManager::Install_WiiWAD(std::string &fileName)
|
||||
}
|
||||
|
||||
pTMDFile.Close();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
|
||||
virtual ECountry GetCountry() const = 0;
|
||||
virtual u64 GetSize() const = 0;
|
||||
|
||||
|
||||
// Size on disc (compressed size)
|
||||
virtual u64 GetRawSize() const = 0;
|
||||
};
|
||||
|
@ -8,12 +8,12 @@ namespace DiscIO
|
||||
{
|
||||
IVolume::ECountry CountrySwitch(u8 CountryCode)
|
||||
{
|
||||
switch (CountryCode)
|
||||
switch (CountryCode)
|
||||
{
|
||||
// Region free - fall through to European defaults for now
|
||||
case 'A':
|
||||
|
||||
|
||||
|
||||
// PAL
|
||||
case 'D': // German
|
||||
return IVolume::COUNTRY_GERMANY;
|
||||
@ -26,18 +26,18 @@ IVolume::ECountry CountrySwitch(u8 CountryCode)
|
||||
case 'M': // Japanese import to PAL regions
|
||||
case 'S': // Spanish-speaking regions
|
||||
case 'P':
|
||||
case 'U': // Australia
|
||||
case 'U': // Australia
|
||||
return IVolume::COUNTRY_EUROPE;
|
||||
break;
|
||||
|
||||
|
||||
case 'F':
|
||||
return IVolume::COUNTRY_FRANCE;
|
||||
break;
|
||||
|
||||
|
||||
case 'I':
|
||||
return IVolume::COUNTRY_ITALY;
|
||||
break;
|
||||
|
||||
|
||||
case 'R':
|
||||
return IVolume::COUNTRY_RUSSIA;
|
||||
break;
|
||||
|
@ -108,7 +108,7 @@ IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii,
|
||||
{
|
||||
if (CVolumeDirectory::IsValidDirectory(_rDirectory))
|
||||
return new CVolumeDirectory(_rDirectory, _bIsWii, _rApploader, _rDOL);
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ static IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _Part
|
||||
std::vector<SPartition> PartitionsVec;
|
||||
};
|
||||
SPartitionGroup PartitionGroup[4];
|
||||
|
||||
|
||||
// read all partitions
|
||||
for (u32 x = 0; x < 4; x++)
|
||||
{
|
||||
@ -184,10 +184,10 @@ static IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _Part
|
||||
_rReader.Read(rPartition.Offset + 0x44c, 8, IV);
|
||||
|
||||
aes_context AES_ctx;
|
||||
aes_setkey_dec(&AES_ctx, (Korean ? g_MasterKeyK : g_MasterKey), 128);
|
||||
aes_setkey_dec(&AES_ctx, (Korean ? g_MasterKeyK : g_MasterKey), 128);
|
||||
|
||||
u8 VolumeKey[16];
|
||||
aes_crypt_cbc(&AES_ctx, AES_DECRYPT, 16, IV, SubKey, VolumeKey);
|
||||
aes_crypt_cbc(&AES_ctx, AES_DECRYPT, 16, IV, SubKey, VolumeKey);
|
||||
|
||||
// -1 means the caller just wanted the partition with matching type
|
||||
if ((int)_VolumeNum == -1 || i == _VolumeNum)
|
||||
|
@ -23,12 +23,12 @@ CVolumeDirectory::CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii,
|
||||
, FST_ADDRESS(0)
|
||||
, DOL_ADDRESS(0)
|
||||
{
|
||||
m_rootDirectory = ExtractDirectoryName(_rDirectory);
|
||||
m_rootDirectory = ExtractDirectoryName(_rDirectory);
|
||||
|
||||
// create the default disk header
|
||||
m_diskHeader = new u8[DISKHEADERINFO_ADDRESS];
|
||||
memset(m_diskHeader, 0, (size_t)DISKHEADERINFO_ADDRESS);
|
||||
SetUniqueID("AGBJ01");
|
||||
SetUniqueID("AGBJ01");
|
||||
SetName("Default name");
|
||||
|
||||
if(_bIsWii)
|
||||
@ -105,7 +105,7 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
||||
{
|
||||
WriteToBuffer(FST_ADDRESS, m_fstSize, m_FSTData, _Offset, _Length, _pBuffer);
|
||||
}
|
||||
|
||||
|
||||
if(m_virtualDisk.size() == 0)
|
||||
return true;
|
||||
|
||||
@ -118,16 +118,16 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
||||
PadToAddress(fileIter->first, _Offset, _Length, _pBuffer);
|
||||
|
||||
while(fileIter != m_virtualDisk.end() && _Length > 0)
|
||||
{
|
||||
{
|
||||
_dbg_assert_(DVDINTERFACE, fileIter->first <= _Offset);
|
||||
u64 fileOffset = _Offset - fileIter->first;
|
||||
|
||||
PlainFileReader* reader = PlainFileReader::Create(fileIter->second.c_str());
|
||||
PlainFileReader* reader = PlainFileReader::Create(fileIter->second.c_str());
|
||||
if(reader == NULL)
|
||||
return false;
|
||||
|
||||
u64 fileSize = reader->GetDataSize();
|
||||
|
||||
|
||||
if(fileOffset < fileSize)
|
||||
{
|
||||
u64 fileBytes = fileSize - fileOffset;
|
||||
@ -152,14 +152,14 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
||||
|
||||
delete reader;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string CVolumeDirectory::GetUniqueID() const
|
||||
{
|
||||
_dbg_assert_(DVDINTERFACE, m_diskHeader);
|
||||
|
||||
|
||||
char buffer[7];
|
||||
memcpy(buffer, m_diskHeader, 6);
|
||||
buffer[6] = 0;
|
||||
@ -182,7 +182,7 @@ void CVolumeDirectory::SetUniqueID(std::string _ID)
|
||||
IVolume::ECountry CVolumeDirectory::GetCountry() const
|
||||
{
|
||||
_dbg_assert_(DVDINTERFACE, m_diskHeader);
|
||||
|
||||
|
||||
u8 CountryCode = m_diskHeader[3];
|
||||
|
||||
return CountrySwitch(CountryCode);
|
||||
@ -263,7 +263,7 @@ void CVolumeDirectory::SetDiskTypeWii()
|
||||
m_diskHeader[0x18] = 0x5d;
|
||||
m_diskHeader[0x19] = 0x1c;
|
||||
m_diskHeader[0x1a] = 0x9e;
|
||||
m_diskHeader[0x1b] = 0xa3;
|
||||
m_diskHeader[0x1b] = 0xa3;
|
||||
memset(m_diskHeader + 0x1c, 0, 4);
|
||||
|
||||
m_addressShift = 2;
|
||||
@ -399,7 +399,7 @@ void CVolumeDirectory::WriteToBuffer(u64 _SrcStartAddress, u64 _SrcLength, u8* _
|
||||
_Length -= srcBytes;
|
||||
_pBuffer += srcBytes;
|
||||
_Address += srcBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CVolumeDirectory::PadToAddress(u64 _StartAddress, u64& _Address, u64& _Length, u8*& _pBuffer) const
|
||||
@ -446,12 +446,12 @@ void CVolumeDirectory::WriteEntryData(u32& entryOffset, u8 type, u32 nameOffset,
|
||||
void CVolumeDirectory::WriteEntryName(u32& nameOffset, const std::string& name)
|
||||
{
|
||||
strncpy((char*)(m_FSTData + nameOffset + m_fstNameOffset), name.c_str(), name.length() + 1);
|
||||
|
||||
|
||||
nameOffset += (u32)(name.length() + 1);
|
||||
}
|
||||
|
||||
void CVolumeDirectory::WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u32& nameOffset, u64& dataOffset, u32 parentEntryNum)
|
||||
{
|
||||
{
|
||||
if(entry.isDirectory)
|
||||
{
|
||||
u32 myOffset = fstOffset;
|
||||
|
@ -96,7 +96,7 @@ private:
|
||||
u8* m_diskHeader;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct SDiskHeaderInfo
|
||||
struct SDiskHeaderInfo
|
||||
{
|
||||
u32 debug_mntr_size;
|
||||
u32 simulated_mem_size;
|
||||
|
@ -98,7 +98,7 @@ int CVolumeGC::GetRevision() const
|
||||
std::vector<std::string> CVolumeGC::GetNames() const
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
|
||||
|
||||
auto const string_decoder = GetStringDecoder(GetCountry());
|
||||
|
||||
char name[0x60 + 1] = {};
|
||||
|
@ -30,9 +30,9 @@ public:
|
||||
u64 GetSize() const;
|
||||
u64 GetRawSize() const;
|
||||
bool IsDiscTwo() const;
|
||||
|
||||
|
||||
typedef std::string(*StringDecoder)(const std::string&);
|
||||
|
||||
|
||||
static StringDecoder GetStringDecoder(ECountry country);
|
||||
|
||||
private:
|
||||
|
@ -104,15 +104,15 @@ std::vector<std::string> CVolumeWAD::GetNames() const
|
||||
{
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
footer_size = Common::swap32(footer_size);
|
||||
|
||||
|
||||
//Japanese, English, German, French, Spanish, Italian, Dutch, unknown, unknown, Korean
|
||||
for (int i = 0; i != 10; ++i)
|
||||
{
|
||||
static const u32 string_length = 42;
|
||||
static const u32 bytes_length = string_length * sizeof(u16);
|
||||
|
||||
|
||||
u16 temp[string_length];
|
||||
|
||||
if (footer_size < 0xF1 || !Read(0x9C + (i * bytes_length) + OpeningBnrOffset, bytes_length, (u8*)&temp))
|
||||
@ -125,7 +125,7 @@ std::vector<std::string> CVolumeWAD::GetNames() const
|
||||
out_temp.resize(string_length);
|
||||
std::transform(temp, temp + out_temp.size(), out_temp.begin(), (u16(&)(u16))Common::swap16);
|
||||
out_temp.erase(std::find(out_temp.begin(), out_temp.end(), 0x00), out_temp.end());
|
||||
|
||||
|
||||
names.push_back(UTF16ToUTF8(out_temp));
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
// --- 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-
|
||||
// We do not do any decryption here, we do raw read, so things are -Faster-
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
@ -27,7 +27,7 @@ public:
|
||||
std::string GetMakerID() const;
|
||||
std::vector<std::string> GetNames() const;
|
||||
u32 GetFSTSize() const { return 0; }
|
||||
std::string GetApploaderDate() const { return "0"; }
|
||||
std::string GetApploaderDate() const { return "0"; }
|
||||
ECountry GetCountry() const;
|
||||
u64 GetSize() const;
|
||||
u64 GetRawSize() const;
|
||||
|
@ -70,7 +70,7 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
|
||||
if (m_LastDecryptedBlockOffset != Block)
|
||||
{
|
||||
memcpy(IV, m_pBuffer + 0x3d0, 16);
|
||||
aes_crypt_cbc(m_AES_ctx, AES_DECRYPT, 0x7C00, IV, m_pBuffer + 0x400, m_LastDecryptedBlock);
|
||||
aes_crypt_cbc(m_AES_ctx, AES_DECRYPT, 0x7C00, IV, m_pBuffer + 0x400, m_LastDecryptedBlock);
|
||||
|
||||
m_LastDecryptedBlockOffset = Block;
|
||||
}
|
||||
@ -108,7 +108,7 @@ void CVolumeWiiCrypted::GetTMD(u8* _pBuffer, u32 * _sz) const
|
||||
RAWRead(m_VolumeOffset + tmdAddr, tmdSz, _pBuffer);
|
||||
*_sz = tmdSz;
|
||||
}
|
||||
|
||||
|
||||
std::string CVolumeWiiCrypted::GetUniqueID() const
|
||||
{
|
||||
if (m_pReader == NULL)
|
||||
@ -153,7 +153,7 @@ std::string CVolumeWiiCrypted::GetMakerID() const
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
|
||||
|
||||
makerID[2] = '\0';
|
||||
|
||||
return makerID;
|
||||
@ -162,7 +162,7 @@ std::string CVolumeWiiCrypted::GetMakerID() const
|
||||
std::vector<std::string> CVolumeWiiCrypted::GetNames() const
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
|
||||
|
||||
auto const string_decoder = CVolumeGC::GetStringDecoder(GetCountry());
|
||||
|
||||
char name[0xFF] = {};
|
||||
@ -202,7 +202,7 @@ std::string CVolumeWiiCrypted::GetApploaderDate() const
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
|
||||
|
||||
date[10] = '\0';
|
||||
|
||||
return date;
|
||||
@ -253,7 +253,7 @@ bool CVolumeWiiCrypted::CheckIntegrity() const
|
||||
NOTICE_LOG(DISCIO, "Integrity Check: fail at cluster %d: could not read metadata", clusterID);
|
||||
return false;
|
||||
}
|
||||
aes_crypt_cbc(m_AES_ctx, AES_DECRYPT, 0x400, IV, clusterMDCrypted, clusterMD);
|
||||
aes_crypt_cbc(m_AES_ctx, AES_DECRYPT, 0x400, IV, clusterMDCrypted, clusterMD);
|
||||
|
||||
|
||||
// Some clusters have invalid data and metadata because they aren't
|
||||
|
@ -138,13 +138,13 @@ File::IOFile& WbfsFileReader::SeekToCluster(u64 offset, u64* available)
|
||||
{
|
||||
u64 base_cluster = offset >> wbfs_sector_shift;
|
||||
if(base_cluster < m_blocks_per_disc)
|
||||
{
|
||||
{
|
||||
u64 cluster_address = wbfs_sector_size * Common::swap16(m_wlba_table[base_cluster]);
|
||||
u64 cluster_offset = offset & (wbfs_sector_size - 1);
|
||||
u64 final_address = cluster_address + cluster_offset;
|
||||
|
||||
for(u32 i = 0; i != m_total_files; i ++)
|
||||
{
|
||||
{
|
||||
if(final_address < (m_files[i]->base_address + m_files[i]->size))
|
||||
{
|
||||
m_files[i]->file.Seek(final_address - m_files[i]->base_address, SEEK_SET);
|
||||
@ -187,7 +187,7 @@ bool IsWbfsBlob(const char* filename)
|
||||
u8 magic[4] = {0, 0, 0, 0};
|
||||
f.ReadBytes(&magic, 4);
|
||||
|
||||
return (magic[0] == 'W') &&
|
||||
return (magic[0] == 'W') &&
|
||||
(magic[1] == 'B') &&
|
||||
(magic[2] == 'F') &&
|
||||
(magic[3] == 'S');
|
||||
|
@ -18,7 +18,7 @@ class WbfsFileReader : public IBlobReader
|
||||
WbfsFileReader(const char* filename);
|
||||
~WbfsFileReader();
|
||||
|
||||
bool OpenFiles(const char* filename);
|
||||
bool OpenFiles(const char* filename);
|
||||
bool ReadHeader();
|
||||
|
||||
File::IOFile& SeekToCluster(u64 offset, u64* available);
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "NANDContentLoader.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <cctype>
|
||||
#include "MathUtil.h"
|
||||
#include "FileUtil.h"
|
||||
#include "Log.h"
|
||||
@ -78,15 +78,15 @@ bool WiiWAD::ParseWAD(DiscIO::IBlobReader& _rReader)
|
||||
{
|
||||
CBlobBigEndianReader ReaderBig(_rReader);
|
||||
|
||||
// get header size
|
||||
// get header size
|
||||
u32 HeaderSize = ReaderBig.Read32(0);
|
||||
if (HeaderSize != 0x20)
|
||||
if (HeaderSize != 0x20)
|
||||
{
|
||||
_dbg_assert_msg_(BOOT, (HeaderSize==0x20), "WiiWAD: Header size != 0x20");
|
||||
return false;
|
||||
}
|
||||
|
||||
// get header
|
||||
// get header
|
||||
u8 Header[0x20];
|
||||
_rReader.Read(0, HeaderSize, Header);
|
||||
u32 HeaderType = ReaderBig.Read32(0x4);
|
||||
|
@ -30,13 +30,13 @@ public:
|
||||
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:
|
||||
|
Reference in New Issue
Block a user