mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Fixes spacing for "for", "while", "switch" and "if"
Also moved && and || to ends of lines instead of start. Fixed misc vertical alignments and some { needed newlining.
This commit is contained in:
@ -45,21 +45,21 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume)
|
||||
// Creating title folder
|
||||
sprintf(titleFolder, "%stitle/%08x/%08x/data/",
|
||||
File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(TitleID>>32), (u32)TitleID);
|
||||
if(!File::Exists(titleFolder))
|
||||
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);
|
||||
|
||||
if(!_rFileSystem.ExportFile("opening.bnr", bnrFilename)) {
|
||||
if (!_rFileSystem.ExportFile("opening.bnr", bnrFilename)) {
|
||||
m_IsValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
CARCFile bnrArc (bnrFilename, 0x600);
|
||||
|
||||
if(!bnrArc.ExportFile("meta/banner.bin", Filename)) {
|
||||
if (!bnrArc.ExportFile("meta/banner.bin", Filename)) {
|
||||
m_IsValid = false;
|
||||
return;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ bool DriveReader::ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8 *o
|
||||
}
|
||||
#else
|
||||
fseeko(file_.GetHandle(), m_blocksize*block_num, SEEK_SET);
|
||||
if(fread(out_ptr, 1, m_blocksize * num_blocks, file_.GetHandle()) != m_blocksize * num_blocks)
|
||||
if (fread(out_ptr, 1, m_blocksize * num_blocks, file_.GetHandle()) != m_blocksize * num_blocks)
|
||||
return false;
|
||||
#endif
|
||||
return true;
|
||||
|
@ -336,7 +336,7 @@ const INANDContentLoader& CNANDContentManager::GetNANDLoader(const std::string&
|
||||
{
|
||||
CNANDContentMap::iterator lb = m_Map.lower_bound(_rName);
|
||||
|
||||
if(lb == m_Map.end() || (m_Map.key_comp()(_rName, lb->first)))
|
||||
if (lb == m_Map.end() || (m_Map.key_comp()(_rName, lb->first)))
|
||||
{
|
||||
m_Map.insert(lb, CNANDContentMap::value_type(_rName, new CNANDContentLoader(_rName)));
|
||||
}
|
||||
@ -367,7 +367,7 @@ bool CNANDContentManager::RemoveTitle(u64 _titleID)
|
||||
void CNANDContentLoader::RemoveTitle() const
|
||||
{
|
||||
INFO_LOG(DISCIO, "RemoveTitle %08x/%08x", (u32)(m_TitleID >> 32), (u32)m_TitleID);
|
||||
if(IsValid())
|
||||
if (IsValid())
|
||||
{
|
||||
// remove tmd?
|
||||
for (u32 i = 0; i < m_numEntries; i++)
|
||||
|
@ -81,7 +81,7 @@ IVolume::ECountry CountrySwitch(u8 CountryCode)
|
||||
|
||||
u8 GetSysMenuRegion(u16 _TitleVersion)
|
||||
{
|
||||
switch(_TitleVersion)
|
||||
switch (_TitleVersion)
|
||||
{
|
||||
case 128: case 192: case 224: case 256:
|
||||
case 288: case 352: case 384: case 416:
|
||||
|
@ -42,7 +42,7 @@ CVolumeDirectory::CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii,
|
||||
SetUniqueID("AGBJ01");
|
||||
SetName("Default name");
|
||||
|
||||
if(_bIsWii)
|
||||
if (_bIsWii)
|
||||
{
|
||||
SetDiskTypeWii();
|
||||
}
|
||||
@ -92,60 +92,60 @@ bool CVolumeDirectory::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const
|
||||
bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
||||
{
|
||||
// header
|
||||
if(_Offset < DISKHEADERINFO_ADDRESS)
|
||||
if (_Offset < DISKHEADERINFO_ADDRESS)
|
||||
{
|
||||
WriteToBuffer(DISKHEADER_ADDRESS, DISKHEADERINFO_ADDRESS, m_diskHeader, _Offset, _Length, _pBuffer);
|
||||
}
|
||||
// header info
|
||||
if(_Offset >= DISKHEADERINFO_ADDRESS && _Offset < APPLOADER_ADDRESS)
|
||||
if (_Offset >= DISKHEADERINFO_ADDRESS && _Offset < APPLOADER_ADDRESS)
|
||||
{
|
||||
WriteToBuffer(DISKHEADERINFO_ADDRESS, sizeof(m_diskHeaderInfo), (u8*)m_diskHeaderInfo, _Offset, _Length, _pBuffer);
|
||||
}
|
||||
// apploader
|
||||
if(_Offset >= APPLOADER_ADDRESS && _Offset < APPLOADER_ADDRESS + m_apploaderSize)
|
||||
if (_Offset >= APPLOADER_ADDRESS && _Offset < APPLOADER_ADDRESS + m_apploaderSize)
|
||||
{
|
||||
WriteToBuffer(APPLOADER_ADDRESS, m_apploaderSize, m_apploader, _Offset, _Length, _pBuffer);
|
||||
}
|
||||
// dol
|
||||
if(_Offset >= DOL_ADDRESS && _Offset < DOL_ADDRESS + m_DOLSize)
|
||||
if (_Offset >= DOL_ADDRESS && _Offset < DOL_ADDRESS + m_DOLSize)
|
||||
{
|
||||
WriteToBuffer(DOL_ADDRESS, m_DOLSize, m_DOL, _Offset, _Length, _pBuffer);
|
||||
}
|
||||
// fst
|
||||
if(_Offset >= FST_ADDRESS && _Offset < m_dataStartAddress)
|
||||
if (_Offset >= FST_ADDRESS && _Offset < m_dataStartAddress)
|
||||
{
|
||||
WriteToBuffer(FST_ADDRESS, m_fstSize, m_FSTData, _Offset, _Length, _pBuffer);
|
||||
}
|
||||
|
||||
if(m_virtualDisk.empty())
|
||||
if (m_virtualDisk.empty())
|
||||
return true;
|
||||
|
||||
// Determine which file the offset refers to
|
||||
std::map<u64, std::string>::const_iterator fileIter = m_virtualDisk.lower_bound(_Offset);
|
||||
if(fileIter->first > _Offset && fileIter != m_virtualDisk.begin())
|
||||
if (fileIter->first > _Offset && fileIter != m_virtualDisk.begin())
|
||||
--fileIter;
|
||||
|
||||
// zero fill to start of file data
|
||||
PadToAddress(fileIter->first, _Offset, _Length, _pBuffer);
|
||||
|
||||
while(fileIter != m_virtualDisk.end() && _Length > 0)
|
||||
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());
|
||||
if(reader == nullptr)
|
||||
if (reader == nullptr)
|
||||
return false;
|
||||
|
||||
u64 fileSize = reader->GetDataSize();
|
||||
|
||||
if(fileOffset < fileSize)
|
||||
if (fileOffset < fileSize)
|
||||
{
|
||||
u64 fileBytes = fileSize - fileOffset;
|
||||
if(_Length < fileBytes)
|
||||
if (_Length < fileBytes)
|
||||
fileBytes = _Length;
|
||||
|
||||
if(!reader->Read(fileOffset, fileBytes, _pBuffer))
|
||||
if (!reader->Read(fileOffset, fileBytes, _pBuffer))
|
||||
return false;
|
||||
|
||||
_Length -= fileBytes;
|
||||
@ -155,7 +155,7 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
|
||||
|
||||
++fileIter;
|
||||
|
||||
if(fileIter != m_virtualDisk.end())
|
||||
if (fileIter != m_virtualDisk.end())
|
||||
{
|
||||
_dbg_assert_(DVDINTERFACE, fileIter->first >= _Offset);
|
||||
PadToAddress(fileIter->first, _Offset, _Length, _pBuffer);
|
||||
@ -184,7 +184,7 @@ void CVolumeDirectory::SetUniqueID(std::string _ID)
|
||||
_dbg_assert_(DVDINTERFACE, m_diskHeader);
|
||||
|
||||
u32 length = (u32)_ID.length();
|
||||
if(length > 6)
|
||||
if (length > 6)
|
||||
length = 6;
|
||||
|
||||
memcpy(m_diskHeader, _ID.c_str(), length);
|
||||
@ -215,8 +215,8 @@ void CVolumeDirectory::SetName(std::string _Name)
|
||||
_dbg_assert_(DVDINTERFACE, m_diskHeader);
|
||||
|
||||
u32 length = (u32)_Name.length();
|
||||
if(length > MAX_NAME_LENGTH)
|
||||
length = MAX_NAME_LENGTH;
|
||||
if (length > MAX_NAME_LENGTH)
|
||||
length = MAX_NAME_LENGTH;
|
||||
|
||||
memcpy(m_diskHeader + 0x20, _Name.c_str(), length);
|
||||
m_diskHeader[length + 0x20] = 0;
|
||||
@ -248,13 +248,13 @@ std::string CVolumeDirectory::ExtractDirectoryName(const std::string& _rDirector
|
||||
|
||||
size_t lastSep = directoryName.find_last_of(DIR_SEP_CHR);
|
||||
|
||||
if(lastSep != directoryName.size() - 1)
|
||||
if (lastSep != directoryName.size() - 1)
|
||||
{
|
||||
// TODO: This assumes that file names will always have a dot in them
|
||||
// and directory names never will; both assumptions are often
|
||||
// right but in general wrong.
|
||||
size_t extensionStart = directoryName.find_last_of('.');
|
||||
if(extensionStart != std::string::npos && extensionStart > lastSep)
|
||||
if (extensionStart != std::string::npos && extensionStart > lastSep)
|
||||
{
|
||||
directoryName.resize(lastSep);
|
||||
}
|
||||
@ -345,7 +345,7 @@ void CVolumeDirectory::SetDOL(const std::string& _rDOL)
|
||||
|
||||
void CVolumeDirectory::BuildFST()
|
||||
{
|
||||
if(m_FSTData)
|
||||
if (m_FSTData)
|
||||
{
|
||||
delete m_FSTData;
|
||||
}
|
||||
@ -374,7 +374,7 @@ void CVolumeDirectory::BuildFST()
|
||||
// write root entry
|
||||
WriteEntryData(fstOffset, DIRECTORY_ENTRY, 0, 0, totalEntries);
|
||||
|
||||
for(auto& entry : rootEntry.children)
|
||||
for (auto& entry : rootEntry.children)
|
||||
{
|
||||
WriteEntry(entry, fstOffset, nameOffset, curDataAddress, rootOffset);
|
||||
}
|
||||
@ -392,17 +392,17 @@ void CVolumeDirectory::BuildFST()
|
||||
void CVolumeDirectory::WriteToBuffer(u64 _SrcStartAddress, u64 _SrcLength, u8* _Src,
|
||||
u64& _Address, u64& _Length, u8*& _pBuffer) const
|
||||
{
|
||||
if(_Length == 0)
|
||||
if (_Length == 0)
|
||||
return;
|
||||
|
||||
_dbg_assert_(DVDINTERFACE, _Address >= _SrcStartAddress);
|
||||
|
||||
u64 srcOffset = _Address - _SrcStartAddress;
|
||||
|
||||
if(srcOffset < _SrcLength)
|
||||
if (srcOffset < _SrcLength)
|
||||
{
|
||||
u64 srcBytes = _SrcLength - srcOffset;
|
||||
if(_Length < srcBytes)
|
||||
if (_Length < srcBytes)
|
||||
srcBytes = _Length;
|
||||
|
||||
memcpy(_pBuffer, _Src + srcOffset, (size_t)srcBytes);
|
||||
@ -415,14 +415,14 @@ void CVolumeDirectory::WriteToBuffer(u64 _SrcStartAddress, u64 _SrcLength, u8* _
|
||||
|
||||
void CVolumeDirectory::PadToAddress(u64 _StartAddress, u64& _Address, u64& _Length, u8*& _pBuffer) const
|
||||
{
|
||||
if(_StartAddress <= _Address)
|
||||
if (_StartAddress <= _Address)
|
||||
return;
|
||||
|
||||
u64 padBytes = _StartAddress - _Address;
|
||||
if(padBytes > _Length)
|
||||
if (padBytes > _Length)
|
||||
padBytes = _Length;
|
||||
|
||||
if(_Length > 0)
|
||||
if (_Length > 0)
|
||||
{
|
||||
memset(_pBuffer, 0, (size_t)padBytes);
|
||||
_Length -= padBytes;
|
||||
@ -463,14 +463,14 @@ void CVolumeDirectory::WriteEntryName(u32& nameOffset, const std::string& name)
|
||||
|
||||
void CVolumeDirectory::WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u32& nameOffset, u64& dataOffset, u32 parentEntryNum)
|
||||
{
|
||||
if(entry.isDirectory)
|
||||
if (entry.isDirectory)
|
||||
{
|
||||
u32 myOffset = fstOffset;
|
||||
u32 myEntryNum = myOffset / ENTRY_SIZE;
|
||||
WriteEntryData(fstOffset, DIRECTORY_ENTRY, nameOffset, parentEntryNum, (u32)(myEntryNum + entry.size + 1));
|
||||
WriteEntryName(nameOffset, entry.virtualName);
|
||||
|
||||
for(const auto& child : entry.children)
|
||||
for (const auto& child : entry.children)
|
||||
{
|
||||
WriteEntry(child, fstOffset, nameOffset, dataOffset, myEntryNum);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ std::string CVolumeWAD::GetUniqueID() const
|
||||
u32 Offset = ALIGN_40(hdr_size) + ALIGN_40(cert_size);
|
||||
|
||||
char GameCode[8];
|
||||
if(!Read(Offset + 0x01E0, 4, (u8*)GameCode))
|
||||
if (!Read(Offset + 0x01E0, 4, (u8*)GameCode))
|
||||
return "0";
|
||||
|
||||
GameCode[4] = temp.at(0);
|
||||
@ -94,7 +94,7 @@ bool CVolumeWAD::GetTitleID(u8* _pBuffer) const
|
||||
{
|
||||
u32 Offset = ALIGN_40(hdr_size) + ALIGN_40(cert_size);
|
||||
|
||||
if(!Read(Offset + 0x01DC, 8, _pBuffer))
|
||||
if (!Read(Offset + 0x01DC, 8, _pBuffer))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -26,7 +26,7 @@ static inline u64 align(u64 value, u64 bounds)
|
||||
WbfsFileReader::WbfsFileReader(const char* filename)
|
||||
: m_total_files(0), m_size(0), m_wlba_table(nullptr), m_good(true)
|
||||
{
|
||||
if(!filename || (strlen(filename) < 4) || !OpenFiles(filename) || !ReadHeader())
|
||||
if (!filename || (strlen(filename) < 4) || !OpenFiles(filename) || !ReadHeader())
|
||||
{
|
||||
m_good = false;
|
||||
return;
|
||||
@ -40,7 +40,7 @@ WbfsFileReader::WbfsFileReader(const char* filename)
|
||||
|
||||
WbfsFileReader::~WbfsFileReader()
|
||||
{
|
||||
for(u32 i = 0; i != m_files.size(); ++ i)
|
||||
for (u32 i = 0; i != m_files.size(); ++ i)
|
||||
{
|
||||
delete m_files[i];
|
||||
}
|
||||
@ -52,18 +52,18 @@ bool WbfsFileReader::OpenFiles(const char* filename)
|
||||
{
|
||||
m_total_files = 0;
|
||||
|
||||
while(true)
|
||||
while (true)
|
||||
{
|
||||
file_entry* new_entry = new file_entry;
|
||||
|
||||
// Replace last character with index (e.g. wbfs = wbf1)
|
||||
std::string path = filename;
|
||||
if(0 != m_total_files)
|
||||
if (0 != m_total_files)
|
||||
{
|
||||
path[path.length() - 1] = '0' + m_total_files;
|
||||
}
|
||||
|
||||
if(!new_entry->file.Open(path, "rb"))
|
||||
if (!new_entry->file.Open(path, "rb"))
|
||||
{
|
||||
delete new_entry;
|
||||
return 0 != m_total_files;
|
||||
@ -89,7 +89,7 @@ bool WbfsFileReader::ReadHeader()
|
||||
m_files[0]->file.ReadBytes(&hd_sector_shift, 1);
|
||||
hd_sector_size = 1ull << hd_sector_shift;
|
||||
|
||||
if(m_size != hd_sector_count * hd_sector_size)
|
||||
if (m_size != hd_sector_count * hd_sector_size)
|
||||
{
|
||||
//printf("File size doesn't match expected size\n");
|
||||
return false;
|
||||
@ -100,7 +100,7 @@ bool WbfsFileReader::ReadHeader()
|
||||
wbfs_sector_size = 1ull << wbfs_sector_shift;
|
||||
wbfs_sector_count = m_size / wbfs_sector_size;
|
||||
|
||||
if(wbfs_sector_size < wii_sector_size)
|
||||
if (wbfs_sector_size < wii_sector_size)
|
||||
{
|
||||
//Setting this too low would case a very large memory allocation
|
||||
return false;
|
||||
@ -113,7 +113,7 @@ bool WbfsFileReader::ReadHeader()
|
||||
m_files[0]->file.Seek(2, SEEK_CUR);
|
||||
m_files[0]->file.ReadBytes(disc_table, 500);
|
||||
|
||||
if(0 == disc_table[0])
|
||||
if (0 == disc_table[0])
|
||||
{
|
||||
//printf("Game must be in 'slot 0'\n");
|
||||
return false;
|
||||
@ -124,7 +124,7 @@ bool WbfsFileReader::ReadHeader()
|
||||
|
||||
bool WbfsFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
|
||||
{
|
||||
while(nbytes)
|
||||
while (nbytes)
|
||||
{
|
||||
u64 read_size = 0;
|
||||
File::IOFile& data_file = SeekToCluster(offset, &read_size);
|
||||
@ -143,18 +143,18 @@ bool WbfsFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
|
||||
File::IOFile& WbfsFileReader::SeekToCluster(u64 offset, u64* available)
|
||||
{
|
||||
u64 base_cluster = offset >> wbfs_sector_shift;
|
||||
if(base_cluster < m_blocks_per_disc)
|
||||
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 ++)
|
||||
for (u32 i = 0; i != m_total_files; i ++)
|
||||
{
|
||||
if(final_address < (m_files[i]->base_address + m_files[i]->size))
|
||||
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);
|
||||
if(available)
|
||||
if (available)
|
||||
{
|
||||
u64 till_end_of_file = m_files[i]->size - (final_address - m_files[i]->base_address);
|
||||
u64 till_end_of_sector = wbfs_sector_size - cluster_offset;
|
||||
@ -175,7 +175,7 @@ WbfsFileReader* WbfsFileReader::Create(const char* filename)
|
||||
{
|
||||
WbfsFileReader* reader = new WbfsFileReader(filename);
|
||||
|
||||
if(reader->IsGood())
|
||||
if (reader->IsGood())
|
||||
{
|
||||
return reader;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ WiiWAD::WiiWAD(const std::string& _rName)
|
||||
if (pReader == nullptr || File::IsDirectory(_rName))
|
||||
{
|
||||
m_Valid = false;
|
||||
if(pReader) delete pReader;
|
||||
if (pReader) delete pReader;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ bool WiiWAD::IsWiiWAD(const std::string& _rName)
|
||||
if (Reader.Read32(0x00) == 0x20)
|
||||
{
|
||||
u32 WADTYpe = Reader.Read32(0x04);
|
||||
switch(WADTYpe)
|
||||
switch (WADTYpe)
|
||||
{
|
||||
case 0x49730000:
|
||||
case 0x69620000:
|
||||
|
Reference in New Issue
Block a user