summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/WbfsBlob.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/DiscIO/WbfsBlob.cpp')
-rw-r--r--Source/Core/DiscIO/WbfsBlob.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp
index 08cb4ec078..7f0a625968 100644
--- a/Source/Core/DiscIO/WbfsBlob.cpp
+++ b/Source/Core/DiscIO/WbfsBlob.cpp
@@ -40,10 +40,8 @@ WbfsFileReader::WbfsFileReader(const std::string& filename)
WbfsFileReader::~WbfsFileReader()
{
- for (u32 i = 0; i != m_files.size(); ++ i)
- {
- delete m_files[i];
- }
+ for (file_entry* entry : m_files)
+ delete entry;
delete[] m_wlba_table;
}
@@ -58,7 +56,7 @@ bool WbfsFileReader::OpenFiles(const std::string& filename)
// Replace last character with index (e.g. wbfs = wbf1)
std::string path = filename;
- if (0 != m_total_files)
+ if (m_total_files != 0)
{
path[path.length() - 1] = '0' + m_total_files;
}
@@ -73,7 +71,7 @@ bool WbfsFileReader::OpenFiles(const std::string& filename)
new_entry->size = new_entry->file.GetSize();
m_size += new_entry->size;
- m_total_files ++;
+ m_total_files++;
m_files.push_back(new_entry);
}
}
@@ -90,10 +88,7 @@ bool WbfsFileReader::ReadHeader()
m_hd_sector_size = 1ull << m_hd_sector_shift;
if (m_size != (m_hd_sector_count * m_hd_sector_size))
- {
- //printf("File size doesn't match expected size\n");
return false;
- }
// Read wbfs cluster info
m_files[0]->file.ReadBytes(&m_wbfs_sector_shift, 1);
@@ -101,10 +96,7 @@ bool WbfsFileReader::ReadHeader()
m_wbfs_sector_count = m_size / m_wbfs_sector_size;
if (m_wbfs_sector_size < WII_SECTOR_SIZE)
- {
- //Setting this too low would case a very large memory allocation
return false;
- }
m_blocks_per_disc = (WII_SECTOR_COUNT * WII_SECTOR_SIZE) / m_wbfs_sector_size;
m_disc_info_size = align(WII_DISC_HEADER_SIZE + m_blocks_per_disc * 2, m_hd_sector_size);
@@ -113,11 +105,8 @@ bool WbfsFileReader::ReadHeader()
m_files[0]->file.Seek(2, SEEK_CUR);
m_files[0]->file.ReadBytes(m_disc_table, 500);
- if (0 == m_disc_table[0])
- {
- //printf("Game must be in 'slot 0'\n");
+ if (m_disc_table[0] == 0)
return false;
- }
return true;
}
@@ -153,7 +142,7 @@ File::IOFile& WbfsFileReader::SeekToCluster(u64 offset, u64* available)
u64 cluster_offset = offset & (m_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))
{