Filesystem: Use file info in arguments instead of path

Some callers already have the file info, making the relatively slow
FindFileInfo calls unnecessary. Callers that didn't have the file info
will now need to call FindFileInfo on their own.
This commit is contained in:
JosJuice
2015-07-30 15:06:23 +02:00
parent 3d5ef948d0
commit 7c45afecb2
7 changed files with 53 additions and 39 deletions

View File

@ -177,7 +177,11 @@ void VolumeGC::LoadBannerFile() const
if (!file_system)
return;
size_t file_size = static_cast<size_t>(file_system->GetFileSize("opening.bnr"));
const FileInfo* file_info = file_system->FindFileInfo("opening.bnr");
if (!file_info)
return;
size_t file_size = static_cast<size_t>(file_info->GetSize());
constexpr int BNR1_MAGIC = 0x31524e42;
constexpr int BNR2_MAGIC = 0x32524e42;
if (file_size != BNR1_SIZE && file_size != BNR2_SIZE)
@ -186,7 +190,11 @@ void VolumeGC::LoadBannerFile() const
return;
}
file_system->ReadFile("opening.bnr", reinterpret_cast<u8*>(&banner_file), file_size);
if (file_size != file_system->ReadFile(file_info, reinterpret_cast<u8*>(&banner_file), file_size))
{
WARN_LOG(DISCIO, "Could not read opening.bnr.");
return;
}
bool is_bnr1;
if (banner_file.id == BNR1_MAGIC && file_size == BNR1_SIZE)